@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,40 +1,43 @@
1
- .scroll-vHFjf {
1
+ .ui0-7-0-scroll-vHFjf {
2
2
  border: 1px solid var(--color-border);
3
- border-radius: var(--radius-lg);
3
+ border-radius: var(--radius-popup);
4
4
  background: var(--color-surface-raised);
5
5
  overflow-x: auto;
6
6
  }
7
7
 
8
- .scroll-vHFjf[data-bare] {
8
+ .ui0-7-0-scroll-vHFjf[data-bare] {
9
9
  background: none;
10
10
  border: 0;
11
11
  border-radius: 0;
12
12
  }
13
13
 
14
- .table-H20Eb {
14
+ .ui0-7-0-table-H20Eb {
15
15
  border-collapse: collapse;
16
16
  width: 100%;
17
+ font-family: var(--font-body);
18
+ font-weight: var(--font-weight-body);
17
19
  font-size: var(--text-sm);
18
20
  font-variant-numeric: tabular-nums;
19
21
  }
20
22
 
21
- .caption-glW7e {
23
+ .ui0-7-0-caption-glW7e {
22
24
  padding: var(--space-3) var(--space-5);
23
25
  text-align: left;
26
+ font-family: var(--font-sans);
27
+ font-weight: var(--font-weight-heading);
24
28
  color: var(--color-text);
25
29
  caption-side: top;
26
- font-weight: 600;
27
30
  }
28
31
 
29
- .caption-glW7e[data-hidden] {
32
+ .ui0-7-0-caption-glW7e[data-hidden] {
30
33
  padding: 0;
31
34
  }
32
35
 
33
- .head-KQpiR {
36
+ .ui0-7-0-head-KQpiR {
34
37
  background: var(--color-surface-2);
35
38
  }
36
39
 
37
- .headerCell-Bm5aB {
40
+ .ui0-7-0-headerCell-Bm5aB {
38
41
  padding: var(--space-1) var(--space-3);
39
42
  border-block: 1px solid var(--color-border);
40
43
  text-align: left;
@@ -47,7 +50,7 @@
47
50
  font-weight: 500;
48
51
  }
49
52
 
50
- .sortButton-b2Ze6 {
53
+ .ui0-7-0-sortButton-b2Ze6 {
51
54
  align-items: center;
52
55
  gap: var(--space-1);
53
56
  min-height: var(--size-touch);
@@ -62,22 +65,22 @@
62
65
  display: inline-flex;
63
66
  }
64
67
 
65
- .sortIcon-sc98J:after {
68
+ .ui0-7-0-sortIcon-sc98J:after {
66
69
  content: "↕";
67
70
  color: var(--color-text-subtle);
68
71
  }
69
72
 
70
- .sortIcon-sc98J[data-direction="asc"]:after {
73
+ .ui0-7-0-sortIcon-sc98J[data-direction="asc"]:after {
71
74
  content: "↑";
72
75
  color: var(--color-link);
73
76
  }
74
77
 
75
- .sortIcon-sc98J[data-direction="desc"]:after {
78
+ .ui0-7-0-sortIcon-sc98J[data-direction="desc"]:after {
76
79
  content: "↓";
77
80
  color: var(--color-link);
78
81
  }
79
82
 
80
- .row-oItIj {
83
+ .ui0-7-0-row-oItIj {
81
84
  border-bottom: 1px solid var(--color-border);
82
85
  transition-property: background-color;
83
86
  transition-duration: var(--motion-duration-1);
@@ -85,33 +88,33 @@
85
88
  }
86
89
 
87
90
  @media (hover: hover) {
88
- .row-oItIj:hover {
91
+ .ui0-7-0-row-oItIj:hover {
89
92
  background: var(--color-surface-2);
90
93
  }
91
94
  }
92
95
 
93
- .cell-L4VgS {
96
+ .ui0-7-0-cell-L4VgS {
94
97
  height: 2.75rem;
95
98
  padding: var(--space-2) var(--space-3);
96
99
  vertical-align: middle;
97
100
  white-space: nowrap;
98
101
  }
99
102
 
100
- .headerCell-Bm5aB:first-child, .cell-L4VgS:first-child {
103
+ .ui0-7-0-headerCell-Bm5aB:first-child, .ui0-7-0-cell-L4VgS:first-child {
101
104
  padding-inline-start: var(--space-5);
102
105
  }
103
106
 
104
- .headerCell-Bm5aB:last-child, .cell-L4VgS:last-child {
107
+ .ui0-7-0-headerCell-Bm5aB:last-child, .ui0-7-0-cell-L4VgS:last-child {
105
108
  padding-inline-end: var(--space-5);
106
109
  }
107
110
 
108
- .table-H20Eb[data-stacked] .row-oItIj {
111
+ .ui0-7-0-table-H20Eb[data-stacked] .ui0-7-0-row-oItIj {
109
112
  gap: var(--space-1);
110
113
  padding: var(--space-3) var(--space-5);
111
114
  display: grid;
112
115
  }
113
116
 
114
- .table-H20Eb[data-stacked] .cell-L4VgS {
117
+ .ui0-7-0-table-H20Eb[data-stacked] .ui0-7-0-cell-L4VgS {
115
118
  gap: var(--space-2);
116
119
  white-space: normal;
117
120
  overflow-wrap: anywhere;
@@ -121,7 +124,7 @@
121
124
  display: grid;
122
125
  }
123
126
 
124
- .table-H20Eb[data-stacked] .cell-L4VgS:before {
127
+ .ui0-7-0-table-H20Eb[data-stacked] .ui0-7-0-cell-L4VgS:before {
125
128
  content: attr(data-label);
126
129
  font-family: var(--font-mono);
127
130
  font-size: var(--text-2xs);
@@ -62,6 +62,20 @@ export interface DatePickerProps extends FieldFrameProps {
62
62
  clearable?: boolean;
63
63
  /** Shown on the trigger while nothing is chosen. */
64
64
  placeholder?: string;
65
+ /**
66
+ * How the chosen date reads on the trigger, in the picker's `locale`: the options of
67
+ * `Intl.DateTimeFormat`. Defaults to `{ dateStyle: 'medium' }`. The placeholder and the calendar's
68
+ * own labels do not follow it. The date is a calendar day, so `timeZone` and `calendar` are fixed
69
+ * (UTC and Gregorian) whatever the options say. `Intl` refuses `dateStyle` beside the individual
70
+ * fields (`weekday`, `month` and the rest), and a value it does not know: options it refuses fall
71
+ * back to the default, with a warning in development, so use one or the other.
72
+ */
73
+ formatOptions?: Intl.DateTimeFormatOptions;
74
+ /**
75
+ * Which end of the trigger the calendar icon sits at. `start` puts it before the date and packs
76
+ * both to the start; `end` is the trigger as it was.
77
+ */
78
+ iconPlacement?: 'start' | 'end';
65
79
  /** The words the control says itself, for an app that is not in English. */
66
80
  labels?: Partial<DatePickerLabels>;
67
81
  }
@@ -69,4 +83,4 @@ export interface DatePickerProps extends FieldFrameProps {
69
83
  * A date field: a button showing the formatted date opens the WAI-ARIA date picker dialog, whose
70
84
  * grid is ours because Base UI has no public calendar. Submits `YYYY-MM-DD` through a hidden input.
71
85
  */
72
- export declare function DatePicker({ label, name, description, error, required, disabled, value, defaultValue, onValueChange, onBlur, min, max, isDateDisabled, locale, weekStartsOn, clearable, placeholder, labels, }: DatePickerProps): import("react").JSX.Element;
86
+ export declare function DatePicker({ label, name, description, error, required, disabled, value, defaultValue, onValueChange, onBlur, min, max, isDateDisabled, locale, weekStartsOn, clearable, placeholder, formatOptions, iconPlacement, labels, }: DatePickerProps): import("react").JSX.Element;
@@ -1,7 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Popover } from "@base-ui/react/popover";
3
- import { useRef, useState } from "react";
3
+ import { useEffect, useRef, useState } from "react";
4
4
  import { CalendarIcon } from "../../icons/CalendarIcon.js";
5
+ import { usePortalContainer } from "../ThemeScope/PortalContainerContext.js";
5
6
  import popup_module from "../../styles/popup.module.js";
6
7
  import { Button } from "../Button/Button.js";
7
8
  import { PickerField } from "../Field/PickerField.js";
@@ -16,8 +17,26 @@ const DEFAULT_LABELS = {
16
17
  requiredMessage: 'Choose a date.',
17
18
  unavailableMessage: 'Choose an available date.'
18
19
  };
19
- function DatePicker({ label, name, description, error, required = false, disabled = false, value, defaultValue, onValueChange, onBlur, min, max, isDateDisabled, locale, weekStartsOn, clearable = false, placeholder = 'Choose a date', labels }) {
20
+ const DEFAULT_FORMAT_OPTIONS = {
21
+ dateStyle: 'medium'
22
+ };
23
+ function triggerFormatter(locale, options) {
24
+ try {
25
+ return {
26
+ formatter: dateFormatter(locale, options),
27
+ refused: false
28
+ };
29
+ } catch (error) {
30
+ if (!(error instanceof TypeError || error instanceof RangeError)) throw error;
31
+ return {
32
+ formatter: dateFormatter(locale, DEFAULT_FORMAT_OPTIONS),
33
+ refused: true
34
+ };
35
+ }
36
+ }
37
+ function DatePicker({ label, name, description, error, required = false, disabled = false, value, defaultValue, onValueChange, onBlur, min, max, isDateDisabled, locale, weekStartsOn, clearable = false, placeholder = 'Choose a date', formatOptions = DEFAULT_FORMAT_OPTIONS, iconPlacement = 'end', labels }) {
20
38
  const gridRef = useRef(null);
39
+ const container = usePortalContainer();
21
40
  const [heldValue, setHeldValue] = useState(()=>parseIsoDate(defaultValue));
22
41
  const [open, setOpen] = useState(false);
23
42
  if (open && disabled) setOpen(false);
@@ -31,6 +50,12 @@ function DatePicker({ label, name, description, error, required = false, disable
31
50
  const firstWeekday = weekStartsOn ?? weekStartOf(resolvedLocale);
32
51
  const earliest = parseIsoDate(min);
33
52
  const latest = parseIsoDate(max);
53
+ const { formatter, refused } = triggerFormatter(resolvedLocale, formatOptions);
54
+ useEffect(()=>{
55
+ if (refused && 'production' !== process.env.NODE_ENV) console.warn('DatePicker: Intl.DateTimeFormat refused formatOptions; the default { dateStyle: "medium" } is used instead.');
56
+ }, [
57
+ refused
58
+ ]);
34
59
  const commit = (nextValue)=>{
35
60
  setHeldValue(nextValue);
36
61
  if (nextValue !== chosen) onValueChange?.(nextValue);
@@ -43,10 +68,9 @@ function DatePicker({ label, name, description, error, required = false, disable
43
68
  required: required,
44
69
  disabled: disabled,
45
70
  value: chosen,
46
- valueText: null === chosen ? placeholder : dateFormatter(resolvedLocale, {
47
- dateStyle: 'medium'
48
- }).format(chosen),
71
+ valueText: null === chosen ? placeholder : formatter.format(chosen),
49
72
  icon: /*#__PURE__*/ jsx(CalendarIcon, {}),
73
+ iconPlacement: iconPlacement,
50
74
  requiredWord: words.required,
51
75
  validate: ()=>{
52
76
  if (null === chosen) return required ? words.requiredMessage : null;
@@ -67,6 +91,7 @@ function DatePicker({ label, name, description, error, required = false, disable
67
91
  onOpenChange: setOpen,
68
92
  modal: "trap-focus",
69
93
  children: /*#__PURE__*/ jsx(Popover.Portal, {
94
+ container: container,
70
95
  children: /*#__PURE__*/ jsx(Popover.Positioner, {
71
96
  className: popup_module.layer,
72
97
  align: "start",
@@ -1,14 +1,14 @@
1
1
  import "./DatePicker_module.css";
2
2
  const DatePicker_module = {
3
- popup: "popup-KehYf",
4
- header: "header-zwN0_",
5
- month: "month-kmJCd",
6
- previous: "previous-zWGPB",
7
- next: "next-caCSG",
8
- gridSlot: "gridSlot-XSqqc",
9
- grid: "grid-OEI6m",
10
- weekday: "weekday-BLI2K",
11
- day: "day-DOQIC",
12
- footer: "footer-rvxzg"
3
+ popup: "ui0-7-0-popup-KehYf",
4
+ header: "ui0-7-0-header-zwN0_",
5
+ month: "ui0-7-0-month-kmJCd",
6
+ previous: "ui0-7-0-previous-zWGPB",
7
+ next: "ui0-7-0-next-caCSG",
8
+ gridSlot: "ui0-7-0-gridSlot-XSqqc",
9
+ grid: "ui0-7-0-grid-OEI6m",
10
+ weekday: "ui0-7-0-weekday-BLI2K",
11
+ day: "ui0-7-0-day-DOQIC",
12
+ footer: "ui0-7-0-footer-rvxzg"
13
13
  };
14
14
  export default DatePicker_module;
@@ -1,52 +1,53 @@
1
- .popup-KehYf {
1
+ .ui0-7-0-popup-KehYf {
2
2
  width: 22rem;
3
3
  }
4
4
 
5
- .header-zwN0_ {
5
+ .ui0-7-0-header-zwN0_ {
6
6
  justify-content: space-between;
7
7
  align-items: center;
8
8
  gap: var(--space-2);
9
9
  display: flex;
10
10
  }
11
11
 
12
- .month-kmJCd {
12
+ .ui0-7-0-month-kmJCd {
13
13
  color: var(--color-text);
14
+ font-family: var(--font-sans);
14
15
  font-size: var(--text-md);
15
- font-weight: 500;
16
+ font-weight: var(--font-weight-label);
16
17
  line-height: var(--leading-snug);
17
18
  text-align: center;
18
19
  flex: 1;
19
20
  }
20
21
 
21
- .previous-zWGPB svg {
22
+ .ui0-7-0-previous-zWGPB svg {
22
23
  transform: rotate(90deg);
23
24
  }
24
25
 
25
- .next-caCSG svg, .header-zwN0_[data-direction="rtl"] .previous-zWGPB svg {
26
+ .ui0-7-0-next-caCSG svg, .ui0-7-0-header-zwN0_[data-direction="rtl"] .ui0-7-0-previous-zWGPB svg {
26
27
  transform: rotate(-90deg);
27
28
  }
28
29
 
29
- .header-zwN0_[data-direction="rtl"] .next-caCSG svg {
30
+ .ui0-7-0-header-zwN0_[data-direction="rtl"] .ui0-7-0-next-caCSG svg {
30
31
  transform: rotate(90deg);
31
32
  }
32
33
 
33
- .previous-zWGPB[aria-disabled="true"], .next-caCSG[aria-disabled="true"] {
34
+ .ui0-7-0-previous-zWGPB[aria-disabled="true"], .ui0-7-0-next-caCSG[aria-disabled="true"] {
34
35
  cursor: not-allowed;
35
36
  opacity: .45;
36
37
  }
37
38
 
38
- .gridSlot-XSqqc {
39
+ .ui0-7-0-gridSlot-XSqqc {
39
40
  min-height: calc(7 * var(--size-touch));
40
41
  }
41
42
 
42
- .grid-OEI6m {
43
+ .ui0-7-0-grid-OEI6m {
43
44
  border-collapse: separate;
44
45
  border-spacing: 0;
45
46
  table-layout: fixed;
46
47
  width: 100%;
47
48
  }
48
49
 
49
- .weekday-BLI2K {
50
+ .ui0-7-0-weekday-BLI2K {
50
51
  height: var(--size-touch);
51
52
  color: var(--color-text-muted);
52
53
  font-size: var(--text-sm);
@@ -55,7 +56,7 @@
55
56
  font-weight: 500;
56
57
  }
57
58
 
58
- .day-DOQIC {
59
+ .ui0-7-0-day-DOQIC {
59
60
  height: var(--size-touch);
60
61
  border-radius: var(--radius-md);
61
62
  color: var(--color-text);
@@ -70,42 +71,42 @@
70
71
  }
71
72
 
72
73
  @media (hover: hover) {
73
- .day-DOQIC:hover:not([aria-disabled="true"], [aria-selected="true"]) {
74
+ .ui0-7-0-day-DOQIC:hover:not([aria-disabled="true"], [aria-selected="true"]) {
74
75
  background: var(--color-surface-2);
75
76
  }
76
77
  }
77
78
 
78
- .day-DOQIC[aria-current="date"] {
79
+ .ui0-7-0-day-DOQIC[aria-current="date"] {
79
80
  border: 1px solid var(--color-accent);
80
81
  font-weight: 600;
81
82
  }
82
83
 
83
- .day-DOQIC[aria-selected="true"] {
84
- background: var(--color-accent);
85
- color: var(--color-accent-text);
84
+ .ui0-7-0-day-DOQIC[aria-selected="true"] {
85
+ background: var(--color-selected);
86
+ color: var(--color-selected-text);
86
87
  }
87
88
 
88
- .day-DOQIC[aria-disabled="true"] {
89
+ .ui0-7-0-day-DOQIC[aria-disabled="true"] {
89
90
  cursor: not-allowed;
90
91
  opacity: .45;
91
92
  text-decoration: line-through;
92
93
  }
93
94
 
94
95
  @media (forced-colors: active) {
95
- .day-DOQIC[aria-selected="true"] {
96
+ .ui0-7-0-day-DOQIC[aria-selected="true"] {
96
97
  forced-color-adjust: none;
97
98
  color: highlighttext;
98
99
  background: highlight;
99
100
  outline-color: canvastext;
100
101
  }
101
102
 
102
- .day-DOQIC[aria-disabled="true"] {
103
+ .ui0-7-0-day-DOQIC[aria-disabled="true"] {
103
104
  opacity: 1;
104
105
  color: graytext;
105
106
  }
106
107
  }
107
108
 
108
- .footer-rvxzg {
109
+ .ui0-7-0-footer-rvxzg {
109
110
  justify-content: flex-end;
110
111
  display: flex;
111
112
  }
@@ -1,8 +1,8 @@
1
1
  import "./Descriptions_module.css";
2
2
  const Descriptions_module = {
3
- root: "root-bQlQQ",
4
- heading: "heading-aHnDT",
5
- list: "list-Qwuyt",
6
- group: "group-fd_ih"
3
+ root: "ui0-7-0-root-bQlQQ",
4
+ heading: "ui0-7-0-heading-aHnDT",
5
+ list: "ui0-7-0-list-Qwuyt",
6
+ group: "ui0-7-0-group-fd_ih"
7
7
  };
8
8
  export default Descriptions_module;
@@ -1,25 +1,29 @@
1
- .root-bQlQQ {
1
+ .ui0-7-0-root-bQlQQ {
2
2
  gap: var(--space-3);
3
3
  flex-direction: column;
4
4
  display: flex;
5
5
  }
6
6
 
7
- .heading-aHnDT {
7
+ .ui0-7-0-heading-aHnDT {
8
8
  color: var(--color-text);
9
9
  font-size: var(--text-h3);
10
+ font-family: var(--font-display);
11
+ font-weight: var(--font-weight-display);
12
+ font-stretch: var(--font-stretch-display);
13
+ text-transform: var(--text-transform-display);
10
14
  line-height: var(--leading-snug);
11
15
  letter-spacing: var(--tracking-heading);
12
16
  margin: 0;
13
17
  }
14
18
 
15
- .list-Qwuyt {
19
+ .ui0-7-0-list-Qwuyt {
16
20
  gap: var(--space-4);
17
21
  grid-template-columns: minmax(0, 1fr);
18
22
  margin: 0;
19
23
  display: grid;
20
24
  }
21
25
 
22
- .group-fd_ih {
26
+ .ui0-7-0-group-fd_ih {
23
27
  gap: var(--space-1);
24
28
  overflow-wrap: anywhere;
25
29
  flex-direction: column;
@@ -28,19 +32,19 @@
28
32
  }
29
33
 
30
34
  @media (width >= 40rem) {
31
- .list-Qwuyt[data-columns="2"] {
35
+ .ui0-7-0-list-Qwuyt[data-columns="2"] {
32
36
  grid-template-columns: repeat(2, minmax(0, 1fr));
33
37
  }
34
38
 
35
- .list-Qwuyt[data-columns="3"] {
39
+ .ui0-7-0-list-Qwuyt[data-columns="3"] {
36
40
  grid-template-columns: repeat(3, minmax(0, 1fr));
37
41
  }
38
42
 
39
- .group-fd_ih[data-span="2"] {
43
+ .ui0-7-0-group-fd_ih[data-span="2"] {
40
44
  grid-column: span 2;
41
45
  }
42
46
 
43
- .group-fd_ih[data-span="3"] {
47
+ .ui0-7-0-group-fd_ih[data-span="3"] {
44
48
  grid-column: span 3;
45
49
  }
46
50
  }
@@ -1,4 +1,4 @@
1
- import type { ReactElement, ReactNode } from 'react';
1
+ import { type ReactElement, type ReactNode } from 'react';
2
2
  export type DialogVariant = 'center' | 'sheet';
3
3
  /** The edge a sheet docks to: `bottom` is the phone pattern, `end` a full-height side panel. */
4
4
  export type SheetSide = 'bottom' | 'end';
@@ -11,6 +11,22 @@ export interface DialogProps {
11
11
  /** Names the popup: it is both the visible heading and the popup's `aria-labelledby` target. */
12
12
  heading: string;
13
13
  headingLevel?: 2 | 3 | 4;
14
+ /**
15
+ * Hides the heading from view while it stays the popup's name (`aria-labelledby`), for a dialog
16
+ * whose own content already says what it is. The header's end group keeps its place at the end.
17
+ */
18
+ headingHidden?: boolean;
19
+ /**
20
+ * Content before the heading in the header row, such as a `Tag` naming the kind of thing the
21
+ * dialog is about.
22
+ */
23
+ headerStart?: ReactNode;
24
+ /**
25
+ * Controls grouped at the end of the header, before the close control, such as a "More" menu
26
+ * button. On open, focus lands on the close control, except with `closeHidden`, when it goes to
27
+ * the first tabbable control, which may be a `headerEnd` button.
28
+ */
29
+ headerEnd?: ReactNode;
14
30
  /** Sits under the heading and becomes the popup's `aria-describedby` target. */
15
31
  description?: ReactNode;
16
32
  children?: ReactNode;
@@ -30,6 +46,18 @@ export interface DialogProps {
30
46
  side?: SheetSide;
31
47
  /** The accessible name of the close control in the header. */
32
48
  closeLabel?: string;
49
+ /**
50
+ * `ghost` (the default) is the bare close; `soft` is the quiet filled circle the mock draws on a
51
+ * photo or a tinted header. The close is drawn as a 36 px circle in both, with a 44 px touch
52
+ * target, never a larger button.
53
+ */
54
+ closeVariant?: 'ghost' | 'soft';
55
+ /**
56
+ * Draws no close control. The caller renders its own visible way out (a "Cancel" in the footer);
57
+ * Escape and a press on the scrim still close the dialog, and `headerEnd` still renders. With no
58
+ * close control the opening focus goes to the first tabbable control in the popup.
59
+ */
60
+ closeHidden?: boolean;
33
61
  /**
34
62
  * Whether a press outside the popup closes it. Escape always does: Base UI has no prop for
35
63
  * that, and vetoing it means cancelling the event inside `onOpenChange`, which this wrapper
@@ -41,4 +69,4 @@ export interface DialogProps {
41
69
  /** Base UI calls this as `(open, eventDetails)`; the second argument is passed through. */
42
70
  onOpenChange?: (open: boolean, eventDetails: unknown) => void;
43
71
  }
44
- export declare function Dialog({ trigger, heading, headingLevel, description, children, footer, variant, side, closeLabel, dismissOnOutsidePress, open, defaultOpen, onOpenChange, }: DialogProps): import("react").JSX.Element;
72
+ export declare function Dialog({ trigger, heading, headingLevel, headingHidden, headerStart, headerEnd, description, children, footer, variant, side, closeLabel, closeVariant, closeHidden, dismissOnOutsidePress, open, defaultOpen, onOpenChange, }: DialogProps): import("react").JSX.Element;
@@ -1,17 +1,30 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Dialog } from "@base-ui/react/dialog";
3
+ import { useId, useRef } from "react";
3
4
  import { CloseIcon } from "../../icons/CloseIcon.js";
5
+ import { useOverflowFocusable } from "../../hooks/useOverflowFocusable.js";
4
6
  import { IconButton } from "../IconButton/IconButton.js";
7
+ import { usePortalContainer } from "../ThemeScope/PortalContainerContext.js";
8
+ import a11y_module from "../../styles/a11y.module.js";
9
+ import closeCircle_module from "../../styles/closeCircle.module.js";
5
10
  import popup_module from "../../styles/popup.module.js";
11
+ import { hasContent } from "../../utils/hasContent.js";
6
12
  import Dialog_module from "./Dialog.module.js";
7
13
  const headingTags = {
8
14
  2: 'h2',
9
15
  3: 'h3',
10
16
  4: 'h4'
11
17
  };
12
- function Dialog_Dialog({ trigger, heading, headingLevel = 2, description, children, footer, variant = 'center', side = 'bottom', closeLabel = 'Close', dismissOnOutsidePress = true, open, defaultOpen, onOpenChange }) {
18
+ function Dialog_Dialog({ trigger, heading, headingLevel = 2, headingHidden = false, headerStart, headerEnd, description, children, footer, variant = 'center', side = 'bottom', closeLabel = 'Close', closeVariant = 'ghost', closeHidden = false, dismissOnOutsidePress = true, open, defaultOpen, onOpenChange }) {
13
19
  const sheetSide = 'sheet' === variant ? side : void 0;
14
20
  const Heading = headingTags[headingLevel] ?? 'h2';
21
+ const container = usePortalContainer();
22
+ const popupRef = useRef(null);
23
+ const closeRef = useRef(null);
24
+ const initialFocus = (interactionType)=>'touch' === interactionType ? popupRef.current : closeRef.current ?? true;
25
+ const showEndGroup = hasContent(headerEnd) || !closeHidden;
26
+ const titleId = useId();
27
+ const [bodyRef, bodyOverflows] = useOverflowFocusable();
15
28
  return /*#__PURE__*/ jsxs(Dialog.Root, {
16
29
  open: open,
17
30
  defaultOpen: defaultOpen,
@@ -22,12 +35,15 @@ function Dialog_Dialog({ trigger, heading, headingLevel = 2, description, childr
22
35
  render: trigger
23
36
  }),
24
37
  /*#__PURE__*/ jsxs(Dialog.Portal, {
38
+ container: container,
25
39
  children: [
26
40
  /*#__PURE__*/ jsx(Dialog.Backdrop, {
27
41
  className: [
28
42
  popup_module.dialogLayer,
29
43
  popup_module.scrim
30
- ].join(' ')
44
+ ].join(' '),
45
+ "data-variant": variant,
46
+ "data-side": sheetSide
31
47
  }),
32
48
  /*#__PURE__*/ jsx(Dialog.Viewport, {
33
49
  className: [
@@ -37,26 +53,45 @@ function Dialog_Dialog({ trigger, heading, headingLevel = 2, description, childr
37
53
  "data-variant": variant,
38
54
  "data-side": sheetSide,
39
55
  children: /*#__PURE__*/ jsxs(Dialog.Popup, {
56
+ ref: popupRef,
40
57
  className: popup_module.surface,
41
58
  "data-popup": 'sheet' === variant ? 'sheet' : 'dialog',
42
59
  "data-side": sheetSide,
60
+ initialFocus: initialFocus,
43
61
  children: [
62
+ 'bottom' === sheetSide ? /*#__PURE__*/ jsx("div", {
63
+ className: Dialog_module.handle,
64
+ "aria-hidden": "true"
65
+ }) : null,
44
66
  /*#__PURE__*/ jsxs("div", {
45
67
  className: Dialog_module.header,
46
68
  children: [
69
+ headerStart,
47
70
  /*#__PURE__*/ jsx(Dialog.Title, {
48
- className: Dialog_module.heading,
71
+ id: titleId,
72
+ className: [
73
+ Dialog_module.heading,
74
+ headingHidden ? a11y_module.visuallyHidden : void 0
75
+ ].filter(Boolean).join(' '),
49
76
  render: /*#__PURE__*/ jsx(Heading, {}),
50
77
  children: heading
51
78
  }),
52
- /*#__PURE__*/ jsx(Dialog.Close, {
53
- render: /*#__PURE__*/ jsx(IconButton, {
54
- label: closeLabel,
55
- variant: "ghost",
56
- size: "sm",
57
- children: /*#__PURE__*/ jsx(CloseIcon, {})
58
- })
59
- })
79
+ showEndGroup ? /*#__PURE__*/ jsxs("div", {
80
+ className: Dialog_module.headerEnd,
81
+ children: [
82
+ headerEnd,
83
+ closeHidden ? null : /*#__PURE__*/ jsx(Dialog.Close, {
84
+ ref: closeRef,
85
+ render: /*#__PURE__*/ jsx(IconButton, {
86
+ label: closeLabel,
87
+ variant: closeVariant,
88
+ size: "sm",
89
+ className: closeCircle_module.close,
90
+ children: /*#__PURE__*/ jsx(CloseIcon, {})
91
+ })
92
+ })
93
+ ]
94
+ }) : null
60
95
  ]
61
96
  }),
62
97
  void 0 === description ? null : /*#__PURE__*/ jsx(Dialog.Description, {
@@ -64,7 +99,13 @@ function Dialog_Dialog({ trigger, heading, headingLevel = 2, description, childr
64
99
  children: description
65
100
  }),
66
101
  void 0 === children ? null : /*#__PURE__*/ jsx("div", {
102
+ ref: bodyRef,
67
103
  className: Dialog_module.body,
104
+ ...bodyOverflows ? {
105
+ tabIndex: 0,
106
+ role: 'region',
107
+ 'aria-labelledby': titleId
108
+ } : void 0,
68
109
  children: children
69
110
  }),
70
111
  void 0 === footer ? null : /*#__PURE__*/ jsx("div", {
@@ -1,10 +1,12 @@
1
1
  import "./Dialog_module.css";
2
2
  const Dialog_module = {
3
- viewport: "viewport-nOzLZ",
4
- header: "header-KgP3n",
5
- heading: "heading-EfBAx",
6
- description: "description-ZV1a4",
7
- body: "body-mavCB",
8
- footer: "footer-CAuV7"
3
+ viewport: "ui0-7-0-viewport-nOzLZ",
4
+ header: "ui0-7-0-header-KgP3n",
5
+ heading: "ui0-7-0-heading-EfBAx",
6
+ headerEnd: "ui0-7-0-headerEnd-sEInd",
7
+ handle: "ui0-7-0-handle-z1dbF",
8
+ description: "ui0-7-0-description-ZV1a4",
9
+ body: "ui0-7-0-body-mavCB",
10
+ footer: "ui0-7-0-footer-CAuV7"
9
11
  };
10
12
  export default Dialog_module;