@calcifer-design/ui 0.5.0 → 0.7.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 (229) hide show
  1. package/dist/components/Alert/Alert.d.ts +5 -2
  2. package/dist/components/Alert/Alert.js +1 -0
  3. package/dist/components/Alert/Alert.module.js +5 -5
  4. package/dist/components/Alert/Alert_module.css +20 -17
  5. package/dist/components/Avatar/Avatar.d.ts +16 -2
  6. package/dist/components/Avatar/Avatar.js +23 -7
  7. package/dist/components/Avatar/Avatar.module.js +3 -3
  8. package/dist/components/Avatar/Avatar_module.css +58 -17
  9. package/dist/components/Avatar/avatarColor.d.ts +12 -0
  10. package/dist/components/Avatar/avatarColor.js +12 -0
  11. package/dist/components/AvatarGroup/AvatarGroup.d.ts +37 -0
  12. package/dist/components/AvatarGroup/AvatarGroup.js +52 -0
  13. package/dist/components/AvatarGroup/AvatarGroup.module.js +8 -0
  14. package/dist/components/AvatarGroup/AvatarGroup_module.css +67 -0
  15. package/dist/components/Breadcrumb/Breadcrumb.module.js +6 -6
  16. package/dist/components/Breadcrumb/Breadcrumb_module.css +7 -7
  17. package/dist/components/Button/Button.d.ts +40 -4
  18. package/dist/components/Button/Button.js +48 -11
  19. package/dist/components/Button/Button.module.js +6 -2
  20. package/dist/components/Button/Button_module.css +143 -17
  21. package/dist/components/Button/LinkButton.d.ts +10 -3
  22. package/dist/components/Button/LinkButton.js +16 -5
  23. package/dist/components/Card/Card.module.js +5 -5
  24. package/dist/components/Card/Card_module.css +15 -9
  25. package/dist/components/CardList/CardList.module.js +3 -3
  26. package/dist/components/CardList/CardList_module.css +5 -3
  27. package/dist/components/Checkbox/Checkbox.module.js +2 -2
  28. package/dist/components/Checkbox/Checkbox_module.css +3 -3
  29. package/dist/components/ChoiceCard/ChoiceCard.d.ts +34 -0
  30. package/dist/components/ChoiceCard/ChoiceCard.js +81 -0
  31. package/dist/components/ChoiceCard/ChoiceCard.module.js +12 -0
  32. package/dist/components/ChoiceCard/ChoiceCard_module.css +161 -0
  33. package/dist/components/Collapsible/Collapsible.d.ts +39 -0
  34. package/dist/components/Collapsible/Collapsible.js +63 -0
  35. package/dist/components/Collapsible/Collapsible.module.js +10 -0
  36. package/dist/components/Collapsible/Collapsible_module.css +80 -0
  37. package/dist/components/DataGrid/DataGrid.d.ts +3 -0
  38. package/dist/components/DataGrid/DataGrid.js +436 -0
  39. package/dist/components/DataGrid/DataGrid.module.js +36 -0
  40. package/dist/components/DataGrid/DataGrid_module.css +372 -0
  41. package/dist/components/DataGrid/GridCardHeader.d.ts +16 -0
  42. package/dist/components/DataGrid/GridCardHeader.js +40 -0
  43. package/dist/components/DataGrid/GridCheckbox.d.ts +15 -0
  44. package/dist/components/DataGrid/GridCheckbox.js +25 -0
  45. package/dist/components/DataGrid/GridHeaderCell.d.ts +14 -0
  46. package/dist/components/DataGrid/GridHeaderCell.js +29 -0
  47. package/dist/components/DataGrid/GridHeaderRow.d.ts +35 -0
  48. package/dist/components/DataGrid/GridHeaderRow.js +56 -0
  49. package/dist/components/DataGrid/GridRow.d.ts +69 -0
  50. package/dist/components/DataGrid/GridRow.js +139 -0
  51. package/dist/components/DataGrid/GridStateRows.d.ts +24 -0
  52. package/dist/components/DataGrid/GridStateRows.js +59 -0
  53. package/dist/components/DataGrid/columns.d.ts +40 -0
  54. package/dist/components/DataGrid/columns.js +37 -0
  55. package/dist/components/DataGrid/labels.d.ts +20 -0
  56. package/dist/components/DataGrid/labels.js +25 -0
  57. package/dist/components/DataGrid/types.d.ts +88 -0
  58. package/dist/components/DataGrid/types.js +0 -0
  59. package/dist/components/DataGrid/useGridEntries.d.ts +17 -0
  60. package/dist/components/DataGrid/useGridEntries.js +40 -0
  61. package/dist/components/DataGrid/useGridHighlight.d.ts +16 -0
  62. package/dist/components/DataGrid/useGridHighlight.js +24 -0
  63. package/dist/components/DataGrid/useGridKeyboard.d.ts +50 -0
  64. package/dist/components/DataGrid/useGridKeyboard.js +242 -0
  65. package/dist/components/DataGrid/useGridMetrics.d.ts +13 -0
  66. package/dist/components/DataGrid/useGridMetrics.js +35 -0
  67. package/dist/components/DataGrid/useLatest.d.ts +7 -0
  68. package/dist/components/DataGrid/useLatest.js +9 -0
  69. package/dist/components/DataGrid/useLoadMore.d.ts +30 -0
  70. package/dist/components/DataGrid/useLoadMore.js +39 -0
  71. package/dist/components/DataGrid/useRowExpansion.d.ts +14 -0
  72. package/dist/components/DataGrid/useRowExpansion.js +21 -0
  73. package/dist/components/DataGrid/useRowSelection.d.ts +43 -0
  74. package/dist/components/DataGrid/useRowSelection.js +107 -0
  75. package/dist/components/DataTable/DataTable.module.js +9 -9
  76. package/dist/components/DataTable/DataTable_module.css +24 -21
  77. package/dist/components/DatePicker/DatePicker.d.ts +15 -1
  78. package/dist/components/DatePicker/DatePicker.js +30 -5
  79. package/dist/components/DatePicker/DatePicker.module.js +10 -10
  80. package/dist/components/DatePicker/DatePicker_module.css +22 -21
  81. package/dist/components/Descriptions/Descriptions.module.js +4 -4
  82. package/dist/components/Descriptions/Descriptions_module.css +12 -8
  83. package/dist/components/Dialog/Dialog.d.ts +30 -2
  84. package/dist/components/Dialog/Dialog.js +52 -11
  85. package/dist/components/Dialog/Dialog.module.js +8 -6
  86. package/dist/components/Dialog/Dialog_module.css +60 -13
  87. package/dist/components/EmptyState/EmptyState.d.ts +41 -0
  88. package/dist/components/EmptyState/EmptyState.js +39 -0
  89. package/dist/components/EmptyState/EmptyState.module.js +9 -0
  90. package/dist/components/EmptyState/EmptyState_module.css +65 -0
  91. package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +5 -2
  92. package/dist/components/ErrorBoundary/ErrorBoundary.module.js +1 -1
  93. package/dist/components/ErrorBoundary/ErrorBoundary_module.css +1 -1
  94. package/dist/components/Field/AffixInput.d.ts +28 -0
  95. package/dist/components/Field/AffixInput.js +50 -0
  96. package/dist/components/Field/GroupFrame.d.ts +19 -0
  97. package/dist/components/Field/GroupFrame.js +31 -0
  98. package/dist/components/Field/PickerField.d.ts +8 -2
  99. package/dist/components/Field/PickerField.js +12 -8
  100. package/dist/components/Field/PickerField.module.js +4 -4
  101. package/dist/components/Field/PickerField_module.css +11 -6
  102. package/dist/components/FilterBar/FilterBar.module.js +9 -9
  103. package/dist/components/FilterBar/FilterBar_module.css +13 -13
  104. package/dist/components/Form/Form.d.ts +9 -7
  105. package/dist/components/Form/Form.module.js +1 -1
  106. package/dist/components/Form/Form_module.css +1 -1
  107. package/dist/components/IconButton/IconButton.d.ts +1 -1
  108. package/dist/components/IconButton/IconButton.module.js +2 -2
  109. package/dist/components/IconButton/IconButton_module.css +28 -17
  110. package/dist/components/Menu/Menu.js +3 -0
  111. package/dist/components/Menu/Menu.module.js +2 -2
  112. package/dist/components/Menu/Menu_module.css +5 -4
  113. package/dist/components/NavMenu/NavMenu.d.ts +27 -4
  114. package/dist/components/NavMenu/NavMenu.js +10 -8
  115. package/dist/components/NavMenu/NavMenu.module.js +6 -6
  116. package/dist/components/NavMenu/NavMenu_module.css +37 -19
  117. package/dist/components/NavMenu/currentPath.d.ts +9 -0
  118. package/dist/components/NavMenu/currentPath.js +5 -0
  119. package/dist/components/PageHeading/PageHeading.module.js +3 -3
  120. package/dist/components/PageHeading/PageHeading_module.css +12 -9
  121. package/dist/components/PageShell/PageShell.module.js +5 -5
  122. package/dist/components/PageShell/PageShell_module.css +9 -9
  123. package/dist/components/Popover/Popover.js +3 -0
  124. package/dist/components/Popover/Popover.module.js +2 -2
  125. package/dist/components/Popover/Popover_module.css +6 -3
  126. package/dist/components/ProgressBar/ProgressBar.d.ts +55 -0
  127. package/dist/components/ProgressBar/ProgressBar.js +76 -0
  128. package/dist/components/ProgressBar/ProgressBar.module.js +12 -0
  129. package/dist/components/ProgressBar/ProgressBar_module.css +120 -0
  130. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  131. package/dist/components/RadioGroup/RadioGroup.js +35 -49
  132. package/dist/components/RadioGroup/RadioGroup.module.js +2 -2
  133. package/dist/components/RadioGroup/RadioGroup_module.css +2 -2
  134. package/dist/components/SearchField/SearchField.d.ts +32 -0
  135. package/dist/components/SearchField/SearchField.js +100 -0
  136. package/dist/components/SearchField/SearchField.module.js +8 -0
  137. package/dist/components/SearchField/SearchField_module.css +34 -0
  138. package/dist/components/Segmented/Segmented.d.ts +23 -6
  139. package/dist/components/Segmented/Segmented.js +37 -20
  140. package/dist/components/Segmented/Segmented.module.js +4 -3
  141. package/dist/components/Segmented/Segmented_module.css +46 -20
  142. package/dist/components/Select/Select.js +3 -0
  143. package/dist/components/Select/Select.module.js +5 -5
  144. package/dist/components/Select/Select_module.css +12 -11
  145. package/dist/components/Skeleton/Skeleton.module.js +3 -3
  146. package/dist/components/Skeleton/Skeleton_module.css +9 -9
  147. package/dist/components/SkipLink/SkipLink.module.js +1 -1
  148. package/dist/components/SkipLink/SkipLink_module.css +4 -4
  149. package/dist/components/Spinner/Spinner.module.js +3 -3
  150. package/dist/components/Spinner/Spinner_module.css +7 -7
  151. package/dist/components/StatusDot/StatusDot.module.js +5 -5
  152. package/dist/components/StatusDot/StatusDot_module.css +11 -11
  153. package/dist/components/Steps/Steps.module.js +6 -6
  154. package/dist/components/Steps/Steps_module.css +19 -19
  155. package/dist/components/Switch/Switch.module.js +2 -2
  156. package/dist/components/Switch/Switch_module.css +5 -5
  157. package/dist/components/TabBar/TabBar.d.ts +26 -0
  158. package/dist/components/TabBar/TabBar.js +52 -0
  159. package/dist/components/TabBar/TabBar.module.js +11 -0
  160. package/dist/components/TabBar/TabBar_module.css +100 -0
  161. package/dist/components/Tabs/Tabs.module.js +4 -4
  162. package/dist/components/Tabs/Tabs_module.css +9 -8
  163. package/dist/components/Tag/Tag.module.js +1 -1
  164. package/dist/components/Tag/Tag_module.css +3 -2
  165. package/dist/components/TextArea/TextArea.module.js +1 -1
  166. package/dist/components/TextArea/TextArea_module.css +6 -2
  167. package/dist/components/TextInput/TextInput.d.ts +14 -2
  168. package/dist/components/TextInput/TextInput.js +4 -5
  169. package/dist/components/ThemeScope/PortalContainerContext.d.ts +17 -0
  170. package/dist/components/ThemeScope/PortalContainerContext.js +6 -0
  171. package/dist/components/ThemeScope/ThemeScope.d.ts +23 -0
  172. package/dist/components/ThemeScope/ThemeScope.js +29 -0
  173. package/dist/components/ThemeScope/ThemeScope.module.js +6 -0
  174. package/dist/components/ThemeScope/ThemeScope_module.css +10 -0
  175. package/dist/components/TimePicker/TimePicker.d.ts +15 -2
  176. package/dist/components/TimePicker/TimePicker.js +5 -5
  177. package/dist/components/Timeline/Timeline.module.js +8 -8
  178. package/dist/components/Timeline/Timeline_module.css +15 -13
  179. package/dist/components/ToastRegion/ToastRegion.js +3 -0
  180. package/dist/components/ToastRegion/ToastRegion.module.js +6 -6
  181. package/dist/components/ToastRegion/ToastRegion_module.css +23 -19
  182. package/dist/components/ToggleChip/ToggleChip.d.ts +49 -0
  183. package/dist/components/ToggleChip/ToggleChip.js +45 -0
  184. package/dist/components/ToggleChip/ToggleChip.module.js +9 -0
  185. package/dist/components/ToggleChip/ToggleChipGroup.d.ts +57 -0
  186. package/dist/components/ToggleChip/ToggleChipGroup.js +93 -0
  187. package/dist/components/ToggleChip/ToggleChip_module.css +97 -0
  188. package/dist/components/Toolbar/Toolbar.module.js +3 -3
  189. package/dist/components/Toolbar/Toolbar_module.css +5 -5
  190. package/dist/components/Tooltip/Tooltip.js +3 -0
  191. package/dist/components/Tree/Tree.module.js +8 -8
  192. package/dist/components/Tree/Tree_module.css +20 -20
  193. package/dist/components/TreeSelect/TreeSelect.js +3 -0
  194. package/dist/components/TreeSelect/TreeSelect.module.js +3 -3
  195. package/dist/components/TreeSelect/TreeSelect_module.css +4 -4
  196. package/dist/components/Upload/Upload.module.js +8 -8
  197. package/dist/components/Upload/Upload_module.css +16 -16
  198. package/dist/components/ViewField/ViewField.module.js +2 -2
  199. package/dist/components/ViewField/ViewField_module.css +3 -3
  200. package/dist/hooks/useControllable.d.ts +11 -0
  201. package/dist/hooks/useControllable.js +13 -0
  202. package/dist/hooks/useIndexedToggleGroup.d.ts +30 -0
  203. package/dist/hooks/useIndexedToggleGroup.js +26 -0
  204. package/dist/hooks/useOverflowFocusable.d.ts +17 -0
  205. package/dist/hooks/useOverflowFocusable.js +36 -0
  206. package/dist/icons/ChevronRightIcon.d.ts +6 -0
  207. package/dist/icons/ChevronRightIcon.js +17 -0
  208. package/dist/icons/RefreshIcon.d.ts +6 -0
  209. package/dist/icons/RefreshIcon.js +22 -0
  210. package/dist/icons/SearchIcon.d.ts +9 -0
  211. package/dist/icons/SearchIcon.js +23 -0
  212. package/dist/index.d.ts +31 -0
  213. package/dist/index.js +14 -0
  214. package/dist/styles/a11y.module.js +1 -1
  215. package/dist/styles/a11y_module.css +1 -1
  216. package/dist/styles/base.css +17 -0
  217. package/dist/styles/closeCircle.module.js +5 -0
  218. package/dist/styles/closeCircle_module.css +12 -0
  219. package/dist/styles/field.module.js +14 -11
  220. package/dist/styles/field_module.css +92 -23
  221. package/dist/styles/pair.module.js +2 -2
  222. package/dist/styles/pair_module.css +5 -3
  223. package/dist/styles/popup.module.js +5 -5
  224. package/dist/styles/popup_module.css +35 -28
  225. package/dist/utils/focusInputFromPill.d.ts +12 -0
  226. package/dist/utils/focusInputFromPill.js +7 -0
  227. package/dist/utils/hasContent.d.ts +8 -0
  228. package/dist/utils/hasContent.js +4 -0
  229. package/package.json +4 -3
@@ -1,4 +1,4 @@
1
- .root-GtYdg {
1
+ .ui0-7-0-root-GtYdg {
2
2
  grid-template: "header"
3
3
  "sidebar"
4
4
  "main" 1fr
@@ -9,47 +9,47 @@
9
9
  position: relative;
10
10
  }
11
11
 
12
- .header-YzERL {
12
+ .ui0-7-0-header-YzERL {
13
13
  padding: var(--space-3) var(--space-4);
14
14
  border-bottom: 1px solid var(--color-border);
15
15
  grid-area: header;
16
16
  }
17
17
 
18
- .sidebar-acwxu {
18
+ .ui0-7-0-sidebar-acwxu {
19
19
  padding: var(--space-4);
20
20
  border-bottom: 1px solid var(--color-border);
21
21
  grid-area: sidebar;
22
22
  }
23
23
 
24
- .main-A7fFb {
24
+ .ui0-7-0-main-A7fFb {
25
25
  padding: var(--space-5) var(--space-4);
26
26
  grid-area: main;
27
27
  }
28
28
 
29
- .main-A7fFb:focus-visible {
29
+ .ui0-7-0-main-A7fFb:focus-visible {
30
30
  outline-offset: calc(var(--focus-ring-width) * -1);
31
31
  }
32
32
 
33
- .footer-O0lU7 {
33
+ .ui0-7-0-footer-O0lU7 {
34
34
  padding: var(--space-3) var(--space-4);
35
35
  border-top: 1px solid var(--color-border);
36
36
  grid-area: footer;
37
37
  }
38
38
 
39
39
  @media (width >= 48rem) {
40
- .root-GtYdg[data-has-sidebar] {
40
+ .ui0-7-0-root-GtYdg[data-has-sidebar] {
41
41
  grid-template: "header header"
42
42
  "sidebar main" 1fr
43
43
  "footer footer"
44
44
  / 16rem minmax(0, 1fr);
45
45
  }
46
46
 
47
- .sidebar-acwxu {
47
+ .ui0-7-0-sidebar-acwxu {
48
48
  border-inline-end: 1px solid var(--color-border);
49
49
  border-bottom: 0;
50
50
  }
51
51
 
52
- .main-A7fFb {
52
+ .ui0-7-0-main-A7fFb {
53
53
  padding-inline: var(--space-5);
54
54
  }
55
55
  }
@@ -1,5 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Popover } from "@base-ui/react/popover";
3
+ import { usePortalContainer } from "../ThemeScope/PortalContainerContext.js";
3
4
  import a11y_module from "../../styles/a11y.module.js";
4
5
  import popup_module from "../../styles/popup.module.js";
5
6
  import Popover_module from "./Popover.module.js";
@@ -10,6 +11,7 @@ const headingTags = {
10
11
  };
11
12
  function Popover_Popover({ trigger, heading, headingLevel = 3, description, children, side = 'bottom', align = 'center', sideOffset = 8, modal = false, closeLabel = 'Close', open, defaultOpen, onOpenChange }) {
12
13
  const Heading = headingTags[headingLevel] ?? 'h3';
14
+ const container = usePortalContainer();
13
15
  return /*#__PURE__*/ jsxs(Popover.Root, {
14
16
  open: open,
15
17
  defaultOpen: defaultOpen,
@@ -20,6 +22,7 @@ function Popover_Popover({ trigger, heading, headingLevel = 3, description, chil
20
22
  render: trigger
21
23
  }),
22
24
  /*#__PURE__*/ jsxs(Popover.Portal, {
25
+ container: container,
23
26
  children: [
24
27
  true === modal ? /*#__PURE__*/ jsx(Popover.Backdrop, {
25
28
  className: [
@@ -1,6 +1,6 @@
1
1
  import "./Popover_module.css";
2
2
  const Popover_module = {
3
- heading: "heading-d0Ysc",
4
- description: "description-IgC4A"
3
+ heading: "ui0-7-0-heading-d0Ysc",
4
+ description: "ui0-7-0-description-IgC4A"
5
5
  };
6
6
  export default Popover_module;
@@ -1,12 +1,15 @@
1
- .heading-d0Ysc {
1
+ .ui0-7-0-heading-d0Ysc {
2
2
  color: var(--color-text);
3
+ font-family: var(--font-sans);
3
4
  font-size: var(--text-sm);
4
- font-weight: 600;
5
+ font-weight: var(--font-weight-heading);
5
6
  line-height: var(--leading-snug);
6
7
  }
7
8
 
8
- .description-IgC4A {
9
+ .ui0-7-0-description-IgC4A {
9
10
  color: var(--color-text-muted);
11
+ font-family: var(--font-body);
12
+ font-weight: var(--font-weight-body);
10
13
  font-size: var(--text-sm);
11
14
  line-height: var(--leading-prose);
12
15
  }
@@ -0,0 +1,55 @@
1
+ import { type ReactNode } from 'react';
2
+ /** The statuses that carry a spoken word; `active` is the normal case and says nothing. */
3
+ type ProgressBarStatusWord = 'finished' | 'error';
4
+ /** Every word the bar speaks: the two status words, and the value of a bar with none. */
5
+ type ProgressBarWord = ProgressBarStatusWord | 'indeterminate';
6
+ export interface ProgressBarProps {
7
+ /** The accessible name; visible unless `hideLabel`. */
8
+ label: string;
9
+ /** Keeps the label as the bar's name and takes it off the screen. */
10
+ hideLabel?: boolean;
11
+ /** A line under the track. It is the bar's accessible description. */
12
+ helperText?: ReactNode;
13
+ /**
14
+ * 0 to `max`; anything outside is clamped. `null`, and any value that is not a finite number,
15
+ * is indeterminate: the bar slides and states no value. A `finished` bar ignores it.
16
+ */
17
+ value: number | null;
18
+ /** The value that fills the track. Anything that is not a positive finite number reads as 100. */
19
+ max?: number;
20
+ /**
21
+ * `finished` fills the track and says so, whatever `value` is. `error` keeps the value and draws
22
+ * it in the danger colour. Both are also stated in a visually hidden word, for assistive
23
+ * technology, so pair `error` with `helperText` to give sighted people the reason in words.
24
+ */
25
+ status?: 'active' | 'finished' | 'error';
26
+ /**
27
+ * The track's height: 0.5rem, or 0.25rem at `sm`. A consumer sets another through the
28
+ * `--progress-bar-track-size` hook, on a `ThemeScope` or another DOM ancestor of the bar.
29
+ */
30
+ size?: 'sm' | 'md';
31
+ /**
32
+ * The visible and the announced value, given the effective value (clamped; `max` for a
33
+ * `finished` bar) and the effective `max`. Defaults to a rounded percentage.
34
+ */
35
+ formatValue?: (value: number, max: number) => string;
36
+ /** Drops the visible value. The announced one stays. */
37
+ hideValue?: boolean;
38
+ /** `selected` fills with the selected colour, the pair an app re-scopes for a chosen thing. */
39
+ tone?: 'accent' | 'selected';
40
+ /**
41
+ * The words the bar speaks, for an app that is not in English: `finished` and `error` follow the
42
+ * label in the bar's name, and `indeterminate` is the announced value of a bar with none (its
43
+ * `aria-valuetext`). Defaults `Finished`, `Error` and `indeterminate progress`; a key left out,
44
+ * or `undefined`, keeps its default.
45
+ */
46
+ statusLabels?: Partial<Record<ProgressBarWord, string>>;
47
+ }
48
+ /**
49
+ * A labelled linear meter. The bar is a display and nothing here can be focused. The fill and the
50
+ * visible value are for the eye (the value is hidden from assistive technology), and the same
51
+ * number reaches a screen reader as `aria-valuenow` and `aria-valuetext`, so the three always
52
+ * agree: the effective value is computed once, here, and Base UI is handed only that.
53
+ */
54
+ export declare function ProgressBar({ label, hideLabel, helperText, value, max, status, size, formatValue, hideValue, tone, statusLabels, }: ProgressBarProps): import("react").JSX.Element;
55
+ export {};
@@ -0,0 +1,76 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { Progress } from "@base-ui/react/progress";
3
+ import { useId } from "react";
4
+ import a11y_module from "../../styles/a11y.module.js";
5
+ import { hasContent } from "../../utils/hasContent.js";
6
+ import ProgressBar_module from "./ProgressBar.module.js";
7
+ const DEFAULT_WORDS = {
8
+ finished: 'Finished',
9
+ error: 'Error',
10
+ indeterminate: 'indeterminate progress'
11
+ };
12
+ const DEFAULT_MAX = 100;
13
+ function defaultFormatValue(value, max) {
14
+ return `${Math.round(100 * value / max)}%`;
15
+ }
16
+ function ProgressBar({ label, hideLabel = false, helperText, value, max = DEFAULT_MAX, status = 'active', size = 'md', formatValue = defaultFormatValue, hideValue = false, tone = 'accent', statusLabels }) {
17
+ const helperId = useId();
18
+ const effectiveMax = Number.isFinite(max) && max > 0 ? max : DEFAULT_MAX;
19
+ const rawValue = 'finished' === status ? effectiveMax : value;
20
+ const effectiveValue = null !== rawValue && Number.isFinite(rawValue) ? Math.min(Math.max(rawValue, 0), effectiveMax) : null;
21
+ const valueText = null === effectiveValue ? void 0 : formatValue(effectiveValue, effectiveMax);
22
+ const wordOf = (word)=>statusLabels?.[word] ?? DEFAULT_WORDS[word];
23
+ const statusWord = 'active' === status ? void 0 : wordOf(status);
24
+ const showValue = void 0 !== valueText && !hideValue;
25
+ const hasHelper = hasContent(helperText);
26
+ const labelElement = /*#__PURE__*/ jsxs(Progress.Label, {
27
+ className: hideLabel ? a11y_module.visuallyHidden : ProgressBar_module.label,
28
+ children: [
29
+ label,
30
+ void 0 === statusWord ? null : /*#__PURE__*/ jsxs(Fragment, {
31
+ children: [
32
+ ' ',
33
+ /*#__PURE__*/ jsx("span", {
34
+ className: a11y_module.visuallyHidden,
35
+ children: statusWord
36
+ })
37
+ ]
38
+ })
39
+ ]
40
+ });
41
+ return /*#__PURE__*/ jsxs(Progress.Root, {
42
+ className: ProgressBar_module.root,
43
+ "data-status": status,
44
+ "data-size": size,
45
+ "data-tone": tone,
46
+ value: effectiveValue,
47
+ max: effectiveMax,
48
+ "aria-valuetext": valueText ?? wordOf('indeterminate'),
49
+ "aria-describedby": hasHelper ? helperId : void 0,
50
+ children: [
51
+ !hideLabel || showValue ? /*#__PURE__*/ jsxs("div", {
52
+ className: ProgressBar_module.row,
53
+ children: [
54
+ labelElement,
55
+ showValue ? /*#__PURE__*/ jsx("span", {
56
+ className: ProgressBar_module.value,
57
+ "aria-hidden": "true",
58
+ children: valueText
59
+ }) : null
60
+ ]
61
+ }) : labelElement,
62
+ /*#__PURE__*/ jsx(Progress.Track, {
63
+ className: ProgressBar_module.track,
64
+ children: /*#__PURE__*/ jsx(Progress.Indicator, {
65
+ className: ProgressBar_module.indicator
66
+ })
67
+ }),
68
+ hasHelper ? /*#__PURE__*/ jsx("div", {
69
+ className: ProgressBar_module.helper,
70
+ id: helperId,
71
+ children: helperText
72
+ }) : null
73
+ ]
74
+ });
75
+ }
76
+ export { ProgressBar };
@@ -0,0 +1,12 @@
1
+ import "./ProgressBar_module.css";
2
+ const ProgressBar_module = {
3
+ root: "ui0-7-0-root-mQ6gu",
4
+ row: "ui0-7-0-row-fP05m",
5
+ label: "ui0-7-0-label-rERKj",
6
+ value: "ui0-7-0-value-v0kJr",
7
+ track: "ui0-7-0-track-kT3yt",
8
+ indicator: "ui0-7-0-indicator-Ss0J6",
9
+ slide: "ui0-7-0-slide-RfrrH",
10
+ helper: "ui0-7-0-helper-hJu00"
11
+ };
12
+ export default ProgressBar_module;
@@ -0,0 +1,120 @@
1
+ .ui0-7-0-root-mQ6gu {
2
+ --progress-bar-fill: var(--color-accent);
3
+ gap: var(--space-2);
4
+ flex-direction: column;
5
+ display: flex;
6
+ position: relative;
7
+ }
8
+
9
+ .ui0-7-0-root-mQ6gu[data-tone="selected"] {
10
+ --progress-bar-fill: var(--color-selected);
11
+ }
12
+
13
+ .ui0-7-0-root-mQ6gu[data-status="finished"] {
14
+ --progress-bar-fill: var(--color-success);
15
+ }
16
+
17
+ .ui0-7-0-root-mQ6gu[data-status="error"] {
18
+ --progress-bar-fill: var(--color-danger);
19
+ }
20
+
21
+ .ui0-7-0-row-fP05m {
22
+ justify-content: space-between;
23
+ align-items: baseline;
24
+ gap: var(--space-2);
25
+ display: flex;
26
+ }
27
+
28
+ .ui0-7-0-label-rERKj, .ui0-7-0-value-v0kJr {
29
+ color: var(--color-text);
30
+ font-family: var(--font-sans);
31
+ font-size: var(--text-sm);
32
+ line-height: var(--leading-snug);
33
+ }
34
+
35
+ .ui0-7-0-label-rERKj {
36
+ min-width: 0;
37
+ font-weight: var(--font-weight-label);
38
+ overflow-wrap: anywhere;
39
+ }
40
+
41
+ .ui0-7-0-value-v0kJr {
42
+ font-weight: var(--font-weight-button);
43
+ font-variant-numeric: tabular-nums;
44
+ white-space: nowrap;
45
+ flex: none;
46
+ margin-inline-start: auto;
47
+ }
48
+
49
+ .ui0-7-0-track-kT3yt {
50
+ height: var(--progress-bar-track-size, .5rem);
51
+ border-radius: var(--radius-full);
52
+ background: var(--color-surface-3);
53
+ position: relative;
54
+ overflow: hidden;
55
+ }
56
+
57
+ .ui0-7-0-root-mQ6gu[data-size="sm"] .ui0-7-0-track-kT3yt {
58
+ height: var(--progress-bar-track-size, .25rem);
59
+ }
60
+
61
+ .ui0-7-0-indicator-Ss0J6 {
62
+ border-radius: var(--radius-full);
63
+ background: var(--progress-bar-fill);
64
+ transition-property: width;
65
+ transition-duration: var(--motion-duration-2);
66
+ transition-timing-function: var(--motion-ease);
67
+ }
68
+
69
+ .ui0-7-0-indicator-Ss0J6[data-indeterminate] {
70
+ block-size: 100%;
71
+ inline-size: 40%;
72
+ animation-name: ui0-7-0-slide-RfrrH;
73
+ animation-duration: var(--motion-duration-4);
74
+ animation-timing-function: var(--motion-ease);
75
+ transition: none;
76
+ animation-iteration-count: infinite;
77
+ position: absolute;
78
+ inset-inline-start: 30%;
79
+ }
80
+
81
+ @keyframes ui0-7-0-slide-RfrrH {
82
+ from {
83
+ translate: -175%;
84
+ }
85
+
86
+ to {
87
+ translate: 175%;
88
+ }
89
+ }
90
+
91
+ @media (prefers-reduced-motion: reduce) {
92
+ .ui0-7-0-indicator-Ss0J6[data-indeterminate] {
93
+ animation-name: none;
94
+ }
95
+ }
96
+
97
+ .ui0-7-0-helper-hJu00 {
98
+ color: var(--color-text-muted);
99
+ font-family: var(--font-body);
100
+ font-weight: var(--font-weight-body);
101
+ font-size: var(--text-xs);
102
+ line-height: var(--leading-snug);
103
+ }
104
+
105
+ .ui0-7-0-root-mQ6gu[data-status="error"] .ui0-7-0-helper-hJu00 {
106
+ color: var(--color-danger);
107
+ }
108
+
109
+ @media (forced-colors: active) {
110
+ .ui0-7-0-track-kT3yt {
111
+ outline-offset: -1px;
112
+ outline: 1px solid canvastext;
113
+ }
114
+
115
+ .ui0-7-0-indicator-Ss0J6 {
116
+ forced-color-adjust: none;
117
+ background: highlight;
118
+ }
119
+ }
120
+
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- import { type FieldFrameProps } from '../Field/Field.js';
2
+ import type { FieldFrameProps } from '../Field/Field.js';
3
3
  export interface RadioOption {
4
4
  /** Submitted with the form, and what `value`/`onValueChange` speak in. */
5
5
  value: string;
@@ -4,61 +4,47 @@ import { Radio } from "@base-ui/react/radio";
4
4
  import { RadioGroup } from "@base-ui/react/radio-group";
5
5
  import { useId } from "react";
6
6
  import field_module from "../../styles/field.module.js";
7
- import { FieldMessages, RequiredMark } from "../Field/Field.js";
7
+ import { GroupFrame } from "../Field/GroupFrame.js";
8
8
  import RadioGroup_module from "./RadioGroup.module.js";
9
9
  function RadioGroup_RadioGroup({ label, options, name, description, error, value, defaultValue, onValueChange, onBlur, required = false, disabled = false, orientation = 'vertical' }) {
10
10
  const labelId = useId();
11
- return /*#__PURE__*/ jsxs(Field.Root, {
12
- className: field_module.frame,
11
+ return /*#__PURE__*/ jsx(GroupFrame, {
12
+ labelId: labelId,
13
+ label: label,
13
14
  name: name,
15
+ description: description,
16
+ error: error,
17
+ required: required,
14
18
  disabled: disabled,
15
- invalid: void 0 !== error,
16
- children: [
17
- /*#__PURE__*/ jsxs("span", {
18
- className: field_module.legend,
19
- id: labelId,
20
- "data-disabled": disabled ? '' : void 0,
21
- children: [
22
- label,
23
- /*#__PURE__*/ jsx(RequiredMark, {
24
- when: required
19
+ children: /*#__PURE__*/ jsx(RadioGroup, {
20
+ className: field_module.options,
21
+ "data-orientation": orientation,
22
+ "aria-labelledby": labelId,
23
+ value: value,
24
+ defaultValue: defaultValue,
25
+ onValueChange: (nextValue)=>onValueChange?.(nextValue),
26
+ onBlur: onBlur,
27
+ required: required,
28
+ children: options.map((option)=>/*#__PURE__*/ jsx(Field.Item, {
29
+ disabled: option.disabled,
30
+ children: /*#__PURE__*/ jsxs(Field.Label, {
31
+ className: field_module.optionLabel,
32
+ children: [
33
+ /*#__PURE__*/ jsx(Radio.Root, {
34
+ className: [
35
+ field_module.controlBox,
36
+ RadioGroup_module.dot
37
+ ].join(' '),
38
+ value: option.value,
39
+ children: /*#__PURE__*/ jsx(Radio.Indicator, {
40
+ className: RadioGroup_module.mark
41
+ })
42
+ }),
43
+ option.label
44
+ ]
25
45
  })
26
- ]
27
- }),
28
- /*#__PURE__*/ jsx(RadioGroup, {
29
- className: field_module.options,
30
- "data-orientation": orientation,
31
- "aria-labelledby": labelId,
32
- value: value,
33
- defaultValue: defaultValue,
34
- onValueChange: (nextValue)=>onValueChange?.(nextValue),
35
- onBlur: onBlur,
36
- required: required,
37
- children: options.map((option)=>/*#__PURE__*/ jsx(Field.Item, {
38
- disabled: option.disabled,
39
- children: /*#__PURE__*/ jsxs(Field.Label, {
40
- className: field_module.optionLabel,
41
- children: [
42
- /*#__PURE__*/ jsx(Radio.Root, {
43
- className: [
44
- field_module.controlBox,
45
- RadioGroup_module.dot
46
- ].join(' '),
47
- value: option.value,
48
- children: /*#__PURE__*/ jsx(Radio.Indicator, {
49
- className: RadioGroup_module.mark
50
- })
51
- }),
52
- option.label
53
- ]
54
- })
55
- }, option.value))
56
- }),
57
- /*#__PURE__*/ jsx(FieldMessages, {
58
- description: description,
59
- error: error
60
- })
61
- ]
46
+ }, option.value))
47
+ })
62
48
  });
63
49
  }
64
50
  export { RadioGroup_RadioGroup as RadioGroup };
@@ -1,6 +1,6 @@
1
1
  import "./RadioGroup_module.css";
2
2
  const RadioGroup_module = {
3
- dot: "dot-A51b6",
4
- mark: "mark-zVMGA"
3
+ dot: "ui0-7-0-dot-A51b6",
4
+ mark: "ui0-7-0-mark-zVMGA"
5
5
  };
6
6
  export default RadioGroup_module;
@@ -1,10 +1,10 @@
1
- .dot-A51b6 {
1
+ .ui0-7-0-dot-A51b6 {
2
2
  border-radius: var(--radius-full);
3
3
  width: 1.25rem;
4
4
  height: 1.25rem;
5
5
  }
6
6
 
7
- .mark-zVMGA {
7
+ .ui0-7-0-mark-zVMGA {
8
8
  border-radius: var(--radius-full);
9
9
  background: var(--color-accent-text);
10
10
  width: .5rem;
@@ -0,0 +1,32 @@
1
+ import { type ComponentPropsWithoutRef } from 'react';
2
+ export interface SearchFieldProps extends Omit<ComponentPropsWithoutRef<'input'>, 'className' | 'type' | 'value' | 'defaultValue' | 'onChange' | 'onSubmit' | 'size' | 'disabled'> {
3
+ /** The accessible name; visible unless `hideLabel`. */
4
+ label: string;
5
+ /** Hides the label from the eye and keeps it as the field's name. */
6
+ hideLabel?: boolean;
7
+ /** Controlled. Pair it with `onValueChange`; use `defaultValue` for an uncontrolled field. */
8
+ value?: string;
9
+ defaultValue?: string;
10
+ /** One argument, as on every other control in the library: the new value, `''` after a clear. */
11
+ onValueChange?: (value: string) => void;
12
+ /**
13
+ * Enter, or the clear control or Escape: the current value, `''` after a clear. Enter is left
14
+ * alone, so an enclosing `<form>` submits as well.
15
+ */
16
+ onSubmit?: (value: string) => void;
17
+ /** The accessible name of the clear control. */
18
+ clearLabel?: string;
19
+ size?: 'sm' | 'md';
20
+ disabled?: boolean;
21
+ className?: string;
22
+ }
23
+ /**
24
+ * A pill search field with a leading search glyph and, while it holds a value, a clear control.
25
+ *
26
+ * Escape with a value clears it exactly as the clear control does and says so with `preventDefault`
27
+ * and `stopPropagation`: the first stops the browser's own clearing of a `type="search"` input,
28
+ * whose `input` event would call `onValueChange('')` a second time, and the second keeps an
29
+ * enclosing `Dialog` open, which Base UI dismisses on the document's Escape. Escape in an empty
30
+ * field does neither, so a dialog around it still closes.
31
+ */
32
+ export declare function SearchField({ label, hideLabel, value, defaultValue, onValueChange, onSubmit, clearLabel, size, disabled, className, ...inputProps }: SearchFieldProps): import("react").JSX.Element;
@@ -0,0 +1,100 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useId, useRef } from "react";
3
+ import { useControllable } from "../../hooks/useControllable.js";
4
+ import { CloseIcon } from "../../icons/CloseIcon.js";
5
+ import { SearchIcon } from "../../icons/SearchIcon.js";
6
+ import a11y_module from "../../styles/a11y.module.js";
7
+ import closeCircle_module from "../../styles/closeCircle.module.js";
8
+ import field_module from "../../styles/field.module.js";
9
+ import { focusInputFromPill } from "../../utils/focusInputFromPill.js";
10
+ import { useFormValue } from "../Form/FormContext.js";
11
+ import { IconButton } from "../IconButton/IconButton.js";
12
+ import SearchField_module from "./SearchField.module.js";
13
+ function SearchField({ label, hideLabel = false, value, defaultValue, onValueChange, onSubmit, clearLabel = 'Clear search', size = 'md', disabled = false, className, ...inputProps }) {
14
+ const generatedId = useId();
15
+ const inputId = inputProps.id ?? generatedId;
16
+ const inputRef = useRef(null);
17
+ const [current, setCurrent] = useControllable(value, defaultValue ?? '');
18
+ useFormValue(disabled ? void 0 : inputProps.name, current);
19
+ function change(nextValue) {
20
+ setCurrent(nextValue);
21
+ onValueChange?.(nextValue);
22
+ }
23
+ function clear() {
24
+ change('');
25
+ onSubmit?.('');
26
+ inputRef.current?.focus();
27
+ }
28
+ function handleKeyDown(event) {
29
+ inputProps.onKeyDown?.(event);
30
+ if (event.nativeEvent.isComposing || 229 === event.keyCode) return;
31
+ if ('Enter' === event.key) onSubmit?.(current);
32
+ else if ('Escape' === event.key && '' !== current) {
33
+ event.preventDefault();
34
+ event.stopPropagation();
35
+ clear();
36
+ }
37
+ }
38
+ const labelId = `${inputId}-label`;
39
+ return /*#__PURE__*/ jsxs("div", {
40
+ role: "search",
41
+ "aria-labelledby": labelId,
42
+ className: [
43
+ field_module.frame,
44
+ SearchField_module.root,
45
+ className
46
+ ].filter(Boolean).join(' '),
47
+ "data-size": size,
48
+ children: [
49
+ /*#__PURE__*/ jsx("label", {
50
+ id: labelId,
51
+ htmlFor: inputId,
52
+ className: hideLabel ? a11y_module.visuallyHidden : field_module.label,
53
+ "data-disabled": disabled ? '' : void 0,
54
+ children: label
55
+ }),
56
+ /*#__PURE__*/ jsxs("div", {
57
+ className: [
58
+ field_module.control,
59
+ field_module.affix,
60
+ SearchField_module.box
61
+ ].join(' '),
62
+ "data-disabled": disabled ? '' : void 0,
63
+ onMouseDown: (event)=>focusInputFromPill(event, inputRef.current),
64
+ children: [
65
+ /*#__PURE__*/ jsx("span", {
66
+ className: field_module.affixIcon,
67
+ "aria-hidden": "true",
68
+ children: /*#__PURE__*/ jsx(SearchIcon, {})
69
+ }),
70
+ /*#__PURE__*/ jsx("input", {
71
+ ...inputProps,
72
+ ref: inputRef,
73
+ id: inputId,
74
+ type: "search",
75
+ className: [
76
+ field_module.affixInput,
77
+ SearchField_module.input
78
+ ].join(' '),
79
+ value: current,
80
+ disabled: disabled,
81
+ onChange: (event)=>change(event.currentTarget.value),
82
+ onKeyDown: handleKeyDown
83
+ }),
84
+ '' === current || disabled ? null : /*#__PURE__*/ jsx(IconButton, {
85
+ variant: "ghost",
86
+ size: "sm",
87
+ label: clearLabel,
88
+ className: [
89
+ SearchField_module.clear,
90
+ closeCircle_module.close
91
+ ].join(' '),
92
+ onClick: clear,
93
+ children: /*#__PURE__*/ jsx(CloseIcon, {})
94
+ })
95
+ ]
96
+ })
97
+ ]
98
+ });
99
+ }
100
+ export { SearchField };
@@ -0,0 +1,8 @@
1
+ import "./SearchField_module.css";
2
+ const SearchField_module = {
3
+ root: "ui0-7-0-root-v2qcn",
4
+ box: "ui0-7-0-box-EP5Wy",
5
+ clear: "ui0-7-0-clear-WukbI",
6
+ input: "ui0-7-0-input-zuTre"
7
+ };
8
+ export default SearchField_module;