tide-design-system 2.0.29 → 2.0.30

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/index.ts CHANGED
@@ -67,7 +67,7 @@ import type { Priority } from '@/types/Priority';
67
67
  import type { Raw } from '@/types/Raw';
68
68
  import type { Realm } from '@/types/Realm';
69
69
  import type { RealmConfig } from '@/types/RealmConfig';
70
- import type { SelectOption, SelectOptGroup } from '@/types/Select';
70
+ import type { SelectOption, SelectOptionGroup } from '@/types/Select';
71
71
  import type { Size } from '@/types/Size';
72
72
  import type { Breakpoint, CssUtility } from '@/types/Styles';
73
73
  import type { Tab } from '@/types/Tab';
@@ -128,7 +128,7 @@ export type {
128
128
  RealmConfig,
129
129
  SelectField,
130
130
  SelectInput,
131
- SelectOptGroup,
131
+ SelectOptionGroup,
132
132
  SelectOption,
133
133
  Size,
134
134
  StringField,
package/package.json CHANGED
@@ -52,5 +52,5 @@
52
52
  "main": "dist/tide-design-system.cjs",
53
53
  "module": "dist/tide-design-system.esm.js",
54
54
  "types": "dist/tide-design-system.esm.d.ts",
55
- "version": "2.0.29"
55
+ "version": "2.0.30"
56
56
  }
@@ -115,6 +115,23 @@
115
115
  :id="uniqueId"
116
116
  v-model="value"
117
117
  >
118
+ <component
119
+ :class="[CSS.WIDTH.FULL, CSS.BG.SURFACE.DEFAULT]"
120
+ :key="optgroup.label"
121
+ :label="optgroup.label"
122
+ :is="optgroup.options ? 'optgroup' : 'option'"
123
+ v-for="optgroup in props.optgroups"
124
+ >
125
+ <option
126
+ :class="[CSS.WIDTH.FULL, CSS.BG.SURFACE.DEFAULT]"
127
+ :key="option.value"
128
+ :value="option.value"
129
+ v-for="option in optgroup.options"
130
+ >
131
+ {{ option.label }}
132
+ </option>
133
+ </component>
134
+
118
135
  <option
119
136
  :class="[CSS.WIDTH.FULL, CSS.BG.SURFACE.DEFAULT]"
120
137
  :key="option.value"
@@ -1,6 +1,6 @@
1
1
  import { action } from '@storybook/addon-actions';
2
2
 
3
- import type { SelectOption } from '@/types/Select';
3
+ import type { SelectOption, SelectOptionGroup } from '@/types/Select';
4
4
 
5
5
  import TideInputSelect from '@/components/TideInputSelect.vue';
6
6
  import {
@@ -19,6 +19,43 @@ const options = {
19
19
  'Option 3': 3,
20
20
  };
21
21
 
22
+ const selectOptionGroups: SelectOptionGroup[] = [
23
+ {
24
+ label: 'Group A',
25
+ options: [
26
+ {
27
+ label: 'Option 1',
28
+ value: 1,
29
+ },
30
+ {
31
+ label: 'Option 2',
32
+ value: 2,
33
+ },
34
+ {
35
+ label: 'Option 3',
36
+ value: 3,
37
+ },
38
+ ],
39
+ },
40
+ {
41
+ label: 'Group B',
42
+ options: [
43
+ {
44
+ label: 'Option 4',
45
+ value: 4,
46
+ },
47
+ {
48
+ label: 'Option 5',
49
+ value: 5,
50
+ },
51
+ {
52
+ label: 'Option 6',
53
+ value: 6,
54
+ },
55
+ ],
56
+ },
57
+ ];
58
+
22
59
  const selectOptions: SelectOption[] = [
23
60
  {
24
61
  label: 'Option 1',
@@ -87,10 +124,20 @@ export default {
87
124
  type: { summary: 'string' },
88
125
  },
89
126
  },
127
+ optgroups: {
128
+ ...formatArgType({ selectOptionGroups }),
129
+ control: 'object',
130
+ description: 'Determines grouped values found inside Select',
131
+ isCustom: true,
132
+ table: {
133
+ defaultValue: { summary: '[]' },
134
+ type: { summary: 'SelectOptionGroup[]' },
135
+ },
136
+ },
90
137
  options: {
91
138
  ...formatArgType({ selectOptions }),
92
139
  control: 'object',
93
- description: 'Determines values found inside Select',
140
+ description: 'Determines ungrouped values found inside Select',
94
141
  isCustom: true,
95
142
  table: {
96
143
  defaultValue: { summary: '[]' },
@@ -130,6 +177,7 @@ export default {
130
177
  inputId: '',
131
178
  label: 'Input label',
132
179
  name: '',
180
+ optgroups: selectOptionGroups,
133
181
  options: selectOptions,
134
182
  required: undefined,
135
183
  supportingText: '',
@@ -1,5 +1,5 @@
1
1
  import type { FormValueTransformer } from '@/types/Form';
2
- import type { SelectOption } from '@/types/Select';
2
+ import type { SelectOptionGroup, SelectOption } from '@/types/Select';
3
3
  import type { TextInputType } from '@/types/TextInput';
4
4
  import type { ValidationError, Validator } from '@/types/Validation';
5
5
 
@@ -25,7 +25,8 @@ interface GenericInput {
25
25
  }
26
26
 
27
27
  interface SelectField extends GenericInput, StringValue {
28
- options: SelectOption[];
28
+ optgroups?: SelectOptionGroup[];
29
+ options?: SelectOption[];
29
30
  }
30
31
 
31
32
  interface StringValue {
package/src/types/Form.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { SelectOptGroup, SelectOption } from '@/types/Select';
1
+ import type { SelectOptionGroup, SelectOption } from '@/types/Select';
2
2
  import type { TextInputType } from '@/types/TextInput';
3
3
  import type { ValidationError, Validator } from '@/types/Validation';
4
4
 
@@ -24,7 +24,7 @@ export type SelectInput = GenericInput &
24
24
  StringValue & {
25
25
  options?: SelectOption[] | readonly SelectOption[];
26
26
  placeholder?: string;
27
- optgroups?: SelectOptGroup[];
27
+ optgroups?: SelectOptionGroup[];
28
28
  };
29
29
 
30
30
  export type TextInput = GenericInput &
@@ -3,8 +3,7 @@ export type SelectOption = {
3
3
  value: any;
4
4
  };
5
5
 
6
- export type SelectOptGroup = {
6
+ export type SelectOptionGroup = {
7
7
  label: string;
8
8
  options?: SelectOption[];
9
- value?: any;
10
9
  };