@indico-data/design-system 2.12.0 → 2.13.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -60,7 +60,7 @@ const meta: Meta = {
60
60
  },
61
61
  isRequired: {
62
62
  control: 'boolean',
63
- description: 'Toggles the required astherisc on the label',
63
+ description: 'Toggles the required asterisk on the label',
64
64
  table: {
65
65
  category: 'Props',
66
66
  type: {
@@ -80,16 +80,16 @@ const meta: Meta = {
80
80
  },
81
81
  defaultValue: { summary: 'false' },
82
82
  },
83
- errorList: {
83
+ errorMessage: {
84
84
  control: false,
85
- description: 'An array of error messages',
85
+ description: 'Error message',
86
86
  table: {
87
87
  category: 'Props',
88
88
  type: {
89
- summary: 'string[]',
89
+ summary: 'string',
90
90
  },
91
91
  },
92
- defaultValue: { summary: '[]' },
92
+ defaultValue: { summary: '' },
93
93
  },
94
94
  helpText: {
95
95
  control: 'text',
@@ -164,14 +164,14 @@ export const Default: Story = {
164
164
  placeholder: 'Please enter a value',
165
165
  hasHiddenLabel: false,
166
166
  isDisabled: false,
167
- errorList: [],
167
+ errorMessage: '',
168
168
  value: '',
169
169
  },
170
170
  render: (args) => {
171
171
  const [value, setValue] = useState('');
172
172
 
173
173
  useEffect(() => {
174
- setValue(args.value);
174
+ setValue(args.value || '');
175
175
  }, [args.value]);
176
176
 
177
177
  const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
@@ -184,13 +184,13 @@ export const Default: Story = {
184
184
  export const Errors: Story = {
185
185
  args: {
186
186
  ...defaultArgs,
187
- errorList: ['You require a username value.'],
187
+ errorMessage: 'You require a username value.',
188
188
  },
189
189
  render: (args) => {
190
190
  const [value, setValue] = useState('');
191
191
 
192
192
  useEffect(() => {
193
- setValue(args.value);
193
+ setValue(args.value || '');
194
194
  }, [args.value]);
195
195
 
196
196
  const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
@@ -210,7 +210,7 @@ export const HiddenLabel: Story = {
210
210
  const [value, setValue] = useState('');
211
211
 
212
212
  useEffect(() => {
213
- setValue(args.value);
213
+ setValue(args.value || '');
214
214
  }, [args.value]);
215
215
 
216
216
  const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
@@ -230,7 +230,7 @@ export const HelpText: Story = {
230
230
  const [value, setValue] = useState('');
231
231
 
232
232
  useEffect(() => {
233
- setValue(args.value);
233
+ setValue(args.value || '');
234
234
  }, [args.value]);
235
235
 
236
236
  const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
@@ -250,7 +250,7 @@ export const Clearable: Story = {
250
250
  const [value, setValue] = useState('');
251
251
 
252
252
  useEffect(() => {
253
- setValue(args.value);
253
+ setValue(args.value || '');
254
254
  }, [args.value]);
255
255
 
256
256
  const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
@@ -270,7 +270,7 @@ export const Icon: Story = {
270
270
  const [value, setValue] = useState('');
271
271
 
272
272
  useEffect(() => {
273
- setValue(args.value);
273
+ setValue(args.value || '');
274
274
  }, [args.value]);
275
275
 
276
276
  const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
@@ -290,7 +290,7 @@ export const Required: Story = {
290
290
  const [value, setValue] = useState('');
291
291
 
292
292
  useEffect(() => {
293
- setValue(args.value);
293
+ setValue(args.value || '');
294
294
  }, [args.value]);
295
295
 
296
296
  const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
@@ -0,0 +1,12 @@
1
+ import { Canvas, Meta, Controls } from '@storybook/blocks';
2
+ import * as Select from './Select.stories';
3
+
4
+ <Meta title="Forms/Select" name="Select" />
5
+
6
+ # Select
7
+
8
+ The select component is a flexible dropdown component that allows users to choose from a list of options. It supports various configurations, such as searchable, clearable, and custom components. It is recommended to use this component with [React Hook Form](https://react-hook-form.com/) for better form state management and best practices. The `Select` component is built using `react-select`, so refer to its [documentation](https://react-select.com/props) for full details on available props.
9
+
10
+ <Canvas of={Select.Default} />
11
+
12
+ <Controls of={Select.Default} />
@@ -83,6 +83,18 @@ const meta: Meta<SelectProps<SelectOption>> = {
83
83
  },
84
84
  defaultValue: { summary: '' },
85
85
  },
86
+ classNamePrefix: {
87
+ control: 'text',
88
+ description:
89
+ 'The prefix to use for the CSS class names. Changing this will result in losing all default styles',
90
+ table: {
91
+ category: 'Props',
92
+ type: {
93
+ summary: 'string',
94
+ },
95
+ },
96
+ defaultValue: { summary: 'select' },
97
+ },
86
98
  onChange: {
87
99
  control: false,
88
100
  description: 'Event handler for when the selected value changes',
@@ -115,4 +127,11 @@ export const Default: Story = {
115
127
  isDisabled: false,
116
128
  isLoading: false,
117
129
  },
130
+ decorators: [
131
+ (Story) => (
132
+ <div style={{ height: 175 }}>
133
+ <Story />
134
+ </div>
135
+ ),
136
+ ],
118
137
  };