@namroodinc/liquid-editorial 0.1.6 → 0.1.7

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 (142) hide show
  1. package/AGENTS.md +2 -0
  2. package/README.md +42 -0
  3. package/UPGRADING.md +68 -11
  4. package/dist/components/AppShell/index.cjs +2 -0
  5. package/dist/components/AppShell/index.cjs.map +1 -0
  6. package/dist/components/AppShell/index.d.cts +15 -0
  7. package/dist/components/AppShell/index.d.cts.map +1 -0
  8. package/dist/components/AppShell/index.d.ts +15 -0
  9. package/dist/components/AppShell/index.d.ts.map +1 -0
  10. package/dist/components/AppShell/index.js +93 -0
  11. package/dist/components/AppShell/index.js.map +1 -0
  12. package/dist/components/AppShell/style.css +79 -0
  13. package/dist/components/AssetGrid/index.cjs +1 -1
  14. package/dist/components/AssetGrid/index.cjs.map +1 -1
  15. package/dist/components/AssetGrid/index.d.cts.map +1 -1
  16. package/dist/components/AssetGrid/index.d.ts.map +1 -1
  17. package/dist/components/AssetGrid/index.js +57 -59
  18. package/dist/components/AssetGrid/index.js.map +1 -1
  19. package/dist/components/AssetGrid/style.css +8 -16
  20. package/dist/components/Board/index.cjs +1 -1
  21. package/dist/components/Board/index.cjs.map +1 -1
  22. package/dist/components/Board/index.d.cts.map +1 -1
  23. package/dist/components/Board/index.d.ts.map +1 -1
  24. package/dist/components/Board/index.js +88 -84
  25. package/dist/components/Board/index.js.map +1 -1
  26. package/dist/components/Board/style.css +17 -28
  27. package/dist/components/Button/index.cjs +1 -1
  28. package/dist/components/Button/index.cjs.map +1 -1
  29. package/dist/components/Button/index.d.cts +3 -2
  30. package/dist/components/Button/index.d.cts.map +1 -1
  31. package/dist/components/Button/index.d.ts +3 -2
  32. package/dist/components/Button/index.d.ts.map +1 -1
  33. package/dist/components/Button/index.js +1 -1
  34. package/dist/components/Button/index.js.map +1 -1
  35. package/dist/components/Button/style.css +21 -15
  36. package/dist/components/DatePicker/index.cjs +1 -1
  37. package/dist/components/DatePicker/index.cjs.map +1 -1
  38. package/dist/components/DatePicker/index.d.cts.map +1 -1
  39. package/dist/components/DatePicker/index.d.ts.map +1 -1
  40. package/dist/components/DatePicker/index.js +46 -45
  41. package/dist/components/DatePicker/index.js.map +1 -1
  42. package/dist/components/DatePicker/style.css +4 -61
  43. package/dist/components/Drawer/index.cjs +1 -1
  44. package/dist/components/Drawer/index.cjs.map +1 -1
  45. package/dist/components/Drawer/index.d.cts +10 -1
  46. package/dist/components/Drawer/index.d.cts.map +1 -1
  47. package/dist/components/Drawer/index.d.ts +10 -1
  48. package/dist/components/Drawer/index.d.ts.map +1 -1
  49. package/dist/components/Drawer/index.js +69 -47
  50. package/dist/components/Drawer/index.js.map +1 -1
  51. package/dist/components/Drawer/style.css +106 -0
  52. package/dist/components/EntryPicker/index.cjs +1 -1
  53. package/dist/components/EntryPicker/index.cjs.map +1 -1
  54. package/dist/components/EntryPicker/index.d.cts.map +1 -1
  55. package/dist/components/EntryPicker/index.d.ts.map +1 -1
  56. package/dist/components/EntryPicker/index.js +12 -11
  57. package/dist/components/EntryPicker/index.js.map +1 -1
  58. package/dist/components/EntryPicker/style.css +3 -30
  59. package/dist/components/Field/style.css +11 -3
  60. package/dist/components/Menu/index.cjs +1 -1
  61. package/dist/components/Menu/index.cjs.map +1 -1
  62. package/dist/components/Menu/index.d.cts.map +1 -1
  63. package/dist/components/Menu/index.d.ts.map +1 -1
  64. package/dist/components/Menu/index.js +11 -16
  65. package/dist/components/Menu/index.js.map +1 -1
  66. package/dist/components/Menu/style.css +7 -41
  67. package/dist/components/Modal/index.cjs +1 -1
  68. package/dist/components/Modal/index.cjs.map +1 -1
  69. package/dist/components/Modal/index.d.cts.map +1 -1
  70. package/dist/components/Modal/index.d.ts.map +1 -1
  71. package/dist/components/Modal/index.js +12 -12
  72. package/dist/components/Modal/index.js.map +1 -1
  73. package/dist/components/NumberField/index.cjs +1 -1
  74. package/dist/components/NumberField/index.cjs.map +1 -1
  75. package/dist/components/NumberField/index.js +13 -17
  76. package/dist/components/NumberField/index.js.map +1 -1
  77. package/dist/components/NumberField/style.css +1 -41
  78. package/dist/components/Popover/index.cjs +1 -1
  79. package/dist/components/Popover/index.cjs.map +1 -1
  80. package/dist/components/Popover/index.js +4 -4
  81. package/dist/components/SearchField/index.cjs +1 -1
  82. package/dist/components/SearchField/index.cjs.map +1 -1
  83. package/dist/components/SearchField/index.d.cts.map +1 -1
  84. package/dist/components/SearchField/index.d.ts.map +1 -1
  85. package/dist/components/SearchField/index.js +26 -27
  86. package/dist/components/SearchField/index.js.map +1 -1
  87. package/dist/components/SearchField/style.css +0 -21
  88. package/dist/components/Select/index.cjs +1 -1
  89. package/dist/components/Select/index.cjs.map +1 -1
  90. package/dist/components/Select/index.d.cts.map +1 -1
  91. package/dist/components/Select/index.d.ts.map +1 -1
  92. package/dist/components/Select/index.js +82 -75
  93. package/dist/components/Select/index.js.map +1 -1
  94. package/dist/components/Select/style.css +5 -38
  95. package/dist/components/SideNav/index.cjs +1 -1
  96. package/dist/components/SideNav/index.cjs.map +1 -1
  97. package/dist/components/SideNav/index.d.cts.map +1 -1
  98. package/dist/components/SideNav/index.d.ts.map +1 -1
  99. package/dist/components/SideNav/index.js +52 -49
  100. package/dist/components/SideNav/index.js.map +1 -1
  101. package/dist/components/SideNav/style.css +2 -27
  102. package/dist/components/SortableList/index.cjs +1 -1
  103. package/dist/components/SortableList/index.cjs.map +1 -1
  104. package/dist/components/SortableList/index.d.cts.map +1 -1
  105. package/dist/components/SortableList/index.d.ts.map +1 -1
  106. package/dist/components/SortableList/index.js +42 -39
  107. package/dist/components/SortableList/index.js.map +1 -1
  108. package/dist/components/SortableList/style.css +9 -15
  109. package/dist/components/Stepper/index.cjs +1 -1
  110. package/dist/components/Stepper/index.cjs.map +1 -1
  111. package/dist/components/Stepper/index.d.cts.map +1 -1
  112. package/dist/components/Stepper/index.d.ts.map +1 -1
  113. package/dist/components/Stepper/index.js +48 -39
  114. package/dist/components/Stepper/index.js.map +1 -1
  115. package/dist/components/Stepper/style.css +24 -18
  116. package/dist/components/SubNav/index.cjs +1 -1
  117. package/dist/components/SubNav/index.cjs.map +1 -1
  118. package/dist/components/SubNav/index.d.cts.map +1 -1
  119. package/dist/components/SubNav/index.d.ts.map +1 -1
  120. package/dist/components/SubNav/index.js +27 -28
  121. package/dist/components/SubNav/index.js.map +1 -1
  122. package/dist/components/SubNav/style.css +13 -0
  123. package/dist/components/Switch/index.cjs +1 -1
  124. package/dist/components/Switch/index.cjs.map +1 -1
  125. package/dist/components/Switch/index.d.cts.map +1 -1
  126. package/dist/components/Switch/index.d.ts.map +1 -1
  127. package/dist/components/Switch/index.js +23 -21
  128. package/dist/components/Switch/index.js.map +1 -1
  129. package/dist/components/Switch/style.css +2 -28
  130. package/dist/components/TagsInput/index.cjs +1 -1
  131. package/dist/components/TagsInput/index.cjs.map +1 -1
  132. package/dist/components/TagsInput/index.js +8 -10
  133. package/dist/components/TagsInput/index.js.map +1 -1
  134. package/dist/components/TagsInput/style.css +2 -24
  135. package/dist/index.cjs +1 -1
  136. package/dist/index.d.cts +2 -0
  137. package/dist/index.d.cts.map +1 -1
  138. package/dist/index.d.ts +2 -0
  139. package/dist/index.d.ts.map +1 -1
  140. package/dist/index.js +39 -38
  141. package/dist/styles.css +1 -0
  142. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["forwardRef","useState","useRef","useCallback","Icon","FieldAffix","require_Icon","require_components_FieldAffix_index","react","react_jsx_runtime","cx","parts","NumberField","ariaInvalid","rest","internal","setInternal","defaultValue","current","value","inputRef","commit","next","onValueChange","nudge","min","direction","step","max","outOfRange","className","size","hasSteppers","isDisabled","disabled","prefix","suffix","node","ref","isInvalid","raw","event","NumberRangeField","crossed","minLabel","maxLabel"],"sources":["../../../src/components/NumberField/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface NumberFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\" | \"value\" | \"defaultValue\" | \"onChange\" | \"prefix\"> {\n size?: FieldSize;\n value?: number | \"\";\n defaultValue?: number | \"\";\n onValueChange?: (value: number | \"\") => void;\n min?: number;\n max?: number;\n step?: number | \"any\";\n /** Rendered inside the field, before the number — \"£\", \"$\", a glyph. */\n prefix?: ReactNode;\n /** Rendered inside the field, after the number — \"kg\", \"%\", \"px\". */\n suffix?: ReactNode;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Hide the − / + steppers and keep typing only. */\n hasSteppers?: boolean;\n}\n\n\n/**\n * A quantity, bounded by `min` and `max`. Steppers move by `step` and stop at\n * the bounds; typing is never blocked, an out-of-range value reads invalid.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n size = \"md\",\n value,\n defaultValue = \"\",\n onValueChange,\n min,\n max,\n step = 1,\n prefix,\n suffix,\n\n isDisabled = false,\n isInvalid = false,\n hasSteppers = true,\n className,\n disabled,\n \"aria-invalid\": ariaInvalid,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState<number | \"\">(defaultValue);\n const current = value ?? internal;\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const commit = useCallback(\n (next: number | \"\") => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n [onValueChange, value],\n );\n\n const nudge = (direction: 1 | -1) => {\n const base = current === \"\" ? (min ?? 0) : current;\n let next = base + direction * (step === \"any\" ? 1 : step);\n if (min !== undefined) next = Math.max(min, next);\n if (max !== undefined) next = Math.min(max, next);\n next = Number(next.toFixed(10));\n commit(next);\n inputRef.current?.focus();\n };\n\n const outOfRange =\n current !== \"\" &&\n ((min !== undefined && current < min) || (max !== undefined && current > max));\n\n return (\n <div className={cx(\"ds-number\", className)} data-size={size}>\n {hasSteppers && (\n <button\n type=\"button\"\n className=\"ds-number__step\"\n aria-label=\"Decrease\"\n disabled={isDisabled || disabled || (min !== undefined && current !== \"\" && current <= min)}\n onClick={() => nudge(-1)}\n >\n <Icon name=\"minus\" size={16} />\n </button>\n )}\n <FieldAffix className=\"ds-number__body\" lead={prefix} trail={suffix}>\n <input\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"number\"\n inputMode=\"decimal\"\n value={current}\n min={min}\n max={max}\n step={step}\n disabled={isDisabled || disabled}\n aria-invalid={isInvalid || outOfRange || ariaInvalid || undefined}\n data-size={size}\n className=\"ds-field-skin ds-number__input\"\n onChange={(event) => {\n const raw = event.target.value;\n commit(raw === \"\" ? \"\" : Number(raw));\n }}\n {...rest}\n />\n </FieldAffix>\n\n {hasSteppers && (\n <button\n type=\"button\"\n className=\"ds-number__step\"\n aria-label=\"Increase\"\n disabled={isDisabled || disabled || (max !== undefined && current !== \"\" && current >= max)}\n onClick={() => nudge(1)}\n >\n <Icon name=\"plus\" size={16} />\n </button>\n )}\n </div>\n );\n});\n\nexport interface NumberRangeValue {\n min: number | \"\";\n max: number | \"\";\n}\n\nexport interface NumberRangeFieldProps {\n value?: NumberRangeValue;\n defaultValue?: NumberRangeValue;\n onValueChange?: (value: NumberRangeValue) => void;\n size?: FieldSize;\n /** Hard bounds both ends are clamped to. */\n min?: number;\n max?: number;\n step?: number;\n /** Rendered inside both fields, before the number. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n isDisabled?: boolean;\n minLabel?: string;\n maxLabel?: string;\n}\n\n/**\n * A lower and an upper bound, typed. The pair reads invalid when the minimum\n * passes the maximum — neither field is rewritten behind the user.\n */\nexport function NumberRangeField({\n value,\n defaultValue = { min: \"\", max: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n step = 1,\n prefix,\n suffix,\n isDisabled = false,\n minLabel = \"Minimum\",\n maxLabel = \"Maximum\",\n}: NumberRangeFieldProps) {\n const [internal, setInternal] = useState<NumberRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: NumberRangeValue) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n };\n\n const crossed = current.min !== \"\" && current.max !== \"\" && current.min > current.max;\n\n return (\n <div className=\"ds-number-range\">\n <NumberField\n aria-label={minLabel}\n size={size}\n value={current.min}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, min: next })}\n />\n <span className=\"ds-number-range__dash\" aria-hidden=\"true\">\n –\n </span>\n <NumberField\n aria-label={maxLabel}\n size={size}\n value={current.max}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, max: next })}\n />\n </div>\n );\n}\n"],"mappings":"A,iQAcA,SAASU,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CA0BA,IAAaC,GAAA,EAAcZ,EAAAA,WAAAA,CAA+C,SACxE,CACE,OAAO,KACP,QACA,eAAe,GACf,gBACA,MACA,MACA,OAAO,EACP,SACA,SAEA,aAAa,GACb,YAAY,GACZ,cAAc,GACd,YACA,WACA,eAAgBa,EAChB,GAAGC,GAEL,EACA,CACA,GAAM,CAACC,EAAUC,IAAA,EAAef,EAAAA,SAAAA,CAAsBgB,CAAY,EAC5DC,EAAUC,GAASJ,EACnBK,GAAA,EAAWlB,EAAAA,OAAAA,CAAgC,IAAI,EAE/CmB,GAAA,EAASlB,EAAAA,YAAAA,CACZ,GAAsB,CACjBgB,IAAU,IAAA,IAAWH,EAAYM,CAAI,EACzCC,IAAgBD,CAAI,CACtB,EACA,CAACC,EAA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ACV,MACA,MACC,OACE,SACA,SACI,aACZ,UAAWyB,EACX,cAAgB,GAAStB,EAAO,CAAE,GAAGH,EAAS,IAAKI,CAAK,CAAC,CAC1D,CAAA,CACE,C,EAET,C"}
1
+ {"version":3,"file":"index.cjs","names":["forwardRef","useState","useRef","useCallback","Button","FieldAffix","require_components_Button_index","require_components_FieldAffix_index","react","react_jsx_runtime","cx","parts","NumberField","ariaInvalid","rest","internal","setInternal","defaultValue","current","value","inputRef","commit","next","onValueChange","nudge","min","direction","step","max","outOfRange","className","size","hasSteppers","isDisabled","disabled","prefix","suffix","node","ref","isInvalid","raw","event","NumberRangeField","crossed","minLabel","maxLabel"],"sources":["../../../src/components/NumberField/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface NumberFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\" | \"value\" | \"defaultValue\" | \"onChange\" | \"prefix\"> {\n size?: FieldSize;\n value?: number | \"\";\n defaultValue?: number | \"\";\n onValueChange?: (value: number | \"\") => void;\n min?: number;\n max?: number;\n step?: number | \"any\";\n /** Rendered inside the field, before the number — \"£\", \"$\", a glyph. */\n prefix?: ReactNode;\n /** Rendered inside the field, after the number — \"kg\", \"%\", \"px\". */\n suffix?: ReactNode;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Hide the − / + steppers and keep typing only. */\n hasSteppers?: boolean;\n}\n\n\n/**\n * A quantity, bounded by `min` and `max`. Steppers move by `step` and stop at\n * the bounds; typing is never blocked, an out-of-range value reads invalid.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n size = \"md\",\n value,\n defaultValue = \"\",\n onValueChange,\n min,\n max,\n step = 1,\n prefix,\n suffix,\n\n isDisabled = false,\n isInvalid = false,\n hasSteppers = true,\n className,\n disabled,\n \"aria-invalid\": ariaInvalid,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState<number | \"\">(defaultValue);\n const current = value ?? internal;\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const commit = useCallback(\n (next: number | \"\") => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n [onValueChange, value],\n );\n\n const nudge = (direction: 1 | -1) => {\n const base = current === \"\" ? (min ?? 0) : current;\n let next = base + direction * (step === \"any\" ? 1 : step);\n if (min !== undefined) next = Math.max(min, next);\n if (max !== undefined) next = Math.min(max, next);\n next = Number(next.toFixed(10));\n commit(next);\n inputRef.current?.focus();\n };\n\n const outOfRange =\n current !== \"\" &&\n ((min !== undefined && current < min) || (max !== undefined && current > max));\n\n return (\n <div className={cx(\"ds-number\", className)} data-size={size}>\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"minus\"\n className=\"ds-number__step\"\n aria-label=\"Decrease\"\n isDisabled={isDisabled || disabled || (min !== undefined && current !== \"\" && current <= min)}\n onClick={() => nudge(-1)}\n />\n )}\n <FieldAffix className=\"ds-number__body\" lead={prefix} trail={suffix}>\n <input\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"number\"\n inputMode=\"decimal\"\n value={current}\n min={min}\n max={max}\n step={step}\n disabled={isDisabled || disabled}\n aria-invalid={isInvalid || outOfRange || ariaInvalid || undefined}\n data-size={size}\n className=\"ds-field-skin ds-number__input\"\n onChange={(event) => {\n const raw = event.target.value;\n commit(raw === \"\" ? \"\" : Number(raw));\n }}\n {...rest}\n />\n </FieldAffix>\n\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"plus\"\n className=\"ds-number__step\"\n aria-label=\"Increase\"\n isDisabled={isDisabled || disabled || (max !== undefined && current !== \"\" && current >= max)}\n onClick={() => nudge(1)}\n />\n )}\n </div>\n );\n});\n\nexport interface NumberRangeValue {\n min: number | \"\";\n max: number | \"\";\n}\n\nexport interface NumberRangeFieldProps {\n value?: NumberRangeValue;\n defaultValue?: NumberRangeValue;\n onValueChange?: (value: NumberRangeValue) => void;\n size?: FieldSize;\n /** Hard bounds both ends are clamped to. */\n min?: number;\n max?: number;\n step?: number;\n /** Rendered inside both fields, before the number. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n isDisabled?: boolean;\n minLabel?: string;\n maxLabel?: string;\n}\n\n/**\n * A lower and an upper bound, typed. The pair reads invalid when the minimum\n * passes the maximum — neither field is rewritten behind the user.\n */\nexport function NumberRangeField({\n value,\n defaultValue = { min: \"\", max: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n step = 1,\n prefix,\n suffix,\n isDisabled = false,\n minLabel = \"Minimum\",\n maxLabel = \"Maximum\",\n}: NumberRangeFieldProps) {\n const [internal, setInternal] = useState<NumberRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: NumberRangeValue) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n };\n\n const crossed = current.min !== \"\" && current.max !== \"\" && current.min > current.max;\n\n return (\n <div className=\"ds-number-range\">\n <NumberField\n aria-label={minLabel}\n size={size}\n value={current.min}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, min: next })}\n />\n <span className=\"ds-number-range__dash\" aria-hidden=\"true\">\n –\n </span>\n <NumberField\n aria-label={maxLabel}\n size={size}\n value={current.max}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, max: next })}\n />\n </div>\n );\n}\n"],"mappings":"A,sPAcA,SAASU,EAAG,GAAGC,EAAuC,CACpD,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AAA,CAAC,MAAD,CAAK,UAAU,kBAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAACG,EAAD,CACE,aAAYgC,EACN,OACN,MAAO1B,EAAQ,IACV,MACA,MACC,OACE,SACA,SACI,aACZ,UAAWyB,EACX,cAAgB,GAAStB,EAAO,CAAE,GAAGH,EAAS,IAAKI,CAAK,CAAC,CAC1D,CAAA,GACD,EAAAb,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,wBAAwB,cAAY,OAAO,SAAA,GAErD,CAAA,GACN,EAAAA,EAAA,IAAA,CAACG,EAAD,CACE,aAAYiC,EACN,OACN,MAAO3B,EAAQ,IACV,MACA,MACC,OACE,SACA,SACI,aACZ,UAAWyB,EACX,cAAgB,GAAStB,EAAO,CAAE,GAAGH,EAAS,IAAKI,CAAK,CAAC,CAC1D,CAAA,CACE,C,EAET,C"}
@@ -1,4 +1,4 @@
1
- import { t as e } from "../../chunks/Icon-CGY1FNXT.js";
1
+ import { Button as e } from "../Button/index.js";
2
2
  /* empty css */
3
3
  import { FieldAffix as t } from "../FieldAffix/index.js";
4
4
  import { forwardRef as n, useCallback as r, useRef as i, useState as a } from "react";
@@ -18,16 +18,14 @@ var l = n(function({ size: n = "md", value: l, defaultValue: u = "", onValueChan
18
18
  className: c("ds-number", b),
19
19
  "data-size": n,
20
20
  children: [
21
- y && /* @__PURE__ */ o("button", {
22
- type: "button",
21
+ y && /* @__PURE__ */ o(e, {
22
+ size: n,
23
+ isIconOnly: !0,
24
+ iconStart: "minus",
23
25
  className: "ds-number__step",
24
26
  "aria-label": "Decrease",
25
- disabled: _ || x || f !== void 0 && D !== "" && D <= f,
26
- onClick: () => A(-1),
27
- children: /* @__PURE__ */ o(e, {
28
- name: "minus",
29
- size: 16
30
- })
27
+ isDisabled: _ || x || f !== void 0 && D !== "" && D <= f,
28
+ onClick: () => A(-1)
31
29
  }),
32
30
  /* @__PURE__ */ o(t, {
33
31
  className: "ds-number__body",
@@ -54,16 +52,14 @@ var l = n(function({ size: n = "md", value: l, defaultValue: u = "", onValueChan
54
52
  ...C
55
53
  })
56
54
  }),
57
- y && /* @__PURE__ */ o("button", {
58
- type: "button",
55
+ y && /* @__PURE__ */ o(e, {
56
+ size: n,
57
+ isIconOnly: !0,
58
+ iconStart: "plus",
59
59
  className: "ds-number__step",
60
60
  "aria-label": "Increase",
61
- disabled: _ || x || p !== void 0 && D !== "" && D >= p,
62
- onClick: () => A(1),
63
- children: /* @__PURE__ */ o(e, {
64
- name: "plus",
65
- size: 16
66
- })
61
+ isDisabled: _ || x || p !== void 0 && D !== "" && D >= p,
62
+ onClick: () => A(1)
67
63
  })
68
64
  ]
69
65
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Icon","cx","parts","NumberField","forwardRef","ariaInvalid","rest","internal","setInternal","useState","defaultValue","current","value","inputRef","useRef","commit","useCallback","next","onValueChange","nudge","min","direction","step","max","outOfRange","className","size","hasSteppers","isDisabled","disabled","FieldAffix","prefix","suffix","node","ref","isInvalid","raw","event","NumberRangeField","crossed","minLabel","maxLabel"],"sources":["../../../src/components/NumberField/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface NumberFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\" | \"value\" | \"defaultValue\" | \"onChange\" | \"prefix\"> {\n size?: FieldSize;\n value?: number | \"\";\n defaultValue?: number | \"\";\n onValueChange?: (value: number | \"\") => void;\n min?: number;\n max?: number;\n step?: number | \"any\";\n /** Rendered inside the field, before the number — \"£\", \"$\", a glyph. */\n prefix?: ReactNode;\n /** Rendered inside the field, after the number — \"kg\", \"%\", \"px\". */\n suffix?: ReactNode;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Hide the − / + steppers and keep typing only. */\n hasSteppers?: boolean;\n}\n\n\n/**\n * A quantity, bounded by `min` and `max`. Steppers move by `step` and stop at\n * the bounds; typing is never blocked, an out-of-range value reads invalid.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n size = \"md\",\n value,\n defaultValue = \"\",\n onValueChange,\n min,\n max,\n step = 1,\n prefix,\n suffix,\n\n isDisabled = false,\n isInvalid = false,\n hasSteppers = true,\n className,\n disabled,\n \"aria-invalid\": ariaInvalid,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState<number | \"\">(defaultValue);\n const current = value ?? internal;\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const commit = useCallback(\n (next: number | \"\") => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n [onValueChange, value],\n );\n\n const nudge = (direction: 1 | -1) => {\n const base = current === \"\" ? (min ?? 0) : current;\n let next = base + direction * (step === \"any\" ? 1 : step);\n if (min !== undefined) next = Math.max(min, next);\n if (max !== undefined) next = Math.min(max, next);\n next = Number(next.toFixed(10));\n commit(next);\n inputRef.current?.focus();\n };\n\n const outOfRange =\n current !== \"\" &&\n ((min !== undefined && current < min) || (max !== undefined && current > max));\n\n return (\n <div className={cx(\"ds-number\", className)} data-size={size}>\n {hasSteppers && (\n <button\n type=\"button\"\n className=\"ds-number__step\"\n aria-label=\"Decrease\"\n disabled={isDisabled || disabled || (min !== undefined && current !== \"\" && current <= min)}\n onClick={() => nudge(-1)}\n >\n <Icon name=\"minus\" size={16} />\n </button>\n )}\n <FieldAffix className=\"ds-number__body\" lead={prefix} trail={suffix}>\n <input\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"number\"\n inputMode=\"decimal\"\n value={current}\n min={min}\n max={max}\n step={step}\n disabled={isDisabled || disabled}\n aria-invalid={isInvalid || outOfRange || ariaInvalid || undefined}\n data-size={size}\n className=\"ds-field-skin ds-number__input\"\n onChange={(event) => {\n const raw = event.target.value;\n commit(raw === \"\" ? \"\" : Number(raw));\n }}\n {...rest}\n />\n </FieldAffix>\n\n {hasSteppers && (\n <button\n type=\"button\"\n className=\"ds-number__step\"\n aria-label=\"Increase\"\n disabled={isDisabled || disabled || (max !== undefined && current !== \"\" && current >= max)}\n onClick={() => nudge(1)}\n >\n <Icon name=\"plus\" size={16} />\n </button>\n )}\n </div>\n );\n});\n\nexport interface NumberRangeValue {\n min: number | \"\";\n max: number | \"\";\n}\n\nexport interface NumberRangeFieldProps {\n value?: NumberRangeValue;\n defaultValue?: NumberRangeValue;\n onValueChange?: (value: NumberRangeValue) => void;\n size?: FieldSize;\n /** Hard bounds both ends are clamped to. */\n min?: number;\n max?: number;\n step?: number;\n /** Rendered inside both fields, before the number. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n isDisabled?: boolean;\n minLabel?: string;\n maxLabel?: string;\n}\n\n/**\n * A lower and an upper bound, typed. The pair reads invalid when the minimum\n * passes the maximum — neither field is rewritten behind the user.\n */\nexport function NumberRangeField({\n value,\n defaultValue = { min: \"\", max: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n step = 1,\n prefix,\n suffix,\n isDisabled = false,\n minLabel = \"Minimum\",\n maxLabel = \"Maximum\",\n}: NumberRangeFieldProps) {\n const [internal, setInternal] = useState<NumberRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: NumberRangeValue) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n };\n\n const crossed = current.min !== \"\" && current.max !== \"\" && current.min > current.max;\n\n return (\n <div className=\"ds-number-range\">\n <NumberField\n aria-label={minLabel}\n size={size}\n value={current.min}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, min: next })}\n />\n <span className=\"ds-number-range__dash\" aria-hidden=\"true\">\n –\n </span>\n <NumberField\n aria-label={maxLabel}\n size={size}\n value={current.max}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, max: next })}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;AAcA,SAASC,EAAG,GAAGC,GAAuC;CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AA0BA,IAAaC,IAAcC,EAA+C,SACxE,EACE,UAAO,MACP,UACA,kBAAe,IACf,kBACA,QACA,QACA,UAAO,GACP,WACA,WAEA,gBAAa,IACb,eAAY,IACZ,iBAAc,IACd,cACA,aACA,gBAAgBC,GAChB,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAUC,KAAeC,EAAsBC,CAAY,GAC5DC,IAAUC,KAASL,GACnBM,IAAWC,EAAgC,IAAI,GAE/CC,IAASC,GACZ,MAAsB;EAErB,AADIJ,MAAU,KAAA,KAAWJ,EAAYS,CAAI,GACzCC,IAAgBD,CAAI;CACtB,GACA,CAACC,GAAeN,CAAK,CACvB,GAEMO,KAAS,MAAsB;EAEnC,IAAIF,KADSN,MAAY,KAAMS,KAAO,IAAKT,KACzBU,KAAaC,MAAS,QAAQ,IAAIA;EAKpD,AAJIF,MAAQ,KAAA,MAAW,IAAO,KAAK,IAAIA,GAAKH,CAAI,IAC5CM,MAAQ,KAAA,MAAW,IAAO,KAAK,IAAIA,GAAKN,CAAI,IAChD,IAAO,OAAOA,EAAK,QAAQ,EAAE,CAAC,GAC9BF,EAAOE,CAAI,GACXJ,EAAS,SAAS,MAAM;CAC1B,GAEMW,IACJb,MAAY,OACVS,MAAQ,KAAA,KAAaT,IAAUS,KAASG,MAAQ,KAAA,KAAaZ,IAAUY;CAE3E,OACE,kBAAC,OAAD;EAAK,WAAWtB,EAAG,aAAawB,CAAS;EAAG,aAAWC;EAAvD,UAAA;GACGC,K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J,EAAYS,CAAI,GACzCC,IAAgBD,CAAI;CACtB,GAEMsB,IAAU5B,EAAQ,QAAQ,MAAMA,EAAQ,QAAQ,MAAMA,EAAQ,MAAMA,EAAQ;CAElF,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAACR,GAAD;IACE,cAAYqC;IACN;IACN,OAAO7B,EAAQ;IACV;IACA;IACC;IACE;IACA;IACI;IACZ,WAAW4B;IACX,gBAAgB,MAASxB,EAAO;KAAE,GAAGJ;KAAS,KAAKM;IAAK,CAAC;GAC1D,CAAA;GACD,kBAAC,QAAD;IAAM,WAAU;IAAwB,eAAY;IAAO,UAAA;GAErD,CAAA;GACN,kBAACd,GAAD;IACE,cAAYsC;IACN;IACN,OAAO9B,EAAQ;IACV;IACA;IACC;IACE;IACA;IACI;IACZ,WAAW4B;IACX,gBAAgB,MAASxB,EAAO;KAAE,GAAGJ;KAAS,KAAKM;IAAK,CAAC;GAC1D,CAAA;EACE;;AAET"}
1
+ {"version":3,"file":"index.js","names":["cx","parts","NumberField","forwardRef","ariaInvalid","rest","internal","setInternal","useState","defaultValue","current","value","inputRef","useRef","commit","useCallback","next","onValueChange","nudge","min","direction","step","max","outOfRange","className","size","hasSteppers","Button","isDisabled","disabled","FieldAffix","prefix","suffix","node","ref","isInvalid","raw","event","NumberRangeField","crossed","minLabel","maxLabel"],"sources":["../../../src/components/NumberField/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface NumberFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\" | \"value\" | \"defaultValue\" | \"onChange\" | \"prefix\"> {\n size?: FieldSize;\n value?: number | \"\";\n defaultValue?: number | \"\";\n onValueChange?: (value: number | \"\") => void;\n min?: number;\n max?: number;\n step?: number | \"any\";\n /** Rendered inside the field, before the number — \"£\", \"$\", a glyph. */\n prefix?: ReactNode;\n /** Rendered inside the field, after the number — \"kg\", \"%\", \"px\". */\n suffix?: ReactNode;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Hide the − / + steppers and keep typing only. */\n hasSteppers?: boolean;\n}\n\n\n/**\n * A quantity, bounded by `min` and `max`. Steppers move by `step` and stop at\n * the bounds; typing is never blocked, an out-of-range value reads invalid.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n size = \"md\",\n value,\n defaultValue = \"\",\n onValueChange,\n min,\n max,\n step = 1,\n prefix,\n suffix,\n\n isDisabled = false,\n isInvalid = false,\n hasSteppers = true,\n className,\n disabled,\n \"aria-invalid\": ariaInvalid,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState<number | \"\">(defaultValue);\n const current = value ?? internal;\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const commit = useCallback(\n (next: number | \"\") => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n [onValueChange, value],\n );\n\n const nudge = (direction: 1 | -1) => {\n const base = current === \"\" ? (min ?? 0) : current;\n let next = base + direction * (step === \"any\" ? 1 : step);\n if (min !== undefined) next = Math.max(min, next);\n if (max !== undefined) next = Math.min(max, next);\n next = Number(next.toFixed(10));\n commit(next);\n inputRef.current?.focus();\n };\n\n const outOfRange =\n current !== \"\" &&\n ((min !== undefined && current < min) || (max !== undefined && current > max));\n\n return (\n <div className={cx(\"ds-number\", className)} data-size={size}>\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"minus\"\n className=\"ds-number__step\"\n aria-label=\"Decrease\"\n isDisabled={isDisabled || disabled || (min !== undefined && current !== \"\" && current <= min)}\n onClick={() => nudge(-1)}\n />\n )}\n <FieldAffix className=\"ds-number__body\" lead={prefix} trail={suffix}>\n <input\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"number\"\n inputMode=\"decimal\"\n value={current}\n min={min}\n max={max}\n step={step}\n disabled={isDisabled || disabled}\n aria-invalid={isInvalid || outOfRange || ariaInvalid || undefined}\n data-size={size}\n className=\"ds-field-skin ds-number__input\"\n onChange={(event) => {\n const raw = event.target.value;\n commit(raw === \"\" ? \"\" : Number(raw));\n }}\n {...rest}\n />\n </FieldAffix>\n\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"plus\"\n className=\"ds-number__step\"\n aria-label=\"Increase\"\n isDisabled={isDisabled || disabled || (max !== undefined && current !== \"\" && current >= max)}\n onClick={() => nudge(1)}\n />\n )}\n </div>\n );\n});\n\nexport interface NumberRangeValue {\n min: number | \"\";\n max: number | \"\";\n}\n\nexport interface NumberRangeFieldProps {\n value?: NumberRangeValue;\n defaultValue?: NumberRangeValue;\n onValueChange?: (value: NumberRangeValue) => void;\n size?: FieldSize;\n /** Hard bounds both ends are clamped to. */\n min?: number;\n max?: number;\n step?: number;\n /** Rendered inside both fields, before the number. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n isDisabled?: boolean;\n minLabel?: string;\n maxLabel?: string;\n}\n\n/**\n * A lower and an upper bound, typed. The pair reads invalid when the minimum\n * passes the maximum — neither field is rewritten behind the user.\n */\nexport function NumberRangeField({\n value,\n defaultValue = { min: \"\", max: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n step = 1,\n prefix,\n suffix,\n isDisabled = false,\n minLabel = \"Minimum\",\n maxLabel = \"Maximum\",\n}: NumberRangeFieldProps) {\n const [internal, setInternal] = useState<NumberRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: NumberRangeValue) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n };\n\n const crossed = current.min !== \"\" && current.max !== \"\" && current.min > current.max;\n\n return (\n <div className=\"ds-number-range\">\n <NumberField\n aria-label={minLabel}\n size={size}\n value={current.min}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, min: next })}\n />\n <span className=\"ds-number-range__dash\" aria-hidden=\"true\">\n –\n </span>\n <NumberField\n aria-label={maxLabel}\n size={size}\n value={current.max}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, max: next })}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;AAcA,SAASA,EAAG,GAAGC,GAAuC;CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AA0BA,IAAaC,IAAcC,EAA+C,SACxE,EACE,UAAO,MACP,UACA,kBAAe,IACf,kBACA,QACA,QACA,UAAO,GACP,WACA,WAEA,gBAAa,IACb,eAAY,IACZ,iBAAc,IACd,cACA,aACA,gBAAgBC,GAChB,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAUC,KAAeC,EAAsBC,CAAY,GAC5DC,IAAUC,KAASL,GACnBM,IAAWC,EAAgC,IAAI,GAE/CC,IAASC,GACZ,MAAsB;EAErB,AADIJ,MAAU,KAAA,KAAWJ,EAAYS,CAAI,GACzCC,IAAgBD,CAAI;CACtB,GACA,CAACC,GAAeN,CAAK,CACvB,GAEMO,KAAS,MAAsB;EAEnC,IAAIF,KADSN,MAAY,KAAMS,KAAO,IAAKT,KACzBU,KAAaC,MAAS,QAAQ,IAAIA;EAKpD,AAJIF,MAAQ,KAAA,MAAW,IAAO,KAAK,IAAIA,GAAKH,CAAI,IAC5CM,MAAQ,KAAA,MAAW,IAAO,KAAK,IAAIA,GAAKN,CAAI,IAChD,IAAO,OAAOA,EAAK,QAAQ,EAAE,CAAC,GAC9BF,EAAOE,CAAI,GACXJ,EAAS,SAAS,MAAM;CAC1B,G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C,CAAY,GACjEC,IAAUC,KAASL,GAEnBQ,KAAU,MAA2B;EAEzC,AADIH,MAAU,KAAA,KAAWJ,EAAYS,CAAI,GACzCC,IAAgBD,CAAI;CACtB,GAEMuB,IAAU7B,EAAQ,QAAQ,MAAMA,EAAQ,QAAQ,MAAMA,EAAQ,MAAMA,EAAQ;CAElF,OACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAACR,GAAD;IACE,cAAYsC;IACN;IACN,OAAO9B,EAAQ;IACV;IACA;IACC;IACE;IACA;IACI;IACZ,WAAW6B;IACX,gBAAgB,MAASzB,EAAO;KAAE,GAAGJ;KAAS,KAAKM;IAAK,CAAC;GAC1D,CAAA;GACD,kBAAC,QAAD;IAAM,WAAU;IAAwB,eAAY;IAAO,UAAA;GAErD,CAAA;GACN,kBAACd,GAAD;IACE,cAAYuC;IACN;IACN,OAAO/B,EAAQ;IACV;IACA;IACC;IACE;IACA;IACI;IACZ,WAAW6B;IACX,gBAAgB,MAASzB,EAAO;KAAE,GAAGJ;KAAS,KAAKM;IAAK,CAAC;GAC1D,CAAA;EACE;;AAET"}
@@ -31,47 +31,7 @@
31
31
  }
32
32
 
33
33
 
34
- .ds-number__step {
35
- display: grid;
36
- place-items: center;
37
- flex: none;
38
- inline-size: var(--field-height-md);
39
- block-size: var(--field-height-md);
40
- border: var(--control-border-width) solid var(--control-border-color);
41
- border-radius: var(--field-radius);
42
- background: var(--field-rest);
43
- color: var(--color-text);
44
- cursor: pointer;
45
- transition: background-color var(--duration-fast) var(--ease-standard);
46
- }
47
-
48
- .ds-number[data-size="sm"] .ds-number__step {
49
- inline-size: var(--field-height-sm);
50
- block-size: var(--field-height-sm);
51
- }
52
-
53
- .ds-number[data-size="lg"] .ds-number__step {
54
- inline-size: var(--field-height-lg);
55
- block-size: var(--field-height-lg);
56
- }
57
-
58
- .ds-number__step:hover:not(:disabled) {
59
- background: var(--field-hover);
60
- }
61
-
62
- .ds-number__step:active:not(:disabled) {
63
- background: var(--field-pressed);
64
- }
65
-
66
- .ds-number__step:focus-visible {
67
- outline: var(--control-border-width) solid var(--color-focus);
68
- outline-offset: 2px;
69
- }
70
-
71
- .ds-number__step:disabled {
72
- opacity: 45%;
73
- cursor: not-allowed;
74
- }
34
+ .ds-number__step { flex: none; }
75
35
 
76
36
  .ds-number-range {
77
37
  display: flex;
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime"),n=require("react-dom");function r(...e){return e.filter(Boolean).join(` `)}var i=8;function a({anchorRef:a,anchorId:o,isOpen:s,align:c=`start`,placement:l=`bottom`,matchAnchorWidth:u=!1,offset:d=4,className:f,children:p,role:m,id:h,panelRef:g,..._}){let v=(0,e.useRef)(null),y=(0,e.useId)(),b=h??y,x=(0,e.useCallback)(()=>{let e=a.current??(o?document.getElementById(o):null),t=v.current;if(!e||!t)return;let n=e.getBoundingClientRect();u&&(t.style.width=`${n.width}px`);let r=t.getBoundingClientRect(),s=document.documentElement.clientWidth,f=document.documentElement.clientHeight,p=f-n.bottom-d-i,m=n.top-d-i,h=l===`top`?m>=r.height||m>p:p<r.height&&m>p,g=Math.max(120,h?m:p),_=h?Math.max(i,n.top-d-Math.min(r.height,g)):Math.min(n.bottom+d,f-i),y=c===`end`?n.right-r.width:n.left,b=Math.max(i,Math.min(y,s-r.width-i));t.style.left=`${Math.round(b)}px`,t.style.top=`${Math.round(_)}px`,t.style.setProperty(`--popover-max-block-size`,`${Math.round(g)}px`),t.style.visibility=`visible`},[c,o,a,u,d,l]);if((0,e.useEffect)(()=>{if(!s)return;let e=document.querySelector(`[data-popover-instance="${CSS.escape(y)}"]`);v.current=e,g&&(g.current=e),x();let t=()=>x();return window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0),v.current=null,g&&(g.current=null)}},[y,s,b,g,x]),!s||typeof document>`u`)return null;let S=(0,t.jsx)(`div`,{id:b,"data-popover-instance":y,role:m,className:r(`ds-popover`,f),..._,children:p});return(0,n.createPortal)(S,document.body)}exports.Popover=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react-dom"),n=require("react/jsx-runtime");function r(...e){return e.filter(Boolean).join(` `)}var i=8;function a({anchorRef:a,anchorId:o,isOpen:s,align:c=`start`,placement:l=`bottom`,matchAnchorWidth:u=!1,offset:d=4,className:f,children:p,role:m,id:h,panelRef:g,..._}){let v=(0,e.useRef)(null),y=(0,e.useId)(),b=h??y,x=(0,e.useCallback)(()=>{let e=a.current??(o?document.getElementById(o):null),t=v.current;if(!e||!t)return;let n=e.getBoundingClientRect();u&&(t.style.width=`${n.width}px`);let r=t.getBoundingClientRect(),s=document.documentElement.clientWidth,f=document.documentElement.clientHeight,p=f-n.bottom-d-i,m=n.top-d-i,h=l===`top`?m>=r.height||m>p:p<r.height&&m>p,g=Math.max(120,h?m:p),_=h?Math.max(i,n.top-d-Math.min(r.height,g)):Math.min(n.bottom+d,f-i),y=c===`end`?n.right-r.width:n.left,b=Math.max(i,Math.min(y,s-r.width-i));t.style.left=`${Math.round(b)}px`,t.style.top=`${Math.round(_)}px`,t.style.setProperty(`--popover-max-block-size`,`${Math.round(g)}px`),t.style.visibility=`visible`},[c,o,a,u,d,l]);if((0,e.useEffect)(()=>{if(!s)return;let e=document.querySelector(`[data-popover-instance="${CSS.escape(y)}"]`);v.current=e,g&&(g.current=e),x();let t=()=>x();return window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0),v.current=null,g&&(g.current=null)}},[y,s,b,g,x]),!s||typeof document>`u`)return null;let S=(0,n.jsx)(`div`,{id:b,"data-popover-instance":y,role:m,className:r(`ds-popover`,f),..._,children:p});return(0,t.createPortal)(S,document.body)}exports.Popover=a;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["useRef","useId","useCallback","createPortal","react","react_jsx_runtime","react_dom","cx","parts","VIEWPORT_MARGIN","Popover","rest","floatingRef","generatedId","panelId","id","place","reference","anchorRef","anchorId","floating","anchor","matchAnchorWidth","panel","viewportWidth","viewportHeight","roomBelow","offset","roomAbove","placeAbove","placement","availableHeight","top","preferredLeft","align","left","isOpen","panelRef","update","className"],"sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["import { useCallback, useEffect, useId, useRef, type ReactNode, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst VIEWPORT_MARGIN = 8;\n\nexport type PopoverAlign = \"start\" | \"end\";\nexport type PopoverPlacement = \"top\" | \"bottom\";\n\nexport interface PopoverProps {\n /** The control the panel hangs off. */\n anchorRef: RefObject<HTMLElement | null>;\n /** Optional DOM id fallback for composed controls whose refs are consumed by a field wrapper. */\n anchorId?: string;\n isOpen: boolean;\n /** Which edge of the anchor the panel lines up with. Flips when it must. */\n align?: PopoverAlign;\n /** Preferred side of the anchor. Flips when the other side has more room. */\n placement?: PopoverPlacement;\n /** Match the anchor's width — for listboxes that read as one field. */\n matchAnchorWidth?: boolean;\n /** Gap between anchor and panel. */\n offset?: number;\n className?: string;\n children: ReactNode;\n role?: string;\n id?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n panelRef?: RefObject<HTMLDivElement | null>;\n}\n\n/**\n * A panel anchored to a control. It is positioned against the viewport, so it\n * flips above the anchor when the space below runs out and slides inward\n * rather than being cut off at any edge.\n */\nexport function Popover({\n anchorRef,\n anchorId,\n isOpen,\n align = \"start\",\n placement = \"bottom\",\n matchAnchorWidth = false,\n offset = 4,\n className,\n children,\n role,\n id,\n panelRef,\n ...rest\n}: PopoverProps) {\n const floatingRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const panelId = id ?? generatedId;\n\n const place = useCallback(() => {\n const reference = anchorRef.current ?? (anchorId ? document.getElementById(anchorId) : null);\n const floating = floatingRef.current;\n if (!reference || !floating) return;\n\n const anchor = reference.getBoundingClientRect();\n if (matchAnchorWidth) floating.style.width = `${anchor.width}px`;\n const panel = floating.getBoundingClientRect();\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n const roomBelow = viewportHeight - anchor.bottom - offset - VIEWPORT_MARGIN;\n const roomAbove = anchor.top - offset - VIEWPORT_MARGIN;\n const placeAbove = placement === \"top\"\n ? roomAbove >= panel.height || roomAbove > roomBelow\n : roomBelow < panel.height && roomAbove > roomBelow;\n const availableHeight = Math.max(120, placeAbove ? roomAbove : roomBelow);\n const top = placeAbove\n ? Math.max(VIEWPORT_MARGIN, anchor.top - offset - Math.min(panel.height, availableHeight))\n : Math.min(anchor.bottom + offset, viewportHeight - VIEWPORT_MARGIN);\n const preferredLeft = align === \"end\" ? anchor.right - panel.width : anchor.left;\n const left = Math.max(\n VIEWPORT_MARGIN,\n Math.min(preferredLeft, viewportWidth - panel.width - VIEWPORT_MARGIN),\n );\n\n floating.style.left = `${Math.round(left)}px`;\n floating.style.top = `${Math.round(top)}px`;\n floating.style.setProperty(\"--popover-max-block-size\", `${Math.round(availableHeight)}px`);\n floating.style.visibility = \"visible\";\n }, [align, anchorId, anchorRef, matchAnchorWidth, offset, placement]);\n\n useEffect(() => {\n if (!isOpen) return;\n const floating = document.querySelector<HTMLDivElement>(\n `[data-popover-instance=\"${CSS.escape(generatedId)}\"]`,\n );\n floatingRef.current = floating;\n if (panelRef) panelRef.current = floating;\n place();\n const update = () => place();\n window.addEventListener(\"resize\", update);\n window.addEventListener(\"scroll\", update, true);\n return () => {\n window.removeEventListener(\"resize\", update);\n window.removeEventListener(\"scroll\", update, true);\n floatingRef.current = null;\n if (panelRef) panelRef.current = null;\n };\n }, [generatedId, isOpen, panelId, panelRef, place]);\n\n if (!isOpen || typeof document === \"undefined\") return null;\n\n const panel = (\n <div\n id={panelId}\n data-popover-instance={generatedId}\n role={role}\n className={cx(\"ds-popover\", className)}\n {...rest}\n >\n {children}\n </div>\n );\n\n return createPortal(panel, document.body);\n}\n"],"mappings":"A,gJAIA,SAASO,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CAEA,IAAMC,EAAkB,EAiCxB,SAAgBC,EAAQ,CACtB,YACA,WACA,SACA,QAAQ,QACR,YAAY,SACZ,mBAAmB,GACnB,SAAS,EACT,YACA,WACA,OACA,KACA,WACA,GAAGC,GACY,CACf,IAAMC,GAAA,EAAcZ,EAAAA,OAAAA,CAA8B,IAAI,EAChDa,GAAA,EAAcZ,EAAAA,MAAAA,CAAM,EACpBa,EAAUC,GAAMF,EAEhBG,GAAA,EAAQd,EAAAA,YAAAA,KAAkB,CAC9B,IAAMe,EAAYC,EAAU,UAAYC,EAAW,SAAS,eAAeA,CAAQ,EAAI,MACjFC,EAAWR,EAAY,QAC7B,GAAI,CAACK,GAAa,CAACG,EAAU,OAE7B,IAAMC,EAASJ,EAAU,sBAAsB,EAC3CK,IAAkB,EAAS,MAAM,MAAQ,GAAGD,EAAO,MAAM,KAC7D,IAAME,EAAQH,EAAS,sBAAsB,EACvCI,EAAgB,SAAS,gBAAgB,YACzCC,EAAiB,SAAS,gBAAgB,aAC1CC,EAAYD,EAAiBJ,EAAO,OAASM,EAASlB,EACtDmB,EAAYP,EAAO,IAAMM,EAASlB,EAClCoB,EAAaC,IAAc,MAC7BF,GAAaL,EAAM,QAAUK,EAAYF,EACzCA,EAAYH,EAAM,QAAUK,EAAYF,EACtCK,EAAkB,KAAK,IAAI,IAAKF,EAAaD,EAAYF,CAAS,EAClEM,EAAMH,EACR,KAAK,IAAIpB,EAAiBY,EAAO,IAAMM,EAAS,KAAK,IAAIJ,EAAM,OAAQQ,CAAe,CAAC,EACvF,KAAK,IAAIV,EAAO,OAASM,EAAQF,EAAiBhB,CAAe,E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","useCallback","createPortal","react","react_dom","react_jsx_runtime","cx","parts","VIEWPORT_MARGIN","Popover","rest","floatingRef","generatedId","panelId","id","place","reference","anchorRef","anchorId","floating","anchor","matchAnchorWidth","panel","viewportWidth","viewportHeight","roomBelow","offset","roomAbove","placeAbove","placement","availableHeight","top","preferredLeft","align","left","isOpen","panelRef","update","className"],"sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["import { useCallback, useEffect, useId, useRef, type ReactNode, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst VIEWPORT_MARGIN = 8;\n\nexport type PopoverAlign = \"start\" | \"end\";\nexport type PopoverPlacement = \"top\" | \"bottom\";\n\nexport interface PopoverProps {\n /** The control the panel hangs off. */\n anchorRef: RefObject<HTMLElement | null>;\n /** Optional DOM id fallback for composed controls whose refs are consumed by a field wrapper. */\n anchorId?: string;\n isOpen: boolean;\n /** Which edge of the anchor the panel lines up with. Flips when it must. */\n align?: PopoverAlign;\n /** Preferred side of the anchor. Flips when the other side has more room. */\n placement?: PopoverPlacement;\n /** Match the anchor's width — for listboxes that read as one field. */\n matchAnchorWidth?: boolean;\n /** Gap between anchor and panel. */\n offset?: number;\n className?: string;\n children: ReactNode;\n role?: string;\n id?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n panelRef?: RefObject<HTMLDivElement | null>;\n}\n\n/**\n * A panel anchored to a control. It is positioned against the viewport, so it\n * flips above the anchor when the space below runs out and slides inward\n * rather than being cut off at any edge.\n */\nexport function Popover({\n anchorRef,\n anchorId,\n isOpen,\n align = \"start\",\n placement = \"bottom\",\n matchAnchorWidth = false,\n offset = 4,\n className,\n children,\n role,\n id,\n panelRef,\n ...rest\n}: PopoverProps) {\n const floatingRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const panelId = id ?? generatedId;\n\n const place = useCallback(() => {\n const reference = anchorRef.current ?? (anchorId ? document.getElementById(anchorId) : null);\n const floating = floatingRef.current;\n if (!reference || !floating) return;\n\n const anchor = reference.getBoundingClientRect();\n if (matchAnchorWidth) floating.style.width = `${anchor.width}px`;\n const panel = floating.getBoundingClientRect();\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n const roomBelow = viewportHeight - anchor.bottom - offset - VIEWPORT_MARGIN;\n const roomAbove = anchor.top - offset - VIEWPORT_MARGIN;\n const placeAbove = placement === \"top\"\n ? roomAbove >= panel.height || roomAbove > roomBelow\n : roomBelow < panel.height && roomAbove > roomBelow;\n const availableHeight = Math.max(120, placeAbove ? roomAbove : roomBelow);\n const top = placeAbove\n ? Math.max(VIEWPORT_MARGIN, anchor.top - offset - Math.min(panel.height, availableHeight))\n : Math.min(anchor.bottom + offset, viewportHeight - VIEWPORT_MARGIN);\n const preferredLeft = align === \"end\" ? anchor.right - panel.width : anchor.left;\n const left = Math.max(\n VIEWPORT_MARGIN,\n Math.min(preferredLeft, viewportWidth - panel.width - VIEWPORT_MARGIN),\n );\n\n floating.style.left = `${Math.round(left)}px`;\n floating.style.top = `${Math.round(top)}px`;\n floating.style.setProperty(\"--popover-max-block-size\", `${Math.round(availableHeight)}px`);\n floating.style.visibility = \"visible\";\n }, [align, anchorId, anchorRef, matchAnchorWidth, offset, placement]);\n\n useEffect(() => {\n if (!isOpen) return;\n const floating = document.querySelector<HTMLDivElement>(\n `[data-popover-instance=\"${CSS.escape(generatedId)}\"]`,\n );\n floatingRef.current = floating;\n if (panelRef) panelRef.current = floating;\n place();\n const update = () => place();\n window.addEventListener(\"resize\", update);\n window.addEventListener(\"scroll\", update, true);\n return () => {\n window.removeEventListener(\"resize\", update);\n window.removeEventListener(\"scroll\", update, true);\n floatingRef.current = null;\n if (panelRef) panelRef.current = null;\n };\n }, [generatedId, isOpen, panelId, panelRef, place]);\n\n if (!isOpen || typeof document === \"undefined\") return null;\n\n const panel = (\n <div\n id={panelId}\n data-popover-instance={generatedId}\n role={role}\n className={cx(\"ds-popover\", className)}\n {...rest}\n >\n {children}\n </div>\n );\n\n return createPortal(panel, document.body);\n}\n"],"mappings":"A,gJAIA,SAASO,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CAEA,IAAMC,EAAkB,EAiCxB,SAAgBC,EAAQ,CACtB,YACA,WACA,SACA,QAAQ,QACR,YAAY,SACZ,mBAAmB,GACnB,SAAS,EACT,YACA,WACA,OACA,KACA,WACA,GAAGC,GACY,CACf,IAAMC,GAAA,EAAcZ,EAAAA,OAAAA,CAA8B,IAAI,EAChDa,GAAA,EAAcZ,EAAAA,MAAAA,CAAM,EACpBa,EAAUC,GAAMF,EAEhBG,GAAA,EAAQd,EAAAA,YAAAA,KAAkB,CAC9B,IAAMe,EAAYC,EAAU,UAAYC,EAAW,SAAS,eAAeA,CAAQ,EAAI,MACjFC,EAAWR,EAAY,QAC7B,GAAI,CAACK,GAAa,CAACG,EAAU,OAE7B,IAAMC,EAASJ,EAAU,sBAAsB,EAC3CK,IAAkB,EAAS,MAAM,MAAQ,GAAGD,EAAO,MAAM,KAC7D,IAAME,EAAQH,EAAS,sBAAsB,EACvCI,EAAgB,SAAS,gBAAgB,YACzCC,EAAiB,SAAS,gBAAgB,aAC1CC,EAAYD,EAAiBJ,EAAO,OAASM,EAASlB,EACtDmB,EAAYP,EAAO,IAAMM,EAASlB,EAClCoB,EAAaC,IAAc,MAC7BF,GAAaL,EAAM,QAAUK,EAAYF,EACzCA,EAAYH,EAAM,QAAUK,EAAYF,EACtCK,EAAkB,KAAK,IAAI,IAAKF,EAAaD,EAAYF,CAAS,EAClEM,EAAMH,EACR,KAAK,IAAIpB,EAAiBY,EAAO,IAAMM,EAAS,KAAK,IAAIJ,EAAM,OAAQQ,CAAe,CAAC,EACvF,KAAK,IAAIV,EAAO,OAASM,EAAQF,EAAiBhB,CAAe,EAC/DwB,EAAgBC,IAAU,MAA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react";
2
- import { jsx as i } from "react/jsx-runtime";
3
- import { createPortal as a } from "react-dom";
2
+ import { createPortal as i } from "react-dom";
3
+ import { jsx as a } from "react/jsx-runtime";
4
4
  //#region src/components/Popover/index.tsx
5
5
  function o(...e) {
6
6
  return e.filter(Boolean).join(" ");
@@ -37,7 +37,7 @@ function c({ anchorRef: c, anchorId: l, isOpen: u, align: d = "start", placement
37
37
  y,
38
38
  w
39
39
  ]), !u || typeof document > "u") return null;
40
- let T = /* @__PURE__ */ i("div", {
40
+ let T = /* @__PURE__ */ a("div", {
41
41
  id: C,
42
42
  "data-popover-instance": S,
43
43
  role: _,
@@ -45,7 +45,7 @@ function c({ anchorRef: c, anchorId: l, isOpen: u, align: d = "start", placement
45
45
  ...b,
46
46
  children: g
47
47
  });
48
- return a(T, document.body);
48
+ return i(T, document.body);
49
49
  }
50
50
  //#endregion
51
51
  export { c as Popover };
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs");;/* empty css */const t=require("../FieldAffix/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=(0,n.forwardRef)(function({size:i=`md`,isDisabled:a=!1,onClear:o,className:s,placeholder:c=`Search`,value:l,disabled:u,onKeyDown:d,...f},p){let m=(0,n.useRef)(null),h=l!==void 0&&String(l).length>0;return(0,r.jsx)(t.FieldAffix,{className:s,lead:(0,r.jsx)(e.t,{name:`search`,size:16}),isTrailInteractive:!0,trail:h&&o?(0,r.jsx)(`button`,{type:`button`,className:`ds-search__clear`,"aria-label":`Clear search`,disabled:a||u,onClick:()=>{o(),m.current?.focus()},children:(0,r.jsx)(e.t,{name:`x`,size:16})}):void 0,children:(0,r.jsx)(`input`,{ref:e=>{m.current=e,typeof p==`function`?p(e):p&&(p.current=e)},type:`search`,value:l,placeholder:c,disabled:a||u,"data-size":i,className:`ds-field-skin ds-search__input`,onKeyDown:e=>{e.key===`Escape`&&o&&o(),d?.(e)},...f})})});exports.SearchField=i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs"),t=require("../Button/index.cjs");;/* empty css */const n=require("../FieldAffix/index.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=(0,r.forwardRef)(function({size:a=`md`,isDisabled:o=!1,onClear:s,className:c,placeholder:l=`Search`,value:u,disabled:d,onKeyDown:f,...p},m){let h=(0,r.useRef)(null),g=u!==void 0&&String(u).length>0;return(0,i.jsx)(n.FieldAffix,{className:c,lead:(0,i.jsx)(e.t,{name:`search`,size:16}),isTrailInteractive:!0,trail:g&&s?(0,i.jsx)(t.Button,{variant:`simple`,size:`xs`,isIconOnly:!0,iconStart:`x`,"aria-label":`Clear search`,isDisabled:o||d,onClick:()=>{s(),h.current?.focus()}}):void 0,children:(0,i.jsx)(`input`,{ref:e=>{h.current=e,typeof m==`function`?m(e):m&&(m.current=e)},type:`search`,value:u,placeholder:l,disabled:o||d,"data-size":a,className:`ds-field-skin ds-search__input`,onKeyDown:e=>{e.key===`Escape`&&s&&s(),f?.(e)},...p})})});exports.SearchField=a;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["forwardRef","useRef","FieldAffix","Icon","require_Icon","require_components_FieldAffix_index","react","react_jsx_runtime","SearchField","rest","inner","hasValue","value","onClear","isDisabled","disabled","node","ref","size","event","onKeyDown"],"sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport interface SearchFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\"> {\n size?: FieldSize;\n isDisabled?: boolean;\n /** Fired by the clear button and by Escape. */\n onClear?: () => void;\n}\n\n/** A filter over a collection. Carries the glyph, and clears without a Save. */\nexport const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n size = \"md\",\n isDisabled = false,\n onClear,\n className,\n placeholder = \"Search\",\n value,\n disabled,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const hasValue = value !== undefined ? String(value).length > 0 : false;\n\n return (\n <FieldAffix\n className={className}\n lead={<Icon name=\"search\" size={16} />}\n isTrailInteractive\n trail={\n hasValue && onClear ? (\n <button\n type=\"button\"\n className=\"ds-search__clear\"\n aria-label=\"Clear search\"\n disabled={isDisabled || disabled}\n onClick={() => {\n onClear();\n inner.current?.focus();\n }}\n >\n <Icon name=\"x\" size={16} />\n </button>\n ) : undefined\n }\n >\n <input\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"search\"\n value={value}\n placeholder={placeholder}\n disabled={isDisabled || disabled}\n data-size={size}\n className=\"ds-field-skin ds-search__input\"\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && onClear) onClear();\n onKeyDown?.(event);\n }}\n {...rest}\n />\n </FieldAffix>\n );\n});\n"],"mappings":"A,iQAgBA,IAAaQ,GAAA,EAAcR,EAAAA,WAAAA,CAA+C,SACxE,CACE,OAAO,KACP,aAAa,GACb,UACA,YACA,cAAc,SACd,QACA,WACA,YACA,GAAGS,GAEL,EACA,CACA,IAAMC,GAAA,EAAQT,EAAAA,OAAAA,CAAgC,IAAI,EAC5CU,EAAWC,IAAU,IAAA,IAAY,OAAOA,CAAK,CAAC,CAAC,OAAS,EAE9D,OACE,EAAAL,EAAA,IAAA,CAACL,EAAAA,WAAD,CACa,YACX,MAAM,EAAAK,EAAA,IAAA,CAACJ,EAAAA,EAAD,CAAM,KAAK,SAAS,KAAM,EAAK,CAAA,EACrC,mBAAA,GACA,MACEQ,GAAYE,GACV,EAAAN,EAAA,IAAA,CAAC,SAAD,CACE,KAAK,SACL,UAAU,mBACV,aAAW,eACX,SAAUO,GAAcC,EACxB,YAAe,CACbF,EAAQ,EACRH,EAAM,SAAS,MAAM,CACvB,EAEA,UAAA,EAAAH,EAAA,IAAA,CAACJ,EAAAA,EAAD,CAAM,KAAK,IAAI,KAAM,EAAK,CAAA,CACpB,CAAA,EACN,IAAA,GAGN,UAAA,EAAAI,EAAA,IAAA,CAAC,QAAD,CACE,IAAM,GAAS,CACb,EAAM,QAAUS,EACZ,OAAOC,GAAQ,WAAYA,EAAID,CAAI,EAC9BC,IAAK,EAAI,QAAUD,EAC9B,EACA,KAAK,SACE,QACM,cACb,SAAUF,GAAcC,EACxB,YAAWG,EACX,UAAU,iCACV,UAAY,GAAU,CAChBC,EAAM,MAAQ,UAAYN,GAASA,EAAQ,EAC/CO,IAAYD,CAAK,CACnB,EACA,GAAIV,CACL,CAAA,CACS,CAAA,CAEhB,CAAC,E"}
1
+ {"version":3,"file":"index.cjs","names":["forwardRef","useRef","FieldAffix","Icon","Button","require_Icon","require_components_Button_index","require_components_FieldAffix_index","react","react_jsx_runtime","SearchField","rest","inner","hasValue","value","onClear","isDisabled","disabled","node","ref","size","event","onKeyDown"],"sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport interface SearchFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\"> {\n size?: FieldSize;\n isDisabled?: boolean;\n /** Fired by the clear button and by Escape. */\n onClear?: () => void;\n}\n\n/** A filter over a collection. Carries the glyph, and clears without a Save. */\nexport const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n size = \"md\",\n isDisabled = false,\n onClear,\n className,\n placeholder = \"Search\",\n value,\n disabled,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const hasValue = value !== undefined ? String(value).length > 0 : false;\n\n return (\n <FieldAffix\n className={className}\n lead={<Icon name=\"search\" size={16} />}\n isTrailInteractive\n trail={\n hasValue && onClear ? (\n <Button\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n iconStart=\"x\"\n aria-label=\"Clear search\"\n isDisabled={isDisabled || disabled}\n onClick={() => {\n onClear();\n inner.current?.focus();\n }}\n />\n ) : undefined\n }\n >\n <input\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"search\"\n value={value}\n placeholder={placeholder}\n disabled={isDisabled || disabled}\n data-size={size}\n className=\"ds-field-skin ds-search__input\"\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && onClear) onClear();\n onKeyDown?.(event);\n }}\n {...rest}\n />\n </FieldAffix>\n );\n});\n"],"mappings":"A,kSAiBA,IAAaU,GAAA,EAAcV,EAAAA,WAAAA,CAA+C,SACxE,CACE,OAAO,KACP,aAAa,GACb,UACA,YACA,cAAc,SACd,QACA,WACA,YACA,GAAGW,GAEL,EACA,CACA,IAAMC,GAAA,EAAQX,EAAAA,OAAAA,CAAgC,IAAI,EAC5CY,EAAWC,IAAU,IAAA,IAAY,OAAOA,CAAK,CAAC,CAAC,OAAS,EAE9D,OACE,EAAAL,EAAA,IAAA,CAACP,EAAAA,WAAD,CACa,YACX,MAAM,EAAAO,EAAA,IAAA,CAACN,EAAAA,EAAD,CAAM,KAAK,SAAS,KAAM,EAAK,CAAA,EACrC,mBAAA,GACA,MACEU,GAAYE,GACV,EAAAN,EAAA,IAAA,CAACL,EAAAA,OAAD,CACE,QAAQ,SACR,KAAK,KACL,WAAA,GACA,UAAU,IACV,aAAW,eACX,WAAYY,GAAcC,EAC1B,YAAe,CACbF,EAAQ,EACRH,EAAM,SAAS,MAAM,CACvB,CACD,CAAA,EACC,IAAA,GAGN,UAAA,EAAAH,EAAA,IAAA,CAAC,QAAD,CACE,IAAM,GAAS,CACb,EAAM,QAAUS,EACZ,OAAOC,GAAQ,WAAYA,EAAID,CAAI,EAC9BC,IAAK,EAAI,QAAUD,EAC9B,EACA,KAAK,SACE,QACM,cACb,SAAUF,GAAcC,EACxB,YAAWG,EACX,UAAU,iCACV,UAAY,GAAU,CAChBC,EAAM,MAAQ,UAAYN,GAASA,EAAQ,EAC/CO,IAAYD,CAAK,CACnB,EACA,GAAIV,CACL,CAAA,CACS,CAAA,CAEhB,CAAC,E"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/SearchField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAGrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gFAAgF;AAChF,eAAO,MAAM,WAAW,+GA2DtB,CAAC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/SearchField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gFAAgF;AAChF,eAAO,MAAM,WAAW,+GA2DtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAGrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gFAAgF;AAChF,eAAO,MAAM,WAAW,+GA2DtB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gFAAgF;AAChF,eAAO,MAAM,WAAW,+GA2DtB,CAAC"}
@@ -1,49 +1,48 @@
1
1
  import { t as e } from "../../chunks/Icon-CGY1FNXT.js";
2
+ import { Button as t } from "../Button/index.js";
2
3
  /* empty css */
3
- import { FieldAffix as t } from "../FieldAffix/index.js";
4
- import { forwardRef as n, useRef as r } from "react";
5
- import { jsx as i } from "react/jsx-runtime";
4
+ import { FieldAffix as n } from "../FieldAffix/index.js";
5
+ import { forwardRef as r, useRef as i } from "react";
6
+ import { jsx as a } from "react/jsx-runtime";
6
7
  //#region src/components/SearchField/index.tsx
7
- var a = n(function({ size: n = "md", isDisabled: a = !1, onClear: o, className: s, placeholder: c = "Search", value: l, disabled: u, onKeyDown: d, ...f }, p) {
8
- let m = r(null), h = l !== void 0 && String(l).length > 0;
9
- return /* @__PURE__ */ i(t, {
10
- className: s,
11
- lead: /* @__PURE__ */ i(e, {
8
+ var o = r(function({ size: r = "md", isDisabled: o = !1, onClear: s, className: c, placeholder: l = "Search", value: u, disabled: d, onKeyDown: f, ...p }, m) {
9
+ let h = i(null), g = u !== void 0 && String(u).length > 0;
10
+ return /* @__PURE__ */ a(n, {
11
+ className: c,
12
+ lead: /* @__PURE__ */ a(e, {
12
13
  name: "search",
13
14
  size: 16
14
15
  }),
15
16
  isTrailInteractive: !0,
16
- trail: h && o ? /* @__PURE__ */ i("button", {
17
- type: "button",
18
- className: "ds-search__clear",
17
+ trail: g && s ? /* @__PURE__ */ a(t, {
18
+ variant: "simple",
19
+ size: "xs",
20
+ isIconOnly: !0,
21
+ iconStart: "x",
19
22
  "aria-label": "Clear search",
20
- disabled: a || u,
23
+ isDisabled: o || d,
21
24
  onClick: () => {
22
- o(), m.current?.focus();
23
- },
24
- children: /* @__PURE__ */ i(e, {
25
- name: "x",
26
- size: 16
27
- })
25
+ s(), h.current?.focus();
26
+ }
28
27
  }) : void 0,
29
- children: /* @__PURE__ */ i("input", {
28
+ children: /* @__PURE__ */ a("input", {
30
29
  ref: (e) => {
31
- m.current = e, typeof p == "function" ? p(e) : p && (p.current = e);
30
+ h.current = e, typeof m == "function" ? m(e) : m && (m.current = e);
32
31
  },
33
32
  type: "search",
34
- value: l,
35
- placeholder: c,
36
- disabled: a || u,
37
- "data-size": n,
33
+ value: u,
34
+ placeholder: l,
35
+ disabled: o || d,
36
+ "data-size": r,
38
37
  className: "ds-field-skin ds-search__input",
39
38
  onKeyDown: (e) => {
40
- e.key === "Escape" && o && o(), d?.(e);
39
+ e.key === "Escape" && s && s(), f?.(e);
41
40
  },
42
- ...f
41
+ ...p
43
42
  })
44
43
  });
45
44
  });
46
45
  //#endregion
47
- export { a as SearchField };
46
+ export { o as SearchField };
48
47
 
49
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Icon","SearchField","forwardRef","rest","inner","useRef","hasValue","value","FieldAffix","onClear","isDisabled","disabled","node","ref","size","event","onKeyDown"],"sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport interface SearchFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\"> {\n size?: FieldSize;\n isDisabled?: boolean;\n /** Fired by the clear button and by Escape. */\n onClear?: () => void;\n}\n\n/** A filter over a collection. Carries the glyph, and clears without a Save. */\nexport const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n size = \"md\",\n isDisabled = false,\n onClear,\n className,\n placeholder = \"Search\",\n value,\n disabled,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const hasValue = value !== undefined ? String(value).length > 0 : false;\n\n return (\n <FieldAffix\n className={className}\n lead={<Icon name=\"search\" size={16} />}\n isTrailInteractive\n trail={\n hasValue && onClear ? (\n <button\n type=\"button\"\n className=\"ds-search__clear\"\n aria-label=\"Clear search\"\n disabled={isDisabled || disabled}\n onClick={() => {\n onClear();\n inner.current?.focus();\n }}\n >\n <Icon name=\"x\" size={16} />\n </button>\n ) : undefined\n }\n >\n <input\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"search\"\n value={value}\n placeholder={placeholder}\n disabled={isDisabled || disabled}\n data-size={size}\n className=\"ds-field-skin ds-search__input\"\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && onClear) onClear();\n onKeyDown?.(event);\n }}\n {...rest}\n />\n </FieldAffix>\n );\n});\n"],"mappings":";;;;;;AAgBA,IAAaC,IAAcC,EAA+C,SACxE,EACE,UAAO,MACP,gBAAa,IACb,YACA,cACA,iBAAc,UACd,UACA,aACA,cACA,GAAGC,KAEL,GACA;CACA,IAAMC,IAAQC,EAAgC,IAAI,GAC5CC,IAAWC,MAAU,KAAA,KAAY,OAAOA,CAAK,CAAC,CAAC,SAAS;CAE9D,OACE,kBAACC,GAAD;EACa;EACX,MAAM,kBAACR,GAAD;GAAM,MAAK;GAAS,MAAM;EAAK,CAAA;EACrC,oBAAA;EACA,OACEM,KAAYG,IACV,kBAAC,UAAD;GACE,MAAK;GACL,WAAU;GACV,cAAW;GACX,UAAUC,KAAcC;GACxB,eAAe;IAEb,AADAF,EAAQ,GACRL,EAAM,SAAS,MAAM;GACvB;GAEA,UAAA,kBAACJ,GAAD;IAAM,MAAK;IAAI,MAAM;GAAK,CAAA;EACpB,CAAA,IACN,KAAA;EAGN,UAAA,kBAAC,SAAD;GACE,MAAM,MAAS;IAEb,AADA,EAAM,UAAUY,GACZ,OAAOC,KAAQ,aAAYA,EAAID,CAAI,IAC9BC,MAAK,EAAI,UAAUD;GAC9B;GACA,MAAK;GACE;GACM;GACb,UAAUF,KAAcC;GACxB,aAAWG;GACX,WAAU;GACV,YAAY,MAAU;IAEpB,AADIC,EAAM,QAAQ,YAAYN,KAASA,EAAQ,GAC/CO,IAAYD,CAAK;GACnB;GACA,GAAIZ;EACL,CAAA;CACS,CAAA;AAEhB,CAAC"}
1
+ {"version":3,"file":"index.js","names":["Icon","SearchField","forwardRef","rest","inner","useRef","hasValue","value","FieldAffix","onClear","Button","isDisabled","disabled","node","ref","size","event","onKeyDown"],"sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport interface SearchFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\"> {\n size?: FieldSize;\n isDisabled?: boolean;\n /** Fired by the clear button and by Escape. */\n onClear?: () => void;\n}\n\n/** A filter over a collection. Carries the glyph, and clears without a Save. */\nexport const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n size = \"md\",\n isDisabled = false,\n onClear,\n className,\n placeholder = \"Search\",\n value,\n disabled,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const hasValue = value !== undefined ? String(value).length > 0 : false;\n\n return (\n <FieldAffix\n className={className}\n lead={<Icon name=\"search\" size={16} />}\n isTrailInteractive\n trail={\n hasValue && onClear ? (\n <Button\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n iconStart=\"x\"\n aria-label=\"Clear search\"\n isDisabled={isDisabled || disabled}\n onClick={() => {\n onClear();\n inner.current?.focus();\n }}\n />\n ) : undefined\n }\n >\n <input\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"search\"\n value={value}\n placeholder={placeholder}\n disabled={isDisabled || disabled}\n data-size={size}\n className=\"ds-field-skin ds-search__input\"\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && onClear) onClear();\n onKeyDown?.(event);\n }}\n {...rest}\n />\n </FieldAffix>\n );\n});\n"],"mappings":";;;;;;;AAiBA,IAAaC,IAAcC,EAA+C,SACxE,EACE,UAAO,MACP,gBAAa,IACb,YACA,cACA,iBAAc,UACd,UACA,aACA,cACA,GAAGC,KAEL,GACA;CACA,IAAMC,IAAQC,EAAgC,IAAI,GAC5CC,IAAWC,MAAU,KAAA,KAAY,OAAOA,CAAK,CAAC,CAAC,SAAS;CAE9D,OACE,kBAACC,GAAD;EACa;EACX,MAAM,kBAACR,GAAD;GAAM,MAAK;GAAS,MAAM;EAAK,CAAA;EACrC,oBAAA;EACA,OACEM,KAAYG,IACV,kBAACC,GAAD;GACE,SAAQ;GACR,MAAK;GACL,YAAA;GACA,WAAU;GACV,cAAW;GACX,YAAYC,KAAcC;GAC1B,eAAe;IAEb,AADAH,EAAQ,GACRL,EAAM,SAAS,MAAM;GACvB;EACD,CAAA,IACC,KAAA;EAGN,UAAA,kBAAC,SAAD;GACE,MAAM,MAAS;IAEb,AADA,EAAM,UAAUS,GACZ,OAAOC,KAAQ,aAAYA,EAAID,CAAI,IAC9BC,MAAK,EAAI,UAAUD;GAC9B;GACA,MAAK;GACE;GACM;GACb,UAAUF,KAAcC;GACxB,aAAWG;GACX,WAAU;GACV,YAAY,MAAU;IAEpB,AADIC,EAAM,QAAQ,YAAYP,KAASA,EAAQ,GAC/CQ,IAAYD,CAAK;GACnB;GACA,GAAIb;EACL,CAAA;CACS,CAAA;AAEhB,CAAC"}
@@ -3,25 +3,4 @@
3
3
  appearance: none;
4
4
  }
5
5
 
6
- .ds-search__clear {
7
- display: grid;
8
- place-items: center;
9
- inline-size: var(--space-6);
10
- block-size: var(--space-6);
11
- border: none;
12
- border-radius: var(--radius-sm);
13
- background: transparent;
14
- color: var(--color-text-muted);
15
- cursor: pointer;
16
- }
17
-
18
- .ds-search__clear:hover {
19
- background: var(--field-hover);
20
- color: var(--color-text);
21
- }
22
-
23
- .ds-search__clear:focus-visible {
24
- outline: var(--control-border-width) solid var(--color-focus);
25
- outline-offset: 2px;
26
- }
27
6
  }
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs");;/* empty css */const t=require("../Popover/index.cjs");let n=require("react"),r=require("react/jsx-runtime");function i(...e){return e.filter(Boolean).join(` `)}var a=(0,n.forwardRef)(function({options:a,value:o,defaultValue:s,onValueChange:c,placeholder:l=`Select an option`,size:u=`md`,isDisabled:d=!1,isInvalid:f=!1,menuPlacement:p=`bottom`,className:m,disabled:h,onClick:g,onKeyDown:_,...v},y){let[b,x]=(0,n.useState)(s??``),S=o??b,[C,w]=(0,n.useState)(!1),[T,E]=(0,n.useState)(0),D=(0,n.useRef)(null),O=(0,n.useRef)(null),k=(0,n.useRef)(null),A=(0,n.useId)(),j=d||h,M=C&&!j,N=a.find(e=>e.value===S),P=a.filter(e=>!e.isDisabled),F=(0,n.useCallback)(e=>{o===void 0&&x(e),c?.(e),w(!1)},[c,o]);(0,n.useEffect)(()=>{if(!M)return;let e=a.findIndex(e=>e.value===S&&!e.isDisabled);E(e<0?a.indexOf(P[0]):e);let t=e=>{let t=e.target;!D.current?.contains(t)&&!k.current?.contains(t)&&w(!1)};return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[M]),(0,n.useEffect)(()=>{M&&(k.current?.querySelectorAll(`[role='option']`)[T])?.scrollIntoView({block:`nearest`})},[T,M]);let I=e=>{let t=a.map((e,t)=>({option:e,index:t})).filter(e=>!e.option.isDisabled);if(t.length===0)return;let n=t[(t.findIndex(e=>e.index===T)+e+t.length)%t.length];E(n.index)},L=e=>{if(!j){if(e.key===`Escape`)w(!1),O.current?.focus();else if(!M&&(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `))e.preventDefault(),w(!0);else if(M){if(e.key===`Tab`)w(!1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),I(e.key===`ArrowDown`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=e.key===`Home`?P[0]:P[P.length-1];t&&E(a.indexOf(t))}else if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=a[T];t&&!t.isDisabled&&F(t.value)}}}};return(0,r.jsxs)(`div`,{className:`ds-select-root`,ref:D,children:[(0,r.jsxs)(`button`,{ref:e=>{O.current=e,typeof y==`function`?y(e):y&&(y.current=e)},type:`button`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":M,"aria-controls":M?A:void 0,"aria-activedescendant":M&&a[T]&&!a[T].isDisabled?`${A}-option-${T}`:void 0,"aria-invalid":f||void 0,disabled:j,"data-size":u,"data-placeholder":N?void 0:``,className:i(`ds-field-skin`,`ds-select`,m),onClick:e=>{g?.(e),e.defaultPrevented||w(e=>!e)},onKeyDown:e=>{_?.(e),e.defaultPrevented||L(e)},...v,children:[(0,r.jsx)(`span`,{className:`ds-select__value`,children:N?N.label:l}),(0,r.jsx)(e.t,{name:`chevron-down`,size:16,className:`ds-select__chevron`})]}),(0,r.jsx)(t.Popover,{anchorRef:O,isOpen:M,placement:p,matchAnchorWidth:!0,panelRef:k,id:A,role:`listbox`,"aria-label":v[`aria-labelledby`]?void 0:v[`aria-label`]??l,"aria-labelledby":v[`aria-labelledby`],className:`ds-surface-raised ds-select__menu`,children:(0,r.jsx)(`div`,{onKeyDown:L,children:a.map((t,n)=>(0,r.jsxs)(`div`,{id:`${A}-option-${n}`,role:`option`,"aria-selected":t.value===S,"aria-disabled":t.isDisabled||void 0,"data-active":n===T||void 0,className:`ds-select__option`,onMouseEnter:()=>!t.isDisabled&&E(n),onClick:()=>{t.isDisabled||(F(t.value),O.current?.focus())},children:[(0,r.jsxs)(`span`,{className:`ds-select__option-body`,children:[(0,r.jsx)(`span`,{className:`ds-select__option-label`,children:t.label}),t.description&&(0,r.jsx)(`span`,{className:`ds-select__option-description`,children:t.description})]}),t.value===S&&(0,r.jsx)(e.t,{name:`check`,size:16})]},t.value))})})]})});exports.Select=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs"),t=require("../Button/index.cjs");;/* empty css */const n=require("../Popover/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a(...e){return e.filter(Boolean).join(` `)}var o=(0,r.forwardRef)(function({options:o,value:s,defaultValue:c,onValueChange:l,placeholder:u=`Select an option`,size:d=`md`,isDisabled:f=!1,isInvalid:p=!1,menuPlacement:m=`bottom`,className:h,disabled:g,onClick:_,onKeyDown:v,...y},b){let[x,S]=(0,r.useState)(c??``),C=s??x,[w,T]=(0,r.useState)(!1),[E,D]=(0,r.useState)(0),O=(0,r.useRef)(null),k=(0,r.useRef)(null),A=(0,r.useRef)(null),j=(0,r.useId)(),M=f||g,N=w&&!M,P=o.find(e=>e.value===C),F=o.filter(e=>!e.isDisabled),I=(0,r.useCallback)(e=>{s===void 0&&S(e),l?.(e),T(!1)},[l,s]);(0,r.useEffect)(()=>{if(!N)return;let e=o.findIndex(e=>e.value===C&&!e.isDisabled);D(e<0?o.indexOf(F[0]):e);let t=e=>{let t=e.target;!O.current?.contains(t)&&!A.current?.contains(t)&&T(!1)};return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[N]),(0,r.useEffect)(()=>{N&&(A.current?.querySelectorAll(`[role='option']`)[E])?.scrollIntoView({block:`nearest`})},[E,N]);let L=e=>{let t=o.map((e,t)=>({option:e,index:t})).filter(e=>!e.option.isDisabled);if(t.length===0)return;let n=t[(t.findIndex(e=>e.index===E)+e+t.length)%t.length];D(n.index)},R=e=>{if(!M){if(e.key===`Escape`){if(!N)return;e.preventDefault(),T(!1),k.current?.focus()}else if(!N&&(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `))e.preventDefault(),T(!0);else if(N){if(e.key===`Tab`)T(!1);else if(e.key===`ArrowDown`||e.key===`ArrowUp`)e.preventDefault(),L(e.key===`ArrowDown`?1:-1);else if(e.key===`Home`||e.key===`End`){e.preventDefault();let t=e.key===`Home`?F[0]:F[F.length-1];t&&D(o.indexOf(t))}else if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=o[E];t&&!t.isDisabled&&I(t.value)}}}};return(0,i.jsxs)(`div`,{className:`ds-select-root`,ref:O,children:[(0,i.jsxs)(t.Button,{ref:e=>{k.current=e,typeof b==`function`?b(e):b&&(b.current=e)},size:d,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":N,"aria-controls":N?j:void 0,"aria-activedescendant":N&&o[E]&&!o[E].isDisabled?`${j}-option-${E}`:void 0,"aria-invalid":p||void 0,isDisabled:M,"data-placeholder":P?void 0:``,className:a(`ds-field-skin`,`ds-select`,h),onClick:e=>{_?.(e),e.defaultPrevented||T(e=>!e)},onKeyDown:e=>{v?.(e),e.defaultPrevented||R(e)},...y,children:[(0,i.jsx)(`span`,{className:`ds-select__value`,children:P?P.label:u}),(0,i.jsx)(e.t,{name:`chevron-down`,size:16,className:`ds-select__chevron`})]}),(0,i.jsx)(n.Popover,{anchorRef:k,isOpen:N,placement:m,matchAnchorWidth:!0,panelRef:A,id:j,role:`listbox`,"aria-label":y[`aria-labelledby`]?void 0:y[`aria-label`]??u,"aria-labelledby":y[`aria-labelledby`],className:`ds-surface-raised ds-select__menu`,children:(0,i.jsx)(`div`,{onKeyDown:R,onPointerDown:e=>e.preventDefault(),children:o.map((n,r)=>(0,i.jsxs)(t.Button,{variant:r===E?`active`:`simple`,size:`sm`,isDisabled:n.isDisabled,tabIndex:-1,id:`${j}-option-${r}`,role:`option`,"aria-selected":n.value===C,"aria-disabled":n.isDisabled||void 0,"data-active":r===E||void 0,className:`ds-select__option`,onMouseEnter:()=>!n.isDisabled&&D(r),onClick:()=>{n.isDisabled||(I(n.value),k.current?.focus())},children:[(0,i.jsxs)(`span`,{className:`ds-select__option-body`,children:[(0,i.jsx)(`span`,{className:`ds-select__option-label`,children:n.label}),n.description&&(0,i.jsx)(`span`,{className:`ds-select__option-description`,children:n.description})]}),n.value===C&&(0,i.jsx)(e.t,{name:`check`,size:16})]},n.value))})})]})});exports.Select=o;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["forwardRef","useState","useRef","useId","useCallback","Icon","Popover","require_Icon","require_components_Popover_index","react","react_jsx_runtime","cx","parts","Select","rest","internal","setInternal","defaultValue","current","value","isOpen","setOpen","activeIndex","setActiveIndex","rootRef","triggerRef","listRef","listId","effectiveDisabled","isDisabled","disabled","isVisible","selected","options","option","enabled","commit","next","onValueChange","index","onPointerDown","target","event","step","order","o","delta","handleKeyDown","pick","node","ref","isInvalid","size","className","onClick","open","onKeyDown","placeholder","menuPlacement"],"sources":["../../../src/components/Select/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface SelectOption {\n value: string;\n label: string;\n /** Secondary line under the label. */\n description?: string;\n isDisabled?: boolean;\n}\n\nexport interface SelectProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"value\" | \"defaultValue\" | \"onChange\"> {\n options: SelectOption[];\n /** Controlled value. Leave undefined to let the select hold its own. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n placeholder?: string;\n size?: FieldSize;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Preferred side of the menu; flips when space requires it. */\n menuPlacement?: PopoverPlacement;\n}\n\n/**\n * One value out of a known list. Wears the field skin, opens a listbox: arrows\n * walk the options, Enter commits, Escape closes without changing anything.\n */\nexport const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n options,\n value,\n defaultValue,\n onValueChange,\n placeholder = \"Select an option\",\n size = \"md\",\n isDisabled = false,\n isInvalid = false,\n menuPlacement = \"bottom\",\n className,\n disabled,\n onClick,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState(defaultValue ?? \"\");\n const current = value ?? internal;\n const [isOpen, setOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(0);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const listRef = useRef<HTMLDivElement | null>(null);\n const listId = useId();\n const effectiveDisabled = isDisabled || disabled;\n const isVisible = isOpen && !effectiveDisabled;\n\n const selected = options.find((option) => option.value === current);\n const enabled = options.filter((option) => !option.isDisabled);\n\n const commit = useCallback(\n (next: string) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n setOpen(false);\n },\n [onValueChange, value],\n );\n\n useEffect(() => {\n if (!isVisible) return;\n const index = options.findIndex((option) => option.value === current && !option.isDisabled);\n setActiveIndex(index < 0 ? options.indexOf(enabled[0]!) : index);\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !listRef.current?.contains(target)) setOpen(false);\n };\n document.addEventListener(\"mousedown\", onPointerDown);\n return () => document.removeEventListener(\"mousedown\", onPointerDown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isVisible]);\n\n useEffect(() => {\n if (!isVisible) return;\n const activeOption = listRef.current?.querySelectorAll<HTMLElement>(\"[role='option']\")[activeIndex];\n activeOption?.scrollIntoView({ block: \"nearest\" });\n }, [activeIndex, isVisible]);\n\n const step = (delta: number) => {\n const order = options.map((option, index) => ({ option, index })).filter((o) => !o.option.isDisabled);\n if (order.length === 0) return;\n const at = order.findIndex((o) => o.index === activeIndex);\n const next = order[(at + delta + order.length) % order.length]!;\n setActiveIndex(next.index);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (effectiveDisabled) return;\n if (event.key === \"Escape\") {\n setOpen(false);\n triggerRef.current?.focus();\n return;\n }\n if (!isVisible && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\" || event.key === \"Enter\" || event.key === \" \")) {\n event.preventDefault();\n setOpen(true);\n return;\n }\n if (!isVisible) return;\n if (event.key === \"Tab\") {\n setOpen(false);\n return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n step(event.key === \"ArrowDown\" ? 1 : -1);\n } else if (event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n const pick = event.key === \"Home\" ? enabled[0] : enabled[enabled.length - 1];\n if (pick) setActiveIndex(options.indexOf(pick));\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n const option = options[activeIndex];\n if (option && !option.isDisabled) commit(option.value);\n }\n };\n\n return (\n <div className=\"ds-select-root\" ref={rootRef}>\n <button\n ref={(node) => {\n triggerRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"button\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isVisible}\n aria-controls={isVisible ? listId : undefined}\n aria-activedescendant={isVisible && options[activeIndex] && !options[activeIndex].isDisabled ? `${listId}-option-${activeIndex}` : undefined}\n aria-invalid={isInvalid || undefined}\n disabled={effectiveDisabled}\n data-size={size}\n data-placeholder={selected ? undefined : \"\"}\n className={cx(\"ds-field-skin\", \"ds-select\", className)}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) setOpen((open) => !open);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented) handleKeyDown(event);\n }}\n {...rest}\n >\n <span className=\"ds-select__value\">{selected ? selected.label : placeholder}</span>\n <Icon name=\"chevron-down\" size={16} className=\"ds-select__chevron\" />\n </button>\n <Popover\n anchorRef={triggerRef}\n isOpen={isVisible}\n placement={menuPlacement}\n matchAnchorWidth\n panelRef={listRef}\n id={listId}\n role=\"listbox\"\n aria-label={rest[\"aria-labelledby\"] ? undefined : rest[\"aria-label\"] ?? placeholder}\n aria-labelledby={rest[\"aria-labelledby\"]}\n className=\"ds-surface-raised ds-select__menu\"\n >\n <div onKeyDown={handleKeyDown}>\n {options.map((option, index) => (\n <div\n key={option.value}\n id={`${listId}-option-${index}`}\n role=\"option\"\n aria-selected={option.value === current}\n aria-disabled={option.isDisabled || undefined}\n data-active={index === activeIndex || undefined}\n className=\"ds-select__option\"\n onMouseEnter={() => !option.isDisabled && setActiveIndex(index)}\n onClick={() => {\n if (!option.isDisabled) {\n commit(option.value);\n triggerRef.current?.focus();\n }\n }}\n >\n <span className=\"ds-select__option-body\">\n <span className=\"ds-select__option-label\">{option.label}</span>\n {option.description && (\n <span className=\"ds-select__option-description\">{option.description}</span>\n )}\n </span>\n {option.value === current && <Icon name=\"check\" size={16} />}\n </div>\n ))}\n </div>\n </Popover>\n </div>\n );\n});\n"],"mappings":"A,8PAeA,SAASW,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CA6BA,IAAaC,GAAA,EAASb,EAAAA,WAAAA,CAA2C,SAC/D,CACE,UACA,QACA,eACA,gBACA,cAAc,mBACd,OAAO,KACP,aAAa,GACb,YAAY,GACZ,gBAAgB,SAChB,YACA,WACA,UACA,YACA,GAAGc,GAEL,EACA,CACA,GAAM,CAACC,EAAUC,IAAA,EAAef,EAAAA,SAAAA,CAASgB,GAAgB,EAAE,EACrDC,EAAUC,GAASJ,EACnB,CAACK,EAAQC,IAAA,EAAWpB,EAAAA,SAAAA,CAAS,EAAK,EAClC,CAACqB,EAAaC,IAAA,EAAkBtB,EAAAA,SAAAA,CAAS,CAAC,EAC1CuB,GAAA,EAAUtB,EAAAA,OAAAA,CAA8B,IAAI,EAC5CuB,GAAA,EAAavB,EAAAA,OAAAA,CAAiC,IAAI,EAClDwB,GAAA,EAAUxB,EAAAA,OAAAA,CAA8B,IAAI,EAC5CyB,GAAA,EAASxB,E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MAAM,EAE9B,EAdF,SAAA,EAgBE,EAAAf,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,yBAAhB,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,0BAA2B,SAAAwB,EAAO,KAAY,CAAA,EAC7DA,EAAO,cACN,EAAAxB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,gCAAiC,SAAAwB,EAAO,WAAkB,CAAA,CAExE,CACL,CAAA,EAAAA,EAAO,QAAUhB,IAAW,EAAAR,EAAA,IAAA,CAACL,EAAAA,EAAD,CAAM,KAAK,QAAQ,KAAM,EAAK,CAAA,CACxD,CAtBE,EAAA6B,EAAO,KAsBT,CACN,CACE,CAAA,CACE,CAAA,CACN,C,EAET,CAAC,E"}
1
+ {"version":3,"file":"index.cjs","names":["forwardRef","useState","useRef","useId","useCallback","Button","Icon","Popover","require_Icon","require_components_Button_index","require_components_Popover_index","react","react_jsx_runtime","cx","parts","Select","rest","internal","setInternal","defaultValue","current","value","isOpen","setOpen","activeIndex","setActiveIndex","rootRef","triggerRef","listRef","listId","effectiveDisabled","isDisabled","disabled","isVisible","selected","options","option","enabled","commit","next","onValueChange","index","onPointerDown","target","event","step","order","o","delta","handleKeyDown","pick","node","ref","isInvalid","className","onClick","open","onKeyDown","placeholder","menuPlacement"],"sources":["../../../src/components/Select/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n} from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface SelectOption {\n value: string;\n label: string;\n /** Secondary line under the label. */\n description?: string;\n isDisabled?: boolean;\n}\n\nexport interface SelectProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"value\" | \"defaultValue\" | \"onChange\"> {\n options: SelectOption[];\n /** Controlled value. Leave undefined to let the select hold its own. */\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n placeholder?: string;\n size?: FieldSize;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Preferred side of the menu; flips when space requires it. */\n menuPlacement?: PopoverPlacement;\n}\n\n/**\n * One value out of a known list. Wears the field skin, opens a listbox: arrows\n * walk the options, Enter commits, Escape closes without changing anything.\n */\nexport const Select = forwardRef<HTMLButtonElement, SelectProps>(function Select(\n {\n options,\n value,\n defaultValue,\n onValueChange,\n placeholder = \"Select an option\",\n size = \"md\",\n isDisabled = false,\n isInvalid = false,\n menuPlacement = \"bottom\",\n className,\n disabled,\n onClick,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState(defaultValue ?? \"\");\n const current = value ?? internal;\n const [isOpen, setOpen] = useState(false);\n const [activeIndex, setActiveIndex] = useState(0);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const listRef = useRef<HTMLDivElement | null>(null);\n const listId = useId();\n const effectiveDisabled = isDisabled || disabled;\n const isVisible = isOpen && !effectiveDisabled;\n\n const selected = options.find((option) => option.value === current);\n const enabled = options.filter((option) => !option.isDisabled);\n\n const commit = useCallback(\n (next: string) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n setOpen(false);\n },\n [onValueChange, value],\n );\n\n useEffect(() => {\n if (!isVisible) return;\n const index = options.findIndex((option) => option.value === current && !option.isDisabled);\n setActiveIndex(index < 0 ? options.indexOf(enabled[0]!) : index);\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !listRef.current?.contains(target)) setOpen(false);\n };\n document.addEventListener(\"mousedown\", onPointerDown);\n return () => document.removeEventListener(\"mousedown\", onPointerDown);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isVisible]);\n\n useEffect(() => {\n if (!isVisible) return;\n const activeOption = listRef.current?.querySelectorAll<HTMLElement>(\"[role='option']\")[activeIndex];\n activeOption?.scrollIntoView({ block: \"nearest\" });\n }, [activeIndex, isVisible]);\n\n const step = (delta: number) => {\n const order = options.map((option, index) => ({ option, index })).filter((o) => !o.option.isDisabled);\n if (order.length === 0) return;\n const at = order.findIndex((o) => o.index === activeIndex);\n const next = order[(at + delta + order.length) % order.length]!;\n setActiveIndex(next.index);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (effectiveDisabled) return;\n if (event.key === \"Escape\") {\n if (!isVisible) return;\n // Claims Escape so an enclosing Drawer stays open.\n event.preventDefault();\n setOpen(false);\n triggerRef.current?.focus();\n return;\n }\n if (!isVisible && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\" || event.key === \"Enter\" || event.key === \" \")) {\n event.preventDefault();\n setOpen(true);\n return;\n }\n if (!isVisible) return;\n if (event.key === \"Tab\") {\n setOpen(false);\n return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n step(event.key === \"ArrowDown\" ? 1 : -1);\n } else if (event.key === \"Home\" || event.key === \"End\") {\n event.preventDefault();\n const pick = event.key === \"Home\" ? enabled[0] : enabled[enabled.length - 1];\n if (pick) setActiveIndex(options.indexOf(pick));\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n const option = options[activeIndex];\n if (option && !option.isDisabled) commit(option.value);\n }\n };\n\n return (\n <div className=\"ds-select-root\" ref={rootRef}>\n <Button\n ref={(node) => {\n triggerRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n size={size}\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n aria-expanded={isVisible}\n aria-controls={isVisible ? listId : undefined}\n aria-activedescendant={isVisible && options[activeIndex] && !options[activeIndex].isDisabled ? `${listId}-option-${activeIndex}` : undefined}\n aria-invalid={isInvalid || undefined}\n isDisabled={effectiveDisabled}\n data-placeholder={selected ? undefined : \"\"}\n className={cx(\"ds-field-skin\", \"ds-select\", className)}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) setOpen((open) => !open);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented) handleKeyDown(event);\n }}\n {...rest}\n >\n <span className=\"ds-select__value\">{selected ? selected.label : placeholder}</span>\n <Icon name=\"chevron-down\" size={16} className=\"ds-select__chevron\" />\n </Button>\n <Popover\n anchorRef={triggerRef}\n isOpen={isVisible}\n placement={menuPlacement}\n matchAnchorWidth\n panelRef={listRef}\n id={listId}\n role=\"listbox\"\n aria-label={rest[\"aria-labelledby\"] ? undefined : rest[\"aria-label\"] ?? placeholder}\n aria-labelledby={rest[\"aria-labelledby\"]}\n className=\"ds-surface-raised ds-select__menu\"\n >\n <div onKeyDown={handleKeyDown} onPointerDown={(event) => event.preventDefault()}>\n {options.map((option, index) => (\n <Button\n key={option.value}\n variant={index === activeIndex ? \"active\" : \"simple\"}\n size=\"sm\"\n isDisabled={option.isDisabled}\n tabIndex={-1}\n id={`${listId}-option-${index}`}\n role=\"option\"\n aria-selected={option.value === current}\n aria-disabled={option.isDisabled || undefined}\n data-active={index === activeIndex || undefined}\n className=\"ds-select__option\"\n onMouseEnter={() => !option.isDisabled && setActiveIndex(index)}\n onClick={() => {\n if (!option.isDisabled) {\n commit(option.value);\n triggerRef.current?.focus();\n }\n }}\n >\n <span className=\"ds-select__option-body\">\n <span className=\"ds-select__option-label\">{option.label}</span>\n {option.description && (\n <span className=\"ds-select__option-description\">{option.description}</span>\n )}\n </span>\n {option.value === current && <Icon name=\"check\" size={16} />}\n </Button>\n ))}\n </div>\n </Popover>\n </div>\n );\n});\n"],"mappings":"A,+RAgBA,SAASa,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CA6BA,IAAaC,GAAA,EAASf,EAAAA,WAAAA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components/Select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AAEf,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AAMrB,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC;IAC5F,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gEAAgE;IAChE,aAAa,CAAC,EAAE,gBAAgB,CAAC;CAClC;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,2GA+KjB,CAAC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,oBAAoB,EAC1B,MAAM,OAAO,CAAC;AAGf,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AA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