@donotdev/components 0.2.3 → 0.3.1

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 (120) hide show
  1. package/dist/CarouselContent-5W2E2F2I.js +1 -0
  2. package/dist/CarouselContent-EELYAALW.js +1 -0
  3. package/dist/CodeContent-7FWYPAB3.js +2 -0
  4. package/dist/CodeContent-E3HLW6BW.js +2 -0
  5. package/dist/advanced/Carousel/Carousel.d.ts +6 -4
  6. package/dist/advanced/Carousel/Carousel.d.ts.map +1 -1
  7. package/dist/advanced/Carousel/Carousel.js +10 -8
  8. package/dist/advanced/Carousel/CarouselContent.d.ts +35 -3
  9. package/dist/advanced/Carousel/CarouselContent.d.ts.map +1 -1
  10. package/dist/advanced/Carousel/CarouselContent.js +103 -67
  11. package/dist/advanced/Carousel/CarouselSkeleton.d.ts +3 -1
  12. package/dist/advanced/Carousel/CarouselSkeleton.d.ts.map +1 -1
  13. package/dist/advanced/Carousel/CarouselSkeleton.js +2 -2
  14. package/dist/advanced/ImageGallery/ImageGallery.d.ts +12 -2
  15. package/dist/advanced/ImageGallery/ImageGallery.d.ts.map +1 -1
  16. package/dist/advanced/ImageGallery/ImageGallery.js +3 -3
  17. package/dist/atomic/ActionButton/index.d.ts +1 -1
  18. package/dist/atomic/ActionButton/index.js +1 -1
  19. package/dist/atomic/Alert/index.d.ts +1 -1
  20. package/dist/atomic/Badge/index.d.ts +1 -1
  21. package/dist/atomic/Button/index.d.ts +30 -1
  22. package/dist/atomic/Button/index.d.ts.map +1 -1
  23. package/dist/atomic/Button/index.js +38 -1
  24. package/dist/atomic/Card/cover.d.ts +8 -1
  25. package/dist/atomic/Card/cover.d.ts.map +1 -1
  26. package/dist/atomic/Card/cover.js +2 -2
  27. package/dist/atomic/Card/index.d.ts +18 -3
  28. package/dist/atomic/Card/index.d.ts.map +1 -1
  29. package/dist/atomic/Card/index.js +20 -3
  30. package/dist/atomic/Collapsible/index.d.ts +7 -1
  31. package/dist/atomic/Collapsible/index.d.ts.map +1 -1
  32. package/dist/atomic/Collapsible/index.js +8 -3
  33. package/dist/atomic/Combobox/index.d.ts +11 -1
  34. package/dist/atomic/Combobox/index.d.ts.map +1 -1
  35. package/dist/atomic/Combobox/index.js +25 -9
  36. package/dist/atomic/DatePicker/index.d.ts +3 -1
  37. package/dist/atomic/DatePicker/index.d.ts.map +1 -1
  38. package/dist/atomic/DatePicker/index.js +2 -2
  39. package/dist/atomic/DateTimePicker/index.d.ts +3 -1
  40. package/dist/atomic/DateTimePicker/index.d.ts.map +1 -1
  41. package/dist/atomic/DateTimePicker/index.js +2 -2
  42. package/dist/atomic/HeroSection/index.d.ts +1 -1
  43. package/dist/atomic/Input/index.d.ts +3 -1
  44. package/dist/atomic/Input/index.d.ts.map +1 -1
  45. package/dist/atomic/Input/index.js +3 -3
  46. package/dist/atomic/Label/FieldInfo.d.ts +18 -0
  47. package/dist/atomic/Label/FieldInfo.d.ts.map +1 -0
  48. package/dist/atomic/Label/FieldInfo.js +34 -0
  49. package/dist/atomic/Label/FloatingLabel.d.ts +6 -1
  50. package/dist/atomic/Label/FloatingLabel.d.ts.map +1 -1
  51. package/dist/atomic/Label/FloatingLabel.js +6 -2
  52. package/dist/atomic/Label/index.d.ts +1 -0
  53. package/dist/atomic/Label/index.d.ts.map +1 -1
  54. package/dist/atomic/Label/index.js +1 -0
  55. package/dist/atomic/PasswordInput/index.d.ts +3 -1
  56. package/dist/atomic/PasswordInput/index.d.ts.map +1 -1
  57. package/dist/atomic/PasswordInput/index.js +2 -2
  58. package/dist/atomic/PinInput/index.d.ts +3 -1
  59. package/dist/atomic/PinInput/index.d.ts.map +1 -1
  60. package/dist/atomic/PinInput/index.js +2 -2
  61. package/dist/atomic/QuantityStepper/index.d.ts +19 -4
  62. package/dist/atomic/QuantityStepper/index.d.ts.map +1 -1
  63. package/dist/atomic/QuantityStepper/index.js +208 -5
  64. package/dist/atomic/QuantityStepper/quantity.d.ts +14 -0
  65. package/dist/atomic/QuantityStepper/quantity.d.ts.map +1 -0
  66. package/dist/atomic/QuantityStepper/quantity.js +35 -0
  67. package/dist/atomic/RangeInput/index.d.ts +3 -1
  68. package/dist/atomic/RangeInput/index.d.ts.map +1 -1
  69. package/dist/atomic/RangeInput/index.js +2 -2
  70. package/dist/atomic/Rating/index.d.ts +1 -1
  71. package/dist/atomic/Select/index.d.ts +3 -1
  72. package/dist/atomic/Select/index.d.ts.map +1 -1
  73. package/dist/atomic/Select/index.js +2 -2
  74. package/dist/atomic/Stepper/index.d.ts +1 -1
  75. package/dist/atomic/SwipeAction/gesture.d.ts +5 -0
  76. package/dist/atomic/SwipeAction/gesture.d.ts.map +1 -0
  77. package/dist/atomic/SwipeAction/gesture.js +10 -0
  78. package/dist/atomic/SwipeAction/index.d.ts +12 -0
  79. package/dist/atomic/SwipeAction/index.d.ts.map +1 -0
  80. package/dist/atomic/SwipeAction/index.js +62 -0
  81. package/dist/atomic/Table/editing.d.ts +3 -1
  82. package/dist/atomic/Table/editing.d.ts.map +1 -1
  83. package/dist/atomic/Table/editing.js +9 -6
  84. package/dist/atomic/Table/index.d.ts +9 -1
  85. package/dist/atomic/Table/index.d.ts.map +1 -1
  86. package/dist/atomic/Table/index.js +64 -48
  87. package/dist/atomic/Tabs/index.d.ts +1 -1
  88. package/dist/atomic/Tag/index.d.ts +3 -1
  89. package/dist/atomic/Tag/index.d.ts.map +1 -1
  90. package/dist/atomic/Tag/index.js +2 -2
  91. package/dist/atomic/Toaster/ToastPrimitive.d.ts +2 -2
  92. package/dist/atomic/Toaster/ToastPrimitive.d.ts.map +1 -1
  93. package/dist/atomic/Toggle/index.d.ts +1 -1
  94. package/dist/atomic/index.d.ts +6 -3
  95. package/dist/atomic/index.d.ts.map +1 -1
  96. package/dist/atomic/index.js +3 -1
  97. package/dist/chunk-SZNEXFUZ.js +3 -0
  98. package/dist/chunk-XK52GUFA.js +3 -0
  99. package/dist/hooks/useIntersectionObserver.d.ts +2 -1
  100. package/dist/hooks/useIntersectionObserver.d.ts.map +1 -1
  101. package/dist/hooks/useIntersectionObserver.js +6 -7
  102. package/dist/index.js +10 -10
  103. package/dist/styles/index.css +316 -51
  104. package/dist/symbol-index.json +1 -1
  105. package/dist/types.d.ts +7 -0
  106. package/dist/types.d.ts.map +1 -1
  107. package/dist/utils/sanitizeDom.browser.d.ts +8 -0
  108. package/dist/utils/sanitizeDom.browser.d.ts.map +1 -0
  109. package/dist/utils/sanitizeDom.browser.js +1 -0
  110. package/dist/utils/sanitizeDom.server.d.ts +9 -0
  111. package/dist/utils/sanitizeDom.server.d.ts.map +1 -0
  112. package/dist/utils/sanitizeDom.server.js +1 -0
  113. package/dist/utils/sanitizeHtml.d.ts.map +1 -1
  114. package/dist/utils/sanitizeHtml.js +7 -6
  115. package/dist/utils/variants.d.ts +1 -1
  116. package/guidelines/API_REFERENCE.md +3 -2
  117. package/guidelines/COMPONENTS.md +10 -5
  118. package/guidelines/QUANTITY_STEPPER.md +78 -0
  119. package/guidelines/SWIPE_ACTION.md +101 -0
  120. package/package.json +8 -2
@@ -15,7 +15,8 @@ import './Combobox.css';
15
15
  * All inline controls (clear, create, chevron) are full touch targets
16
16
  * (`--touch-target`, 48px) via `.dndev-inline-action-btn`. Spinner matches
17
17
  * the chevron width so there's no layout shift on loading.
18
- * Gaps between items = `--gap-tight`. Outer inset on both sides = `--gap-sm`.
18
+ * Gaps between items = 4px (hardcoded in Combobox.css, tighter than `--gap-sm`).
19
+ * Outer inset on both sides = `--gap-sm`.
19
20
  */
20
21
  function computeTrailingPad(actionCount) {
21
22
  const parts = ['var(--gap-sm)'];
@@ -23,11 +24,11 @@ function computeTrailingPad(actionCount) {
23
24
  parts.push(`${actionCount} * var(--touch-target)`);
24
25
  parts.push('var(--touch-target)'); // chevron / spinner slot
25
26
  if (actionCount > 0)
26
- parts.push(`${actionCount} * var(--gap-tight, 4px)`);
27
+ parts.push(`${actionCount} * 4px`);
27
28
  parts.push('var(--gap-sm)');
28
29
  return `calc(${parts.join(' + ')})`;
29
30
  }
30
- const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessage = 'No results found', options = [], disabled, isLoading, variant, multiple = false, label, creatable = false, createLabel = 'Create', clearable = false, onOpenChange, onSearchChange, required, onCreateClick, createActionLabel, chips, }) => {
31
+ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessage = 'No results found', options = [], disabled, isLoading, variant, multiple = false, label, info, creatable = false, createLabel = 'Create', clearable = false, clearLabel = 'Clear', selectedLabel = '{{count}} selected', onOpenChange, onSearchChange, required, onCreateClick, createActionLabel, chips, }) => {
31
32
  const id = useId();
32
33
  const [open, setOpen] = useState(false);
33
34
  const [search, setSearch] = useState('');
@@ -182,6 +183,16 @@ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessag
182
183
  inputRef.current?.focus();
183
184
  }
184
185
  };
186
+ // `multiple` without chips: the selection as text (chips show it themselves).
187
+ // One value: its option label; several, or one without a known option: the count.
188
+ const singleSelectedLabel = selectedValues.length === 1
189
+ ? options.find((opt) => opt.value === selectedValues[0])?.label
190
+ : undefined;
191
+ const selectionSummary = !multiple || chips || selectedValues.length === 0
192
+ ? ''
193
+ : singleSelectedLabel
194
+ ? singleSelectedLabel
195
+ : selectedLabel.replace('{{count}}', String(selectedValues.length));
185
196
  const getDisplayValue = () => {
186
197
  // User is actively typing/backspacing — always show the search text (even if empty)
187
198
  if (open && isSearchingRef.current)
@@ -190,8 +201,9 @@ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessag
190
201
  return search;
191
202
  if (selectedValues.length === 0)
192
203
  return '';
204
+ // Multiple: open = search field (the summary stays visible as placeholder)
193
205
  if (multiple)
194
- return '';
206
+ return open ? '' : selectionSummary;
195
207
  const selectedOption = options.find((opt) => opt.value === selectedValues[0]);
196
208
  return selectedOption?.label || (creatable ? selectedValues[0] : '');
197
209
  };
@@ -232,20 +244,24 @@ const Combobox = ({ value, onValueChange, placeholder = 'Select...', emptyMessag
232
244
  const showClear = clearable && !disabled && (hasSelection || search.length > 0);
233
245
  const reservedCount = (showCreate ? 1 : 0) + (clearable ? 1 : 0);
234
246
  const trailingPad = computeTrailingPad(reservedCount);
235
- return (_jsxs("div", { ref: containerRef, className: cn('dndev-relative', open && 'dndev-combobox-open'), style: { width: '100%' }, children: [chips && label ? (_jsx(FloatingLabel, { htmlFor: id, label: label, disabled: disabled, required: required, children: _jsxs("div", { className: cn('dndev-relative dndev-combobox-wrapper', 'dndev-combobox-wrapper--chips'), style: withCssVars({ '--combobox-pad-end': trailingPad }), onClick: handleInputClick, children: [chips, _jsx(Input, { ref: inputRef, id: id, bare: true, value: displayValue, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: hasSelection ? '' : placeholder, disabled: disabled, role: "combobox", "aria-expanded": open, "aria-controls": `${id}-listbox`, autoComplete: "one-time-code", "aria-autocomplete": "list", "data-variant": variant }), _jsxs("div", { className: "dndev-combobox-trailing", children: [showCreate && (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-action-btn dndev-combobox-action-btn--create", onClick: (e) => {
247
+ return (_jsxs("div", { ref: containerRef, className: cn('dndev-relative', open && 'dndev-combobox-open'), style: { width: '100%' }, children: [chips && label ? (_jsx(FloatingLabel, { htmlFor: id, label: label, info: info, disabled: disabled, required: required, children: _jsxs("div", { className: cn('dndev-relative dndev-combobox-wrapper', 'dndev-combobox-wrapper--chips'), style: withCssVars({ '--combobox-pad-end': trailingPad }), onClick: handleInputClick, children: [chips, _jsx(Input, { ref: inputRef, id: id, bare: true, value: displayValue, onChange: handleInputChange, onFocus: handleInputFocus, onKeyDown: handleKeyDown, placeholder: hasSelection ? '' : placeholder, disabled: disabled, role: "combobox", "aria-expanded": open, "aria-controls": `${id}-listbox`, autoComplete: "one-time-code", "aria-autocomplete": "list", "data-variant": variant }), _jsxs("div", { className: "dndev-combobox-trailing", children: [showCreate && (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-action-btn dndev-combobox-action-btn--create", onClick: (e) => {
236
248
  e.stopPropagation();
237
249
  onCreateClick();
238
- }, "aria-label": createActionLabel || createLabel || 'Create new', children: _jsx(Plus, {}) })), showClear && (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-action-btn dndev-combobox-action-btn--clear", onClick: handleClear, "aria-label": "Clear", children: _jsx(X, {}) })), isLoading ? (_jsx("span", { className: "dndev-combobox-spinner", children: _jsx(Spinner, {}) })) : (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-chevron", onClick: handleChevronClick, onMouseDown: (e) => e.preventDefault(), tabIndex: -1, "aria-label": open ? 'Close' : 'Open', "aria-expanded": open, disabled: disabled, children: _jsx(ChevronDown, {}) }))] })] }) })) : (_jsxs("div", { className: cn('dndev-relative dndev-combobox-wrapper', chips && 'dndev-combobox-wrapper--chips'), style: withCssVars({ '--combobox-pad-end': trailingPad }), onClick: chips ? handleInputClick : undefined, children: [chips, _jsx(Input, { ref: inputRef, id: id, label: chips ? undefined : label, value: displayValue, onChange: handleInputChange, onFocus: handleInputFocus, onClick: chips ? undefined : handleInputClick, onKeyDown: handleKeyDown, placeholder: hasSelection && chips ? '' : placeholder, disabled: disabled, required: required, bare: !!chips, role: "combobox", "aria-expanded": open, "aria-controls": `${id}-listbox`, autoComplete: "one-time-code", "aria-autocomplete": "list", "data-variant": variant }), _jsxs("div", { className: "dndev-combobox-trailing", children: [showCreate && (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-action-btn dndev-combobox-action-btn--create", onClick: (e) => {
250
+ }, "aria-label": createActionLabel || createLabel || 'Create new', children: _jsx(Plus, {}) })), showClear && (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-action-btn dndev-combobox-action-btn--clear", onClick: handleClear, "aria-label": clearLabel, children: _jsx(X, {}) })), isLoading ? (_jsx("span", { className: "dndev-combobox-spinner", children: _jsx(Spinner, {}) })) : (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-chevron", onClick: handleChevronClick, onMouseDown: (e) => e.preventDefault(), tabIndex: -1, "aria-label": open ? 'Close' : 'Open', "aria-expanded": open, disabled: disabled, children: _jsx(ChevronDown, {}) }))] })] }) })) : (_jsxs("div", { className: cn('dndev-relative dndev-combobox-wrapper', chips && 'dndev-combobox-wrapper--chips'), style: withCssVars({ '--combobox-pad-end': trailingPad }), onClick: chips ? handleInputClick : undefined, children: [chips, _jsx(Input, { ref: inputRef, id: id, label: chips ? undefined : label, value: displayValue, onChange: handleInputChange, onFocus: handleInputFocus, onClick: chips ? undefined : handleInputClick, onKeyDown: handleKeyDown, placeholder: hasSelection && chips
251
+ ? ''
252
+ : selectionSummary
253
+ ? selectionSummary
254
+ : placeholder, disabled: disabled, required: required, bare: !!chips, role: "combobox", "aria-expanded": open, "aria-controls": `${id}-listbox`, autoComplete: "one-time-code", "aria-autocomplete": "list", "data-variant": variant }), _jsxs("div", { className: "dndev-combobox-trailing", children: [showCreate && (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-action-btn dndev-combobox-action-btn--create", onClick: (e) => {
239
255
  e.stopPropagation();
240
256
  onCreateClick();
241
- }, "aria-label": createActionLabel || createLabel || 'Create new', children: _jsx(Plus, {}) })), showClear && (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-action-btn dndev-combobox-action-btn--clear", onClick: handleClear, "aria-label": "Clear", children: _jsx(X, {}) })), isLoading ? (_jsx("span", { className: "dndev-combobox-spinner", children: _jsx(Spinner, {}) })) : (_jsx("span", { className: "dndev-combobox-chevron", children: _jsx(ChevronDown, {}) }))] })] })), open && (_jsx("div", { className: "dndev-floating dndev-menu-content dndev-z-tooltip dndev-combobox-content", style: {
257
+ }, "aria-label": createActionLabel || createLabel || 'Create new', children: _jsx(Plus, {}) })), showClear && (_jsx("button", { type: "button", className: "dndev-inline-action-btn dndev-combobox-action-btn dndev-combobox-action-btn--clear", onClick: handleClear, "aria-label": clearLabel, children: _jsx(X, {}) })), isLoading ? (_jsx("span", { className: "dndev-combobox-spinner", children: _jsx(Spinner, {}) })) : (_jsx("span", { className: "dndev-combobox-chevron", children: _jsx(ChevronDown, {}) }))] })] })), open && (_jsx("div", { className: "dndev-floating dndev-menu-content dndev-z-tooltip dndev-combobox-content", style: {
242
258
  position: 'absolute',
243
259
  top: '100%',
244
260
  insetInlineStart: 0,
245
261
  insetInlineEnd: 0,
246
262
  width: '100%',
247
- marginTop: 'var(--gap-tight)',
248
- padding: 'var(--gap-tight)',
263
+ marginTop: 'var(--gap-sm)',
264
+ padding: 'var(--gap-sm)',
249
265
  textAlign: 'start',
250
266
  }, "data-glow": "blank", children: _jsx(ScrollArea, { className: "dndev-menu-scroll-area", end: true, children: _jsx("div", { ref: listRef, id: `${id}-listbox`, role: "listbox", "aria-label": label || placeholder, style: {
251
267
  display: 'flex',
@@ -8,6 +8,8 @@ export interface DatePickerProps {
8
8
  onChange?: (date: string | null) => void;
9
9
  /** FloatingLabel text */
10
10
  label?: string;
11
+ /** Help text: an (i) after the label shows it on hover, focus or tap. Needs `label`. */
12
+ info?: string;
11
13
  /** Minimum selectable date (ISO string or Date) */
12
14
  min?: string | Date;
13
15
  /** Maximum selectable date (ISO string or Date) */
@@ -49,6 +51,6 @@ export interface DatePickerProps {
49
51
  * <DatePicker label="Début" min="2024-01-01" required />
50
52
  * ```
51
53
  */
52
- declare function DatePicker({ value, onChange, label, min, max, required, disabled, locale, className, id: idProp, name, ref, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'data-variant': dataVariant, }: DatePickerProps): import("react").JSX.Element;
54
+ declare function DatePicker({ value, onChange, label, info, min, max, required, disabled, locale, className, id: idProp, name, ref, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'data-variant': dataVariant, }: DatePickerProps): import("react").JSX.Element;
53
55
  export default DatePicker;
54
56
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/DateP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E,MAAM,CAAC;CACzB;AAMD;;;;;;;;;;;;;;;GAeG;AACH,iBAAS,UAAU,CAAC,EAClB,KAAK,EACL,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,GAAG,EACH,GAAG,EACH,QAAgB,EAChB,QAAgB,EAChB,MAAM,EACN,SAAS,EACT,EAAE,EAAE,MAAM,EACV,IAAI,EACJ,GAAG,EACH,kBAAkB,EAAE,eAAe,EACnC,cAAc,EAAE,WAAW,EAC3B,cAAc,EAAE,WAAW,GAC5B,EAAE,eAAe,+BAyfjB;AAED,eAAe,UAAU,CAAC"}
@@ -37,7 +37,7 @@ import './DatePicker.css';
37
37
  * <DatePicker label="Début" min="2024-01-01" required />
38
38
  * ```
39
39
  */
40
- function DatePicker({ value, onChange, label, min, max, required = false, disabled = false, locale, className, id: idProp, name, ref, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'data-variant': dataVariant, }) {
40
+ function DatePicker({ value, onChange, label, info, min, max, required = false, disabled = false, locale, className, id: idProp, name, ref, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'data-variant': dataVariant, }) {
41
41
  const generatedId = useId();
42
42
  const id = idProp ?? generatedId;
43
43
  const resolvedLocale = resolveLocale(locale);
@@ -370,7 +370,7 @@ function DatePicker({ value, onChange, label, min, max, required = false, disabl
370
370
  const nativeInput = (_jsx("input", { type: "date", className: "dndev-datepicker-native dndev-input", value: isoValue, onChange: handleNativeChange, min: minDate ? toISODate(minDate) : undefined, max: maxDate ? toISODate(maxDate) : undefined, required: required, disabled: disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid || undefined }));
371
371
  const content = (_jsxs("div", { ref: ref ?? containerRef, id: id, className: cn('dndev-datepicker', className), "aria-describedby": ariaDescribedBy, "data-disabled": disabled || undefined, children: [segmentedInput, nativeInput, name && _jsx("input", { type: "hidden", name: name, value: isoValue }), _jsx("div", { className: "dndev-datepicker-live", role: "status", "aria-live": "polite", children: liveText })] }));
372
372
  if (label) {
373
- return (_jsx(FloatingLabel, { htmlFor: id, label: label, disabled: disabled, required: required, children: content }));
373
+ return (_jsx(FloatingLabel, { htmlFor: id, label: label, info: info, disabled: disabled, required: required, children: content }));
374
374
  }
375
375
  return content;
376
376
  }
@@ -8,6 +8,8 @@ export interface DateTimePickerProps {
8
8
  onChange?: (datetime: string | null) => void;
9
9
  /** FloatingLabel text */
10
10
  label?: string;
11
+ /** Help text: an (i) after the label shows it on hover, focus or tap. Needs `label`. */
12
+ info?: string;
11
13
  /** Minimum selectable datetime (ISO string or Date) */
12
14
  min?: string | Date;
13
15
  /** Maximum selectable datetime (ISO string or Date) */
@@ -49,6 +51,6 @@ export interface DateTimePickerProps {
49
51
  * <DateTimePicker label="Événement" min="2024-01-01T00:00" required />
50
52
  * ```
51
53
  */
52
- declare function DateTimePicker({ value, onChange, label, min, max, required, disabled, locale, className, id: idProp, name, ref, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'data-variant': dataVariant, }: DateTimePickerProps): import("react").JSX.Element;
54
+ declare function DateTimePicker({ value, onChange, label, info, min, max, required, disabled, locale, className, id: idProp, name, ref, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'data-variant': dataVariant, }: DateTimePickerProps): import("react").JSX.Element;
53
55
  export default DateTimePicker;
54
56
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/DateTimePicker/index.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAiC,GAAG,EAAE,MAAM,OAAO,CAAC;AAwBhE,OAAO,sBAAsB,CAAC;AAsB9B,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC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AAc,EAAE,WAAW,GAC5B,EAAE,mBAAmB,+BA0lBrB;AAED,eAAe,cAAc,CAAC"}
@@ -68,7 +68,7 @@ function parseISODateTime(iso) {
68
68
  * <DateTimePicker label="Événement" min="2024-01-01T00:00" required />
69
69
  * ```
70
70
  */
71
- function DateTimePicker({ value, onChange, label, min, max, required = false, disabled = false, locale, className, id: idProp, name, ref, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'data-variant': dataVariant, }) {
71
+ function DateTimePicker({ value, onChange, label, info, min, max, required = false, disabled = false, locale, className, id: idProp, name, ref, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'data-variant': dataVariant, }) {
72
72
  const generatedId = useId();
73
73
  const id = idProp ?? generatedId;
74
74
  const resolvedLocale = resolveLocale(locale);
@@ -453,7 +453,7 @@ function DateTimePicker({ value, onChange, label, min, max, required = false, di
453
453
  const nativeInput = (_jsx("input", { type: "datetime-local", className: "dndev-datepicker-native dndev-input", value: isoValue, onChange: handleNativeChange, min: minDate ? toISODateTime(minDate) : undefined, max: maxDate ? toISODateTime(maxDate) : undefined, required: required, disabled: disabled, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid || undefined }));
454
454
  const content = (_jsxs("div", { ref: ref ?? containerRef, id: id, className: cn('dndev-datepicker dndev-datetimepicker', className), "aria-describedby": ariaDescribedBy, "data-disabled": disabled || undefined, children: [segmentedInput, nativeInput, name && _jsx("input", { type: "hidden", name: name, value: isoValue }), _jsx("div", { className: "dndev-datepicker-live", role: "status", "aria-live": "polite", children: liveText })] }));
455
455
  if (label) {
456
- return (_jsx(FloatingLabel, { htmlFor: id, label: label, disabled: disabled, required: required, children: content }));
456
+ return (_jsx(FloatingLabel, { htmlFor: id, label: label, info: info, disabled: disabled, required: required, children: content }));
457
457
  }
458
458
  return content;
459
459
  }
@@ -44,7 +44,7 @@ import { type ElementType, type ComponentPropsWithRef, type ReactNode } from 're
44
44
  import { type Tone, type TextAlign } from '../../utils/constants';
45
45
  import './HeroSection.css';
46
46
  declare const heroSectionVariants: (props?: ({
47
- variant?: "accent" | "primary" | "subtle" | null | undefined;
47
+ variant?: "primary" | "accent" | "subtle" | null | undefined;
48
48
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
49
49
  /** HeroSection-specific props (merged with the native props of the `as` element). */
50
50
  export interface HeroSectionOwnProps extends VariantProps<typeof heroSectionVariants> {
@@ -12,6 +12,8 @@ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
12
12
  iconEnd?: boolean;
13
13
  /** Label for floating label - always shown small at top-left when provided */
14
14
  label?: string;
15
+ /** Help text: an (i) after the label shows it on hover, focus or tap. Needs `label`. */
16
+ info?: string;
15
17
  /**
16
18
  * Bare mode - no border/shadow (for use inside FloatingLabel or custom wrappers).
17
19
  * Auto-enabled when `label` is provided.
@@ -38,6 +40,6 @@ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
38
40
  * @param {InputProps} props - The props for the input
39
41
  * @returns {JSX.Element} The rendered input
40
42
  */
41
- declare const Input: ({ className, type, icon, iconEnd, label, bare, value, onFocus, onBlur, required, id: idProp, ...props }: InputProps) => import("react").JSX.Element;
43
+ declare const Input: ({ className, type, icon, iconEnd, label, info, bare, value, onFocus, onBlur, required, id: idProp, ...props }: InputProps) => import("react").JSX.Element;
42
44
  export default Input;
43
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Input/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,aAAa,CAAC;AAErB,qCAAqC;AACrC,MAAM,WAAW,UAAW,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IACvE,gDAAgD;IAChD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kCAAkC;IAClC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,KAAK,GAAI,yGAaZ,UAAU,gCA6EZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Input/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,aAAa,CAAC;AAErB,qCAAqC;AACrC,MAAM,WAAW,UAAW,SAAQ,mBAAmB,CAAC,gBAAgB,CAAC;IACvE,gDAAgD;IAChD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kCAAkC;IAClC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,KAAK,GAAI,+GAcZ,UAAU,gCAgFZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -31,7 +31,7 @@ import './Input.css';
31
31
  * @param {InputProps} props - The props for the input
32
32
  * @returns {JSX.Element} The rendered input
33
33
  */
34
- const Input = ({ className, type, icon, iconEnd = false, label, bare, value, onFocus, onBlur, required, id: idProp, ...props }) => {
34
+ const Input = ({ className, type, icon, iconEnd = false, label, info, bare, value, onFocus, onBlur, required, id: idProp, ...props }) => {
35
35
  const generatedId = useId();
36
36
  const id = idProp ?? generatedId;
37
37
  const hasIcon = !!icon;
@@ -44,7 +44,7 @@ const Input = ({ className, type, icon, iconEnd = false, label, bare, value, onF
44
44
  // Explicitly exclude children to prevent void element error (input is a void element)
45
45
  // If we have a label, extract style to pass to FloatingLabel wrapper instead of input
46
46
  const { children: _children, style, ...inputProps } = props;
47
- const inputElement = (_jsx("input", { id: id, type: type, value: value, required: required, autoComplete: "one-time-code", className: inputClasses, "data-bare": isBare || undefined, ...inputProps,
47
+ const inputElement = (_jsx("input", { id: id, type: type, value: value, onFocus: onFocus, onBlur: onBlur, required: required, autoComplete: "one-time-code", className: inputClasses, "data-bare": isBare || undefined, ...inputProps,
48
48
  // Only apply style to input if there's no label (label wrapper gets it)
49
49
  style: hasLabel ? undefined : style }));
50
50
  const needsWrapper = hasIcon || hasLabel;
@@ -55,7 +55,7 @@ const Input = ({ className, type, icon, iconEnd = false, label, bare, value, onF
55
55
  }
56
56
  // With label: use FloatingLabel wrapper (fieldset/legend)
57
57
  if (hasLabel) {
58
- return (_jsx(FloatingLabel, { htmlFor: id, label: label, disabled: props.disabled, required: required, style: style, children: inputWithIcon }));
58
+ return (_jsx(FloatingLabel, { htmlFor: id, label: label, info: info, disabled: props.disabled, required: required, style: style, children: inputWithIcon }));
59
59
  }
60
60
  // Icon only, no label
61
61
  return inputWithIcon;
@@ -0,0 +1,18 @@
1
+ /** Props for {@link FieldInfo}. */
2
+ export interface FieldInfoProps {
3
+ /** Help text: what the field is for, in the reader's words. Also the button's accessible name. */
4
+ text: string;
5
+ }
6
+ /**
7
+ * (i) help button for a field label. Hover or focus shows the text; a tap (or click)
8
+ * pins it open until the button loses focus or Escape is pressed.
9
+ *
10
+ * @component
11
+ * @example
12
+ * ```tsx
13
+ * <FieldInfo text="Address of the page: /routines/oily-skin" />
14
+ * ```
15
+ */
16
+ export declare function FieldInfo({ text }: FieldInfoProps): import("react").JSX.Element;
17
+ export default FieldInfo;
18
+ //# sourceMappingURL=FieldInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldInfo.d.ts","sourceRoot":"","sources":["../../../src/atomic/Label/FieldInfo.tsx"],"names":[],"mappings":"AAoBA,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,kGAAkG;IAClG,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,cAAc,+BAkBjD;AAED,eAAe,SAAS,CAAC"}
@@ -0,0 +1,34 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ // packages/components/src/atomic/Label/FieldInfo.tsx
4
+ /**
5
+ * @fileoverview FieldInfo component
6
+ * @description (i) button next to a field label: its help text shows on hover and
7
+ * keyboard focus (tooltip), and on tap for touch screens, where hover does not exist.
8
+ *
9
+ * @version 0.1.0
10
+ * @since 0.2.5
11
+ * @author AMBROISE PARK Consulting
12
+ */
13
+ import { useState } from 'react';
14
+ import { Info } from 'lucide-react';
15
+ import Icon from '../Icons/Icon';
16
+ import Tooltip from '../Tooltip';
17
+ /**
18
+ * (i) help button for a field label. Hover or focus shows the text; a tap (or click)
19
+ * pins it open until the button loses focus or Escape is pressed.
20
+ *
21
+ * @component
22
+ * @example
23
+ * ```tsx
24
+ * <FieldInfo text="Address of the page: /routines/oily-skin" />
25
+ * ```
26
+ */
27
+ export function FieldInfo({ text }) {
28
+ const [pinned, setPinned] = useState(false);
29
+ return (_jsx(Tooltip, { content: text, side: "top", forceOpen: pinned || undefined, children: _jsx("button", { type: "button", className: "dndev-field-info", "aria-label": text, onClick: () => setPinned((open) => !open), onBlur: () => setPinned(false), onKeyDown: (event) => {
30
+ if (event.key === 'Escape')
31
+ setPinned(false);
32
+ }, children: _jsx(Icon, { icon: Info, ariaHidden: true }) }) }));
33
+ }
34
+ export default FieldInfo;
@@ -22,6 +22,8 @@ export interface FloatingLabelProps {
22
22
  truncate?: boolean;
23
23
  /** Whether the field is required - shows asterisk indicator */
24
24
  required?: boolean;
25
+ /** Help text: an (i) after the label shows it on hover, focus or tap */
26
+ info?: string;
25
27
  /** Children (the input element) - REQUIRED */
26
28
  children: ReactNode;
27
29
  /** Additional className for the fieldset */
@@ -41,8 +43,11 @@ export interface FloatingLabelProps {
41
43
  * <FloatingLabel label="Email Address" htmlFor="email" required>
42
44
  * <input id="email" type="email" />
43
45
  * </FloatingLabel>
46
+ * <FloatingLabel label="URL" htmlFor="slug" info="Address of the page: /routines/oily-skin">
47
+ * <input id="slug" />
48
+ * </FloatingLabel>
44
49
  * ```
45
50
  */
46
- export declare function FloatingLabel({ htmlFor, label, disabled, truncate, required, children, className, style, }: FloatingLabelProps): import("react").JSX.Element;
51
+ export declare function FloatingLabel({ htmlFor, label, disabled, truncate, required, info, children, className, style, }: FloatingLabelProps): import("react").JSX.Element;
47
52
  export default FloatingLabel;
48
53
  //# sourceMappingURL=FloatingLabel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingLabel.d.ts","sourceRoot":"","sources":["../../../src/atomic/Label/FloatingLabel.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,yGAAyG;AACzG,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,QAAQ,EAAE,SAAS,CAAC;IACp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C"}
@@ -11,6 +11,7 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
11
11
  * @author AMBROISE PARK Consulting
12
12
  */
13
13
  import './Label.css';
14
+ import { FieldInfo } from './FieldInfo';
14
15
  /**
15
16
  * FloatingLabel - Fieldset/legend wrapper for floating labels
16
17
  *
@@ -23,9 +24,12 @@ import './Label.css';
23
24
  * <FloatingLabel label="Email Address" htmlFor="email" required>
24
25
  * <input id="email" type="email" />
25
26
  * </FloatingLabel>
27
+ * <FloatingLabel label="URL" htmlFor="slug" info="Address of the page: /routines/oily-skin">
28
+ * <input id="slug" />
29
+ * </FloatingLabel>
26
30
  * ```
27
31
  */
28
- export function FloatingLabel({ htmlFor, label, disabled = false, truncate = true, required = false, children, className, style, }) {
29
- return (_jsxs("fieldset", { className: `dndev-floating-fieldset ${className || ''}`, disabled: disabled, "data-disabled": disabled ? 'true' : undefined, style: style, children: [_jsx("legend", { className: "dndev-floating-legend", "data-truncate": truncate ? undefined : 'false', children: _jsxs("label", { htmlFor: htmlFor, children: [label, required && ' *'] }) }), children] }));
32
+ export function FloatingLabel({ htmlFor, label, disabled = false, truncate = true, required = false, info, children, className, style, }) {
33
+ return (_jsxs("fieldset", { className: `dndev-floating-fieldset ${className || ''}`, disabled: disabled, "data-disabled": disabled ? 'true' : undefined, style: style, children: [_jsxs("legend", { className: "dndev-floating-legend", "data-truncate": truncate ? undefined : 'false', "data-info": info ? 'true' : undefined, children: [_jsxs("label", { htmlFor: htmlFor, children: [label, required && ' *'] }), info && _jsx(FieldInfo, { text: info })] }), children] }));
30
34
  }
31
35
  export default FloatingLabel;
@@ -45,4 +45,5 @@ export interface LabelProps extends LabelPrimitiveProps {
45
45
  declare const Label: ({ className, icon: Icon, iconEnd, plain, required, children, ...props }: LabelProps) => import("react").JSX.Element;
46
46
  export default Label;
47
47
  export { FloatingLabel, type FloatingLabelProps };
48
+ export { FieldInfo, type FieldInfoProps } from './FieldInfo';
48
49
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Label/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,qCAAqC;AACrC,MAAM,WAAW,UAAW,SAAQ,mBAAmB;IACrD,8CAA8C;IAC9C,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,KAAK,GAAI,yEAQZ,UAAU,gCAoBZ,CAAC;AAEF,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/Label/index.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,qCAAqC;AACrC,MAAM,WAAW,UAAW,SAAQ,mBAAmB;IACrD,8CAA8C;IAC9C,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,KAAK,GAAI,yEAQZ,UAAU,gCAoBZ,CAAC;AAEF,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC"}
@@ -20,3 +20,4 @@ const Label = ({ className, icon: Icon, iconEnd = false, plain = false, required
20
20
  };
21
21
  export default Label;
22
22
  export { FloatingLabel };
23
+ export { FieldInfo } from './FieldInfo';
@@ -8,6 +8,8 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
8
8
  onVisibilityChange?: (visible: boolean) => void;
9
9
  /** Label for floating label - always shown small at top-left when provided */
10
10
  label?: string;
11
+ /** Help text: an (i) after the label shows it on hover, focus or tap. Needs `label`. */
12
+ info?: string;
11
13
  /** Whether the field is required - shows asterisk indicator */
12
14
  required?: boolean;
13
15
  }
@@ -40,6 +42,6 @@ export interface PasswordInputProps extends Omit<InputHTMLAttributes<HTMLInputEl
40
42
  * @param {PasswordInputProps} props - The props for the password input
41
43
  * @returns {JSX.Element} The rendered password input
42
44
  */
43
- declare const PasswordInput: ({ className, visible: controlledVisible, onVisibilityChange, label, value, onFocus, onBlur, required, id: idProp, ...props }: PasswordInputProps) => import("react").JSX.Element;
45
+ declare const PasswordInput: ({ className, visible: controlledVisible, onVisibilityChange, label, info, value, onFocus, onBlur, required, id: idProp, ...props }: PasswordInputProps) => import("react").JSX.Element;
44
46
  export default PasswordInput;
45
47
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/PasswordInput/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,qBAAqB,CAAC;AAE7B,4EAA4E;AAC5E,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAC9C,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,CACP;IACC,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,QAAA,MAAM,aAAa,GAAI,8HAWpB,kBAAkB,gCAsEpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/PasswordInput/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,qBAAqB,CAAC;AAE7B,4EAA4E;AAC5E,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAC9C,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,CACP;IACC,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,QAAA,MAAM,aAAa,GAAI,oIAYpB,kBAAkB,gCAuEpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -42,7 +42,7 @@ import './PasswordInput.css';
42
42
  * @param {PasswordInputProps} props - The props for the password input
43
43
  * @returns {JSX.Element} The rendered password input
44
44
  */
45
- const PasswordInput = ({ className, visible: controlledVisible, onVisibilityChange, label, value, onFocus, onBlur, required, id: idProp, ...props }) => {
45
+ const PasswordInput = ({ className, visible: controlledVisible, onVisibilityChange, label, info, value, onFocus, onBlur, required, id: idProp, ...props }) => {
46
46
  // A passed id must reach both the input and its label
47
47
  const generatedId = useId();
48
48
  const id = idProp ?? generatedId;
@@ -61,6 +61,6 @@ const PasswordInput = ({ className, visible: controlledVisible, onVisibilityChan
61
61
  if (!hasLabel) {
62
62
  return inputContent;
63
63
  }
64
- return (_jsx(FloatingLabel, { htmlFor: id, label: label, disabled: props.disabled, required: required, children: inputContent }));
64
+ return (_jsx(FloatingLabel, { htmlFor: id, label: label, info: info, disabled: props.disabled, required: required, children: inputContent }));
65
65
  };
66
66
  export default PasswordInput;
@@ -30,6 +30,8 @@ export interface PinInputProps extends Omit<InputHTMLAttributes<HTMLInputElement
30
30
  numericOnly?: boolean;
31
31
  /** Floating label rendered above the group. */
32
32
  label?: string;
33
+ /** Help text: an (i) after the label shows it on hover, focus or tap. Needs `label`. */
34
+ info?: string;
33
35
  /** Whether the field is required - shows asterisk indicator */
34
36
  required?: boolean;
35
37
  /** Auto-focus the first box on mount. */
@@ -87,6 +89,6 @@ export interface PinInputProps extends Omit<InputHTMLAttributes<HTMLInputElement
87
89
  * @param {PinInputProps} props - The props for the PIN input
88
90
  * @returns {JSX.Element} The rendered PIN input
89
91
  */
90
- declare const PinInput: ({ value, onChange, onComplete, length, mask, hideMaskToggle, shake, numericOnly, label, required, autoFocus, disabled, className, digitAriaLabel, revealAriaLabel, "aria-label": ariaLabel, ...rest }: PinInputProps) => import("react").JSX.Element;
92
+ declare const PinInput: ({ value, onChange, onComplete, length, mask, hideMaskToggle, shake, numericOnly, label, info, required, autoFocus, disabled, className, digitAriaLabel, revealAriaLabel, "aria-label": ariaLabel, ...rest }: PinInputProps) => import("react").JSX.Element;
91
93
  export default PinInput;
92
94
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/PinInput/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,gBAAgB,CAAC;AAExB,mEAAmE;AACnE,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,CACtE;IACC,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,0FAA0F;IAC1F,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kEAAkE;IAClE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oFAAoF;IACpF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,C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,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3D;;;OAGG;IACH,eAAe,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAClD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,QAAA,MAAM,QAAQ,GAAI,6MAmBf,aAAa,gCAyKf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -54,7 +54,7 @@ import './PinInput.css';
54
54
  * @param {PinInputProps} props - The props for the PIN input
55
55
  * @returns {JSX.Element} The rendered PIN input
56
56
  */
57
- const PinInput = ({ value, onChange, onComplete, length = 4, mask = true, hideMaskToggle = false, shake = false, numericOnly = true, label, required, autoFocus, disabled, className, digitAriaLabel, revealAriaLabel, 'aria-label': ariaLabel, ...rest }) => {
57
+ const PinInput = ({ value, onChange, onComplete, length = 4, mask = true, hideMaskToggle = false, shake = false, numericOnly = true, label, info, required, autoFocus, disabled, className, digitAriaLabel, revealAriaLabel, 'aria-label': ariaLabel, ...rest }) => {
58
58
  const id = useId();
59
59
  const refs = useRef([]);
60
60
  const [revealed, setRevealed] = useState(false);
@@ -150,6 +150,6 @@ const PinInput = ({ value, onChange, onComplete, length = 4, mask = true, hideMa
150
150
  : (revealAriaLabel?.show ?? 'Show PIN'), "aria-pressed": revealed, tabIndex: -1, children: revealed ? (_jsx(EyeOff, { className: "dndev-size-md" })) : (_jsx(Eye, { className: "dndev-size-md" })) })) : null] }));
151
151
  if (!label)
152
152
  return group;
153
- return (_jsx(FloatingLabel, { htmlFor: id, label: label, disabled: disabled, required: required, children: group }));
153
+ return (_jsx(FloatingLabel, { htmlFor: id, label: label, info: info, disabled: disabled, required: required, children: group }));
154
154
  };
155
155
  export default PinInput;
@@ -2,8 +2,22 @@ import type { HTMLAttributes } from 'react';
2
2
  import './QuantityStepper.css';
3
3
  /** Props for the QuantityStepper component -- [ − qty + ] quantity control. */
4
4
  export interface QuantityStepperProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'onChange'> {
5
- /** Quantity shown between the buttons */
5
+ /** Controlled quantity. Zero may be used as the initial, not-yet-added value. */
6
6
  value: number;
7
+ /** Enables native text editing; receives validated quantities on commit, not on each keystroke. Takes precedence over legacy callbacks. */
8
+ onChange?: (value: number) => void;
9
+ /** First positive quantity (safe integer). @default 1 */
10
+ min?: number;
11
+ /** Lot size (positive safe integer); valid quantities are min + k * step. @default 1 */
12
+ step?: number;
13
+ /** Stock limit; rounded down to the last complete lot. */
14
+ max?: number;
15
+ /** Allows committing zero, in addition to positive lots. @default false */
16
+ allowZero?: boolean;
17
+ /** Shows only a large + at zero, reserving the expanded footprint. @default false */
18
+ collapseWhenZero?: boolean;
19
+ /** Stack the controls: plus, quantity, minus (also DOM and tab order). @default false */
20
+ vertical?: boolean;
7
21
  /** Called by −. Omit to disable − (at the minimum). */
8
22
  onDecrement?: () => void;
9
23
  /** Called by +. Omit to disable + (stock or limit reached). */
@@ -31,8 +45,9 @@ export interface QuantityStepperProps extends Omit<HTMLAttributes<HTMLDivElement
31
45
  /**
32
46
  * Quantity control in the e-commerce standard form: one outlined field, borderless
33
47
  * − / + buttons, the quantity centred with tabular figures. Stateless: the caller owns
34
- * the value and the step rules (lots, minimums, stock) and passes `undefined` handlers
35
- * to disable a direction.
48
+ * the value. Legacy mode uses direction callbacks; additive onChange mode owns lot
49
+ * normalization and offers an uncontrolled text spinbutton committed on blur/Enter.
50
+ * onChange takes precedence over the legacy direction and value-click callbacks.
36
51
  *
37
52
  * @component
38
53
  * @example
@@ -47,6 +62,6 @@ export interface QuantityStepperProps extends Omit<HTMLAttributes<HTMLDivElement
47
62
  * />
48
63
  * ```
49
64
  */
50
- declare const QuantityStepper: ({ value, onDecrement, onIncrement, onValueClick, disabled, fullWidth, decrementLabel, incrementLabel, valueLabel, className, ...props }: QuantityStepperProps) => import("react").JSX.Element;
65
+ declare const QuantityStepper: ({ value, onDecrement, onIncrement, onValueClick, onChange, min, step, max, allowZero, collapseWhenZero, vertical, disabled, fullWidth, decrementLabel, incrementLabel, valueLabel, className, onBlur, ...props }: QuantityStepperProps) => import("react").JSX.Element;
51
66
  export default QuantityStepper;
52
67
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/atomic/QuantityStepper/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,OAAO,uBAAuB,CAAC;AAE/B,+EAA+E;AAC/E,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACrG,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,2BAA2B;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,eAAe,GAAI,yIAYt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