@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
@@ -4,7 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var Field = require('../Field/Field.js');
7
- var Icon = require('../Icon/Icon.js');
7
+ require('../Icon/Icon.js');
8
+ var RoasterIcon = require('../Icon/RoasterIcon.js');
8
9
  var index = require('../../utils/useUid/index.js');
9
10
  var index$1 = require('../../utils/classNames/index.js');
10
11
 
@@ -29,13 +30,13 @@ function EmptyMarkupPlaceholder({
29
30
  }) {
30
31
  if (type === "file")
31
32
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
32
- /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "file-csv", className: "roaster-file__icon" }),
33
+ /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "file-spreadsheet", className: "roaster-file__icon" }),
33
34
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "roaster-file__name", children: noFileLabel })
34
35
  ] });
35
36
  if (defaultValue) {
36
37
  return /* @__PURE__ */ jsxRuntime.jsx("img", { src: defaultValue, alt: "" });
37
38
  }
38
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "roaster-file__placeholder", children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "image" }) });
39
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "roaster-file__placeholder", children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "image" }) });
39
40
  }
40
41
  function Preview({ type, files }) {
41
42
  const file = files[0];
@@ -50,7 +51,7 @@ function Preview({ type, files }) {
50
51
  return imageUrl ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: imageUrl, alt: file.name }) : null;
51
52
  }
52
53
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
53
- /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "file-csv", className: "roaster-file__icon" }),
54
+ /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "file-spreadsheet", className: "roaster-file__icon" }),
54
55
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "roaster-file__name", children: files.map((chosen) => chosen.name).join(", ") })
55
56
  ] });
56
57
  }
@@ -61,6 +62,7 @@ const FileField = React__namespace.forwardRef((props, ref) => {
61
62
  name,
62
63
  disabled,
63
64
  description,
65
+ keepDescription,
64
66
  error,
65
67
  className,
66
68
  style,
@@ -83,37 +85,49 @@ const FileField = React__namespace.forwardRef((props, ref) => {
83
85
  onChange?.(event);
84
86
  onValueChange?.(chosen);
85
87
  };
86
- return /* @__PURE__ */ jsxRuntime.jsx(Field.Field, { controlId: uid, label, description, error, className, style, children: /* @__PURE__ */ jsxRuntime.jsxs(
87
- "div",
88
+ return /* @__PURE__ */ jsxRuntime.jsx(
89
+ Field.Field,
88
90
  {
89
- className: index$1.classNames("roaster-file", `roaster-file--${size}`),
90
- "data-state": files.length > 0 ? "filled" : void 0,
91
- children: [
92
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: type === "image" ? "roaster-file__image" : "roaster-file__preview", children: files.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(EmptyMarkupPlaceholder, { type, defaultValue, noFileLabel: text.noFile }) : /* @__PURE__ */ jsxRuntime.jsx(Preview, { type, files }) }),
93
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-file__button", children: [
94
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
95
- /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "arrow-up-from-bracket" }),
96
- text.upload,
97
- hint && /* @__PURE__ */ jsxRuntime.jsx("small", { className: "roaster-file__hint", children: hint })
98
- ] }),
99
- /* @__PURE__ */ jsxRuntime.jsx(
100
- "input",
101
- {
102
- ...others,
103
- ...Field.fieldControlProps(uid, { description, error }, others),
104
- name,
105
- ref,
106
- className: "roaster-file__input",
107
- type: "file",
108
- disabled,
109
- accept,
110
- onChange: handleChange
111
- }
112
- )
113
- ] })
114
- ]
91
+ controlId: uid,
92
+ label,
93
+ description,
94
+ keepDescription,
95
+ error,
96
+ className,
97
+ style,
98
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
99
+ "div",
100
+ {
101
+ className: index$1.classNames("roaster-file", `roaster-file--${size}`),
102
+ "data-state": files.length > 0 ? "filled" : void 0,
103
+ children: [
104
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: type === "image" ? "roaster-file__image" : "roaster-file__preview", children: files.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(EmptyMarkupPlaceholder, { type, defaultValue, noFileLabel: text.noFile }) : /* @__PURE__ */ jsxRuntime.jsx(Preview, { type, files }) }),
105
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-file__button", children: [
106
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
107
+ /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "upload" }),
108
+ text.upload,
109
+ hint && /* @__PURE__ */ jsxRuntime.jsx("small", { className: "roaster-file__hint", children: hint })
110
+ ] }),
111
+ /* @__PURE__ */ jsxRuntime.jsx(
112
+ "input",
113
+ {
114
+ ...others,
115
+ ...Field.fieldControlProps(uid, { description, error, keepDescription }, others),
116
+ name,
117
+ ref,
118
+ className: "roaster-file__input",
119
+ type: "file",
120
+ disabled,
121
+ accept,
122
+ onChange: handleChange
123
+ }
124
+ )
125
+ ] })
126
+ ]
127
+ }
128
+ )
115
129
  }
116
- ) });
130
+ );
117
131
  });
118
132
  FileField.displayName = "FileField";
119
133
 
@@ -1 +1 @@
1
- {"version":3,"file":"FileField.js","sources":["../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\nimport { Icon } from '@/components/Icon';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the file input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface FileFieldProps\n extends\n FieldBaseProps,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'size' | 'defaultValue' | 'value' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the file upload field input element (optional). */\n id?: string;\n /** The name attribute to be applied to the file upload field input element (optional). */\n name?: string;\n /**\n * The accept attribute to be applied to the file upload field input element (optional).\n * Specifies the types of accepted files.\n */\n accept?: string;\n /**\n * The size of the file upload field (optional).\n * - 'small': render a smaller file upload field\n * - 'medium': render a larger file upload field\n */\n size?: 'small' | 'medium';\n /** Whether the file upload field should be disabled (optional). */\n disabled?: boolean;\n /** The default value of the file upload field input (used to display a preview image when type is image). */\n defaultValue?: string | null;\n /**\n * Called with the chosen files when the user picks some: one, or several with `multiple`. The native `onChange`\n * gets the event.\n */\n onValueChange?(files: File[]): void;\n /**\n * The type of file to be uploaded (optional).\n * - 'image': upload an image file\n * - 'file': upload any file type\n */\n type?: 'image' | 'file';\n /** The text of the field, in English by default. */\n labels?: Partial<FileFieldLabels>;\n /** A line under the upload label, such as the files it takes. */\n hint?: React.ReactNode;\n}\n\n/** The text of the file field, for other languages. */\nexport interface FileFieldLabels {\n /** The upload button. */\n upload: React.ReactNode;\n /** Shown for a file field (`type=\"file\"`) with no file yet. */\n noFile: React.ReactNode;\n}\n\nconst defaultFileFieldLabels: FileFieldLabels = { upload: 'Upload a file', noFile: 'No file added' };\n\nfunction EmptyMarkupPlaceholder({\n type,\n defaultValue,\n noFileLabel,\n}: {\n type: 'image' | 'file';\n defaultValue?: string | null;\n noFileLabel: React.ReactNode;\n}) {\n if (type === 'file')\n return (\n <>\n <Icon name=\"file-csv\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{noFileLabel}</span>\n </>\n );\n\n if (defaultValue) {\n return <img src={defaultValue} alt=\"\" />;\n }\n\n return (\n <div className=\"roaster-file__placeholder\">\n <Icon name=\"image\" />\n </div>\n );\n}\n\nfunction Preview({ type, files }: { type: string; files: File[] }) {\n const file = files[0];\n const [imageUrl, setImageUrl] = React.useState<string>();\n\n // One object URL per file, released when the file changes or the preview goes away, so it doesn't leak memory.\n React.useEffect(() => {\n if (type !== 'image' || !file) return undefined;\n const url = URL.createObjectURL(file);\n setImageUrl(url);\n return () => URL.revokeObjectURL(url);\n }, [type, file]);\n\n if (type === 'image' && file) {\n return imageUrl ? <img src={imageUrl} alt={file.name} /> : null;\n }\n\n return (\n <>\n <Icon name=\"file-csv\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{files.map((chosen) => chosen.name).join(', ')}</span>\n </>\n );\n}\n\n/** A file upload field with a preview for images and the file name for other files. */\nexport const FileField = React.forwardRef<HTMLInputElement, FileFieldProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n description,\n error,\n className,\n style,\n onChange,\n onValueChange,\n type = 'image',\n accept = type === 'image' ? 'image/*' : '.csv, .xls',\n size = 'small',\n defaultValue,\n labels,\n hint,\n ...others\n } = props;\n const text = { ...defaultFileFieldLabels, ...labels };\n const uid = useUid(id);\n // Every chosen file: several with `multiple`.\n const [files, setFiles] = React.useState<File[]>([]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const chosen = [...(event.currentTarget.files ?? [])];\n setFiles(chosen);\n onChange?.(event);\n onValueChange?.(chosen);\n };\n\n return (\n <Field controlId={uid} label={label} description={description} error={error} className={className} style={style}>\n <div\n className={classNames('roaster-file', `roaster-file--${size}`)}\n data-state={files.length > 0 ? 'filled' : undefined}\n >\n <div className={type === 'image' ? 'roaster-file__image' : 'roaster-file__preview'}>\n {files.length === 0 ? (\n <EmptyMarkupPlaceholder type={type} defaultValue={defaultValue} noFileLabel={text.noFile} />\n ) : (\n <Preview type={type} files={files} />\n )}\n </div>\n <div className=\"roaster-file__button\">\n <span>\n <Icon name=\"arrow-up-from-bracket\" />\n {text.upload}\n {hint && <small className=\"roaster-file__hint\">{hint}</small>}\n </span>\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error }, others)}\n name={name}\n ref={ref}\n className=\"roaster-file__input\"\n type=\"file\"\n disabled={disabled}\n accept={accept}\n onChange={handleChange}\n />\n </div>\n </div>\n </Field>\n );\n});\n\nFileField.displayName = 'FileField';\n"],"names":["jsxs","Fragment","jsx","Icon","React","useUid","Field","classNames","fieldControlProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,sBAAsB,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;AACnF,SAAS,sBAAsB,CAAC;AAChC,EAAE,IAAI;AACN,EAAE,YAAY;AACd,EAAE;AACF,CAAC,EAAE;AACH,EAAE,IAAI,IAAI,KAAK,MAAM;AACrB,IAAI,uBAAuBA,eAAI,CAACC,mBAAQ,EAAE,EAAE,QAAQ,EAAE;AACtD,sBAAsBC,cAAG,CAACC,SAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AACtF,sBAAsBD,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,WAAW,EAAE;AAC5F,KAAK,EAAE,CAAC;AACR,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,uBAAuBA,cAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AACrE,EAAE;AACF,EAAE,uBAAuBA,cAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,2BAA2B,EAAE,QAAQ,kBAAkBA,cAAG,CAACC,SAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACvI;AACA,SAAS,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;AAClC,EAAE,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;AACvB,EAAE,MAAM,C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,uBAAuB,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,mBAAmBA,cAAG,CAAC,sBAAsB,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,mBAAmBA,cAAG,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AACnS,wBAAwBF,eAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,sBAAsB,EAAE,QAAQ,EAAE;AACnF,0BAA0BA,eAAI,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE;AACnD,4BAA4BE,cAAG,CAACC,SAAI,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;AACxE,YAAY,IAAI,CAAC,MAAM;AACvB,YAAY,IAAI,oBAAoBD,cAAG,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE;AACpG,WAAW,EAAE,CAAC;AACd,0BAA0BA,cAAG;AAC7B,YAAY,OAAO;AACnB,YAAY;AACZ,cAAc,GAAG,MAAM;AACvB,cAAc,GAAGM,uBAAiB,CAAC,GAAG,EAAE,EAAS,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AAC9E,cAAc,IAAI;AAClB,cAAc,GAAG;AACjB,cAAc,SAAS,EAAE,qBAAqB;AAC9C,cAAc,IAAI,EAAE,MAAM;AAC1B,cAAc,QAAQ;AACtB,cAAc,MAAM;AACpB,cAAc,QAAQ,EAAE;AACxB;AACA;AACA,SAAS,EAAE;AACX;AACA;AACA,GAAG,EAAE,CAAC;AACN,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
1
+ {"version":3,"file":"FileField.js","sources":["../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useUid } from '@/utils';\nimport { Field, fieldControlProps, type FieldBaseProps } from '../Field';\nimport { RoasterIcon } from '@/components/Icon';\n\n/**\n * Every native `<input>` prop (`name`, `required`, `aria-*`, ...) is accepted and forwarded to the file input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface FileFieldProps\n extends\n FieldBaseProps,\n Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'size' | 'defaultValue' | 'value' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the file upload field input element (optional). */\n id?: string;\n /** The name attribute to be applied to the file upload field input element (optional). */\n name?: string;\n /**\n * The accept attribute to be applied to the file upload field input element (optional).\n * Specifies the types of accepted files.\n */\n accept?: string;\n /**\n * The size of the file upload field (optional).\n * - 'small': render a smaller file upload field\n * - 'medium': render a larger file upload field\n */\n size?: 'small' | 'medium';\n /** Whether the file upload field should be disabled (optional). */\n disabled?: boolean;\n /** The default value of the file upload field input (used to display a preview image when type is image). */\n defaultValue?: string | null;\n /**\n * Called with the chosen files when the user picks some: one, or several with `multiple`. The native `onChange`\n * gets the event.\n */\n onValueChange?(files: File[]): void;\n /**\n * The type of file to be uploaded (optional).\n * - 'image': upload an image file\n * - 'file': upload any file type\n */\n type?: 'image' | 'file';\n /** The text of the field, in English by default. */\n labels?: Partial<FileFieldLabels>;\n /** A line under the upload label, such as the files it takes. */\n hint?: React.ReactNode;\n}\n\n/** The text of the file field, for other languages. */\nexport interface FileFieldLabels {\n /** The upload button. */\n upload: React.ReactNode;\n /** Shown for a file field (`type=\"file\"`) with no file yet. */\n noFile: React.ReactNode;\n}\n\nconst defaultFileFieldLabels: FileFieldLabels = { upload: 'Upload a file', noFile: 'No file added' };\n\nfunction EmptyMarkupPlaceholder({\n type,\n defaultValue,\n noFileLabel,\n}: {\n type: 'image' | 'file';\n defaultValue?: string | null;\n noFileLabel: React.ReactNode;\n}) {\n if (type === 'file')\n return (\n <>\n <RoasterIcon name=\"file-spreadsheet\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{noFileLabel}</span>\n </>\n );\n\n if (defaultValue) {\n return <img src={defaultValue} alt=\"\" />;\n }\n\n return (\n <div className=\"roaster-file__placeholder\">\n <RoasterIcon name=\"image\" />\n </div>\n );\n}\n\nfunction Preview({ type, files }: { type: string; files: File[] }) {\n const file = files[0];\n const [imageUrl, setImageUrl] = React.useState<string>();\n\n // One object URL per file, released when the file changes or the preview goes away, so it doesn't leak memory.\n React.useEffect(() => {\n if (type !== 'image' || !file) return undefined;\n const url = URL.createObjectURL(file);\n setImageUrl(url);\n return () => URL.revokeObjectURL(url);\n }, [type, file]);\n\n if (type === 'image' && file) {\n return imageUrl ? <img src={imageUrl} alt={file.name} /> : null;\n }\n\n return (\n <>\n <RoasterIcon name=\"file-spreadsheet\" className=\"roaster-file__icon\" />\n <span className=\"roaster-file__name\">{files.map((chosen) => chosen.name).join(', ')}</span>\n </>\n );\n}\n\n/** A file upload field with a preview for images and the file name for other files. */\nexport const FileField = React.forwardRef<HTMLInputElement, FileFieldProps>((props, ref) => {\n const {\n id,\n label,\n name,\n disabled,\n description,\n keepDescription,\n error,\n className,\n style,\n onChange,\n onValueChange,\n type = 'image',\n accept = type === 'image' ? 'image/*' : '.csv, .xls',\n size = 'small',\n defaultValue,\n labels,\n hint,\n ...others\n } = props;\n const text = { ...defaultFileFieldLabels, ...labels };\n const uid = useUid(id);\n // Every chosen file: several with `multiple`.\n const [files, setFiles] = React.useState<File[]>([]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const chosen = [...(event.currentTarget.files ?? [])];\n setFiles(chosen);\n onChange?.(event);\n onValueChange?.(chosen);\n };\n\n return (\n <Field\n controlId={uid}\n label={label}\n description={description}\n keepDescription={keepDescription}\n error={error}\n className={className}\n style={style}\n >\n <div\n className={classNames('roaster-file', `roaster-file--${size}`)}\n data-state={files.length > 0 ? 'filled' : undefined}\n >\n <div className={type === 'image' ? 'roaster-file__image' : 'roaster-file__preview'}>\n {files.length === 0 ? (\n <EmptyMarkupPlaceholder type={type} defaultValue={defaultValue} noFileLabel={text.noFile} />\n ) : (\n <Preview type={type} files={files} />\n )}\n </div>\n <div className=\"roaster-file__button\">\n <span>\n <RoasterIcon name=\"upload\" />\n {text.upload}\n {hint && <small className=\"roaster-file__hint\">{hint}</small>}\n </span>\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, others)}\n name={name}\n ref={ref}\n className=\"roaster-file__input\"\n type=\"file\"\n disabled={disabled}\n accept={accept}\n onChange={handleChange}\n />\n </div>\n </div>\n </Field>\n );\n});\n\nFileField.displayName = 'FileField';\n"],"names":["jsxs","Fragment","jsx","RoasterIcon","React","useUid","Field","classNames","fieldControlProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,sBAAsB,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;AACnF,SAAS,sBAAsB,CAAC;AAChC,EAAE,IAAI;AACN,EAAE,YAAY;AACd,EAAE;AACF,CAAC,EAAE;AACH,EAAE,IAAI,IAAI,KAAK,MAAM;AACrB,IAAI,uBAAuBA,eAAI,CAACC,mBAAQ,EAAE,EAAE,QAAQ,EAAE;AACtD,sBAAsBC,cAAG,CAACC,uBAAW,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AACrG,sBAAsBD,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,WAAW,EAAE;AAC5F,KAAK,EAAE,CAAC;AACR,EAAE,IAAI,YAAY,EAAE;AACpB,IAAI,uBAAuBA,cAAG,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AACrE,EAAE;AACF,EAAE,uBAAuBA,cAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,2BAA2B,EAAE,QAAQ,kBAAkBA,cAAG,CAACC,uBAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC9I;AACA,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;AAC5B;AACA;AACA,aAAa,EAAE;AACf;AACA;AACA;AACA;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** Every native `<i>` prop (`id`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface IconProps extends Omit<React.ComponentPropsWithoutRef<'i'>, 'children'> {\n /** The Font Awesome icon's name, without its `fa-` prefix: `xmark`, `circle-info`. */\n name: string;\n /**\n * What the icon means, for an icon that stands alone, such as a status. Leave it out for an icon next to text that\n * says the same, or inside a button with its own name: the icon is then hidden from screen readers.\n */\n label?: string;\n}\n\n/**\n * A Font Awesome icon, in the regular style: `<Icon name=\"xmark\" />`. It needs `fontawesome.css` from the CDN. Use\n * `IconBadge` for an icon on a colored, rounded background.\n */\nexport const Icon = React.forwardRef<HTMLElement, IconProps>(({ name, label, className, ...others }, ref) => (\n <i\n {...(label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true })}\n {...others}\n ref={ref}\n className={classNames('fa-regular', `fa-${name}`, className)}\n />\n));\n\nIcon.displayName = 'Icon';\n"],"names":["React","jsx","classNames"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIY,MAAC,IAAI,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqBC,cAAG;AACxG,EAAE,GAAG;AACL,EAAE;AACF,IAAI,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;AAC7E,IAAI,GAAG,MAAM;AACb,IAAI,GAAG;AACP,IAAI,SAAS,EAAEC,gBAAU,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAC/D;AACA,CAAC;AACD,IAAI,CAAC,WAAW,GAAG,MAAM;;"}
1
+ {"version":3,"file":"Icon.js","sources":["../../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/**\n * Every native `<i>` prop (`id`, `data-*`, ...) is accepted and forwarded to it.\n *\n * @deprecated `Icon` is deprecated: pass your icon set's own element.\n */\nexport interface IconProps extends Omit<React.ComponentPropsWithoutRef<'i'>, 'children'> {\n /** The Font Awesome icon's name, without its `fa-` prefix: `xmark`, `circle-info`. */\n name: string;\n /**\n * What the icon means, for an icon that stands alone, such as a status. Leave it out for an icon next to text that\n * says the same, or inside a button with its own name: the icon is then hidden from screen readers.\n */\n label?: string;\n}\n\n/**\n * Deprecated: pass your icon set's own element instead, such as Font Awesome's\n * `<i className=\"fa-regular fa-house\" aria-hidden=\"true\" />`. Roaster's components draw their own icons, and an app's\n * icons are the app's, from the icon set it loads.\n *\n * A Font Awesome icon, in the regular style: `<Icon name=\"house\" />`. It needs Font Awesome, which the app loads. Use\n * `IconBadge` for an icon on a colored, rounded background.\n *\n * @deprecated Pass your icon set's own element instead, such as Font Awesome's\n * `<i className=\"fa-regular fa-house\" aria-hidden=\"true\" />`.\n */\nexport const Icon = React.forwardRef<HTMLElement, IconProps>(({ name, label, className, ...others }, ref) => (\n <i\n {...(label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true })}\n {...others}\n ref={ref}\n className={classNames('fa-regular', `fa-${name}`, className)}\n />\n));\n\nIcon.displayName = 'Icon';\n"],"names":["React","jsx","classNames"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIY,MAAC,IAAI,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,qBAAqBC,cAAG;AACxG,EAAE,GAAG;AACL,EAAE;AACF,IAAI,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE;AAC7E,IAAI,GAAG,MAAM;AACb,IAAI,GAAG;AACP,IAAI,SAAS,EAAEC,gBAAU,CAAC,YAAY,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS;AAC/D;AACA,CAAC;AACD,IAAI,CAAC,WAAW,GAAG,MAAM;;"}
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var index = require('../../utils/classNames/index.js');
6
+
7
+ function RoasterIcon({ name, className }) {
8
+ return /* @__PURE__ */ jsxRuntime.jsx("i", { className: index.classNames("roaster-icon", `roaster-icon--${name}`, className), "aria-hidden": "true" });
9
+ }
10
+
11
+ exports.RoasterIcon = RoasterIcon;
12
+ //# sourceMappingURL=RoasterIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoasterIcon.js","sources":["../../../../src/components/Icon/RoasterIcon.tsx"],"sourcesContent":["import { classNames } from '@/utils';\n\n/** The icons Roaster draws, each a `roaster-icon--<name>` class of roaster.css: Lucide's, by their Lucide names. */\nexport type RoasterIconName =\n | 'x'\n | 'check'\n | 'chevron-up'\n | 'chevron-down'\n | 'chevron-left'\n | 'chevron-right'\n | 'arrow-up'\n | 'arrow-down'\n | 'arrow-left'\n | 'arrow-right'\n | 'info'\n | 'menu'\n | 'image'\n | 'file-spreadsheet'\n | 'upload'\n | 'bold'\n | 'italic'\n | 'underline'\n | 'strikethrough'\n | 'link'\n | 'list'\n | 'list-ordered'\n | 'heading-1'\n | 'heading-2'\n | 'heading-3'\n | 'square-pen'\n | 'save'\n | 'trash';\n\nexport interface RoasterIconProps {\n name: RoasterIconName;\n className?: string;\n}\n\n/**\n * One of the icons Roaster's components draw, such as a close button's cross: `<RoasterIcon name=\"x\" />`. It needs no\n * icon font, and is hidden from screen readers, as the control around it is named. Internal: an app's own icons go\n * through `Icon`.\n */\nexport function RoasterIcon({ name, className }: RoasterIconProps) {\n return <i className={classNames('roaster-icon', `roaster-icon--${name}`, className)} aria-hidden=\"true\" />;\n}\n"],"names":["jsx","classNames"],"mappings":";;;;;;AAGO,SAAS,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;AACjD,EAAE,uBAAuBA,cAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAEC,gBAAU,CAAC,cAAc,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;AACvI;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconBadge.js","sources":["../../../../src/components/IconBadge/IconBadge.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** The tones of the badge's background. Without one, it has none. */\nexport type IconBadgeTone = 'neutral' | 'primary' | 'info' | 'success' | 'danger';\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 IconBadgeProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {\n /** The icon or image. */\n children: React.ReactNode;\n /** The background's tone. */\n tone?: IconBadgeTone;\n /**\n * 36px (`medium`) or 20px (`small`). In a Timeline.Item, it takes the timeline marker's size.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A round badge around an icon or an image, in a tone. For the icon alone, use `Icon`; for a description on hover and\n * focus, put a focusable element in a `Tooltip`.\n */\nexport const IconBadge = React.forwardRef<HTMLSpanElement, IconBadgeProps>((props, ref) => {\n const { tone, children, size = 'medium', className, ...otherProps } = props;\n\n return (\n <span\n {...otherProps}\n ref={ref}\n className={classNames(\n 'roaster-icon-badge',\n { 'roaster-icon-badge--small': size === 'small', [`roaster-icon-badge--${tone}`]: tone },\n className\n )}\n >\n {children}\n </span>\n );\n});\n\nIconBadge.displayName = 'IconBadge';\n"],"names":["React","jsx","classNames"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIY,MAAC,SAAS,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1D,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK;AAC7E,EAAE,uBAAuBC,cAAG;AAC5B,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,GAAG,UAAU;AACnB,MAAM,GAAG;AACT,MAAM,SAAS,EAAEC,gBAAU;AAC3B,QAAQ,oBAAoB;AAC5B,QAAQ,EAAE,2BAA2B,EAAE,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE;AAChG,QAAQ;AACR,OAAO;AACP,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
1
+ {"version":3,"file":"IconBadge.js","sources":["../../../../src/components/IconBadge/IconBadge.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames } from '@/utils';\n\n/** The tones of the badge's background. Without one, it has none. */\nexport type IconBadgeTone = 'neutral' | 'primary' | 'info' | 'success' | 'danger';\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 IconBadgeProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {\n /** The icon or image. */\n children: React.ReactNode;\n /** The background's tone. */\n tone?: IconBadgeTone;\n /**\n * 36px (`medium`) or 20px (`small`). In a Timeline.Item, it takes the timeline marker's size.\n * @defaultValue 'medium'\n */\n size?: 'small' | 'medium';\n}\n\n/**\n * A round badge around an icon or an image, in a tone. For a description on hover and focus, put a focusable element\n * in a `Tooltip`.\n */\nexport const IconBadge = React.forwardRef<HTMLSpanElement, IconBadgeProps>((props, ref) => {\n const { tone, children, size = 'medium', className, ...otherProps } = props;\n\n return (\n <span\n {...otherProps}\n ref={ref}\n className={classNames(\n 'roaster-icon-badge',\n { 'roaster-icon-badge--small': size === 'small', [`roaster-icon-badge--${tone}`]: tone },\n className\n )}\n >\n {children}\n </span>\n );\n});\n\nIconBadge.displayName = 'IconBadge';\n"],"names":["React","jsx","classNames"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIY,MAAC,SAAS,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1D,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK;AAC7E,EAAE,uBAAuBC,cAAG;AAC5B,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,GAAG,UAAU;AACnB,MAAM,GAAG;AACT,MAAM,SAAS,EAAEC,gBAAU;AAC3B,QAAQ,oBAAoB;AAC5B,QAAQ,EAAE,2BAA2B,EAAE,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE;AAChG,QAAQ;AACR,OAAO;AACP,MAAM;AACN;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -4,7 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var ButtonIcon = require('../ButtonIcon/ButtonIcon.js');
7
- var Icon = require('../Icon/Icon.js');
7
+ require('../Icon/Icon.js');
8
+ var RoasterIcon = require('../Icon/RoasterIcon.js');
8
9
  var index = require('../../utils/useControllableState/index.js');
9
10
  var index$1 = require('../../utils/useUid/index.js');
10
11
  var index$2 = require('../../utils/classNames/index.js');
@@ -105,7 +106,7 @@ const Modal = React__namespace.forwardRef((props, ref) => {
105
106
  children: [
106
107
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-modal__header", children: [
107
108
  title && /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "roaster-modal__title", id: titleId, children: title }),
108
- /* @__PURE__ */ jsxRuntime.jsx(ButtonIcon.ButtonIcon, { size: "medium", "aria-label": text.close, onClick: () => setOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "xmark" }) }),
109
+ /* @__PURE__ */ jsxRuntime.jsx(ButtonIcon.ButtonIcon, { size: "medium", "aria-label": text.close, onClick: () => setOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "x" }) }),
109
110
  description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "roaster-modal__description", id: descriptionId, children: description })
110
111
  ] }),
111
112
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "roaster-modal__body", children }),
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.js","sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { ModalLabels, ModalProps } from './types';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Icon } from '@/components/Icon';\n\nconst defaultModalLabels: ModalLabels = { close: 'Close' };\n\n// A layout effect in the browser (the modal opens before it paints), and nothing on the server, which warns about one.\nconst useClientLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n\n/** Whether the pointer event happened outside the dialog's box, on its backdrop. */\nfunction onBackdrop(dialog: HTMLDialogElement, event: React.MouseEvent) {\n const box = dialog.getBoundingClientRect();\n return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;\n}\n\n/**\n * A dialog over the page (`<dialog>` opened with `showModal()`), with a title, content and an optional footer. The page\n * behind is inert and doesn't scroll; the close button, Escape and a click outside ask to close it; the focus goes\n * back where it was. Open it with `open`, or with `useModal().openModal()` inside a ModalProvider.\n */\nexport const Modal = React.forwardRef<HTMLDialogElement, ModalProps>((props, ref) => {\n const {\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n title,\n description,\n size = 'small',\n sheet = false,\n footer,\n labels,\n children,\n className,\n onCancel,\n onMouseDown,\n onClick,\n ...others\n } = props;\n const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });\n const text = { ...defaultModalLabels, ...labels };\n const titleId = useUid();\n const descriptionId = useUid();\n const dialogRef = React.useRef<HTMLDialogElement | null>(null);\n const setRefs = React.useCallback(\n (dialog: HTMLDialogElement | null) => {\n dialogRef.current = dialog;\n if (typeof ref === 'function') ref(dialog);\n else if (ref) ref.current = dialog;\n },\n [ref]\n );\n // Set on mousedown, so that a selection dragged from inside the dialog to outside doesn't close it.\n const pressedOutside = React.useRef(false);\n\n // Shown as a modal once mounted. Unmounting removes it without close(), so the focus goes back by hand.\n useClientLayoutEffect(() => {\n if (!open) return undefined;\n const dialog = dialogRef.current;\n const previous = document.activeElement;\n if (dialog && !dialog.open) dialog.showModal();\n return () => {\n if (dialog?.open) dialog.close();\n if (previous instanceof HTMLElement && previous.isConnected) previous.focus({ preventScroll: true });\n };\n }, [open]);\n\n if (!open) return null;\n\n return (\n // The mouse handlers only add a click outside to close it; the keyboard has Escape, through the cancel event.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n <dialog\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n {...others}\n ref={setRefs}\n className={classNames(\n 'roaster-modal',\n size !== 'small' && `roaster-modal--${size}`,\n sheet && 'roaster-modal--sheet',\n className\n )}\n onCancel={(event) => {\n onCancel?.(event);\n // Escape: the state closes the dialog, so a parent that keeps it open is obeyed.\n event.preventDefault();\n setOpen(false);\n }}\n onMouseDown={(event) => {\n onMouseDown?.(event);\n pressedOutside.current = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n }}\n onClick={(event) => {\n onClick?.(event);\n const outside = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n if (pressedOutside.current && outside) setOpen(false);\n pressedOutside.current = false;\n }}\n >\n <div className=\"roaster-modal__header\">\n {title && (\n <h2 className=\"roaster-modal__title\" id={titleId}>\n {title}\n </h2>\n )}\n <ButtonIcon size=\"medium\" aria-label={text.close} onClick={() => setOpen(false)}>\n <Icon name=\"xmark\" />\n </ButtonIcon>\n {description && (\n <p className=\"roaster-modal__description\" id={descriptionId}>\n {description}\n </p>\n )}\n </div>\n <div className=\"roaster-modal__body\">{children}</div>\n {footer && <div className=\"roaster-modal__footer\">{footer}</div>}\n </dialog>\n );\n});\n\nModal.displayName = 'Modal';\n"],"names":["React","useControllableState","useUid","jsxs","classNames","jsx","ButtonIcon","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;AAC7C,MAAM,qBAAqB,GAAG,OAAO,MAAM,KAAK,WAAW,GAAGA,gBAAK,CAAC,SAAS,GAAGA,gBAAK,CAAC,eAAe;AACrG,SAAS,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE;AACnC,EAAE,MAAM,GAAG,GAAG,MAAM,CAAC,qBAAqB,EAAE;AAC5C,EAAE,OAAO,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,MAAM;AACvH;AACY,MAAC,KAAK,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACtD,EAAE,MAAM;AACR,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,WAAW,GAAG,KAAK;AACvB,IAAI,YAAY;AAChB,IAAI,KAAK;AACT,IAAI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+ {"version":3,"file":"Modal.js","sources":["../../../../src/components/Modal/Modal.tsx"],"sourcesContent":["import * as React from 'react';\nimport { classNames, useControllableState, useUid } from '@/utils';\nimport { ModalLabels, ModalProps } from './types';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { RoasterIcon } from '@/components/Icon';\n\nconst defaultModalLabels: ModalLabels = { close: 'Close' };\n\n// A layout effect in the browser (the modal opens before it paints), and nothing on the server, which warns about one.\nconst useClientLayoutEffect = typeof window === 'undefined' ? React.useEffect : React.useLayoutEffect;\n\n/** Whether the pointer event happened outside the dialog's box, on its backdrop. */\nfunction onBackdrop(dialog: HTMLDialogElement, event: React.MouseEvent) {\n const box = dialog.getBoundingClientRect();\n return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;\n}\n\n/**\n * A dialog over the page (`<dialog>` opened with `showModal()`), with a title, content and an optional footer. The page\n * behind is inert and doesn't scroll; the close button, Escape and a click outside ask to close it; the focus goes\n * back where it was. Open it with `open`, or with `useModal().openModal()` inside a ModalProvider.\n */\nexport const Modal = React.forwardRef<HTMLDialogElement, ModalProps>((props, ref) => {\n const {\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n title,\n description,\n size = 'small',\n sheet = false,\n footer,\n labels,\n children,\n className,\n onCancel,\n onMouseDown,\n onClick,\n ...others\n } = props;\n const [open, setOpen] = useControllableState({ value: openProp, defaultValue: defaultOpen, onChange: onOpenChange });\n const text = { ...defaultModalLabels, ...labels };\n const titleId = useUid();\n const descriptionId = useUid();\n const dialogRef = React.useRef<HTMLDialogElement | null>(null);\n const setRefs = React.useCallback(\n (dialog: HTMLDialogElement | null) => {\n dialogRef.current = dialog;\n if (typeof ref === 'function') ref(dialog);\n else if (ref) ref.current = dialog;\n },\n [ref]\n );\n // Set on mousedown, so that a selection dragged from inside the dialog to outside doesn't close it.\n const pressedOutside = React.useRef(false);\n\n // Shown as a modal once mounted. Unmounting removes it without close(), so the focus goes back by hand.\n useClientLayoutEffect(() => {\n if (!open) return undefined;\n const dialog = dialogRef.current;\n const previous = document.activeElement;\n if (dialog && !dialog.open) dialog.showModal();\n return () => {\n if (dialog?.open) dialog.close();\n if (previous instanceof HTMLElement && previous.isConnected) previous.focus({ preventScroll: true });\n };\n }, [open]);\n\n if (!open) return null;\n\n return (\n // The mouse handlers only add a click outside to close it; the keyboard has Escape, through the cancel event.\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions\n <dialog\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n {...others}\n ref={setRefs}\n className={classNames(\n 'roaster-modal',\n size !== 'small' && `roaster-modal--${size}`,\n sheet && 'roaster-modal--sheet',\n className\n )}\n onCancel={(event) => {\n onCancel?.(event);\n // Escape: the state closes the dialog, so a parent that keeps it open is obeyed.\n event.preventDefault();\n setOpen(false);\n }}\n onMouseDown={(event) => {\n onMouseDown?.(event);\n pressedOutside.current = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n }}\n onClick={(event) => {\n onClick?.(event);\n const outside = event.target === event.currentTarget && onBackdrop(event.currentTarget, event);\n if (pressedOutside.current && outside) setOpen(false);\n pressedOutside.current = false;\n }}\n >\n <div className=\"roaster-modal__header\">\n {title && (\n <h2 className=\"roaster-modal__title\" id={titleId}>\n {title}\n </h2>\n )}\n <ButtonIcon size=\"medium\" aria-label={text.close} onClick={() => setOpen(false)}>\n <RoasterIcon name=\"x\" />\n </ButtonIcon>\n {description && (\n <p className=\"roaster-modal__description\" id={descriptionId}>\n {description}\n </p>\n )}\n </div>\n <div className=\"roaster-modal__body\">{children}</div>\n {footer && <div className=\"roaster-modal__footer\">{footer}</div>}\n </dialog>\n );\n});\n\nModal.displayName = 'Modal';\n"],"names":["React","useControllableState","useUid","jsxs","classNames","jsx","ButtonIcon","RoasterIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,kBAAkB,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE;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,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,kBAAkBD,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;AACnL,YAAY,WAAW,oBAAoBF,cAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,4BAA4B,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE;AACzI,WAAW,EAAE,CAAC;AACd,0BAA0BA,cAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC;AACpF,UAAU,MAAM,oBAAoBA,cAAG,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,EAAE;AACvG;AACA;AACA;AACA;AACA,CAAC;AACD,KAAK,CAAC,WAAW,GAAG,OAAO;;"}
@@ -4,7 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var Button = require('../Button/Button.js');
7
- var Icon = require('../Icon/Icon.js');
7
+ require('../Icon/Icon.js');
8
+ var RoasterIcon = require('../Icon/RoasterIcon.js');
8
9
  var index = require('../../utils/classNames/index.js');
9
10
 
10
11
  function _interopNamespaceDefault(e) {
@@ -35,10 +36,10 @@ const Pagination = React__namespace.forwardRef(function Pagination2({ onNextPage
35
36
  disabled: !hasPreviousPage,
36
37
  onClick: () => onPreviousPage?.(),
37
38
  "aria-label": text.previousPage,
38
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "chevron-left" })
39
+ children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "chevron-left" })
39
40
  }
40
41
  ),
41
- /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { variant: "secondary", disabled: !hasNextPage, onClick: () => onNextPage?.(), "aria-label": text.nextPage, children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "chevron-right" }) })
42
+ /* @__PURE__ */ jsxRuntime.jsx(Button.Button, { variant: "secondary", disabled: !hasNextPage, onClick: () => onNextPage?.(), "aria-label": text.nextPage, children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "chevron-right" }) })
42
43
  ] });
43
44
  });
44
45
 
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.js","sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button';\nimport { classNames } from '@/utils';\nimport { Icon } from '@/components/Icon';\n\n/** The text of the pagination, for other languages. */\nexport interface PaginationLabels {\n /** The name of the navigation, read by screen readers. */\n navigation: string;\n /** The name of the previous page button, read by screen readers. */\n previousPage: string;\n /** The name of the next page button, read by screen readers. */\n nextPage: string;\n}\n\nconst defaultPaginationLabels: PaginationLabels = {\n navigation: 'Pagination',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n};\n\n/** Every native `<nav>` prop (`id`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface PaginationProps extends React.ComponentPropsWithoutRef<'nav'> {\n /** Called when the next page button is clicked. */\n onNextPage?: () => void;\n /** Called when the previous page button is clicked. */\n onPreviousPage?: () => void;\n /** Whether there is a next page: the button is disabled otherwise. */\n hasNextPage?: boolean;\n /** Whether there is a previous page: the button is disabled otherwise. */\n hasPreviousPage?: boolean;\n /** The text of the pagination, in English by default. */\n labels?: Partial<PaginationLabels>;\n}\n\n/** Previous and next buttons to move through pages of results, in a named `nav`. */\nexport const Pagination = React.forwardRef<HTMLElement, PaginationProps>(function Pagination(\n { onNextPage, onPreviousPage, hasNextPage, hasPreviousPage, className, labels, ...others },\n ref\n) {\n const text = { ...defaultPaginationLabels, ...labels };\n return (\n <nav aria-label={text.navigation} {...others} ref={ref} className={classNames('roaster-pagination', className)}>\n <Button\n variant=\"secondary\"\n disabled={!hasPreviousPage}\n onClick={() => onPreviousPage?.()}\n aria-label={text.previousPage}\n >\n <Icon name=\"chevron-left\" />\n </Button>\n <Button variant=\"secondary\" disabled={!hasNextPage} onClick={() => onNextPage?.()} aria-label={text.nextPage}>\n <Icon name=\"chevron-right\" />\n </Button>\n </nav>\n );\n});\n"],"names":["React","jsxs","classNames","jsx","Button","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,uBAAuB,GAAG;AAChC,EAAE,UAAU,EAAE,YAAY;AAC1B,EAAE,YAAY,EAAE,eAAe;AAC/B,EAAE,QAAQ,EAAE;AACZ,CAAC;AACW,MAAC,UAAU,GAAGA,gBAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,EAAE;AACjK,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE;AACxD,EAAE,uBAAuBC,eAAI,CAAC,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAEC,gBAAU,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE;AACxJ,oBAAoBC,cAAG;AACvB,MAAMC,aAAM;AACZ,MAAM;AACN,QAAQ,OAAO,EAAE,WAAW;AAC5B,QAAQ,QAAQ,EAAE,CAAC,eAAe;AAClC,QAAQ,OAAO,EAAE,MAAM,cAAc,IAAI;AACzC,QAAQ,YAAY,EAAE,IAAI,CAAC,YAAY;AACvC,QAAQ,QAAQ,kBAAkBD,cAAG,CAACE,SAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;AACpE;AACA,KAAK;AACL,oBAAoBF,cAAG,CAACC,aAAM,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,kBAAkBD,cAAG,CAACE,SAAI,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE;AAC5M,GAAG,EAAE,CAAC;AACN,CAAC;;"}
1
+ {"version":3,"file":"Pagination.js","sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button';\nimport { classNames } from '@/utils';\nimport { RoasterIcon } from '@/components/Icon';\n\n/** The text of the pagination, for other languages. */\nexport interface PaginationLabels {\n /** The name of the navigation, read by screen readers. */\n navigation: string;\n /** The name of the previous page button, read by screen readers. */\n previousPage: string;\n /** The name of the next page button, read by screen readers. */\n nextPage: string;\n}\n\nconst defaultPaginationLabels: PaginationLabels = {\n navigation: 'Pagination',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n};\n\n/** Every native `<nav>` prop (`id`, `data-*`, ...) is accepted and forwarded to it. */\nexport interface PaginationProps extends React.ComponentPropsWithoutRef<'nav'> {\n /** Called when the next page button is clicked. */\n onNextPage?: () => void;\n /** Called when the previous page button is clicked. */\n onPreviousPage?: () => void;\n /** Whether there is a next page: the button is disabled otherwise. */\n hasNextPage?: boolean;\n /** Whether there is a previous page: the button is disabled otherwise. */\n hasPreviousPage?: boolean;\n /** The text of the pagination, in English by default. */\n labels?: Partial<PaginationLabels>;\n}\n\n/** Previous and next buttons to move through pages of results, in a named `nav`. */\nexport const Pagination = React.forwardRef<HTMLElement, PaginationProps>(function Pagination(\n { onNextPage, onPreviousPage, hasNextPage, hasPreviousPage, className, labels, ...others },\n ref\n) {\n const text = { ...defaultPaginationLabels, ...labels };\n return (\n <nav aria-label={text.navigation} {...others} ref={ref} className={classNames('roaster-pagination', className)}>\n <Button\n variant=\"secondary\"\n disabled={!hasPreviousPage}\n onClick={() => onPreviousPage?.()}\n aria-label={text.previousPage}\n >\n <RoasterIcon name=\"chevron-left\" />\n </Button>\n <Button variant=\"secondary\" disabled={!hasNextPage} onClick={() => onNextPage?.()} aria-label={text.nextPage}>\n <RoasterIcon name=\"chevron-right\" />\n </Button>\n </nav>\n );\n});\n"],"names":["React","jsxs","classNames","jsx","Button","RoasterIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,uBAAuB,GAAG;AAChC,EAAE,UAAU,EAAE,YAAY;AAC1B,EAAE,YAAY,EAAE,eAAe;AAC/B,EAAE,QAAQ,EAAE;AACZ,CAAC;AACW,MAAC,UAAU,GAAGA,gBAAK,CAAC,UAAU,CAAC,SAAS,WAAW,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,EAAE;AACjK,EAAE,MAAM,IAAI,GAAG,EAAE,GAAG,uBAAuB,EAAE,GAAG,MAAM,EAAE;AACxD,EAAE,uBAAuBC,eAAI,CAAC,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAEC,gBAAU,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAAE,QAAQ,EAAE;AACxJ,oBAAoBC,cAAG;AACvB,MAAMC,aAAM;AACZ,MAAM;AACN,QAAQ,OAAO,EAAE,WAAW;AAC5B,QAAQ,QAAQ,EAAE,CAAC,eAAe;AAClC,QAAQ,OAAO,EAAE,MAAM,cAAc,IAAI;AACzC,QAAQ,YAAY,EAAE,IAAI,CAAC,YAAY;AACvC,QAAQ,QAAQ,kBAAkBD,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;AAC3E;AACA,KAAK;AACL,oBAAoBF,cAAG,CAACC,aAAM,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,UAAU,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,kBAAkBD,cAAG,CAACE,uBAAW,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,EAAE;AACnN,GAAG,EAAE,CAAC;AACN,CAAC;;"}
@@ -28,6 +28,7 @@ const RangeField = React__namespace.forwardRef((props, ref) => {
28
28
  value,
29
29
  min = 0,
30
30
  description,
31
+ keepDescription,
31
32
  disabled,
32
33
  onChange,
33
34
  onValueChange,
@@ -52,27 +53,39 @@ const RangeField = React__namespace.forwardRef((props, ref) => {
52
53
  onChange?.(event);
53
54
  setInternalValue(Number(event.currentTarget.value));
54
55
  };
55
- return /* @__PURE__ */ jsxRuntime.jsx(Field.Field, { controlId: uid, label, description, error, className, style, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-range", children: [
56
- /* @__PURE__ */ jsxRuntime.jsx(
57
- "input",
58
- {
59
- ...others,
60
- ...Field.fieldControlProps(uid, { description, error }, others),
61
- ref,
62
- className: "roaster-range__input",
63
- min,
64
- max,
65
- name,
66
- step,
67
- type: "range",
68
- disabled,
69
- value: current,
70
- onChange: handleChange,
71
- style: { "--roaster-range-percent": `${fillPercentage}%` }
72
- }
73
- ),
74
- /* @__PURE__ */ jsxRuntime.jsx("output", { className: "roaster-range__value", htmlFor: uid, children: current })
75
- ] }) });
56
+ return /* @__PURE__ */ jsxRuntime.jsx(
57
+ Field.Field,
58
+ {
59
+ controlId: uid,
60
+ label,
61
+ description,
62
+ keepDescription,
63
+ error,
64
+ className,
65
+ style,
66
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "roaster-range", children: [
67
+ /* @__PURE__ */ jsxRuntime.jsx(
68
+ "input",
69
+ {
70
+ ...others,
71
+ ...Field.fieldControlProps(uid, { description, error, keepDescription }, others),
72
+ ref,
73
+ className: "roaster-range__input",
74
+ min,
75
+ max,
76
+ name,
77
+ step,
78
+ type: "range",
79
+ disabled,
80
+ value: current,
81
+ onChange: handleChange,
82
+ style: { "--roaster-range-percent": `${fillPercentage}%` }
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsxRuntime.jsx("output", { className: "roaster-range__value", htmlFor: uid, children: current })
86
+ ] })
87
+ }
88
+ );
76
89
  });
77
90
  RangeField.displayName = "RangeField";
78
91
 
@@ -1 +1 @@
1
- {"version":3,"file":"RangeField.js","sources":["../../../../src/components/RangeField/RangeField.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 range input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface RangeFieldProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the range input element (optional). */\n id?: string;\n /** The minimum value of the range input field (optional). */\n min?: number;\n /** The maximum value of the range input field (optional). */\n max?: number;\n /** The step value of the range input field (optional). */\n step?: number;\n /** The name attribute to be applied to the range input element (optional). */\n name?: string;\n /** The value of the range input field (optional). */\n value?: number;\n /** Whether the range input field should be disabled (optional). */\n disabled?: boolean;\n /** The default value of the range input field (optional). */\n defaultValue?: number;\n /** Called with the new value when the user moves the slider. The native `onChange` gets the event. */\n onValueChange?(value: number): void;\n}\n\n/** A slider to pick a number between a minimum and a maximum, with its current value shown. */\nexport const RangeField = React.forwardRef<HTMLInputElement, RangeFieldProps>((props, ref) => {\n const {\n id,\n name,\n label,\n value,\n min = 0,\n description,\n disabled,\n onChange,\n onValueChange,\n step = 1,\n max = 100,\n error,\n className,\n style,\n defaultValue = 0,\n ...others\n } = props;\n\n const [internalValue, setInternalValue] = useControllableState<number>({\n value,\n defaultValue,\n onChange: onValueChange,\n });\n const uid = useUid(id);\n\n // The browser clamps what the slider shows; clamp what we display and fill with the same number.\n const current = Math.min(Math.max(Number(internalValue), min), max);\n const range = max - min;\n const fillPercentage = range > 0 ? (100 * (current - min)) / range : 0;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n setInternalValue(Number(event.currentTarget.value));\n };\n\n return (\n <Field controlId={uid} label={label} description={description} error={error} className={className} style={style}>\n <div className=\"roaster-range\">\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error }, others)}\n ref={ref}\n className=\"roaster-range__input\"\n min={min}\n max={max}\n name={name}\n step={step}\n type=\"range\"\n disabled={disabled}\n value={current}\n onChange={handleChange}\n // The CSS fills the track up to this percentage, in the theme's colors.\n style={{ '--roaster-range-percent': `${fillPercentage}%` } as React.CSSProperties}\n />\n <output className=\"roaster-range__value\" htmlFor={uid}>\n {current}\n </output>\n </div>\n </Field>\n );\n});\n\nRangeField.displayName = 'RangeField';\n"],"names":["React","useControllableState","useUid","jsx","Field","jsxs","fieldControlProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,UAAU,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,IAAI;AACR,IAAI,KAAK;AACT,IAAI,KAAK;AACT,IAAI,GAAG,GAAG,CAAC;AACX,IAAI,WAAW;AACf,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,aAAa;AACjB,IAAI,IAAI,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,GAAG;AACb,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,YAAY,GAAG,CAAC;AACpB,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGC,0BAAoB,CAAC;AACjE,IAAI,KAAK;AACT,IAAI,YAAY;AAChB,IAAI,QAAQ,EAAE;AACd,GAAG,CAAC;AACJ,EAAE,MAAM,GAAG,GAAGC,cAAM,CAAC,EAAE,CAAC;AACxB,EAAE,MAAM,OAAO,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AAE,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE;AACxG,GAAG,EAAE,CAAC,EAAE,CAAC;AACT,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
1
+ {"version":3,"file":"RangeField.js","sources":["../../../../src/components/RangeField/RangeField.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 range input, with the\n * ref. `className` and `style` go to the field's wrapper.\n */\nexport interface RangeFieldProps\n extends FieldBaseProps, Omit<React.ComponentPropsWithoutRef<'input'>, 'type' | 'className' | 'style'> {\n /** The HTML ID attribute to be applied to the range input element (optional). */\n id?: string;\n /** The minimum value of the range input field (optional). */\n min?: number;\n /** The maximum value of the range input field (optional). */\n max?: number;\n /** The step value of the range input field (optional). */\n step?: number;\n /** The name attribute to be applied to the range input element (optional). */\n name?: string;\n /** The value of the range input field (optional). */\n value?: number;\n /** Whether the range input field should be disabled (optional). */\n disabled?: boolean;\n /** The default value of the range input field (optional). */\n defaultValue?: number;\n /** Called with the new value when the user moves the slider. The native `onChange` gets the event. */\n onValueChange?(value: number): void;\n}\n\n/** A slider to pick a number between a minimum and a maximum, with its current value shown. */\nexport const RangeField = React.forwardRef<HTMLInputElement, RangeFieldProps>((props, ref) => {\n const {\n id,\n name,\n label,\n value,\n min = 0,\n description,\n keepDescription,\n disabled,\n onChange,\n onValueChange,\n step = 1,\n max = 100,\n error,\n className,\n style,\n defaultValue = 0,\n ...others\n } = props;\n\n const [internalValue, setInternalValue] = useControllableState<number>({\n value,\n defaultValue,\n onChange: onValueChange,\n });\n const uid = useUid(id);\n\n // The browser clamps what the slider shows; clamp what we display and fill with the same number.\n const current = Math.min(Math.max(Number(internalValue), min), max);\n const range = max - min;\n const fillPercentage = range > 0 ? (100 * (current - min)) / range : 0;\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n setInternalValue(Number(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 className={className}\n style={style}\n >\n <div className=\"roaster-range\">\n <input\n {...others}\n {...fieldControlProps(uid, { label, description, error, keepDescription }, others)}\n ref={ref}\n className=\"roaster-range__input\"\n min={min}\n max={max}\n name={name}\n step={step}\n type=\"range\"\n disabled={disabled}\n value={current}\n onChange={handleChange}\n // The CSS fills the track up to this percentage, in the theme's colors.\n style={{ '--roaster-range-percent': `${fillPercentage}%` } as React.CSSProperties}\n />\n <output className=\"roaster-range__value\" htmlFor={uid}>\n {current}\n </output>\n </div>\n </Field>\n );\n});\n\nRangeField.displayName = 'RangeField';\n"],"names":["React","useControllableState","useUid","jsx","Field","jsxs","fieldControlProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKY,MAAC,UAAU,GAAGA,gBAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC3D,EAAE,MAAM;AACR,IAAI,EAAE;AACN,IAAI,IAAI;AACR,IAAI,KAAK;AACT,IAAI,KAAK;AACT,IAAI,GAAG,GAAG,CAAC;AACX,IAAI,WAAW;AACf,IAAI,eAAe;AACnB,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,aAAa;AACjB,IAAI,IAAI,GAAG,CAAC;AACZ,IAAI,GAAG,GAAG,GAAG;AACb,IAAI,KAAK;AACT,IAAI,SAAS;AACb,IAAI,KAAK;AACT,IAAI,YAAY,GAAG,CAAC;AACpB,IAAI,GAAG;AACP,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGC,0BAAoB,CAAC;AACjE,IAAI,KAAK;AACT,IAAI,YAAY;AAChB,IAAI,QAAQ,EAAE;AACd,GAAG,CAAC;AACJ,EAAE,MAAM,GAA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,KAAK,EAAE,EAAE,yBAAyB,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC;AACpE;AACA,SAAS;AACT,wBAAwBH,cAAG,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC5G,OAAO,EAAE;AACT;AACA,GAAG;AACH,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
@@ -2,11 +2,11 @@
2
2
  'use strict';
3
3
 
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
- var react = require('@floating-ui/react');
6
5
  var React = require('react');
7
6
  var Field = require('../Field/Field.js');
8
7
  var index = require('../../utils/useUid/index.js');
9
- var index$1 = require('../../utils/classNames/index.js');
8
+ var index$1 = require('../../utils/useMergeRefs/index.js');
9
+ var index$2 = require('../../utils/classNames/index.js');
10
10
 
11
11
  function _interopNamespaceDefault(e) {
12
12
  var n = Object.create(null);
@@ -46,6 +46,7 @@ const SelectBase = React__namespace.forwardRef((props, ref) => {
46
46
  options,
47
47
  placeholder,
48
48
  description,
49
+ keepDescription,
49
50
  prefix,
50
51
  prefixWidth = prefix ? 24 : 12,
51
52
  onChange,
@@ -62,7 +63,7 @@ const SelectBase = React__namespace.forwardRef((props, ref) => {
62
63
  } = props;
63
64
  const uid = index.useUid(id);
64
65
  const selectRef = React__namespace.useRef(null);
65
- const mergedRef = react.useMergeRefs([selectRef, ref]);
66
+ const mergedRef = index$1.useMergeRefs([selectRef, ref]);
66
67
  const items = options.map(optionResolver);
67
68
  useSelectedContent(selectRef, rich && items.some((item) => item.description));
68
69
  const optionElements = items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: item.value, disabled: item.disabled, children: [
@@ -83,19 +84,20 @@ const SelectBase = React__namespace.forwardRef((props, ref) => {
83
84
  controlId: uid,
84
85
  label,
85
86
  description,
87
+ keepDescription,
86
88
  error,
87
89
  inline,
88
90
  className,
89
91
  style,
90
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index$1.classNames({ "roaster-input-group": prefix }), children: [
92
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index$2.classNames({ "roaster-input-group": prefix }), children: [
91
93
  prefix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "roaster-input-group__prefix", children: prefix }),
92
94
  /* @__PURE__ */ jsxRuntime.jsxs(
93
95
  "select",
94
96
  {
95
97
  ...others,
96
- ...Field.fieldControlProps(uid, { description, error }, others),
98
+ ...Field.fieldControlProps(uid, { description, error, keepDescription }, others),
97
99
  ref: mergedRef,
98
- className: index$1.classNames("roaster-select", { "roaster-select--prefixed": prefix, "roaster-select--rich": rich }),
100
+ className: index$2.classNames("roaster-select", { "roaster-select--prefixed": prefix, "roaster-select--rich": rich }),
99
101
  style: { paddingLeft: prefixWidth },
100
102
  defaultValue: startValue,
101
103
  onChange: handleChange,
@@ -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":["React","useUid","useMergeRefs","jsxs","Fragment","jsx","Field","classNames","fieldControlProps"],"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,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;AACnF,EAAE;AACF,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;AAChF;AACA,SAAS,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE;AAC1C,EAAEA,gBAAK,CAAC,SAAS,CAAC,MAAM;AACxB,IAAI,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO;AAC9B,IAAI,MAAM,YAAY,GAAG,OAAO,GAAG,EAAE,QAAQ,KAAK,UAAU,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;AACzG,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE,OAAO,MAAM;AAC3D,IAAI,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AACnD,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ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,UAAU;AACV,YAAY,GAAG,MAAM;AACrB,YAAY,GAAGK,uBAAiB,CAAC,GAAG,EAAE,EAAS,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;AAC5E,YAAY,GAAG,EAAE,SAAS;AAC1B,YAAY,SAAS,EAAED,kBAAU,CAAC,gBAAgB,EAAE,EAAE,0BAA0B,EAAE,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC;AACzH,YAAY,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE;AAC/C,YAAY,YAAY,EAAE,UAAU;AACpC,YAAY,QAAQ,EAAE,YAAY;AAClC,YAAY,QAAQ,EAAE;AACtB,cAAc,WAAW,KAAK,MAAM,oBAAoBF,cAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,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;;"}
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":["React","useUid","useMergeRefs","jsxs","Fragment","jsx","Field","classNames","fieldControlProps"],"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,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;AACnF,EAAE;AACF,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;AAChF;AACA,SAAS,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE;AAC1C,EAAEA,gBAAK,CAAC,SAAS,CAAC,MAAM;AACxB,IAAI,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO;AAC9B,IAAI,MAAM,YAAY,GAAG,OAAO,GAAG,EAAE,QAAQ,KAAK,UAAU,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;AACzG,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,IAA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E,QAAQ,EAAE;AAClH,QAAQ,MAAM,oBAAoBF,cAAG,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,6BAA6B,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC7G,wBAAwBF,eAAI;AAC5B,UAAU,QAAQ;AAClB,UAAU;AACV,YAAY,GAAG,MAAM;AACrB,YAAY,GAAGK,uBAAiB,CAAC,GAAG,EAAE,EAAS,WAAW,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,MAAM,CAAC;AAC7F,YAAY,GAAG,EAAE,SAAS;AAC1B,YAAY,SAAS,EAAED,kBAAU,CAAC,gBAAgB,EAAE,EAAE,0BAA0B,EAAE,MAAM,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC;AACzH,YAAY,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE;AAC/C,YAAY,YAAY,EAAE,UAAU;AACpC,YAAY,QAAQ,EAAE,YAAY;AAClC,YAAY,QAAQ,EAAE;AACtB,cAAc,WAAW,KAAK,MAAM,oBAAoBF,cAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,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;;"}
@@ -4,7 +4,8 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var Button = require('../Button/Button.js');
7
- var Icon = require('../Icon/Icon.js');
7
+ require('../Icon/Icon.js');
8
+ var RoasterIcon = require('../Icon/RoasterIcon.js');
8
9
  var Section = require('./components/Section.js');
9
10
  var Menu = require('./components/Menu.js');
10
11
  var Back = require('./components/Back.js');
@@ -121,7 +122,7 @@ const SidebarBase = React__namespace.forwardRef((props, ref) => {
121
122
  "aria-controls": sidebarId,
122
123
  "aria-expanded": drawerOpen,
123
124
  onClick: () => panelRef.current?.showPopover?.(),
124
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "bars" })
125
+ children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "menu" })
125
126
  }
126
127
  ),
127
128
  mobileHeader
@@ -135,7 +136,7 @@ const SidebarBase = React__namespace.forwardRef((props, ref) => {
135
136
  className: "roaster-sidebar__close",
136
137
  "aria-label": text.close,
137
138
  onClick: () => panelRef.current?.hidePopover?.(),
138
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon.Icon, { name: "xmark" })
139
+ children: /* @__PURE__ */ jsxRuntime.jsx(RoasterIcon.RoasterIcon, { name: "x" })
139
140
  }
140
141
  ),
141
142
  /* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "roaster-sidebar__nav", "aria-label": text.navigation, children: [