@indico-data/design-system 2.60.7 → 2.60.9

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.60.7",
3
+ "version": "2.60.9",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -159,6 +159,26 @@ const meta: Meta<typeof InputDateRangePicker> = {
159
159
  },
160
160
  },
161
161
  },
162
+ fromLabel: {
163
+ control: 'text',
164
+ description: 'The label for the `from` input.',
165
+ table: {
166
+ category: 'Props',
167
+ type: {
168
+ summary: 'string',
169
+ },
170
+ },
171
+ },
172
+ toLabel: {
173
+ control: 'text',
174
+ description: 'The label for the `to` input.',
175
+ table: {
176
+ category: 'Props',
177
+ type: {
178
+ summary: 'string',
179
+ },
180
+ },
181
+ },
162
182
  month: {
163
183
  control: 'date',
164
184
  description: 'The currently displayed month.',
@@ -190,6 +210,9 @@ export const RangeInput: Story = {
190
210
  toErrorMessage: '',
191
211
  fromErrorMessage: '',
192
212
  ariaLabel: 'Date Picker',
213
+ fromLabel: 'From Date',
214
+ toLabel: 'To Date',
215
+ gutterWidth: 2,
193
216
  isOpen: false,
194
217
  selected: { from: new Date(), to: new Date(new Date().getTime() + 5 * 24 * 60 * 60 * 1000) },
195
218
  },
@@ -25,6 +25,9 @@ interface InputDateRangePickerProps {
25
25
  toErrorMessage?: string | undefined;
26
26
  fromErrorMessage?: string | undefined;
27
27
  'data-testid'?: string;
28
+ gutterWidth?: number;
29
+ fromLabel?: string;
30
+ toLabel?: string;
28
31
  }
29
32
 
30
33
  export function InputDateRangePicker(props: InputDateRangePickerProps) {
@@ -44,6 +47,9 @@ export function InputDateRangePicker(props: InputDateRangePickerProps) {
44
47
  inputIconName,
45
48
  toErrorMessage,
46
49
  fromErrorMessage,
50
+ gutterWidth,
51
+ fromLabel,
52
+ toLabel,
47
53
  ...rest
48
54
  } = props;
49
55
 
@@ -107,7 +113,7 @@ export function InputDateRangePicker(props: InputDateRangePickerProps) {
107
113
 
108
114
  return (
109
115
  <FloatUI isOpen={isOpen} ariaLabel={ariaLabel}>
110
- <Row>
116
+ <Row gutterWidth={gutterWidth}>
111
117
  <Col>
112
118
  <Input
113
119
  id={`${inputId}-from`}
@@ -117,7 +123,7 @@ export function InputDateRangePicker(props: InputDateRangePickerProps) {
117
123
  iconName={inputIconName}
118
124
  onChange={(e) => handleInputChange(e, 'from')}
119
125
  errorMessage={fromErrorMessage}
120
- label={'From Date'}
126
+ label={fromLabel}
121
127
  name={'From Date'}
122
128
  data-testid="date-picker-from"
123
129
  />
@@ -131,7 +137,7 @@ export function InputDateRangePicker(props: InputDateRangePickerProps) {
131
137
  iconName={inputIconName}
132
138
  onChange={(e) => handleInputChange(e, 'to')}
133
139
  errorMessage={toErrorMessage}
134
- label={'To Date'}
140
+ label={toLabel}
135
141
  name={'To Date'}
136
142
  data-testid="date-picker-to"
137
143
  />
@@ -1,11 +1,45 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
2
  import { Select, SelectProps } from './Select';
3
3
  import { SelectOption } from './types';
4
+ import { LabelProps } from '../subcomponents/Label';
4
5
 
5
- const meta: Meta<SelectProps<SelectOption>> = {
6
+ const meta: Meta<SelectProps<SelectOption> & LabelProps> = {
6
7
  title: 'Forms/Select',
7
8
  component: Select,
8
9
  argTypes: {
10
+ name: {
11
+ control: 'text',
12
+ description: 'The name of the select component',
13
+ table: {
14
+ category: 'Props',
15
+ type: {
16
+ summary: 'string',
17
+ },
18
+ },
19
+ defaultValue: { summary: '' },
20
+ },
21
+ hasHiddenLabel: {
22
+ control: 'boolean',
23
+ description: 'Toggles the visibility of the label',
24
+ table: {
25
+ category: 'Props',
26
+ type: {
27
+ summary: 'boolean',
28
+ },
29
+ },
30
+ defaultValue: { summary: 'false' },
31
+ },
32
+ label: {
33
+ control: 'text',
34
+ description: 'The label for the select component',
35
+ table: {
36
+ category: 'Props',
37
+ type: {
38
+ summary: 'string',
39
+ },
40
+ },
41
+ defaultValue: { summary: '' },
42
+ },
9
43
  options: {
10
44
  control: 'object',
11
45
  description: 'Options for the select component',
@@ -126,6 +160,9 @@ export const Default: Story = {
126
160
  isSearchable: true,
127
161
  isDisabled: false,
128
162
  isLoading: false,
163
+ hasHiddenLabel: false,
164
+ label: 'Select an option...',
165
+ name: 'select',
129
166
  },
130
167
  decorators: [
131
168
  (Story) => (
@@ -2,9 +2,13 @@ import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import ReactSelect, { Props as ReactSelectProps, components, OptionProps } from 'react-select';
4
4
  import { SelectOption } from './types';
5
+ import { withLabel } from '../subcomponents/Label';
5
6
 
6
7
  export interface SelectProps<OptionType extends SelectOption> extends ReactSelectProps<OptionType> {
7
8
  options: OptionType[];
9
+ label?: string;
10
+ name?: string;
11
+ hasHiddenLabel?: boolean;
8
12
  }
9
13
 
10
14
  const OptionComponent = <OptionType extends SelectOption>({
@@ -20,10 +24,13 @@ const OptionComponent = <OptionType extends SelectOption>({
20
24
  );
21
25
  };
22
26
 
23
- export const Select = <OptionType extends SelectOption>({
27
+ const Select = <OptionType extends SelectOption>({
24
28
  classNamePrefix = 'select',
25
29
  className,
26
30
  components: customComponents,
31
+ label,
32
+ hasHiddenLabel,
33
+ name,
27
34
  ...props
28
35
  }: SelectProps<OptionType>) => {
29
36
  const defaultComponents = {
@@ -41,3 +48,7 @@ export const Select = <OptionType extends SelectOption>({
41
48
  />
42
49
  );
43
50
  };
51
+
52
+ const LabeledSelect = withLabel(Select);
53
+
54
+ export { LabeledSelect as Select };
@@ -1,7 +1,7 @@
1
1
  import React, { forwardRef } from 'react';
2
2
 
3
3
  export interface LabelProps {
4
- label: string;
4
+ label?: string;
5
5
  name: string;
6
6
  isRequired?: boolean;
7
7
  hasHiddenLabel?: boolean;
package/src/index.ts CHANGED
@@ -19,6 +19,7 @@ export { DatePicker } from './components/forms/date/datePicker/DatePicker';
19
19
  export { TimePicker } from './components/forms/timePicker';
20
20
  export { IconTriggerDatePicker } from './components/forms/date/iconTriggerDatePicker';
21
21
  export { SingleInputDatePicker } from './components/forms/date/inputDatePicker';
22
+ export { InputDateRangePicker } from './components/forms/date/inputDateRangePicker';
22
23
  export { Form } from './components/forms/form';
23
24
  export { Skeleton } from './components/skeleton';
24
25
  export { Card } from './components/card';
@@ -46,3 +47,5 @@ export type {
46
47
  Row as TanstackTableRowType,
47
48
  Table as TanstackTableType,
48
49
  } from '@tanstack/react-table';
50
+ export type { DateRange } from 'react-day-picker';
51
+ export type { SelectOption } from './components/forms/select/types';