@tedi-design-system/react 17.1.0-rc.7 → 17.1.0-rc.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.
Files changed (96) hide show
  1. package/_virtual/index.es13.js +2 -2
  2. package/_virtual/index.es14.js +2 -2
  3. package/bundle-stats.html +1 -1
  4. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  5. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  6. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  7. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  8. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  9. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  10. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  11. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  12. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  13. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  14. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  15. package/external/prop-types/external/react-is/index.es.js +1 -1
  16. package/external/react-is/index.cjs.js +1 -1
  17. package/external/react-is/index.es.js +1 -1
  18. package/external/toposort/index.cjs.js +1 -1
  19. package/external/toposort/index.es.js +1 -1
  20. package/index.css +1 -1
  21. package/package.json +1 -1
  22. package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js +1 -1
  23. package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js +70 -70
  24. package/src/tedi/components/form/input-group/components/input/input.es.js +8 -8
  25. package/src/tedi/components/form/input-group/components/prefix/prefix.es.js +10 -10
  26. package/src/tedi/components/form/input-group/components/suffix/suffix.es.js +6 -6
  27. package/src/tedi/components/form/input-group/input-group.es.js +13 -13
  28. package/src/tedi/components/form/select/components/select-bulk-helpers.cjs.js +1 -0
  29. package/src/tedi/components/form/select/components/select-bulk-helpers.d.ts +55 -0
  30. package/src/tedi/components/form/select/components/select-bulk-helpers.es.js +34 -0
  31. package/src/tedi/components/form/select/components/select-group-bulk-context.cjs.js +1 -0
  32. package/src/tedi/components/form/select/components/select-group-bulk-context.d.ts +18 -0
  33. package/src/tedi/components/form/select/components/select-group-bulk-context.es.js +6 -0
  34. package/src/tedi/components/form/select/components/select-group-heading.cjs.js +1 -1
  35. package/src/tedi/components/form/select/components/select-group-heading.d.ts +4 -1
  36. package/src/tedi/components/form/select/components/select-group-heading.es.js +43 -8
  37. package/src/tedi/components/form/select/components/select-group.cjs.js +1 -1
  38. package/src/tedi/components/form/select/components/select-group.d.ts +4 -1
  39. package/src/tedi/components/form/select/components/select-group.es.js +18 -6
  40. package/src/tedi/components/form/select/components/select-menu-list.cjs.js +1 -1
  41. package/src/tedi/components/form/select/components/select-menu-list.d.ts +9 -1
  42. package/src/tedi/components/form/select/components/select-menu-list.es.js +22 -8
  43. package/src/tedi/components/form/select/components/select-multi-option.cjs.js +1 -1
  44. package/src/tedi/components/form/select/components/select-multi-option.es.js +40 -18
  45. package/src/tedi/components/form/select/components/select-multi-value.cjs.js +1 -1
  46. package/src/tedi/components/form/select/components/select-multi-value.d.ts +12 -1
  47. package/src/tedi/components/form/select/components/select-multi-value.es.js +42 -8
  48. package/src/tedi/components/form/select/components/select-single-option.cjs.js +1 -1
  49. package/src/tedi/components/form/select/components/select-single-option.es.js +5 -4
  50. package/src/tedi/components/form/select/components/select-single-value.cjs.js +1 -0
  51. package/src/tedi/components/form/select/components/select-single-value.d.ts +3 -0
  52. package/src/tedi/components/form/select/components/select-single-value.es.js +9 -0
  53. package/src/tedi/components/form/select/components/select-tags-context.cjs.js +1 -0
  54. package/src/tedi/components/form/select/components/select-tags-context.d.ts +11 -0
  55. package/src/tedi/components/form/select/components/select-tags-context.es.js +9 -0
  56. package/src/tedi/components/form/select/components/select-value-container.cjs.js +1 -1
  57. package/src/tedi/components/form/select/components/select-value-container.d.ts +12 -2
  58. package/src/tedi/components/form/select/components/select-value-container.es.js +76 -13
  59. package/src/tedi/components/form/select/select.cjs.js +1 -1
  60. package/src/tedi/components/form/select/select.d.ts +258 -0
  61. package/src/tedi/components/form/select/select.es.js +265 -175
  62. package/src/tedi/components/form/select/select.module.scss.cjs.js +1 -1
  63. package/src/tedi/components/form/select/select.module.scss.es.js +14 -5
  64. package/src/tedi/components/form/textfield/textfield.cjs.js +1 -1
  65. package/src/tedi/components/form/textfield/textfield.es.js +110 -110
  66. package/src/tedi/components/form/time-field/time-field-helpers.cjs.js +1 -0
  67. package/src/tedi/components/form/time-field/time-field-helpers.d.ts +51 -0
  68. package/src/tedi/components/form/time-field/time-field-helpers.es.js +65 -0
  69. package/src/tedi/components/form/time-field/time-field.cjs.js +1 -0
  70. package/src/tedi/components/form/time-field/time-field.d.ts +87 -0
  71. package/src/tedi/components/form/time-field/time-field.es.js +149 -0
  72. package/src/tedi/components/form/time-field/time-field.module.scss.cjs.js +1 -0
  73. package/src/tedi/components/form/time-field/time-field.module.scss.es.js +10 -0
  74. package/src/tedi/components/form/time-picker/components/time-grid/time-grid.cjs.js +1 -0
  75. package/src/tedi/components/form/time-picker/components/time-grid/time-grid.d.ts +38 -0
  76. package/src/tedi/components/form/time-picker/components/time-grid/time-grid.es.js +101 -0
  77. package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.cjs.js +1 -0
  78. package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.d.ts +40 -0
  79. package/src/tedi/components/form/time-picker/components/time-wheel/time-wheel.es.js +184 -0
  80. package/src/tedi/components/form/time-picker/time-picker.cjs.js +1 -0
  81. package/src/tedi/components/form/time-picker/time-picker.d.ts +60 -0
  82. package/src/tedi/components/form/time-picker/time-picker.es.js +45 -0
  83. package/src/tedi/components/form/time-picker/time-picker.module.scss.cjs.js +1 -0
  84. package/src/tedi/components/form/time-picker/time-picker.module.scss.es.js +14 -0
  85. package/src/tedi/components/overlays/dropdown/dropdown.cjs.js +1 -1
  86. package/src/tedi/components/overlays/dropdown/dropdown.d.ts +9 -0
  87. package/src/tedi/components/overlays/dropdown/dropdown.es.js +98 -88
  88. package/src/tedi/components/tags/tag/tag.cjs.js +1 -1
  89. package/src/tedi/components/tags/tag/tag.d.ts +8 -0
  90. package/src/tedi/components/tags/tag/tag.es.js +14 -13
  91. package/src/tedi/index.d.ts +2 -0
  92. package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
  93. package/src/tedi/providers/label-provider/labels-map.d.ts +14 -0
  94. package/src/tedi/providers/label-provider/labels-map.es.js +14 -0
  95. package/tedi.cjs.js +1 -1
  96. package/tedi.es.js +170 -166
@@ -9,55 +9,295 @@ declare module 'react-select/dist/declarations/src/Select' {
9
9
  }
10
10
  }
11
11
  export interface SelectProps extends Omit<FormLabelProps, 'id' | 'label'> {
12
+ /**
13
+ * Unique HTML id for the input. Also used as react-select's `instanceId` for SSR-stable internal IDs.
14
+ * When omitted, falls back to the surrounding `InputGroup`'s id or a generated `useId()`.
15
+ */
12
16
  id?: string;
17
+ /** Visible label. May be omitted when the surrounding `InputGroup` provides its own label. */
13
18
  label?: string;
19
+ /**
20
+ * The list of selectable options. Pass a flat `ISelectOption[]` for a simple
21
+ * list, or an array of `IGroupedOptions` (each with its own `options` array)
22
+ * for a grouped menu.
23
+ */
14
24
  options?: OptionsOrGroups<ISelectOption, IGroupedOptions<ISelectOption>>;
25
+ /**
26
+ * Used in async mode (`async: true`).
27
+ * - `true` — call `loadOptions` once on mount with an empty input string
28
+ * and use the result as the initial option list.
29
+ * - An array — show these options before the user types anything.
30
+ * - Omit — start with no options until the user types.
31
+ */
15
32
  defaultOptions?: OptionsOrGroups<ISelectOption, IGroupedOptions<ISelectOption>> | boolean;
33
+ /** Text shown in the field when no value is selected. */
16
34
  placeholder?: string;
35
+ /** Extra class on the root wrapper. Use `classNames` for per-subcomponent overrides. */
17
36
  className?: string;
37
+ /**
38
+ * Icon shown on the right of the field as the dropdown indicator.
39
+ * - `"arrow_drop_down"` (default) — standard select chevron.
40
+ * - `"search"` — magnifier; useful for combobox-style search fields.
41
+ * @default 'arrow_drop_down'
42
+ */
18
43
  iconName?: 'arrow_drop_down' | 'search';
44
+ /**
45
+ * Fires whenever the selection changes. Receives the new value:
46
+ * a single `ISelectOption` (single-select), an array (multi-select),
47
+ * or `null` when cleared.
48
+ */
19
49
  onChange?: (value: TSelectValue) => void;
50
+ /**
51
+ * Fires whenever the user types in the search input. Receives the new input
52
+ * string and a `react-select` action descriptor (e.g. `'input-change'`,
53
+ * `'menu-close'`). Use this to drive controlled search.
54
+ */
20
55
  onInputChange?: (value: string, actionMeta: InputActionMeta) => void;
56
+ /** Controlled search input string. Pair with `onInputChange` to manage it from the parent. */
21
57
  inputValue?: string;
58
+ /**
59
+ * Async option loader. Called with the current search string; resolve the
60
+ * `callback` with the matching options. Only invoked when `async: true`.
61
+ */
22
62
  loadOptions?: (inputValue: string, callback: (options: OptionsOrGroups<ISelectOption, IGroupedOptions<ISelectOption>>) => void) => void;
63
+ /** When `true`, shows a loading spinner in the indicator area. Useful while async results are pending. */
23
64
  isLoading?: boolean;
65
+ /** Uncontrolled initial selection. Ignored when `value` is provided. */
24
66
  defaultValue?: TSelectValue;
67
+ /**
68
+ * Controlled selection. When set, the parent owns the value and must update
69
+ * it via `onChange`. Use `defaultValue` for uncontrolled usage.
70
+ */
25
71
  value?: TSelectValue;
72
+ /** Disables interaction and applies disabled styling. */
26
73
  disabled?: boolean;
74
+ /** Form field name; rendered onto the underlying hidden input for form submission. */
27
75
  name?: string;
76
+ /**
77
+ * Forces error styling. Also set automatically when `helper.type === 'error'`.
78
+ * @default false
79
+ */
28
80
  invalid?: boolean;
81
+ /**
82
+ * Forces valid (success) styling. Also set automatically when `helper.type === 'valid'`.
83
+ * @default false
84
+ */
29
85
  valid?: boolean;
86
+ /**
87
+ * Helper / feedback text rendered below the field. Set `type` to `'hint'`,
88
+ * `'error'`, or `'valid'` — the latter two also drive the field's invalid /
89
+ * valid visual state.
90
+ */
30
91
  helper?: FeedbackTextProps;
92
+ /**
93
+ * Visual size variant.
94
+ * - omit — default (40px tall).
95
+ * - `"small"` — compact (32px tall) for dense layouts.
96
+ */
31
97
  size?: 'small';
98
+ /**
99
+ * Switches the underlying component to `react-select`'s `AsyncSelect`. Pair
100
+ * with `loadOptions` (and optionally `defaultOptions`) to fetch options on
101
+ * the fly.
102
+ * @default false
103
+ */
32
104
  async?: boolean;
105
+ /**
106
+ * Custom renderer for the content of each option in the dropdown. Receives
107
+ * the full option props from `react-select`; return any React node. Use
108
+ * `renderValue` if you also want to customise how the selected value
109
+ * appears in the trigger.
110
+ */
33
111
  renderOption?: (props: OptionProps<ISelectOption, boolean>) => JSX.Element;
112
+ /**
113
+ * Message shown when the option list is empty (no matches for the search,
114
+ * or no options at all). Defaults to the localised `select.no-options`
115
+ * label from `LabelProvider`.
116
+ */
34
117
  noOptionsMessage?: (obj: {
35
118
  inputValue: string;
36
119
  }) => React.ReactNode;
120
+ /**
121
+ * Message shown while async options are loading. Defaults to the localised
122
+ * `select.loading` label from `LabelProvider`.
123
+ */
37
124
  loadingMessage?: (obj: {
38
125
  inputValue: string;
39
126
  }) => React.ReactNode;
127
+ /**
128
+ * Renders custom content underneath the option list, inside the dropdown
129
+ * (e.g. a "Show more" button or a "powered by" footer).
130
+ */
40
131
  renderMessageListFooter?: (props: MenuListProps<ISelectOption, boolean>) => JSX.Element;
132
+ /**
133
+ * Enables multi-select mode: the field renders selections as removable
134
+ * tags and `onChange` receives an array.
135
+ * @default false
136
+ */
41
137
  multiple?: boolean;
138
+ /**
139
+ * Layout for selected tags in multi-select mode.
140
+ * - `"stack"` (default) — tags wrap onto multiple rows.
141
+ * - `"row"` — tags stay on one row; overflow tags collapse into a `+N`
142
+ * counter, just like the Angular `multiRow=false` mode.
143
+ * @default 'stack'
144
+ */
42
145
  tagsDirection?: 'stack' | 'row';
146
+ /**
147
+ * Layout for the dropdown menu.
148
+ * - `"menu"` (default): vertical list of options.
149
+ * - `"grid"`: swatch grid for color / icon pickers and similar compact
150
+ * pickers. Grid sizing is customizable via the `--tedi-swatch-size`,
151
+ * `--tedi-swatch-gap`, and `--tedi-swatch-columns` CSS variables on the
152
+ * menu list element.
153
+ * @default 'menu'
154
+ */
155
+ dropdownType?: 'menu' | 'grid';
156
+ /**
157
+ * Custom renderer for the trigger value (single-select). Receives the
158
+ * currently selected option and may return any React node — useful for
159
+ * color swatches, icons, or any non-text representation in the field.
160
+ * Ignored in multi-select mode (use `renderOption` for tag rendering).
161
+ */
162
+ renderValue?: (option: ISelectOption) => React.ReactNode;
163
+ /**
164
+ * In multi-select mode, prepends a "Select all" toggle to the menu list.
165
+ * Toggles every enabled option (or, when filtering, every visible enabled
166
+ * option) on/off. Indeterminate when only some are selected. Ignored when
167
+ * `multiple` is false.
168
+ * @default false
169
+ */
170
+ showSelectAll?: boolean;
171
+ /**
172
+ * In multi-select mode with grouped options, makes each group heading a
173
+ * checkbox that toggles the whole group. Indeterminate when only some
174
+ * options in the group are selected. Ignored when `multiple` is false or
175
+ * `options` is not grouped.
176
+ * @default false
177
+ */
178
+ selectableGroups?: boolean;
179
+ /**
180
+ * Open the menu automatically when the input first receives focus.
181
+ * @default false
182
+ */
43
183
  openMenuOnFocus?: boolean;
184
+ /**
185
+ * Open the menu when the trigger area is clicked.
186
+ * @default true
187
+ */
44
188
  openMenuOnClick?: boolean;
189
+ /**
190
+ * Treat the Tab key as a confirm-and-move-on for the currently focused
191
+ * option (otherwise Tab simply moves focus out of the menu without
192
+ * selecting).
193
+ * @default false
194
+ */
45
195
  tabSelectsValue?: boolean;
196
+ /**
197
+ * Close the menu after each successful selection. Default depends on
198
+ * `multiple`: `true` for single-select, `false` for multi-select so the
199
+ * user can pick several options without re-opening.
200
+ */
46
201
  closeMenuOnSelect?: boolean;
202
+ /**
203
+ * Blur the search input after each selection. Useful if you want to
204
+ * collapse the cursor immediately on pick.
205
+ * @default false
206
+ */
47
207
  blurInputOnSelect?: boolean;
208
+ /**
209
+ * Focus the input on initial mount.
210
+ * @default false
211
+ */
48
212
  autoFocus?: boolean;
213
+ /**
214
+ * Whether the value can be cleared via the "×" indicator. The visible
215
+ * "×" button only appears if `isClearIndicatorVisible` is also `true`
216
+ * (that prop is now deprecated; see its docstring for migration plans).
217
+ * Backspace deletion is controlled separately by `backspaceRemovesValue`
218
+ * (default `false`).
219
+ * @default true
220
+ */
49
221
  isClearable?: boolean;
222
+ /**
223
+ * @deprecated This prop will be removed in a future major version.
224
+ *
225
+ * `isClearable` and `isClearIndicatorVisible` overlap: `isClearable` already
226
+ * controls whether the value can be cleared, and `isClearIndicatorVisible`
227
+ * only adds an extra gate on whether the visible "×" button renders. The
228
+ * default combination (`isClearable: true`, `isClearIndicatorVisible: false`)
229
+ * leaves consumers in a state where Backspace clears the value but no
230
+ * affordance is shown — a hidden interaction.
231
+ *
232
+ * In a future major version the prop will be removed and `isClearable`
233
+ * alone will control both behaviour and visibility (matching `react-select`
234
+ * and the Angular implementation). For new code, prefer `isClearable` and
235
+ * leave this prop unset.
236
+ */
50
237
  isClearIndicatorVisible?: boolean;
238
+ /**
239
+ * Allow filtering the option list by typing. Set to `false` for a pure
240
+ * dropdown with no search input (e.g. color/icon pickers).
241
+ * @default true
242
+ */
51
243
  isSearchable?: boolean;
244
+ /**
245
+ * In multi-select mode, render an "×" remove button on each selected tag
246
+ * so the user can deselect single options without re-opening the menu.
247
+ * @default false
248
+ */
52
249
  isTagRemovable?: boolean;
250
+ /**
251
+ * If `true`, pressing Backspace while the input is empty removes the
252
+ * last selected value (single-mode: clears it; multi-mode: pops the
253
+ * last tag). Disabled by default because react-select's upstream
254
+ * default (`true`) leads to accidental deletions, especially in
255
+ * multi-select with no visual cue for the affected tag.
256
+ * @default false
257
+ */
258
+ backspaceRemovesValue?: boolean;
259
+ /**
260
+ * Controlled menu open state. When set, the parent owns whether the menu
261
+ * is showing — pair with `onMenuOpen` / `onMenuClose`.
262
+ */
53
263
  menuIsOpen?: boolean;
264
+ /** Fires when the menu opens (uncontrolled or controlled). */
54
265
  onMenuOpen?: () => void;
266
+ /** Fires when the menu closes (uncontrolled or controlled). */
55
267
  onMenuClose?: () => void;
268
+ /** Fires when the input loses focus. */
56
269
  onBlur?: () => void;
270
+ /**
271
+ * Hide the underlying text input (its width collapses to 0). Useful when
272
+ * the field is a pure picker with no typing — the value display still
273
+ * shows, but the cursor caret area is removed.
274
+ */
57
275
  inputIsHidden?: boolean;
276
+ /**
277
+ * Typography overrides applied to group headings (when `options` is
278
+ * grouped). `text` on an individual `IGroupedOptions` entry takes
279
+ * precedence over this default.
280
+ * @default { modifiers: 'small', color: 'tertiary' }
281
+ */
58
282
  optionGroupHeadingText?: Pick<TextProps, 'modifiers' | 'color'>;
283
+ /**
284
+ * In async mode, cache the result of each `loadOptions` call by input
285
+ * string so the same query isn't re-fetched.
286
+ * @default false
287
+ */
59
288
  cacheOptions?: boolean;
289
+ /**
290
+ * In single-select mode, render each option with a leading radio button
291
+ * for a more explicit "pick one" UI. Has no effect in multi-select mode.
292
+ * @default false
293
+ */
60
294
  showRadioButtons?: boolean;
295
+ /**
296
+ * Per-subcomponent class overrides forwarded to react-select's `classNames`
297
+ * map. Each entry adds an extra class onto the corresponding internal
298
+ * subcomponent; use this for one-off styling without losing the default
299
+ * `tedi-select__*` BEM classes.
300
+ */
61
301
  classNames?: {
62
302
  clearIndicator?: string;
63
303
  container?: string;
@@ -83,15 +323,33 @@ export interface SelectProps extends Omit<FormLabelProps, 'id' | 'label'> {
83
323
  valueContainer?: string;
84
324
  };
85
325
  }
326
+ /**
327
+ * One option in the select list. `customData` is a typed escape hatch for
328
+ * carrying domain data alongside the display label — `renderOption` /
329
+ * `renderValue` can read it back via `props.data.customData`.
330
+ */
86
331
  export interface ISelectOption<CustomData = unknown> {
332
+ /** The string written into the form value when this option is picked. */
87
333
  value: string;
334
+ /** Display label. Strings are searchable; React nodes render as-is and aren't filtered by search. */
88
335
  label: string | React.ReactNode | React.ReactNode[];
336
+ /** When `true`, the option appears greyed out and can't be picked. */
89
337
  isDisabled?: boolean;
338
+ /** Arbitrary data attached to the option, accessible inside custom renderers. */
90
339
  customData?: CustomData;
91
340
  }
341
+ /**
342
+ * A group of options in a grouped select. Extends react-select's `GroupBase`
343
+ * with a `text` field that overrides typography for this specific heading.
344
+ */
92
345
  export interface IGroupedOptions<CustomOption = unknown> extends GroupBase<CustomOption> {
346
+ /** Typography override for this group heading. Falls back to `optionGroupHeadingText`. */
93
347
  text?: Pick<TextProps, 'modifiers' | 'color'>;
94
348
  }
349
+ /**
350
+ * Shape of the Select's value: a single option (single-select), an array
351
+ * (multi-select), or `null` when empty.
352
+ */
95
353
  export type TSelectValue<CustomData = unknown> = ISelectOption<CustomData> | ReadonlyArray<ISelectOption<CustomData>> | null;
96
354
  export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<SelectInstance<ISelectOption<unknown>, boolean, IGroupedOptions<ISelectOption<unknown>>>>>;
97
355
  export default Select;