@trellixio/roaster-react 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/CHANGELOG.md +383 -0
  2. package/LICENSE.md +38 -2
  3. package/README.md +10 -10
  4. package/cjs/components/ActionList/components/ActionListDropdown.js +6 -5
  5. package/cjs/components/ActionList/components/ActionListDropdown.js.map +1 -1
  6. package/cjs/components/ActionList/components/ActionListItem.js +9 -7
  7. package/cjs/components/ActionList/components/ActionListItem.js.map +1 -1
  8. package/cjs/components/ActionList/components/ActionListSearch.js +24 -6
  9. package/cjs/components/ActionList/components/ActionListSearch.js.map +1 -1
  10. package/cjs/components/ActionList/components/ActionListSubmenu.js +7 -5
  11. package/cjs/components/ActionList/components/ActionListSubmenu.js.map +1 -1
  12. package/cjs/components/ActionList/components/ActionListSwitchItem.js +6 -5
  13. package/cjs/components/ActionList/components/ActionListSwitchItem.js.map +1 -1
  14. package/cjs/components/Alert/Alert.js +3 -2
  15. package/cjs/components/Alert/Alert.js.map +1 -1
  16. package/cjs/components/AppFrame/AppFrame.js.map +1 -1
  17. package/cjs/components/Avatar/Avatar.js +1 -1
  18. package/cjs/components/Avatar/Avatar.js.map +1 -1
  19. package/cjs/components/Button/Button.js +3 -2
  20. package/cjs/components/Button/Button.js.map +1 -1
  21. package/cjs/components/ButtonIcon/ButtonIcon.js.map +1 -1
  22. package/cjs/components/Checkbox/Checkbox.js +4 -4
  23. package/cjs/components/Checkbox/Checkbox.js.map +1 -1
  24. package/cjs/components/ColorField/ColorField.js +42 -29
  25. package/cjs/components/ColorField/ColorField.js.map +1 -1
  26. package/cjs/components/DatePicker/DatePicker.js +2 -2
  27. package/cjs/components/DatePicker/DatePicker.js.map +1 -1
  28. package/cjs/components/DatePicker/components/Calendar/Calendar.js +4 -3
  29. package/cjs/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
  30. package/cjs/components/DropdownCard/components/DropdownCardDropdown.js +6 -5
  31. package/cjs/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
  32. package/cjs/components/DropdownCard/components/DropdownCardTabs.js +3 -2
  33. package/cjs/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
  34. package/cjs/components/Field/Field.js +26 -6
  35. package/cjs/components/Field/Field.js.map +1 -1
  36. package/cjs/components/FileField/FileField.js +47 -33
  37. package/cjs/components/FileField/FileField.js.map +1 -1
  38. package/cjs/components/Icon/Icon.js.map +1 -1
  39. package/cjs/components/Icon/RoasterIcon.js +12 -0
  40. package/cjs/components/Icon/RoasterIcon.js.map +1 -0
  41. package/cjs/components/IconBadge/IconBadge.js.map +1 -1
  42. package/cjs/components/Modal/Modal.js +3 -2
  43. package/cjs/components/Modal/Modal.js.map +1 -1
  44. package/cjs/components/Pagination/Pagination.js +4 -3
  45. package/cjs/components/Pagination/Pagination.js.map +1 -1
  46. package/cjs/components/RangeField/RangeField.js +34 -21
  47. package/cjs/components/RangeField/RangeField.js.map +1 -1
  48. package/cjs/components/Select/Select.js +8 -6
  49. package/cjs/components/Select/Select.js.map +1 -1
  50. package/cjs/components/Sidebar/Sidebar.js +4 -3
  51. package/cjs/components/Sidebar/Sidebar.js.map +1 -1
  52. package/cjs/components/Sidebar/components/Back.js +7 -3
  53. package/cjs/components/Sidebar/components/Back.js.map +1 -1
  54. package/cjs/components/StatCard/StatCard.js +3 -2
  55. package/cjs/components/StatCard/StatCard.js.map +1 -1
  56. package/cjs/components/Switch/Switch.js +7 -1
  57. package/cjs/components/Switch/Switch.js.map +1 -1
  58. package/cjs/components/Table/components/TableHeadCell.js +4 -3
  59. package/cjs/components/Table/components/TableHeadCell.js.map +1 -1
  60. package/cjs/components/Tag/Tag.js +3 -2
  61. package/cjs/components/Tag/Tag.js.map +1 -1
  62. package/cjs/components/TextField/TextField.js +3 -1
  63. package/cjs/components/TextField/TextField.js.map +1 -1
  64. package/cjs/components/Textarea/Textarea.js +36 -4
  65. package/cjs/components/Textarea/Textarea.js.map +1 -1
  66. package/cjs/components/Thumbnail/Thumbnail.js +3 -2
  67. package/cjs/components/Thumbnail/Thumbnail.js.map +1 -1
  68. package/cjs/components/Toast/Toast.js +3 -2
  69. package/cjs/components/Toast/Toast.js.map +1 -1
  70. package/cjs/components/Tooltip/Tooltip.js +6 -5
  71. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  72. package/cjs/components/Tooltip/TooltipCallout.js +3 -2
  73. package/cjs/components/Tooltip/TooltipCallout.js.map +1 -1
  74. package/cjs/components/Visualizer/Visualizer.js +4 -3
  75. package/cjs/components/Visualizer/Visualizer.js.map +1 -1
  76. package/cjs/utils/Slot/index.js +5 -5
  77. package/cjs/utils/Slot/index.js.map +1 -1
  78. package/cjs/utils/useDropdown/DropdownTrigger.js +4 -4
  79. package/cjs/utils/useDropdown/DropdownTrigger.js.map +1 -1
  80. package/cjs/utils/useMergeRefs/index.js +51 -0
  81. package/cjs/utils/useMergeRefs/index.js.map +1 -0
  82. package/esm/components/ActionList/components/ActionListDropdown.js +2 -1
  83. package/esm/components/ActionList/components/ActionListDropdown.js.map +1 -1
  84. package/esm/components/ActionList/components/ActionListItem.js +5 -3
  85. package/esm/components/ActionList/components/ActionListItem.js.map +1 -1
  86. package/esm/components/ActionList/components/ActionListSearch.js +21 -3
  87. package/esm/components/ActionList/components/ActionListSearch.js.map +1 -1
  88. package/esm/components/ActionList/components/ActionListSubmenu.js +5 -3
  89. package/esm/components/ActionList/components/ActionListSubmenu.js.map +1 -1
  90. package/esm/components/ActionList/components/ActionListSwitchItem.js +2 -1
  91. package/esm/components/ActionList/components/ActionListSwitchItem.js.map +1 -1
  92. package/esm/components/Alert/Alert.js +3 -2
  93. package/esm/components/Alert/Alert.js.map +1 -1
  94. package/esm/components/AppFrame/AppFrame.js.map +1 -1
  95. package/esm/components/Avatar/Avatar.js +1 -1
  96. package/esm/components/Avatar/Avatar.js.map +1 -1
  97. package/esm/components/Button/Button.js +3 -2
  98. package/esm/components/Button/Button.js.map +1 -1
  99. package/esm/components/ButtonIcon/ButtonIcon.js.map +1 -1
  100. package/esm/components/Checkbox/Checkbox.js +1 -1
  101. package/esm/components/Checkbox/Checkbox.js.map +1 -1
  102. package/esm/components/ColorField/ColorField.js +42 -29
  103. package/esm/components/ColorField/ColorField.js.map +1 -1
  104. package/esm/components/DatePicker/DatePicker.js +1 -1
  105. package/esm/components/DatePicker/DatePicker.js.map +1 -1
  106. package/esm/components/DatePicker/components/Calendar/Calendar.js +4 -3
  107. package/esm/components/DatePicker/components/Calendar/Calendar.js.map +1 -1
  108. package/esm/components/DropdownCard/components/DropdownCardDropdown.js +2 -1
  109. package/esm/components/DropdownCard/components/DropdownCardDropdown.js.map +1 -1
  110. package/esm/components/DropdownCard/components/DropdownCardTabs.js +3 -2
  111. package/esm/components/DropdownCard/components/DropdownCardTabs.js.map +1 -1
  112. package/esm/components/Field/Field.js +26 -6
  113. package/esm/components/Field/Field.js.map +1 -1
  114. package/esm/components/FileField/FileField.js +47 -33
  115. package/esm/components/FileField/FileField.js.map +1 -1
  116. package/esm/components/Icon/Icon.js.map +1 -1
  117. package/esm/components/Icon/RoasterIcon.js +10 -0
  118. package/esm/components/Icon/RoasterIcon.js.map +1 -0
  119. package/esm/components/IconBadge/IconBadge.js.map +1 -1
  120. package/esm/components/Modal/Modal.js +3 -2
  121. package/esm/components/Modal/Modal.js.map +1 -1
  122. package/esm/components/Pagination/Pagination.js +4 -3
  123. package/esm/components/Pagination/Pagination.js.map +1 -1
  124. package/esm/components/RangeField/RangeField.js +34 -21
  125. package/esm/components/RangeField/RangeField.js.map +1 -1
  126. package/esm/components/Select/Select.js +4 -2
  127. package/esm/components/Select/Select.js.map +1 -1
  128. package/esm/components/Sidebar/Sidebar.js +4 -3
  129. package/esm/components/Sidebar/Sidebar.js.map +1 -1
  130. package/esm/components/Sidebar/components/Back.js +7 -3
  131. package/esm/components/Sidebar/components/Back.js.map +1 -1
  132. package/esm/components/StatCard/StatCard.js +3 -2
  133. package/esm/components/StatCard/StatCard.js.map +1 -1
  134. package/esm/components/Switch/Switch.js +7 -1
  135. package/esm/components/Switch/Switch.js.map +1 -1
  136. package/esm/components/Table/components/TableHeadCell.js +4 -3
  137. package/esm/components/Table/components/TableHeadCell.js.map +1 -1
  138. package/esm/components/Tag/Tag.js +3 -2
  139. package/esm/components/Tag/Tag.js.map +1 -1
  140. package/esm/components/TextField/TextField.js +3 -1
  141. package/esm/components/TextField/TextField.js.map +1 -1
  142. package/esm/components/Textarea/Textarea.js +38 -6
  143. package/esm/components/Textarea/Textarea.js.map +1 -1
  144. package/esm/components/Thumbnail/Thumbnail.js +3 -2
  145. package/esm/components/Thumbnail/Thumbnail.js.map +1 -1
  146. package/esm/components/Toast/Toast.js +3 -2
  147. package/esm/components/Toast/Toast.js.map +1 -1
  148. package/esm/components/Tooltip/Tooltip.js +2 -1
  149. package/esm/components/Tooltip/Tooltip.js.map +1 -1
  150. package/esm/components/Tooltip/TooltipCallout.js +3 -2
  151. package/esm/components/Tooltip/TooltipCallout.js.map +1 -1
  152. package/esm/components/Visualizer/Visualizer.js +4 -3
  153. package/esm/components/Visualizer/Visualizer.js.map +1 -1
  154. package/esm/package.json +4 -1
  155. package/esm/utils/Slot/index.js +1 -1
  156. package/esm/utils/Slot/index.js.map +1 -1
  157. package/esm/utils/useDropdown/DropdownTrigger.js +1 -1
  158. package/esm/utils/useDropdown/DropdownTrigger.js.map +1 -1
  159. package/esm/utils/useMergeRefs/index.js +36 -0
  160. package/esm/utils/useMergeRefs/index.js.map +1 -0
  161. package/lib/components/ActionList/components/ActionListItem.d.ts +4 -1
  162. package/lib/components/ActionList/components/ActionListItem.d.ts.map +1 -1
  163. package/lib/components/ActionList/components/ActionListSearch.d.ts.map +1 -1
  164. package/lib/components/ActionList/components/ActionListSubmenu.d.ts.map +1 -1
  165. package/lib/components/AppFrame/AppFrame.d.ts +5 -1
  166. package/lib/components/AppFrame/AppFrame.d.ts.map +1 -1
  167. package/lib/components/Avatar/Avatar.d.ts +4 -1
  168. package/lib/components/Avatar/Avatar.d.ts.map +1 -1
  169. package/lib/components/ButtonIcon/ButtonIcon.d.ts +1 -1
  170. package/lib/components/ButtonIcon/ButtonIcon.d.ts.map +1 -1
  171. package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  172. package/lib/components/ColorField/ColorField.d.ts.map +1 -1
  173. package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
  174. package/lib/components/DatePicker/utils/index.d.ts +2 -1
  175. package/lib/components/DatePicker/utils/index.d.ts.map +1 -1
  176. package/lib/components/Field/Field.d.ts +13 -7
  177. package/lib/components/Field/Field.d.ts.map +1 -1
  178. package/lib/components/FileField/FileField.d.ts.map +1 -1
  179. package/lib/components/Icon/Icon.d.ts +13 -2
  180. package/lib/components/Icon/Icon.d.ts.map +1 -1
  181. package/lib/components/Icon/RoasterIcon.d.ts +13 -0
  182. package/lib/components/Icon/RoasterIcon.d.ts.map +1 -0
  183. package/lib/components/Icon/index.d.ts +2 -0
  184. package/lib/components/Icon/index.d.ts.map +1 -1
  185. package/lib/components/IconBadge/IconBadge.d.ts +2 -2
  186. package/lib/components/RangeField/RangeField.d.ts.map +1 -1
  187. package/lib/components/Select/Select.d.ts.map +1 -1
  188. package/lib/components/Sidebar/components/Back.d.ts.map +1 -1
  189. package/lib/components/Switch/Switch.d.ts.map +1 -1
  190. package/lib/components/TextField/TextField.d.ts.map +1 -1
  191. package/lib/components/Textarea/Textarea.d.ts +6 -1
  192. package/lib/components/Textarea/Textarea.d.ts.map +1 -1
  193. package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
  194. package/lib/utils/Slot/index.d.ts.map +1 -1
  195. package/lib/utils/index.d.ts +1 -0
  196. package/lib/utils/index.d.ts.map +1 -1
  197. package/lib/utils/useDropdown/DropdownTrigger.d.ts.map +1 -1
  198. package/lib/utils/useMergeRefs/index.d.ts +11 -0
  199. package/lib/utils/useMergeRefs/index.d.ts.map +1 -0
  200. package/package.json +2 -2
  201. package/roaster.css +2 -1
  202. package/themes/azoth.css +1 -1
  203. package/themes/coffee.css +1 -1
  204. package/themes/scalar.css +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ActionListSwitchItem.js","sources":["../../../../../src/components/ActionList/components/ActionListSwitchItem.tsx"],"sourcesContent":["import { useListItem, useMergeRefs } from '@floating-ui/react';\nimport * as React from 'react';\nimport { classNames, useControllableState } from '@/utils';\nimport { useActionListContext } from '../ActionList.context';\n\n/**\n * Every native `<input>` prop (`name`, `aria-*`, ...) is accepted and forwarded to the switch, with the ref.\n * `className` and `style` go to the item.\n */\nexport interface ActionListSwitchItemProps extends Omit<\n React.ComponentPropsWithoutRef<'input'>,\n 'type' | 'children' | 'role'\n> {\n /** The setting's name, with an optional icon before it. */\n children: React.ReactNode;\n /** Called with the new state when the user turns the setting on or off. */\n onCheckedChange?(checked: boolean): void;\n}\n\n/**\n * An on/off setting in the menu (`role=\"menuitemcheckbox\"`), drawn as a switch at the item's end, such as showing a\n * chart. Turning it on or off leaves the menu open.\n */\nexport const ActionListSwitchItem = React.forwardRef<HTMLInputElement, ActionListSwitchItemProps>(\n ({ children, checked, defaultChecked, onChange, onCheckedChange, className, style, ...rest }, propRef) => {\n const context = useActionListContext();\n const item = useListItem();\n const ref = useMergeRefs([item.ref, propRef]);\n const [on, setOn] = useControllableState({\n value: checked,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n\n return (\n <label className={classNames('roaster-action-list__item', className)} style={style}>\n {children}\n <span className=\"roaster-switch\">\n <input\n {...context.getItemProps({\n ...rest,\n onChange(event: React.ChangeEvent<HTMLInputElement>) {\n onChange?.(event);\n setOn(event.target.checked);\n },\n })}\n ref={ref}\n type=\"checkbox\"\n role=\"menuitemcheckbox\"\n checked={on}\n aria-checked={on}\n tabIndex={context.activeIndex === item.index ? 0 : -1}\n className=\"roaster-switch__input\"\n />\n <span className=\"roaster-switch__track\" />\n </span>\n </label>\n );\n }\n);\nActionListSwitchItem.displayName = 'ActionListSwitchItem';\n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,EAAE,EAAE;AAC9B,YAAY,QAAQ,EAAE,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,EAAE;AACjE,YAAY,SAAS,EAAE;AACvB;AACA,SAAS;AACT,wBAAwB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE;AAC1E,OAAO,EAAE;AACT,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,oBAAoB,CAAC,WAAW,GAAG,sBAAsB;;"}
1
+ {"version":3,"file":"ActionListSwitchItem.js","sources":["../../../../../src/components/ActionList/components/ActionListSwitchItem.tsx"],"sourcesContent":["import { useListItem } from '@floating-ui/react';\nimport * as React from 'react';\nimport { classNames, useControllableState, useMergeRefs } from '@/utils';\nimport { useActionListContext } from '../ActionList.context';\n\n/**\n * Every native `<input>` prop (`name`, `aria-*`, ...) is accepted and forwarded to the switch, with the ref.\n * `className` and `style` go to the item.\n */\nexport interface ActionListSwitchItemProps extends Omit<\n React.ComponentPropsWithoutRef<'input'>,\n 'type' | 'children' | 'role'\n> {\n /** The setting's name, with an optional icon before it. */\n children: React.ReactNode;\n /** Called with the new state when the user turns the setting on or off. */\n onCheckedChange?(checked: boolean): void;\n}\n\n/**\n * An on/off setting in the menu (`role=\"menuitemcheckbox\"`), drawn as a switch at the item's end, such as showing a\n * chart. Turning it on or off leaves the menu open.\n */\nexport const ActionListSwitchItem = React.forwardRef<HTMLInputElement, ActionListSwitchItemProps>(\n ({ children, checked, defaultChecked, onChange, onCheckedChange, className, style, ...rest }, propRef) => {\n const context = useActionListContext();\n const item = useListItem();\n const ref = useMergeRefs([item.ref, propRef]);\n const [on, setOn] = useControllableState({\n value: checked,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n\n return (\n <label className={classNames('roaster-action-list__item', className)} style={style}>\n {children}\n <span className=\"roaster-switch\">\n <input\n {...context.getItemProps({\n ...rest,\n onChange(event: React.ChangeEvent<HTMLInputElement>) {\n onChange?.(event);\n setOn(event.target.checked);\n },\n })}\n ref={ref}\n type=\"checkbox\"\n role=\"menuitemcheckbox\"\n checked={on}\n aria-checked={on}\n tabIndex={context.activeIndex === item.index ? 0 : -1}\n className=\"roaster-switch__input\"\n />\n <span className=\"roaster-switch__track\" />\n </span>\n </label>\n );\n }\n);\nActionListSwitchItem.displayName = 'ActionListSwitchItem';\n"],"names":[],"mappings":";;;;;;;;;AAMY,MAAC,oBAAoB,GAAG,KAAK,CAAC,UAAU;AACpD,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,OAAO,KAAK;AAC5G,IAAI,MAAM,OAAO,GAAG,oBAAoB,EAAE;AAC1C,IAAI,MAAM,IAAI,GAAG,WAAW,EAAE;AAC9B,IAAI,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AACjD,IAAI,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,oBAAoB,CAAC;AAC7C,MAAM,KAAK,EAAE,OAAO;AACpB,MAAM,YAAY,EAAE,cAAc,IAAI,KAAK;AAC3C,MAAM,QAAQ,EAAE;AAChB,KAAK,CAAC;AACN,IAAI,uBAAuB,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,2BAA2B,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE;AAC3H,MAAM,QAAQ;AACd,sBAAsB,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE;AAC5E,wBAAwB,GAAG;AAC3B,UAAU,OAAO;AACjB,UAAU;AACV,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AACpC,cAAc,GAAG,IAAI;AACrB,cAAc,QAAQ,CAAC,KAAK,EAAE;AAC9B,gBAAgB,QAAQ,GAAG,KAAK,CAAC;AACjC,gBAAgB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;AAC3C,cAAc;AACd,aAAa,CAAC;AACd,YAAY,GAAG;AACf,YAAY,IAAI,EAAE,UAAU;AAC5B,YAAY,IAAI,EAAE,kBAAkB;AACpC,YAAY,OAAO,EAAE,EAAE;AACvB,YAAY,cAAc,EAAE,EAAE;AAC9B,YAAY,QAAQ,EAAE,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,EAAE;AACjE,YAAY,SAAS,EAAE;AACvB;AACA,SAAS;AACT,wBAAwB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE;AAC1E,OAAO,EAAE;AACT,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,oBAAoB,CAAC,WAAW,GAAG,sBAAsB;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { ButtonIcon } from '../ButtonIcon/ButtonIcon.js';
5
- import { Icon } from '../Icon/Icon.js';
5
+ import '../Icon/Icon.js';
6
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
6
7
  import { classNames } from '../../utils/classNames/index.js';
7
8
 
8
9
  const defaultAlertLabels = { close: "Close" };
@@ -19,7 +20,7 @@ const Alert = React.forwardRef((props, ref) => {
19
20
  children: [
20
21
  icon && /* @__PURE__ */ jsx("span", { className: "roaster-alert__icon", children: icon }),
21
22
  /* @__PURE__ */ jsx("div", { className: "roaster-alert__content", children }),
22
- closable && /* @__PURE__ */ jsx(ButtonIcon, { className: "roaster-alert__close", "aria-label": text.close, onClick: onClose, children: /* @__PURE__ */ jsx(Icon, { name: "xmark" }) })
23
+ closable && /* @__PURE__ */ jsx(ButtonIcon, { className: "roaster-alert__close", "aria-label": text.close, onClick: onClose, children: /* @__PURE__ */ jsx(RoasterIcon, { name: "x" }) })
23
24
  ]
24
25
  }
25
26
  );
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Icon } from '@/components/Icon';\n\n/** The tones of an alert: its color, icon, and how urgently screen readers announce it. */\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger' | 'primary';\n\n/** The text of the alert, for other languages. */\nexport interface AlertLabels {\n /** The name of the close button, read by screen readers. */\n close: string;\n}\n\nconst defaultAlertLabels: AlertLabels = { close: 'Close' };\n\n/** Every native `<div>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface AlertProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The message: text, links, or blocks such as a list. */\n children: React.ReactNode;\n /**\n * The tone. `danger` and `warning` are announced at once (`role=\"alert\"`), `info`, `success` and `primary`\n * politely (`role=\"status\"`). `primary` is a prompt that asks for a decision, with its buttons in the message.\n * @defaultValue 'info'\n */\n tone?: AlertTone;\n /** An icon in place of the tone's, such as an `Icon`. */\n icon?: React.ReactNode;\n /** Shows a close button, which calls `onClose`. */\n closable?: boolean;\n /** Called when the close button is clicked. */\n onClose?(): void;\n /** The text of the alert, in English by default. */\n labels?: Partial<AlertLabels>;\n}\n\n/** A message banner in a tone (info, success, warning, danger, or primary for a prompt), with an optional close button. */\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>((props, ref) => {\n const { children, closable = false, tone = 'info', icon, onClose, labels, className, ...others } = props;\n const text = { ...defaultAlertLabels, ...labels };\n\n return (\n <div\n role={tone === 'danger' || tone === 'warning' ? 'alert' : 'status'}\n {...others}\n ref={ref}\n className={classNames('roaster-alert', `roaster-alert--${tone}`, className)}\n >\n {icon && <span className=\"roaster-alert__icon\">{icon}</span>}\n <div className=\"roaster-alert__content\">{children}</div>\n {closable && (\n <ButtonIcon className=\"roaster-alert__close\" aria-label={text.close} onClick={onClose}>\n <Icon name=\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G;AACH,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
1
+ {"version":3,"file":"Alert.js","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** The tones of an alert: its color, icon, and how urgently screen readers announce it. */\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger' | 'primary';\n\n/** The text of the alert, for other languages. */\nexport interface AlertLabels {\n /** The name of the close button, read by screen readers. */\n close: string;\n}\n\nconst defaultAlertLabels: AlertLabels = { close: 'Close' };\n\n/** Every native `<div>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface AlertProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The message: text, links, or blocks such as a list. */\n children: React.ReactNode;\n /**\n * The tone. `danger` and `warning` are announced at once (`role=\"alert\"`), `info`, `success` and `primary`\n * politely (`role=\"status\"`). `primary` is a prompt that asks for a decision, with its buttons in the message.\n * @defaultValue 'info'\n */\n tone?: AlertTone;\n /** An icon in place of the tone's, such as an `Icon`. */\n icon?: React.ReactNode;\n /** Shows a close button, which calls `onClose`. */\n closable?: boolean;\n /** Called when the close button is clicked. */\n onClose?(): void;\n /** The text of the alert, in English by default. */\n labels?: Partial<AlertLabels>;\n}\n\n/** A message banner in a tone (info, success, warning, danger, or primary for a prompt), with an optional close button. */\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>((props, ref) => {\n const { children, closable = false, tone = 'info', icon, onClose, labels, className, ...others } = props;\n const text = { ...defaultAlertLabels, ...labels };\n\n return (\n <div\n role={tone === 'danger' || tone === 'warning' ? 'alert' : 'status'}\n {...others}\n ref={ref}\n className={classNames('roaster-alert', `roaster-alert--${tone}`, className)}\n >\n {icon && <span className=\"roaster-alert__icon\">{icon}</span>}\n <div className=\"roaster-alert__content\">{children}</div>\n {closable && (\n <ButtonIcon className=\"roaster-alert__close\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AAE,CAAC,EAAE;AAChM;AACA;AACA,GAAG;AACH,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppFrame.js","sources":["../../../../src/components/AppFrame/AppFrame.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** Every native `<div>` prop is accepted and forwarded to it. */\nexport type LayoutProps = React.ComponentPropsWithoutRef<'div'>;\n\n/** The page's layout wrapper: it holds the Sidebar (or a HeaderMenu) and the Mainframe. */\nexport const Layout = React.forwardRef<HTMLDivElement, LayoutProps>(({ className, ...others }, ref) => (\n <div {...others} ref={ref} className={classNames('roaster-layout', className)} />\n));\nLayout.displayName = 'Layout';\n\n/** Every native `<div>` prop is accepted and forwarded to it. */\nexport interface MainframeProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The content: the Page, and a Visualizer beside it when `grid` is set. */\n children?: React.ReactNode;\n /** Alerts about the whole app, above the page, such as an outdated payment. */\n alerts?: React.ReactNode;\n /**\n * Makes room for a Visualizer beside the page.\n * @defaultValue false\n */\n grid?: boolean;\n}\n\n/** The frame beside the sidebar: app-wide alerts, then the page (and a Visualizer, with `grid`). */\nexport const Mainframe = React.forwardRef<HTMLDivElement, MainframeProps>(\n ({ children, alerts, grid = false, className, ...others }, ref) => (\n <div\n {...others}\n ref={ref}\n className={classNames('roaster-mainframe', { 'roaster-mainframe--grid': grid }, className)}\n >\n {alerts && <section className=\"roaster-mainframe__alerts\">{alerts}</section>}\n {children}\n </div>\n )\n);\nMainframe.displayName = 'Mainframe';\n\n/** Every native `<header>` prop is accepted and forwarded to it. */\nexport interface HeaderMenuProps extends React.ComponentPropsWithoutRef<'header'> {\n /** The bar's content: a way back (breadcrumbs), the logo, the account menu. */\n children?: React.ReactNode;\n}\n\n/** The sticky bar at the top of pages without a sidebar. */\nexport const HeaderMenu = React.forwardRef<HTMLElement, HeaderMenuProps>(({ className, ...others }, ref) => (\n <header {...others} ref={ref} className={classNames('roaster-header-menu', className)} />\n));\nHeaderMenu.displayName = 'HeaderMenu';\n\n/** Every native `<header>` prop is accepted and forwarded to it. */\nexport interface TopBarProps extends Omit<React.ComponentPropsWithoutRef<'header'>, 'title'> {\n /** The start of the bar, such as a search button (with `className=\"roaster-top-bar__search\"`), or a `Breadcrumbs`. */\n children?: React.ReactNode;\n /**\n * The page's name, on a page without a title of its own: an `<h1>`, with an optional icon before it, at the bar's\n * start, before `children`.\n */\n title?: React.ReactNode;\n /** The end of the bar: buttons, and the account, a `<button className=\"roaster-top-bar__account\">` with an `Avatar`. */\n actions?: React.ReactNode;\n}\n\n/** The bar at the top of the main frame, beside the sidebar: a search, then actions and the account. */\nexport const TopBar = React.forwardRef<HTMLElement, TopBarProps>(\n ({ className, children, title, actions, ...others }, ref) => (\n <header {...others} ref={ref} className={classNames('roaster-top-bar', className)}>\n {title != null && title !== false && <h1 className=\"roaster-top-bar__title\">{title}</h1>}\n {children}\n {actions && <div className=\"roaster-top-bar__actions\">{actions}</div>}\n </header>\n )\n);\nTopBar.displayName = 'TopBar';\n\n/** Every native `<footer>` prop is accepted and forwarded to it. */\nexport interface FooterProps extends React.ComponentPropsWithoutRef<'footer'> {\n /** The bar's content, such as the store's name in `<span className=\"roaster-footer__store\">`. */\n children?: React.ReactNode;\n}\n\n/** The fixed bar at the bottom of the page. */\nexport const Footer = React.forwardRef<HTMLElement, FooterProps>(({ className, ...others }, ref) => (\n <footer {...others} ref={ref} className={classNames('roaster-footer', className)} />\n));\nFooter.displayName = 'Footer';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE,CAAC;AAC5K,MAAM,CAAC,WAAW,GA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EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC3H,IAAI,QAAQ;AACZ,IAAI,OAAO,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,0BAA0B,EAAE,QAAQ,EAAE,OAAO,EAAE;AACtG,GAAG,EAAE;AACL;AACA,MAAM,CAAC,WAAW,GAAG,QAAQ;AACjB,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE,CAAC;AAC/K,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"AppFrame.js","sources":["../../../../src/components/AppFrame/AppFrame.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** Every native `<div>` prop is accepted and forwarded to it. */\nexport type LayoutProps = React.ComponentPropsWithoutRef<'div'>;\n\n/** The page's layout wrapper: it holds the Sidebar (or a HeaderMenu) and the Mainframe. */\nexport const Layout = React.forwardRef<HTMLDivElement, LayoutProps>(({ className, ...others }, ref) => (\n <div {...others} ref={ref} className={classNames('roaster-layout', className)} />\n));\nLayout.displayName = 'Layout';\n\n/** Every native `<div>` prop is accepted and forwarded to it. */\nexport interface MainframeProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The content: the Page, and a Visualizer beside it when `grid` is set. */\n children?: React.ReactNode;\n /** Alerts about the whole app, above the page, such as an outdated payment. */\n alerts?: React.ReactNode;\n /**\n * Makes room for a Visualizer beside the page.\n * @defaultValue false\n */\n grid?: boolean;\n}\n\n/** The frame beside the sidebar: app-wide alerts, then the page (and a Visualizer, with `grid`). */\nexport const Mainframe = React.forwardRef<HTMLDivElement, MainframeProps>(\n ({ children, alerts, grid = false, className, ...others }, ref) => (\n <div\n {...others}\n ref={ref}\n className={classNames('roaster-mainframe', { 'roaster-mainframe--grid': grid }, className)}\n >\n {alerts && <section className=\"roaster-mainframe__alerts\">{alerts}</section>}\n {children}\n </div>\n )\n);\nMainframe.displayName = 'Mainframe';\n\n/** Every native `<header>` prop is accepted and forwarded to it. */\nexport interface HeaderMenuProps extends React.ComponentPropsWithoutRef<'header'> {\n /**\n * The bar's content: a way back (breadcrumbs), the logo, the account menu. The account opens from a `Button` with a\n * small `Avatar`, the name and a chevron, or from the picture alone, as in the TopBar:\n * `<button className=\"roaster-top-bar__account\">` with an `Avatar`.\n */\n children?: React.ReactNode;\n}\n\n/** The sticky bar at the top of pages without a sidebar. */\nexport const HeaderMenu = React.forwardRef<HTMLElement, HeaderMenuProps>(({ className, ...others }, ref) => (\n <header {...others} ref={ref} className={classNames('roaster-header-menu', className)} />\n));\nHeaderMenu.displayName = 'HeaderMenu';\n\n/** Every native `<header>` prop is accepted and forwarded to it. */\nexport interface TopBarProps extends Omit<React.ComponentPropsWithoutRef<'header'>, 'title'> {\n /** The start of the bar, such as a search button (with `className=\"roaster-top-bar__search\"`), or a `Breadcrumbs`. */\n children?: React.ReactNode;\n /**\n * The page's name, on a page without a title of its own: an `<h1>`, with an optional icon before it, at the bar's\n * start, before `children`.\n */\n title?: React.ReactNode;\n /** The end of the bar: buttons, and the account, a `<button className=\"roaster-top-bar__account\">` with an `Avatar`. */\n actions?: React.ReactNode;\n}\n\n/** The bar at the top of the main frame, beside the sidebar: a search, then actions and the account. */\nexport const TopBar = React.forwardRef<HTMLElement, TopBarProps>(\n ({ className, children, title, actions, ...others }, ref) => (\n <header {...others} ref={ref} className={classNames('roaster-top-bar', className)}>\n {title != null && title !== false && <h1 className=\"roaster-top-bar__title\">{title}</h1>}\n {children}\n {actions && <div className=\"roaster-top-bar__actions\">{actions}</div>}\n </header>\n )\n);\nTopBar.displayName = 'TopBar';\n\n/** Every native `<footer>` prop is accepted and forwarded to it. */\nexport interface FooterProps extends React.ComponentPropsWithoutRef<'footer'> {\n /** The bar's content, such as the store's name in `<span className=\"roaster-footer__store\">`. */\n children?: React.ReactNode;\n}\n\n/** The fixed bar at the bottom of the page. */\nexport const Footer = React.forwardRef<HTMLElement, FooterProps>(({ className, ...others }, ref) => (\n <footer {...others} ref={ref} className={classNames('roaster-footer', className)} />\n));\nFooter.displayName = 'Footer';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE,CAAC;AAC5K,MAAM,CAAC,WAAW,GAAG,QAAQ;AACjB,MAAC,SAAS,GAAG,KAAK,CAAC,UAAU;AACzC,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,IAAI;AACzF,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,SAAS,EAAE,UAAU,CAAC,mBAAmB,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE,EAAE,SAAS,CAAC;AAChG,MAAM,QAAQ,EAAE;AAChB,QAAQ,MAAM,oBAAoB,GAAG,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC9G,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS,CAAC,WAAW,GAAG,WAAW;AACvB,MAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAE,CAAC;AACxL,UAAU,CAAC,WAAW,GAAG,YAAY;AACzB,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU;AACtC,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE;AAC/K,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,oBAAoB,GAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC3H,IAAI,QAAQ;AACZ,IAAI,OAAO,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,0BAA0B,EAAE,QAAQ,EAAE,OAAO,EAAE;AACtG,GAAG,EAAE;AACL;AACA,MAAM,CAAC,WAAW,GAAG,QAAQ;AACjB,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE,CAAC;AAC/K,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
@@ -25,7 +25,7 @@ const Avatar = React.forwardRef(
25
25
  ),
26
26
  style: { ...typeof size === "number" && { width: size, height: size }, ...style },
27
27
  children: [
28
- icon ? icon : showFallback ? (initials ?? name.charAt(0)).toUpperCase() : /* @__PURE__ */ jsx("img", { src: src ?? void 0, alt: label, onError }),
28
+ icon ? icon : showFallback ? initials ?? name.charAt(0).toUpperCase() : /* @__PURE__ */ jsx("img", { src: src ?? void 0, alt: label, onError }),
29
29
  badge != null && /* @__PURE__ */ jsx("span", { className: "roaster-avatar__badge", children: badge })
30
30
  ]
31
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.js","sources":["../../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useImageFallback } from '@/utils';\n\n/** Every native `<span>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface AvatarProps extends React.ComponentPropsWithoutRef<'span'> {\n /** The URL of the picture. Without it, or when it fails to load, the avatar shows the initial of `name`. */\n src?: string | null;\n /**\n * What the avatar says to screen readers. `''` when the name is already written next to it.\n * @defaultValue `name`\n */\n alt?: string;\n /** The name of the person or store. */\n name: string;\n /** The width and height, in pixels, or `small` (28px, such as in a list's rows). */\n size?: number | 'small';\n /** The letters shown without a picture, such as two initials. The first letter of `name` by default. */\n initials?: string;\n /** Fills the initials in one of seven colors, so that neighbors differ, or in gray (`neutral`), for no one. */\n tint?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 'neutral';\n /** An icon in place of the picture and the initials, such as an arrow to a list's other items. */\n icon?: React.ReactNode;\n /** A small mark on the avatar's corner, such as an `Icon` for a linked account. */\n badge?: React.ReactNode;\n}\n\n/** A round picture of a person or a store, showing the initial of the name when there is no picture. */\nexport const Avatar = React.forwardRef<HTMLSpanElement, AvatarProps>(\n ({ src, alt, name, size, initials, tint, icon, badge, className, style, ...others }, ref) => {\n const { showFallback, onError } = useImageFallback(src);\n const label = alt ?? name;\n // The initial is a picture of the name: named like one, or hidden when it is decorative.\n const fallbackProps = label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true };\n\n return (\n <span\n {...(showFallback ? fallbackProps : {})}\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-avatar',\n {\n [`roaster-avatar--${tint === 'neutral' ? 'neutral' : `tint-${tint}`}`]: tint !== undefined,\n 'roaster-avatar--small': size === 'small',\n },\n className\n )}\n style={{ ...(typeof size === 'number' && { width: size, height: size }), ...style }}\n >\n {icon ? (\n icon\n ) : showFallback ? (\n (initials ?? name.charAt(0)).toUpperCase()\n ) : (\n <img src={src ?? undefined} alt={label} onError={onError} />\n )}\n {badge != null && <span className=\"roaster-avatar__badge\">{badge}</span>}\n </span>\n );\n }\n);\n\nAvatar.displayName = 'Avatar';\n"],"names":[],"mappings":";;;;;;AAIY,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU;AACtC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAC/F,IAAI,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAC;AAC3D,IAAI,MAAM,KAAK,GAAG,GAAG,IAAI,IAAI;AAC7B,IAAI,MAAM,aAAa,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;AAChG,IAAI,uBAAuB,IAAI;AAC/B,MAAM,MAAM;AACZ,MAAM;AACN,QAAQ,GAAG,YAAY,GAAG,aAAa,GAAG,EAAE;AAC5C,QAAQ,GAAG,MAAM;AACjB,QAAQ,GAAG;AACX,QAAQ,SAAS,EAAE,UAAU;AAC7B,UAAU,gBAAgB;AAC1B,UAAU;AACV,YAAY,CAAC,CAAC,gBAAgB,EAAE,IAAI,KAAK,SAAS,GAAG,SAAS,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,MAAM;AACnG,YAAY,uBAAuB,EAAE,IAAI,KAAK;AAC9C,WAAW;AACX,UAAU;AACV,SAAS;AACT,QAAQ,KAAK,EAAE,EAAE,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE;AACzF,QAAQ,QAAQ,EAAE;AAClB,UAAU,IAAI,GAAG,IAAI,GAAG,YAAY,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,mBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC3J,UAAU,KAAK,IAAI,IAAI,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,KAAK,EAAE;AAC9G;AACA;AACA,KAAK;AACL,EAAE;AACF;AACA,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"Avatar.js","sources":["../../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useImageFallback } from '@/utils';\n\n/** Every native `<span>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface AvatarProps extends React.ComponentPropsWithoutRef<'span'> {\n /** The URL of the picture. Without it, or when it fails to load, the avatar shows the initial of `name`. */\n src?: string | null;\n /**\n * What the avatar says to screen readers. `''` when the name is already written next to it.\n * @defaultValue `name`\n */\n alt?: string;\n /** The name of the person or store. */\n name: string;\n /** The width and height, in pixels, or `small` (28px, such as in a list's rows). */\n size?: number | 'small';\n /**\n * The letters shown without a picture, such as two initials, as written: a brand's lower-case \"k\" stays one. The first\n * letter of `name`, in capitals, by default.\n */\n initials?: string;\n /** Fills the initials in one of seven colors, so that neighbors differ, or in gray (`neutral`), for no one. */\n tint?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 'neutral';\n /** An icon in place of the picture and the initials, such as an arrow to a list's other items. */\n icon?: React.ReactNode;\n /** A small mark on the avatar's corner, such as an `Icon` for a linked account. */\n badge?: React.ReactNode;\n}\n\n/** A round picture of a person or a store, showing the initial of the name when there is no picture. */\nexport const Avatar = React.forwardRef<HTMLSpanElement, AvatarProps>(\n ({ src, alt, name, size, initials, tint, icon, badge, className, style, ...others }, ref) => {\n const { showFallback, onError } = useImageFallback(src);\n const label = alt ?? name;\n // The initial is a picture of the name: named like one, or hidden when it is decorative.\n const fallbackProps = label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true };\n\n return (\n <span\n {...(showFallback ? fallbackProps : {})}\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-avatar',\n {\n [`roaster-avatar--${tint === 'neutral' ? 'neutral' : `tint-${tint}`}`]: tint !== undefined,\n 'roaster-avatar--small': size === 'small',\n },\n className\n )}\n style={{ ...(typeof size === 'number' && { width: size, height: size }), ...style }}\n >\n {icon ? (\n icon\n ) : showFallback ? (\n (initials ?? name.charAt(0).toUpperCase())\n ) : (\n <img src={src ?? undefined} alt={label} onError={onError} />\n )}\n {badge != null && <span className=\"roaster-avatar__badge\">{badge}</span>}\n </span>\n );\n }\n);\n\nAvatar.displayName = 'Avatar';\n"],"names":[],"mappings":";;;;;;AAIY,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU;AACtC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAC/F,IAAI,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAC;AAC3D,IAAI,MAAM,KAAK,GAAG,GAAG,IAAI,IAAI;AAC7B,IAAI,MAAM,aAAa,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;AAChG,IAAI,uBAAuB,IAAI;AAC/B,MAAM,MAAM;AACZ,MAAM;AACN,QAAQ,GAAG,YAAY,GAAG,aAAa,GAAG,EAAE;AAC5C,QAAQ,GAAG,MAAM;AACjB,QAAQ,GAAG;AACX,QAAQ,SAAS,EAAE,UAAU;AAC7B,UAAU,gBAAgB;AAC1B,UAAU;AACV,YAAY,CAAC,CAAC,gBAAgB,EAAE,IAAI,KAAK,SAAS,GAAG,SAAS,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,MAAM;AACnG,YAAY,uBAAuB,EAAE,IAAI,KAAK;AAC9C,WAAW;AACX,UAAU;AACV,SAAS;AACT,QAAQ,KAAK,EAAE,EAAE,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,EAAE;AACzF,QAAQ,QAAQ,EAAE;AAClB,UAAU,IAAI,GAAG,IAAI,GAAG,YAAY,GAAG,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,mBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AACzJ,UAAU,KAAK,IAAI,IAAI,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,KAAK,EAAE;AAC9G;AACA;AACA,KAAK;AACL,EAAE;AACF;AACA,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
@@ -1,7 +1,8 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
- import { Icon } from '../Icon/Icon.js';
4
+ import '../Icon/Icon.js';
5
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
5
6
  import { classNames } from '../../utils/classNames/index.js';
6
7
  import { Slot } from '../../utils/Slot/index.js';
7
8
 
@@ -47,7 +48,7 @@ const Button = React.forwardRef((props, ref) => {
47
48
  }
48
49
  return /* @__PURE__ */ jsxs("button", { ...others, ...loadingProps, ref, type, className: classes, onClick: handleClick, children: [
49
50
  children,
50
- caret && /* @__PURE__ */ jsx(Icon, { name: "chevron-down", className: "roaster-button__caret" })
51
+ caret && /* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-down", className: "roaster-button__caret" })
51
52
  ] });
52
53
  });
53
54
  Button.displayName = "Button";
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Icon } from '../Icon';\nimport { classNames, Slot } from '@/utils';\n\n/** Every native `<button>` prop (`type`, `name`, `aria-*`, ...) is accepted and forwarded to it. */\nexport interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n /** The button's content: its text, and an `Icon` if any. */\n children: React.ReactNode;\n /**\n * The look of the button:\n * - `primary`: filled, for the main action\n * - `secondary`: for other actions: outlined in coffee, filled in Azoth\n * - `plain`: a link-like text button\n * - `ghost`: no background or border, such as an icon in a toolbar\n * - `chip`: a filter or a toggle, such as the filters above a table; `aria-pressed` turns it on. It looks like\n * `secondary` in the coffee theme\n * @defaultValue 'primary'\n */\n variant?: 'primary' | 'secondary' | 'plain' | 'ghost' | 'chip';\n /**\n * A status color: `success` for positive actions, `danger` for destructive ones. `neutral`, for a `plain` button: a\n * quiet action in the text's secondary color, such as one under a form.\n */\n tone?: 'success' | 'danger' | 'neutral';\n /**\n * `large` for the buttons of full-page flows and a few prominent calls to action. Buttons in a modal's footer and in\n * `FormActions` are large without it. `small` for smaller text, such as a quiet action under a field. The sizes look\n * the same in the coffee theme.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** A square button holding only an icon. Name it with `aria-label`. */\n iconOnly?: boolean;\n /** A chevron after the text, for a button that opens a menu, such as a filter chip. Not with `asChild`. */\n caret?: boolean;\n /** Takes the whole width of its container. */\n fullWidth?: boolean;\n /** Its label lines up with the text before it, its padding hanging out of its place, such as a period picker. */\n flush?: boolean;\n /**\n * A value in a column of rows, such as a property in a page's side column: its icon nearer the start, its text cut\n * short with an ellipsis when it doesn't fit.\n */\n row?: boolean;\n /** Shows a spinner in place of the content, and ignores clicks, while an action runs. */\n loading?: boolean;\n /**\n * Render the element your child is, such as a link (`<Button asChild><a href=\"/new\">New</a></Button>`), with the\n * button's look.\n */\n asChild?: boolean;\n}\n\n/**\n * A button in the primary, secondary, plain, ghost or chip style, optionally in the success, danger or (plain) neutral\n * tone, and in the small, medium or large size. It is\n * `type=\"button\"` unless you say otherwise, so it never submits a form by accident.\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n const {\n children,\n variant = 'primary',\n tone,\n size = 'medium',\n iconOnly,\n caret,\n fullWidth,\n flush,\n row,\n loading,\n asChild,\n className,\n onClick,\n type = 'button',\n ...others\n } = props;\n\n const classes = classNames(\n 'roaster-button',\n `roaster-button--${variant}`,\n tone && `roaster-button--${tone}`,\n {\n 'roaster-button--small': size === 'small',\n 'roaster-button--large': size === 'large',\n 'roaster-button--icon-only': iconOnly,\n 'roaster-button--full-width': fullWidth,\n 'roaster-button--flush': flush,\n 'roaster-button--row': row,\n },\n className\n );\n const loadingProps = loading ? { 'aria-busy': true, 'aria-disabled': true } : {};\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n // A loading button stays focusable, so a click can still reach it from the keyboard.\n if (loading) event.preventDefault();\n else onClick?.(event);\n };\n\n if (asChild) {\n return (\n <Slot {...others} {...loadingProps} ref={ref as React.Ref<HTMLElement>} className={classes} onClick={handleClick}>\n {children}\n </Slot>\n );\n }\n return (\n <button {...others} {...loadingProps} ref={ref} type={type} className={classes} onClick={handleClick}>\n {children}\n {caret && <Icon name=\"chevron-down\" className=\"roaster-button__caret\" />}\n </button>\n );\n});\n\nButton.displayName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AG,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AAC7H,EAAE;AACF,EAAE,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;AACrI,IAAI,QAAQ;AACZ,IAAI,KAAK,oBAAoB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,uBAAuB,EAAE;AACnG,GAAG,EAAE,CAAC;AACN,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\nimport { RoasterIcon } from '../Icon';\nimport { classNames, Slot } from '@/utils';\n\n/** Every native `<button>` prop (`type`, `name`, `aria-*`, ...) is accepted and forwarded to it. */\nexport interface ButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n /** The button's content: its text, and an `Icon` if any. */\n children: React.ReactNode;\n /**\n * The look of the button:\n * - `primary`: filled, for the main action\n * - `secondary`: for other actions: outlined in coffee, filled in Azoth\n * - `plain`: a link-like text button\n * - `ghost`: no background or border, such as an icon in a toolbar\n * - `chip`: a filter or a toggle, such as the filters above a table; `aria-pressed` turns it on. It looks like\n * `secondary` in the coffee theme\n * @defaultValue 'primary'\n */\n variant?: 'primary' | 'secondary' | 'plain' | 'ghost' | 'chip';\n /**\n * A status color: `success` for positive actions, `danger` for destructive ones. `neutral`, for a `plain` button: a\n * quiet action in the text's secondary color, such as one under a form.\n */\n tone?: 'success' | 'danger' | 'neutral';\n /**\n * `large` for the buttons of full-page flows and a few prominent calls to action. Buttons in a modal's footer and in\n * `FormActions` are large without it. `small` for smaller text, such as a quiet action under a field. The sizes look\n * the same in the coffee theme.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /** A square button holding only an icon. Name it with `aria-label`. */\n iconOnly?: boolean;\n /** A chevron after the text, for a button that opens a menu, such as a filter chip. Not with `asChild`. */\n caret?: boolean;\n /** Takes the whole width of its container. */\n fullWidth?: boolean;\n /** Its label lines up with the text before it, its padding hanging out of its place, such as a period picker. */\n flush?: boolean;\n /**\n * A value in a column of rows, such as a property in a page's side column: its icon nearer the start, its text cut\n * short with an ellipsis when it doesn't fit.\n */\n row?: boolean;\n /** Shows a spinner in place of the content, and ignores clicks, while an action runs. */\n loading?: boolean;\n /**\n * Render the element your child is, such as a link (`<Button asChild><a href=\"/new\">New</a></Button>`), with the\n * button's look.\n */\n asChild?: boolean;\n}\n\n/**\n * A button in the primary, secondary, plain, ghost or chip style, optionally in the success, danger or (plain) neutral\n * tone, and in the small, medium or large size. It is\n * `type=\"button\"` unless you say otherwise, so it never submits a form by accident.\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {\n const {\n children,\n variant = 'primary',\n tone,\n size = 'medium',\n iconOnly,\n caret,\n fullWidth,\n flush,\n row,\n loading,\n asChild,\n className,\n onClick,\n type = 'button',\n ...others\n } = props;\n\n const classes = classNames(\n 'roaster-button',\n `roaster-button--${variant}`,\n tone && `roaster-button--${tone}`,\n {\n 'roaster-button--small': size === 'small',\n 'roaster-button--large': size === 'large',\n 'roaster-button--icon-only': iconOnly,\n 'roaster-button--full-width': fullWidth,\n 'roaster-button--flush': flush,\n 'roaster-button--row': row,\n },\n className\n );\n const loadingProps = loading ? { 'aria-busy': true, 'aria-disabled': true } : {};\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n // A loading button stays focusable, so a click can still reach it from the keyboard.\n if (loading) event.preventDefault();\n else onClick?.(event);\n };\n\n if (asChild) {\n return (\n <Slot {...others} {...loadingProps} ref={ref as React.Ref<HTMLElement>} className={classes} onClick={handleClick}>\n {children}\n </Slot>\n );\n }\n return (\n <button {...others} {...loadingProps} ref={ref} type={type} className={classes} onClick={handleClick}>\n {children}\n {caret && <RoasterIcon name=\"chevron-down\" className=\"roaster-button__caret\" />}\n </button>\n );\n});\n\nButton.displayName = 'Button';\n"],"names":[],"mappings":";;;;;;;;AAKY,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACvD,EAAE,MAAM;AACR,IAAI,QAAQ;AACZ,IAAI,OAAO,GAAG,SAAS;AACvB,IAAI,IAAI;AACR,IAAI,IAAI,GAAG,QAAQ;AACnB,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,GAAG;AACP,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,SAAS;AACb,IAAI,OAAO;AACX,IAAI,IAAI,GAAG,QAAQ;AACnB,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,OAAO,GAAG,UAAU;AAC5B,IAAI,gBAAgB;AACpB,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAChC,IAAI,IAAI,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACrC,IAAI;AACJ,MAAM,uBAAuB,EAAE,IAAI,KAAK,OAAO;AAC/C,MAAM,uBAAuB,EAAE,IAAI,KAAK,OAAO;AAC/C,MAAM,2BAA2B,EAAE,QAAQ;AAC3C,MAAM,4BAA4B,EAAE,SAAS;AAC7C,MAAM,uBAAuB,EAAE,KAAK;AACpC,MAAM,qBAAqB,EAAE;AAC7B,KAAK;AACL,IAAI;AACJ,GAAG;AACH,EAAE,MAAM,YAAY,GAAG,OAAO,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE;AAClF,EAAE,MAAM,WAAW,GAAG,CAAC,KAAK,KAAK;AACjC,IAAI,IAAI,OAAO,EAAE,KAAK,CAAC,cAAc,EAAE;AACvC,SAAS,OAAO,GAAG,KAAK,CAAC;AACzB,EAAE,CAAC;AACH,EAAE,IAAI,OAAO,EAAE;AACf,IAAI,uBAAuB,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AAC7H,EAAE;AACF,EAAE,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;AACrI,IAAI,QAAQ;AACZ,IAAI,KAAK,oBAAoB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,uBAAuB,EAAE;AAC1G,GAAG,EAAE,CAAC;AACN,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonIcon.js","sources":["../../../../src/components/ButtonIcon/ButtonIcon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\ninterface ButtonIconBaseProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'aria-label' | 'aria-labelledby'> {\n /** The icon, such as `<Icon name=\"xmark\" />`. */\n children: React.ReactNode;\n /**\n * The size of the icon: `small` (alerts, toasts, tags) or `medium` (modals).\n * @defaultValue 'small'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A small icon-only button, such as the close button of an alert, a tag or a modal. It has no text, so it needs a\n * name: `aria-label`, or `aria-labelledby` pointing at text on the page. Every native `<button>` prop is accepted.\n */\nexport type ButtonIconProps = ButtonIconBaseProps &\n ({ 'aria-label': string; 'aria-labelledby'?: string } | { 'aria-label'?: string; 'aria-labelledby': string });\n\n/** A small icon-only button, such as the close button of an alert, a tag or a modal. Name it with `aria-label`. */\nexport const ButtonIcon = React.forwardRef<HTMLButtonElement, ButtonIconProps>((props, ref) => {\n const { children, size = 'small', className, type = 'button', ...others } = props;\n\n return (\n <button\n {...others}\n ref={ref}\n type={type}\n className={classNames('roaster-icon-button', { 'roaster-icon-button--medium': size === 'medium' }, className)}\n >\n {children}\n </button>\n );\n});\n\nButtonIcon.displayName = 'ButtonIcon';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACnF,EAAE,uBAAuB,GAAG;AAC5B,IAAI,QAAQ;AACZ,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,IAAI;AACV,MAAM,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,EAAE,6BAA6B,EAAE,IAAI,KAAK,QAAQ,EAAE,EAAE,SAAS,CAAC;AACnH,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
1
+ {"version":3,"file":"ButtonIcon.js","sources":["../../../../src/components/ButtonIcon/ButtonIcon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\ninterface ButtonIconBaseProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'aria-label' | 'aria-labelledby'> {\n /** The icon, such as Roaster's cross: `<i className=\"roaster-icon roaster-icon--x\" aria-hidden=\"true\" />`. */\n children: React.ReactNode;\n /**\n * The size of the icon: `small` (alerts, toasts, tags) or `medium` (modals).\n * @defaultValue 'small'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A small icon-only button, such as the close button of an alert, a tag or a modal. It has no text, so it needs a\n * name: `aria-label`, or `aria-labelledby` pointing at text on the page. Every native `<button>` prop is accepted.\n */\nexport type ButtonIconProps = ButtonIconBaseProps &\n ({ 'aria-label': string; 'aria-labelledby'?: string } | { 'aria-label'?: string; 'aria-labelledby': string });\n\n/** A small icon-only button, such as the close button of an alert, a tag or a modal. Name it with `aria-label`. */\nexport const ButtonIcon = React.forwardRef<HTMLButtonElement, ButtonIconProps>((props, ref) => {\n const { children, size = 'small', className, type = 'button', ...others } = props;\n\n return (\n <button\n {...others}\n ref={ref}\n type={type}\n className={classNames('roaster-icon-button', { 'roaster-icon-button--medium': size === 'medium' }, className)}\n >\n {children}\n </button>\n );\n});\n\nButtonIcon.displayName = 'ButtonIcon';\n"],"names":[],"mappings":";;;;;AAIY,MAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACnF,EAAE,uBAAuB,GAAG;AAC5B,IAAI,QAAQ;AACZ,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,IAAI;AACV,MAAM,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,EAAE,6BAA6B,EAAE,IAAI,KAAK,QAAQ,EAAE,EAAE,SAAS,CAAC;AACnH,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
@@ -1,12 +1,12 @@
1
1
  'use client';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
- import { useMergeRefs } from '@floating-ui/react';
5
4
  import { CheckboxGroup } from './CheckboxGroup/CheckboxGroup.js';
6
5
  import { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroup.context.js';
7
6
  import { leafValues, ChoiceText } from './ChoiceText.js';
8
7
  import { useUid } from '../../utils/useUid/index.js';
9
8
  import { useControllableState } from '../../utils/useControllableState/index.js';
9
+ import { useMergeRefs } from '../../utils/useMergeRefs/index.js';
10
10
  import { classNames } from '../../utils/classNames/index.js';
11
11
 
12
12
  const CheckboxBase = React.forwardRef((props, ref) => {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMergeRefs } from '@floating-ui/react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { CheckboxGroup } from './CheckboxGroup/CheckboxGroup';\nimport { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroup.context';\nimport { ChoiceText, leafValues } from './ChoiceText';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `onChange`, `aria-*`, ...) is accepted and forwarded to the\n * checkbox, with the ref. `className` and `style` go to its label.\n */\nexport interface CheckboxProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'value'> {\n /** The value submitted with the form when checked, and the value a `Checkbox.Group` holds. */\n value: string;\n /** The text next to the box. */\n label?: React.ReactNode;\n /** A line under the label, such as what the choice means. */\n description?: React.ReactNode;\n /** A short text at the end of the row, such as the kind of a name (\"Recipient\"). */\n detail?: React.ReactNode;\n /**\n * The checkboxes under this one, in a `Checkbox.Group`: checking it checks them all, and it is checked when they\n * all are, mixed when some are. Their values stand for its own.\n */\n children?: React.ReactNode;\n /** `card` draws the checkbox as a bordered card, highlighted while checked. */\n variant?: 'default' | 'card';\n /** The mixed state: some of the items this checkbox stands for are checked, not all. */\n indeterminate?: boolean;\n /** Called with the new checked state when the user toggles the checkbox. */\n onCheckedChange?(checked: boolean): void;\n}\n\nconst CheckboxBase = React.forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\n const {\n id,\n label,\n description,\n detail,\n children,\n value,\n variant = 'default',\n indeterminate = false,\n checked,\n defaultChecked,\n onChange,\n onCheckedChange,\n className,\n style,\n ...others\n } = props;\n const ctx = useCheckboxGroupContext();\n const uid = useUid(id);\n // On its own, the checkbox follows `checked`, or keeps its own state from `defaultChecked`.\n const [ownChecked, setOwnChecked] = useControllableState({\n value: checked,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n // `indeterminate` is a DOM property, not an attribute.\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n\n // With checkboxes under it, in a group, it stands for them.\n const nested = React.useMemo(() => (children != null ? leafValues(children) : []), [children]);\n const parent = ctx != null && nested.length > 0;\n const nestedChecked = parent ? nested.filter((item) => ctx.value.includes(item)).length : 0;\n const isIndeterminate = parent ? nestedChecked > 0 && nestedChecked < nested.length : indeterminate;\n React.useEffect(() => {\n if (inputRef.current) inputRef.current.indeterminate = isIndeterminate;\n }, [isIndeterminate]);\n\n const isChecked = parent ? nestedChecked === nested.length : ctx ? ctx.value.includes(value) : ownChecked;\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n if (parent) {\n const others = ctx.value.filter((item) => !nested.includes(item));\n ctx.setValue(event.target.checked ? [...others, ...nested] : others);\n } else if (ctx) ctx.onChange(event);\n else setOwnChecked(event.target.checked);\n };\n\n const choice = (\n <label\n className={classNames('roaster-choice', { 'roaster-choice--card': variant === 'card' }, className)}\n style={style}\n >\n <input\n {...others}\n ref={mergedRef}\n id={uid}\n type=\"checkbox\"\n value={value}\n checked={isChecked}\n onChange={handleChange}\n className=\"roaster-choice__input\"\n />\n <span className=\"roaster-choice__box\" />\n <ChoiceText label={label} description={description} detail={detail} labelId={`${uid}-label`} />\n </label>\n );\n if (children == null) return choice;\n return (\n <>\n {choice}\n <div className=\"roaster-choice-group roaster-choice-group--nested\" role=\"group\" aria-labelledby={`${uid}-label`}>\n {children}\n </div>\n </>\n );\n});\n\nCheckboxBase.displayName = 'Checkbox';\n\n/**\n * A checkbox with a label. Use Checkbox.Group to manage several values together, and `variant=\"card\"` for a\n * card-style option.\n */\nexport const Checkbox = Object.assign(CheckboxBase, {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X,MAAM,QAAQ,EAAE;AAChB,wBAAwB,GAAG;AAC3B,UAAU,OAAO;AACjB,UAAU;AACV,YAAY,GAAG,MAAM;AACrB,YAAY,GAAG,EAAE,SAAS;AAC1B,YAAY,EAAE,EAAE,GAAG;AACnB,YAAY,IAAI,EAAE,UAAU;AAC5B,YAAY,KAAK;AACjB,YAAY,OAAO,EAAE,SAAS;AAC9B,YAAY,QAAQ,EAAE,YAAY;AAClC,YAAY,SAAS,EAAE;AACvB;AACA,SAAS;AACT,wBAAwB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;AACzE,wBAAwB,GAAG,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;AAC/F;AACA;AACA,GAAG;AACH,EAAE,IAAI,QAAQ,IAAI,IAAI,EAAE,OAAO,MAAM;AACrC,EAAE,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;AACpD,IAAI,MAAM;AACV,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,mDAAmD,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE;AAC7J,GAAG,EAAE,CAAC;AACN,CAAC,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,UAAU;AACzB,MAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useMergeRefs, useUid } from '@/utils';\nimport { CheckboxGroup } from './CheckboxGroup/CheckboxGroup';\nimport { useCheckboxGroupContext } from './CheckboxGroup/CheckboxGroup.context';\nimport { ChoiceText, leafValues } from './ChoiceText';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `onChange`, `aria-*`, ...) is accepted and forwarded to the\n * checkbox, with the ref. `className` and `style` go to its label.\n */\nexport interface CheckboxProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'value'> {\n /** The value submitted with the form when checked, and the value a `Checkbox.Group` holds. */\n value: string;\n /** The text next to the box. */\n label?: React.ReactNode;\n /** A line under the label, such as what the choice means. */\n description?: React.ReactNode;\n /** A short text at the end of the row, such as the kind of a name (\"Recipient\"). */\n detail?: React.ReactNode;\n /**\n * The checkboxes under this one, in a `Checkbox.Group`: checking it checks them all, and it is checked when they\n * all are, mixed when some are. Their values stand for its own.\n */\n children?: React.ReactNode;\n /** `card` draws the checkbox as a bordered card, highlighted while checked. */\n variant?: 'default' | 'card';\n /** The mixed state: some of the items this checkbox stands for are checked, not all. */\n indeterminate?: boolean;\n /** Called with the new checked state when the user toggles the checkbox. */\n onCheckedChange?(checked: boolean): void;\n}\n\nconst CheckboxBase = React.forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\n const {\n id,\n label,\n description,\n detail,\n children,\n value,\n variant = 'default',\n indeterminate = false,\n checked,\n defaultChecked,\n onChange,\n onCheckedChange,\n className,\n style,\n ...others\n } = props;\n const ctx = useCheckboxGroupContext();\n const uid = useUid(id);\n // On its own, the checkbox follows `checked`, or keeps its own state from `defaultChecked`.\n const [ownChecked, setOwnChecked] = useControllableState({\n value: checked,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n // `indeterminate` is a DOM property, not an attribute.\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n\n // With checkboxes under it, in a group, it stands for them.\n const nested = React.useMemo(() => (children != null ? leafValues(children) : []), [children]);\n const parent = ctx != null && nested.length > 0;\n const nestedChecked = parent ? nested.filter((item) => ctx.value.includes(item)).length : 0;\n const isIndeterminate = parent ? nestedChecked > 0 && nestedChecked < nested.length : indeterminate;\n React.useEffect(() => {\n if (inputRef.current) inputRef.current.indeterminate = isIndeterminate;\n }, [isIndeterminate]);\n\n const isChecked = parent ? nestedChecked === nested.length : ctx ? ctx.value.includes(value) : ownChecked;\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n if (parent) {\n const others = ctx.value.filter((item) => !nested.includes(item));\n ctx.setValue(event.target.checked ? [...others, ...nested] : others);\n } else if (ctx) ctx.onChange(event);\n else setOwnChecked(event.target.checked);\n };\n\n const choice = (\n <label\n className={classNames('roaster-choice', { 'roaster-choice--card': variant === 'card' }, className)}\n style={style}\n >\n <input\n {...others}\n ref={mergedRef}\n id={uid}\n type=\"checkbox\"\n value={value}\n checked={isChecked}\n onChange={handleChange}\n className=\"roaster-choice__input\"\n />\n <span className=\"roaster-choice__box\" />\n <ChoiceText label={label} description={description} detail={detail} labelId={`${uid}-label`} />\n </label>\n );\n if (children == null) return choice;\n return (\n <>\n {choice}\n <div className=\"roaster-choice-group roaster-choice-group--nested\" role=\"group\" aria-labelledby={`${uid}-label`}>\n {children}\n </div>\n </>\n );\n});\n\nCheckboxBase.displayName = 'Checkbox';\n\n/**\n * A checkbox with a label. Use Checkbox.Group to manage several values together, and `variant=\"card\"` for a\n * card-style option.\n */\nexport const Checkbox = Object.assign(CheckboxBase, { Group: CheckboxGroup });\n"],"names":[],"mappings":";;;;;;;;;;;AAOA,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,WAAW;AACf,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,KAAK;AACT,IAAI,OAAO,GAAG,SAAS;AACvB,IAAI,aAAa,GAAG,KAAK;AACzB,IAAI,OAAO;AACX,IAAI,cAAc;AAClB,IAAI,QAAQ;AACZ,IAAI,eAAe;AACnB,IAAI,SAAS;AACb,IAAI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AG,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE;AAC/F;AACA;AACA,GAAG;AACH,EAAE,IAAI,QAAQ,IAAI,IAAI,EAAE,OAAO,MAAM;AACrC,EAAE,uBAAuB,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE;AACpD,IAAI,MAAM;AACV,oBAAoB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,mDAAmD,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE;AAC7J,GAAG,EAAE,CAAC;AACN,CAAC,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,UAAU;AACzB,MAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE;;"}
@@ -17,6 +17,7 @@ const ColorField = React.forwardRef((props, ref) => {
17
17
  name,
18
18
  disabled,
19
19
  description,
20
+ keepDescription,
20
21
  error,
21
22
  className,
22
23
  style,
@@ -50,35 +51,47 @@ const ColorField = React.forwardRef((props, ref) => {
50
51
  const color = toFullHex(typed);
51
52
  if (color) setInternalValue(color);
52
53
  };
53
- return /* @__PURE__ */ jsx(Field, { controlId: uid, label, description, error, className, style, children: /* @__PURE__ */ jsxs("div", { className: "roaster-merged-inputs", children: [
54
- /* @__PURE__ */ jsxs("span", { className: "roaster-color-swatch roaster-merged-inputs__start", children: [
55
- /* @__PURE__ */ jsx("span", { className: "roaster-color-swatch__preview", style: { backgroundColor: internalValue } }),
56
- /* @__PURE__ */ jsx(
57
- "input",
58
- {
59
- ...others,
60
- ...fieldControlProps(uid, { description, error }, others),
61
- ref,
62
- type: "color",
63
- className: "roaster-color-swatch__input",
64
- name,
65
- disabled,
66
- onChange: handleChange,
67
- value: internalValue
68
- }
69
- )
70
- ] }),
71
- /* @__PURE__ */ jsx(
72
- "input",
73
- {
74
- type: "text",
75
- className: "roaster-input roaster-merged-inputs__end",
76
- "aria-label": text.hex,
77
- value: shownHex,
78
- onChange: handleHexChange
79
- }
80
- )
81
- ] }) });
54
+ return /* @__PURE__ */ jsx(
55
+ Field,
56
+ {
57
+ controlId: uid,
58
+ label,
59
+ description,
60
+ keepDescription,
61
+ error,
62
+ className,
63
+ style,
64
+ children: /* @__PURE__ */ jsxs("div", { className: "roaster-merged-inputs", children: [
65
+ /* @__PURE__ */ jsxs("span", { className: "roaster-color-swatch roaster-merged-inputs__start", children: [
66
+ /* @__PURE__ */ jsx("span", { className: "roaster-color-swatch__preview", style: { backgroundColor: internalValue } }),
67
+ /* @__PURE__ */ jsx(
68
+ "input",
69
+ {
70
+ ...others,
71
+ ...fieldControlProps(uid, { description, error, keepDescription }, others),
72
+ ref,
73
+ type: "color",
74
+ className: "roaster-color-swatch__input",
75
+ name,
76
+ disabled,
77
+ onChange: handleChange,
78
+ value: internalValue
79
+ }
80
+ )
81
+ ] }),
82
+ /* @__PURE__ */ jsx(
83
+ "input",
84
+ {
85
+ type: "text",
86
+ className: "roaster-input roaster-merged-inputs__end",
87
+ "aria-label": text.hex,
88
+ value: shownHex,
89
+ onChange: handleHexChange
90
+ }
91
+ )
92
+ ] })
93
+ }
94
+ );
82
95
  });
83
96
  ColorField.displayName = "ColorField";
84
97
 
@@ -1 +1 @@
1
- {"version":3,"file":"ColorField.js","sources":["../../../../src/components/ColorField/ColorField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useUid, useControllableState } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/** `#abc` or `#aabbcc` as `#aabbcc`; anything else as `null`. */\nfunction toFullHex(text: string) {\n if (!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(text)) return null;\n return (text.length === 4 ? text.replace(/[0-9a-f]/gi, (digit) => digit + digit) : text).toLowerCase();\n}\n\n/** The text of the color field, for other languages. */\nexport interface ColorFieldLabels {\n /** The name of the text input that holds the hex code, read by screen readers. */\n hex: string;\n}\n\nconst defaultColorFieldLabels: ColorFieldLabels = { hex: 'Hex color code' };\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the color input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface ColorFieldProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the color field input element (optional). */\n id?: string;\n /** The name attribute to be applied to the color field input element (optional). */\n name?: string;\n /** Whether the color field input should be disabled (optional). */\n disabled?: boolean;\n /** The current value of the color field input (optional). */\n value?: string;\n /** The default value of the color field input (optional). */\n defaultValue?: string;\n /** Called with the new color when the user picks or types one. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** The text of the field, in English by default. */\n labels?: Partial<ColorFieldLabels>;\n}\n\n/** A color picker with a text field that shows and edits the hex value. */\nexport const ColorField = React.forwardRef<HTMLInputElement, ColorFieldProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n description,\n error,\n className,\n style,\n onChange,\n onValueChange,\n value,\n defaultValue,\n labels,\n ...others\n } = props;\n const text = { ...defaultColorFieldLabels, ...labels };\n const [internalValue, setInternalValue] = useControllableState({\n value,\n defaultValue: defaultValue ?? '',\n onChange: onValueChange,\n });\n const uid = useUid(id);\n\n // The hex text as typed: the color only follows once it is a whole code (#RGB or #RRGGBB).\n const [hexText, setHexText] = React.useState(internalValue);\n React.useEffect(() => {\n setHexText((typed) => (toFullHex(typed) === internalValue.toLowerCase() ? typed : internalValue));\n }, [internalValue]);\n\n // A whole code the value doesn't hold (a controlled field the parent didn't update) gives way to the value.\n const typedColor = toFullHex(hexText);\n const shownHex = typedColor && typedColor !== internalValue.toLowerCase() ? internalValue : hexText;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n setInternalValue(event.currentTarget.value);\n };\n const handleHexChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const typed = event.currentTarget.value;\n setHexText(typed);\n const color = toFullHex(typed);\n if (color) setInternalValue(color);\n };\n\n return (\n <Field controlId={uid} label={label} description={description} error={error} className={className} style={style}>\n <div className=\"roaster-merged-inputs\">\n <span className=\"roaster-color-swatch roaster-merged-inputs__start\">\n <span className=\"roaster-color-swatch__preview\" style={{ backgroundColor: internalValue }} />\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error }, others)}\n ref={ref}\n type=\"color\"\n className=\"roaster-color-swatch__input\"\n name={name}\n disabled={disabled}\n onChange={handleChange}\n value={internalValue}\n />\n </span>\n <input\n type=\"text\"\n className=\"roaster-input roaster-merged-inputs__end\"\n aria-label={text.hex}\n value={shownHex}\n onChange={handleHexChange}\n />\n </div>\n </Field>\n );\n});\n\nColorField.displayName = 'ColorField';\n"],"names":[],"mappings":";;;;;;;AAKA,SAAS,SAAS,CAAC,IAAI,EAAE;AACzB,EAAE,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,IAAI;AAC9D,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,KAAK,KAAK,GAAG,KAAK,CAAC,GAAG,IAAI,EAAE,WAAW,EAAE;AACxG;AACA,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,gBAAgB,EAAE;AAC7C,MAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,QAAQ;AACZ,IAAI,WAAW;AACf,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,QAAQ;AACZ,IAAI,aAAa;AACjB,IAAI,KAAK;AACT,IAAI,YAAY;AACh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AAK,CAAC;AACtC,EAAE,CAAC;AACH,EAAE,uBAAuB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,kBAAkB,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE;AACzL,oBAAoB,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,mDAAmD,EAAE,QAAQ,EAAE;AAC7G,sBAAsB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,+BAA+B,EAAE,KAAK,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE,EAAE,CAAC;AAC5H,sBAAsB,GAAG;AACzB,QAAQ,OAAO;AACf,QAAQ;AACR,UAAU,GAAG,MAAM;AACnB,UAAU,GAAG,iBAAiB,CAAC,GAAG,EAAE,EAAS,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AAC1E,UAAU,GAAG;AACb,UAAU,IAAI,EAAE,OAAO;AACvB,UAAU,SAAS,EAAE,6BAA6B;AAClD,UAAU,IAAI;AACd,UAAU,QAAQ;AAClB,UAAU,QAAQ,EAAE,YAAY;AAChC,UAAU,KAAK,EAAE;AACjB;AACA;AACA,KAAK,EAAE,CAAC;AACR,oBAAoB,GAAG;AACvB,MAAM,OAAO;AACb,MAAM;AACN,QAAQ,IAAI,EAAE,MAAM;AACpB,QAAQ,SAAS,EAAE,0CAA0C;AAC7D,QAAQ,YAAY,EAAE,IAAI,CAAC,GAAG;AAC9B,QAAQ,KAAK,EAAE,QAAQ;AACvB,QAAQ,QAAQ,EAAE;AAClB;AACA;AACA,GAAG,EAAE,CAAC,EAAE,CAAC;AACT,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
1
+ {"version":3,"file":"ColorField.js","sources":["../../../../src/components/ColorField/ColorField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useUid, useControllableState } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/** `#abc` or `#aabbcc` as `#aabbcc`; anything else as `null`. */\nfunction toFullHex(text: string) {\n if (!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(text)) return null;\n return (text.length === 4 ? text.replace(/[0-9a-f]/gi, (digit) => digit + digit) : text).toLowerCase();\n}\n\n/** The text of the color field, for other languages. */\nexport interface ColorFieldLabels {\n /** The name of the text input that holds the hex code, read by screen readers. */\n hex: string;\n}\n\nconst defaultColorFieldLabels: ColorFieldLabels = { hex: 'Hex color code' };\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the color input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface ColorFieldProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the color field input element (optional). */\n id?: string;\n /** The name attribute to be applied to the color field input element (optional). */\n name?: string;\n /** Whether the color field input should be disabled (optional). */\n disabled?: boolean;\n /** The current value of the color field input (optional). */\n value?: string;\n /** The default value of the color field input (optional). */\n defaultValue?: string;\n /** Called with the new color when the user picks or types one. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** The text of the field, in English by default. */\n labels?: Partial<ColorFieldLabels>;\n}\n\n/** A color picker with a text field that shows and edits the hex value. */\nexport const ColorField = React.forwardRef<HTMLInputElement, ColorFieldProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n description,\n keepDescription,\n error,\n className,\n style,\n onChange,\n onValueChange,\n value,\n defaultValue,\n labels,\n ...others\n } = props;\n const text = { ...defaultColorFieldLabels, ...labels };\n const [internalValue, setInternalValue] = useControllableState({\n value,\n defaultValue: defaultValue ?? '',\n onChange: onValueChange,\n });\n const uid = useUid(id);\n\n // The hex text as typed: the color only follows once it is a whole code (#RGB or #RRGGBB).\n const [hexText, setHexText] = React.useState(internalValue);\n React.useEffect(() => {\n setHexText((typed) => (toFullHex(typed) === internalValue.toLowerCase() ? typed : internalValue));\n }, [internalValue]);\n\n // A whole code the value doesn't hold (a controlled field the parent didn't update) gives way to the value.\n const typedColor = toFullHex(hexText);\n const shownHex = typedColor && typedColor !== internalValue.toLowerCase() ? internalValue : hexText;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n setInternalValue(event.currentTarget.value);\n };\n const handleHexChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const typed = event.currentTarget.value;\n setHexText(typed);\n const color = toFullHex(typed);\n if (color) setInternalValue(color);\n };\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n className={className}\n style={style}\n >\n <div className=\"roaster-merged-inputs\">\n <span className=\"roaster-color-swatch roaster-merged-inputs__start\">\n <span className=\"roaster-color-swatch__preview\" style={{ backgroundColor: internalValue }} />\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, others)}\n ref={ref}\n type=\"color\"\n className=\"roaster-color-swatch__input\"\n name={name}\n disabled={disabled}\n onChange={handleChange}\n value={internalValue}\n />\n </span>\n <input\n type=\"text\"\n className=\"roaster-input roaster-merged-inputs__end\"\n aria-label={text.hex}\n value={shownHex}\n onChange={handleHexChange}\n />\n </div>\n </Field>\n );\n});\n\nColorField.displayName = 'ColorField';\n"],"names":[],"mappings":";;;;;;;AAKA,SAAS,SAAS,CAAC,IAAI,EAAE;AACzB,EAAE,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,IAAI;AAC9D,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,KAAK,KAAK,KAAK,GAAG,KAAK,CAAC,GAAG,IAAI,EAAE,WAAW,EAAE;AACxG;AACA,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,gBAAgB,EAAE;AAC7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,CAAC;AACZ,wBAAwB,GAAG;AAC3B,UAAU,OAAO;AACjB,UAAU;AACV,YAAY,IAAI,EAAE,MAAM;AACxB,YAAY,SAAS,EAAE,0CAA0C;AACjE,YAAY,YAAY,EAAE,IAAI,CAAC,GAAG;AAClC,YAAY,KAAK,EAAE,QAAQ;AAC3B,YAAY,QAAQ,EAAE;AACtB;AACA;AACA,OAAO,EAAE;AACT;AACA,GAAG;AACH,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
@@ -5,8 +5,8 @@ import { pickCalendarProps, formatDate, dateStringParser, isDateValid, getSepara
5
5
  import { Calendar } from './components/Calendar/Calendar.js';
6
6
  import { MonthGrid } from './components/MonthGrid/MonthGrid.js';
7
7
  import { TextField } from '../TextField/TextField.js';
8
- import { useMergeRefs } from '@floating-ui/react';
9
8
  import { useControllableState } from '../../utils/useControllableState/index.js';
9
+ import { useMergeRefs } from '../../utils/useMergeRefs/index.js';
10
10
 
11
11
  const DatePickerBase = React.forwardRef(function DatePicker2(props, ref) {
12
12
  const { calendarProps, others } = pickCalendarProps(props);
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { dateStringParser, formatDate, getSeparatorIndex, isDateValid, pickCalendarProps } from './utils';\n\nimport { Calendar, CalendarProps } from './components';\nimport type { CalendarLabels } from './components/Calendar/Calendar';\nimport { TextField, TextFieldProps } from '../TextField';\nimport { useMergeRefs } from '@floating-ui/react';\nimport { useControllableState } from '@/utils';\nimport { MonthGrid } from './components/MonthGrid';\nimport { DateSeparator, DateFormat, DatePickerInputError } from './utils/types';\n\nexport interface DatePickerProps\n extends\n Omit<CalendarProps, 'handleDateSelection' | 'year' | 'month' | 'selected' | 'isOpen' | 'onClose'>,\n Omit<TextFieldProps, 'onChange' | 'onValueChange' | 'defaultValue' | 'value' | 'onAbort' | 'ref'> {\n /** The separator used for the date input fields. Defaults to '-' */\n separator?: DateSeparator;\n /** The format used as input mask. Defaults to 'YYYY MM DD' */\n dateFormat?: DateFormat;\n /** Callback function that will be called when an error occurs when parsing the date */\n onInputError?(type: DatePickerInputError): string;\n /** Called with the new date, or `null` when the field is cleared. */\n onValueChange?(date: Date | null): void;\n /** Default value for uncontrolled input */\n defaultValue?: Date | null;\n /** Selected date, required with controlled input */\n value?: Date | null;\n /** The month to show, from 0 to 11. 0 is January, 1 is February ... 11 is December */\n month?: number;\n /** The year to show */\n year?: number;\n /** The text of the calendar, in English by default. */\n labels?: Partial<CalendarLabels>;\n}\n\nconst DatePickerBase = React.forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(props, ref) {\n const { calendarProps, others } = pickCalendarProps(props);\n const { labels, ...inputProps } = others as typeof others & { labels?: Partial<CalendarLabels> };\n\n const {\n month,\n year,\n onValueChange,\n onInputError,\n value: passedValue,\n disableSpecificDates,\n dateFormat,\n separator,\n minDate,\n maxDate,\n defaultValue,\n onMonthChange,\n locale,\n weekStartsOn,\n } = calendarProps;\n\n const calendarRef = React.useRef<HTMLDivElement>(null);\n const [isTextFieldFocused, setIsTextFieldFocused] = React.useState(false);\n const [inputError, setInputError] = React.useState<string | boolean>(false);\n const [currentKey, setCurrentKey] = React.useState('');\n // The calendar opens on the default date's month, if there is one.\n const [{ currentDisplayedMonth, currentDisplayedYear }, setCalendarDate] = React.useState({\n currentDisplayedMonth: defaultValue ? defaultValue.getMonth() : month,\n currentDisplayedYear: defaultValue ? defaultValue.getFullYear() : year,\n });\n\n const separatorIndex = getSeparatorIndex(dateFormat);\n\n const handleMonthChange = React.useCallback(\n (targetMonth: number, targetYear: number) => {\n setCalendarDate({ currentDisplayedMonth: targetMonth, currentDisplayedYear: targetYear });\n onMonthChange?.(targetMonth, targetYear);\n },\n [onMonthChange]\n );\n\n const [date, setDate] = useControllableState<Date | null>({\n value: passedValue,\n defaultValue: defaultValue ?? null,\n onChange: onValueChange,\n });\n\n const [inputValue, setInputValue] = React.useState(\n date instanceof Date ? formatDate(date, separator, dateFormat) : ''\n );\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n // Set while the focus goes back to the input after closing, so that focus doesn't open the calendar again.\n const returningFocus = React.useRef(false);\n const onFocus = () => {\n if (returningFocus.current) returningFocus.current = false;\n else setIsTextFieldFocused(true);\n };\n const onBlur = () => setIsTextFieldFocused(false);\n // Escape closes the calendar, and the focus goes back to the input.\n const closeToInput = React.useCallback(() => {\n setIsTextFieldFocused(false);\n // Only when the focus really moves: focusing the focused input fires no focus event to clear the flag.\n if (inputRef.current && document.activeElement !== inputRef.current) {\n returningFocus.current = true;\n inputRef.current.focus();\n }\n }, []);\n\n const handleDateSelection = React.useCallback(\n (selectedDate: Date) => {\n setInputValue(formatDate(selectedDate, separator, dateFormat));\n setDate(selectedDate);\n setCalendarDate({\n currentDisplayedMonth: selectedDate.getMonth(),\n currentDisplayedYear: selectedDate.getFullYear(),\n });\n setInputError('');\n // Chosen: the calendar closes and the focus goes back to the input.\n window.setTimeout(closeToInput, 10);\n },\n [setDate, separator, dateFormat, closeToInput]\n );\n\n // A controlled date picker shows the new value whenever the parent changes it. Compared by time, since the parent\n // may pass a new Date object for the same day on every render.\n const controlledTime = passedValue === undefined ? undefined : (passedValue?.getTime() ?? null);\n React.useEffect(() => {\n if (controlledTime === undefined) return;\n setInputValue(controlledTime === null ? '' : formatDate(new Date(controlledTime), separator, dateFormat));\n }, [controlledTime, separator, dateFormat]);\n\n function handleInputChange(value: string) {\n const valueLength = value.length;\n\n if (currentKey !== 'Backspace' && (valueLength === separatorIndex.first || valueLength === separatorIndex.second)) {\n return setInputValue(value + separator);\n }\n\n if (valueLength === 0) {\n setDate(null);\n }\n\n setInputValue(value);\n\n if (valueLength === 10) {\n const dateValue = dateStringParser(value, dateFormat, separator);\n if (!dateValue) {\n return setInputError(onInputError?.('INVALID_DATE') ?? true);\n }\n setInputError('');\n\n if (isDateValid({ date: dateValue, minDate, maxDate })) {\n return handleDateSelection(dateValue);\n }\n return setInputError(onInputError?.('OUT_OF_RANGE') ?? true);\n }\n // Still typing: the error, if any, waits for the field to lose the focus.\n setInputError('');\n }\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n others.onBlur?.(event);\n if (inputValue.length > 0 && inputValue.length < 10) setInputError(onInputError?.('INVALID_DATE') ?? true);\n };\n\n return (\n <div\n className=\"roaster-date-picker\"\n ref={calendarRef}\n // Close when the focus leaves the date picker (Tab past the calendar, or a click elsewhere).\n onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) onBlur();\n }}\n >\n <TextField\n {...inputProps}\n value={inputValue}\n ref={mergedRef}\n onFocus={onFocus}\n onBlur={handleInputBlur}\n maxLength={10}\n // The WAI-ARIA date picker combobox: a text input that opens a calendar dialog.\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={isTextFieldFocused}\n onValueChange={(value) => handleInputChange(value)}\n onKeyDown={(event) => {\n setCurrentKey(event.key);\n if (event.key === 'Escape') onBlur();\n }}\n // A typing error wins over the one the parent passes.\n error={inputError || others.error}\n />\n <Calendar\n selected={date ?? undefined}\n onClose={closeToInput}\n minDate={minDate}\n maxDate={maxDate}\n isOpen={isTextFieldFocused}\n year={currentDisplayedYear}\n month={currentDisplayedMonth}\n onMonthChange={handleMonthChange}\n handleDateSelection={handleDateSelection}\n disableSpecificDates={disableSpecificDates}\n locale={locale}\n weekStartsOn={weekStartsOn}\n labels={labels}\n />\n </div>\n );\n});\n\n/**\n * A text field with a calendar, to type or pick a date, with optional minimum and maximum dates. DatePicker.MonthGrid\n * chooses a range of whole months instead.\n */\nexport const DatePicker = Object.assign(DatePickerBase, { MonthGrid });\n"],"names":[],"mappings":";;;;;;;;;;AASA,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE;AACzE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GA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P,MAAM,QAAQ,EAAE;AAChB,wBAAwB,GAAG;AAC3B,UAAU,SAAS;AACnB,UAAU;AACV,YAAY,GAAG,UAAU;AACzB,YAAY,KAAK,EAAE,UAAU;AAC7B,YAAY,GAAG,EAAE,SAAS;AAC1B,YAAY,OAAO;AACnB,YAAY,MAAM,EAAE,eAAe;AACnC,YAAY,SAAS,EAAE,EAAE;AACzB,YAAY,IAAI,EAAE,UAAU;AAC5B,YAAY,eAAe,EAAE,QAAQ;AACrC,YAAY,eAAe,EAAE,kBAAkB;AAC/C,YAAY,aAAa,EAAE,CAAC,KAAK,KAAK,iBAAiB,CAAC,KAAK,CAAC;AAC9D,YAAY,SAAS,EAAE,CAAC,KAAK,KAAK;AAClC,cAAc,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC;AACtC,cAAc,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,MAAM,EAAE;AAClD,YAAY,CAAC;AACb,YAAY,KAAK,EAAE,UAAU,IAAI,MAAM,CAAC;AACxC;AACA,SAAS;AACT,wBAAwB,GAAG;AAC3B,UAAU,QAAQ;AAClB,UAAU;AACV,YAAY,QAAQ,EAAE,IAAI,IAAI,MAAM;AACpC,YAAY,OAAO,EAAE,YAAY;AACjC,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,MAAM,EAAE,kBAAkB;AACtC,YAAY,IAAI,EAAE,oBAAoB;AACtC,YAAY,KAAK,EAAE,qBAAqB;AACxC,YAAY,aAAa,EAAE,iBAAiB;AAC5C,YAAY,mBAAmB;AAC/B,YAAY,oBAAoB;AAChC,YAAY,MAAM;AAClB,YAAY,YAAY;AACxB,YAAY;AACZ;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC,CAAC;AACU,MAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE;;"}
1
+ {"version":3,"file":"DatePicker.js","sources":["../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import * as React from 'react';\nimport { dateStringParser, formatDate, getSeparatorIndex, isDateValid, pickCalendarProps } from './utils';\n\nimport { Calendar, CalendarProps } from './components';\nimport type { CalendarLabels } from './components/Calendar/Calendar';\nimport { TextField, TextFieldProps } from '../TextField';\nimport { useControllableState, useMergeRefs } from '@/utils';\nimport { MonthGrid } from './components/MonthGrid';\nimport { DateSeparator, DateFormat, DatePickerInputError } from './utils/types';\n\nexport interface DatePickerProps\n extends\n Omit<CalendarProps, 'handleDateSelection' | 'year' | 'month' | 'selected' | 'isOpen' | 'onClose'>,\n Omit<TextFieldProps, 'onChange' | 'onValueChange' | 'defaultValue' | 'value' | 'onAbort' | 'ref'> {\n /** The separator used for the date input fields. Defaults to '-' */\n separator?: DateSeparator;\n /** The format used as input mask. Defaults to 'YYYY MM DD' */\n dateFormat?: DateFormat;\n /** Callback function that will be called when an error occurs when parsing the date */\n onInputError?(type: DatePickerInputError): string;\n /** Called with the new date, or `null` when the field is cleared. */\n onValueChange?(date: Date | null): void;\n /** Default value for uncontrolled input */\n defaultValue?: Date | null;\n /** Selected date, required with controlled input */\n value?: Date | null;\n /** The month to show, from 0 to 11. 0 is January, 1 is February ... 11 is December */\n month?: number;\n /** The year to show */\n year?: number;\n /** The text of the calendar, in English by default. */\n labels?: Partial<CalendarLabels>;\n}\n\nconst DatePickerBase = React.forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(props, ref) {\n const { calendarProps, others } = pickCalendarProps(props);\n const { labels, ...inputProps } = others as typeof others & { labels?: Partial<CalendarLabels> };\n\n const {\n month,\n year,\n onValueChange,\n onInputError,\n value: passedValue,\n disableSpecificDates,\n dateFormat,\n separator,\n minDate,\n maxDate,\n defaultValue,\n onMonthChange,\n locale,\n weekStartsOn,\n } = calendarProps;\n\n const calendarRef = React.useRef<HTMLDivElement>(null);\n const [isTextFieldFocused, setIsTextFieldFocused] = React.useState(false);\n const [inputError, setInputError] = React.useState<string | boolean>(false);\n const [currentKey, setCurrentKey] = React.useState('');\n // The calendar opens on the default date's month, if there is one.\n const [{ currentDisplayedMonth, currentDisplayedYear }, setCalendarDate] = React.useState({\n currentDisplayedMonth: defaultValue ? defaultValue.getMonth() : month,\n currentDisplayedYear: defaultValue ? defaultValue.getFullYear() : year,\n });\n\n const separatorIndex = getSeparatorIndex(dateFormat);\n\n const handleMonthChange = React.useCallback(\n (targetMonth: number, targetYear: number) => {\n setCalendarDate({ currentDisplayedMonth: targetMonth, currentDisplayedYear: targetYear });\n onMonthChange?.(targetMonth, targetYear);\n },\n [onMonthChange]\n );\n\n const [date, setDate] = useControllableState<Date | null>({\n value: passedValue,\n defaultValue: defaultValue ?? null,\n onChange: onValueChange,\n });\n\n const [inputValue, setInputValue] = React.useState(\n date instanceof Date ? formatDate(date, separator, dateFormat) : ''\n );\n\n const inputRef = React.useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n // Set while the focus goes back to the input after closing, so that focus doesn't open the calendar again.\n const returningFocus = React.useRef(false);\n const onFocus = () => {\n if (returningFocus.current) returningFocus.current = false;\n else setIsTextFieldFocused(true);\n };\n const onBlur = () => setIsTextFieldFocused(false);\n // Escape closes the calendar, and the focus goes back to the input.\n const closeToInput = React.useCallback(() => {\n setIsTextFieldFocused(false);\n // Only when the focus really moves: focusing the focused input fires no focus event to clear the flag.\n if (inputRef.current && document.activeElement !== inputRef.current) {\n returningFocus.current = true;\n inputRef.current.focus();\n }\n }, []);\n\n const handleDateSelection = React.useCallback(\n (selectedDate: Date) => {\n setInputValue(formatDate(selectedDate, separator, dateFormat));\n setDate(selectedDate);\n setCalendarDate({\n currentDisplayedMonth: selectedDate.getMonth(),\n currentDisplayedYear: selectedDate.getFullYear(),\n });\n setInputError('');\n // Chosen: the calendar closes and the focus goes back to the input.\n window.setTimeout(closeToInput, 10);\n },\n [setDate, separator, dateFormat, closeToInput]\n );\n\n // A controlled date picker shows the new value whenever the parent changes it. Compared by time, since the parent\n // may pass a new Date object for the same day on every render.\n const controlledTime = passedValue === undefined ? undefined : (passedValue?.getTime() ?? null);\n React.useEffect(() => {\n if (controlledTime === undefined) return;\n setInputValue(controlledTime === null ? '' : formatDate(new Date(controlledTime), separator, dateFormat));\n }, [controlledTime, separator, dateFormat]);\n\n function handleInputChange(value: string) {\n const valueLength = value.length;\n\n if (currentKey !== 'Backspace' && (valueLength === separatorIndex.first || valueLength === separatorIndex.second)) {\n return setInputValue(value + separator);\n }\n\n if (valueLength === 0) {\n setDate(null);\n }\n\n setInputValue(value);\n\n if (valueLength === 10) {\n const dateValue = dateStringParser(value, dateFormat, separator);\n if (!dateValue) {\n return setInputError(onInputError?.('INVALID_DATE') ?? true);\n }\n setInputError('');\n\n if (isDateValid({ date: dateValue, minDate, maxDate })) {\n return handleDateSelection(dateValue);\n }\n return setInputError(onInputError?.('OUT_OF_RANGE') ?? true);\n }\n // Still typing: the error, if any, waits for the field to lose the focus.\n setInputError('');\n }\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n others.onBlur?.(event);\n if (inputValue.length > 0 && inputValue.length < 10) setInputError(onInputError?.('INVALID_DATE') ?? true);\n };\n\n return (\n <div\n className=\"roaster-date-picker\"\n ref={calendarRef}\n // Close when the focus leaves the date picker (Tab past the calendar, or a click elsewhere).\n onBlur={(event) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) onBlur();\n }}\n >\n <TextField\n {...inputProps}\n value={inputValue}\n ref={mergedRef}\n onFocus={onFocus}\n onBlur={handleInputBlur}\n maxLength={10}\n // The WAI-ARIA date picker combobox: a text input that opens a calendar dialog.\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={isTextFieldFocused}\n onValueChange={(value) => handleInputChange(value)}\n onKeyDown={(event) => {\n setCurrentKey(event.key);\n if (event.key === 'Escape') onBlur();\n }}\n // A typing error wins over the one the parent passes.\n error={inputError || others.error}\n />\n <Calendar\n selected={date ?? undefined}\n onClose={closeToInput}\n minDate={minDate}\n maxDate={maxDate}\n isOpen={isTextFieldFocused}\n year={currentDisplayedYear}\n month={currentDisplayedMonth}\n onMonthChange={handleMonthChange}\n handleDateSelection={handleDateSelection}\n disableSpecificDates={disableSpecificDates}\n locale={locale}\n weekStartsOn={weekStartsOn}\n labels={labels}\n />\n </div>\n );\n});\n\n/**\n * A text field with a calendar, to type or pick a date, with optional minimum and maximum dates. DatePicker.MonthGrid\n * chooses a range of whole months instead.\n */\nexport const DatePicker = Object.assign(DatePickerBase, { MonthGrid });\n"],"names":[],"mappings":";;;;;;;;;;AAQA,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE;AACzE,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,KAAK,CAAC;AAC5D,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM;AAC1C,EAAE,MAAM;AACR,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,aAAa;AACjB,IAAI,YAAY;AAChB,IAAI,KAAK,EAAE,WAAW;AACtB,IAAI,oBAAoB;AACxB,IAAI,UAAU;AACd,IAAI,SAAS;AACb,IAAI,OAAO;AACX,IAAI,OAAO;AACX,IAAI,YAAY;AAChB,IAAI,aAAa;AACjB,IAAI,MAAM;AACV,IAAI;AACJ,GAAG,GAAG,aAAa;AACnB,EAAE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACxC,EAAE,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC3E,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC3D,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;AACxD,EAAE,MAAM,CAAC,EAAE,qBAAqB,EAAE,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AACnB,YAAY,OAAO;AACnB,YAAY,MAAM,EAAE,kBAAkB;AACtC,YAAY,IAAI,EAAE,oBAAoB;AACtC,YAAY,KAAK,EAAE,qBAAqB;AACxC,YAAY,aAAa,EAAE,iBAAiB;AAC5C,YAAY,mBAAmB;AAC/B,YAAY,oBAAoB;AAChC,YAAY,MAAM;AAClB,YAAY,YAAY;AACxB,YAAY;AACZ;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC,CAAC;AACU,MAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,SAAS,EAAE;;"}
@@ -3,7 +3,8 @@ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { Button } from '../../../Button/Button.js';
4
4
  import { monthTitle, noop, getPreviousDisplayMonth, getPreviousDisplayYear, getNextDisplayMonth, getNextDisplayYear } from '../../utils/index.js';
5
5
  import { Month } from '../Month/Month.js';
6
- import { Icon } from '../../../Icon/Icon.js';
6
+ import '../../../Icon/Icon.js';
7
+ import { RoasterIcon } from '../../../Icon/RoasterIcon.js';
7
8
 
8
9
  const defaultCalendarLabels = {
9
10
  calendar: "Choose a date",
@@ -44,7 +45,7 @@ function Calendar({
44
45
  iconOnly: true,
45
46
  "aria-label": text.previousMonth,
46
47
  onClick: () => onMonthChange?.(showPreviousMonth, showPreviousYear),
47
- children: /* @__PURE__ */ jsx(Icon, { name: "arrow-left" })
48
+ children: /* @__PURE__ */ jsx(RoasterIcon, { name: "arrow-left" })
48
49
  }
49
50
  ),
50
51
  /* @__PURE__ */ jsx("span", { className: "roaster-date-picker__month", "aria-live": "polite", children: monthTitle(month, year, locale) }),
@@ -55,7 +56,7 @@ function Calendar({
55
56
  iconOnly: true,
56
57
  "aria-label": text.nextMonth,
57
58
  onClick: () => onMonthChange?.(showNextMonth, showNextYear),
58
- children: /* @__PURE__ */ jsx(Icon, { name: "arrow-right" })
59
+ children: /* @__PURE__ */ jsx(RoasterIcon, { name: "arrow-right" })
59
60
  }
60
61
  )
61
62
  ] }),
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.js","sources":["../../../../../../src/components/DatePicker/components/Calendar/Calendar.tsx"],"sourcesContent":["import { Button } from '@/components/Button';\nimport {\n getNextDisplayMonth,\n getNextDisplayYear,\n getPreviousDisplayMonth,\n getPreviousDisplayYear,\n monthTitle,\n type WeekStartsOn,\n noop,\n} from '../../utils';\n\nimport { Month } from '../Month';\nimport { Icon } from '@/components/Icon';\n\nexport interface CalendarProps {\n /**\n * The language of the month and weekday names, as a BCP 47 tag such as `fr-FR`.\n * @defaultValue 'en-US'\n */\n locale?: string;\n /**\n * The day the week starts on: 0 is Sunday, 1 Monday ... 6 Saturday.\n * @defaultValue 0\n */\n weekStartsOn?: WeekStartsOn;\n /** Mounts Calendar if true */\n isOpen?: boolean;\n /** Callback to close the calendar. */\n onClose?(): void;\n /** The selected date */\n selected?: Date;\n /** The month to show, from 0 to 11. 0 is January, 1 is February ... 11 is December */\n month: number;\n /** The year to show */\n year: number;\n /** Disable selecting dates before this. */\n minDate?: Date;\n /** Disable selecting dates after this. */\n maxDate?: Date;\n /** Disable specific dates. */\n disableSpecificDates?: Date[];\n /** Callback when date is selected. */\n handleDateSelection?(date: Date): void;\n /** Callback when month is changed. */\n onMonthChange?(month: number, year: number): void;\n}\n\n/** The text of the calendar, for other languages. */\nexport interface CalendarLabels {\n /** The name of the calendar, read by screen readers. */\n calendar: string;\n /** The name of the previous month button. */\n previousMonth: string;\n /** The name of the next month button. */\n nextMonth: string;\n}\n\nexport const defaultCalendarLabels: CalendarLabels = {\n calendar: 'Choose a date',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n};\n\nexport function Calendar({\n selected,\n month,\n year,\n minDate,\n maxDate,\n disableSpecificDates,\n onMonthChange,\n handleDateSelection = noop,\n isOpen = false,\n onClose,\n locale,\n weekStartsOn,\n labels,\n}: CalendarProps & { labels?: Partial<CalendarLabels> }) {\n const text = { ...defaultCalendarLabels, ...labels };\n const showNextYear = getNextDisplayYear(month, year);\n const showNextMonth = getNextDisplayMonth(month);\n\n const showPreviousYear = getPreviousDisplayYear(month, year);\n const showPreviousMonth = getPreviousDisplayMonth(month);\n\n if (!isOpen) return null;\n\n return (\n // A click in the calendar leaves the focus where it is: Safari doesn't focus a clicked button, so the click would\n // otherwise blur the input and close the calendar. Not an interaction of its own: the buttons inside are.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div className=\"roaster-date-picker__popup\" onMouseDown={(event) => event.preventDefault()}>\n <div className=\"roaster-date-picker__calendar\" role=\"dialog\" aria-label={text.calendar}>\n <div className=\"roaster-date-picker__nav\">\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.previousMonth}\n onClick={() => onMonthChange?.(showPreviousMonth, showPreviousYear)}\n >\n <Icon name=\"arrow-left\" />\n </Button>\n <span className=\"roaster-date-picker__month\" aria-live=\"polite\">\n {monthTitle(month, year, locale)}\n </span>\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.nextMonth}\n onClick={() => onMonthChange?.(showNextMonth, showNextYear)}\n >\n <Icon name=\"arrow-right\" />\n </Button>\n </div>\n <Month\n month={month}\n year={year}\n selected={selected}\n onChange={handleDateSelection}\n onMonthChange={onMonthChange}\n onEscape={onClose}\n minDate={minDate}\n maxDate={maxDate}\n disableSpecificDates={disableSpecificDates}\n locale={locale}\n weekStartsOn={weekStartsOn}\n />\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAaY,MAAC,qBAAqB,GAAG;AACrC,EAAE,QAAQ,EAAE,eAAe;AAC3B,EAAE,aAAa,EAAE,gBAAgB;AACjC,EAAE,SAAS,EAAE;AACb;AACO,SAAS,QAAQ,CAAC;AACzB,EAAE,QAAQ;AACV,EAAE,KAAK;AACP,EAAE,IAAI;AACN,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,oBAAoB;AACtB,EAAE,aAAa;AACf,EAAE,mBAAmB,GAAG,IAAI;AAC5B,EAAE,MAAM,GAAG,KAAK;AA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AA4B,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;AAClJ,wBAAwB,GAAG;AAC3B,UAAU,MAAM;AAChB,UAAU;AACV,YAAY,OAAO,EAAE,WAAW;AAChC,YAAY,QAAQ,EAAE,IAAI;AAC1B,YAAY,YAAY,EAAE,IAAI,CAAC,SAAS;AACxC,YAAY,OAAO,EAAE,MAAM,aAAa,GAAG,aAAa,EAAE,YAAY,CAAC;AACvE,YAAY,QAAQ,kBAAkB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;AACvE;AACA;AACA,OAAO,EAAE,CAAC;AACV,sBAAsB,GAAG;AACzB,QAAQ,KAAK;AACb,QAAQ;AACR,UAAU,KAAK;AACf,UAAU,IAAI;AACd,UAAU,QAAQ;AAClB,UAAU,QAAQ,EAAE,mBAAmB;AACvC,UAAU,aAAa;AACvB,UAAU,QAAQ,EAAE,OAAO;AAC3B,UAAU,OAAO;AACjB,UAAU,OAAO;AACjB,UAAU,oBAAoB;AAC9B,UAAU,MAAM;AAChB,UAAU;AACV;AACA;AACA,KAAK,EAAE,CAAC,EAAE;AACV;AACA;;"}
1
+ {"version":3,"file":"Calendar.js","sources":["../../../../../../src/components/DatePicker/components/Calendar/Calendar.tsx"],"sourcesContent":["import { Button } from '@/components/Button';\nimport {\n getNextDisplayMonth,\n getNextDisplayYear,\n getPreviousDisplayMonth,\n getPreviousDisplayYear,\n monthTitle,\n type WeekStartsOn,\n noop,\n} from '../../utils';\n\nimport { Month } from '../Month';\nimport { RoasterIcon } from '@/components/Icon';\n\nexport interface CalendarProps {\n /**\n * The language of the month and weekday names, as a BCP 47 tag such as `fr-FR`.\n * @defaultValue 'en-US'\n */\n locale?: string;\n /**\n * The day the week starts on: 0 is Sunday, 1 Monday ... 6 Saturday.\n * @defaultValue 0\n */\n weekStartsOn?: WeekStartsOn;\n /** Mounts Calendar if true */\n isOpen?: boolean;\n /** Callback to close the calendar. */\n onClose?(): void;\n /** The selected date */\n selected?: Date;\n /** The month to show, from 0 to 11. 0 is January, 1 is February ... 11 is December */\n month: number;\n /** The year to show */\n year: number;\n /** Disable selecting dates before this. */\n minDate?: Date;\n /** Disable selecting dates after this. */\n maxDate?: Date;\n /** Disable specific dates. */\n disableSpecificDates?: Date[];\n /** Callback when date is selected. */\n handleDateSelection?(date: Date): void;\n /** Callback when month is changed. */\n onMonthChange?(month: number, year: number): void;\n}\n\n/** The text of the calendar, for other languages. */\nexport interface CalendarLabels {\n /** The name of the calendar, read by screen readers. */\n calendar: string;\n /** The name of the previous month button. */\n previousMonth: string;\n /** The name of the next month button. */\n nextMonth: string;\n}\n\nexport const defaultCalendarLabels: CalendarLabels = {\n calendar: 'Choose a date',\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n};\n\nexport function Calendar({\n selected,\n month,\n year,\n minDate,\n maxDate,\n disableSpecificDates,\n onMonthChange,\n handleDateSelection = noop,\n isOpen = false,\n onClose,\n locale,\n weekStartsOn,\n labels,\n}: CalendarProps & { labels?: Partial<CalendarLabels> }) {\n const text = { ...defaultCalendarLabels, ...labels };\n const showNextYear = getNextDisplayYear(month, year);\n const showNextMonth = getNextDisplayMonth(month);\n\n const showPreviousYear = getPreviousDisplayYear(month, year);\n const showPreviousMonth = getPreviousDisplayMonth(month);\n\n if (!isOpen) return null;\n\n return (\n // A click in the calendar leaves the focus where it is: Safari doesn't focus a clicked button, so the click would\n // otherwise blur the input and close the calendar. Not an interaction of its own: the buttons inside are.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div className=\"roaster-date-picker__popup\" onMouseDown={(event) => event.preventDefault()}>\n <div className=\"roaster-date-picker__calendar\" role=\"dialog\" aria-label={text.calendar}>\n <div className=\"roaster-date-picker__nav\">\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.previousMonth}\n onClick={() => onMonthChange?.(showPreviousMonth, showPreviousYear)}\n >\n <RoasterIcon name=\"arrow-left\" />\n </Button>\n <span className=\"roaster-date-picker__month\" aria-live=\"polite\">\n {monthTitle(month, year, locale)}\n </span>\n <Button\n variant=\"secondary\"\n iconOnly\n aria-label={text.nextMonth}\n onClick={() => onMonthChange?.(showNextMonth, showNextYear)}\n >\n <RoasterIcon name=\"arrow-right\" />\n </Button>\n </div>\n <Month\n month={month}\n year={year}\n selected={selected}\n onChange={handleDateSelection}\n onMonthChange={onMonthChange}\n onEscape={onClose}\n minDate={minDate}\n maxDate={maxDate}\n disableSpecificDates={disableSpecificDates}\n locale={locale}\n weekStartsOn={weekStartsOn}\n />\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAaY,MAAC,qBAAqB,GAAG;AACrC,EAAE,QAAQ,EAAE,eAAe;AAC3B,EAAE,aAAa,EAAE,gBAAgB;AACjC,EAAE,SAAS,EAAE;AACb;AACO,SAAS,QAAQ,CAAC;AACzB,EAAE,QAAQ;AACV,EAAE,KAAK;AACP,EAAE,IAAI;AACN,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,oBAAoB;AACtB,EAAE,aAAa;AACf,EAAE,mBAAmB,GAAG,IAAI;AAC5B,EAAE,MAAM,GAAG,KAAK;AAChB,EAAE,OAAO;AACT,EAAE,MAAM;AACR,EAAE,YAAY;AACd,EAAE;AACF,CAAC,EAAE;AACH,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,qBAAqB,EAAE,GAAG,MAAM,EAAE;AACtD,EAAE,MAAM,YAAY,GAAG,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC;AACtD,EAAE,MAAM,aAAa,GAAG,mBAAmB,CAAC,KAAK,CAAC;AAClD,EAAE,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC;AAC9D,EAAE,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,KAAK,CAAC;AAC1D,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI;AAC1B,E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GAAG;AACzB,QAAQ,KAAK;AACb,QAAQ;AACR,UAAU,KAAK;AACf,UAAU,IAAI;AACd,UAAU,QAAQ;AAClB,UAAU,QAAQ,EAAE,mBAAmB;AACvC,UAAU,aAAa;AACvB,UAAU,QAAQ,EAAE,OAAO;AAC3B,UAAU,OAAO;AACjB,UAAU,OAAO;AACjB,UAAU,oBAAoB;AAC9B,UAAU,MAAM;AAChB,UAAU;AACV;AACA;AACA,KAAK,EAAE,CAAC,EAAE;AACV;AACA;;"}
@@ -1,8 +1,9 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
- import { useMergeRefs, FloatingFocusManager } from '@floating-ui/react';
4
+ import { FloatingFocusManager } from '@floating-ui/react';
5
5
  import { useDropdownCardContext } from '../DropdownCard.context.js';
6
+ import { useMergeRefs } from '../../../utils/useMergeRefs/index.js';
6
7
  import { useMediaQuery, PHONE_QUERY } from '../../../utils/useMediaQuery/index.js';
7
8
  import { classNames } from '../../../utils/classNames/index.js';
8
9
 
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownCardDropdown.js","sources":["../../../../../src/components/DropdownCard/components/DropdownCardDropdown.tsx"],"sourcesContent":["import * as React from 'react';\nimport { FloatingFocusManager, useMergeRefs } from '@floating-ui/react';\nimport { useDropdownCardContext } from '../DropdownCard.context';\nimport { PHONE_QUERY, classNames, useMediaQuery } from '@/utils';\n\n/** Every native `<div>` prop (`aria-label`, `className`, `style`...) is accepted and forwarded to the card. */\nexport interface DropdownCardDropdownProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * `compact`: a row or two of fields in a menu's frame, such as a sort order. `tabs`: a list of tabs beside the\n * content, with DropdownCard.Tabs.\n */\n variant?: 'default' | 'compact' | 'tabs';\n /**\n * On a phone (480px wide at most), the card rises from the window's bottom as a sheet, its full width, over the\n * dimmed page; on a wider screen it opens under its trigger as usual. Guidance: a sheet suits a large card, such as\n * filters or a date; a small one (`compact`) stays beside its trigger.\n * @defaultValue false\n */\n sheet?: boolean;\n}\n\n/**\n * The card: its content and actions. Rendered while the dropdown card is open, after its trigger, so Tab goes from one\n * to the other; fixed, so a parent's overflow doesn't cut it.\n */\nexport const DropdownCardDropdown = React.forwardRef<HTMLDivElement, DropdownCardDropdownProps>(\n ({ className, style, children, variant = 'default', sheet = false, ...props }, propRef) => {\n const { context: floatingContext, ...context } = useDropdownCardContext();\n const ref = useMergeRefs([context.refs.setFloating, propRef]);\n // A sheet on a phone is placed by the CSS, at the window's bottom, not beside its trigger.\n const asSheet = useMediaQuery(PHONE_QUERY) && sheet;\n if (!context.open) return null;\n\n return (\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={ref}\n {...context.getFloatingProps(props)}\n // After the spread, so a caller's className and style add to these instead of replacing them.\n className={classNames(\n 'roaster-dropdown-card',\n 'roaster-dropdown-card--floating',\n {\n 'roaster-dropdown-card--compact': variant === 'compact',\n 'roaster-dropdown-card--tabs': variant === 'tabs',\n 'roaster-dropdown-card--sheet': sheet,\n },\n className\n )}\n style={asSheet ? style : { ...context.floatingStyles, ...style }}\n >\n {children}\n </div>\n </FloatingFocusManager>\n );\n }\n);\n\nDropdownCardDropdown.displayName = 'DropdownCardDropdown';\n"],"names":[],"mappings":";;;;;;;;AAMY,MAAC,oBAAoB,GAAG,KAAK,CAAC,UAAU;AACpD,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,OAAO,KAAK;AAC7F,IAAI,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,GAAG,sBAAsB,EAAE;AAC7E,IAAI,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACjE,IAAI,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC,IAAI,KAAK;AACvD,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI;AAClC,IAAI,uBAAuB,GAAG,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,kBAAkB,GAAG;AAC5H,MAAM,KAAK;AACX,MAAM;AACN,QAAQ,GAAG;AACX,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC;AAC1C,QAAQ,SAAS,EAAE,UAAU;AAC7B,UAAU,uBAAuB;AACjC,UAAU,iCAAiC;AAC3C,UAAU;AACV,YAAY,gCAAgC,EAAE,OAAO,KAAK,SAAS;AACnE,YAAY,6BAA6B,EAAE,OAAO,KAAK,MAAM;AAC7D,YAAY,8BAA8B,EAAE;AAC5C,WAAW;AACX,UAAU;AACV,SAAS;AACT,QAAQ,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,KAAK,EAAE;AACxE,QAAQ;AACR;AACA,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,oBAAoB,CAAC,WAAW,GAAG,sBAAsB;;"}
1
+ {"version":3,"file":"DropdownCardDropdown.js","sources":["../../../../../src/components/DropdownCard/components/DropdownCardDropdown.tsx"],"sourcesContent":["import * as React from 'react';\nimport { FloatingFocusManager } from '@floating-ui/react';\nimport { useDropdownCardContext } from '../DropdownCard.context';\nimport { PHONE_QUERY, classNames, useMediaQuery, useMergeRefs } from '@/utils';\n\n/** Every native `<div>` prop (`aria-label`, `className`, `style`...) is accepted and forwarded to the card. */\nexport interface DropdownCardDropdownProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * `compact`: a row or two of fields in a menu's frame, such as a sort order. `tabs`: a list of tabs beside the\n * content, with DropdownCard.Tabs.\n */\n variant?: 'default' | 'compact' | 'tabs';\n /**\n * On a phone (480px wide at most), the card rises from the window's bottom as a sheet, its full width, over the\n * dimmed page; on a wider screen it opens under its trigger as usual. Guidance: a sheet suits a large card, such as\n * filters or a date; a small one (`compact`) stays beside its trigger.\n * @defaultValue false\n */\n sheet?: boolean;\n}\n\n/**\n * The card: its content and actions. Rendered while the dropdown card is open, after its trigger, so Tab goes from one\n * to the other; fixed, so a parent's overflow doesn't cut it.\n */\nexport const DropdownCardDropdown = React.forwardRef<HTMLDivElement, DropdownCardDropdownProps>(\n ({ className, style, children, variant = 'default', sheet = false, ...props }, propRef) => {\n const { context: floatingContext, ...context } = useDropdownCardContext();\n const ref = useMergeRefs([context.refs.setFloating, propRef]);\n // A sheet on a phone is placed by the CSS, at the window's bottom, not beside its trigger.\n const asSheet = useMediaQuery(PHONE_QUERY) && sheet;\n if (!context.open) return null;\n\n return (\n <FloatingFocusManager context={floatingContext} modal={false}>\n <div\n ref={ref}\n {...context.getFloatingProps(props)}\n // After the spread, so a caller's className and style add to these instead of replacing them.\n className={classNames(\n 'roaster-dropdown-card',\n 'roaster-dropdown-card--floating',\n {\n 'roaster-dropdown-card--compact': variant === 'compact',\n 'roaster-dropdown-card--tabs': variant === 'tabs',\n 'roaster-dropdown-card--sheet': sheet,\n },\n className\n )}\n style={asSheet ? style : { ...context.floatingStyles, ...style }}\n >\n {children}\n </div>\n </FloatingFocusManager>\n );\n }\n);\n\nDropdownCardDropdown.displayName = 'DropdownCardDropdown';\n"],"names":[],"mappings":";;;;;;;;;AAMY,MAAC,oBAAoB,GAAG,KAAK,CAAC,UAAU;AACpD,EAAE,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,OAAO,KAAK;AAC7F,IAAI,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,GAAG,sBAAsB,EAAE;AAC7E,IAAI,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACjE,IAAI,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC,IAAI,KAAK;AACvD,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,IAAI;AAClC,IAAI,uBAAuB,GAAG,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,kBAAkB,GAAG;AAC5H,MAAM,KAAK;AACX,MAAM;AACN,QAAQ,GAAG;AACX,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC;AAC1C,QAAQ,SAAS,EAAE,UAAU;AAC7B,UAAU,uBAAuB;AACjC,UAAU,iCAAiC;AAC3C,UAAU;AACV,YAAY,gCAAgC,EAAE,OAAO,KAAK,SAAS;AACnE,YAAY,6BAA6B,EAAE,OAAO,KAAK,MAAM;AAC7D,YAAY,8BAA8B,EAAE;AAC5C,WAAW;AACX,UAAU;AACV,SAAS;AACT,QAAQ,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,GAAG,KAAK,EAAE;AACxE,QAAQ;AACR;AACA,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,oBAAoB,CAAC,WAAW,GAAG,sBAAsB;;"}
@@ -1,7 +1,8 @@
1
1
  'use client';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
- import { Icon } from '../../Icon/Icon.js';
4
+ import '../../Icon/Icon.js';
5
+ import { RoasterIcon } from '../../Icon/RoasterIcon.js';
5
6
  import { classNames } from '../../../utils/classNames/index.js';
6
7
  import { useControllableState } from '../../../utils/useControllableState/index.js';
7
8
  import { useUid } from '../../../utils/useUid/index.js';
@@ -87,7 +88,7 @@ const DropdownCardTab = React.forwardRef(
87
88
  children: [
88
89
  icon,
89
90
  children,
90
- /* @__PURE__ */ jsx(Icon, { name: "angle-right" })
91
+ /* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-right" })
91
92
  ]
92
93
  }
93
94
  );