tide-design-system 2.4.7 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +2 -0
- package/README.md +3 -1
- package/dist/css/reset.css +5 -1
- package/dist/css/utilities-base.css +6 -6
- package/dist/css/utilities-responsive.css +24 -24
- package/dist/css/variables.css +3 -0
- package/dist/style.css +1 -1
- package/dist/tide-design-system.cjs +2 -2
- package/dist/tide-design-system.esm.d.ts +152 -70
- package/dist/tide-design-system.esm.js +1375 -1243
- package/docs/assets/full-bleed.gif +0 -0
- package/docs/assets/layout-grid-default.webp +0 -0
- package/docs/assets/layout-grid-fluid.webp +0 -0
- package/docs/assets/layout-grid.webp +0 -0
- package/docs/configuation.md +47 -0
- package/docs/grid-layout.md +83 -0
- package/docs/upgrading.md +79 -0
- package/index.ts +4 -0
- package/package.json +1 -1
- package/src/assets/css/reset.css +5 -1
- package/src/assets/css/utilities-base.css +6 -6
- package/src/assets/css/utilities-responsive.css +24 -24
- package/src/assets/css/variables.css +3 -0
- package/src/components/TideAccordionItem.vue +21 -13
- package/src/components/TideAlert.vue +1 -1
- package/src/components/TideButtonSegmented.vue +14 -15
- package/src/components/TideChipFilter.vue +13 -7
- package/src/components/TideInputCheckbox.vue +0 -1
- package/src/components/TideInputSelect.vue +1 -1
- package/src/components/TideInputSelectDeprecated.vue +1 -1
- package/src/components/TideInputText.vue +2 -2
- package/src/components/TideInputTextDeprecated.vue +2 -2
- package/src/components/TideInputTextarea.vue +2 -2
- package/src/components/TideInputTextareaDeprecated.vue +2 -2
- package/src/components/TideModal.vue +33 -20
- package/src/components/TidePagination.vue +17 -19
- package/src/components/TideRating.vue +93 -0
- package/src/components/TideSheet.vue +24 -21
- package/src/components/TideSwitch.vue +23 -20
- package/src/components/TideTabs.vue +58 -0
- package/src/stories/TideAccordionItem.stories.ts +33 -34
- package/src/stories/TideButtonSegmented.stories.ts +33 -25
- package/src/stories/TideChipFilter.stories.ts +33 -23
- package/src/stories/TideInputCheckbox.stories.ts +18 -10
- package/src/stories/TideModal.stories.ts +33 -37
- package/src/stories/TidePagination.stories.ts +31 -20
- package/src/stories/TideRating.stories.ts +120 -0
- package/src/stories/TideSheet.stories.ts +33 -28
- package/src/stories/TideSwitch.stories.ts +33 -34
- package/src/stories/TideTabs.stories.ts +115 -0
|
@@ -1,35 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref, watch } from 'vue';
|
|
2
2
|
|
|
3
3
|
import TideAccordionItem from '@/components/TideAccordionItem.vue';
|
|
4
|
-
import { argTypeBooleanUnrequired, dataTrack,
|
|
4
|
+
import { argTypeBooleanUnrequired, dataTrack, doSomething, parameters } from '@/utilities/storybook';
|
|
5
5
|
|
|
6
6
|
import type { StoryContext } from '@storybook/vue3';
|
|
7
7
|
|
|
8
8
|
type Args = InstanceType<typeof TideAccordionItem>['$props'] & {
|
|
9
|
-
|
|
9
|
+
vModel: boolean;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
const render = (args: Args, context: StoryContext) => ({
|
|
13
13
|
components: { TideAccordionItem },
|
|
14
14
|
methods: {
|
|
15
15
|
doSomething,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
handleIsExpandedChange: (value: boolean) => {
|
|
17
|
+
context.updateArgs({ ...args, vModel: value });
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
setup: () => {
|
|
21
|
+
const isExpanded = ref(args.vModel);
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
watch(isExpanded, () => {
|
|
24
|
+
args.vModel = isExpanded.value;
|
|
25
|
+
});
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
alert('Please specify a valid handler in the "toggle" control.');
|
|
27
|
+
watch(
|
|
28
|
+
() => args.vModel,
|
|
29
|
+
(newValue) => {
|
|
30
|
+
isExpanded.value = newValue;
|
|
28
31
|
}
|
|
29
|
-
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
args,
|
|
36
|
+
isExpanded,
|
|
37
|
+
};
|
|
30
38
|
},
|
|
31
|
-
|
|
32
|
-
template: `<TideAccordionItem @toggle="handleToggle" v-bind="args">{{ args.default }}</TideAccordionItem>`,
|
|
39
|
+
template: `<TideAccordionItem v-bind="args" v-model="isExpanded" @update:modelValue="handleIsExpandedChange">{{ args.default }}</TideAccordionItem>`,
|
|
33
40
|
});
|
|
34
41
|
|
|
35
42
|
export default {
|
|
@@ -43,17 +50,6 @@ export default {
|
|
|
43
50
|
type: { summary: 'HTML' },
|
|
44
51
|
},
|
|
45
52
|
},
|
|
46
|
-
handleToggle: {
|
|
47
|
-
control: 'text',
|
|
48
|
-
description: 'JS code or function to execute on toggle event',
|
|
49
|
-
isEmit: true,
|
|
50
|
-
name: 'toggle',
|
|
51
|
-
table: {
|
|
52
|
-
category: 'Events',
|
|
53
|
-
defaultValue: { summary: 'None' },
|
|
54
|
-
type: { summary: '(isExpanded: boolean) => void' },
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
53
|
hasBottomDivider: {
|
|
58
54
|
...argTypeBooleanUnrequired,
|
|
59
55
|
description: 'Determines whether to include bottom divider',
|
|
@@ -62,10 +58,6 @@ export default {
|
|
|
62
58
|
...argTypeBooleanUnrequired,
|
|
63
59
|
description: 'Determines whether to include bottom divider',
|
|
64
60
|
},
|
|
65
|
-
isExpanded: {
|
|
66
|
-
...argTypeBooleanUnrequired,
|
|
67
|
-
description: 'Determines whether body content should be displayed',
|
|
68
|
-
},
|
|
69
61
|
isOptional: {
|
|
70
62
|
...argTypeBooleanUnrequired,
|
|
71
63
|
description: 'Determines whether to show "(optional)" indicator after label',
|
|
@@ -78,17 +70,24 @@ export default {
|
|
|
78
70
|
type: { summary: 'string' },
|
|
79
71
|
},
|
|
80
72
|
},
|
|
81
|
-
|
|
73
|
+
vModel: {
|
|
74
|
+
control: 'boolean',
|
|
75
|
+
description: 'Data binding to Vue ref',
|
|
76
|
+
table: {
|
|
77
|
+
category: 'Native',
|
|
78
|
+
defaultValue: { summary: 'None' },
|
|
79
|
+
type: { summary: 'Ref<boolean>' },
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
82
|
},
|
|
83
83
|
args: {
|
|
84
84
|
dataTrack: '',
|
|
85
85
|
default: 'Lorem Ipsum',
|
|
86
|
-
handleToggle: 'doSomething',
|
|
87
86
|
hasBottomDivider: undefined,
|
|
88
87
|
hasTopDivider: undefined,
|
|
89
|
-
isExpanded: undefined,
|
|
90
88
|
isOptional: undefined,
|
|
91
89
|
label: 'Demo',
|
|
90
|
+
vModel: true,
|
|
92
91
|
},
|
|
93
92
|
component: TideAccordionItem,
|
|
94
93
|
parameters,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref, watch } from 'vue';
|
|
2
2
|
|
|
3
3
|
import TideButtonSegmented from '@/components/TideButtonSegmented.vue';
|
|
4
|
-
import {
|
|
4
|
+
import { doSomething, getLabelsFromOptions, parameters } from '@/utilities/storybook';
|
|
5
5
|
|
|
6
6
|
import type { Tab } from '@/types/Tab';
|
|
7
7
|
import type { StoryContext } from '@storybook/vue3';
|
|
8
8
|
|
|
9
9
|
type Args = InstanceType<typeof TideButtonSegmented>['$props'] & {
|
|
10
|
-
|
|
10
|
+
vModel: number;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
const options = {
|
|
@@ -36,23 +36,30 @@ const render = (args: Args, context: StoryContext) => ({
|
|
|
36
36
|
components: { TideButtonSegmented },
|
|
37
37
|
methods: {
|
|
38
38
|
doSomething,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
handleIndexChange: (value: number) => {
|
|
40
|
+
context.updateArgs({ ...args, vModel: value });
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
setup: () => {
|
|
44
|
+
const currentIndex = ref(args.vModel);
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
watch(currentIndex, () => {
|
|
47
|
+
args.vModel = currentIndex.value;
|
|
48
|
+
});
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
alert('Please specify a valid handler in the "change" control.');
|
|
50
|
+
watch(
|
|
51
|
+
() => args.vModel,
|
|
52
|
+
(newValue) => {
|
|
53
|
+
currentIndex.value = newValue;
|
|
51
54
|
}
|
|
52
|
-
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
args,
|
|
59
|
+
currentIndex,
|
|
60
|
+
};
|
|
53
61
|
},
|
|
54
|
-
|
|
55
|
-
template: '<TideButtonSegmented @change="handleChange" class="tide-display-inline-flex" v-bind="args" />',
|
|
62
|
+
template: '<TideButtonSegmented v-bind="args" v-model="currentIndex" @update:modelValue="handleIndexChange" />',
|
|
56
63
|
});
|
|
57
64
|
|
|
58
65
|
export default {
|
|
@@ -69,15 +76,6 @@ export default {
|
|
|
69
76
|
defaultValue: { summary: 'None' },
|
|
70
77
|
},
|
|
71
78
|
},
|
|
72
|
-
change: disabledArgType,
|
|
73
|
-
handleChange: {
|
|
74
|
-
...change,
|
|
75
|
-
table: {
|
|
76
|
-
category: 'Events',
|
|
77
|
-
defaultValue: { summary: 'None' },
|
|
78
|
-
type: { summary: '(tabIndex: number) => void' },
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
79
|
tabs: {
|
|
82
80
|
control: 'object',
|
|
83
81
|
description: 'Sets label and callback for each tab',
|
|
@@ -87,11 +85,21 @@ export default {
|
|
|
87
85
|
type: { summary: 'Tab[]' },
|
|
88
86
|
},
|
|
89
87
|
},
|
|
88
|
+
vModel: {
|
|
89
|
+
control: 'number',
|
|
90
|
+
description: 'Data binding to Vue ref',
|
|
91
|
+
table: {
|
|
92
|
+
category: 'Native',
|
|
93
|
+
defaultValue: { summary: 'None' },
|
|
94
|
+
type: { summary: 'Ref<number>' },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
90
97
|
},
|
|
91
98
|
args: {
|
|
92
99
|
activeTab: undefined,
|
|
93
100
|
handleChange: 'doSomething',
|
|
94
101
|
tabs,
|
|
102
|
+
vModel: 0,
|
|
95
103
|
},
|
|
96
104
|
component: TideButtonSegmented,
|
|
97
105
|
parameters,
|
|
@@ -1,40 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref, watch } from 'vue';
|
|
2
2
|
|
|
3
3
|
import TideChipFilter from '@/components/TideChipFilter.vue';
|
|
4
|
-
import {
|
|
4
|
+
import { dataTrack, doSomething, parameters } from '@/utilities/storybook';
|
|
5
5
|
|
|
6
6
|
import type { StoryContext } from '@storybook/vue3';
|
|
7
7
|
|
|
8
8
|
type Args = InstanceType<typeof TideChipFilter>['$props'] & {
|
|
9
|
-
|
|
9
|
+
vModel: boolean;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
const render = (args: Args, context: StoryContext) => ({
|
|
13
13
|
components: { TideChipFilter },
|
|
14
14
|
methods: {
|
|
15
15
|
doSomething,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
handleIsActiveChange: (value: boolean) => {
|
|
17
|
+
context.updateArgs({ ...args, vModel: value });
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
setup: () => {
|
|
21
|
+
const isActive = ref(args.vModel);
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
watch(isActive, () => {
|
|
24
|
+
args.vModel = isActive.value;
|
|
25
|
+
});
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
alert('Please specify a valid handler in the "click" control.');
|
|
27
|
+
watch(
|
|
28
|
+
() => args.vModel,
|
|
29
|
+
(newValue) => {
|
|
30
|
+
isActive.value = newValue;
|
|
28
31
|
}
|
|
29
|
-
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
args,
|
|
36
|
+
isActive,
|
|
37
|
+
};
|
|
30
38
|
},
|
|
31
|
-
|
|
32
|
-
template: `<TideChipFilter @click="handleClick" class="tide-display-inline-flex" v-bind="args">{{ args.default }}</TideChipFilter>`,
|
|
39
|
+
template: `<TideChipFilter v-bind="args" v-model="isActive" @update:modelValue="handleIsActiveChange">{{ args.default }}</TideChipFilter>`,
|
|
33
40
|
});
|
|
34
41
|
|
|
35
42
|
export default {
|
|
36
43
|
argTypes: {
|
|
37
|
-
click,
|
|
38
44
|
dataTrack,
|
|
39
45
|
default: {
|
|
40
46
|
control: 'text',
|
|
@@ -45,10 +51,6 @@ export default {
|
|
|
45
51
|
type: { summary: 'HTML' },
|
|
46
52
|
},
|
|
47
53
|
},
|
|
48
|
-
isActive: {
|
|
49
|
-
...argTypeBooleanUnrequired,
|
|
50
|
-
description: 'Determines whether toggle is active',
|
|
51
|
-
},
|
|
52
54
|
label: {
|
|
53
55
|
control: 'text',
|
|
54
56
|
description: 'Chip text',
|
|
@@ -57,13 +59,21 @@ export default {
|
|
|
57
59
|
type: { summary: 'string' },
|
|
58
60
|
},
|
|
59
61
|
},
|
|
62
|
+
vModel: {
|
|
63
|
+
control: 'boolean',
|
|
64
|
+
description: 'Data binding to Vue ref',
|
|
65
|
+
table: {
|
|
66
|
+
category: 'Native',
|
|
67
|
+
defaultValue: { summary: 'None' },
|
|
68
|
+
type: { summary: 'Ref<boolean>' },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
60
71
|
},
|
|
61
72
|
args: {
|
|
62
|
-
click: 'doSomething',
|
|
63
73
|
dataTrack: '',
|
|
64
74
|
default: '',
|
|
65
|
-
isActive: undefined,
|
|
66
75
|
label: 'Demo',
|
|
76
|
+
vModel: false,
|
|
67
77
|
},
|
|
68
78
|
component: TideChipFilter,
|
|
69
79
|
parameters,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { ref } from 'vue';
|
|
2
|
+
import { ref, watch } from 'vue';
|
|
3
3
|
|
|
4
4
|
import TideInputCheckbox from '@/components/TideInputCheckbox.vue';
|
|
5
5
|
import { argTypeBooleanUnrequired, dataTrack, disabledArgType, doSomething, parameters } from '@/utilities/storybook';
|
|
6
6
|
|
|
7
7
|
type Args = InstanceType<typeof TideInputCheckbox>['$props'] & {
|
|
8
8
|
handleValid: string;
|
|
9
|
-
vModel:
|
|
9
|
+
vModel: boolean;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
const render = (args: Args) => ({
|
|
@@ -28,13 +28,21 @@ const render = (args: Args) => ({
|
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
30
|
setup() {
|
|
31
|
-
const model = ref
|
|
31
|
+
const model = ref(args.vModel);
|
|
32
|
+
|
|
33
|
+
watch(model, (v) => {
|
|
34
|
+
args.vModel = v;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
watch(
|
|
38
|
+
() => args.vModel,
|
|
39
|
+
(v) => {
|
|
40
|
+
model.value = v;
|
|
41
|
+
}
|
|
42
|
+
);
|
|
32
43
|
|
|
33
44
|
return {
|
|
34
|
-
args
|
|
35
|
-
...args,
|
|
36
|
-
inputId: undefined, // Do not allow empty ID attribute to break the demo.
|
|
37
|
-
},
|
|
45
|
+
args,
|
|
38
46
|
model,
|
|
39
47
|
};
|
|
40
48
|
},
|
|
@@ -109,12 +117,12 @@ export default {
|
|
|
109
117
|
description: 'Determines whether input is required',
|
|
110
118
|
},
|
|
111
119
|
vModel: {
|
|
112
|
-
control: '
|
|
120
|
+
control: 'boolean',
|
|
113
121
|
description: 'Data binding to Vue ref',
|
|
114
122
|
table: {
|
|
115
123
|
category: 'Native',
|
|
116
124
|
defaultValue: { summary: 'None' },
|
|
117
|
-
type: { summary: 'Ref' },
|
|
125
|
+
type: { summary: 'Ref<boolean>' },
|
|
118
126
|
},
|
|
119
127
|
},
|
|
120
128
|
valid: disabledArgType,
|
|
@@ -130,7 +138,7 @@ export default {
|
|
|
130
138
|
name: '',
|
|
131
139
|
number: '',
|
|
132
140
|
required: undefined,
|
|
133
|
-
vModel:
|
|
141
|
+
vModel: false,
|
|
134
142
|
},
|
|
135
143
|
component: TideInputCheckbox,
|
|
136
144
|
parameters,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { compile, h } from 'vue';
|
|
2
|
+
import { compile, h, ref, watch } from 'vue';
|
|
3
3
|
|
|
4
4
|
import TideButton from '@/components/TideButton.vue';
|
|
5
5
|
import TideIcon from '@/components/TideIcon.vue';
|
|
@@ -26,14 +26,14 @@ type Args = InstanceType<typeof TideModal>['$props'] & {
|
|
|
26
26
|
default: string;
|
|
27
27
|
footer: string;
|
|
28
28
|
handleBack: string;
|
|
29
|
-
handleChange: string;
|
|
30
29
|
handleClose: string;
|
|
30
|
+
vModel: boolean;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const formatSnippet = (code: string, context: StoryContext) => {
|
|
34
34
|
const { args } = context;
|
|
35
35
|
|
|
36
|
-
const argsWithValues: string[] = [
|
|
36
|
+
const argsWithValues: string[] = [`v-model="${args.vModel}"`];
|
|
37
37
|
const slotContentIndentationFixed = (args.default as string).replace(/(<\/[^>]+>)$/, `${tab}$1`);
|
|
38
38
|
|
|
39
39
|
if (args.isBackButton !== undefined) argsWithValues.push(`:is-back-button="${args.isBackButton}"`);
|
|
@@ -42,7 +42,6 @@ const formatSnippet = (code: string, context: StoryContext) => {
|
|
|
42
42
|
if (args.width !== '') argsWithValues.push(`width="${args.width}"`);
|
|
43
43
|
|
|
44
44
|
if (args.handleBack !== undefined) argsWithValues.push(`@back="${args.handleBack}"`);
|
|
45
|
-
if (args.handleClose !== undefined) argsWithValues.push(`@close="${args.handleClose}"`);
|
|
46
45
|
|
|
47
46
|
return (
|
|
48
47
|
`<TideModal ${argsWithValues.join(' ')}>${lineBreak}` +
|
|
@@ -75,19 +74,12 @@ const render = (args: Args, context: StoryContext) => {
|
|
|
75
74
|
}
|
|
76
75
|
};
|
|
77
76
|
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
context.updateArgs({ ...args, isOpen: false });
|
|
81
|
-
try {
|
|
82
|
-
const callback = eval(args.handleClose);
|
|
83
|
-
if (callback) callback();
|
|
84
|
-
} catch {
|
|
85
|
-
alert('Please specify a valid handler in the "close" control.');
|
|
86
|
-
}
|
|
77
|
+
const handleOpenModalClick = () => {
|
|
78
|
+
context.updateArgs({ ...args, vModel: true });
|
|
87
79
|
};
|
|
88
80
|
|
|
89
|
-
const
|
|
90
|
-
context.updateArgs({ ...args,
|
|
81
|
+
const handleIsOpenChange = (value: boolean) => {
|
|
82
|
+
context.updateArgs({ ...args, vModel: value });
|
|
91
83
|
};
|
|
92
84
|
|
|
93
85
|
return {
|
|
@@ -96,10 +88,23 @@ const render = (args: Args, context: StoryContext) => {
|
|
|
96
88
|
doSomething,
|
|
97
89
|
doSomethingElse,
|
|
98
90
|
handleBack,
|
|
99
|
-
|
|
91
|
+
handleIsOpenChange,
|
|
100
92
|
handleOpenModalClick,
|
|
101
93
|
},
|
|
102
94
|
render: () => {
|
|
95
|
+
const isOpen = ref(args.vModel);
|
|
96
|
+
|
|
97
|
+
watch(isOpen, () => {
|
|
98
|
+
args.vModel = isOpen.value;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
watch(
|
|
102
|
+
() => args.vModel,
|
|
103
|
+
(newValue) => {
|
|
104
|
+
isOpen.value = newValue;
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
|
|
103
108
|
// Wrap compiled footer in a component with TideButton registered
|
|
104
109
|
const Footer = args.footer
|
|
105
110
|
? {
|
|
@@ -119,8 +124,9 @@ const render = (args: Args, context: StoryContext) => {
|
|
|
119
124
|
TideModal,
|
|
120
125
|
{
|
|
121
126
|
...args,
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
'modelValue': isOpen.value,
|
|
128
|
+
'onBack': handleBack,
|
|
129
|
+
'onUpdate:modelValue': handleIsOpenChange,
|
|
124
130
|
},
|
|
125
131
|
{
|
|
126
132
|
default: () => h('div', { innerHTML: args.default }),
|
|
@@ -136,7 +142,6 @@ const render = (args: Args, context: StoryContext) => {
|
|
|
136
142
|
export default {
|
|
137
143
|
argTypes: {
|
|
138
144
|
back: disabledArgType,
|
|
139
|
-
close: disabledArgType,
|
|
140
145
|
default: {
|
|
141
146
|
control: 'text',
|
|
142
147
|
description: 'Modal content',
|
|
@@ -155,7 +160,6 @@ export default {
|
|
|
155
160
|
},
|
|
156
161
|
handleBack: {
|
|
157
162
|
control: 'text',
|
|
158
|
-
description: "JS function to execute when modal's back button is pressed",
|
|
159
163
|
name: 'back',
|
|
160
164
|
table: {
|
|
161
165
|
category: 'Events',
|
|
@@ -163,16 +167,6 @@ export default {
|
|
|
163
167
|
type: { summary: '() => void' },
|
|
164
168
|
},
|
|
165
169
|
},
|
|
166
|
-
handleClose: {
|
|
167
|
-
control: 'text',
|
|
168
|
-
description: 'JS function to execute when modal is closed',
|
|
169
|
-
name: 'close',
|
|
170
|
-
table: {
|
|
171
|
-
category: 'Events',
|
|
172
|
-
defaultValue: { summary: 'None' },
|
|
173
|
-
type: { summary: '() => void' },
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
170
|
isBackButton: {
|
|
177
171
|
...argTypeBooleanUnrequired,
|
|
178
172
|
description: 'Determines whether the back button is displayed',
|
|
@@ -187,16 +181,19 @@ export default {
|
|
|
187
181
|
defaultValue: { summary: 'False' },
|
|
188
182
|
},
|
|
189
183
|
},
|
|
190
|
-
|
|
191
|
-
description: '
|
|
184
|
+
title: {
|
|
185
|
+
description: 'Modal title',
|
|
192
186
|
table: {
|
|
193
|
-
defaultValue: { summary: '
|
|
187
|
+
defaultValue: { summary: 'None' },
|
|
194
188
|
},
|
|
195
189
|
},
|
|
196
|
-
|
|
197
|
-
|
|
190
|
+
vModel: {
|
|
191
|
+
control: 'boolean',
|
|
192
|
+
description: 'Data binding to Vue ref',
|
|
198
193
|
table: {
|
|
194
|
+
category: 'Native',
|
|
199
195
|
defaultValue: { summary: 'None' },
|
|
196
|
+
type: { summary: 'Ref<boolean>' },
|
|
200
197
|
},
|
|
201
198
|
},
|
|
202
199
|
width: {
|
|
@@ -210,11 +207,10 @@ export default {
|
|
|
210
207
|
default: `Default Slot Demo`,
|
|
211
208
|
footer: '<TideButton label="Footer Slot Demo" />',
|
|
212
209
|
handleBack: 'doSomething',
|
|
213
|
-
handleClose: 'doSomethingElse',
|
|
214
210
|
isBackButton: undefined,
|
|
215
211
|
isDismissible: undefined,
|
|
216
|
-
isOpen: false,
|
|
217
212
|
title: 'Modal Demo',
|
|
213
|
+
vModel: false,
|
|
218
214
|
width: '',
|
|
219
215
|
},
|
|
220
216
|
component: TideModal,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref, watch } from 'vue';
|
|
2
2
|
|
|
3
3
|
import TidePagination from '@/components/TidePagination.vue';
|
|
4
4
|
import * as STANDARD_ELEMENT from '@/types/Element';
|
|
@@ -15,6 +15,7 @@ import type { StoryContext } from '@storybook/vue3';
|
|
|
15
15
|
|
|
16
16
|
type Args = InstanceType<typeof TidePagination>['$props'] & {
|
|
17
17
|
handleChange: string;
|
|
18
|
+
vModel: number;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
const ELEMENT_BROAD = prependNoneAsUndefined(STANDARD_ELEMENT.ELEMENT_BROAD);
|
|
@@ -23,23 +24,30 @@ const render = (args: Args, context: StoryContext) => ({
|
|
|
23
24
|
components: { TidePagination },
|
|
24
25
|
methods: {
|
|
25
26
|
doSomething,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
handleIndexChange: (value: number) => {
|
|
28
|
+
context.updateArgs({ ...args, vModel: value });
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
setup: () => {
|
|
32
|
+
const currentIndex = ref(args.vModel);
|
|
29
33
|
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
watch(currentIndex, () => {
|
|
35
|
+
args.vModel = currentIndex.value;
|
|
36
|
+
});
|
|
32
37
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
alert('Please specify a valid handler in the "change" control.');
|
|
38
|
+
watch(
|
|
39
|
+
() => args.vModel,
|
|
40
|
+
(newValue) => {
|
|
41
|
+
currentIndex.value = newValue;
|
|
38
42
|
}
|
|
39
|
-
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
args,
|
|
47
|
+
currentIndex,
|
|
48
|
+
};
|
|
40
49
|
},
|
|
41
|
-
|
|
42
|
-
template: `<TidePagination @change="handleChange" v-bind="args" />`,
|
|
50
|
+
template: `<TidePagination v-bind="args" v-model="currentIndex" @update:modelValue="handleIndexChange" />`,
|
|
43
51
|
});
|
|
44
52
|
|
|
45
53
|
export default {
|
|
@@ -61,23 +69,26 @@ export default {
|
|
|
61
69
|
type: { summary: '(pageIndex: number) => void' },
|
|
62
70
|
},
|
|
63
71
|
},
|
|
64
|
-
|
|
72
|
+
pageTotal: {
|
|
65
73
|
control: {
|
|
66
74
|
min: 1,
|
|
67
75
|
type: 'number',
|
|
68
76
|
},
|
|
69
77
|
},
|
|
70
|
-
|
|
71
|
-
control:
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
vModel: {
|
|
79
|
+
control: 'number',
|
|
80
|
+
description: 'Data binding to Vue ref',
|
|
81
|
+
table: {
|
|
82
|
+
category: 'Native',
|
|
83
|
+
defaultValue: { summary: 'None' },
|
|
84
|
+
type: { summary: 'Ref<number>' },
|
|
74
85
|
},
|
|
75
86
|
},
|
|
76
87
|
},
|
|
77
88
|
args: {
|
|
78
89
|
handleChange: 'doSomething',
|
|
79
|
-
pageCurrent: 1,
|
|
80
90
|
pageTotal: 5,
|
|
91
|
+
vModel: 1,
|
|
81
92
|
},
|
|
82
93
|
component: TidePagination,
|
|
83
94
|
parameters,
|