@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":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import { useMergeRefs } from '@floating-ui/react';\nimport * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps, type InlineFieldProps } from '../Field';\n\n/** One option of the select, as rendered. */\nexport interface SelectOption {\n /** The submitted value. */\n value: string;\n /** The text shown. */\n label: string;\n /** Whether the option can't be chosen. */\n disabled?: boolean;\n /**\n * A line under the label in a `rich` select's list. Where the browser shows its own list, it follows the label after\n * a dot.\n */\n description?: string;\n}\n\n/** The items the select understands without an `optionResolver`. */\nexport type SelectItem = string | SelectOption | { id: string | number; name?: string; title?: string };\n\n/** Turns one item of `data` into the option to render. */\nexport type OptionResolver<T> = (item: T) => SelectOption;\n\n/**\n * Strings are their own value and label, `{ id, name }` and `{ id, title }` objects use the id as the value, and any\n * other object is read as an option (`{ value, label, disabled }`).\n */\nfunction defaultOptionResolver(item: unknown): SelectOption {\n if (typeof item === 'string') return { label: item, value: item };\n\n const record = (item ?? {}) as Record<string, unknown>;\n if ('id' in record && ('name' in record || 'title' in record)) {\n return { label: String(record.name ?? record.title), value: String(record.id) };\n }\n return { ...record, value: String(record.value), label: String(record.label) } as SelectOption;\n}\n\n/**\n * Every native `<select>` prop (`name`, `value`, `required`, `aria-*`, ...) is accepted and forwarded to the select,\n * with the ref. `className` and `style` go to the field's wrapper.\n */\nexport interface SelectProps<T = SelectItem>\n extends\n FieldBaseProps,\n InlineFieldProps,\n Omit<React.ComponentPropsWithoutRef<'select'>, 'prefix' | 'className' | 'style'> {\n /**\n * The options: strings, `{ value, label }` objects, `{ id, name }` objects, or any other shape together with an\n * `optionResolver`.\n */\n options: T[];\n /** A first, empty option such as \"Choose a country\", shown until one is chosen. It can't be chosen back. */\n placeholder?: string;\n /** The element to be displayed to the left of the select field (optional). */\n prefix?: React.ReactNode;\n /** The width of the prefix element (optional). */\n prefixWidth?: number;\n /** Called with the new value when the user picks an option. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** Turns each item of `options` into an option (`{ value, label, disabled }`). Needed for shapes the select doesn't know. */\n optionResolver?: OptionResolver<T>;\n /**\n * Draws the list itself, where the browser allows it (the customizable select: Chrome, Edge, Safari): a check on the\n * chosen option, the theme's hover, and the options' descriptions. Other browsers (Firefox) show their own list.\n */\n rich?: boolean;\n}\n\n/**\n * Keeps the descriptions out of a rich select's field: the field then shows the chosen option's content (a\n * `<selectedcontent>` in a `<button>`, first in the select), whose description the CSS hides. Added after rendering,\n * and only where the browser draws the list itself: React 18 doesn't allow a button in a select, and the other\n * browsers show the option's text.\n */\nfunction useSelectedContent(ref: React.RefObject<HTMLSelectElement | null>, enabled: boolean) {\n React.useEffect(() => {\n const select = ref.current;\n // jsdom has `CSS` without `supports`.\n const drawsItsList = typeof CSS?.supports === 'function' && CSS.supports('appearance', 'base-select');\n if (!enabled || !select || !drawsItsList) return undefined;\n const button = document.createElement('button');\n button.append(document.createElement('selectedcontent'));\n select.prepend(button);\n return () => button.remove();\n }, [ref, enabled]);\n}\n\nconst SelectBase = React.forwardRef<HTMLSelectElement, SelectProps<unknown>>((props, ref) => {\n const {\n label,\n options,\n placeholder,\n description,\n prefix,\n prefixWidth = prefix ? 24 : 12,\n onChange,\n onValueChange,\n id,\n error,\n optionResolver = defaultOptionResolver,\n rich = false,\n inline,\n className,\n style,\n defaultValue,\n ...others\n } = props;\n const uid = useUid(id);\n const selectRef = React.useRef<HTMLSelectElement>(null);\n const mergedRef = useMergeRefs([selectRef, ref]);\n const items = options.map(optionResolver);\n useSelectedContent(selectRef, rich && items.some((item) => item.description));\n const optionElements = items.map((item) => (\n <option key={item.value} value={item.value} disabled={item.disabled}>\n {item.label}\n {item.description && (\n <>\n <span className=\"roaster-select__separator\"> · </span>\n <small className=\"roaster-select__description\">{item.description}</small>\n </>\n )}\n </option>\n ));\n // Uncontrolled with a placeholder and no default: start on the placeholder, which a browser would skip as disabled.\n const startValue = defaultValue ?? (placeholder !== undefined && others.value === undefined ? '' : undefined);\n\n const handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n error={error}\n inline={inline}\n className={className}\n style={style}\n >\n <div className={classNames({ 'roaster-input-group': prefix })}>\n {prefix && <span className=\"roaster-input-group__prefix\">{prefix}</span>}\n <select\n {...others}\n {...fieldControlProps(uid, { label, description, error }, others)}\n ref={mergedRef}\n className={classNames('roaster-select', { 'roaster-select--prefixed': prefix, 'roaster-select--rich': rich })}\n style={{ paddingLeft: prefixWidth }}\n defaultValue={startValue}\n onChange={handleChange}\n >\n {placeholder !== undefined && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {optionElements}\n </select>\n </div>\n </Field>\n );\n});\n\nSelectBase.displayName = 'Select';\n\n/**\n * A dropdown to choose one option, from a list of strings or objects, with an optional prefix. The type of `options`'\n * items is passed to `optionResolver`.\n */\nexport const Select = SelectBase as (<T = SelectItem>(\n props: SelectProps<T> & React.RefAttributes<HTMLSelectElement>\n) => React.ReactElement | null) & { displayName?: string };\n"],"names":[],"mappings":";;;;;;;;AAMA,SAAS,qBAAqB,CAAC,IAAI,EAAE;AACrC,EAAE,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;AACnE,EAAE,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE;AAC3B,EAAE,IAAI,IAAI,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,CAAC,EAAE;AACjE,IAAI,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,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AACA,OAAO,EAAE;AACT;AACA,GAAG;AACH,CAAC,CAAC;AACF,UAAU,CAAC,WAAW,GAAG,QAAQ;AACrB,MAAC,MAAM,GAAG;;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../../src/components/Select/Select.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useMergeRefs, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps, type InlineFieldProps } from '../Field';\n\n/** One option of the select, as rendered. */\nexport interface SelectOption {\n /** The submitted value. */\n value: string;\n /** The text shown. */\n label: string;\n /** Whether the option can't be chosen. */\n disabled?: boolean;\n /**\n * A line under the label in a `rich` select's list. Where the browser shows its own list, it follows the label after\n * a dot.\n */\n description?: string;\n}\n\n/** The items the select understands without an `optionResolver`. */\nexport type SelectItem = string | SelectOption | { id: string | number; name?: string; title?: string };\n\n/** Turns one item of `data` into the option to render. */\nexport type OptionResolver<T> = (item: T) => SelectOption;\n\n/**\n * Strings are their own value and label, `{ id, name }` and `{ id, title }` objects use the id as the value, and any\n * other object is read as an option (`{ value, label, disabled }`).\n */\nfunction defaultOptionResolver(item: unknown): SelectOption {\n if (typeof item === 'string') return { label: item, value: item };\n\n const record = (item ?? {}) as Record<string, unknown>;\n if ('id' in record && ('name' in record || 'title' in record)) {\n return { label: String(record.name ?? record.title), value: String(record.id) };\n }\n return { ...record, value: String(record.value), label: String(record.label) } as SelectOption;\n}\n\n/**\n * Every native `<select>` prop (`name`, `value`, `required`, `aria-*`, ...) is accepted and forwarded to the select,\n * with the ref. `className` and `style` go to the field's wrapper.\n */\nexport interface SelectProps<T = SelectItem>\n extends\n FieldBaseProps,\n InlineFieldProps,\n Omit<React.ComponentPropsWithoutRef<'select'>, 'prefix' | 'className' | 'style'> {\n /**\n * The options: strings, `{ value, label }` objects, `{ id, name }` objects, or any other shape together with an\n * `optionResolver`.\n */\n options: T[];\n /** A first, empty option such as \"Choose a country\", shown until one is chosen. It can't be chosen back. */\n placeholder?: string;\n /** The element to be displayed to the left of the select field (optional). */\n prefix?: React.ReactNode;\n /** The width of the prefix element (optional). */\n prefixWidth?: number;\n /** Called with the new value when the user picks an option. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** Turns each item of `options` into an option (`{ value, label, disabled }`). Needed for shapes the select doesn't know. */\n optionResolver?: OptionResolver<T>;\n /**\n * Draws the list itself, where the browser allows it (the customizable select: Chrome, Edge, Safari): a check on the\n * chosen option, the theme's hover, and the options' descriptions. Other browsers (Firefox) show their own list.\n */\n rich?: boolean;\n}\n\n/**\n * Keeps the descriptions out of a rich select's field: the field then shows the chosen option's content (a\n * `<selectedcontent>` in a `<button>`, first in the select), whose description the CSS hides. Added after rendering,\n * and only where the browser draws the list itself: React 18 doesn't allow a button in a select, and the other\n * browsers show the option's text.\n */\nfunction useSelectedContent(ref: React.RefObject<HTMLSelectElement | null>, enabled: boolean) {\n React.useEffect(() => {\n const select = ref.current;\n // jsdom has `CSS` without `supports`.\n const drawsItsList = typeof CSS?.supports === 'function' && CSS.supports('appearance', 'base-select');\n if (!enabled || !select || !drawsItsList) return undefined;\n const button = document.createElement('button');\n button.append(document.createElement('selectedcontent'));\n select.prepend(button);\n return () => button.remove();\n }, [ref, enabled]);\n}\n\nconst SelectBase = React.forwardRef<HTMLSelectElement, SelectProps<unknown>>((props, ref) => {\n const {\n label,\n options,\n placeholder,\n description,\n keepDescription,\n prefix,\n prefixWidth = prefix ? 24 : 12,\n onChange,\n onValueChange,\n id,\n error,\n optionResolver = defaultOptionResolver,\n rich = false,\n inline,\n className,\n style,\n defaultValue,\n ...others\n } = props;\n const uid = useUid(id);\n const selectRef = React.useRef<HTMLSelectElement>(null);\n const mergedRef = useMergeRefs([selectRef, ref]);\n const items = options.map(optionResolver);\n useSelectedContent(selectRef, rich && items.some((item) => item.description));\n const optionElements = items.map((item) => (\n <option key={item.value} value={item.value} disabled={item.disabled}>\n {item.label}\n {item.description && (\n <>\n <span className=\"roaster-select__separator\"> · </span>\n <small className=\"roaster-select__description\">{item.description}</small>\n </>\n )}\n </option>\n ));\n // Uncontrolled with a placeholder and no default: start on the placeholder, which a browser would skip as disabled.\n const startValue = defaultValue ?? (placeholder !== undefined && others.value === undefined ? '' : undefined);\n\n const handleChange = (event: React.ChangeEvent<HTMLSelectElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n inline={inline}\n className={className}\n style={style}\n >\n <div className={classNames({ 'roaster-input-group': prefix })}>\n {prefix && <span className=\"roaster-input-group__prefix\">{prefix}</span>}\n <select\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, others)}\n ref={mergedRef}\n className={classNames('roaster-select', { 'roaster-select--prefixed': prefix, 'roaster-select--rich': rich })}\n style={{ paddingLeft: prefixWidth }}\n defaultValue={startValue}\n onChange={handleChange}\n >\n {placeholder !== undefined && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {optionElements}\n </select>\n </div>\n </Field>\n );\n});\n\nSelectBase.displayName = 'Select';\n\n/**\n * A dropdown to choose one option, from a list of strings or objects, with an optional prefix. The type of `options`'\n * items is passed to `optionResolver`.\n */\nexport const Select = SelectBase as (<T = SelectItem>(\n props: SelectProps<T> & React.RefAttributes<HTMLSelectElement>\n) => React.ReactElement | null) & { displayName?: string };\n"],"names":[],"mappings":";;;;;;;;AAKA,SAAS,qBAAqB,CAAC,IAAI,EAAE;AACrC,EAAE,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;AACnE,EAAE,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE;AAC3B,EAAE,IAAI,IAAI,IAAI,MAAM,KAAK,MAAM,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,CAAC,EAAE;AACjE,IAAI,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,MA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AE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAC3H,cAAc;AACd;AACA;AACA;AACA,OAAO,EAAE;AACT;AACA,GAAG;AACH,CAAC,CAAC;AACF,UAAU,CAAC,WAAW,GAAG,QAAQ;AACrB,MAAC,MAAM,GAAG;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { Button } from '../Button/Button.js';
5
- import { Icon } from '../Icon/Icon.js';
5
+ import '../Icon/Icon.js';
6
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
6
7
  import { Section } from './components/Section.js';
7
8
  import { Menu } from './components/Menu.js';
8
9
  import { Back } from './components/Back.js';
@@ -106,7 +107,7 @@ const SidebarBase = React.forwardRef((props, ref) => {
106
107
  "aria-controls": sidebarId,
107
108
  "aria-expanded": drawerOpen,
108
109
  onClick: () => panelRef.current?.showPopover?.(),
109
- children: /* @__PURE__ */ jsx(Icon, { name: "bars" })
110
+ children: /* @__PURE__ */ jsx(RoasterIcon, { name: "menu" })
110
111
  }
111
112
  ),
112
113
  mobileHeader
@@ -120,7 +121,7 @@ const SidebarBase = React.forwardRef((props, ref) => {
120
121
  className: "roaster-sidebar__close",
121
122
  "aria-label": text.close,
122
123
  onClick: () => panelRef.current?.hidePopover?.(),
123
- children: /* @__PURE__ */ jsx(Icon, { name: "xmark" })
124
+ children: /* @__PURE__ */ jsx(RoasterIcon, { name: "x" })
124
125
  }
125
126
  ),
126
127
  /* @__PURE__ */ jsxs("nav", { className: "roaster-sidebar__nav", "aria-label": text.navigation, children: [
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.js","sources":["../../../../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Button } from '../Button';\nimport { Icon } from '@/components/Icon';\nimport { Section } from './components/Section';\nimport { Menu } from './components/Menu';\nimport type { MenuItemProps } from './components/MenuItem';\nimport { Back } from './components/Back';\n\n/** An item of the sidebar. Its other props (`href`, `onClick`...) go to its link. */\nexport interface SidebarItemProps extends Omit<MenuItemProps, 'children' | 'current'> {\n /** The text of the item. */\n label: React.ReactNode;\n /** The item's path: it is the current page when it matches `activePath`, and is passed to `onMenuItemClick`. */\n pathname?: string;\n /** The items under it, in a sub-menu that opens and closes. */\n subMenu?: SidebarItemProps[];\n}\n\n/** A labeled section of the sidebar, such as \"Company\" or \"Team\": a label over its items. */\nexport interface SidebarSection {\n /** The label, over the items. */\n title: React.ReactNode;\n /** A small button at the label's end, such as one that adds an item. */\n action?: React.ReactNode;\n /** The items of the section. */\n items: SidebarItemProps[];\n}\n\nconst isSection = (entry: SidebarItemProps | SidebarItemProps[] | SidebarSection): entry is SidebarSection =>\n !Array.isArray(entry) && 'items' in entry && 'title' in entry;\n\n/** The text of the sidebar, for other languages. */\nexport interface SidebarLabels {\n /** The name of the navigation, read by screen readers. */\n navigation: string;\n /** The name of the button that opens the sidebar where it is a drawer (up to 1024px). */\n open: string;\n /** The name of the button that closes it there. */\n close: string;\n}\n\nconst defaultSidebarLabels: SidebarLabels = { navigation: 'Main', open: 'Open the menu', close: 'Close the menu' };\n\n/** Every native `<aside>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface SidebarProps extends React.ComponentPropsWithoutRef<'aside'> {\n /** The top of the sidebar: the logo, buttons. */\n header?: React.ReactNode;\n /** The bottom of the sidebar: settings, the account. */\n footer?: React.ReactNode;\n /** The path of the current page: its item gets `aria-current=\"page\"`, and its sub-menu starts open. */\n activePath?: string;\n /** Next to the button that opens the sidebar where it is a drawer, such as the logo. */\n mobileHeader?: React.ReactNode;\n /**\n * The items. An array of items is a group, set apart from the next by a line or room; a section (`{ title, items }`)\n * is a group with a label over it.\n */\n items: (SidebarItemProps | SidebarItemProps[] | SidebarSection)[];\n /** Called when an item is clicked, with its pathname. */\n onMenuItemClick?: ({ itemId }: { itemId: string }) => void;\n /** The text of the sidebar, in English by default. */\n labels?: Partial<SidebarLabels>;\n}\n\nconst keyOf = (item: SidebarItemProps, index: number) => item.pathname ?? `item-${index}`;\n\nconst SidebarBase = React.forwardRef<HTMLElement, SidebarProps>((props, ref) => {\n const { mobileHeader, header, footer, activePath, onMenuItemClick, items, labels, className, id, ...others } = props;\n const text = { ...defaultSidebarLabels, ...labels };\n const sidebarId = useUid(id);\n const panelRef = React.useRef<HTMLElement | null>(null);\n const setRefs = React.useCallback(\n (panel: HTMLElement | null) => {\n panelRef.current = panel;\n if (typeof ref === 'function') ref(panel);\n else if (ref) ref.current = panel;\n },\n [ref]\n );\n\n // Whether the drawer is open, for the opener's aria-expanded. The browser opens and closes it (popover).\n const [drawerOpen, setDrawerOpen] = React.useState(false);\n React.useEffect(() => {\n const panel = panelRef.current;\n const onToggle = (event: Event) => setDrawerOpen((event as ToggleEvent).newState === 'open');\n panel?.addEventListener('toggle', onToggle);\n return () => panel?.removeEventListener('toggle', onToggle);\n }, []);\n\n // The open sub-menus, by pathname: the current page's opens with it.\n const groupOf = React.useCallback(\n (path: string | undefined) =>\n items\n .flatMap((entry) => (isSection(entry) ? entry.items : entry))\n .find((item) => item.subMenu?.some((sub) => sub.pathname === path) || (item.subMenu && item.pathname === path))\n ?.pathname,\n [items]\n );\n const [openGroups, setOpenGroups] = React.useState(() => new Set([groupOf(activePath)].filter(Boolean)));\n React.useEffect(() => {\n const group = groupOf(activePath);\n if (group) setOpenGroups((open) => (open.has(group) ? open : new Set([...open, group])));\n }, [activePath, groupOf]);\n\n function onItemClick(item: SidebarItemProps) {\n if (item.pathname !== undefined) onMenuItemClick?.({ itemId: item.pathname });\n // Where the sidebar is a drawer, choosing a page closes it.\n if (!item.subMenu?.length && drawerOpen) panelRef.current?.hidePopover?.();\n }\n\n function renderItem(item: SidebarItemProps, index: number) {\n const { pathname, subMenu, icon, label, onClick, action, suffix, detail, ...linkProps } = item;\n if (subMenu && subMenu.length > 0) {\n const groupKey = keyOf(item, index);\n return (\n <li key={groupKey}>\n <details\n className=\"roaster-sidebar__group\"\n open={openGroups.has(groupKey)}\n onToggle={(event) => {\n const isOpen = event.currentTarget.open;\n setOpenGroups((open) => {\n if (open.has(groupKey) === isOpen) return open;\n const next = new Set(open);\n if (isOpen) next.add(groupKey);\n else next.delete(groupKey);\n return next;\n });\n }}\n >\n <summary className=\"roaster-sidebar__item\" onClick={() => onItemClick(item)}>\n {icon && <span className=\"roaster-sidebar__icon\">{icon}</span>}\n {label}\n {suffix != null && <span className=\"roaster-sidebar__end\">{suffix}</span>}\n {action && <span className=\"roaster-sidebar__end\">{action}</span>}\n </summary>\n <Menu.SubMenu>{subMenu.map((sub, subIndex) => renderItem(sub, subIndex))}</Menu.SubMenu>\n </details>\n </li>\n );\n }\n return (\n <Menu.Item\n key={keyOf(item, index)}\n {...linkProps}\n icon={icon}\n action={action}\n suffix={suffix}\n detail={detail}\n current={pathname !== undefined && pathname === activePath}\n onClick={(event) => {\n onClick?.(event);\n onItemClick(item);\n }}\n >\n {label}\n </Menu.Item>\n );\n }\n\n // `popover` isn't in React 18's types.\n const popover = { popover: 'auto' } as React.HTMLAttributes<HTMLElement>;\n\n return (\n <>\n <div className=\"roaster-sidebar-opener\">\n <Button\n variant=\"ghost\"\n iconOnly\n aria-label={text.open}\n aria-controls={sidebarId}\n aria-expanded={drawerOpen}\n onClick={() => panelRef.current?.showPopover?.()}\n >\n <Icon name=\"bars\" />\n </Button>\n {mobileHeader}\n </div>\n\n <aside {...others} {...popover} id={sidebarId} ref={setRefs} className={classNames('roaster-sidebar', className)}>\n <Button\n variant=\"secondary\"\n iconOnly\n className=\"roaster-sidebar__close\"\n aria-label={text.close}\n onClick={() => panelRef.current?.hidePopover?.()}\n >\n <Icon name=\"xmark\" />\n </Button>\n <nav className=\"roaster-sidebar__nav\" aria-label={text.navigation}>\n <Section className=\"roaster-sidebar__header\">{header}</Section>\n <Section className=\"roaster-sidebar__body\">\n {items.map((item, index) =>\n isSection(item) ? (\n <section\n key={`section-${index}`}\n className=\"roaster-sidebar__section\"\n aria-labelledby={`${sidebarId}-section-${index}`}\n >\n <h2 className=\"roaster-sidebar__label\" id={`${sidebarId}-section-${index}`}>\n {item.title}\n {item.action}\n </h2>\n <Menu>{item.items.map(renderItem)}</Menu>\n </section>\n ) : Array.isArray(item) ? (\n <Menu key={`group-${keyOf(item[0] ?? { label: '' }, index)}`}>{item.map(renderItem)}</Menu>\n ) : (\n <Menu key={`group-${keyOf(item, index)}`}>{renderItem(item, index)}</Menu>\n )\n )}\n </Section>\n <Section className=\"roaster-sidebar__footer\">{footer}</Section>\n </nav>\n </aside>\n </>\n );\n});\n\nSidebarBase.displayName = 'Sidebar';\n\n/**\n * The navigation of an application: a header (the logo, or the account button with a Sidebar.Back under it), groups\n * of items with sub-menus (`<details>`), labeled sections, and a footer. The current\n * page's item has `aria-current=\"page\"`. Up to a tablet's width (1024px), it is a drawer (a popover) that a bar at the\n * top opens, with a close button beside it.\n */\nexport const Sidebar = Object.assign(SidebarBase, { Section: Section, Menu: Menu, Back: Back });\n"],"names":[],"mappings":";;;;;;;;;;;AASA,MAAM,SAAS,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK;AAC1F,MAAM,oBAAoB,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE;AACnG,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC/D,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACrD,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE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CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;;"}
1
+ {"version":3,"file":"Sidebar.js","sources":["../../../../src/components/Sidebar/Sidebar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Button } from '../Button';\nimport { RoasterIcon } from '@/components/Icon';\nimport { Section } from './components/Section';\nimport { Menu } from './components/Menu';\nimport type { MenuItemProps } from './components/MenuItem';\nimport { Back } from './components/Back';\n\n/** An item of the sidebar. Its other props (`href`, `onClick`...) go to its link. */\nexport interface SidebarItemProps extends Omit<MenuItemProps, 'children' | 'current'> {\n /** The text of the item. */\n label: React.ReactNode;\n /** The item's path: it is the current page when it matches `activePath`, and is passed to `onMenuItemClick`. */\n pathname?: string;\n /** The items under it, in a sub-menu that opens and closes. */\n subMenu?: SidebarItemProps[];\n}\n\n/** A labeled section of the sidebar, such as \"Company\" or \"Team\": a label over its items. */\nexport interface SidebarSection {\n /** The label, over the items. */\n title: React.ReactNode;\n /** A small button at the label's end, such as one that adds an item. */\n action?: React.ReactNode;\n /** The items of the section. */\n items: SidebarItemProps[];\n}\n\nconst isSection = (entry: SidebarItemProps | SidebarItemProps[] | SidebarSection): entry is SidebarSection =>\n !Array.isArray(entry) && 'items' in entry && 'title' in entry;\n\n/** The text of the sidebar, for other languages. */\nexport interface SidebarLabels {\n /** The name of the navigation, read by screen readers. */\n navigation: string;\n /** The name of the button that opens the sidebar where it is a drawer (up to 1024px). */\n open: string;\n /** The name of the button that closes it there. */\n close: string;\n}\n\nconst defaultSidebarLabels: SidebarLabels = { navigation: 'Main', open: 'Open the menu', close: 'Close the menu' };\n\n/** Every native `<aside>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface SidebarProps extends React.ComponentPropsWithoutRef<'aside'> {\n /** The top of the sidebar: the logo, buttons. */\n header?: React.ReactNode;\n /** The bottom of the sidebar: settings, the account. */\n footer?: React.ReactNode;\n /** The path of the current page: its item gets `aria-current=\"page\"`, and its sub-menu starts open. */\n activePath?: string;\n /** Next to the button that opens the sidebar where it is a drawer, such as the logo. */\n mobileHeader?: React.ReactNode;\n /**\n * The items. An array of items is a group, set apart from the next by a line or room; a section (`{ title, items }`)\n * is a group with a label over it.\n */\n items: (SidebarItemProps | SidebarItemProps[] | SidebarSection)[];\n /** Called when an item is clicked, with its pathname. */\n onMenuItemClick?: ({ itemId }: { itemId: string }) => void;\n /** The text of the sidebar, in English by default. */\n labels?: Partial<SidebarLabels>;\n}\n\nconst keyOf = (item: SidebarItemProps, index: number) => item.pathname ?? `item-${index}`;\n\nconst SidebarBase = React.forwardRef<HTMLElement, SidebarProps>((props, ref) => {\n const { mobileHeader, header, footer, activePath, onMenuItemClick, items, labels, className, id, ...others } = props;\n const text = { ...defaultSidebarLabels, ...labels };\n const sidebarId = useUid(id);\n const panelRef = React.useRef<HTMLElement | null>(null);\n const setRefs = React.useCallback(\n (panel: HTMLElement | null) => {\n panelRef.current = panel;\n if (typeof ref === 'function') ref(panel);\n else if (ref) ref.current = panel;\n },\n [ref]\n );\n\n // Whether the drawer is open, for the opener's aria-expanded. The browser opens and closes it (popover).\n const [drawerOpen, setDrawerOpen] = React.useState(false);\n React.useEffect(() => {\n const panel = panelRef.current;\n const onToggle = (event: Event) => setDrawerOpen((event as ToggleEvent).newState === 'open');\n panel?.addEventListener('toggle', onToggle);\n return () => panel?.removeEventListener('toggle', onToggle);\n }, []);\n\n // The open sub-menus, by pathname: the current page's opens with it.\n const groupOf = React.useCallback(\n (path: string | undefined) =>\n items\n .flatMap((entry) => (isSection(entry) ? entry.items : entry))\n .find((item) => item.subMenu?.some((sub) => sub.pathname === path) || (item.subMenu && item.pathname === path))\n ?.pathname,\n [items]\n );\n const [openGroups, setOpenGroups] = React.useState(() => new Set([groupOf(activePath)].filter(Boolean)));\n React.useEffect(() => {\n const group = groupOf(activePath);\n if (group) setOpenGroups((open) => (open.has(group) ? open : new Set([...open, group])));\n }, [activePath, groupOf]);\n\n function onItemClick(item: SidebarItemProps) {\n if (item.pathname !== undefined) onMenuItemClick?.({ itemId: item.pathname });\n // Where the sidebar is a drawer, choosing a page closes it.\n if (!item.subMenu?.length && drawerOpen) panelRef.current?.hidePopover?.();\n }\n\n function renderItem(item: SidebarItemProps, index: number) {\n const { pathname, subMenu, icon, label, onClick, action, suffix, detail, ...linkProps } = item;\n if (subMenu && subMenu.length > 0) {\n const groupKey = keyOf(item, index);\n return (\n <li key={groupKey}>\n <details\n className=\"roaster-sidebar__group\"\n open={openGroups.has(groupKey)}\n onToggle={(event) => {\n const isOpen = event.currentTarget.open;\n setOpenGroups((open) => {\n if (open.has(groupKey) === isOpen) return open;\n const next = new Set(open);\n if (isOpen) next.add(groupKey);\n else next.delete(groupKey);\n return next;\n });\n }}\n >\n <summary className=\"roaster-sidebar__item\" onClick={() => onItemClick(item)}>\n {icon && <span className=\"roaster-sidebar__icon\">{icon}</span>}\n {label}\n {suffix != null && <span className=\"roaster-sidebar__end\">{suffix}</span>}\n {action && <span className=\"roaster-sidebar__end\">{action}</span>}\n </summary>\n <Menu.SubMenu>{subMenu.map((sub, subIndex) => renderItem(sub, subIndex))}</Menu.SubMenu>\n </details>\n </li>\n );\n }\n return (\n <Menu.Item\n key={keyOf(item, index)}\n {...linkProps}\n icon={icon}\n action={action}\n suffix={suffix}\n detail={detail}\n current={pathname !== undefined && pathname === activePath}\n onClick={(event) => {\n onClick?.(event);\n onItemClick(item);\n }}\n >\n {label}\n </Menu.Item>\n );\n }\n\n // `popover` isn't in React 18's types.\n const popover = { popover: 'auto' } as React.HTMLAttributes<HTMLElement>;\n\n return (\n <>\n <div className=\"roaster-sidebar-opener\">\n <Button\n variant=\"ghost\"\n iconOnly\n aria-label={text.open}\n aria-controls={sidebarId}\n aria-expanded={drawerOpen}\n onClick={() => panelRef.current?.showPopover?.()}\n >\n <RoasterIcon name=\"menu\" />\n </Button>\n {mobileHeader}\n </div>\n\n <aside {...others} {...popover} id={sidebarId} ref={setRefs} className={classNames('roaster-sidebar', className)}>\n <Button\n variant=\"secondary\"\n iconOnly\n className=\"roaster-sidebar__close\"\n aria-label={text.close}\n onClick={() => panelRef.current?.hidePopover?.()}\n >\n <RoasterIcon name=\"x\" />\n </Button>\n <nav className=\"roaster-sidebar__nav\" aria-label={text.navigation}>\n <Section className=\"roaster-sidebar__header\">{header}</Section>\n <Section className=\"roaster-sidebar__body\">\n {items.map((item, index) =>\n isSection(item) ? (\n <section\n key={`section-${index}`}\n className=\"roaster-sidebar__section\"\n aria-labelledby={`${sidebarId}-section-${index}`}\n >\n <h2 className=\"roaster-sidebar__label\" id={`${sidebarId}-section-${index}`}>\n {item.title}\n {item.action}\n </h2>\n <Menu>{item.items.map(renderItem)}</Menu>\n </section>\n ) : Array.isArray(item) ? (\n <Menu key={`group-${keyOf(item[0] ?? { label: '' }, index)}`}>{item.map(renderItem)}</Menu>\n ) : (\n <Menu key={`group-${keyOf(item, index)}`}>{renderItem(item, index)}</Menu>\n )\n )}\n </Section>\n <Section className=\"roaster-sidebar__footer\">{footer}</Section>\n </nav>\n </aside>\n </>\n );\n});\n\nSidebarBase.displayName = 'Sidebar';\n\n/**\n * The navigation of an application: a header (the logo, or the account button with a Sidebar.Back under it), groups\n * of items with sub-menus (`<details>`), labeled sections, and a footer. The current\n * page's item has `aria-current=\"page\"`. Up to a tablet's width (1024px), it is a drawer (a popover) that a bar at the\n * top opens, with a close button beside it.\n */\nexport const Sidebar = Object.assign(SidebarBase, { Section: Section, Menu: Menu, Back: Back });\n"],"names":[],"mappings":";;;;;;;;;;;;AASA,MAAM,SAAS,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK;AAC1F,MAAM,oBAAoB,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE;AACnG,MAAM,KA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KAAK,CAAC,CAAC,CAAC;AACrP,SAAS,EAAE,CAAC;AACZ,wBAAwB,GAAG,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,yBAAyB,EAAE,QAAQ,EAAE,MAAM,EAAE;AAC/F,OAAO,EAAE;AACT,KAAK,EAAE;AACP,GAAG,EAAE,CAAC;AACN,CAAC,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,SAAS;AACvB,MAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE;;"}
@@ -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
 
@@ -9,10 +10,13 @@ const Back = React.forwardRef(
9
10
  ({ children, asChild = false, className, ...others }, ref) => {
10
11
  const classes = classNames("roaster-sidebar__back", className);
11
12
  if (asChild && React.isValidElement(children)) {
12
- return /* @__PURE__ */ jsx(Slot, { ...others, ref, className: classes, children: React.cloneElement(children, void 0, [/* @__PURE__ */ jsx(Icon, { name: "chevron-left" }, "arrow"), children.props.children]) });
13
+ return /* @__PURE__ */ jsx(Slot, { ...others, ref, className: classes, children: React.cloneElement(children, void 0, [
14
+ /* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-left" }, "arrow"),
15
+ children.props.children
16
+ ]) });
13
17
  }
14
18
  return /* @__PURE__ */ jsxs("a", { ...others, ref, className: classes, children: [
15
- /* @__PURE__ */ jsx(Icon, { name: "chevron-left" }),
19
+ /* @__PURE__ */ jsx(RoasterIcon, { name: "chevron-left" }),
16
20
  children
17
21
  ] });
18
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Back.js","sources":["../../../../../src/components/Sidebar/components/Back.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, Slot } from '@/utils';\nimport { Icon } from '@/components/Icon';\n\n/** Every native `<a>` prop (`href`, `onClick`, ...) is accepted and forwarded to the link. */\nexport interface BackProps extends React.ComponentPropsWithoutRef<'a'> {\n /** Where it leads back to, such as \"Settings\" for the settings' navigation. */\n children: React.ReactNode;\n /**\n * Renders the only child (a router's Link) as the link, with the arrow before its text.\n * @defaultValue false\n */\n asChild?: boolean;\n}\n\n/** The way back out of a nested navigation, such as from the settings to the app: in the header, under the account. */\nexport const Back = React.forwardRef<HTMLAnchorElement, BackProps>(\n ({ children, asChild = false, className, ...others }, ref) => {\n const classes = classNames('roaster-sidebar__back', className);\n if (asChild && React.isValidElement<{ children?: React.ReactNode }>(children)) {\n return (\n <Slot {...others} ref={ref as React.Ref<HTMLElement>} className={classes}>\n {React.cloneElement(children, undefined, [<Icon key=\"arrow\" name=\"chevron-left\" />, children.props.children])}\n </Slot>\n );\n }\n return (\n <a {...others} ref={ref} className={classes}>\n <Icon name=\"chevron-left\" />\n {children}\n </a>\n );\n }\n);\nBack.displayName = 'SidebarBack';\n"],"names":[],"mappings":";;;;;;;AAKY,MAAC,IAAI,GAAG,KAAK,CAAC,UAAU;AACpC,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAChE,IAAI,MAAM,OAAO,GAAG,UAAU,CAAC,uBAAuB,EAAE,SAAS,CAAC;AAClE,IAAI,IAAI,OAAO,IAAI,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;AACnD,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;AACvN,IAAI;AACJ,IAAI,uBAAuB,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE;AACrF,sBAAsB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;AACzD,MAAM;AACN,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,IAAI,CAAC,WAAW,GAAG,aAAa;;"}
1
+ {"version":3,"file":"Back.js","sources":["../../../../../src/components/Sidebar/components/Back.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, Slot } from '@/utils';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** Every native `<a>` prop (`href`, `onClick`, ...) is accepted and forwarded to the link. */\nexport interface BackProps extends React.ComponentPropsWithoutRef<'a'> {\n /** Where it leads back to, such as \"Settings\" for the settings' navigation. */\n children: React.ReactNode;\n /**\n * Renders the only child (a router's Link) as the link, with the arrow before its text.\n * @defaultValue false\n */\n asChild?: boolean;\n}\n\n/** The way back out of a nested navigation, such as from the settings to the app: in the header, under the account. */\nexport const Back = React.forwardRef<HTMLAnchorElement, BackProps>(\n ({ children, asChild = false, className, ...others }, ref) => {\n const classes = classNames('roaster-sidebar__back', className);\n if (asChild && React.isValidElement<{ children?: React.ReactNode }>(children)) {\n return (\n <Slot {...others} ref={ref as React.Ref<HTMLElement>} className={classes}>\n {React.cloneElement(children, undefined, [\n <RoasterIcon key=\"arrow\" name=\"chevron-left\" />,\n children.props.children,\n ])}\n </Slot>\n );\n }\n return (\n <a {...others} ref={ref} className={classes}>\n <RoasterIcon name=\"chevron-left\" />\n {children}\n </a>\n );\n }\n);\nBack.displayName = 'SidebarBack';\n"],"names":[],"mappings":";;;;;;;;AAKY,MAAC,IAAI,GAAG,KAAK,CAAC,UAAU;AACpC,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAChE,IAAI,MAAM,OAAO,GAAG,UAAU,CAAC,uBAAuB,EAAE,SAAS,CAAC;AAClE,IAAI,IAAI,OAAO,IAAI,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;AACnD,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE;AAC5H,wBAAwB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC;AAC3E,QAAQ,QAAQ,CAAC,KAAK,CAAC;AACvB,OAAO,CAAC,EAAE,CAAC;AACX,IAAI;AACJ,IAAI,uBAAuB,IAAI,CAAC,GAAG,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE;AACrF,sBAAsB,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;AAChE,MAAM;AACN,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,IAAI,CAAC,WAAW,GAAG,aAAa;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { Tooltip } from '../Tooltip/Tooltip.js';
5
- import { Icon } from '../Icon/Icon.js';
5
+ import '../Icon/Icon.js';
6
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
6
7
  import { Progress } from '../Progress/Progress.js';
7
8
  import { useUid } from '../../utils/useUid/index.js';
8
9
  import { classNames } from '../../utils/classNames/index.js';
@@ -21,7 +22,7 @@ const StatCardBase = React.forwardRef((props, ref) => {
21
22
  children: [
22
23
  /* @__PURE__ */ jsx("div", { className: "roaster-stat-card__header", children: /* @__PURE__ */ jsxs("p", { className: "roaster-stat-card__title", children: [
23
24
  /* @__PURE__ */ jsx("span", { id: titleId, children: title }),
24
- description && /* @__PURE__ */ jsx(Tooltip, { label: description, children: /* @__PURE__ */ jsx("button", { className: "roaster-stat-card__info", type: "button", "aria-label": text.info, children: /* @__PURE__ */ jsx(Icon, { name: "circle-info" }) }) })
25
+ description && /* @__PURE__ */ jsx(Tooltip, { label: description, children: /* @__PURE__ */ jsx("button", { className: "roaster-stat-card__info", type: "button", "aria-label": text.info, children: /* @__PURE__ */ jsx(RoasterIcon, { name: "info" }) }) })
25
26
  ] }) }),
26
27
  /* @__PURE__ */ jsxs("div", { className: "roaster-stat-card__body", children: [
27
28
  /* @__PURE__ */ jsxs("div", { className: "roaster-stat-card__text", children: [
@@ -1 +1 @@
1
- {"version":3,"file":"StatCard.js","sources":["../../../../src/components/StatCard/StatCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Tooltip } from '../Tooltip';\nimport { Icon } from '@/components/Icon';\nimport { Progress } from '../Progress';\n\n/** The text of the stat card, for other languages. */\nexport interface StatCardLabels {\n /** The name of the button that shows the description, read by screen readers. */\n info: string;\n}\n\nconst defaultStatCardLabels: StatCardLabels = { info: 'More information' };\n\n/** Every native `<article>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface StatCardProps extends Omit<React.ComponentPropsWithoutRef<'article'>, 'title'> {\n /** The title of the statistic. It also names the ring. */\n title: React.ReactNode;\n /** The value of the statistic. */\n value: React.ReactNode;\n /** What the statistic means, in a tooltip on an info button next to the title. */\n description?: React.ReactNode;\n /** A ring showing the value as a percentage, from 0 to 100. */\n progressValue?: number;\n /** The line under the value, such as \"20 emails clicked\". */\n progressLabel?: string;\n /** The text of the card, in English by default. */\n labels?: Partial<StatCardLabels>;\n /** The shadow of a clickable card, on a card the page sets apart (the theme may give other cards none). */\n raised?: boolean;\n}\n\nconst StatCardBase = React.forwardRef<HTMLElement, StatCardProps>((props, ref) => {\n const { title, value, description, progressValue, progressLabel, labels, raised, className, ...others } = props;\n const text = { ...defaultStatCardLabels, ...labels };\n const titleId = useUid();\n return (\n <article\n {...others}\n ref={ref}\n className={classNames('roaster-stat-card', { 'roaster-stat-card--raised': raised }, className)}\n >\n <div className=\"roaster-stat-card__header\">\n <p className=\"roaster-stat-card__title\">\n <span id={titleId}>{title}</span>\n {description && (\n <Tooltip label={description}>\n <button className=\"roaster-stat-card__info\" type=\"button\" aria-label={text.info}>\n <Icon name=\"circle-info\" />\n </button>\n </Tooltip>\n )}\n </p>\n </div>\n\n <div className=\"roaster-stat-card__body\">\n <div className=\"roaster-stat-card__text\">\n <span className=\"roaster-stat-card__value\">{value}</span>\n <small className=\"roaster-stat-card__description\">{progressLabel}</small>\n </div>\n\n {progressValue !== undefined && progressValue >= 0 && (\n <Progress variant=\"circular\" value={progressValue} aria-labelledby={titleId} />\n )}\n </div>\n </article>\n );\n});\n\nStatCardBase.displayName = 'StatCard';\n\n/** Every native `<div>` prop is accepted and forwarded to it. */\nexport interface StatCardGroupProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The stat cards. */\n children: React.ReactNode;\n /**\n * `compact`: figures in a row without frames, such as a table's totals. `headline`: a report's head figures, each\n * name underlined in dots where it has a `title` that explains it; a group holding one card shows its figure larger.\n */\n variant?: 'default' | 'compact' | 'headline';\n}\n\n/** A row of stat cards. */\nexport const StatCardGroup = React.forwardRef<HTMLDivElement, StatCardGroupProps>(\n ({ children, variant = 'default', className, ...others }, ref) => (\n <div\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-stat-card-group',\n { [`roaster-stat-card-group--${variant}`]: variant !== 'default' },\n className\n )}\n >\n {children}\n </div>\n )\n);\nStatCardGroup.displayName = 'StatCardGroup';\n\n/** A card showing one statistic: a title, a value, a line under it and an optional ring. StatCard.Group sets them in a row. */\nexport const StatCard = Object.assign(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K,EAAE,aAAa,EAAE;;"}
1
+ {"version":3,"file":"StatCard.js","sources":["../../../../src/components/StatCard/StatCard.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Tooltip } from '../Tooltip';\nimport { RoasterIcon } from '@/components/Icon';\nimport { Progress } from '../Progress';\n\n/** The text of the stat card, for other languages. */\nexport interface StatCardLabels {\n /** The name of the button that shows the description, read by screen readers. */\n info: string;\n}\n\nconst defaultStatCardLabels: StatCardLabels = { info: 'More information' };\n\n/** Every native `<article>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface StatCardProps extends Omit<React.ComponentPropsWithoutRef<'article'>, 'title'> {\n /** The title of the statistic. It also names the ring. */\n title: React.ReactNode;\n /** The value of the statistic. */\n value: React.ReactNode;\n /** What the statistic means, in a tooltip on an info button next to the title. */\n description?: React.ReactNode;\n /** A ring showing the value as a percentage, from 0 to 100. */\n progressValue?: number;\n /** The line under the value, such as \"20 emails clicked\". */\n progressLabel?: string;\n /** The text of the card, in English by default. */\n labels?: Partial<StatCardLabels>;\n /** The shadow of a clickable card, on a card the page sets apart (the theme may give other cards none). */\n raised?: boolean;\n}\n\nconst StatCardBase = React.forwardRef<HTMLElement, StatCardProps>((props, ref) => {\n const { title, value, description, progressValue, progressLabel, labels, raised, className, ...others } = props;\n const text = { ...defaultStatCardLabels, ...labels };\n const titleId = useUid();\n return (\n <article\n {...others}\n ref={ref}\n className={classNames('roaster-stat-card', { 'roaster-stat-card--raised': raised }, className)}\n >\n <div className=\"roaster-stat-card__header\">\n <p className=\"roaster-stat-card__title\">\n <span id={titleId}>{title}</span>\n {description && (\n <Tooltip label={description}>\n <button className=\"roaster-stat-card__info\" type=\"button\" aria-label={text.info}>\n <RoasterIcon name=\"info\" />\n </button>\n </Tooltip>\n )}\n </p>\n </div>\n\n <div className=\"roaster-stat-card__body\">\n <div className=\"roaster-stat-card__text\">\n <span className=\"roaster-stat-card__value\">{value}</span>\n <small className=\"roaster-stat-card__description\">{progressLabel}</small>\n </div>\n\n {progressValue !== undefined && progressValue >= 0 && (\n <Progress variant=\"circular\" value={progressValue} aria-labelledby={titleId} />\n )}\n </div>\n </article>\n );\n});\n\nStatCardBase.displayName = 'StatCard';\n\n/** Every native `<div>` prop is accepted and forwarded to it. */\nexport interface StatCardGroupProps extends React.ComponentPropsWithoutRef<'div'> {\n /** The stat cards. */\n children: React.ReactNode;\n /**\n * `compact`: figures in a row without frames, such as a table's totals. `headline`: a report's head figures, each\n * name underlined in dots where it has a `title` that explains it; a group holding one card shows its figure larger.\n */\n variant?: 'default' | 'compact' | 'headline';\n}\n\n/** A row of stat cards. */\nexport const StatCardGroup = React.forwardRef<HTMLDivElement, StatCardGroupProps>(\n ({ children, variant = 'default', className, ...others }, ref) => (\n <div\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-stat-card-group',\n { [`roaster-stat-card-group--${variant}`]: variant !== 'default' },\n className\n )}\n >\n {children}\n </div>\n )\n);\nStatCardGroup.displayName = 'StatCardGroup';\n\n/** A card showing one statistic: a title, a value, a line under it and an optional ring. StatCard.Group sets them in a row. */\nexport const StatCard = Object.assign(StatCardBase, { Group: StatCardGroup });\n"],"names":[],"mappings":";;;;;;;;;;AAOA,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,kBAAkB,EAAE;AAC1D,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AACjH,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,qBAAqB,EAAE,GAAG,MAAM,EAAE;AACtD,EAAE,MAAM,OAAO,GAAG,MAAM,EAAE;AAC1B,EAAE,uBAAuB,IAAI;AAC7B,IAAI,SAAS;AACb,IAAI;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QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAE;AACnK,SAAS,EAAE;AACX;AACA;AACA,GAAG;AACH,CAAC,CAAC;AACF,YAAY,CAAC,WAAW,GAAG,UAAU;AACzB,MAAC,aAAa,GAAG,KAAK,CAAC,UAAU;AAC7C,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG;AACvF,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG;AACT,MAAM,SAAS,EAAE,UAAU;AAC3B,QAAQ,yBAAyB;AACjC,QAAQ,EAAE,CAAC,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,KAAK,SAAS,EAAE;AAC1E,QAAQ;AACR,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA,aAAa,CAAC,WAAW,GAAG,eAAe;AAC/B,MAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE;;"}
@@ -14,6 +14,7 @@ const Switch = React.forwardRef((props, ref) => {
14
14
  checked: checkedProp,
15
15
  defaultChecked = false,
16
16
  description,
17
+ keepDescription,
17
18
  error,
18
19
  className,
19
20
  style,
@@ -39,6 +40,7 @@ const Switch = React.forwardRef((props, ref) => {
39
40
  controlId: uid,
40
41
  label: beside ? void 0 : label,
41
42
  description,
43
+ keepDescription,
42
44
  error,
43
45
  className,
44
46
  style,
@@ -47,7 +49,11 @@ const Switch = React.forwardRef((props, ref) => {
47
49
  "input",
48
50
  {
49
51
  ...others,
50
- ...fieldControlProps(uid, { description, error }, others),
52
+ ...fieldControlProps(
53
+ uid,
54
+ { description, error, keepDescription },
55
+ others
56
+ ),
51
57
  ref,
52
58
  type: "checkbox",
53
59
  role: "switch",
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useUid, useControllableState } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the switch input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface SwitchProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the switch element (optional). */\n id?: string;\n /** The name attribute to be applied to the switch element (optional). */\n name?: string;\n /** Whether the switch toggle should be disabled (optional). */\n disabled?: boolean;\n /** The checked state of the switch toggle, for a controlled switch (optional). */\n checked?: boolean;\n /** The default checked state of the switch toggle, for an uncontrolled switch (optional). */\n defaultChecked?: boolean;\n /** Called with the new state when the user toggles the switch. The native `onChange` gets the event. */\n onCheckedChange?(value: boolean): void;\n /**\n * Where the label goes: over the switch, as a field's label (`top`), or beside it (`end`), as a checkbox's, such as\n * in a list of settings.\n * @defaultValue 'top'\n */\n labelPosition?: 'top' | 'end';\n}\n\n/**\n * A toggle switch with a label, over it or beside it. Control it with checked and onCheckedChange, or leave it\n * uncontrolled with defaultChecked.\n */\nexport const Switch = React.forwardRef<HTMLInputElement, SwitchProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n checked: checkedProp,\n defaultChecked = false,\n description,\n error,\n className,\n style,\n onChange,\n onCheckedChange,\n labelPosition = 'top',\n ...others\n } = props;\n const beside = labelPosition === 'end';\n const [checked, setChecked] = useControllableState<boolean>({\n value: checkedProp,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n\n const uid = useUid(id);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n setChecked(event.currentTarget.checked);\n };\n\n return (\n <Field\n controlId={uid}\n label={beside ? undefined : label}\n description={description}\n error={error}\n className={className}\n style={style}\n >\n {/* Its own label too, so a click on the toggle reaches the input; beside it, it holds the text. */}\n <label className=\"roaster-switch\">\n <input\n {...others}\n {...fieldControlProps(uid, { label: beside ? undefined : label, description, error }, others)}\n ref={ref}\n type=\"checkbox\"\n role=\"switch\"\n className=\"roaster-switch__input\"\n name={name}\n checked={checked}\n disabled={disabled}\n onChange={handleChange}\n />\n <span className=\"roaster-switch__track\" />\n {beside && label && <span className=\"roaster-switch__label\">{label}</span>}\n </label>\n </Field>\n );\n});\n\nSwitch.displayName = 'Switch';\n"],"names":[],"mappings":";;;;;;;AAKY,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACvD,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,QAAQ;AACZ,IAAI,OAAO,EAAE,WAAW;AACxB,IAAI,cAAc,GAAG,KAAK;AAC1B,IAAI,WAAW;AACf,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,QAAQ;AACZ,IAAI,eAAe;AACnB,IAAI,aAAa,GAAG,KAAK;AACzB,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,MAAM,GAAG,aAAa,KAAK,KAAK;AACxC,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,oBAAoB,CAAC;AACrD,IAAI,KAAK,EAAE,WAAW;AACtB,IAAI,YAAY,EAAE,cAAc,IAAI,KAAK;AACzC,IAAI,QAAQ,EAAE;AACd,GAAG,CAAC;AACJ,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;AAC3C,EAAE,CAAC;AACH,EAAE,uBAAuB,GAAG;AAC5B,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,SAAS,EAAE,GAAG;AACpB,MAAM,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK;AACpC,MAAM,WAAW;AACjB,MAAM,KAAK;AACX,MAAM,SAAS;AACf,MAAM,KAAK;AACX,MAAM,QAAQ,kBAAkB,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE;AACvF,wBAAwB,GAAG;AAC3B,UAAU,OAAO;AACjB,UAAU;AACV,YAAY,GAAG,MAAM;AACrB,YAAY,GAAG,iBAAiB,CAAC,GAAG,EAAE,EAAkC,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AACrG,YAAY,GAAG;AACf,YAAY,IAAI,EAAE,UAAU;AAC5B,YAAY,IAAI,EAAE,QAAQ;AAC1B,YAAY,SAAS,EAAE,uBAAuB;AAC9C,YAAY,IAAI;AAChB,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ,EAAE;AACtB;AACA,SAAS;AACT,wBAAwB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAC3E,QAAQ,MAAM,IAAI,KAAK,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,KAAK,EAAE;AAC9G,OAAO,EAAE;AACT;AACA,GAAG;AACH,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useUid, useControllableState } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the switch input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface SwitchProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the switch element (optional). */\n id?: string;\n /** The name attribute to be applied to the switch element (optional). */\n name?: string;\n /** Whether the switch toggle should be disabled (optional). */\n disabled?: boolean;\n /** The checked state of the switch toggle, for a controlled switch (optional). */\n checked?: boolean;\n /** The default checked state of the switch toggle, for an uncontrolled switch (optional). */\n defaultChecked?: boolean;\n /** Called with the new state when the user toggles the switch. The native `onChange` gets the event. */\n onCheckedChange?(value: boolean): void;\n /**\n * Where the label goes: over the switch, as a field's label (`top`), or beside it (`end`), as a checkbox's, such as\n * in a list of settings.\n * @defaultValue 'top'\n */\n labelPosition?: 'top' | 'end';\n}\n\n/**\n * A toggle switch with a label, over it or beside it. Control it with checked and onCheckedChange, or leave it\n * uncontrolled with defaultChecked.\n */\nexport const Switch = React.forwardRef<HTMLInputElement, SwitchProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n checked: checkedProp,\n defaultChecked = false,\n description,\n keepDescription,\n error,\n className,\n style,\n onChange,\n onCheckedChange,\n labelPosition = 'top',\n ...others\n } = props;\n const beside = labelPosition === 'end';\n const [checked, setChecked] = useControllableState<boolean>({\n value: checkedProp,\n defaultValue: defaultChecked ?? false,\n onChange: onCheckedChange,\n });\n\n const uid = useUid(id);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n setChecked(event.currentTarget.checked);\n };\n\n return (\n <Field\n controlId={uid}\n label={beside ? undefined : label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n className={className}\n style={style}\n >\n {/* Its own label too, so a click on the toggle reaches the input; beside it, it holds the text. */}\n <label className=\"roaster-switch\">\n <input\n {...others}\n {...fieldControlProps(\n uid,\n { label: beside ? undefined : label, description, error, keepDescription },\n others\n )}\n ref={ref}\n type=\"checkbox\"\n role=\"switch\"\n className=\"roaster-switch__input\"\n name={name}\n checked={checked}\n disabled={disabled}\n onChange={handleChange}\n />\n <span className=\"roaster-switch__track\" />\n {beside && label && <span className=\"roaster-switch__label\">{label}</span>}\n </label>\n </Field>\n );\n});\n\nSwitch.displayName = 'Switch';\n"],"names":[],"mappings":";;;;;;;AAKY,MAAC,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACvD,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,IAAI;AACR,IAAI,QAAQ;AACZ,IAAI,OAAO,EAAE,WAAW;AACxB,IAAI,cAAc,GAAG,KAAK;AAC1B,IAAI,WAAW;AACf,IAAI,eAAe;AACnB,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,QAAQ;AACZ,IAAI,eAAe;AACnB,IAAI,aAAa,GAAG,KAAK;AACzB,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,MAAM,GAAG,aAAa,KAAK,KAAK;AACxC,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,oBAAoB,CAAC;AACrD,IAAI,KAAK,EAAE,WAAW;AACtB,IAAI,YAAY,EAAE,cAAc,IAAI,KAAK;AACzC,IAAI,QAAQ,EAAE;AACd,GAAG,CAAC;AACJ,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;AAC3C,EAAE,CAAC;AACH,EAAE,uBAAuB,GAAG;AAC5B,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,SAAS,EAAE,GAAG;AACpB,MAAM,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK;AACpC,MAAM,WAAW;AACjB,MAAM,eAAe;AACrB,MAAM,KAAK;AACX,MAAM,SAAS;AACf,MAAM,KAAK;AACX,MAAM,QAAQ,kBAAkB,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAE;AACvF,wBAAwB,GAAG;AAC3B,UAAU,OAAO;AACjB,UAAU;AACV,YAAY,GAAG,MAAM;AACrB,YAAY,GAAG,iBAAiB;AAChC,cAAc,GAAG;AACjB,cAAc,EAAkC,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE;AACrF,cAAc;AACd,aAAa;AACb,YAAY,GAAG;AACf,YAAY,IAAI,EAAE,UAAU;AAC5B,YAAY,IAAI,EAAE,QAAQ;AAC1B,YAAY,SAAS,EAAE,uBAAuB;AAC9C,YAAY,IAAI;AAChB,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ,EAAE;AACtB;AACA,SAAS;AACT,wBAAwB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAC3E,QAAQ,MAAM,IAAI,KAAK,oBAAoB,GAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,KAAK,EAAE;AAC9G,OAAO,EAAE;AACT;AACA,GAAG;AACH,CAAC;AACD,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
@@ -2,7 +2,8 @@
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { Tooltip } from '../../Tooltip/Tooltip.js';
5
- import { Icon } from '../../Icon/Icon.js';
5
+ import '../../Icon/Icon.js';
6
+ import { RoasterIcon } from '../../Icon/RoasterIcon.js';
6
7
  import { TableLabelsContext } from '../labels.js';
7
8
  import { classNames } from '../../../utils/classNames/index.js';
8
9
 
@@ -13,7 +14,7 @@ const TableHeadCell = React.forwardRef(
13
14
  title,
14
15
  children,
15
16
  description && " ",
16
- description && /* @__PURE__ */ jsx(Tooltip, { placement: "bottom", ...tooltipProps, label: description, children: /* @__PURE__ */ jsx("button", { className: "roaster-table__info", type: "button", "aria-label": text.columnInfo, children: /* @__PURE__ */ jsx(Icon, { name: "circle-info" }) }) })
17
+ description && /* @__PURE__ */ jsx(Tooltip, { placement: "bottom", ...tooltipProps, label: description, children: /* @__PURE__ */ jsx("button", { className: "roaster-table__info", type: "button", "aria-label": text.columnInfo, children: /* @__PURE__ */ jsx(RoasterIcon, { name: "info" }) }) })
17
18
  ] }) });
18
19
  }
19
20
  );
@@ -24,7 +25,7 @@ const TableSortButton = React.forwardRef(
24
25
  const sort = React.useContext(SortContext);
25
26
  return /* @__PURE__ */ jsxs("button", { ...props, ref, type, className: classNames("roaster-table__sort", className), children: [
26
27
  children,
27
- sort && /* @__PURE__ */ jsx(Icon, { name: sort === "ascending" ? "arrow-up" : "arrow-down" })
28
+ sort && /* @__PURE__ */ jsx(RoasterIcon, { name: sort === "ascending" ? "arrow-up" : "arrow-down" })
28
29
  ] });
29
30
  }
30
31
  );
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeadCell.js","sources":["../../../../../src/components/Table/components/TableHeadCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Tooltip, TooltipProps } from '@/components/Tooltip';\nimport { Icon } from '@/components/Icon';\nimport type { TableColumnPriority, TableDataType } from '../Table.types';\nimport { TableLabelsContext } from '../labels';\nimport { classNames } from '@/utils';\n\n/** Every native `<th>` prop is accepted and forwarded to it. */\nexport interface TableHeadCellBaseProps extends Omit<React.ComponentPropsWithoutRef<'th'>, 'title'> {\n /** The column's kind of data, which aligns its cells (`data-type`). */\n type: TableDataType;\n /** What the column means, in a tooltip on an info button after the title. */\n description?: React.ReactNode;\n /** The tooltip's other props, such as `placement`. */\n tooltipProps?: Omit<TooltipProps, 'children' | 'label'>;\n /** How the column sorts the rows (`aria-sort`), with an arrow after its Table.SortButton's title. */\n sort?: 'ascending' | 'descending';\n /** `secondary`: hidden on a phone, with its column (give the column the same priority in `Table`'s `columns`). */\n priority?: TableColumnPriority;\n}\n\nexport interface TableHeadCellPropsWithChildren extends TableHeadCellBaseProps {\n /** The title of the column. */\n children?: React.ReactNode;\n title?: never;\n}\n\nexport interface TableHeadCellPropsWithTitle extends TableHeadCellBaseProps {\n children?: never;\n /** The title of the column. */\n title?: React.ReactNode;\n}\n\nexport type TableHeadCellProps = TableHeadCellPropsWithChildren | TableHeadCellPropsWithTitle;\n\n/** A column title, with an optional info button that shows the column's description. */\nexport const TableHeadCell = React.forwardRef<HTMLTableCellElement, TableHeadCellProps>(\n ({ title, type, description, tooltipProps, sort, priority, children, ...props }, ref) => {\n const text = React.useContext(TableLabelsContext);\n return (\n <th {...props} ref={ref} data-type={type} data-priority={priority} aria-sort={sort}>\n <SortContext.Provider value={sort}>\n {title}\n {children}\n {description && ' '}\n {description && (\n <Tooltip placement=\"bottom\" {...tooltipProps} label={description}>\n <button className=\"roaster-table__info\" type=\"button\" aria-label={text.columnInfo}>\n <Icon name=\"circle-info\" />\n </button>\n </Tooltip>\n )}\n </SortContext.Provider>\n </th>\n );\n }\n);\n\nTableHeadCell.displayName = 'TableHeadCell';\n\nconst SortContext = React.createContext<TableHeadCellBaseProps['sort']>(undefined);\n\n/** Every native `<button>` prop is accepted and forwarded to it. */\nexport interface TableSortButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n /** The column's title. */\n children: React.ReactNode;\n}\n\n/**\n * A sortable column's title, as a button: it sorts the rows, or opens a menu of sort orders (in ActionList.Trigger).\n * The column's `sort` adds its arrow.\n */\nexport const TableSortButton = React.forwardRef<HTMLButtonElement, TableSortButtonProps>(\n ({ children, className, type = 'button', ...props }, ref) => {\n const sort = React.useContext(SortContext);\n return (\n <button {...props} ref={ref} type={type} className={classNames('roaster-table__sort', className)}>\n {children}\n {sort && <Icon name={sort === 'ascending' ? 'arrow-up' : 'arrow-down'} />}\n </button>\n );\n }\n);\nTableSortButton.displayName = 'TableSortButton';\n"],"names":[],"mappings":";;;;;;;;AAOY,MAAC,aAAa,GAAG,KAAK,CAAC,UAAU;AAC7C,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,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AE,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE;AACpI,MAAM,QAAQ;AACd,MAAM,IAAI,oBAAoB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,KAAK,WAAW,GAAG,UAAU,GAAG,YAAY,EAAE;AAClG,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,eAAe,CAAC,WAAW,GAAG,iBAAiB;;"}
1
+ {"version":3,"file":"TableHeadCell.js","sources":["../../../../../src/components/Table/components/TableHeadCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Tooltip, TooltipProps } from '@/components/Tooltip';\nimport { RoasterIcon } from '@/components/Icon';\nimport type { TableColumnPriority, TableDataType } from '../Table.types';\nimport { TableLabelsContext } from '../labels';\nimport { classNames } from '@/utils';\n\n/** Every native `<th>` prop is accepted and forwarded to it. */\nexport interface TableHeadCellBaseProps extends Omit<React.ComponentPropsWithoutRef<'th'>, 'title'> {\n /** The column's kind of data, which aligns its cells (`data-type`). */\n type: TableDataType;\n /** What the column means, in a tooltip on an info button after the title. */\n description?: React.ReactNode;\n /** The tooltip's other props, such as `placement`. */\n tooltipProps?: Omit<TooltipProps, 'children' | 'label'>;\n /** How the column sorts the rows (`aria-sort`), with an arrow after its Table.SortButton's title. */\n sort?: 'ascending' | 'descending';\n /** `secondary`: hidden on a phone, with its column (give the column the same priority in `Table`'s `columns`). */\n priority?: TableColumnPriority;\n}\n\nexport interface TableHeadCellPropsWithChildren extends TableHeadCellBaseProps {\n /** The title of the column. */\n children?: React.ReactNode;\n title?: never;\n}\n\nexport interface TableHeadCellPropsWithTitle extends TableHeadCellBaseProps {\n children?: never;\n /** The title of the column. */\n title?: React.ReactNode;\n}\n\nexport type TableHeadCellProps = TableHeadCellPropsWithChildren | TableHeadCellPropsWithTitle;\n\n/** A column title, with an optional info button that shows the column's description. */\nexport const TableHeadCell = React.forwardRef<HTMLTableCellElement, TableHeadCellProps>(\n ({ title, type, description, tooltipProps, sort, priority, children, ...props }, ref) => {\n const text = React.useContext(TableLabelsContext);\n return (\n <th {...props} ref={ref} data-type={type} data-priority={priority} aria-sort={sort}>\n <SortContext.Provider value={sort}>\n {title}\n {children}\n {description && ' '}\n {description && (\n <Tooltip placement=\"bottom\" {...tooltipProps} label={description}>\n <button className=\"roaster-table__info\" type=\"button\" aria-label={text.columnInfo}>\n <RoasterIcon name=\"info\" />\n </button>\n </Tooltip>\n )}\n </SortContext.Provider>\n </th>\n );\n }\n);\n\nTableHeadCell.displayName = 'TableHeadCell';\n\nconst SortContext = React.createContext<TableHeadCellBaseProps['sort']>(undefined);\n\n/** Every native `<button>` prop is accepted and forwarded to it. */\nexport interface TableSortButtonProps extends React.ComponentPropsWithoutRef<'button'> {\n /** The column's title. */\n children: React.ReactNode;\n}\n\n/**\n * A sortable column's title, as a button: it sorts the rows, or opens a menu of sort orders (in ActionList.Trigger).\n * The column's `sort` adds its arrow.\n */\nexport const TableSortButton = React.forwardRef<HTMLButtonElement, TableSortButtonProps>(\n ({ children, className, type = 'button', ...props }, ref) => {\n const sort = React.useContext(SortContext);\n return (\n <button {...props} ref={ref} type={type} className={classNames('roaster-table__sort', className)}>\n {children}\n {sort && <RoasterIcon name={sort === 'ascending' ? 'arrow-up' : 'arrow-down'} />}\n </button>\n );\n }\n);\nTableSortButton.displayName = 'TableSortButton';\n"],"names":[],"mappings":";;;;;;;;;AAOY,MAAC,aAAa,GAAG,KAAK,CAAC,UAAU;AAC7C,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AAC3F,IAAI,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC;AACrD,IAAI,uBAAuB,GAAG,CAAC,IAAI,EAAE,E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IAAI,EAAE,IAAI,KAAK,WAAW,GAAG,UAAU,GAAG,YAAY,EAAE;AACzG,KAAK,EAAE,CAAC;AACR,EAAE;AACF;AACA,eAAe,CAAC,WAAW,GAAG,iBAAiB;;"}
@@ -3,7 +3,8 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
4
  import { TagGroup } from './TagGroup.js';
5
5
  import { ButtonIcon } from '../ButtonIcon/ButtonIcon.js';
6
- import { Icon } from '../Icon/Icon.js';
6
+ import '../Icon/Icon.js';
7
+ import { RoasterIcon } from '../Icon/RoasterIcon.js';
7
8
  import { classNames } from '../../utils/classNames/index.js';
8
9
 
9
10
  const TagBase = React.forwardRef(
@@ -24,7 +25,7 @@ const TagBase = React.forwardRef(
24
25
  ),
25
26
  children: [
26
27
  children,
27
- onRemove && /* @__PURE__ */ jsx(ButtonIcon, { className: "roaster-tag__remove", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx(Icon, { name: "xmark" }) })
28
+ onRemove && /* @__PURE__ */ jsx(ButtonIcon, { className: "roaster-tag__remove", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx(RoasterIcon, { name: "x" }) })
28
29
  ]
29
30
  }
30
31
  );
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { TagGroup } from './TagGroup';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Icon } from '@/components/Icon';\n\n/** The tones of a tag. */\nexport type TagTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n\n/** The text of the tag, for other languages. */\nexport interface TagLabels {\n /** The name of the remove button, read by screen readers. By default \"Remove\" and the tag's text, when it is text. */\n remove: string;\n}\n\n/**\n * Every native `<span>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it, except the obsolete\n * `color`, left out so that v1's `color` prop is an error rather than ignored: use `tone`.\n */\nexport interface TagProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {\n /** The content of the tag: text, with an optional icon. */\n children: React.ReactNode;\n /** Shows a remove button, which calls it. */\n onRemove?(): void;\n /**\n * The tone of the tag.\n * @defaultValue 'neutral'\n */\n tone?: TagTone;\n /**\n * `outline` draws an edge instead of a fill, such as for a role (\"Admin\") or a state that asks for nothing; `solid`\n * fills it with the inverted color, such as for a plan name (\"Pro\"); `inline` is a soft pill in a sentence, at the\n * text's own size, such as what the sentence counts.\n */\n variant?: 'outline' | 'solid' | 'inline';\n /** `small` is a lower tag, such as beside a name in a comment's header. */\n size?: 'small';\n /** The text of the tag, in English by default. */\n labels?: Partial<TagLabels>;\n}\n\nconst TagBase = React.forwardRef<HTMLSpanElement, TagProps>(\n ({ children, onRemove, tone = 'neutral', variant, size, labels, className, ...others }, ref) => {\n const text = typeof children === 'string' || typeof children === 'number' ? ` ${children}` : '';\n const removeLabel = labels?.remove ?? `Remove${text}`;\n return (\n <span\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-tag',\n `roaster-tag--${tone}`,\n variant && `roaster-tag--${variant}`,\n size && `roaster-tag--${size}`,\n className\n )}\n >\n {children}\n {onRemove && (\n <ButtonIcon className=\"roaster-tag__remove\" aria-label={removeLabel} onClick={onRemove}>\n <Icon name=\"xmark\" />\n </ButtonIcon>\n )}\n </span>\n );\n }\n);\n\nTagBase.displayName = 'Tag';\n\n/** Every native `<span>` prop is accepted and forwarded to it. */\nexport interface TagDotProps extends React.ComponentPropsWithoutRef<'span'> {\n /**\n * The dot's color, such as a label's: a tone, or `primary`. By default the text's color.\n */\n tone?: TagTone | 'primary';\n}\n\n/** A colored dot before a tag's text, such as a label's color. Hidden from screen readers: the text says it. */\nconst TagDot = React.forwardRef<HTMLSpanElement, TagDotProps>(({ tone, className, ...others }, ref) => (\n <span\n aria-hidden=\"true\"\n {...others}\n ref={ref}\n className={classNames('roaster-tag__dot', tone && `roaster-icon-${tone === 'neutral' ? 'muted' : tone}`, className)}\n />\n));\n\nTagDot.displayName = 'Tag.Dot';\n\n/**\n * A small label in a tone (neutral, info, success, warning or danger), optionally removable with a labelled button.\n * Group tags with Tag.Group; Tag.Dot is a colored dot before the text.\n */\nexport const Tag = Object.assign(TagBase, { Group: TagGroup, Dot: TagDot });\n"],"names":[],"mappings":";;;;;;;;AAOA,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU;AAChC,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,KAAK;AAClG,IAAI,MAAM,IAAI,GAAG,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE;AACnG,IAAI,MAAM,WAAW,GAAG,MAAM,EAAE,MAAM,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACzD,IAAI,uBAAuB,IAAI;AAC/B,MAAM,MAAM;AACZ,MAAM;AACN,QAAQ,GAAG,MAAM;AACjB,QAAQ,GAAG;AACX,QAAQ,SAAS,EAAE,UAAU;AAC7B,UAAU,aAAa;AACvB,UAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAChC,UAAU,OAAO,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC9C,UAAU,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AACxC,UAAU;AACV,SAAS;AACT,QAAQ,QAAQ,EAAE;AAClB,UAAU,QAAQ;AAClB,UAAU,QAAQ,oBAAoB,GAAG,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,kBAAkB,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE;AAChM;AACA;AACA,KAAK;AACL,EAAE;AACF,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,KAAK;AAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG;AAC5F,EAAE,MAAM;AACR,EAAE;AACF,IAAI,aAAa,EAAE,MAAM;AACzB,IAAI,GAAG,MAAM;AACb,IAAI,GAAG;AACP,IAAI,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,KAAK,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS;AACtH;AACA,CAAC,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,SAAS;AAClB,MAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE;;"}
1
+ {"version":3,"file":"Tag.js","sources":["../../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\nimport { TagGroup } from './TagGroup';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** The tones of a tag. */\nexport type TagTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n\n/** The text of the tag, for other languages. */\nexport interface TagLabels {\n /** The name of the remove button, read by screen readers. By default \"Remove\" and the tag's text, when it is text. */\n remove: string;\n}\n\n/**\n * Every native `<span>` prop (`id`, `aria-*`, `data-*`, ...) is accepted and forwarded to it, except the obsolete\n * `color`, left out so that v1's `color` prop is an error rather than ignored: use `tone`.\n */\nexport interface TagProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {\n /** The content of the tag: text, with an optional icon. */\n children: React.ReactNode;\n /** Shows a remove button, which calls it. */\n onRemove?(): void;\n /**\n * The tone of the tag.\n * @defaultValue 'neutral'\n */\n tone?: TagTone;\n /**\n * `outline` draws an edge instead of a fill, such as for a role (\"Admin\") or a state that asks for nothing; `solid`\n * fills it with the inverted color, such as for a plan name (\"Pro\"); `inline` is a soft pill in a sentence, at the\n * text's own size, such as what the sentence counts.\n */\n variant?: 'outline' | 'solid' | 'inline';\n /** `small` is a lower tag, such as beside a name in a comment's header. */\n size?: 'small';\n /** The text of the tag, in English by default. */\n labels?: Partial<TagLabels>;\n}\n\nconst TagBase = React.forwardRef<HTMLSpanElement, TagProps>(\n ({ children, onRemove, tone = 'neutral', variant, size, labels, className, ...others }, ref) => {\n const text = typeof children === 'string' || typeof children === 'number' ? ` ${children}` : '';\n const removeLabel = labels?.remove ?? `Remove${text}`;\n return (\n <span\n {...others}\n ref={ref}\n className={classNames(\n 'roaster-tag',\n `roaster-tag--${tone}`,\n variant && `roaster-tag--${variant}`,\n size && `roaster-tag--${size}`,\n className\n )}\n >\n {children}\n {onRemove && (\n <ButtonIcon className=\"roaster-tag__remove\" aria-label={removeLabel} onClick={onRemove}>\n <RoasterIcon name=\"x\" />\n </ButtonIcon>\n )}\n </span>\n );\n }\n);\n\nTagBase.displayName = 'Tag';\n\n/** Every native `<span>` prop is accepted and forwarded to it. */\nexport interface TagDotProps extends React.ComponentPropsWithoutRef<'span'> {\n /**\n * The dot's color, such as a label's: a tone, or `primary`. By default the text's color.\n */\n tone?: TagTone | 'primary';\n}\n\n/** A colored dot before a tag's text, such as a label's color. Hidden from screen readers: the text says it. */\nconst TagDot = React.forwardRef<HTMLSpanElement, TagDotProps>(({ tone, className, ...others }, ref) => (\n <span\n aria-hidden=\"true\"\n {...others}\n ref={ref}\n className={classNames('roaster-tag__dot', tone && `roaster-icon-${tone === 'neutral' ? 'muted' : tone}`, className)}\n />\n));\n\nTagDot.displayName = 'Tag.Dot';\n\n/**\n * A small label in a tone (neutral, info, success, warning or danger), optionally removable with a labelled button.\n * Group tags with Tag.Group; Tag.Dot is a col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K,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqB,GAAG;AAC5F,EAAE,MAAM;AACR,EAAE;AACF,IAAI,aAAa,EAAE,MAAM;AACzB,IAAI,GAAG,MAAM;AACb,IAAI,GAAG;AACP,IAAI,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,IAAI,IAAI,CAAC,aAAa,EAAE,IAAI,KAAK,SAAS,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS;AACtH;AACA,CAAC,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,SAAS;AAClB,MAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE;;"}
@@ -16,6 +16,7 @@ const TextField = React.forwardRef((props, ref) => {
16
16
  onChange,
17
17
  onValueChange,
18
18
  description,
19
+ keepDescription,
19
20
  rightSection,
20
21
  type = "text",
21
22
  variant,
@@ -34,7 +35,7 @@ const TextField = React.forwardRef((props, ref) => {
34
35
  "input",
35
36
  {
36
37
  ...others,
37
- ...fieldControlProps(uid, { description, error }, others),
38
+ ...fieldControlProps(uid, { description, error, keepDescription }, others),
38
39
  ref,
39
40
  type,
40
41
  onChange: handleChange,
@@ -56,6 +57,7 @@ const TextField = React.forwardRef((props, ref) => {
56
57
  controlId: uid,
57
58
  label,
58
59
  description,
60
+ keepDescription,
59
61
  error,
60
62
  inline,
61
63
  className,
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","sources":["../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, Slot, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps, type InlineFieldProps } from '../Field';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface TextFieldProps\n extends\n FieldBaseProps,\n InlineFieldProps,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'prefix' | 'className' | 'style'> {\n /** `plain` has no edge or fill, such as a reply's field in a card's footer. The focus ring stays. */\n variant?: 'plain';\n /** A prefix to display before the input. */\n prefix?: React.ReactNode;\n /** A suffix to display after the input. */\n suffix?: React.ReactNode;\n /** A section to display on the right side of the input. */\n rightSection?: React.ReactNode;\n /** Called with the new value when the user changes it. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** The type of the input element, such as text, email, tel, url, number, or password. */\n type?: 'text' | 'email' | 'tel' | 'url' | 'number' | 'password';\n}\n\n/**\n * A single-line text field with a label, help text, error message, and an optional prefix, suffix or right-hand\n * section.\n */\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>((props, ref) => {\n const {\n id,\n label,\n error,\n prefix,\n suffix,\n onChange,\n onValueChange,\n description,\n rightSection,\n type = 'text',\n variant,\n inline,\n className,\n style,\n ...others\n } = props;\n\n const uid = useUid(id);\n const hasRightSection = rightSection != null && rightSection !== false && rightSection !== '';\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n const input = (\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error }, others)}\n ref={ref}\n type={type}\n onChange={handleChange}\n className={classNames('roaster-input', variant && `roaster-input--${variant}`, {\n 'roaster-merged-inputs__start': hasRightSection,\n 'roaster-input--prefixed': prefix,\n 'roaster-input--suffixed': suffix,\n })}\n />\n );\n // The prefix and suffix sit over the input, in a group as wide as it.\n const control =\n prefix || suffix ? (\n <div className=\"roaster-input-group\">\n {prefix && <span className=\"roaster-input-group__prefix\">{prefix}</span>}\n {input}\n {suffix && <span className=\"roaster-input-group__suffix\">{suffix}</span>}\n </div>\n ) : (\n input\n );\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n error={error}\n inline={inline}\n className={className}\n style={style}\n >\n {hasRightSection ? (\n <div className=\"roaster-merged-inputs\">\n {control}\n {/* An element (a Button) takes the class; text is wrapped first. */}\n <Slot className=\"roaster-merged-inputs__end\">\n {React.isValidElement(rightSection) ? rightSection : <span>{rightSection}</span>}\n </Slot>\n </div>\n ) : (\n control\n )}\n </Field>\n );\n});\n\nTextField.displayName = 'TextField';\n"],"names":[],"mappings":";;;;;;;;AAKY,MAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1D,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,KAAK;AACT,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,aAAa;AACjB,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,IAAI,GAAG,MAAM;AACjB,IAAI,OAAO;AACX,IAAI,MAAM;AACV,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,eAAe,GAAG,YAAY,IAAI,IAAI,IAAI,YAAY,KAAK,KAAK,IAAI,YAAY,KAAK,EAAE;AAC/F,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC;AAC9C,EAAE,CAAC;AACH,EAAE,MAAM,KAAK,mBAAmB,GAAG;AACnC,IAAI,OAAO;AACX,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,EAAS,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AACtE,MAAM,GAAG;AACT,MAAM,IAAI;AACV,MAAM,QAAQ,EAAE,YAAY;AAC5B,MAAM,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,O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../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, Slot, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps, type InlineFieldProps } from '../Field';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface TextFieldProps\n extends\n FieldBaseProps,\n InlineFieldProps,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'prefix' | 'className' | 'style'> {\n /** `plain` has no edge or fill, such as a reply's field in a card's footer. The focus ring stays. */\n variant?: 'plain';\n /** A prefix to display before the input. */\n prefix?: React.ReactNode;\n /** A suffix to display after the input. */\n suffix?: React.ReactNode;\n /** A section to display on the right side of the input. */\n rightSection?: React.ReactNode;\n /** Called with the new value when the user changes it. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** The type of the input element, such as text, email, tel, url, number, or password. */\n type?: 'text' | 'email' | 'tel' | 'url' | 'number' | 'password';\n}\n\n/**\n * A single-line text field with a label, help text, error message, and an optional prefix, suffix or right-hand\n * section.\n */\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>((props, ref) => {\n const {\n id,\n label,\n error,\n prefix,\n suffix,\n onChange,\n onValueChange,\n description,\n keepDescription,\n rightSection,\n type = 'text',\n variant,\n inline,\n className,\n style,\n ...others\n } = props;\n\n const uid = useUid(id);\n const hasRightSection = rightSection != null && rightSection !== false && rightSection !== '';\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n const input = (\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, others)}\n ref={ref}\n type={type}\n onChange={handleChange}\n className={classNames('roaster-input', variant && `roaster-input--${variant}`, {\n 'roaster-merged-inputs__start': hasRightSection,\n 'roaster-input--prefixed': prefix,\n 'roaster-input--suffixed': suffix,\n })}\n />\n );\n // The prefix and suffix sit over the input, in a group as wide as it.\n const control =\n prefix || suffix ? (\n <div className=\"roaster-input-group\">\n {prefix && <span className=\"roaster-input-group__prefix\">{prefix}</span>}\n {input}\n {suffix && <span className=\"roaster-input-group__suffix\">{suffix}</span>}\n </div>\n ) : (\n input\n );\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n inline={inline}\n className={className}\n style={style}\n >\n {hasRightSection ? (\n <div className=\"roaster-merged-inputs\">\n {control}\n {/* An element (a Button) takes the class; text is wrapped first. */}\n <Slot className=\"roaster-merged-inputs__end\">\n {React.isValidElement(rightSection) ? rightSection : <span>{rightSection}</span>}\n </Slot>\n </div>\n ) : (\n control\n )}\n </Field>\n );\n});\n\nTextField.displayName = 'TextField';\n"],"names":[],"mappings":";;;;;;;;AAKY,MAAC,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1D,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,IAAI,KAAK;AACT,IAAI,MAAM;AACV,IAAI,MAAM;AACV,IAAI,QAAQ;AACZ,IAAI,aAAa;AACjB,IAAI,WAAW;AACf,IAAI,eAAe;AACnB,IAAI,YAAY;AAChB,IAAI,IAAI,GAAG,MAAM;AACjB,IAAI,OAAO;AACX,IAAI,MAAM;AACV,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,eAAe,GAAG,YAAY,IAAI,IAAI,IAAI,YAAY,KAAK,KAAK,IAAI,YAAY,KAAK,EAAE;AAC/F,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC;AAC9C,EAAE,CAAC;AACH,EAAE,MAAM,KAA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I,EAAE,EAAE,SAAS,EAAE,4BAA4B,EAAE,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,GAAG,YAAY,mBAAmB,GAAG,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,EAAE;AACpM,OAAO,EAAE,CAAC,GAAG;AACb;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -1,27 +1,59 @@
1
1
  'use client';
2
- import { jsx } from 'react/jsx-runtime';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import * as React from 'react';
4
- import { Field, fieldControlProps } from '../Field/Field.js';
4
+ import { fieldControlProps, Field } from '../Field/Field.js';
5
5
  import { useUid } from '../../utils/useUid/index.js';
6
6
  import { classNames } from '../../utils/classNames/index.js';
7
7
 
8
8
  const Textarea = React.forwardRef((props, ref) => {
9
- const { label, error, id, description, onChange, onValueChange, variant, className, style, ...others } = props;
9
+ const {
10
+ label,
11
+ error,
12
+ id,
13
+ description,
14
+ keepDescription,
15
+ onChange,
16
+ onValueChange,
17
+ variant,
18
+ footer,
19
+ className,
20
+ style,
21
+ ...others
22
+ } = props;
10
23
  const uid = useUid(id);
24
+ const hasFooter = !(footer == null || typeof footer === "boolean" || footer === "");
25
+ const footerId = `${uid}-footer`;
11
26
  const handleChange = (event) => {
12
27
  onChange?.(event);
13
28
  onValueChange?.(event.currentTarget.value);
14
29
  };
15
- return /* @__PURE__ */ jsx(Field, { controlId: uid, label, description, error, className, style, children: /* @__PURE__ */ jsx(
30
+ const describedBy = [others["aria-describedby"], hasFooter && footerId].filter(Boolean).join(" ") || void 0;
31
+ const textarea = /* @__PURE__ */ jsx(
16
32
  "textarea",
17
33
  {
18
34
  ...others,
19
- ...fieldControlProps(uid, { description, error }, others),
35
+ ...fieldControlProps(uid, { description, error, keepDescription }, { "aria-describedby": describedBy }),
20
36
  ref,
21
37
  className: classNames("roaster-textarea", variant && `roaster-input--${variant}`),
22
38
  onChange: handleChange
23
39
  }
24
- ) });
40
+ );
41
+ return /* @__PURE__ */ jsx(
42
+ Field,
43
+ {
44
+ controlId: uid,
45
+ label,
46
+ description,
47
+ keepDescription,
48
+ error,
49
+ className,
50
+ style,
51
+ children: hasFooter ? /* @__PURE__ */ jsxs("div", { className: "roaster-textarea-group", children: [
52
+ textarea,
53
+ /* @__PURE__ */ jsx("div", { className: "roaster-textarea-group__footer", id: footerId, children: footer })
54
+ ] }) : textarea
55
+ }
56
+ );
25
57
  });
26
58
  Textarea.displayName = "Textarea";
27
59
 
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/**\n * Every native `<textarea>` prop (`name`, `rows`, `required`, `aria-*`, ...) is accepted and forwarded to the\n * textarea, with the ref. `className` and `style` go to the field's wrapper.\n */\nexport interface TextareaProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'textarea'>, 'className' | 'style'> {\n /** Called with the new value when the user changes it. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** `plain` has no edge or fill, such as a comment's text area in a card. The focus ring stays. */\n variant?: 'plain';\n}\n\n/** A multiline text field with a label, help text and error message. */\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>((props, ref) => {\n const { label, error, id, description, onChange, onValueChange, variant, className, style, ...others } = props;\n\n const uid = useUid(id);\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n return (\n <Field controlId={uid} label={label} description={description} error={error} className={className} style={style}>\n <textarea\n {...others}\n {...fieldControlProps(uid, { label, description, error }, others)}\n ref={ref}\n className={classNames('roaster-textarea', variant && `roaster-input--${variant}`)}\n onChange={handleChange}\n />\n </Field>\n );\n});\n\nTextarea.displayName = 'Textarea';\n"],"names":[],"mappings":";;;;;;;AAKY,MAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACzD,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK;AAChH,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,YAAY,GAAG,CAAC,KAAK,KAAK;AAClC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC;AAC9C,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,GAAG;AAChI,IAAI,UAAU;AACd,IAAI;AACJ,MAAM,GAAG,MAAM;AACf,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,EAAS,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AACtE,MAAM,GAAG;AACT,MAAM,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,OAAO,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;AACvF,MAAM,QAAQ,EAAE;AAChB;AACA,GAAG,EAAE,CAAC;AACN,CAAC;AACD,QAAQ,CAAC,WAAW,GAAG,UAAU;;"}
1
+ {"version":3,"file":"Textarea.js","sources":["../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\n\n/**\n * Every native `<textarea>` prop (`name`, `rows`, `required`, `aria-*`, ...) is accepted and forwarded to the\n * textarea, with the ref. `className` and `style` go to the field's wrapper.\n */\nexport interface TextareaProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'textarea'>, 'className' | 'style'> {\n /** Called with the new value when the user changes it. The native `onChange` gets the event. */\n onValueChange?(value: string): void;\n /** `plain` has no edge or fill, such as a comment's text area in a card. The focus ring stays. */\n variant?: 'plain';\n /**\n * A short text in the box, under the text at its end, such as a count of the characters: `912 / 1000`. The textarea\n * is described by it. Not with `plain`, which has no box: put it beside the card's buttons.\n */\n footer?: React.ReactNode;\n}\n\n/** A multiline text field with a label, help text and error message, and an optional footer in its box. */\nexport const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>((props, ref) => {\n const {\n label,\n error,\n id,\n description,\n keepDescription,\n onChange,\n onValueChange,\n variant,\n footer,\n className,\n style,\n ...others\n } = props;\n\n const uid = useUid(id);\n const hasFooter = !(footer == null || typeof footer === 'boolean' || footer === '');\n const footerId = `${uid}-footer`;\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n onChange?.(event);\n onValueChange?.(event.currentTarget.value);\n };\n\n // The footer describes the textarea after any description it already has, and before the field's texts under it.\n const describedBy = [others['aria-describedby'], hasFooter && footerId].filter(Boolean).join(' ') || undefined;\n const textarea = (\n <textarea\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, { 'aria-describedby': describedBy })}\n ref={ref}\n className={classNames('roaster-textarea', variant && `roaster-input--${variant}`)}\n onChange={handleChange}\n />\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 {hasFooter ? (\n <div className=\"roaster-textarea-group\">\n {textarea}\n <div className=\"roaster-textarea-group__footer\" id={footerId}>\n {footer}\n </div>\n </div>\n ) : (\n textarea\n )}\n </Field>\n );\n});\n\nTextarea.displayName = 'Textarea';\n"],"names":[],"mappings":";;;;;;;AAKY,MAAC,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAA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AAE,uBAAuB,GAAG;AAC5B,IAAI,KAAK;AACT,IAAI;AACJ,MAAM,SAAS,EAAE,GAAG;AACpB,MAAM,KAAK;AACX,MAAM,WAAW;AACjB,MAAM,eAAe;AACrB,MAAM,KAAK;AACX,MAAM,SAAS;AACf,MAAM,KAAK;AACX,MAAM,QAAQ,EAAE,SAAS,mBAAmB,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE,QAAQ,EAAE;AACzG,QAAQ,QAAQ;AAChB,wBAAwB,GAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,gCAAgC,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE;AAClH,OAAO,EAAE,CAAC,GAAG;AACb;AACA,GAAG;AACH,CAAC;AACD,QAAQ,CAAC,WAAW,GAAG,UAAU;;"}
@@ -1,7 +1,8 @@
1
1
  'use client';
2
2
  import { jsx } 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 { useImageFallback } from '../../utils/useImageFallback/index.js';
6
7
  import { classNames } from '../../utils/classNames/index.js';
7
8
 
@@ -18,7 +19,7 @@ const Thumbnail = React.forwardRef(
18
19
  ref,
19
20
  className: classNames("roaster-thumbnail", className),
20
21
  style: { ...size && { width: size, height: size }, ...style },
21
- children: showFallback ? /* @__PURE__ */ jsx(Icon, { name: "image" }) : /* @__PURE__ */ jsx("img", { src: src ?? void 0, alt: label, onError })
22
+ children: showFallback ? /* @__PURE__ */ jsx(RoasterIcon, { name: "image" }) : /* @__PURE__ */ jsx("img", { src: src ?? void 0, alt: label, onError })
22
23
  }
23
24
  );
24
25
  }