@manakind/ui-core 0.12.0 → 0.13.1
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/README.md +6 -0
- package/dist/checkbox/checkbox.css +102 -0
- package/dist/checkbox/checkbox.css.d.ts +2 -0
- package/dist/checkbox/checkbox.d.ts +77 -0
- package/dist/checkbox/checkbox.d.ts.map +1 -0
- package/dist/checkbox/checkbox.js +49 -0
- package/dist/checkbox/checkbox.js.map +1 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.d.ts.map +1 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/date-input/date-input.css +123 -0
- package/dist/date-input/date-input.css.d.ts +2 -0
- package/dist/date-input/date-input.d.ts +88 -0
- package/dist/date-input/date-input.d.ts.map +1 -0
- package/dist/date-input/date-input.js +104 -0
- package/dist/date-input/date-input.js.map +1 -0
- package/dist/date-input/index.d.ts +2 -0
- package/dist/date-input/index.d.ts.map +1 -0
- package/dist/date-input/index.js +2 -0
- package/dist/date-input/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/popover/index.d.ts +2 -0
- package/dist/popover/index.d.ts.map +1 -0
- package/dist/popover/index.js +2 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/popover/popover.css +45 -0
- package/dist/popover/popover.css.d.ts +2 -0
- package/dist/popover/popover.d.ts +77 -0
- package/dist/popover/popover.d.ts.map +1 -0
- package/dist/popover/popover.js +44 -0
- package/dist/popover/popover.js.map +1 -0
- package/dist/switch/switch.d.ts +1 -0
- package/dist/switch/switch.d.ts.map +1 -1
- package/dist/switch/switch.js +6 -2
- package/dist/switch/switch.js.map +1 -1
- package/package.json +64 -39
package/README.md
CHANGED
|
@@ -65,6 +65,9 @@ separately, so an app can load only what it renders.
|
|
|
65
65
|
| `@manakind/ui-core/icon` | `Icon` |
|
|
66
66
|
| `@manakind/ui-core/illustration` | `Illustration` + `illustrationPaint` |
|
|
67
67
|
| `@manakind/ui-core/menu` | `Menu` |
|
|
68
|
+
| `@manakind/ui-core/popover` | `Popover` |
|
|
69
|
+
| `@manakind/ui-core/checkbox` | `Checkbox` |
|
|
70
|
+
| `@manakind/ui-core/date-input` | `DateInput` |
|
|
68
71
|
| `@manakind/ui-core/progress` | `Progress` |
|
|
69
72
|
| `@manakind/ui-core/select` | `Select` |
|
|
70
73
|
| `@manakind/ui-core/switch` | `Switch` |
|
|
@@ -78,6 +81,9 @@ separately, so an app can load only what it renders.
|
|
|
78
81
|
| `@manakind/ui-core/css/icon` | Icon structural CSS |
|
|
79
82
|
| `@manakind/ui-core/css/illustration` | Illustration structural CSS, including the paint roles |
|
|
80
83
|
| `@manakind/ui-core/css/menu` | Menu structural CSS |
|
|
84
|
+
| `@manakind/ui-core/css/popover` | Popover structural CSS |
|
|
85
|
+
| `@manakind/ui-core/css/checkbox` | Checkbox structural CSS |
|
|
86
|
+
| `@manakind/ui-core/css/date-input` | DateInput structural CSS |
|
|
81
87
|
| `@manakind/ui-core/css/progress` | Progress structural CSS |
|
|
82
88
|
| `@manakind/ui-core/css/select` | Select structural CSS |
|
|
83
89
|
| `@manakind/ui-core/css/switch` | Switch structural CSS |
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-checkbox {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: var(--ds-checkbox-label-gap);
|
|
6
|
+
color: var(--ds-checkbox-label-text);
|
|
7
|
+
font-size: var(--_checkbox-font-size);
|
|
8
|
+
max-width: 100%;
|
|
9
|
+
overflow-wrap: anywhere;
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
|
|
12
|
+
&[data-disabled] {
|
|
13
|
+
cursor: not-allowed;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&[data-readonly] {
|
|
17
|
+
cursor: default;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
& .ds-checkbox__control {
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
flex-shrink: 0;
|
|
26
|
+
width: var(--_checkbox-control-size);
|
|
27
|
+
height: var(--_checkbox-control-size);
|
|
28
|
+
border: 1px solid var(--ds-checkbox-control-border);
|
|
29
|
+
border-radius: var(--ds-checkbox-control-radius);
|
|
30
|
+
background-color: var(--ds-checkbox-control-bg);
|
|
31
|
+
color: var(--ds-checkbox-indicator-color);
|
|
32
|
+
transition:
|
|
33
|
+
background-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
34
|
+
border-color 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* The border stays in the checked state and changes colour with it. The
|
|
38
|
+
* checked fill is a brand colour that may not clear 3:1 against the page
|
|
39
|
+
* on its own (Manuia's olive does not in light), so the border is what
|
|
40
|
+
* bounds the box, as it bounds Switch's track.
|
|
41
|
+
*/
|
|
42
|
+
&[data-state="checked"] {
|
|
43
|
+
border-color: var(--ds-checkbox-control-border-checked);
|
|
44
|
+
background-color: var(--ds-checkbox-control-bg-checked);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
* Thicker as well as red, as on Select and Switch: colour alone is a
|
|
49
|
+
* weak signal on a control, and this one has to survive a red-green
|
|
50
|
+
* colour deficiency. Scoped after `checked` on purpose, so an invalid
|
|
51
|
+
* checkbox keeps saying so in either state.
|
|
52
|
+
*/
|
|
53
|
+
&[data-invalid] {
|
|
54
|
+
border-width: 2px;
|
|
55
|
+
border-color: var(--ds-checkbox-control-border-invalid);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
* Ark moves focus to the hidden input and mirrors its `:focus-visible`
|
|
60
|
+
* onto the control as a data attribute, so the ring is drawn here, where
|
|
61
|
+
* the user is looking. Same ring as every control: 2px, 3px out.
|
|
62
|
+
*/
|
|
63
|
+
&[data-focus-visible] {
|
|
64
|
+
outline: 2px solid var(--ds-checkbox-focus-ring);
|
|
65
|
+
outline-offset: 3px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&[data-disabled] {
|
|
69
|
+
opacity: var(--ds-opacity-disabled);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/*
|
|
74
|
+
* Ark hides the indicator with the `hidden` attribute while unchecked,
|
|
75
|
+
* which only the UA's `[hidden] { display: none }` acts on. An author
|
|
76
|
+
* `display` beats that rule, so the pair stays together or every box
|
|
77
|
+
* shows a check.
|
|
78
|
+
*/
|
|
79
|
+
& .ds-checkbox__indicator {
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
|
|
82
|
+
&[hidden] {
|
|
83
|
+
display: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.ds-checkbox--sm {
|
|
88
|
+
--_checkbox-control-size: var(--ds-checkbox-size-sm-control-size);
|
|
89
|
+
--_checkbox-font-size: var(--ds-checkbox-size-sm-font-size);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&.ds-checkbox--md {
|
|
93
|
+
--_checkbox-control-size: var(--ds-checkbox-size-md-control-size);
|
|
94
|
+
--_checkbox-font-size: var(--ds-checkbox-size-md-font-size);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&.ds-checkbox--lg {
|
|
98
|
+
--_checkbox-control-size: var(--ds-checkbox-size-lg-control-size);
|
|
99
|
+
--_checkbox-font-size: var(--ds-checkbox-size-lg-font-size);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import './checkbox.css';
|
|
3
|
+
import { type IconSource } from '../icon/icon';
|
|
4
|
+
export type CheckboxSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
/**
|
|
6
|
+
* A checkbox has to have a name. A visible `label` is the one to reach for:
|
|
7
|
+
* the whole label is the click target. Expressed as a union so an unnamed
|
|
8
|
+
* checkbox is a compile error rather than an axe finding, as `Switch` does.
|
|
9
|
+
*/
|
|
10
|
+
type CheckboxName = {
|
|
11
|
+
/** Visible label. The whole label is the click target. */
|
|
12
|
+
label: ReactNode;
|
|
13
|
+
/** A different accessible name when the visible label alone would not say what the control is. */
|
|
14
|
+
'aria-label'?: string;
|
|
15
|
+
} | {
|
|
16
|
+
label?: undefined;
|
|
17
|
+
/** Accessible name when no visible label fits, such as a row whose text already says what the checkbox is. */
|
|
18
|
+
'aria-label': string;
|
|
19
|
+
};
|
|
20
|
+
export type CheckboxProps = CheckboxName & {
|
|
21
|
+
/** Controlled checked state. Leave undefined to let the component own it. */
|
|
22
|
+
checked?: boolean;
|
|
23
|
+
/** Initial state when uncontrolled. */
|
|
24
|
+
defaultChecked?: boolean;
|
|
25
|
+
/** Fired with the new state whenever the user toggles the checkbox. */
|
|
26
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
27
|
+
/** Control size and label type scale. */
|
|
28
|
+
size?: CheckboxSize;
|
|
29
|
+
/** Disable the control. It keeps its state and stops responding. */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Marks the control invalid for assistive tech and styling (`data-invalid`).
|
|
33
|
+
* Pair it with a message the control points at through `aria-describedby`;
|
|
34
|
+
* a red border alone is not an accessible error.
|
|
35
|
+
*/
|
|
36
|
+
invalid?: boolean;
|
|
37
|
+
/** Id of the element that describes the control, such as an error message. */
|
|
38
|
+
'aria-describedby'?: string;
|
|
39
|
+
/** Show the state without letting the user change it. */
|
|
40
|
+
readOnly?: boolean;
|
|
41
|
+
/** Marks the hidden input required for native form validation. */
|
|
42
|
+
required?: boolean;
|
|
43
|
+
/** Name for native form participation. */
|
|
44
|
+
name?: string;
|
|
45
|
+
/** Value submitted under `name` while checked. Defaults to `on`. */
|
|
46
|
+
value?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Glyph shown in the box while checked.
|
|
49
|
+
*
|
|
50
|
+
* Defaults to a plain built-in check so `@manakind/ui-core` installs and
|
|
51
|
+
* renders on its own. Products override it with their own icon set, as
|
|
52
|
+
* they do Select's `itemIndicator`.
|
|
53
|
+
*/
|
|
54
|
+
indicator?: IconSource;
|
|
55
|
+
/** Extra class names appended after the `ds-checkbox` modifiers. */
|
|
56
|
+
className?: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* A choice that is saved with the form, built on Ark UI's Checkbox.
|
|
60
|
+
*
|
|
61
|
+
* Ark owns the behaviour: a hidden checkbox carries the state, the root is
|
|
62
|
+
* the `<label>` that names it, and Space and pointer toggling come for free.
|
|
63
|
+
* This wrapper contributes `ds-` classes, the `--ds-checkbox-*` bindings, a
|
|
64
|
+
* flat prop API, and the check glyph.
|
|
65
|
+
*
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <Checkbox label="Health" checked={chosen} onCheckedChange={setChosen} />
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* A checkbox is for a choice that is submitted later, alone or as one of
|
|
71
|
+
* several that can all be on. A setting that takes effect at once is a
|
|
72
|
+
* `Switch`; a choice between values of which exactly one applies is a
|
|
73
|
+
* `Select`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function Checkbox({ label, checked, defaultChecked, onCheckedChange, size, disabled, invalid, readOnly, required, name, value, indicator, className, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/checkbox/checkbox.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO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cAAc,EACd,eAAe,EACf,IAAW,EACX,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,SAAiB,EACjB,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,kBAAkB,EAAE,eAAe,GACpC,EAAE,aAAa,2CAoDf"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox as ArkCheckbox } from '@ark-ui/react/checkbox';
|
|
3
|
+
import { useId, useRef } from 'react';
|
|
4
|
+
import './checkbox.css';
|
|
5
|
+
import { cx } from '../cx';
|
|
6
|
+
import { Check } from '../fallback-glyphs';
|
|
7
|
+
import { Icon } from '../icon/icon';
|
|
8
|
+
/**
|
|
9
|
+
* A choice that is saved with the form, built on Ark UI's Checkbox.
|
|
10
|
+
*
|
|
11
|
+
* Ark owns the behaviour: a hidden checkbox carries the state, the root is
|
|
12
|
+
* the `<label>` that names it, and Space and pointer toggling come for free.
|
|
13
|
+
* This wrapper contributes `ds-` classes, the `--ds-checkbox-*` bindings, a
|
|
14
|
+
* flat prop API, and the check glyph.
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Checkbox label="Health" checked={chosen} onCheckedChange={setChosen} />
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* A checkbox is for a choice that is submitted later, alone or as one of
|
|
21
|
+
* several that can all be on. A setting that takes effect at once is a
|
|
22
|
+
* `Switch`; a choice between values of which exactly one applies is a
|
|
23
|
+
* `Select`.
|
|
24
|
+
*/
|
|
25
|
+
export function Checkbox({ label, checked, defaultChecked, onCheckedChange, size = 'md', disabled, invalid, readOnly, required, name, value, indicator = Check, className, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, }) {
|
|
26
|
+
const inputRef = useRef(null);
|
|
27
|
+
/*
|
|
28
|
+
* Ark hands a checkbox inside a Field the field's control and label ids,
|
|
29
|
+
* so two checkboxes in one field would share an id and both be named by
|
|
30
|
+
* the field's label. A checkbox names itself, so it keeps its own ids and
|
|
31
|
+
* takes only the states from a field around it.
|
|
32
|
+
*/
|
|
33
|
+
const ownId = useId();
|
|
34
|
+
const ids = { hiddenInput: `${ownId}:input`, label: `${ownId}:label` };
|
|
35
|
+
/*
|
|
36
|
+
* Ark renders the hidden input uncontrolled and syncs it only when its own
|
|
37
|
+
* state changes, so a controlled parent that declines a toggle would leave
|
|
38
|
+
* the native input flipped while the box shows the old state. Restoring
|
|
39
|
+
* the parent's value after Ark has read the input keeps the two agreeing,
|
|
40
|
+
* as Switch does.
|
|
41
|
+
*/
|
|
42
|
+
const handleCheckedChange = (details) => {
|
|
43
|
+
onCheckedChange?.(details.checked === true);
|
|
44
|
+
if (checked !== undefined && inputRef.current)
|
|
45
|
+
inputRef.current.checked = checked;
|
|
46
|
+
};
|
|
47
|
+
return (_jsxs(ArkCheckbox.Root, { ids: ids, className: cx('ds-checkbox', `ds-checkbox--${size}`, className), checked: checked, defaultChecked: defaultChecked, onCheckedChange: handleCheckedChange, disabled: disabled, invalid: invalid, readOnly: readOnly, required: required, name: name, value: value, children: [_jsx(ArkCheckbox.Control, { className: "ds-checkbox__control", children: _jsx(ArkCheckbox.Indicator, { className: "ds-checkbox__indicator", children: _jsx(Icon, { source: indicator, size: "sm", decorative: true }) }) }), label && _jsx(ArkCheckbox.Label, { className: "ds-checkbox__label", children: label }), _jsx(ArkCheckbox.HiddenInput, { ref: inputRef, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "aria-readonly": readOnly || undefined })] }));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../src/checkbox/checkbox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAkB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AQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,aAEZ,KAAC,WAAW,CAAC,OAAO,IAAC,SAAS,EAAC,sBAAsB,YACnD,KAAC,WAAW,CAAC,SAAS,IAAC,SAAS,EAAC,wBAAwB,YACvD,KAAC,IAAI,IAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,IAAI,EAAC,UAAU,SAAG,GAC1B,GACJ,EACrB,KAAK,IAAI,KAAC,WAAW,CAAC,KAAK,IAAC,SAAS,EAAC,oBAAoB,YAAE,KAAK,GAAqB,EACvF,KAAC,WAAW,CAAC,WAAW,IACtB,GAAG,EAAE,QAAQ,gBACD,SAAS,sBACH,eAAe,mBAClB,QAAQ,IAAI,SAAS,GACpC,IACe,CACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyC,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
/*
|
|
3
|
+
* The control is the `ds-input` box drawn around parts instead of around
|
|
4
|
+
* one text node, so it reads the input contract: a form of inputs, dates
|
|
5
|
+
* and selects is one family.
|
|
6
|
+
*/
|
|
7
|
+
.ds-date-input {
|
|
8
|
+
display: block;
|
|
9
|
+
max-width: 100%;
|
|
10
|
+
overflow-wrap: anywhere;
|
|
11
|
+
|
|
12
|
+
& .ds-date-input__control {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
width: 100%;
|
|
17
|
+
min-height: var(--_date-input-height);
|
|
18
|
+
padding-inline: var(--_date-input-padding-inline);
|
|
19
|
+
border: 1px solid var(--ds-input-border);
|
|
20
|
+
border-radius: var(--ds-input-radius);
|
|
21
|
+
background-color: var(--ds-input-bg);
|
|
22
|
+
color: var(--ds-input-text);
|
|
23
|
+
font-size: var(--_date-input-font-size);
|
|
24
|
+
transition:
|
|
25
|
+
background-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
26
|
+
border-color 150ms cubic-bezier(0, 0, 0.2, 1),
|
|
27
|
+
box-shadow 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
* The same signals as Input: invalid is red and 2px, hover is darker
|
|
31
|
+
* and 2px, the second pixel a ring outside the border so nothing
|
|
32
|
+
* below the control moves.
|
|
33
|
+
*/
|
|
34
|
+
&[data-invalid] {
|
|
35
|
+
border-color: var(--ds-input-border-invalid);
|
|
36
|
+
box-shadow: 0 0 0 1px var(--ds-input-border-invalid);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:hover:not([data-disabled], [data-readonly]) {
|
|
40
|
+
background-color: var(--ds-input-bg-hover);
|
|
41
|
+
|
|
42
|
+
&:not([data-invalid]) {
|
|
43
|
+
border-color: var(--ds-input-border-hover);
|
|
44
|
+
box-shadow: 0 0 0 1px var(--ds-input-border-hover);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&[data-disabled] {
|
|
49
|
+
opacity: var(--ds-opacity-disabled);
|
|
50
|
+
cursor: not-allowed;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
* The parts are separated by the locale's literals, not by gaps. A row
|
|
56
|
+
* that wraps and parts capped at the box: a part only ever holds digits,
|
|
57
|
+
* but the long-words guard holds every text to the same rule.
|
|
58
|
+
*/
|
|
59
|
+
& .ds-date-input__segments {
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
flex-wrap: wrap;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: 0;
|
|
64
|
+
max-width: 100%;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
* A part is a `contenteditable` span. Focus is shown by filling the
|
|
69
|
+
* part, not by the ring: the ring belongs to the control's box, and a
|
|
70
|
+
* ring on each part would draw three boxes inside one. The box ring is
|
|
71
|
+
* drawn while any part has focus, through `data-focus` on the control.
|
|
72
|
+
*/
|
|
73
|
+
& .ds-date-input__segment {
|
|
74
|
+
display: inline-block;
|
|
75
|
+
/* A flex item shrinks only below `min-width: 0`; a part never holds more than digits, but the long-words guard asks anyway. */
|
|
76
|
+
min-width: 0;
|
|
77
|
+
max-width: 100%;
|
|
78
|
+
overflow-wrap: anywhere;
|
|
79
|
+
padding-inline: var(--ds-date-input-segment-padding-inline);
|
|
80
|
+
border-radius: var(--ds-date-input-segment-radius);
|
|
81
|
+
font-variant-numeric: tabular-nums;
|
|
82
|
+
caret-color: transparent;
|
|
83
|
+
outline: none;
|
|
84
|
+
|
|
85
|
+
&[data-placeholder-shown] {
|
|
86
|
+
color: var(--ds-input-placeholder);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&[data-type="literal"] {
|
|
90
|
+
padding-inline: 0;
|
|
91
|
+
color: var(--ds-input-placeholder);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&:focus {
|
|
95
|
+
background-color: var(--ds-date-input-segment-bg-selected);
|
|
96
|
+
color: var(--ds-date-input-segment-text-selected);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
& .ds-date-input__control[data-focus] {
|
|
101
|
+
outline: 2px solid var(--ds-input-focus-ring);
|
|
102
|
+
outline-offset: 3px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&.ds-date-input--sm {
|
|
106
|
+
--_date-input-height: var(--ds-input-size-sm-height);
|
|
107
|
+
--_date-input-padding-inline: var(--ds-input-size-sm-padding-inline);
|
|
108
|
+
--_date-input-font-size: var(--ds-input-size-sm-font-size);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&.ds-date-input--md {
|
|
112
|
+
--_date-input-height: var(--ds-input-size-md-height);
|
|
113
|
+
--_date-input-padding-inline: var(--ds-input-size-md-padding-inline);
|
|
114
|
+
--_date-input-font-size: var(--ds-input-size-md-font-size);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&.ds-date-input--lg {
|
|
118
|
+
--_date-input-height: var(--ds-input-size-lg-height);
|
|
119
|
+
--_date-input-padding-inline: var(--ds-input-size-lg-padding-inline);
|
|
120
|
+
--_date-input-font-size: var(--ds-input-size-lg-font-size);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import './date-input.css';
|
|
2
|
+
import type { InputSize } from '../field/input';
|
|
3
|
+
export type DatePartNames = {
|
|
4
|
+
day: string;
|
|
5
|
+
month: string;
|
|
6
|
+
year: string;
|
|
7
|
+
};
|
|
8
|
+
export type DateInputProps = {
|
|
9
|
+
/**
|
|
10
|
+
* The date as an ISO calendar date, `YYYY-MM-DD`, or `null` for none.
|
|
11
|
+
* A calendar date has no time and no zone, so the same value means the
|
|
12
|
+
* same day everywhere. Leave undefined to let the component own it.
|
|
13
|
+
*/
|
|
14
|
+
value?: string | null;
|
|
15
|
+
/** Initial date when uncontrolled, `YYYY-MM-DD`, or `null` for none. */
|
|
16
|
+
defaultValue?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Fired with the ISO date whenever all three parts hold a value, and with
|
|
19
|
+
* `null` once every part is cleared. A half-typed or half-cleared date
|
|
20
|
+
* fires nothing: the last whole date stands until there is a new one or
|
|
21
|
+
* none.
|
|
22
|
+
*/
|
|
23
|
+
onValueChange?: (value: string | null) => void;
|
|
24
|
+
/**
|
|
25
|
+
* BCP 47 tag that decides the order of the parts and the separators.
|
|
26
|
+
* Defaults to `nb`: day, month, year with dots (31.12.2026), the format
|
|
27
|
+
* the products write dates in; `en-GB` gives slashes, `en-US` leads with
|
|
28
|
+
* the month.
|
|
29
|
+
*/
|
|
30
|
+
locale?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Fired when the parts go from all empty or all filled to some filled,
|
|
33
|
+
* and back. A form that must refuse a half-typed date on submit listens
|
|
34
|
+
* here: `onValueChange` cannot tell a cleared part from an untouched one.
|
|
35
|
+
*/
|
|
36
|
+
onIncompleteChange?: (incomplete: boolean) => void;
|
|
37
|
+
/**
|
|
38
|
+
* What the parts are called for assistive technology, in the product's
|
|
39
|
+
* language. The placeholders follow `locale`; these do not, because the
|
|
40
|
+
* control cannot know which words the product uses. English by default.
|
|
41
|
+
*/
|
|
42
|
+
partNames?: DatePartNames;
|
|
43
|
+
/** Control height and type scale. Matches `Input` and `Select`. */
|
|
44
|
+
size?: InputSize;
|
|
45
|
+
/**
|
|
46
|
+
* Marks the control invalid on its own, outside a `Field`. Inside one, the
|
|
47
|
+
* field's `error` or `invalid` does this and the prop is not needed.
|
|
48
|
+
*/
|
|
49
|
+
invalid?: boolean;
|
|
50
|
+
/** Disables the parts and dims the control. */
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/** Shows the date without letting the user change it. */
|
|
53
|
+
readOnly?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Tells assistive technology the date is required. The form validates it:
|
|
56
|
+
* the value lives in a hidden input, which takes part in no native
|
|
57
|
+
* validation.
|
|
58
|
+
*/
|
|
59
|
+
required?: boolean;
|
|
60
|
+
/** Name for native form participation; the hidden input submits the ISO date. */
|
|
61
|
+
name?: string;
|
|
62
|
+
/** Accessible name when the control is outside a `Field`. */
|
|
63
|
+
'aria-label'?: string;
|
|
64
|
+
/** Extra class names appended after `ds-date-input`. */
|
|
65
|
+
className?: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A date typed as parts, built on Ark UI's DateInput.
|
|
69
|
+
*
|
|
70
|
+
* The control shows day, month and year as separate parts in the locale's
|
|
71
|
+
* order, with the locale's separators between them. A part takes digits,
|
|
72
|
+
* steps with the arrow keys, and hands focus to the next part when it is
|
|
73
|
+
* full, so a date is typed as one run of digits. The value in and out is an
|
|
74
|
+
* ISO calendar date: a string a form library and a database both keep as
|
|
75
|
+
* is, with no time zone to get wrong.
|
|
76
|
+
*
|
|
77
|
+
* Inside a `Field` it takes the label, the hint, the error and the states
|
|
78
|
+
* from the field, which also owns its `id`; clicking the label focuses the
|
|
79
|
+
* first part. On its own it needs `aria-label`.
|
|
80
|
+
*
|
|
81
|
+
* ```tsx
|
|
82
|
+
* <Field label="Target date" error={errors.targetDate?.message}>
|
|
83
|
+
* <DateInput value={targetDate} onValueChange={setTargetDate} />
|
|
84
|
+
* </Field>
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function DateInput({ value, defaultValue, onValueChange, locale, onIncompleteChange, partNames, size, invalid, disabled, readOnly, required, name, 'aria-label': ariaLabel, className, }: DateInputProps): import("react/jsx-runtime").JSX.Element;
|
|
88
|
+
//# sourceMappingURL=date-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-input.d.ts","sourceRoot":"","sources":["../../src/date-input/date-input.tsx"],"names":[],"mappings":"AAQA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAIzE,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,mEAAmE;IACnE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAyEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,YAAY,EACZ,aAAa,EACb,MAAa,EACb,kBAAkB,EAClB,SAA8B,EAC9B,IAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,YAAY,EAAE,SAAS,EACvB,SAAS,GACV,EAAE,cAAc,2CAkDhB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DateInput as ArkDateInput, useDateInputContext, } from '@ark-ui/react/date-input';
|
|
3
|
+
import { parseDate } from '@internationalized/date';
|
|
4
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
5
|
+
import './date-input.css';
|
|
6
|
+
import { cx } from '../cx';
|
|
7
|
+
import { useFieldControl } from '../field/use-field-control';
|
|
8
|
+
const ENGLISH_PART_NAMES = { day: 'Day', month: 'Month', year: 'Year' };
|
|
9
|
+
/*
|
|
10
|
+
* The value a form submits and `onValueChange` reports. Zag formats it for
|
|
11
|
+
* the locale by default, which is the display, not a date a database keeps.
|
|
12
|
+
*/
|
|
13
|
+
const toIso = (date) => date.toString();
|
|
14
|
+
/*
|
|
15
|
+
* A wrong shape throws, during render, where the product passed it: a
|
|
16
|
+
* timestamp or a locale string is a bug in the caller, and a control that
|
|
17
|
+
* showed something else would hide it.
|
|
18
|
+
*/
|
|
19
|
+
const toDateValue = (iso, prop) => {
|
|
20
|
+
if (iso === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
if (iso === null || iso === '')
|
|
23
|
+
return [];
|
|
24
|
+
try {
|
|
25
|
+
return [parseDate(iso)];
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
throw new Error(`DateInput: ${prop} must be an ISO calendar date (YYYY-MM-DD), got "${iso}"`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
/*
|
|
32
|
+
* A part's key is its type and its rank among parts of that type: the
|
|
33
|
+
* literal separators repeat, and a key that changed with the text would
|
|
34
|
+
* remount the part under the user's caret.
|
|
35
|
+
*/
|
|
36
|
+
const isDatePart = (type) => type === 'day' || type === 'month' || type === 'year';
|
|
37
|
+
function renderSegments(api, names, required) {
|
|
38
|
+
const seen = new Map();
|
|
39
|
+
return api.getSegments().map((segment) => {
|
|
40
|
+
const rank = seen.get(segment.type) ?? 0;
|
|
41
|
+
seen.set(segment.type, rank + 1);
|
|
42
|
+
const part = isDatePart(segment.type) ? segment.type : undefined;
|
|
43
|
+
return (_jsx(ArkDateInput.Segment, { segment: segment, className: "ds-date-input__segment", "aria-label": part && names[part], "aria-required": part && required ? true : undefined }, `${segment.type}-${rank}`));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/*
|
|
47
|
+
* Reports the half-typed state to the parent. Zag holds it in the display
|
|
48
|
+
* value, not in the committed value, so it is read from the context and
|
|
49
|
+
* sent out when it changes: an effect, because the parent is the external
|
|
50
|
+
* system here.
|
|
51
|
+
*/
|
|
52
|
+
function IncompleteWatcher({ onIncompleteChange, }) {
|
|
53
|
+
const api = useDateInputContext();
|
|
54
|
+
const segments = api.getSegments().filter((segment) => segment.isEditable);
|
|
55
|
+
const filled = segments.filter((segment) => !segment.isPlaceholder).length;
|
|
56
|
+
const incomplete = filled > 0 && filled < segments.length;
|
|
57
|
+
const previous = useRef(incomplete);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (previous.current === incomplete)
|
|
60
|
+
return;
|
|
61
|
+
previous.current = incomplete;
|
|
62
|
+
onIncompleteChange(incomplete);
|
|
63
|
+
}, [incomplete, onIncompleteChange]);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A date typed as parts, built on Ark UI's DateInput.
|
|
68
|
+
*
|
|
69
|
+
* The control shows day, month and year as separate parts in the locale's
|
|
70
|
+
* order, with the locale's separators between them. A part takes digits,
|
|
71
|
+
* steps with the arrow keys, and hands focus to the next part when it is
|
|
72
|
+
* full, so a date is typed as one run of digits. The value in and out is an
|
|
73
|
+
* ISO calendar date: a string a form library and a database both keep as
|
|
74
|
+
* is, with no time zone to get wrong.
|
|
75
|
+
*
|
|
76
|
+
* Inside a `Field` it takes the label, the hint, the error and the states
|
|
77
|
+
* from the field, which also owns its `id`; clicking the label focuses the
|
|
78
|
+
* first part. On its own it needs `aria-label`.
|
|
79
|
+
*
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <Field label="Target date" error={errors.targetDate?.message}>
|
|
82
|
+
* <DateInput value={targetDate} onValueChange={setTargetDate} />
|
|
83
|
+
* </Field>
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export function DateInput({ value, defaultValue, onValueChange, locale = 'nb', onIncompleteChange, partNames = ENGLISH_PART_NAMES, size = 'md', invalid, disabled, readOnly, required, name, 'aria-label': ariaLabel, className, }) {
|
|
87
|
+
const field = useFieldControl();
|
|
88
|
+
const controlledValue = useMemo(() => toDateValue(value, 'value'), [value]);
|
|
89
|
+
const initialValue = useMemo(() => toDateValue(defaultValue, 'defaultValue'), [defaultValue]);
|
|
90
|
+
const isRequired = field?.required || required;
|
|
91
|
+
/*
|
|
92
|
+
* A Field names its control through `<label for>` and focuses a control
|
|
93
|
+
* that is not labelable by calling `focus()` on the element carrying the
|
|
94
|
+
* field's id. That element is the control box here, which is not itself
|
|
95
|
+
* a part, so a focus that lands on the box is handed to the first part.
|
|
96
|
+
*/
|
|
97
|
+
const focusFirstSegment = (event) => {
|
|
98
|
+
if (event.target !== event.currentTarget)
|
|
99
|
+
return;
|
|
100
|
+
event.currentTarget.querySelector('[role="spinbutton"]')?.focus();
|
|
101
|
+
};
|
|
102
|
+
return (_jsxs(ArkDateInput.Root, { className: cx('ds-date-input', `ds-date-input--${size}`, className), ids: field ? { control: field.id, label: () => field.labelId } : undefined, locale: locale, value: controlledValue, defaultValue: initialValue, onValueChange: (details) => onValueChange?.(details.valueAsString[0] ?? null), invalid: field?.invalid || invalid, disabled: field?.disabled || disabled, readOnly: field?.readOnly || readOnly, name: name, format: toIso, children: [_jsx(ArkDateInput.Control, { className: "ds-date-input__control", tabIndex: -1, onFocus: focusFirstSegment, children: _jsxs(ArkDateInput.SegmentGroup, { className: "ds-date-input__segments", "aria-label": ariaLabel, "aria-describedby": field?.describedBy, children: [_jsx(ArkDateInput.Context, { children: (api) => renderSegments(api, partNames, isRequired) }), onIncompleteChange && _jsx(IncompleteWatcher, { onIncompleteChange: onIncompleteChange })] }) }), _jsx(ArkDateInput.HiddenInput, {})] }));
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=date-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-input.js","sourceRoot":"","sources":["../../src/date-input/date-input.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0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/date-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA2C,MAAM,cAAc,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,16 @@ export * from './alert';
|
|
|
2
2
|
export * from './badge';
|
|
3
3
|
export * from './button';
|
|
4
4
|
export * from './card';
|
|
5
|
+
export * from './checkbox';
|
|
5
6
|
export { cx } from './cx';
|
|
7
|
+
export * from './date-input';
|
|
6
8
|
export * from './dialog';
|
|
7
9
|
export { Check as FallbackCheck, ChevronRight as FallbackChevronRight, Cross as FallbackCross, } from './fallback-glyphs';
|
|
8
10
|
export * from './field';
|
|
9
11
|
export * from './icon';
|
|
10
12
|
export * from './illustration';
|
|
11
13
|
export * from './menu';
|
|
14
|
+
export * from './popover';
|
|
12
15
|
export * from './progress';
|
|
13
16
|
export * from './select';
|
|
14
17
|
export * from './switch';
|
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,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,16 @@ export * from './alert';
|
|
|
2
2
|
export * from './badge';
|
|
3
3
|
export * from './button';
|
|
4
4
|
export * from './card';
|
|
5
|
+
export * from './checkbox';
|
|
5
6
|
export { cx } from './cx';
|
|
7
|
+
export * from './date-input';
|
|
6
8
|
export * from './dialog';
|
|
7
9
|
export { Check as FallbackCheck, ChevronRight as FallbackChevronRight, Cross as FallbackCross, } from './fallback-glyphs';
|
|
8
10
|
export * from './field';
|
|
9
11
|
export * from './icon';
|
|
10
12
|
export * from './illustration';
|
|
11
13
|
export * from './menu';
|
|
14
|
+
export * from './popover';
|
|
12
15
|
export * from './progress';
|
|
13
16
|
export * from './select';
|
|
14
17
|
export * from './switch';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,OAAO,EACL,KAAK,IAAI,aAAa,EACtB,YAAY,IAAI,oBAAoB,EACpC,KAAK,IAAI,aAAa,GACvB,MAAM,mBAAmB,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA4C,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
/*
|
|
3
|
+
* The panel renders in a portal, so it is not a descendant of the trigger
|
|
4
|
+
* in the DOM and is styled at the top level, as Menu's popup is.
|
|
5
|
+
*/
|
|
6
|
+
.ds-popover__content {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
padding: var(--ds-popover-content-padding);
|
|
9
|
+
border: 1px solid var(--ds-popover-content-border);
|
|
10
|
+
border-radius: var(--ds-popover-content-radius);
|
|
11
|
+
background-color: var(--ds-popover-content-bg);
|
|
12
|
+
color: var(--ds-popover-content-text);
|
|
13
|
+
box-shadow: var(--ds-popover-content-shadow);
|
|
14
|
+
/*
|
|
15
|
+
* As wide as its content, but no wider than the room Zag measures
|
|
16
|
+
* beside the trigger, and no taller than the room below it: past that
|
|
17
|
+
* the content scrolls instead of pushing the panel off screen.
|
|
18
|
+
*/
|
|
19
|
+
inline-size: max-content;
|
|
20
|
+
max-inline-size: var(--available-width);
|
|
21
|
+
max-block-size: var(--available-height);
|
|
22
|
+
overflow: auto;
|
|
23
|
+
overflow-wrap: anywhere;
|
|
24
|
+
|
|
25
|
+
/* Zag measures the trigger into `--reference-width` on the positioner. */
|
|
26
|
+
&.ds-popover__content--same-width {
|
|
27
|
+
inline-size: var(--reference-width);
|
|
28
|
+
}
|
|
29
|
+
/*
|
|
30
|
+
* The `popup` stacking layer (ds-config/scripts/stacking.ts), as
|
|
31
|
+
* Select's listbox and Menu's popup: Zag copies this onto the
|
|
32
|
+
* positioner, so the panel paints above the products' overlay layer.
|
|
33
|
+
*/
|
|
34
|
+
z-index: 60;
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* Inset like Menu's ring: an outer ring on a portalled panel is cropped
|
|
38
|
+
* by anything that sizes to it and can clip against the viewport.
|
|
39
|
+
*/
|
|
40
|
+
&:focus-visible {
|
|
41
|
+
outline: 2px solid var(--ds-popover-focus-ring);
|
|
42
|
+
outline-offset: -2px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import './popover.css';
|
|
3
|
+
export type PopoverPlacement = 'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end';
|
|
4
|
+
export interface PopoverProps {
|
|
5
|
+
/**
|
|
6
|
+
* The element that opens the popover: a `<button>`, or a component that
|
|
7
|
+
* passes its props and `ref` on to one.
|
|
8
|
+
*
|
|
9
|
+
* Ark renders it as the trigger, adding `aria-haspopup="dialog"`,
|
|
10
|
+
* `aria-expanded`, `aria-controls`, the open/close handlers and
|
|
11
|
+
* `data-state` (`open` or `closed`, for a product's own indicator). Its
|
|
12
|
+
* own handlers still run. Give it an accessible name that says what the
|
|
13
|
+
* popover holds, such as "Categories: Health, Career": the popover takes
|
|
14
|
+
* its own name from `label`.
|
|
15
|
+
*/
|
|
16
|
+
trigger: ReactElement;
|
|
17
|
+
/**
|
|
18
|
+
* What the popover is, such as "Categories". Names the panel for
|
|
19
|
+
* assistive technology; it is not shown. The trigger already says it.
|
|
20
|
+
*/
|
|
21
|
+
label: string;
|
|
22
|
+
/** What the popover holds: a group of checkboxes, a short form, a note. */
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
/** Controlled open state. Leave undefined to let the component own it. */
|
|
25
|
+
open?: boolean;
|
|
26
|
+
/** Initial state when uncontrolled. */
|
|
27
|
+
defaultOpen?: boolean;
|
|
28
|
+
/** Fired whenever the popover opens or closes, by any means. */
|
|
29
|
+
onOpenChange?: (open: boolean) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Where the popover sits relative to the trigger. It flips to the other
|
|
32
|
+
* side when there is no room. Defaults to `bottom-start`.
|
|
33
|
+
*/
|
|
34
|
+
placement?: PopoverPlacement;
|
|
35
|
+
/**
|
|
36
|
+
* Make the popover as wide as its trigger, for a popover that stands in
|
|
37
|
+
* for a listbox under a full-width control. Otherwise it is as wide as
|
|
38
|
+
* its content, up to the room beside the trigger.
|
|
39
|
+
*/
|
|
40
|
+
sameWidth?: boolean;
|
|
41
|
+
/** Extra class names on the popover's panel. */
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A small panel opened from a trigger and placed beside it, built on Ark
|
|
46
|
+
* UI's Popover. It holds something richer than a menu's list of choices:
|
|
47
|
+
* a group of checkboxes, a short form, a note with a link.
|
|
48
|
+
*
|
|
49
|
+
* Ark owns the hard parts: the `dialog` role, focus moving into the panel
|
|
50
|
+
* on open and back to the trigger on close, Escape and click outside to
|
|
51
|
+
* dismiss, and positioning that flips when there is no room. This wrapper
|
|
52
|
+
* contributes `ds-` classes, the `--ds-popover-*` bindings, and a flat
|
|
53
|
+
* prop API.
|
|
54
|
+
*
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <Popover trigger={<button type="button">Categories: {chosen.join(', ')}</button>} label="Categories">
|
|
57
|
+
* <Checkbox label="Health" checked={chosen.includes('Health')} onCheckedChange={toggle('Health')} />
|
|
58
|
+
* <Checkbox label="Career" checked={chosen.includes('Career')} onCheckedChange={toggle('Career')} />
|
|
59
|
+
* </Popover>
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* The panel is mounted only while open, so what it holds lives in the
|
|
63
|
+
* parent: a control inside is controlled, and the trigger reads the same
|
|
64
|
+
* state.
|
|
65
|
+
*
|
|
66
|
+
* Reach for this when the content is more than a list of mutually
|
|
67
|
+
* exclusive choices (that is a `Menu` or a `Select`) and less than a task
|
|
68
|
+
* that should take the whole screen (that is a `Dialog`). The panel is not
|
|
69
|
+
* modal: the page behind it stays usable, and a click on it closes the
|
|
70
|
+
* panel.
|
|
71
|
+
*
|
|
72
|
+
* The panel renders in a portal at the `popup` stacking layer, as Select's
|
|
73
|
+
* listbox and Menu's popup do, so it paints above the page or dialog it
|
|
74
|
+
* opens from.
|
|
75
|
+
*/
|
|
76
|
+
export declare function Popover({ trigger, label, children, open, defaultOpen, onOpenChange, placement, sameWidth, className, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/popover/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAGtE,OAAO,eAAe,CAAC;AAEvB,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,KAAK,GACL,SAAS,CAAC;AAEd,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;OAUG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,QAAQ,EAAE,SAAS,CAAC;IACpB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gEAAgE;IAChE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,SAA0B,EAC1B,SAAiB,EACjB,SAAS,GACV,EAAE,YAAY,2CA8Bd"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Popover as ArkPopover } from '@ark-ui/react/popover';
|
|
3
|
+
import { Portal } from '@ark-ui/react/portal';
|
|
4
|
+
import { useContext } from 'react';
|
|
5
|
+
import { cx } from '../cx';
|
|
6
|
+
import { PortalContainerContext } from '../portal-container';
|
|
7
|
+
import './popover.css';
|
|
8
|
+
/**
|
|
9
|
+
* A small panel opened from a trigger and placed beside it, built on Ark
|
|
10
|
+
* UI's Popover. It holds something richer than a menu's list of choices:
|
|
11
|
+
* a group of checkboxes, a short form, a note with a link.
|
|
12
|
+
*
|
|
13
|
+
* Ark owns the hard parts: the `dialog` role, focus moving into the panel
|
|
14
|
+
* on open and back to the trigger on close, Escape and click outside to
|
|
15
|
+
* dismiss, and positioning that flips when there is no room. This wrapper
|
|
16
|
+
* contributes `ds-` classes, the `--ds-popover-*` bindings, and a flat
|
|
17
|
+
* prop API.
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Popover trigger={<button type="button">Categories: {chosen.join(', ')}</button>} label="Categories">
|
|
21
|
+
* <Checkbox label="Health" checked={chosen.includes('Health')} onCheckedChange={toggle('Health')} />
|
|
22
|
+
* <Checkbox label="Career" checked={chosen.includes('Career')} onCheckedChange={toggle('Career')} />
|
|
23
|
+
* </Popover>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* The panel is mounted only while open, so what it holds lives in the
|
|
27
|
+
* parent: a control inside is controlled, and the trigger reads the same
|
|
28
|
+
* state.
|
|
29
|
+
*
|
|
30
|
+
* Reach for this when the content is more than a list of mutually
|
|
31
|
+
* exclusive choices (that is a `Menu` or a `Select`) and less than a task
|
|
32
|
+
* that should take the whole screen (that is a `Dialog`). The panel is not
|
|
33
|
+
* modal: the page behind it stays usable, and a click on it closes the
|
|
34
|
+
* panel.
|
|
35
|
+
*
|
|
36
|
+
* The panel renders in a portal at the `popup` stacking layer, as Select's
|
|
37
|
+
* listbox and Menu's popup do, so it paints above the page or dialog it
|
|
38
|
+
* opens from.
|
|
39
|
+
*/
|
|
40
|
+
export function Popover({ trigger, label, children, open, defaultOpen, onOpenChange, placement = 'bottom-start', sameWidth = false, className, }) {
|
|
41
|
+
const portalContainer = useContext(PortalContainerContext);
|
|
42
|
+
return (_jsxs(ArkPopover.Root, { lazyMount: true, unmountOnExit: true, open: open, defaultOpen: defaultOpen, onOpenChange: (details) => onOpenChange?.(details.open), positioning: { placement, sameWidth }, children: [_jsx(ArkPopover.Trigger, { asChild: true, children: trigger }), _jsx(Portal, { container: portalContainer, children: _jsx(ArkPopover.Positioner, { children: _jsx(ArkPopover.Content, { className: cx('ds-popover__content', sameWidth && 'ds-popover__content--same-width', className), "aria-label": label, children: children }) }) })] }));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.js","sourceRoot":"","sources":["../../src/popover/popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAqC,UAAU,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,eAAe,CAAC;AAmDvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,SAAS,GAAG,cAAc,EAC1B,SAAS,GAAG,KAAK,EACjB,SAAS,GACI;IACb,MAAM,eAAe,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAE3D,OAAO,CACL,MAAC,UAAU,CAAC,IAAI,IACd,SAAS,QACT,aAAa,QACb,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EACvD,WAAW,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,aAErC,KAAC,UAAU,CAAC,OAAO,IAAC,OAAO,kBAAE,OAAO,GAAsB,EAE1D,KAAC,MAAM,IAAC,SAAS,EAAE,eAAe,YAChC,KAAC,UAAU,CAAC,UAAU,cACpB,KAAC,UAAU,CAAC,OAAO,IACjB,SAAS,EAAE,EAAE,CACX,qBAAqB,EACrB,SAAS,IAAI,iCAAiC,EAC9C,SAAS,CACV,gBACW,KAAK,YAEhB,QAAQ,GACU,GACC,GACjB,IACO,CACnB,CAAC;AACJ,CAAC"}
|
package/dist/switch/switch.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type SwitchLabelPlacement = 'start' | 'end';
|
|
|
11
11
|
type SwitchName = {
|
|
12
12
|
/** Visible label. The whole label is the click target. */
|
|
13
13
|
label: ReactNode;
|
|
14
|
+
/** A different accessible name when the visible label alone would not say what the control is. */
|
|
14
15
|
'aria-label'?: string;
|
|
15
16
|
} | {
|
|
16
17
|
label?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/switch/switch.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/switch/switch.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AACtD,OAAO,cAAc,CAAC;AAGtB,MAAM,MAAM,UAAU,GAAG,IA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ACP,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,kBAAkB,EAAE,eAAe,GACpC,EAAE,WAAW,2CAqDb"}
|
package/dist/switch/switch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Switch as ArkSwitch } from '@ark-ui/react/switch';
|
|
3
|
-
import { useRef } from 'react';
|
|
3
|
+
import { useId, useRef } from 'react';
|
|
4
4
|
import './switch.css';
|
|
5
5
|
import { cx } from '../cx';
|
|
6
6
|
/**
|
|
@@ -24,6 +24,10 @@ import { cx } from '../cx';
|
|
|
24
24
|
export function Switch({ label, labelPlacement = 'end', checked, defaultChecked, onCheckedChange, size = 'md', disabled, invalid, readOnly, required, name, value, className, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, }) {
|
|
25
25
|
const labelNode = label ? (_jsx(ArkSwitch.Label, { className: "ds-switch__label", children: label })) : null;
|
|
26
26
|
const inputRef = useRef(null);
|
|
27
|
+
// Own ids, as Checkbox: a switch names itself, and two switches in one
|
|
28
|
+
// Field must not share the field's control id.
|
|
29
|
+
const ownId = useId();
|
|
30
|
+
const ids = { hiddenInput: `${ownId}:input`, label: `${ownId}:label` };
|
|
27
31
|
/*
|
|
28
32
|
* Ark renders the hidden input uncontrolled (`defaultChecked`) and syncs it
|
|
29
33
|
* only when its own state changes. A controlled parent that declines a
|
|
@@ -37,6 +41,6 @@ export function Switch({ label, labelPlacement = 'end', checked, defaultChecked,
|
|
|
37
41
|
if (checked !== undefined && inputRef.current)
|
|
38
42
|
inputRef.current.checked = checked;
|
|
39
43
|
};
|
|
40
|
-
return (_jsxs(ArkSwitch.Root, { className: cx('ds-switch', `ds-switch--${size}`, className), checked: checked, defaultChecked: defaultChecked, onCheckedChange: handleCheckedChange, disabled: disabled, invalid: invalid, readOnly: readOnly, required: required, name: name, value: value, children: [labelPlacement === 'start' && labelNode, _jsx(ArkSwitch.Control, { className: "ds-switch__control", children: _jsx(ArkSwitch.Thumb, { className: "ds-switch__thumb" }) }), labelPlacement === 'end' && labelNode, _jsx(ArkSwitch.HiddenInput, { ref: inputRef, role: "switch", "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "aria-readonly": readOnly || undefined })] }));
|
|
44
|
+
return (_jsxs(ArkSwitch.Root, { ids: ids, className: cx('ds-switch', `ds-switch--${size}`, className), checked: checked, defaultChecked: defaultChecked, onCheckedChange: handleCheckedChange, disabled: disabled, invalid: invalid, readOnly: readOnly, required: required, name: name, value: value, children: [labelPlacement === 'start' && labelNode, _jsx(ArkSwitch.Control, { className: "ds-switch__control", children: _jsx(ArkSwitch.Thumb, { className: "ds-switch__thumb" }) }), labelPlacement === 'end' && labelNode, _jsx(ArkSwitch.HiddenInput, { ref: inputRef, role: "switch", "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, "aria-readonly": readOnly || undefined })] }));
|
|
41
45
|
}
|
|
42
46
|
//# sourceMappingURL=switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/switch/switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAkB,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/switch/switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAkB,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AA8D3B;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,KAAK,EACL,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,aAEX,cAAc,KAAK,OAAO,IAAI,SAAS,EACxC,KAAC,SAAS,CAAC,OAAO,IAAC,SAAS,EAAC,oBAAoB,YAC/C,KAAC,SAAS,CAAC,KAAK,IAAC,SAAS,EAAC,kBAAkB,GAAG,GAC9B,EACnB,cAAc,KAAK,KAAK,IAAI,SAAS,EACtC,KAAC,SAAS,CAAC,WAAW,IACpB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAC,QAAQ,gBACD,SAAS,sBACH,eAAe,mBAClB,QAAQ,IAAI,SAAS,GACpC,IACa,CAClB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manakind/ui-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,10 +40,54 @@
|
|
|
40
40
|
"types": "./dist/card/index.d.ts",
|
|
41
41
|
"import": "./dist/card/index.js"
|
|
42
42
|
},
|
|
43
|
+
"./checkbox": {
|
|
44
|
+
"types": "./dist/checkbox/index.d.ts",
|
|
45
|
+
"import": "./dist/checkbox/index.js"
|
|
46
|
+
},
|
|
47
|
+
"./date-input": {
|
|
48
|
+
"types": "./dist/date-input/index.d.ts",
|
|
49
|
+
"import": "./dist/date-input/index.js"
|
|
50
|
+
},
|
|
43
51
|
"./dialog": {
|
|
44
52
|
"types": "./dist/dialog/index.d.ts",
|
|
45
53
|
"import": "./dist/dialog/index.js"
|
|
46
54
|
},
|
|
55
|
+
"./field": {
|
|
56
|
+
"types": "./dist/field/index.d.ts",
|
|
57
|
+
"import": "./dist/field/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./icon": {
|
|
60
|
+
"types": "./dist/icon/index.d.ts",
|
|
61
|
+
"import": "./dist/icon/index.js"
|
|
62
|
+
},
|
|
63
|
+
"./illustration": {
|
|
64
|
+
"types": "./dist/illustration/index.d.ts",
|
|
65
|
+
"import": "./dist/illustration/index.js"
|
|
66
|
+
},
|
|
67
|
+
"./menu": {
|
|
68
|
+
"types": "./dist/menu/index.d.ts",
|
|
69
|
+
"import": "./dist/menu/index.js"
|
|
70
|
+
},
|
|
71
|
+
"./popover": {
|
|
72
|
+
"types": "./dist/popover/index.d.ts",
|
|
73
|
+
"import": "./dist/popover/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./progress": {
|
|
76
|
+
"types": "./dist/progress/index.d.ts",
|
|
77
|
+
"import": "./dist/progress/index.js"
|
|
78
|
+
},
|
|
79
|
+
"./select": {
|
|
80
|
+
"types": "./dist/select/index.d.ts",
|
|
81
|
+
"import": "./dist/select/index.js"
|
|
82
|
+
},
|
|
83
|
+
"./switch": {
|
|
84
|
+
"types": "./dist/switch/index.d.ts",
|
|
85
|
+
"import": "./dist/switch/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./tabs": {
|
|
88
|
+
"types": "./dist/tabs/index.d.ts",
|
|
89
|
+
"import": "./dist/tabs/index.js"
|
|
90
|
+
},
|
|
47
91
|
"./css/alert": {
|
|
48
92
|
"types": "./dist/alert/alert.css.d.ts",
|
|
49
93
|
"default": "./dist/alert/alert.css"
|
|
@@ -60,10 +104,22 @@
|
|
|
60
104
|
"types": "./dist/card/card.css.d.ts",
|
|
61
105
|
"default": "./dist/card/card.css"
|
|
62
106
|
},
|
|
107
|
+
"./css/checkbox": {
|
|
108
|
+
"types": "./dist/checkbox/checkbox.css.d.ts",
|
|
109
|
+
"default": "./dist/checkbox/checkbox.css"
|
|
110
|
+
},
|
|
111
|
+
"./css/date-input": {
|
|
112
|
+
"types": "./dist/date-input/date-input.css.d.ts",
|
|
113
|
+
"default": "./dist/date-input/date-input.css"
|
|
114
|
+
},
|
|
63
115
|
"./css/dialog": {
|
|
64
116
|
"types": "./dist/dialog/dialog.css.d.ts",
|
|
65
117
|
"default": "./dist/dialog/dialog.css"
|
|
66
118
|
},
|
|
119
|
+
"./css/field": {
|
|
120
|
+
"types": "./dist/field/field.css.d.ts",
|
|
121
|
+
"default": "./dist/field/field.css"
|
|
122
|
+
},
|
|
67
123
|
"./css/icon": {
|
|
68
124
|
"types": "./dist/icon/icon.css.d.ts",
|
|
69
125
|
"default": "./dist/icon/icon.css"
|
|
@@ -76,6 +132,10 @@
|
|
|
76
132
|
"types": "./dist/menu/menu.css.d.ts",
|
|
77
133
|
"default": "./dist/menu/menu.css"
|
|
78
134
|
},
|
|
135
|
+
"./css/popover": {
|
|
136
|
+
"types": "./dist/popover/popover.css.d.ts",
|
|
137
|
+
"default": "./dist/popover/popover.css"
|
|
138
|
+
},
|
|
79
139
|
"./css/progress": {
|
|
80
140
|
"types": "./dist/progress/progress.css.d.ts",
|
|
81
141
|
"default": "./dist/progress/progress.css"
|
|
@@ -88,45 +148,9 @@
|
|
|
88
148
|
"types": "./dist/switch/switch.css.d.ts",
|
|
89
149
|
"default": "./dist/switch/switch.css"
|
|
90
150
|
},
|
|
91
|
-
"./css/field": {
|
|
92
|
-
"types": "./dist/field/field.css.d.ts",
|
|
93
|
-
"default": "./dist/field/field.css"
|
|
94
|
-
},
|
|
95
151
|
"./css/tabs": {
|
|
96
152
|
"types": "./dist/tabs/tabs.css.d.ts",
|
|
97
153
|
"default": "./dist/tabs/tabs.css"
|
|
98
|
-
},
|
|
99
|
-
"./icon": {
|
|
100
|
-
"types": "./dist/icon/index.d.ts",
|
|
101
|
-
"import": "./dist/icon/index.js"
|
|
102
|
-
},
|
|
103
|
-
"./illustration": {
|
|
104
|
-
"types": "./dist/illustration/index.d.ts",
|
|
105
|
-
"import": "./dist/illustration/index.js"
|
|
106
|
-
},
|
|
107
|
-
"./menu": {
|
|
108
|
-
"types": "./dist/menu/index.d.ts",
|
|
109
|
-
"import": "./dist/menu/index.js"
|
|
110
|
-
},
|
|
111
|
-
"./progress": {
|
|
112
|
-
"types": "./dist/progress/index.d.ts",
|
|
113
|
-
"import": "./dist/progress/index.js"
|
|
114
|
-
},
|
|
115
|
-
"./select": {
|
|
116
|
-
"types": "./dist/select/index.d.ts",
|
|
117
|
-
"import": "./dist/select/index.js"
|
|
118
|
-
},
|
|
119
|
-
"./switch": {
|
|
120
|
-
"types": "./dist/switch/index.d.ts",
|
|
121
|
-
"import": "./dist/switch/index.js"
|
|
122
|
-
},
|
|
123
|
-
"./field": {
|
|
124
|
-
"types": "./dist/field/index.d.ts",
|
|
125
|
-
"import": "./dist/field/index.js"
|
|
126
|
-
},
|
|
127
|
-
"./tabs": {
|
|
128
|
-
"types": "./dist/tabs/index.d.ts",
|
|
129
|
-
"import": "./dist/tabs/index.js"
|
|
130
154
|
}
|
|
131
155
|
},
|
|
132
156
|
"scripts": {
|
|
@@ -138,7 +162,8 @@
|
|
|
138
162
|
"typecheck": "tsc --noEmit"
|
|
139
163
|
},
|
|
140
164
|
"dependencies": {
|
|
141
|
-
"@ark-ui/react": "^5.39.2"
|
|
165
|
+
"@ark-ui/react": "^5.39.2",
|
|
166
|
+
"@internationalized/date": "^3.12.4"
|
|
142
167
|
},
|
|
143
168
|
"peerDependencies": {
|
|
144
169
|
"react": "^19.0.0",
|
|
@@ -146,7 +171,7 @@
|
|
|
146
171
|
},
|
|
147
172
|
"devDependencies": {
|
|
148
173
|
"@manakind/ds-config": "*",
|
|
149
|
-
"@manakind/manuia-tokens": "0.
|
|
174
|
+
"@manakind/manuia-tokens": "0.11.0",
|
|
150
175
|
"@testing-library/jest-dom": "^6.9.1",
|
|
151
176
|
"@testing-library/react": "^16.3.2",
|
|
152
177
|
"@testing-library/user-event": "^14.6.1",
|