@ox0/ui 3.4.0 → 3.6.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.
- package/dist/components/date-field.d.ts +39 -0
- package/dist/components/date-field.d.ts.map +1 -0
- package/dist/components/date-field.test.d.ts +2 -0
- package/dist/components/date-field.test.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +364 -15
- package/dist/providers/use-theme-preference.d.ts +15 -0
- package/dist/providers/use-theme-preference.d.ts.map +1 -0
- package/dist/providers/use-theme-preference.test.d.ts +2 -0
- package/dist/providers/use-theme-preference.test.d.ts.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type FocusEvent, type ReactNode } from "react";
|
|
2
|
+
import { type LayoutItemProps } from "../mixins/layout-item";
|
|
3
|
+
export interface DateFieldProps extends LayoutItemProps {
|
|
4
|
+
/** Visible label. Use `ariaLabel` only when the context labels the field already. */
|
|
5
|
+
readonly label?: ReactNode;
|
|
6
|
+
readonly ariaLabel?: string;
|
|
7
|
+
readonly description?: ReactNode;
|
|
8
|
+
readonly errorMessage?: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* The date as `"YYYY-MM-DD"`, or `null` for empty. The same calendar-date
|
|
11
|
+
* format `DateTime` displays, so values round-trip without time zones.
|
|
12
|
+
*/
|
|
13
|
+
readonly value?: string | null;
|
|
14
|
+
readonly defaultValue?: string | null;
|
|
15
|
+
/** Called with `"YYYY-MM-DD"` once every segment is filled, or `null` when cleared. */
|
|
16
|
+
readonly onChange?: (value: string | null) => void;
|
|
17
|
+
/** Focus leaves the field (not just moves between its segments). */
|
|
18
|
+
readonly onBlur?: (event: FocusEvent<Element>) => void;
|
|
19
|
+
readonly onFocus?: (event: FocusEvent<Element>) => void;
|
|
20
|
+
/** Earliest allowed date, `"YYYY-MM-DD"`. Earlier dates mark the field invalid. */
|
|
21
|
+
readonly minValue?: string;
|
|
22
|
+
/** Latest allowed date, `"YYYY-MM-DD"`. */
|
|
23
|
+
readonly maxValue?: string;
|
|
24
|
+
/** Submits the value as `"YYYY-MM-DD"` under this name in a native form. */
|
|
25
|
+
readonly name?: string;
|
|
26
|
+
readonly id?: string;
|
|
27
|
+
readonly autoFocus?: boolean;
|
|
28
|
+
readonly isDisabled?: boolean;
|
|
29
|
+
readonly isInvalid?: boolean;
|
|
30
|
+
readonly isReadOnly?: boolean;
|
|
31
|
+
readonly isRequired?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A date entered as month, day and year segments in the user's locale order.
|
|
35
|
+
* It draws its own placeholders ("mm/dd/yyyy"), so an empty field looks empty
|
|
36
|
+
* in every browser, unlike `<input type="date">`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function DateField({ ariaLabel, autoFocus, defaultValue, description, errorMessage, id, isDisabled, isInvalid, isReadOnly, isRequired, label, maxValue, minValue, name, onBlur, onChange, onFocus, value, ...restProps }: DateFieldProps): ReactNode;
|
|
39
|
+
//# sourceMappingURL=date-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-field.d.ts","sourceRoot":"","sources":["../../src/components/date-field.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAA;AAKpF,OAAO,EAAE,KAAK,eAAe,EAAiB,MAAM,uBAAuB,CAAA;AAkB3E,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,qFAAqF;IACrF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAA;IACjC;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GA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|
+
{"version":3,"file":"date-field.test.d.ts","sourceRoot":"","sources":["../../src/components/date-field.test.tsx"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -54,10 +54,12 @@ export * from "./components/slider";
|
|
|
54
54
|
export * from "./components/table";
|
|
55
55
|
export * from "./components/tag-group";
|
|
56
56
|
export * from "./components/text-field";
|
|
57
|
+
export * from "./components/date-field";
|
|
57
58
|
export * from "./layout/grid";
|
|
58
59
|
export * from "./layout/use-breakpoint-up";
|
|
59
60
|
export * from "./layout/inline";
|
|
60
61
|
export * from "./layout/split";
|
|
61
62
|
export * from "./layout/stack";
|
|
62
63
|
export * from "./providers/ox0-provider";
|
|
64
|
+
export * from "./providers/use-theme-preference";
|
|
63
65
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,C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A;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,kCAAkC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,11 @@ import { isFocusVisible as hooks_isFocusVisible, useControllableState, useMediaQ
|
|
|
4
4
|
import { Ox0I18nProvider, toDateTimeAttribute, useDateFormat, useMessage } from "@ox0/i18n";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import { FloatingFocusManager, FloatingPortal, autoUpdate, flip, offset, shift, size as react_size, useClick, useDismiss, useFloating, useInteractions, useListNavigation, useMergeRefs, useRole } from "@floating-ui/react";
|
|
7
|
-
import { DismissButton, HiddenSelect, Overlay, mergeProps, useButton, useFocusRing, useListBox, useListBoxSection, useObjectRef, useOption, usePopover, useSelect } from "react-aria";
|
|
8
|
-
import { Item, Section, useListState, useSelectState } from "react-stately";
|
|
9
|
-
import {
|
|
7
|
+
import { DismissButton, HiddenSelect, Overlay, mergeProps, useButton, useDateField, useDateSegment, useFocusRing, useListBox, useListBoxSection, useObjectRef, useOption, usePopover, useSelect } from "react-aria";
|
|
8
|
+
import { Item, Section, useDateFieldState, useListState, useSelectState } from "react-stately";
|
|
9
|
+
import { createCalendar, parseDate } from "@internationalized/date";
|
|
10
|
+
import { IntlContext } from "react-intl";
|
|
11
|
+
import { breakpoints, createTheme, readThemePreference, writeThemePreference } from "@ox0/tokens";
|
|
10
12
|
import "@ox0/tokens/styles.css";
|
|
11
13
|
var __webpack_modules__ = {};
|
|
12
14
|
var __webpack_module_cache__ = {};
|
|
@@ -152,6 +154,7 @@ __webpack_require__.add({
|
|
|
152
154
|
flex-direction: column;
|
|
153
155
|
min-block-size: 100dvh;
|
|
154
156
|
display: flex;
|
|
157
|
+
container: ox0-shell / inline-size;
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
.skipLink-yR80ud {
|
|
@@ -184,25 +187,32 @@ __webpack_require__.add({
|
|
|
184
187
|
.barInner-feWiUP {
|
|
185
188
|
align-items: center;
|
|
186
189
|
gap: var(--ox0-space-lg);
|
|
187
|
-
|
|
190
|
+
block-size: 3.5rem;
|
|
188
191
|
padding-inline: var(--ox0-space-lg);
|
|
189
192
|
display: flex;
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
.brand-KL4jhb {
|
|
196
|
+
font-size: var(--ox0-font-size-md);
|
|
193
197
|
font-weight: var(--ox0-font-weight-semibold);
|
|
194
198
|
align-items: center;
|
|
195
199
|
gap: var(--ox0-space-sm);
|
|
200
|
+
letter-spacing: -.01em;
|
|
196
201
|
flex-shrink: 0;
|
|
197
202
|
display: flex;
|
|
198
203
|
}
|
|
199
204
|
|
|
200
205
|
.barNav-MoDjCs {
|
|
201
206
|
flex: auto;
|
|
207
|
+
align-self: stretch;
|
|
202
208
|
min-inline-size: 0;
|
|
203
209
|
display: none;
|
|
204
210
|
}
|
|
205
211
|
|
|
212
|
+
.barNav-MoDjCs > nav {
|
|
213
|
+
block-size: 100%;
|
|
214
|
+
}
|
|
215
|
+
|
|
206
216
|
.actions-b1jjay {
|
|
207
217
|
align-items: center;
|
|
208
218
|
gap: var(--ox0-space-sm);
|
|
@@ -215,8 +225,9 @@ __webpack_require__.add({
|
|
|
215
225
|
display: flex;
|
|
216
226
|
}
|
|
217
227
|
|
|
218
|
-
@
|
|
228
|
+
@container ox0-shell (width >= 48rem) {
|
|
219
229
|
.barInner-feWiUP {
|
|
230
|
+
gap: var(--ox0-space-xl);
|
|
220
231
|
padding-inline: var(--ox0-space-2xl);
|
|
221
232
|
}
|
|
222
233
|
|
|
@@ -247,10 +258,17 @@ __webpack_require__.add({
|
|
|
247
258
|
.navList-Zq3sIY[data-orientation="horizontal"] {
|
|
248
259
|
scrollbar-width: none;
|
|
249
260
|
flex-wrap: nowrap;
|
|
250
|
-
align-items:
|
|
261
|
+
align-items: stretch;
|
|
262
|
+
block-size: 100%;
|
|
251
263
|
overflow-x: auto;
|
|
252
264
|
}
|
|
253
265
|
|
|
266
|
+
.navList-Zq3sIY[data-orientation="horizontal"] > li {
|
|
267
|
+
align-items: center;
|
|
268
|
+
display: flex;
|
|
269
|
+
position: relative;
|
|
270
|
+
}
|
|
271
|
+
|
|
254
272
|
.navList-Zq3sIY[data-orientation="vertical"] {
|
|
255
273
|
flex-direction: column;
|
|
256
274
|
}
|
|
@@ -262,7 +280,9 @@ __webpack_require__.add({
|
|
|
262
280
|
font-weight: var(--ox0-font-weight-medium);
|
|
263
281
|
align-items: center;
|
|
264
282
|
gap: var(--ox0-space-sm);
|
|
265
|
-
padding: var(--ox0-space-
|
|
283
|
+
padding: calc(var(--ox0-space-xs) + var(--ox0-space-2xs)) var(--ox0-space-sm);
|
|
284
|
+
transition: background-color var(--ox0-duration-fast) var(--ox0-ease-crisp),
|
|
285
|
+
color var(--ox0-duration-fast) var(--ox0-ease-crisp);
|
|
266
286
|
white-space: nowrap;
|
|
267
287
|
text-decoration: none;
|
|
268
288
|
display: flex;
|
|
@@ -279,20 +299,39 @@ __webpack_require__.add({
|
|
|
279
299
|
}
|
|
280
300
|
|
|
281
301
|
.navItem-LuewCO[aria-current="page"] {
|
|
282
|
-
background: var(--ox0-color-surface-selected);
|
|
283
302
|
color: var(--ox0-color-foreground);
|
|
284
303
|
}
|
|
285
304
|
|
|
286
|
-
.navList-Zq3sIY[data-orientation="horizontal"] .navItem-LuewCO[aria-current="page"] {
|
|
287
|
-
|
|
305
|
+
.navList-Zq3sIY[data-orientation="horizontal"] .navItem-LuewCO[aria-current="page"]:after {
|
|
306
|
+
background: var(--ox0-color-accent);
|
|
307
|
+
content: "";
|
|
308
|
+
block-size: 2px;
|
|
309
|
+
inset-block-end: 0;
|
|
310
|
+
inset-inline: var(--ox0-space-sm);
|
|
311
|
+
border-radius: 2px 2px 0 0;
|
|
312
|
+
position: absolute;
|
|
288
313
|
}
|
|
289
314
|
|
|
290
315
|
.navList-Zq3sIY[data-orientation="vertical"] .navItem-LuewCO {
|
|
291
316
|
font-size: var(--ox0-font-size-md);
|
|
317
|
+
padding: var(--ox0-space-sm) var(--ox0-space-md);
|
|
318
|
+
position: relative;
|
|
292
319
|
}
|
|
293
320
|
|
|
294
321
|
.navList-Zq3sIY[data-orientation="vertical"] .navItem-LuewCO[aria-current="page"] {
|
|
295
|
-
|
|
322
|
+
background: var(--ox0-color-surface-selected);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.navList-Zq3sIY[data-orientation="vertical"] .navItem-LuewCO[aria-current="page"]:before {
|
|
326
|
+
background: var(--ox0-color-accent);
|
|
327
|
+
content: "";
|
|
328
|
+
border-radius: 0 2px 2px 0;
|
|
329
|
+
block-size: 1.125rem;
|
|
330
|
+
inline-size: 3px;
|
|
331
|
+
margin-block: auto;
|
|
332
|
+
position: absolute;
|
|
333
|
+
inset-block: 0;
|
|
334
|
+
inset-inline-start: 0;
|
|
296
335
|
}
|
|
297
336
|
`,
|
|
298
337
|
""
|
|
@@ -1236,11 +1275,13 @@ __webpack_require__.add({
|
|
|
1236
1275
|
module.id,
|
|
1237
1276
|
`.fieldset-ppnMnv {
|
|
1238
1277
|
color: var(--ox0-color-foreground);
|
|
1278
|
+
min-width: 0;
|
|
1239
1279
|
align-content: start;
|
|
1240
1280
|
gap: var(--ox0-space-xs);
|
|
1241
|
-
min-
|
|
1281
|
+
min-inline-size: 0;
|
|
1242
1282
|
font-size: var(--ox0-font-size-md);
|
|
1243
1283
|
border: none;
|
|
1284
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1244
1285
|
margin: 0;
|
|
1245
1286
|
padding: 0;
|
|
1246
1287
|
display: grid;
|
|
@@ -1331,9 +1372,11 @@ __webpack_require__.add({
|
|
|
1331
1372
|
___CSS_LOADER_EXPORT___.push([
|
|
1332
1373
|
module.id,
|
|
1333
1374
|
`.root-ZfGmPt {
|
|
1375
|
+
min-inline-size: 0;
|
|
1334
1376
|
font-size: var(--ox0-font-size-md);
|
|
1335
1377
|
align-content: start;
|
|
1336
1378
|
gap: var(--ox0-space-xs);
|
|
1379
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1337
1380
|
display: grid;
|
|
1338
1381
|
}
|
|
1339
1382
|
|
|
@@ -1518,6 +1561,8 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
1518
1561
|
`.root-WkZ_BN {
|
|
1519
1562
|
align-content: start;
|
|
1520
1563
|
gap: var(--ox0-space-xs);
|
|
1564
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1565
|
+
min-inline-size: 0;
|
|
1521
1566
|
display: grid;
|
|
1522
1567
|
}
|
|
1523
1568
|
|
|
@@ -1699,6 +1744,116 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
1699
1744
|
A: __rspack_default_export
|
|
1700
1745
|
});
|
|
1701
1746
|
},
|
|
1747
|
+
"../../node_modules/.pnpm/@rsbuild+core@2.1.13_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[1].oneOf[4].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[1].oneOf[4].use[2]!./src/components/date-field.module.css" (module, __webpack_exports__, __webpack_require__) {
|
|
1748
|
+
var _node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__rspack_import_0 = __webpack_require__("../../node_modules/.pnpm/@rsbuild+core@2.1.13_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/noSourceMaps.js");
|
|
1749
|
+
var _node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(_node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__rspack_import_0);
|
|
1750
|
+
var _node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_api_js__rspack_import_1 = __webpack_require__("../../node_modules/.pnpm/@rsbuild+core@2.1.13_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/api.js");
|
|
1751
|
+
var _node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_api_js__rspack_import_1_default = /*#__PURE__*/ __webpack_require__.n(_node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_api_js__rspack_import_1);
|
|
1752
|
+
var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_api_js__rspack_import_1_default()(_node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__rspack_import_0_default());
|
|
1753
|
+
___CSS_LOADER_EXPORT___.push([
|
|
1754
|
+
module.id,
|
|
1755
|
+
`.root-jhFRmC {
|
|
1756
|
+
color: var(--ox0-color-foreground);
|
|
1757
|
+
font-size: var(--ox0-font-size-md);
|
|
1758
|
+
align-content: start;
|
|
1759
|
+
gap: var(--ox0-space-xs);
|
|
1760
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1761
|
+
min-inline-size: 0;
|
|
1762
|
+
display: grid;
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
.control-rRQVEl {
|
|
1766
|
+
background: var(--ox0-color-surface);
|
|
1767
|
+
border: 1px solid var(--ox0-color-border);
|
|
1768
|
+
border-radius: var(--ox0-radius-sm);
|
|
1769
|
+
box-sizing: border-box;
|
|
1770
|
+
cursor: text;
|
|
1771
|
+
font-variant-numeric: tabular-nums;
|
|
1772
|
+
height: var(--ox0-control-height-md);
|
|
1773
|
+
min-inline-size: 0;
|
|
1774
|
+
padding-inline: calc(var(--ox0-space-md) - 2px);
|
|
1775
|
+
transition: border-color var(--ox0-duration-fast) var(--ox0-ease-crisp),
|
|
1776
|
+
box-shadow var(--ox0-duration-fast) var(--ox0-ease-crisp);
|
|
1777
|
+
white-space: nowrap;
|
|
1778
|
+
align-items: center;
|
|
1779
|
+
display: flex;
|
|
1780
|
+
overflow: hidden;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
.control-rRQVEl:hover {
|
|
1784
|
+
border-color: var(--ox0-color-border-strong);
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
.control-rRQVEl.focusVisible-O_oNxe {
|
|
1788
|
+
border-color: var(--ox0-color-accent);
|
|
1789
|
+
box-shadow: 0 0 0 3px var(--ox0-color-focus-ring);
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
.control-rRQVEl.invalid-G42Ug_ {
|
|
1793
|
+
border-color: var(--ox0-color-danger);
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
.control-rRQVEl.invalid-G42Ug_.focusVisible-O_oNxe {
|
|
1797
|
+
box-shadow: 0 0 0 3px var(--ox0-color-danger-subtle);
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
.control-rRQVEl.disabled-eefMMd {
|
|
1801
|
+
background: var(--ox0-color-canvas);
|
|
1802
|
+
color: var(--ox0-color-disabled);
|
|
1803
|
+
cursor: not-allowed;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
.segment-qBeSFi {
|
|
1807
|
+
border-radius: var(--ox0-radius-xs);
|
|
1808
|
+
box-sizing: content-box;
|
|
1809
|
+
text-align: end;
|
|
1810
|
+
outline: none;
|
|
1811
|
+
padding: 0 2px;
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
.placeholder-n53Bc3 {
|
|
1815
|
+
color: var(--ox0-color-disabled);
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
.segment-qBeSFi:focus {
|
|
1819
|
+
background: var(--ox0-color-accent);
|
|
1820
|
+
color: var(--ox0-color-on-accent);
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
.literal-L0lCHh {
|
|
1824
|
+
color: var(--ox0-color-muted);
|
|
1825
|
+
padding: 0 1px;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
.description-iyjYjF {
|
|
1829
|
+
color: var(--ox0-color-muted);
|
|
1830
|
+
font-size: var(--ox0-font-size-sm);
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
.error-fBRnM3 {
|
|
1834
|
+
color: var(--ox0-color-danger-text);
|
|
1835
|
+
font-size: var(--ox0-font-size-sm);
|
|
1836
|
+
}
|
|
1837
|
+
`,
|
|
1838
|
+
""
|
|
1839
|
+
]);
|
|
1840
|
+
___CSS_LOADER_EXPORT___.locals = {
|
|
1841
|
+
root: "root-jhFRmC",
|
|
1842
|
+
control: "control-rRQVEl",
|
|
1843
|
+
focusVisible: "focusVisible-O_oNxe",
|
|
1844
|
+
invalid: "invalid-G42Ug_",
|
|
1845
|
+
disabled: "disabled-eefMMd",
|
|
1846
|
+
segment: "segment-qBeSFi",
|
|
1847
|
+
placeholder: "placeholder-n53Bc3",
|
|
1848
|
+
literal: "literal-L0lCHh",
|
|
1849
|
+
description: "description-iyjYjF",
|
|
1850
|
+
error: "error-fBRnM3"
|
|
1851
|
+
};
|
|
1852
|
+
const __rspack_default_export = ___CSS_LOADER_EXPORT___;
|
|
1853
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
1854
|
+
A: __rspack_default_export
|
|
1855
|
+
});
|
|
1856
|
+
},
|
|
1702
1857
|
"../../node_modules/.pnpm/@rsbuild+core@2.1.13_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[1].oneOf[4].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[1].oneOf[4].use[2]!./src/components/dialog.module.css" (module, __webpack_exports__, __webpack_require__) {
|
|
1703
1858
|
var _node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__rspack_import_0 = __webpack_require__("../../node_modules/.pnpm/@rsbuild+core@2.1.13_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/noSourceMaps.js");
|
|
1704
1859
|
var _node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(_node_modules_pnpm_rsbuild_core_2_1_13_core_js_3_47_0_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__rspack_import_0);
|
|
@@ -2258,6 +2413,8 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
2258
2413
|
`.root-HAlTlg {
|
|
2259
2414
|
align-content: start;
|
|
2260
2415
|
gap: var(--ox0-space-xs);
|
|
2416
|
+
grid-template-columns: minmax(0, 1fr);
|
|
2417
|
+
min-inline-size: 0;
|
|
2261
2418
|
display: grid;
|
|
2262
2419
|
}
|
|
2263
2420
|
|
|
@@ -2329,11 +2486,13 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
2329
2486
|
module.id,
|
|
2330
2487
|
`.fieldset-MruCMe {
|
|
2331
2488
|
color: var(--ox0-color-foreground);
|
|
2489
|
+
min-width: 0;
|
|
2332
2490
|
align-content: start;
|
|
2333
2491
|
gap: var(--ox0-space-xs);
|
|
2334
|
-
min-
|
|
2492
|
+
min-inline-size: 0;
|
|
2335
2493
|
font-size: var(--ox0-font-size-md);
|
|
2336
2494
|
border: none;
|
|
2495
|
+
grid-template-columns: minmax(0, 1fr);
|
|
2337
2496
|
margin: 0;
|
|
2338
2497
|
padding: 0;
|
|
2339
2498
|
display: grid;
|
|
@@ -2894,9 +3053,11 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
2894
3053
|
module.id,
|
|
2895
3054
|
`.root-DxBVJW {
|
|
2896
3055
|
color: var(--ox0-color-foreground);
|
|
3056
|
+
min-inline-size: 0;
|
|
2897
3057
|
font-size: var(--ox0-font-size-md);
|
|
2898
3058
|
align-content: start;
|
|
2899
3059
|
gap: var(--ox0-space-xs);
|
|
3060
|
+
grid-template-columns: minmax(0, 1fr);
|
|
2900
3061
|
display: grid;
|
|
2901
3062
|
}
|
|
2902
3063
|
|
|
@@ -3144,11 +3305,13 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
3144
3305
|
module.id,
|
|
3145
3306
|
`.fieldset-PcJq3W {
|
|
3146
3307
|
color: var(--ox0-color-foreground);
|
|
3308
|
+
min-width: 0;
|
|
3147
3309
|
align-content: start;
|
|
3148
3310
|
gap: var(--ox0-space-xs);
|
|
3149
|
-
min-
|
|
3311
|
+
min-inline-size: 0;
|
|
3150
3312
|
font-size: var(--ox0-font-size-md);
|
|
3151
3313
|
border: none;
|
|
3314
|
+
grid-template-columns: minmax(0, 1fr);
|
|
3152
3315
|
margin: 0;
|
|
3153
3316
|
padding: 0;
|
|
3154
3317
|
display: grid;
|
|
@@ -3240,9 +3403,11 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
3240
3403
|
module.id,
|
|
3241
3404
|
`.root-Bq3cNE {
|
|
3242
3405
|
color: var(--ox0-color-foreground);
|
|
3406
|
+
min-inline-size: 0;
|
|
3243
3407
|
font-size: var(--ox0-font-size-md);
|
|
3244
3408
|
align-content: start;
|
|
3245
3409
|
gap: var(--ox0-space-xs);
|
|
3410
|
+
grid-template-columns: minmax(0, 1fr);
|
|
3246
3411
|
display: grid;
|
|
3247
3412
|
}
|
|
3248
3413
|
|
|
@@ -3369,6 +3534,8 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
3369
3534
|
`.root-FHU2Km {
|
|
3370
3535
|
align-content: start;
|
|
3371
3536
|
gap: var(--ox0-space-xs);
|
|
3537
|
+
grid-template-columns: minmax(0, 1fr);
|
|
3538
|
+
min-inline-size: 0;
|
|
3372
3539
|
display: grid;
|
|
3373
3540
|
}
|
|
3374
3541
|
|
|
@@ -3695,9 +3862,11 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
3695
3862
|
module.id,
|
|
3696
3863
|
`.root-TON2np {
|
|
3697
3864
|
color: var(--ox0-color-foreground);
|
|
3865
|
+
min-inline-size: 0;
|
|
3698
3866
|
font-size: var(--ox0-font-size-md);
|
|
3699
3867
|
align-content: start;
|
|
3700
3868
|
gap: var(--ox0-space-xs);
|
|
3869
|
+
grid-template-columns: minmax(0, 1fr);
|
|
3701
3870
|
display: grid;
|
|
3702
3871
|
}
|
|
3703
3872
|
|
|
@@ -3961,6 +4130,8 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
3961
4130
|
`.root-oT5_Un {
|
|
3962
4131
|
align-content: start;
|
|
3963
4132
|
gap: var(--ox0-space-xs);
|
|
4133
|
+
grid-template-columns: minmax(0, 1fr);
|
|
4134
|
+
min-inline-size: 0;
|
|
3964
4135
|
display: grid;
|
|
3965
4136
|
}
|
|
3966
4137
|
|
|
@@ -4284,9 +4455,11 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
4284
4455
|
module.id,
|
|
4285
4456
|
`.root-czq2dC {
|
|
4286
4457
|
color: var(--ox0-color-foreground);
|
|
4458
|
+
min-inline-size: 0;
|
|
4287
4459
|
font-size: var(--ox0-font-size-md);
|
|
4288
4460
|
align-content: start;
|
|
4289
4461
|
gap: var(--ox0-space-xs);
|
|
4462
|
+
grid-template-columns: minmax(0, 1fr);
|
|
4290
4463
|
display: grid;
|
|
4291
4464
|
}
|
|
4292
4465
|
|
|
@@ -4437,9 +4610,11 @@ div.tag-ueb2Qr.selected-a1JhC8[data-selectable]:hover {
|
|
|
4437
4610
|
module.id,
|
|
4438
4611
|
`.root-EDj_sz {
|
|
4439
4612
|
color: var(--ox0-color-foreground);
|
|
4613
|
+
min-inline-size: 0;
|
|
4440
4614
|
font-size: var(--ox0-font-size-md);
|
|
4441
4615
|
align-content: start;
|
|
4442
4616
|
gap: var(--ox0-space-xs);
|
|
4617
|
+
grid-template-columns: minmax(0, 1fr);
|
|
4443
4618
|
display: grid;
|
|
4444
4619
|
}
|
|
4445
4620
|
|
|
@@ -11955,6 +12130,136 @@ const text_field_TextField = /*#__PURE__*/ forwardRef(function({ ariaLabel, desc
|
|
|
11955
12130
|
]
|
|
11956
12131
|
});
|
|
11957
12132
|
});
|
|
12133
|
+
const date_field_module_0 = __webpack_require__("../../node_modules/.pnpm/@rsbuild+core@2.1.13_core-js@3.47.0/node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[1].oneOf[4].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[1].oneOf[4].use[2]!./src/components/date-field.module.css");
|
|
12134
|
+
var date_field_module_options = {};
|
|
12135
|
+
date_field_module_options.styleTagTransform = styleTagTransform_default();
|
|
12136
|
+
date_field_module_options.setAttributes = setAttributesWithoutAttributes_default();
|
|
12137
|
+
date_field_module_options.insert = insertBySelector_default().bind(null, "head");
|
|
12138
|
+
date_field_module_options.domAPI = styleDomAPI_default();
|
|
12139
|
+
date_field_module_options.insertStyleElement = insertStyleElement_default();
|
|
12140
|
+
injectStylesIntoStyleTag_default()(date_field_module_0.A, date_field_module_options);
|
|
12141
|
+
const date_field_module = date_field_module_0.A && date_field_module_0.A.locals ? date_field_module_0.A.locals : void 0;
|
|
12142
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
12143
|
+
function toCalendarDate(value) {
|
|
12144
|
+
if (void 0 === value) return;
|
|
12145
|
+
if (null === value || !ISO_DATE.test(value)) return null;
|
|
12146
|
+
try {
|
|
12147
|
+
return parseDate(value);
|
|
12148
|
+
} catch {
|
|
12149
|
+
return null;
|
|
12150
|
+
}
|
|
12151
|
+
}
|
|
12152
|
+
function DateField({ ariaLabel, autoFocus, defaultValue, description, errorMessage, id, isDisabled, isInvalid, isReadOnly, isRequired, label, maxValue, minValue, name, onBlur, onChange, onFocus, value, ...restProps }) {
|
|
12153
|
+
const { style: layoutStyle } = useLayoutItem(restProps);
|
|
12154
|
+
const locale = useContext(IntlContext)?.locale ?? "en-US";
|
|
12155
|
+
const calendarValue = useMemo(()=>toCalendarDate(value), [
|
|
12156
|
+
value
|
|
12157
|
+
]);
|
|
12158
|
+
const calendarDefault = useMemo(()=>toCalendarDate(defaultValue), [
|
|
12159
|
+
defaultValue
|
|
12160
|
+
]);
|
|
12161
|
+
const calendarMin = useMemo(()=>toCalendarDate(minValue) ?? void 0, [
|
|
12162
|
+
minValue
|
|
12163
|
+
]);
|
|
12164
|
+
const calendarMax = useMemo(()=>toCalendarDate(maxValue) ?? void 0, [
|
|
12165
|
+
maxValue
|
|
12166
|
+
]);
|
|
12167
|
+
const dateProps = {
|
|
12168
|
+
autoFocus,
|
|
12169
|
+
"aria-label": ariaLabel,
|
|
12170
|
+
defaultValue: calendarDefault,
|
|
12171
|
+
description,
|
|
12172
|
+
errorMessage,
|
|
12173
|
+
id,
|
|
12174
|
+
isDisabled,
|
|
12175
|
+
isInvalid: isInvalid || null != errorMessage ? true : void 0,
|
|
12176
|
+
isReadOnly,
|
|
12177
|
+
isRequired,
|
|
12178
|
+
label,
|
|
12179
|
+
maxValue: calendarMax,
|
|
12180
|
+
minValue: calendarMin,
|
|
12181
|
+
name,
|
|
12182
|
+
onBlur,
|
|
12183
|
+
onFocus,
|
|
12184
|
+
onChange: onChange ? (date)=>onChange(date ? date.toString() : null) : void 0,
|
|
12185
|
+
validationBehavior: "aria",
|
|
12186
|
+
value: calendarValue
|
|
12187
|
+
};
|
|
12188
|
+
const state = useDateFieldState({
|
|
12189
|
+
...dateProps,
|
|
12190
|
+
createCalendar: createCalendar,
|
|
12191
|
+
locale
|
|
12192
|
+
});
|
|
12193
|
+
const ref = useRef(null);
|
|
12194
|
+
const inputRef = useRef(null);
|
|
12195
|
+
const { descriptionProps, errorMessageProps, fieldProps, inputProps, labelProps } = useDateField({
|
|
12196
|
+
...dateProps,
|
|
12197
|
+
inputRef
|
|
12198
|
+
}, state, ref);
|
|
12199
|
+
const { focusProps, isFocusVisible } = useFocusRing({
|
|
12200
|
+
within: true
|
|
12201
|
+
});
|
|
12202
|
+
const invalid = state.isInvalid;
|
|
12203
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
12204
|
+
className: date_field_module.root,
|
|
12205
|
+
style: layoutStyle,
|
|
12206
|
+
children: [
|
|
12207
|
+
label ? /*#__PURE__*/ jsx("span", {
|
|
12208
|
+
...labelProps,
|
|
12209
|
+
className: field_module.label,
|
|
12210
|
+
children: label
|
|
12211
|
+
}) : null,
|
|
12212
|
+
/*#__PURE__*/ jsxs("div", {
|
|
12213
|
+
...mergeProps(fieldProps, focusProps),
|
|
12214
|
+
ref: ref,
|
|
12215
|
+
className: [
|
|
12216
|
+
date_field_module.control,
|
|
12217
|
+
invalid ? date_field_module.invalid : null,
|
|
12218
|
+
isFocusVisible ? date_field_module.focusVisible : null,
|
|
12219
|
+
isDisabled ? date_field_module.disabled : null
|
|
12220
|
+
].filter(Boolean).join(" "),
|
|
12221
|
+
children: [
|
|
12222
|
+
state.segments.map((segment, i)=>/*#__PURE__*/ jsx(Segment, {
|
|
12223
|
+
segment: segment,
|
|
12224
|
+
state: state
|
|
12225
|
+
}, i)),
|
|
12226
|
+
/*#__PURE__*/ jsx("input", {
|
|
12227
|
+
...inputProps,
|
|
12228
|
+
ref: inputRef,
|
|
12229
|
+
type: "hidden"
|
|
12230
|
+
})
|
|
12231
|
+
]
|
|
12232
|
+
}),
|
|
12233
|
+
description ? /*#__PURE__*/ jsx("span", {
|
|
12234
|
+
...descriptionProps,
|
|
12235
|
+
className: date_field_module.description,
|
|
12236
|
+
children: description
|
|
12237
|
+
}) : null,
|
|
12238
|
+
errorMessage ? /*#__PURE__*/ jsx("span", {
|
|
12239
|
+
...errorMessageProps,
|
|
12240
|
+
className: date_field_module.error,
|
|
12241
|
+
children: errorMessage
|
|
12242
|
+
}) : null
|
|
12243
|
+
]
|
|
12244
|
+
});
|
|
12245
|
+
}
|
|
12246
|
+
function Segment({ segment, state }) {
|
|
12247
|
+
const ref = useRef(null);
|
|
12248
|
+
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
12249
|
+
const className = useMemo(()=>[
|
|
12250
|
+
"literal" === segment.type ? date_field_module.literal : date_field_module.segment,
|
|
12251
|
+
segment.isPlaceholder ? date_field_module.placeholder : null
|
|
12252
|
+
].filter(Boolean).join(" "), [
|
|
12253
|
+
segment.isPlaceholder,
|
|
12254
|
+
segment.type
|
|
12255
|
+
]);
|
|
12256
|
+
return /*#__PURE__*/ jsx("div", {
|
|
12257
|
+
...segmentProps,
|
|
12258
|
+
ref: ref,
|
|
12259
|
+
className: className,
|
|
12260
|
+
children: segment.text
|
|
12261
|
+
});
|
|
12262
|
+
}
|
|
11958
12263
|
const responsiveKeys = [
|
|
11959
12264
|
"base",
|
|
11960
12265
|
"sm",
|
|
@@ -12165,4 +12470,48 @@ function Ox0Provider({ children, colorScheme, density, locale, messages, navigat
|
|
|
12165
12470
|
})
|
|
12166
12471
|
});
|
|
12167
12472
|
}
|
|
12168
|
-
|
|
12473
|
+
const use_theme_preference_listeners = new Set();
|
|
12474
|
+
function subscribe(listener) {
|
|
12475
|
+
use_theme_preference_listeners.add(listener);
|
|
12476
|
+
window.addEventListener("storage", listener);
|
|
12477
|
+
return ()=>{
|
|
12478
|
+
use_theme_preference_listeners.delete(listener);
|
|
12479
|
+
window.removeEventListener("storage", listener);
|
|
12480
|
+
};
|
|
12481
|
+
}
|
|
12482
|
+
function useThemePreference(name, options = {}) {
|
|
12483
|
+
const { defaultTheme, storageKey } = options;
|
|
12484
|
+
const read = ()=>readThemePreference(name, {
|
|
12485
|
+
defaultTheme,
|
|
12486
|
+
storageKey
|
|
12487
|
+
});
|
|
12488
|
+
const value = useSyncExternalStore(subscribe, read, read);
|
|
12489
|
+
const setValue = useCallback((next)=>{
|
|
12490
|
+
writeThemePreference(name, next, {
|
|
12491
|
+
defaultTheme,
|
|
12492
|
+
storageKey
|
|
12493
|
+
});
|
|
12494
|
+
for (const notify of use_theme_preference_listeners)notify();
|
|
12495
|
+
}, [
|
|
12496
|
+
defaultTheme,
|
|
12497
|
+
name,
|
|
12498
|
+
storageKey
|
|
12499
|
+
]);
|
|
12500
|
+
return [
|
|
12501
|
+
value,
|
|
12502
|
+
setValue
|
|
12503
|
+
];
|
|
12504
|
+
}
|
|
12505
|
+
function useColorScheme(options) {
|
|
12506
|
+
return useThemePreference("colorScheme", options);
|
|
12507
|
+
}
|
|
12508
|
+
function useNeutralTheme(options) {
|
|
12509
|
+
return useThemePreference("theme", options);
|
|
12510
|
+
}
|
|
12511
|
+
function useDensity(options) {
|
|
12512
|
+
return useThemePreference("density", options);
|
|
12513
|
+
}
|
|
12514
|
+
function useFontScale(options) {
|
|
12515
|
+
return useThemePreference("fontScale", options);
|
|
12516
|
+
}
|
|
12517
|
+
export { Accordion, AccordionHeader, AccordionItem, AccordionPanel, AppShell, BreadcrumbItem, Breadcrumbs, ConfirmDialog, ConfirmPopover, ConfirmProvider, DateField, Dialog, Drawer, ListBox, ListBoxFilter, ListItem, ListItemDivider, ListItemGroup, ListItemStatic, MarkProvider, Markable, Menu, MenuItem, MenuSection, MenuSeparator, MenuSubTrigger, Nav, NavItem, Ox0Provider, Popover, PopoverContent, PopoverTrigger, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, Tabs, TagGroup, ToastProvider, Tooltip, TooltipContent, TooltipTrigger, badge_Badge as Badge, banner_Banner as Banner, box_Box as Box, button_Button as Button, button_group_ButtonGroup as ButtonGroup, caption_Caption as Caption, card_Card as Card, checkbox_Checkbox as Checkbox, checkbox_group_CheckboxGroup as CheckboxGroup, checkbox_group_GroupCheckbox as GroupCheckbox, code_Code as Code, code_block_CodeBlock as CodeBlock, combobox_Combobox as Combobox, createTextStyles, date_time_DateRange as DateRange, date_time_DateTime as DateTime, defaultUiMessages, disclosure_triangle_DisclosureTriangle as DisclosureTriangle, divider_Divider as Divider, drop_zone_DropZone as DropZone, field_group_FieldGroup as FieldGroup, file_trigger_FileTrigger as FileTrigger, grid_Grid as Grid, heading_Heading as Heading, icon_button_IconButton as IconButton, icon_label_IconLabel as IconLabel, icon_toggle_IconToggle as IconToggle, inline_Inline as Inline, keyboard_Keyboard as Keyboard, label_Label as Label, link_Link as Link, matchesAccept, number_field_NumberField as NumberField, numeric_Numeric as Numeric, page_Page as Page, page_PageHeader as PageHeader, radio_group_Radio as Radio, radio_group_RadioGroup as RadioGroup, search_field_SearchField as SearchField, select_Select as Select, skeleton_Skeleton as Skeleton, slider_Slider as Slider, spinner_Spinner as Spinner, splitLayoutItemProps, split_Split as Split, stack_Stack as Stack, surface_Surface as Surface, switch_Switch as Switch, tag_group_Tag as Tag, text_Text as Text, text_area_TextArea as TextArea, text_field_TextField as TextField, useBorders, useBreakpointUp, useColorScheme, useConfirm, useDateFormat, useDensity, useFlexItem, useFontScale, useGridItem, useLayoutItem, useListItemState, useMark, useNeutralTheme, usePlacement, useResponsiveValue, useSizing, useSpacing, useSurface, useToast };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ColorScheme, type DensityName, type FontScale, type ThemeName, type ThemePreferenceOptions } from "@ox0/tokens";
|
|
2
|
+
/**
|
|
3
|
+
* The user's color scheme: `"light"`, `"dark"` or `"system"`. Stored in the
|
|
4
|
+
* format `getThemeScript()` reads and applied to `<html>`, so the choice
|
|
5
|
+
* survives reloads without a flash. Don't also pass `colorScheme` to
|
|
6
|
+
* `Ox0Provider`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useColorScheme(options?: ThemePreferenceOptions): [ColorScheme, (scheme: ColorScheme) => void];
|
|
9
|
+
/** The neutral palette, persisted like `useColorScheme`. Don't also pass `neutralTheme`. */
|
|
10
|
+
export declare function useNeutralTheme(options?: ThemePreferenceOptions): [ThemeName, (theme: ThemeName) => void];
|
|
11
|
+
/** Spacing density, persisted like `useColorScheme`. Don't also pass `density`. */
|
|
12
|
+
export declare function useDensity(options?: ThemePreferenceOptions): [DensityName, (density: DensityName) => void];
|
|
13
|
+
/** Root font scale (`"sm"` 87.5%, `"md"`, `"lg"` 112.5%), persisted like `useColorScheme`. */
|
|
14
|
+
export declare function useFontScale(options?: ThemePreferenceOptions): [FontScale, (scale: FontScale) => void];
|
|
15
|
+
//# sourceMappingURL=use-theme-preference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme-preference.d.ts","sourceRoot":"","sources":["../../src/providers/use-theme-preference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,SAAS,EAEd,KAAK,SAAS,EAEd,KAAK,sBAAsB,EAG5B,MAAM,aAAa,CAAA;AAkCpB;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,CAAC,EAAE,sBAAsB,GAC/B,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC,CAE9C;AAED,4FAA4F;AAC5F,wBAAgB,eAAe,CAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC/B,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC,CAEzC;AAED,mFAAmF;AACnF,wBAAgB,UAAU,CACxB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC,CAE/C;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAC1B,OAAO,CAAC,EAAE,sBAAsB,GAC/B,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC,CAEzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme-preference.test.d.ts","sourceRoot":"","sources":["../../src/providers/use-theme-preference.test.tsx"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox0/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/esturcke/ox0-platform.git",
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@floating-ui/react": "^0.27.19",
|
|
25
|
+
"@internationalized/date": "^3.12.4",
|
|
25
26
|
"react-aria": "^3.52.1",
|
|
26
27
|
"react-stately": "^3.50.0",
|
|
27
|
-
"@ox0/i18n": "0.4.0",
|
|
28
28
|
"@ox0/hooks": "0.2.2",
|
|
29
|
-
"@ox0/
|
|
29
|
+
"@ox0/i18n": "0.4.0",
|
|
30
|
+
"@ox0/tokens": "0.7.0"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
33
|
"react": "^19.0.0",
|