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.
Files changed (50) hide show
  1. package/.storybook/main.ts +2 -0
  2. package/README.md +3 -1
  3. package/dist/css/reset.css +5 -1
  4. package/dist/css/utilities-base.css +6 -6
  5. package/dist/css/utilities-responsive.css +24 -24
  6. package/dist/css/variables.css +3 -0
  7. package/dist/style.css +1 -1
  8. package/dist/tide-design-system.cjs +2 -2
  9. package/dist/tide-design-system.esm.d.ts +152 -70
  10. package/dist/tide-design-system.esm.js +1375 -1243
  11. package/docs/assets/full-bleed.gif +0 -0
  12. package/docs/assets/layout-grid-default.webp +0 -0
  13. package/docs/assets/layout-grid-fluid.webp +0 -0
  14. package/docs/assets/layout-grid.webp +0 -0
  15. package/docs/configuation.md +47 -0
  16. package/docs/grid-layout.md +83 -0
  17. package/docs/upgrading.md +79 -0
  18. package/index.ts +4 -0
  19. package/package.json +1 -1
  20. package/src/assets/css/reset.css +5 -1
  21. package/src/assets/css/utilities-base.css +6 -6
  22. package/src/assets/css/utilities-responsive.css +24 -24
  23. package/src/assets/css/variables.css +3 -0
  24. package/src/components/TideAccordionItem.vue +21 -13
  25. package/src/components/TideAlert.vue +1 -1
  26. package/src/components/TideButtonSegmented.vue +14 -15
  27. package/src/components/TideChipFilter.vue +13 -7
  28. package/src/components/TideInputCheckbox.vue +0 -1
  29. package/src/components/TideInputSelect.vue +1 -1
  30. package/src/components/TideInputSelectDeprecated.vue +1 -1
  31. package/src/components/TideInputText.vue +2 -2
  32. package/src/components/TideInputTextDeprecated.vue +2 -2
  33. package/src/components/TideInputTextarea.vue +2 -2
  34. package/src/components/TideInputTextareaDeprecated.vue +2 -2
  35. package/src/components/TideModal.vue +33 -20
  36. package/src/components/TidePagination.vue +17 -19
  37. package/src/components/TideRating.vue +93 -0
  38. package/src/components/TideSheet.vue +24 -21
  39. package/src/components/TideSwitch.vue +23 -20
  40. package/src/components/TideTabs.vue +58 -0
  41. package/src/stories/TideAccordionItem.stories.ts +33 -34
  42. package/src/stories/TideButtonSegmented.stories.ts +33 -25
  43. package/src/stories/TideChipFilter.stories.ts +33 -23
  44. package/src/stories/TideInputCheckbox.stories.ts +18 -10
  45. package/src/stories/TideModal.stories.ts +33 -37
  46. package/src/stories/TidePagination.stories.ts +31 -20
  47. package/src/stories/TideRating.stories.ts +120 -0
  48. package/src/stories/TideSheet.stories.ts +33 -28
  49. package/src/stories/TideSwitch.stories.ts +33 -34
  50. package/src/stories/TideTabs.stories.ts +115 -0
@@ -0,0 +1,120 @@
1
+ import { action } from '@storybook/addon-actions';
2
+ import { ref, watchEffect } from 'vue';
3
+
4
+ import TideRating from '@/components/TideRating.vue';
5
+ import { argTypeBooleanUnrequired, change, doSomething, parameters } from '@/utilities/storybook';
6
+
7
+ import type { StoryContext } from '@storybook/vue3';
8
+
9
+ type Args = InstanceType<typeof TideRating>['$props'] & {
10
+ handleChange: string;
11
+ vModel: number;
12
+ };
13
+
14
+ const maxRating = 10;
15
+
16
+ const render = (args: Args, context: StoryContext) => ({
17
+ components: { TideRating },
18
+ methods: {
19
+ doSomething,
20
+ handleChange: (index: number) => {
21
+ action('Current rating')(index);
22
+ context.updateArgs({ ...args, vModel: index });
23
+
24
+ try {
25
+ const callback = eval(args.handleChange);
26
+
27
+ if (callback) {
28
+ callback();
29
+ }
30
+ } catch {
31
+ alert('Please specify a valid handler in the "change" control.');
32
+ }
33
+ },
34
+ },
35
+ setup: () => {
36
+ const ratingValue = ref<number>(args.vModel);
37
+
38
+ watchEffect(() => {
39
+ ratingValue.value = args.vModel;
40
+ });
41
+
42
+ return {
43
+ args,
44
+ ratingValue,
45
+ };
46
+ },
47
+ template: '<TideRating v-model="ratingValue" @update:modelValue="handleChange" v-bind="args" />',
48
+ });
49
+
50
+ export default {
51
+ argTypes: {
52
+ description: {
53
+ control: 'text',
54
+ description: 'Determines the text displayed below the title',
55
+ table: {
56
+ defaultValue: { summary: 'None' },
57
+ type: { summary: 'string' },
58
+ },
59
+ },
60
+ handleChange: {
61
+ ...change,
62
+ control: 'text',
63
+ description: 'JS code or function to execute on change event',
64
+ name: 'update:modelValue',
65
+ table: {
66
+ category: 'Events',
67
+ defaultValue: { summary: 'None' },
68
+ type: { summary: '() => void' },
69
+ },
70
+ },
71
+ maxRating: {
72
+ control: 'text',
73
+ description: 'Maximum rating value / Number of segments',
74
+ table: {
75
+ defaultValue: { summary: 10 },
76
+ type: { summary: 'number' },
77
+ },
78
+ },
79
+ showRating: {
80
+ ...argTypeBooleanUnrequired,
81
+ description: 'Determines whether to display the current rating value',
82
+ },
83
+ title: {
84
+ control: 'text',
85
+ description: 'Determines the title text displayed above the rating component',
86
+ table: {
87
+ defaultValue: { summary: 'None' },
88
+ type: { summary: 'string' },
89
+ },
90
+ },
91
+ vModel: {
92
+ control: {
93
+ type: 'select',
94
+ },
95
+ description: 'Data binding to Vue ref (selected rating index)',
96
+ isDynamic: true,
97
+ options: Array.from({ length: maxRating + 1 }, (_, i) => i),
98
+ table: {
99
+ category: 'Native',
100
+ defaultValue: { summary: 'None' },
101
+ type: { summary: 'Ref<number>' },
102
+ },
103
+ },
104
+ },
105
+ args: {
106
+ description: 'Description',
107
+ handleChange: 'doSomething',
108
+ maxRating: '10',
109
+ showRating: undefined,
110
+ title: 'Title',
111
+ vModel: 0,
112
+ },
113
+ component: TideRating,
114
+ parameters,
115
+ render,
116
+ tags: ['autodocs'],
117
+ title: 'Components/TideRating',
118
+ };
119
+
120
+ export const Demo = {};
@@ -1,4 +1,5 @@
1
1
  import { action } from '@storybook/addon-actions';
2
+ import { ref, watch } from 'vue';
2
3
 
3
4
  import TideButton from '@/components/TideButton.vue';
4
5
  import TideSheet from '@/components/TideSheet.vue';
@@ -17,6 +18,7 @@ type Args = InstanceType<typeof TideSheet>['$props'] & {
17
18
  default: string;
18
19
  handleBack: string;
19
20
  handleClose: string;
21
+ vModel: boolean;
20
22
  };
21
23
 
22
24
  const formatSnippet = (code: string, context: StoryContext) => {
@@ -59,28 +61,32 @@ const render = (args: Args, context: StoryContext) => ({
59
61
  alert('Please specify a valid handler in the "back" control.');
60
62
  }
61
63
  },
62
- handleClose: () => {
63
- action('Sheet closed')({});
64
- context.updateArgs({ ...args, isOpen: false });
64
+ handleIsOpenChange: (value: boolean) => {
65
+ context.updateArgs({ ...args, vModel: value });
66
+ },
67
+ },
68
+ setup: () => {
69
+ const isOpen = ref(args.vModel);
65
70
 
66
- try {
67
- const callback = eval(args.handleClose);
71
+ watch(isOpen, () => {
72
+ args.vModel = isOpen.value;
73
+ });
68
74
 
69
- if (callback) {
70
- callback();
71
- }
72
- } catch {
73
- alert('Please specify a valid handler in the "close" control.');
75
+ watch(
76
+ () => args.vModel,
77
+ (newValue) => {
78
+ isOpen.value = newValue;
74
79
  }
75
- },
76
- handleOpenSheetClick: () => {
77
- context.updateArgs({ ...args, isOpen: true });
78
- },
80
+ );
81
+
82
+ return {
83
+ args,
84
+ isOpen,
85
+ };
79
86
  },
80
- setup: () => ({ args }),
81
87
  template: `
82
- <TideButton label="Open sheet" @click="handleOpenSheetClick" />
83
- <TideSheet v-bind="args" @close="handleClose" @back="handleBack">
88
+ <TideButton label="Open sheet" @click="handleIsOpenChange(true)" />
89
+ <TideSheet v-bind="args" v-model="isOpen" @back="handleBack" @update:modelValue="handleIsOpenChange">
84
90
  ${args.default}
85
91
  </TideSheet>`,
86
92
  });
@@ -107,16 +113,6 @@ export default {
107
113
  type: { summary: '() => void' },
108
114
  },
109
115
  },
110
- handleClose: {
111
- control: 'text',
112
- description: 'JS function to execute when sheet is closed',
113
- name: 'close',
114
- table: {
115
- category: 'Events',
116
- defaultValue: { summary: 'None' },
117
- type: { summary: '() => void' },
118
- },
119
- },
120
116
  isBackButton: {
121
117
  ...argTypeBooleanUnrequired,
122
118
  description: 'Determines whether the back button is displayed',
@@ -130,13 +126,22 @@ export default {
130
126
  defaultValue: { summary: 'False' },
131
127
  },
132
128
  },
129
+ vModel: {
130
+ control: 'boolean',
131
+ description: 'Data binding to Vue ref',
132
+ table: {
133
+ category: 'Native',
134
+ defaultValue: { summary: 'None' },
135
+ type: { summary: 'Ref<boolean>' },
136
+ },
137
+ },
133
138
  },
134
139
  args: {
135
140
  default: `<div>${lineBreak}${tab}Default Slot Demo${lineBreak}</div>`,
136
141
  handleBack: 'doSomething',
137
142
  handleClose: 'doSomethingElse',
138
143
  isBackButton: undefined,
139
- isOpen: false,
144
+ vModel: false,
140
145
  },
141
146
  component: TideSheet,
142
147
  parameters,
@@ -1,70 +1,69 @@
1
- import { action } from '@storybook/addon-actions';
1
+ import { ref, watch } from 'vue';
2
2
 
3
3
  import TideSwitch from '@/components/TideSwitch.vue';
4
- import {
5
- argTypeBooleanUnrequired,
6
- change,
7
- dataTrack,
8
- disabledArgType,
9
- doSomething,
10
- parameters,
11
- } from '@/utilities/storybook';
4
+ import { argTypeBooleanUnrequired, dataTrack, doSomething, parameters } from '@/utilities/storybook';
12
5
 
13
6
  import type { StoryContext } from '@storybook/vue3';
14
7
 
15
8
  type Args = InstanceType<typeof TideSwitch>['$props'] & {
16
- handleChange: string;
9
+ vModel: true;
17
10
  };
18
11
 
19
12
  const render = (args: Args, context: StoryContext) => ({
20
13
  components: { TideSwitch },
21
14
  methods: {
22
15
  doSomething,
23
- handleChange: () => {
24
- action('TideSwitch changed')();
25
- context.updateArgs({ ...args, isActive: context.args.isActive !== true });
16
+ handleIsActiveChange: (value: boolean) => {
17
+ context.updateArgs({ ...args, vModel: value });
18
+ },
19
+ },
20
+ setup: () => {
21
+ const isActive = ref(args.vModel);
26
22
 
27
- try {
28
- const callback = eval(args.handleChange);
23
+ watch(isActive, () => {
24
+ args.vModel = isActive.value;
25
+ });
29
26
 
30
- if (callback) {
31
- callback();
32
- }
33
- } catch {
34
- alert('Please specify a valid handler in the "change" control.');
27
+ watch(
28
+ () => args.vModel,
29
+ (newValue) => {
30
+ isActive.value = newValue;
35
31
  }
36
- },
32
+ );
33
+
34
+ return {
35
+ args,
36
+ isActive,
37
+ };
37
38
  },
38
- setup: () => ({ args }),
39
- template: `<TideSwitch @change="handleChange" v-bind="args" />`,
39
+ template: `<TideSwitch v-bind="args" v-model="isActive" @update:modelValue="handleIsActiveChange" />`,
40
40
  });
41
41
 
42
42
  export default {
43
43
  argTypes: {
44
- change: disabledArgType,
45
44
  dataTrack,
46
45
  disabled: {
47
46
  ...argTypeBooleanUnrequired,
48
47
  description: 'Determines clickability',
49
48
  },
50
- handleChange: {
51
- ...change,
52
- table: {
53
- category: 'Events',
54
- defaultValue: { summary: 'None' },
55
- type: { summary: '() => void' },
56
- },
57
- },
58
49
  isActive: {
59
50
  ...argTypeBooleanUnrequired,
60
51
  description: 'Determines whether toggle is active',
61
52
  },
53
+ vModel: {
54
+ control: 'boolean',
55
+ description: 'Data binding to Vue ref',
56
+ table: {
57
+ category: 'Native',
58
+ defaultValue: { summary: 'None' },
59
+ type: { summary: 'Ref<boolean>' },
60
+ },
61
+ },
62
62
  },
63
63
  args: {
64
64
  dataTrack: '',
65
65
  disabled: undefined,
66
- handleChange: 'doSomething',
67
- isActive: undefined,
66
+ vModel: false,
68
67
  },
69
68
  component: TideSwitch,
70
69
  parameters,
@@ -0,0 +1,115 @@
1
+ import { action } from '@storybook/addon-actions';
2
+ import { ref, watchEffect } from 'vue';
3
+
4
+ import TideTabs from '@/components/TideTabs.vue';
5
+ import { change, disabledArgType, doSomething, parameters } from '@/utilities/storybook';
6
+
7
+ import type { Tab } from '@/types/Tab';
8
+ import type { StoryContext } from '@storybook/vue3';
9
+
10
+ type Args = InstanceType<typeof TideTabs>['$props'] & {
11
+ handleChange: string;
12
+ vModel: number;
13
+ };
14
+
15
+ const tabs: Tab[] = [
16
+ {
17
+ dataTrack: 'Tab 0 Click',
18
+ label: 'First Tab',
19
+ },
20
+ {
21
+ dataTrack: 'Tab 1 Click',
22
+ label: 'Second Tab',
23
+ },
24
+ {
25
+ dataTrack: 'Tab 2 Click',
26
+ label: 'Third Tab',
27
+ },
28
+ {
29
+ dataTrack: 'Tab 3 Click',
30
+ label: 'Fourth Tab',
31
+ },
32
+ ];
33
+
34
+ const render = (args: Args, context: StoryContext) => ({
35
+ components: { TideTabs },
36
+ methods: {
37
+ doSomething,
38
+ handleChange: (index: number) => {
39
+ action('Current tab')(index);
40
+ context.updateArgs({ ...args, vModel: index });
41
+
42
+ try {
43
+ const callback = eval(args.handleChange);
44
+
45
+ if (callback) {
46
+ callback();
47
+ }
48
+ } catch {
49
+ alert('Please specify a valid handler in the "change" control.');
50
+ }
51
+ },
52
+ },
53
+ setup: () => {
54
+ const currentTab = ref<number>(args.vModel);
55
+
56
+ watchEffect(() => {
57
+ currentTab.value = args.vModel;
58
+ });
59
+
60
+ return {
61
+ args,
62
+ currentTab,
63
+ };
64
+ },
65
+ template: `<TideTabs @update:modelValue="handleChange" v-bind="args" v-model="currentTab" />`,
66
+ });
67
+
68
+ export default {
69
+ argTypes: {
70
+ change: disabledArgType,
71
+ handleChange: {
72
+ ...change,
73
+ name: 'update:modelValue',
74
+ table: {
75
+ category: 'Events',
76
+ defaultValue: { summary: 'None' },
77
+ type: { summary: '(tabIndex: number) => void' },
78
+ },
79
+ },
80
+ tabs: {
81
+ control: 'object',
82
+ description: 'Sets labels and callback for each tab',
83
+ isCustom: true,
84
+ table: {
85
+ defaultValue: { summary: 'None' },
86
+ type: { summary: 'Tab[]' },
87
+ },
88
+ },
89
+ vModel: {
90
+ control: {
91
+ type: 'select',
92
+ },
93
+ description: 'Data binding to Vue ref (active tab index)',
94
+ isDynamic: true,
95
+ options: Object.keys(tabs).map((index) => parseInt(index)),
96
+ table: {
97
+ category: 'Native',
98
+ defaultValue: { summary: 'None' },
99
+ type: { summary: 'Ref<number>' },
100
+ },
101
+ },
102
+ },
103
+ args: {
104
+ handleChange: 'doSomething',
105
+ tabs,
106
+ vModel: 0,
107
+ },
108
+ component: TideTabs,
109
+ parameters,
110
+ render,
111
+ tags: ['autodocs'],
112
+ title: 'Components/TideTabs',
113
+ };
114
+
115
+ export const Demo = {};