Skip to content

Commit 58fc904

Browse files
committed
docs: update docs
1 parent dc58605 commit 58fc904

File tree

8 files changed

+128
-43
lines changed

8 files changed

+128
-43
lines changed

.npmignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
node_modules
22
.cache
3-
dist
4-
docs
3+
dist

packages/docs/content/2.get-started/1.guide/2.concepts.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ These are the core concepts you need to know about vue-final-modal and its appro
1313
::list{type=success}
1414
- SSR (Nuxt 3) support. [Teleport](/api/components/vue-final-modal#teleportto) your modals to `'body'`{lang=ts} by default.
1515
- `useModal()`{lang=ts} composable to manage your modal programmatically.
16-
- [focusTrap](/api/components/vue-final-modal#focustrap) for better web accessibility.
17-
- Full control to the zIndex of the nested modals with [zIndexFn prop](/api/components/vue-final-modal#zindexfn).
16+
- Trap keyboard focus within modal element (uses [focus-trap]([/api/components/vue-final-modal#focustrap](https://github.com/focus-trap/focus-trap)) for best web accessibility).
17+
- Full control to the zIndex of the nested modals (see [zIndexFn prop](/api/components/vue-final-modal#zindexfn)).
1818
- Customizable `<Transition>` for the modal content and overlay.
1919
- Provide Higher order components including [VFullscreen](/api/components/v-fullscreen) and [VBottomSheet](/api/components/v-bottom-sheet).
2020
::

packages/docs/content/3.api/1.components/1.vue-final-modal.md

Lines changed: 76 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,107 +27,159 @@ It will be helpful for understanding the naming of [props](#props).
2727
- Description:
2828
- Set `null | false` to disable teleport.
2929
- Checkout the [Nuxt 3 teleport](https://v3.nuxtjs.org/api/components/teleports/#teleport) for the reason why the default value have to be `'body'`{lang=ts}.
30-
- Type: `[String, null, Boolean, Object] as PropType<string | RendererElement | null | false>`{lang=ts}
30+
- Type:
31+
- JS: `[String, null, Boolean, Object]`{lang=ts}
32+
- TS: `PropType<string | RendererElement | null | false>`{lang=ts}
3133
- Default: `'body'`{lang=ts}
3234

33-
### modalId
35+
### modalId (optional)
3436

3537
`modalId` should be an uniq value for the operation of a modal via [useVfm()](/api/composables/use-vfm#usevfm).
36-
- Type: `[String, Number, Symbol] as PropType<ModalId>`{lang=ts}
37-
```ts
38-
export type ModalId = number | string | symbol
39-
```
38+
- Type:
39+
- JS: `[String, Number, Symbol]`{lang=ts}
40+
- TS: `PropType<ModalId>`{lang=ts}
41+
```ts
42+
export type ModalId = number | string | symbol
43+
```
44+
45+
```ts
46+
import { ModalId } from 'vue-final-modal'
47+
```
4048
- Default: `undefined`{lang=ts}
4149

42-
### modelValue
50+
### modelValue (optional)
4351

4452
Display the modal or not.
45-
- Type: `Boolean as PropType<boolean>`{lang=ts}
53+
- Type:
54+
- JS: `Boolean`{lang=ts}
55+
- TS: `PropType<boolean>`{lang=ts}
4656
- Default: `undefined`{lang=ts}
4757

4858
### displayDirective
4959

5060
Render the modal content via `'if'`{lang=ts} or `'show'`{lang=ts} directive.
51-
- Type: `String as PropType<'if' | 'show'>`{lang=ts}
61+
- Type:
62+
- JS: `'if' | 'show'`{lang=ts}
63+
- TS: `PropType<'if' | 'show'>`{lang=ts}
5264
- Default: `'if'`{lang=ts}
5365

5466
### hideOverlay
5567

5668
Hide the overlay or not.
57-
- Type: `Boolean as PropType<boolean>`{lang=ts}
69+
- Type:
70+
- JS: `Boolean`{lang=ts}
71+
- TS: `PropType<boolean>`{lang=ts}
5872
- Default: `undefined`{lang=ts}
5973

6074
### overlayTransition
6175

6276
Customize the overlay transition.
63-
- Type: `Object as PropType<TransitionProps>`{lang=ts}
77+
- Type:
78+
- JS: `Object`{lang=ts}
79+
- TS: `PropType<TransitionProps>`{lang=ts}
80+
- see interface [TransitionProps](https://vuejs.org/api/built-in-components.html#transition)
6481
- Default: `() => ({ name: 'vfm' })`{lang=ts}
6582
6683
### contentTransition
6784
6885
Customize the content transition.
69-
- Type: `Object as PropType<TransitionProps>`{lang=ts}
86+
- Type:
87+
- JS: `Object`{lang=ts}
88+
- TS: `PropType<TransitionProps>`{lang=ts}
89+
- see interface [TransitionProps](https://vuejs.org/api/built-in-components.html#transition)
7090
- Default: `() => ({ name: 'vfm' })`{lang=ts}
7191
7292
### overlayClass
7393
7494
Bind class to `.vfm__overlay`{lang=ts} element.
75-
- Type: `undefined as unknown as PropType<any>`{lang=ts}
95+
- Type:
96+
- JS: `[Object, Array, String]`{lang=ts}
97+
- TS: `[Object, Array, String] as unknown as PropType<any>`{lang=ts}
7698
- Default: `undefined`{lang=ts}
7799
78100
### contentClass
79101
80102
Bind class to `.vfm__content`{lang=ts} element.
81-
- Type: `undefined as unknown as PropType<any>`{lang=ts}
103+
- Type:
104+
- JS: `[Object, Array, String]`{lang=ts}
105+
- TS: `[Object, Array, String] as unknown as PropType<any>`{lang=ts}
82106
- Default: `undefined`{lang=ts}
83107
84108
### overlayStyle
85109
86110
Bind style to `.vfm__overlay`{lang=ts} element.
87-
- Type: `[String, Object, Array] as PropType<StyleValue>`{lang=ts}
111+
- Type:
112+
- JS: `[String, Object, Array]`{lang=ts}
113+
- TS: `PropType<StyleValue>`{lang=ts}
114+
```ts
115+
export type StyleValue = string | CSSProperties | (string | CSSProperties)[]
116+
```
117+
```ts
118+
import { StyleValue } from 'vue-final-modal'
119+
```
88120
- Default: `undefined`{lang=ts}
89121

90122
### contentStyle
91123

92124
Bind style to `.vfm__content`{lang=ts} element.
93-
- Type: `[String, Object, Array] as PropType<StyleValue>`{lang=ts}
125+
- Type:
126+
- JS: `[String, Object, Array]`{lang=ts}
127+
- TS: `PropType<StyleValue>`{lang=ts}
128+
```ts
129+
export type StyleValue = string | CSSProperties | (string | CSSProperties)[]
130+
```
131+
```ts
132+
import { StyleValue } from 'vue-final-modal'
133+
```
94134
- Default: `undefined`{lang=ts}
95135

96136
### clickToClose
97137

98138
Can be closed by clicking the `.vfm`{lang=ts} element.
99-
- Type: `Boolean as PropType<boolean>`{lang=ts}
139+
- Type:
140+
- JS: `Boolean`{lang=ts}
141+
- TS: `PropType<boolean>`{lang=ts}
100142
- Default: `true`{lang=ts}
101143

102144
### escToClose
103145

104146
Can be closed by keypress `esc`{lang=ts}.
105-
- Type: `Boolean as PropType<boolean>`{lang=ts}
147+
- Type:
148+
- JS: `Boolean`{lang=ts}
149+
- TS: `PropType<boolean>`{lang=ts}
106150
- Default: `true`{lang=ts}
107151

108152
### background
109153

110154
Is it allow to interact with background of the modal.
111-
- Type: `String as PropType<'interactive' | 'non-interactive'>`{lang=ts}
155+
- Type:
156+
- JS: `'interactive' | 'non-interactive'`{lang=ts}
157+
- TS: `PropType<'interactive' | 'non-interactive'>`{lang=ts}
112158
- Default: `'non-interactive'`{lang=ts}
113159

114160
### focusTrap
115161
- Description:
116-
- Use `{ disabled: true }`{lang=ts} to disable the focusTrap.
117-
- For more information on what options can be passed, see [createOptions](https://github.com/focus-trap/focus-trap#createoptions) in the [focus-trap](https://github.com/focus-trap/focus-trap) documentation.
118-
- Type: `Object as PropType<Options & { disabled?: true }>`{lang=ts}
162+
- Set `false`{lang=ts} to disable the focusTrap.
163+
- For more information on what `options` can be passed, see [createOptions](https://github.com/focus-trap/focus-trap#createoptions) in the [focus-trap](https://github.com/focus-trap/focus-trap) documentation.
164+
- Type:
165+
- JS: `[Boolean, Object]`{lang=ts}
166+
- TS: `PropType<false | Options>`{lang=ts}
119167
- Default: `() => ({ allowOutsideClick: true })`{lang=ts}
120168

121169
### lockScroll
122170

123171
Lock body scroll or not when the modal is opened.
124-
- Type: `Boolean as PropType<boolean>`{lang=ts}
172+
- Type:
173+
- JS: `Boolean`{lang=ts}
174+
- TS: `PropType<boolean>`{lang=ts}
125175
- Default: `true`{lang=ts}
126176

127177
### zIndexFn
128178

129179
Define how to increase the zIndex when there are nested modals.
130-
- Type: `Function as PropType<(context: { index: number }) => number | undefined>`{lang=ts}
180+
- Type:
181+
- JS: `Function`{lang=ts}
182+
- TS: `PropType<(context: { index: number }) => number | undefined>`{lang=ts}
131183
- Default: `({ index }: { index: number }) => 1000 + 2 * index`{lang=ts}
132184
- `index`{lang=ts} is the index order of the opened modals
133185
## Events

packages/docs/content/3.api/1.components/2.v-full-screen.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,43 +28,63 @@ It will be helpful for understanding the naming of [props](#props).
2828
### hideOverlay
2929

3030
Hide the overlay or not.
31-
- Type: `Boolean as PropType<boolean>`{lang=ts}
31+
- Type:
32+
- JS: `Boolean`{lang=ts}
33+
- TS: `PropType<boolean>`{lang=ts}
3234
- Default: `true`{lang=ts}
3335

3436
### fullscreenClass
3537

3638
Bind class to `.vfm-fullscreen-content`{lang=ts} element.
37-
- Type: `undefined as unknown as PropType<any>`{lang=ts}
39+
- Type:
40+
- JS: `[Object, Array, String]`{lang=ts}
41+
- TS: `[Object, Array, String] as unknown as PropType<any>`{lang=ts}
3842
- Default: `undefined`{lang=ts}
3943

4044
### fullscreenStyle
4145

4246
Bind style to `.vfm-fullscreen-content`{lang=ts} element.
43-
- Type: `[String, Object, Array] as PropType<StyleValue>`{lang=ts}
47+
- Type:
48+
- JS: `[String, Object, Array]`{lang=ts}
49+
- TS: `PropType<StyleValue>`{lang=ts}
50+
```ts
51+
export type StyleValue = string | CSSProperties | (string | CSSProperties)[]
52+
```
53+
```ts
54+
import { StyleValue } from 'vue-final-modal'
55+
```
4456
- Default: `undefined`{lang=ts}
4557

4658
### closeDirection
4759

4860
The direction of swiping to close the full screen modal
49-
- Type: `String as PropType<'NONE' | 'RIGHT' | 'LEFT'>`{lang=ts}
61+
- Type:
62+
- JS: `'NONE' | 'RIGHT' | 'LEFT'`{lang=ts}
63+
- TS: `PropType<'NONE' | 'RIGHT' | 'LEFT'>`{lang=ts}
5064
- Default: `'NONE'`
5165

5266
### threshold
5367

5468
Threshold for swipe to close
55-
- Type: `Number as PropType<number>`{lang=ts}
69+
- Type:
70+
- JS: `Number`{lang=ts}
71+
- TS: `PropType<number>`{lang=ts}
5672
- Default: `30`
5773

5874
### showSwipeBanner
5975

6076
If set `:showSwipeBanner="true"`{lang=ts}, only allow clicking `swipe-banner` slot to swipe to close
61-
- Type: `Boolean as PropType<boolean>`{lang=ts}
77+
- Type:
78+
- JS: `Boolean`{lang=ts}
79+
- TS: `PropType<boolean>`{lang=ts}
6280
- Default: `undefined`
6381

6482
### preventNavigationGestures
6583

6684
When set `:preventNavigationGestures="true"`{lang=ts}, there will be two invisible bars for prevent navigation gestures including swiping back/forward on mobile webkit. For example: Safari mobile.
67-
- Type: `Boolean as PropType<boolean>`{lang=ts}
85+
- Type:
86+
- JS: `Boolean`{lang=ts}
87+
- TS: `PropType<boolean>`{lang=ts}
6888
- Default: `undefined`
6989

7090
## Events

packages/docs/content/3.api/1.components/3.v-bottom-sheet.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,39 @@ It will be helpful for understanding the naming of [props](#props).
2828
### bottomSheetClass
2929

3030
Bind class to `.vfm-bottom-sheet-content`{lang=ts} element.
31-
- Type: `undefined as unknown as PropType<any>`{lang=ts}
31+
- Type:
32+
- JS: `[Object, Array, String]`{lang=ts}
33+
- TS: `[Object, Array, String] as unknown as PropType<any>`{lang=ts}
3234
- Default: `undefined`{lang=ts}
3335

3436
### bottomSheetStyle
3537

3638
Bind style to `.vfm-bottom-sheet-content`{lang=ts} element.
37-
- Type: `[String, Object, Array] as PropType<StyleValue>`{lang=ts}
39+
- Type:
40+
- JS: `[String, Object, Array]`{lang=ts}
41+
- TS: `PropType<StyleValue>`{lang=ts}
42+
```ts
43+
export type StyleValue = string | CSSProperties | (string | CSSProperties)[]
44+
```
45+
```ts
46+
import { StyleValue } from 'vue-final-modal'
47+
```
3848
- Default: `undefined`{lang=ts}
3949

4050
### closeDirection
4151

4252
The direction of swiping to close the bottom sheet modal
43-
- Type: `String as PropType<'NONE' | 'DOWN'>`{lang=ts}
53+
- Type:
54+
- JS: `'NONE' | 'DOWN'`{lang=ts}
55+
- TS: `PropType<'NONE' | 'DOWN'>`{lang=ts}
4456
- Default: `'DOWN'`
4557

4658
### threshold
4759

4860
Threshold for swipe to close
49-
- Type: `Number as PropType<number>`{lang=ts}
61+
- Type:
62+
- JS: `Number`{lang=ts}
63+
- TS: `PropType<number>`{lang=ts}
5064
- Default: `30`
5165

5266
## Events

packages/vue-final-modal/src/components/CoreModal/CoreModalProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export const coreModalProps = {
136136
* @default `{ allowOutsideClick: true }`
137137
*/
138138
focusTrap: {
139-
type: Object as PropType<Options & { disabled?: true }>,
139+
type: [Boolean, Object] as PropType<false | Options>,
140140
default: () => ({
141141
allowOutsideClick: true,
142142
}),

packages/vue-final-modal/src/components/CoreModal/useFocusTrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function useFocusTrap(
1111
openedModals: ComputedRef<Modal>[]
1212
},
1313
) {
14-
if (props.focusTrap?.disabled) {
14+
if (props.focusTrap === false) {
1515
return {
1616
focus() {},
1717
focusLast() {},

packages/vue-final-modal/test/VueFinalModal.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('tests VueFinalModal', () => {
3434
it('basic', async () => {
3535
const wrapper = mount(VueFinalModal, {
3636
props: {
37-
focusTrap: { disabled: true },
37+
focusTrap: false,
3838
},
3939
global: {
4040
plugins: [createVfm()],
@@ -53,7 +53,7 @@ describe('tests VueFinalModal', () => {
5353
const wrapper = mount(VueFinalModal, {
5454
props: {
5555
displayDirective: 'show',
56-
focusTrap: { disabled: true },
56+
focusTrap: false,
5757
},
5858
global: {
5959
plugins: [createVfm()],

0 commit comments

Comments
 (0)