@manakind/ui-core 0.14.0 → 0.16.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/README.md +4 -2
- package/dist/button/button.css +16 -10
- package/dist/button/button.d.ts +3 -2
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +4 -4
- package/dist/button/button.js.map +1 -1
- package/dist/button/icon-button.d.ts +6 -1
- package/dist/button/icon-button.d.ts.map +1 -1
- package/dist/button/icon-button.js.map +1 -1
- package/dist/calendar/calendar.css +153 -0
- package/dist/calendar/calendar.css.d.ts +2 -0
- package/dist/calendar/calendar.d.ts +115 -0
- package/dist/calendar/calendar.d.ts.map +1 -0
- package/dist/calendar/calendar.js +112 -0
- package/dist/calendar/calendar.js.map +1 -0
- package/dist/calendar/index.d.ts +2 -0
- package/dist/calendar/index.d.ts.map +1 -0
- package/dist/calendar/index.js +2 -0
- package/dist/calendar/index.js.map +1 -0
- package/dist/date-input/date-input.d.ts.map +1 -1
- package/dist/date-input/date-input.js +2 -12
- package/dist/date-input/date-input.js.map +1 -1
- package/dist/fallback-glyphs.d.ts +1 -0
- package/dist/fallback-glyphs.d.ts.map +1 -1
- package/dist/fallback-glyphs.js +2 -0
- package/dist/fallback-glyphs.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/iso-date.d.ts +10 -0
- package/dist/iso-date.d.ts.map +1 -0
- package/dist/iso-date.js +17 -0
- package/dist/iso-date.js.map +1 -0
- package/dist/menu/index.d.ts +2 -2
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +1 -1
- package/dist/menu/index.js.map +1 -1
- package/dist/menu/menu.css +53 -0
- package/dist/menu/menu.d.ts +32 -1
- package/dist/menu/menu.d.ts.map +1 -1
- package/dist/menu/menu.js +23 -1
- package/dist/menu/menu.js.map +1 -1
- package/dist/popover/popover.d.ts +8 -1
- package/dist/popover/popover.d.ts.map +1 -1
- package/dist/popover/popover.js +2 -2
- package/dist/popover/popover.js.map +1 -1
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -56,15 +56,16 @@ separately, so an app can load only what it renders.
|
|
|
56
56
|
|
|
57
57
|
| Entry | Contents |
|
|
58
58
|
|---|---|
|
|
59
|
-
| `@manakind/ui-core` | Everything below, plus every prop type, the `cx` helper, and the built-in fallback glyphs (`FallbackChevronRight`, `FallbackCheck`, `FallbackCross`) for compositions that want the same defaults |
|
|
59
|
+
| `@manakind/ui-core` | Everything below, plus every prop type, the `cx` helper, and the built-in fallback glyphs (`FallbackChevronLeft`, `FallbackChevronRight`, `FallbackCheck`, `FallbackCross`) for compositions that want the same defaults |
|
|
60
60
|
| `@manakind/ui-core/alert` | `Alert` |
|
|
61
61
|
| `@manakind/ui-core/badge` | `Badge` |
|
|
62
62
|
| `@manakind/ui-core/button` | `Button` + `IconButton` |
|
|
63
|
+
| `@manakind/ui-core/calendar` | `Calendar` |
|
|
63
64
|
| `@manakind/ui-core/card` | `Card`, `CardHeader`, `CardTitle`, `CardLink`, `CardDescription`, `CardContent`, `CardFooter` |
|
|
64
65
|
| `@manakind/ui-core/dialog` | `Dialog` + `DialogClose` |
|
|
65
66
|
| `@manakind/ui-core/icon` | `Icon` |
|
|
66
67
|
| `@manakind/ui-core/illustration` | `Illustration` + `illustrationPaint` |
|
|
67
|
-
| `@manakind/ui-core/menu` | `Menu` |
|
|
68
|
+
| `@manakind/ui-core/menu` | `Menu`, `MenuTrigger` |
|
|
68
69
|
| `@manakind/ui-core/popover` | `Popover` |
|
|
69
70
|
| `@manakind/ui-core/checkbox` | `Checkbox` |
|
|
70
71
|
| `@manakind/ui-core/date-input` | `DateInput` |
|
|
@@ -77,6 +78,7 @@ separately, so an app can load only what it renders.
|
|
|
77
78
|
| `@manakind/ui-core/css/alert` | Alert structural CSS; its icon also needs `css/icon` |
|
|
78
79
|
| `@manakind/ui-core/css/badge` | Badge structural CSS |
|
|
79
80
|
| `@manakind/ui-core/css/button` | Button + IconButton structural CSS |
|
|
81
|
+
| `@manakind/ui-core/css/calendar` | Calendar structural CSS; its paging buttons also need `css/button` and `css/icon` |
|
|
80
82
|
| `@manakind/ui-core/css/card` | Card structural CSS |
|
|
81
83
|
| `@manakind/ui-core/css/dialog` | Dialog structural CSS; its close button also needs `css/button` and `css/icon` |
|
|
82
84
|
| `@manakind/ui-core/css/icon` | Icon structural CSS |
|
package/dist/button/button.css
CHANGED
|
@@ -128,29 +128,35 @@
|
|
|
128
128
|
|
|
129
129
|
&.ds-button--icon-only {
|
|
130
130
|
aspect-ratio: 1;
|
|
131
|
+
padding: 0;
|
|
131
132
|
|
|
132
133
|
/*
|
|
133
134
|
* A circle at every size, rather than inheriting the button radius.
|
|
134
|
-
* `--ds-button-radius` is a fixed 16px while icon buttons are 32/
|
|
135
|
-
* square, so 16px
|
|
136
|
-
* above it — the shape
|
|
137
|
-
* the size grew. A percentage tracks the box instead of fighting it.
|
|
135
|
+
* `--ds-button-radius` is a fixed 16px while icon buttons are 32/40/48px
|
|
136
|
+
* square, so 16px would be exactly half at `sm` and less than half
|
|
137
|
+
* above it — the shape would drift from a circle to a rounded rectangle
|
|
138
|
+
* as the size grew. A percentage tracks the box instead of fighting it.
|
|
138
139
|
*/
|
|
139
140
|
border-radius: 50%;
|
|
140
141
|
|
|
142
|
+
/*
|
|
143
|
+
* The square is its own ramp, not the text button's height: the icon
|
|
144
|
+
* is the label, so it takes the icon scale's step for the size and the
|
|
145
|
+
* square keeps the same inset around it at every size.
|
|
146
|
+
*/
|
|
141
147
|
&.ds-button--sm {
|
|
142
|
-
|
|
143
|
-
min-width: var(--ds-button-size-sm-
|
|
148
|
+
min-height: var(--ds-button-size-sm-icon-only-size);
|
|
149
|
+
min-width: var(--ds-button-size-sm-icon-only-size);
|
|
144
150
|
}
|
|
145
151
|
|
|
146
152
|
&.ds-button--md {
|
|
147
|
-
|
|
148
|
-
min-width: var(--ds-button-size-md-
|
|
153
|
+
min-height: var(--ds-button-size-md-icon-only-size);
|
|
154
|
+
min-width: var(--ds-button-size-md-icon-only-size);
|
|
149
155
|
}
|
|
150
156
|
|
|
151
157
|
&.ds-button--lg {
|
|
152
|
-
|
|
153
|
-
min-width: var(--ds-button-size-lg-
|
|
158
|
+
min-height: var(--ds-button-size-lg-icon-only-size);
|
|
159
|
+
min-width: var(--ds-button-size-lg-icon-only-size);
|
|
154
160
|
}
|
|
155
161
|
}
|
|
156
162
|
|
package/dist/button/button.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ interface ButtonOwnProps {
|
|
|
12
12
|
/**
|
|
13
13
|
* Decorative icon rendered before the label.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* The icon sits beside text, so it is always the `sm` step of the icon
|
|
16
|
+
* scale whatever the button size, and it inherits the button's text
|
|
17
|
+
* color via `currentColor`. The icon is
|
|
17
18
|
* always rendered as decorative — the accessible name comes from the
|
|
18
19
|
* button's children.
|
|
19
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EACL,KAAK,cAAc,EAInB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AAGtB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,CAAC;AAC5E,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,UAAU,cAAc;IACtB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,mBAAmB;IACnB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB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G,mBAAmB,GAAG,kBAAkB,CAAC;AAuFnE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CAExC"}
|
package/dist/button/button.js
CHANGED
|
@@ -4,8 +4,8 @@ import { cloneElement, Fragment, isValidElement, } from 'react';
|
|
|
4
4
|
import { Icon } from '../icon/icon';
|
|
5
5
|
import './button.css';
|
|
6
6
|
import { cx } from '../cx';
|
|
7
|
-
function ButtonContent({
|
|
8
|
-
return (_jsxs(_Fragment, { children: [loading && _jsx("span", { className: "ds-button__spinner", "aria-hidden": "true" }), leadingIcon && (_jsx(Icon, { source: leadingIcon, size:
|
|
7
|
+
function ButtonContent({ loading, leadingIcon, trailingIcon, children }) {
|
|
8
|
+
return (_jsxs(_Fragment, { children: [loading && _jsx("span", { className: "ds-button__spinner", "aria-hidden": "true" }), leadingIcon && (_jsx(Icon, { source: leadingIcon, size: "sm", decorative: true, className: "ds-button__icon ds-button__icon--leading" })), _jsx("span", { className: "ds-button__label", children: children }), trailingIcon && (_jsx(Icon, { source: trailingIcon, size: "sm", decorative: true, className: "ds-button__icon ds-button__icon--trailing" }))] }));
|
|
9
9
|
}
|
|
10
10
|
function classesFor(variant, size, className) {
|
|
11
11
|
return cx('ds-button', `ds-button--${variant}`, `ds-button--${size}`, className);
|
|
@@ -14,11 +14,11 @@ function ButtonAsChild({ variant = 'primary', size = 'md', leadingIcon, trailing
|
|
|
14
14
|
if (!isValidElement(children) || children.type === Fragment) {
|
|
15
15
|
throw new Error('Button asChild needs exactly one element as its child, such as <a> or a router link.');
|
|
16
16
|
}
|
|
17
|
-
const content = (_jsx(ButtonContent, {
|
|
17
|
+
const content = (_jsx(ButtonContent, { loading: false, leadingIcon: leadingIcon, trailingIcon: trailingIcon, children: children.props.children }));
|
|
18
18
|
return cloneElement(children, { className: cx(classesFor(variant, size, className), children.props.className) }, content);
|
|
19
19
|
}
|
|
20
20
|
function ButtonAsButton({ variant = 'primary', size = 'md', loading = false, disabled, leadingIcon, trailingIcon, className, children, ...props }) {
|
|
21
|
-
return (_jsx(ark.button, { disabled: disabled || loading, className: cx(classesFor(variant, size, className), loading && 'ds-button--loading'), ...props, children: _jsx(ButtonContent, {
|
|
21
|
+
return (_jsx(ark.button, { disabled: disabled || loading, className: cx(classesFor(variant, size, className), loading && 'ds-button--loading'), ...props, children: _jsx(ButtonContent, { loading: loading, leadingIcon: leadingIcon, trailingIcon: trailingIcon, children: children }) }));
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Shared base button for the Manakind design system.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAEL,YAAY,EACZ,QAAQ,EACR,cAAc,GAGf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAoE3B,SAAS,aAAa,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAEL,YAAY,EACZ,QAAQ,EACR,cAAc,GAGf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AACrD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAoE3B,SAAS,aAAa,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAsB;IACzF,OAAO,CACL,8BACG,OAAO,IAAI,eAAM,SAAS,EAAC,oBAAoB,iBAAa,MAAM,GAAG,EACrE,WAAW,IAAI,CAC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QAAQ,EACR,WAAW,EACX,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACY;IACpB,OAAO,CACL,KAAC,GAAG,CAAC,MAAM,IACT,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAC7B,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,OAAO,IAAI,oBAAoB,CAAC,KAChF,KAAK,YAET,KAAC,aAAa,IAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,YAClF,QAAQ,GACK,GACL,CACd,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAC,aAAa,OAAK,KAAK,GAAI,CAAC,CAAC,CAAC,KAAC,cAAc,OAAK,KAAK,GAAI,CAAC;AACtF,CAAC"}
|
|
@@ -13,7 +13,12 @@ export interface IconButtonProps extends Omit<ComponentProps<typeof ark.button>,
|
|
|
13
13
|
'aria-label': string;
|
|
14
14
|
/** Visual style variant. Shared with {@link Button}. */
|
|
15
15
|
variant?: ButtonVariant;
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Size preset. The icon is the label, so it takes the icon scale's step of
|
|
18
|
+
* the same name (16 / 24 / 32px) and the circle keeps the same inset around
|
|
19
|
+
* it (32 / 40 / 48px). The circle is taller than a text `Button` of the
|
|
20
|
+
* same size from `md` up.
|
|
21
|
+
*/
|
|
17
22
|
size?: ButtonSize;
|
|
18
23
|
/** Show loading spinner and disable interaction. */
|
|
19
24
|
loading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../src/button/icon-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC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,EACzB,IAAI,EACJ,OAAmB,EACnB,IAAW,EACX,OAAe,EACf,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,eAAe,2CAkBjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../src/button/icon-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAErD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../src/button/icon-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAErD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAwB3B;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,KAAK,EACf,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACQ;IAChB,OAAO,CACL,MAAC,GAAG,CAAC,MAAM,IACT,QAAQ,EAAE,QAAQ,IAAI,OAAO,EAC7B,SAAS,EAAE,EAAE,CACX,WAAW,EACX,sBAAsB,EACtB,cAAc,OAAO,EAAE,EACvB,cAAc,IAAI,EAAE,EACpB,OAAO,IAAI,oBAAoB,EAC/B,SAAS,CACV,KACG,KAAK,aAER,OAAO,IAAI,eAAM,SAAS,EAAC,oBAAoB,iBAAa,MAAM,GAAG,EACtE,KAAC,IAAI,IAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,QAAC,SAAS,EAAC,iBAAiB,GAAG,IAC9D,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-calendar {
|
|
3
|
+
display: inline-block;
|
|
4
|
+
max-width: 100%;
|
|
5
|
+
overflow-wrap: anywhere;
|
|
6
|
+
color: var(--ds-calendar-day-text);
|
|
7
|
+
|
|
8
|
+
&[data-disabled] {
|
|
9
|
+
opacity: var(--ds-opacity-disabled);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
& .ds-calendar__content {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: var(--ds-calendar-gap);
|
|
16
|
+
outline: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* A grid rather than a flex row: the heading must stay between its two
|
|
21
|
+
* buttons on one line, and a word too long for it breaks inside its own
|
|
22
|
+
* column instead of squeezing the buttons.
|
|
23
|
+
*/
|
|
24
|
+
& .ds-calendar__header {
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: var(--ds-calendar-gap);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
& .ds-calendar__heading {
|
|
32
|
+
min-width: 0;
|
|
33
|
+
color: var(--ds-calendar-header-text);
|
|
34
|
+
font-size: var(--ds-calendar-header-font-size);
|
|
35
|
+
font-weight: var(--ds-calendar-header-font-weight);
|
|
36
|
+
text-align: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
& .ds-calendar__table {
|
|
40
|
+
border-collapse: separate;
|
|
41
|
+
border-spacing: 0;
|
|
42
|
+
table-layout: fixed;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
& .ds-calendar__weekday {
|
|
46
|
+
box-sizing: border-box;
|
|
47
|
+
width: var(--ds-calendar-day-size);
|
|
48
|
+
padding: 0 0 var(--ds-calendar-day-padding);
|
|
49
|
+
color: var(--ds-calendar-weekday-text);
|
|
50
|
+
font-size: var(--ds-calendar-weekday-font-size);
|
|
51
|
+
font-weight: var(--ds-calendar-weekday-font-weight);
|
|
52
|
+
text-align: center;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
* The band between a range's two ends is drawn on the cells, edge to
|
|
57
|
+
* edge, so it reads as one stretch under the day fills; it rounds off
|
|
58
|
+
* at the ends of the range, at the ends of a hover preview, and at the
|
|
59
|
+
* ends of each row.
|
|
60
|
+
*/
|
|
61
|
+
& .ds-calendar__cell {
|
|
62
|
+
padding: 0;
|
|
63
|
+
|
|
64
|
+
&:has(.ds-calendar__day[data-in-range]) {
|
|
65
|
+
background-color: var(--ds-calendar-day-bg-range);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:first-child,
|
|
69
|
+
&:has([data-range-start]),
|
|
70
|
+
&:has([data-hover-range-start]) {
|
|
71
|
+
border-start-start-radius: var(--ds-calendar-day-radius);
|
|
72
|
+
border-end-start-radius: var(--ds-calendar-day-radius);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&:last-child,
|
|
76
|
+
&:has([data-range-end]),
|
|
77
|
+
&:has([data-hover-range-end]) {
|
|
78
|
+
border-start-end-radius: var(--ds-calendar-day-radius);
|
|
79
|
+
border-end-end-radius: var(--ds-calendar-day-radius);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/*
|
|
84
|
+
* The whole cell is the target; the fill sits inside it by the cell's
|
|
85
|
+
* padding. A focus ring (2px, 3px out) around the fill ends inside the
|
|
86
|
+
* neighbouring cell's padding, so it never crosses a chosen day's fill,
|
|
87
|
+
* where the products' rings would vanish.
|
|
88
|
+
*/
|
|
89
|
+
& .ds-calendar__day {
|
|
90
|
+
display: flex;
|
|
91
|
+
box-sizing: border-box;
|
|
92
|
+
width: var(--ds-calendar-day-size);
|
|
93
|
+
height: var(--ds-calendar-day-size);
|
|
94
|
+
padding: var(--ds-calendar-day-padding);
|
|
95
|
+
font-size: var(--ds-calendar-day-font-size);
|
|
96
|
+
font-variant-numeric: tabular-nums;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
outline: none;
|
|
99
|
+
user-select: none;
|
|
100
|
+
|
|
101
|
+
&[data-outside-range] {
|
|
102
|
+
color: var(--ds-calendar-day-text-outside);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&[data-in-range] {
|
|
106
|
+
color: var(--ds-calendar-day-text-range);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&[data-disabled] {
|
|
110
|
+
cursor: default;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&:not([data-disabled]) .ds-calendar__day[data-disabled] {
|
|
115
|
+
opacity: var(--ds-opacity-disabled);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&[data-readonly] .ds-calendar__day {
|
|
119
|
+
cursor: default;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
& .ds-calendar__day-fill {
|
|
123
|
+
display: flex;
|
|
124
|
+
flex: 1;
|
|
125
|
+
align-items: center;
|
|
126
|
+
justify-content: center;
|
|
127
|
+
box-sizing: border-box;
|
|
128
|
+
border-radius: var(--ds-calendar-day-radius);
|
|
129
|
+
transition: background-color 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&:not([data-readonly])
|
|
133
|
+
.ds-calendar__day:hover:not([data-disabled], [data-selected])
|
|
134
|
+
.ds-calendar__day-fill {
|
|
135
|
+
background-color: var(--ds-calendar-day-bg-hover);
|
|
136
|
+
color: var(--ds-calendar-day-text);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
& .ds-calendar__day[data-today] .ds-calendar__day-fill {
|
|
140
|
+
box-shadow: 0 0 0 1px var(--ds-calendar-day-border-today);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
& .ds-calendar__day[data-selected] .ds-calendar__day-fill {
|
|
144
|
+
background-color: var(--ds-calendar-day-bg-selected);
|
|
145
|
+
color: var(--ds-calendar-day-text-selected);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
& .ds-calendar__day:focus-visible .ds-calendar__day-fill {
|
|
149
|
+
outline: 2px solid var(--ds-calendar-focus-ring);
|
|
150
|
+
outline-offset: 3px;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import './calendar.css';
|
|
2
|
+
import type { IconSource } from '../icon/icon';
|
|
3
|
+
/**
|
|
4
|
+
* A stretch of days. Both ends are ISO calendar dates, `YYYY-MM-DD`; `end`
|
|
5
|
+
* is `null` while only the first day is chosen.
|
|
6
|
+
*/
|
|
7
|
+
export interface CalendarRange {
|
|
8
|
+
start: string;
|
|
9
|
+
end: string | null;
|
|
10
|
+
}
|
|
11
|
+
/** A day of the week as `Date#getDay()` counts them: 0 is Sunday, 1 is Monday. */
|
|
12
|
+
export type CalendarWeekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
13
|
+
interface CalendarCommonProps {
|
|
14
|
+
/**
|
|
15
|
+
* The calendar's name, saying which day is being chosen: "Scheduled day",
|
|
16
|
+
* "Target date". A calendar has no label of its own, and the month heading
|
|
17
|
+
* changes as the user pages.
|
|
18
|
+
*/
|
|
19
|
+
'aria-label': string;
|
|
20
|
+
/**
|
|
21
|
+
* BCP 47 tag that decides the month and weekday names and, unless
|
|
22
|
+
* `startOfWeek` says otherwise, the first day of the week. Defaults to
|
|
23
|
+
* `en-GB`: English names, Monday first. The products' own date format is
|
|
24
|
+
* not involved; the grid shows day numbers only.
|
|
25
|
+
*/
|
|
26
|
+
locale?: string;
|
|
27
|
+
/** The first column, `0` for Sunday through `6` for Saturday. Defaults to the locale's. */
|
|
28
|
+
startOfWeek?: CalendarWeekday;
|
|
29
|
+
/**
|
|
30
|
+
* The earliest day that can be chosen, `YYYY-MM-DD`. Earlier days are
|
|
31
|
+
* shown but cannot be chosen; a value outside the window is still shown
|
|
32
|
+
* as the value.
|
|
33
|
+
*/
|
|
34
|
+
min?: string;
|
|
35
|
+
/** The latest day that can be chosen, `YYYY-MM-DD`. */
|
|
36
|
+
max?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Any day of the month shown first when nothing is chosen yet,
|
|
39
|
+
* `YYYY-MM-DD`. Defaults to the month of the chosen day, else this month.
|
|
40
|
+
*/
|
|
41
|
+
defaultMonth?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Moves focus to the chosen day (else the first day shown by
|
|
44
|
+
* `defaultMonth`, else today) once the calendar is in the page. For a calendar opened in a popover, so
|
|
45
|
+
* the arrow keys work at once and a screen reader lands on a day.
|
|
46
|
+
*/
|
|
47
|
+
autoFocus?: boolean;
|
|
48
|
+
/** Dims the calendar; nothing in it can be focused or chosen. */
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/** Shows the days and the choice, pages freely, but lets nothing be chosen. */
|
|
51
|
+
readOnly?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Glyph for the "previous month" button. Defaults to a plain built-in
|
|
54
|
+
* chevron so `@manakind/ui-core` renders on its own; products pass their
|
|
55
|
+
* own icon set.
|
|
56
|
+
*/
|
|
57
|
+
previousIcon?: IconSource;
|
|
58
|
+
/** Glyph for the "next month" button. Same defaulting rule as {@link CalendarCommonProps.previousIcon}. */
|
|
59
|
+
nextIcon?: IconSource;
|
|
60
|
+
/** Extra class names appended after `ds-calendar`. */
|
|
61
|
+
className?: string;
|
|
62
|
+
}
|
|
63
|
+
interface CalendarSingleProps {
|
|
64
|
+
/** One day at a time. The default. */
|
|
65
|
+
selectionMode?: 'single';
|
|
66
|
+
/** The chosen day, `YYYY-MM-DD`, or `null` for none. Leave undefined to let the calendar own it. */
|
|
67
|
+
value?: string | null;
|
|
68
|
+
/** The day chosen at first when uncontrolled, or `null` for none. */
|
|
69
|
+
defaultValue?: string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Fired with the ISO date of the day the user chose. Choosing the chosen
|
|
72
|
+
* day again fires nothing, and the calendar never clears: a product that
|
|
73
|
+
* lets the user unschedule does it with a control of its own.
|
|
74
|
+
*/
|
|
75
|
+
onValueChange?: (value: string) => void;
|
|
76
|
+
}
|
|
77
|
+
interface CalendarRangeProps {
|
|
78
|
+
/**
|
|
79
|
+
* A first and a last day. The first click chooses the first day and fires
|
|
80
|
+
* with `end: null`; the second click chooses the last day, in either
|
|
81
|
+
* order, and fires with both; a third click starts a new range.
|
|
82
|
+
*/
|
|
83
|
+
selectionMode: 'range';
|
|
84
|
+
/** The chosen range, or `null` for none. Leave undefined to let the calendar own it. */
|
|
85
|
+
value?: CalendarRange | null;
|
|
86
|
+
/** The range chosen at first when uncontrolled, or `null` for none. */
|
|
87
|
+
defaultValue?: CalendarRange | null;
|
|
88
|
+
/** Fired with the range so far: `end` is `null` after the first click of a new range. */
|
|
89
|
+
onValueChange?: (value: CalendarRange) => void;
|
|
90
|
+
}
|
|
91
|
+
type CalendarSelection = CalendarSingleProps | CalendarRangeProps;
|
|
92
|
+
export type CalendarProps = CalendarCommonProps & CalendarSelection;
|
|
93
|
+
/**
|
|
94
|
+
* A month of days to choose from, built on Ark UI's DatePicker.
|
|
95
|
+
*
|
|
96
|
+
* The grid shows one month at a time with the weekdays across the top and
|
|
97
|
+
* a button pair to turn the page; the days of the neighbouring months fill
|
|
98
|
+
* the first and last rows, and every month has six rows, so the calendar
|
|
99
|
+
* keeps its height as the user pages. One day is chosen at a time, or a
|
|
100
|
+
* first and a last day with `selectionMode="range"`. The value in and out is
|
|
101
|
+
* an ISO calendar date, `YYYY-MM-DD`, as `DateInput` gives: a string a form
|
|
102
|
+
* library and a database both keep as is, with no time zone to get wrong.
|
|
103
|
+
*
|
|
104
|
+
* It is the grid alone. A product puts it in a `Popover` behind a button
|
|
105
|
+
* that shows the choice, or in the page, and gives it `aria-label`; the
|
|
106
|
+
* labels the grid speaks ("Choose Wednesday 12 June 2024", "Previous month")
|
|
107
|
+
* are English, as Ark's are.
|
|
108
|
+
*
|
|
109
|
+
* ```tsx
|
|
110
|
+
* <Calendar aria-label="Scheduled day" value={day} onValueChange={setDay} autoFocus />
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export declare function Calendar({ 'aria-label': ariaLabel, locale, startOfWeek, min, max, defaultMonth, autoFocus, disabled, readOnly, previousIcon, nextIcon, className, ...selection }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
114
|
+
export {};
|
|
115
|
+
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/calendar/calendar.tsx"],"names":[],"mappings":"AAGA,OAAO,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,kFAAkF;AAClF,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAExD,UAAU,mBAAmB;IAC3B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2FAA2F;IAC3F,WAAW,CAAC,EAAE,eAAe,CAAC;IAC9B;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+EAA+E;IAC/E,QAAQ,CAAC,EA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icker as ArkDatePicker } from '@ark-ui/react/date-picker';
|
|
3
|
+
import { getLocalTimeZone, today } from '@internationalized/date';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import './calendar.css';
|
|
6
|
+
import { IconButton } from '../button/icon-button';
|
|
7
|
+
import { cx } from '../cx';
|
|
8
|
+
import { ChevronLeft, ChevronRight } from '../fallback-glyphs';
|
|
9
|
+
import { parseIsoDate } from '../iso-date';
|
|
10
|
+
const parseIso = (iso, prop) => parseIsoDate(iso, `Calendar: ${prop}`);
|
|
11
|
+
const parseOptional = (iso, prop) => iso === undefined ? undefined : parseIso(iso, prop);
|
|
12
|
+
/*
|
|
13
|
+
* Zag keeps every selection as a list of dates: one for a day, up to two
|
|
14
|
+
* for a range. The product's typed shape is folded into that list on the
|
|
15
|
+
* way in and rebuilt on the way out.
|
|
16
|
+
*/
|
|
17
|
+
function toDateValues(selection, prop) {
|
|
18
|
+
const given = selection[prop];
|
|
19
|
+
if (given === undefined)
|
|
20
|
+
return undefined;
|
|
21
|
+
if (given === null)
|
|
22
|
+
return [];
|
|
23
|
+
if (typeof given === 'string')
|
|
24
|
+
return [parseIso(given, prop)];
|
|
25
|
+
const dates = [parseIso(given.start, `${prop}.start`)];
|
|
26
|
+
if (given.end !== null)
|
|
27
|
+
dates.push(parseIso(given.end, `${prop}.end`));
|
|
28
|
+
return dates;
|
|
29
|
+
}
|
|
30
|
+
/*
|
|
31
|
+
* Zag's list can be sparse: a range cleared from outside between its two
|
|
32
|
+
* clicks keeps Zag waiting for an end date, and the next click lands at
|
|
33
|
+
* index 1 of an empty list. The dates that are there are the selection.
|
|
34
|
+
*/
|
|
35
|
+
function report(selection, dates) {
|
|
36
|
+
const [start, end] = dates.filter((date) => date !== undefined);
|
|
37
|
+
if (!start)
|
|
38
|
+
return;
|
|
39
|
+
if (selection.selectionMode === 'range') {
|
|
40
|
+
selection.onValueChange?.({ start: start.toString(), end: end?.toString() ?? null });
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
selection.onValueChange?.(start.toString());
|
|
44
|
+
}
|
|
45
|
+
/*
|
|
46
|
+
* The day Zag's keyboard focus and the shown month follow. Zag moves it on
|
|
47
|
+
* its own events only, so a value the parent changes to another month
|
|
48
|
+
* would leave the grid on the old one: the calendar owns it, and moves it
|
|
49
|
+
* to the chosen day whenever the parent chooses a new one.
|
|
50
|
+
*/
|
|
51
|
+
function useFocusedDay(chosen, fallback) {
|
|
52
|
+
const chosenKey = chosen?.toString();
|
|
53
|
+
const [focused, setFocused] = useState(() => ({
|
|
54
|
+
key: chosenKey,
|
|
55
|
+
day: chosen ?? fallback ?? today(getLocalTimeZone()),
|
|
56
|
+
}));
|
|
57
|
+
if (chosenKey !== focused.key) {
|
|
58
|
+
setFocused({ key: chosenKey, day: chosen ?? focused.day });
|
|
59
|
+
}
|
|
60
|
+
const setDay = (day) => setFocused((state) => ({ ...state, day }));
|
|
61
|
+
return [focused.day, setDay];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A month of days to choose from, built on Ark UI's DatePicker.
|
|
65
|
+
*
|
|
66
|
+
* The grid shows one month at a time with the weekdays across the top and
|
|
67
|
+
* a button pair to turn the page; the days of the neighbouring months fill
|
|
68
|
+
* the first and last rows, and every month has six rows, so the calendar
|
|
69
|
+
* keeps its height as the user pages. One day is chosen at a time, or a
|
|
70
|
+
* first and a last day with `selectionMode="range"`. The value in and out is
|
|
71
|
+
* an ISO calendar date, `YYYY-MM-DD`, as `DateInput` gives: a string a form
|
|
72
|
+
* library and a database both keep as is, with no time zone to get wrong.
|
|
73
|
+
*
|
|
74
|
+
* It is the grid alone. A product puts it in a `Popover` behind a button
|
|
75
|
+
* that shows the choice, or in the page, and gives it `aria-label`; the
|
|
76
|
+
* labels the grid speaks ("Choose Wednesday 12 June 2024", "Previous month")
|
|
77
|
+
* are English, as Ark's are.
|
|
78
|
+
*
|
|
79
|
+
* ```tsx
|
|
80
|
+
* <Calendar aria-label="Scheduled day" value={day} onValueChange={setDay} autoFocus />
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export function Calendar({ 'aria-label': ariaLabel, locale = 'en-GB', startOfWeek, min, max, defaultMonth, autoFocus = false, disabled, readOnly, previousIcon = ChevronLeft, nextIcon = ChevronRight, className, ...selection }) {
|
|
84
|
+
const rootRef = useRef(null);
|
|
85
|
+
const controlledDates = toDateValues(selection, 'value');
|
|
86
|
+
const initialDates = toDateValues(selection, 'defaultValue');
|
|
87
|
+
const [focusedDay, setFocusedDay] = useFocusedDay(controlledDates?.[0] ?? initialDates?.[0], parseOptional(defaultMonth, 'defaultMonth'));
|
|
88
|
+
const minDate = parseOptional(min, 'min');
|
|
89
|
+
const maxDate = parseOptional(max, 'max');
|
|
90
|
+
/*
|
|
91
|
+
* Passed as unavailable days rather than Zag's own `min`/`max`, which clamp
|
|
92
|
+
* a value outside them to the nearest allowed day and show that day as
|
|
93
|
+
* chosen while the parent holds another. Unavailable days are disabled and
|
|
94
|
+
* cannot be chosen, and a value outside the window stays the value.
|
|
95
|
+
*/
|
|
96
|
+
const isOutsideWindow = (date) => (minDate !== undefined && date.compare(minDate) < 0) ||
|
|
97
|
+
(maxDate !== undefined && date.compare(maxDate) > 0);
|
|
98
|
+
/*
|
|
99
|
+
* Zag gives the focused day `tabindex="0"` and every other day `-1`; the
|
|
100
|
+
* one day in the tab order is the one to land on. An effect, because the
|
|
101
|
+
* focus is the browser's.
|
|
102
|
+
*/
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!autoFocus)
|
|
105
|
+
return;
|
|
106
|
+
rootRef.current
|
|
107
|
+
?.querySelector('[data-part="table-cell-trigger"][tabindex="0"]')
|
|
108
|
+
?.focus({ preventScroll: true });
|
|
109
|
+
}, [autoFocus]);
|
|
110
|
+
return (_jsx(ArkDatePicker.Root, { ref: rootRef, className: cx('ds-calendar', className), inline: true, closeOnSelect: false, fixedWeeks: true, outsideDaySelectable: true, selectionMode: selection.selectionMode ?? 'single', value: controlledDates, defaultValue: initialDates, onValueChange: (details) => report(selection, details.value), focusedValue: focusedDay, onFocusChange: (details) => setFocusedDay(details.focusedValue), isDateUnavailable: minDate || maxDate ? isOutsideWindow : undefined, locale: locale, timeZone: getLocalTimeZone(), startOfWeek: startOfWeek, disabled: disabled, readOnly: readOnly, children: _jsx(ArkDatePicker.Content, { className: "ds-calendar__content", "aria-label": ariaLabel, "aria-disabled": disabled || undefined, children: _jsx(ArkDatePicker.View, { view: "day", children: _jsx(ArkDatePicker.Context, { children: (api) => (_jsxs(_Fragment, { children: [_jsxs(ArkDatePicker.ViewControl, { className: "ds-calendar__header", children: [_jsx(ArkDatePicker.PrevTrigger, { asChild: true, children: _jsx(IconButton, { variant: "tertiary", size: "sm", icon: previousIcon, "aria-label": "Previous month" }) }), _jsx(ArkDatePicker.RangeText, { className: "ds-calendar__heading", "aria-live": "polite" }), _jsx(ArkDatePicker.NextTrigger, { asChild: true, children: _jsx(IconButton, { variant: "tertiary", size: "sm", icon: nextIcon, "aria-label": "Next month" }) })] }), _jsxs(ArkDatePicker.Table, { className: "ds-calendar__table", children: [_jsx(ArkDatePicker.TableHead, { children: _jsx(ArkDatePicker.TableRow, { children: api.weekDays.map((weekDay) => (_jsx(ArkDatePicker.TableHeader, { className: "ds-calendar__weekday", children: weekDay.short }, weekDay.value.toString()))) }) }), _jsx(ArkDatePicker.TableBody, { children: api.weeks.map((week) => (_jsx(ArkDatePicker.TableRow, { children: week.map((day) => (_jsx(ArkDatePicker.TableCell, { value: day, className: "ds-calendar__cell", children: _jsx(ArkDatePicker.TableCellTrigger, { className: "ds-calendar__day", children: _jsx("span", { className: "ds-calendar__day-fill", children: day.day }) }) }, day.toString()))) }, week[0]?.toString()))) })] })] })) }) }) }) }));
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/calendar/calendar.tsx"],"names":[],"mapp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AE,QAAQ,EAAE,CAYvB,CAC1B,CAAC,GACsB,IACN,IACrB,CACJ,GACqB,GACL,GACC,GACL,CACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,GAIT,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-input.d.ts","sourceRoot":"","sources":["../../src/date-input/date-input.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-input.d.ts","sourceRoot":"","sources":["../../src/date-input/date-input.tsx"],"names":[],"mappings":"AAOA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIhD,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;AAgEF;;;;;;;;;;;;;;;;;;;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"}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DateInput as ArkDateInput, useDateInputContext, } from '@ark-ui/react/date-input';
|
|
3
|
-
import { parseDate } from '@internationalized/date';
|
|
4
3
|
import { useEffect, useMemo, useRef } from 'react';
|
|
5
4
|
import './date-input.css';
|
|
6
5
|
import { cx } from '../cx';
|
|
7
6
|
import { useFieldControl } from '../field/use-field-control';
|
|
7
|
+
import { parseIsoDate } from '../iso-date';
|
|
8
8
|
const ENGLISH_PART_NAMES = { day: 'Day', month: 'Month', year: 'Year' };
|
|
9
9
|
/*
|
|
10
10
|
* The value a form submits and `onValueChange` reports. Zag formats it for
|
|
11
11
|
* the locale by default, which is the display, not a date a database keeps.
|
|
12
12
|
*/
|
|
13
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
14
|
const toDateValue = (iso, prop) => {
|
|
20
15
|
if (iso === undefined)
|
|
21
16
|
return undefined;
|
|
22
17
|
if (iso === null || iso === '')
|
|
23
18
|
return [];
|
|
24
|
-
|
|
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
|
-
}
|
|
19
|
+
return [parseIsoDate(iso, `DateInput: ${prop}`)];
|
|
30
20
|
};
|
|
31
21
|
/*
|
|
32
22
|
* A part's key is its type and its rank among parts of that type: the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-input.js","sourceRoot":"","sources":["../../src/date-input/date-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,IAAI,YAAY,EAGzB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"date-input.js","sourceRoot":"","sources":["../../src/date-input/date-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,IAAI,YAAY,EAGzB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAmB,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,MAAM,kBAAkB,GAAkB,EAA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,EACrC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,KAAK,aAEb,KAAC,YAAY,CAAC,OAAO,IACnB,SAAS,EAAC,wBAAwB,EAClC,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,iBAAiB,YAE1B,MAAC,YAAY,CAAC,YAAY,IACxB,SAAS,EAAC,yBAAyB,gBACvB,SAAS,sBACH,KAAK,EAAE,WAAW,aAEpC,KAAC,YAAY,CAAC,OAAO,cAClB,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,GAC/B,EACtB,kBAAkB,IAAI,KAAC,iBAAiB,IAAC,kBAAkB,EAAE,kBAAkB,GAAI,IAC1D,GACP,EACvB,KAAC,YAAY,CAAC,WAAW,KAAG,IACV,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IconSource } from './icon/icon';
|
|
2
2
|
export declare const ChevronRight: IconSource;
|
|
3
|
+
export declare const ChevronLeft: IconSource;
|
|
3
4
|
export declare const Check: IconSource;
|
|
4
5
|
export declare const Cross: IconSource;
|
|
5
6
|
//# sourceMappingURL=fallback-glyphs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallback-glyphs.d.ts","sourceRoot":"","sources":["../src/fallback-glyphs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsB9C,eAAO,MAAM,YAAY,EAAE,UAW1B,CAAC;AAGF,eAAO,MAAM,KAAK,EAAE,UAWnB,CAAC;AAGF,eAAO,MAAM,KAAK,EAAE,UAUnB,CAAC"}
|
|
1
|
+
{"version":3,"file":"fallback-glyphs.d.ts","sourceRoot":"","sources":["../src/fallback-glyphs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsB9C,eAAO,MAAM,YAAY,EAAE,UAW1B,CAAC;AAGF,eAAO,MAAM,WAAW,EAAE,UAWzB,CAAC;AAGF,eAAO,MAAM,KAAK,EAAE,UAWnB,CAAC;AAGF,eAAO,MAAM,KAAK,EAAE,UAUnB,CAAC"}
|
package/dist/fallback-glyphs.js
CHANGED
|
@@ -21,6 +21,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
21
21
|
*/
|
|
22
22
|
export const ChevronRight = (props) => (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", ...props, children: _jsx("path", { d: "m6 4 4 4-4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
23
23
|
ChevronRight.displayName = 'FallbackChevronRight';
|
|
24
|
+
export const ChevronLeft = (props) => (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", ...props, children: _jsx("path", { d: "M10 4 6 8l4 4", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
25
|
+
ChevronLeft.displayName = 'FallbackChevronLeft';
|
|
24
26
|
export const Check = (props) => (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", ...props, children: _jsx("path", { d: "m3.5 8.5 3 3 6-6", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
25
27
|
Check.displayName = 'FallbackCheck';
|
|
26
28
|
export const Cross = (props) => (_jsx("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", fill: "none", ...props, children: _jsx("path", { d: "m4 4 8 8m0-8-8 8", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallback-glyphs.js","sourceRoot":"","sources":["../src/fallback-glyphs.tsx"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC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MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,GACrB,GACE,CACP,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export * from './alert';
|
|
2
2
|
export * from './badge';
|
|
3
3
|
export * from './button';
|
|
4
|
+
export * from './calendar';
|
|
4
5
|
export * from './card';
|
|
5
6
|
export * from './checkbox';
|
|
6
7
|
export { cx } from './cx';
|
|
7
8
|
export * from './date-input';
|
|
8
9
|
export * from './dialog';
|
|
9
|
-
export { Check as FallbackCheck, ChevronRight as FallbackChevronRight, Cross as FallbackCross, } from './fallback-glyphs';
|
|
10
|
+
export { Check as FallbackCheck, ChevronLeft as FallbackChevronLeft, ChevronRight as FallbackChevronRight, Cross as FallbackCross, } from './fallback-glyphs';
|
|
10
11
|
export * from './field';
|
|
11
12
|
export * from './icon';
|
|
12
13
|
export * from './illustration';
|
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,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,iBAAiB,CAAC;AAChC,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,YAAY,CAAC;AAC3B,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,WAAW,IAAI,mBAAmB,EAClC,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,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export * from './alert';
|
|
2
2
|
export * from './badge';
|
|
3
3
|
export * from './button';
|
|
4
|
+
export * from './calendar';
|
|
4
5
|
export * from './card';
|
|
5
6
|
export * from './checkbox';
|
|
6
7
|
export { cx } from './cx';
|
|
7
8
|
export * from './date-input';
|
|
8
9
|
export * from './dialog';
|
|
9
|
-
export { Check as FallbackCheck, ChevronRight as FallbackChevronRight, Cross as FallbackCross, } from './fallback-glyphs';
|
|
10
|
+
export { Check as FallbackCheck, ChevronLeft as FallbackChevronLeft, ChevronRight as FallbackChevronRight, Cross as FallbackCross, } from './fallback-glyphs';
|
|
10
11
|
export * from './field';
|
|
11
12
|
export * from './icon';
|
|
12
13
|
export * from './illustration';
|
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,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,iBAAiB,CAAC;AAChC,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,YAAY,CAAC;AAC3B,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,WAAW,IAAI,mBAAmB,EAClC,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,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DateValue } from '@internationalized/date';
|
|
2
|
+
/**
|
|
3
|
+
* Parses the ISO calendar date, `YYYY-MM-DD`, that `DateInput` and
|
|
4
|
+
* `Calendar` take and give, or throws naming the prop. A wrong shape throws
|
|
5
|
+
* during render, where the product passed it: a timestamp or a locale
|
|
6
|
+
* string is a bug in the caller, and a control that showed something else
|
|
7
|
+
* would hide it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseIsoDate(iso: string, label: string): DateValue;
|
|
10
|
+
//# sourceMappingURL=iso-date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso-date.d.ts","sourceRoot":"","sources":["../src/iso-date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,yBAAyB,CAAC;AAEpE;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAMlE"}
|
package/dist/iso-date.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { parseDate } from '@internationalized/date';
|
|
2
|
+
/**
|
|
3
|
+
* Parses the ISO calendar date, `YYYY-MM-DD`, that `DateInput` and
|
|
4
|
+
* `Calendar` take and give, or throws naming the prop. A wrong shape throws
|
|
5
|
+
* during render, where the product passed it: a timestamp or a locale
|
|
6
|
+
* string is a bug in the caller, and a control that showed something else
|
|
7
|
+
* would hide it.
|
|
8
|
+
*/
|
|
9
|
+
export function parseIsoDate(iso, label) {
|
|
10
|
+
try {
|
|
11
|
+
return parseDate(iso);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
throw new Error(`${label} must be an ISO calendar date (YYYY-MM-DD), got "${iso}"`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=iso-date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso-date.js","sourceRoot":"","sources":["../src/iso-date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpE;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,KAAa;IACrD,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,oDAAoD,GAAG,GAAG,CAAC,CAAC;IACtF,CAAC;AACH,CAAC"}
|
package/dist/menu/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { MenuItem, MenuProps } from './menu';
|
|
2
|
-
export { Menu } from './menu';
|
|
1
|
+
export type { MenuItem, MenuProps, MenuTriggerProps } from './menu';
|
|
2
|
+
export { Menu, MenuTrigger } from './menu';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/menu/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/menu/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Menu } from './menu';
|
|
1
|
+
export { Menu, MenuTrigger } from './menu';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/menu/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/menu/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/menu/menu.css
CHANGED
|
@@ -1,4 +1,57 @@
|
|
|
1
1
|
@layer components {
|
|
2
|
+
/*
|
|
3
|
+
* No border and no height of its own: the trigger is as tall as what it
|
|
4
|
+
* wraps, so a badge row keeps its measurements with or without a menu.
|
|
5
|
+
*/
|
|
6
|
+
.ds-menu__trigger {
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: var(--ds-menu-trigger-gap);
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
overflow-wrap: anywhere;
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0 var(--ds-menu-trigger-padding-inline);
|
|
14
|
+
border: 0;
|
|
15
|
+
border-radius: var(--ds-menu-trigger-radius);
|
|
16
|
+
background-color: transparent;
|
|
17
|
+
color: inherit;
|
|
18
|
+
font: inherit;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
transition: background-color 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
21
|
+
|
|
22
|
+
&:hover:not(:disabled),
|
|
23
|
+
&[data-state="open"] {
|
|
24
|
+
background-color: var(--ds-menu-trigger-bg-hover);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:focus-visible {
|
|
28
|
+
outline: 2px solid var(--ds-menu-focus-ring);
|
|
29
|
+
outline-offset: 3px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:disabled {
|
|
33
|
+
opacity: var(--ds-opacity-disabled);
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
& .ds-menu__trigger-indicator {
|
|
38
|
+
color: var(--ds-menu-trigger-indicator-color);
|
|
39
|
+
transform: rotate(90deg);
|
|
40
|
+
transition: transform 150ms cubic-bezier(0, 0, 0.2, 1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&[data-state="open"] .ds-menu__trigger-indicator {
|
|
44
|
+
transform: rotate(-90deg);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@media (prefers-reduced-motion: reduce) {
|
|
48
|
+
&,
|
|
49
|
+
& .ds-menu__trigger-indicator {
|
|
50
|
+
transition: none;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
2
55
|
/*
|
|
3
56
|
* The popup renders in a portal, so it is not a descendant of the trigger
|
|
4
57
|
* in the DOM and is styled at the top level, as Select's listbox is.
|
package/dist/menu/menu.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactElement } from 'react';
|
|
1
|
+
import { type ComponentProps, type ReactElement } from 'react';
|
|
2
2
|
import { type IconSource } from '../icon/icon';
|
|
3
3
|
import './menu.css';
|
|
4
4
|
export interface MenuItem<V extends string = string> {
|
|
@@ -56,6 +56,37 @@ export interface MenuProps<V extends string = string> {
|
|
|
56
56
|
/** Extra class names on the menu's popup. */
|
|
57
57
|
className?: string;
|
|
58
58
|
}
|
|
59
|
+
export interface MenuTriggerProps extends Omit<ComponentProps<'button'>, 'type'> {
|
|
60
|
+
/**
|
|
61
|
+
* Glyph after the content saying it opens a menu. Must point RIGHT, as
|
|
62
|
+
* Select's indicator does: the trigger turns it down while closed and up
|
|
63
|
+
* while open, so one glyph serves both states.
|
|
64
|
+
*
|
|
65
|
+
* Defaults to a plain built-in chevron. Products override it with their
|
|
66
|
+
* own icon set.
|
|
67
|
+
*/
|
|
68
|
+
indicator?: IconSource;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A quiet, compact trigger for a `Menu`: the content it is given, then a
|
|
72
|
+
* chevron, with a fill on hover and while open, and the focus ring.
|
|
73
|
+
*
|
|
74
|
+
* For a trigger that wraps something with its own look, such as a status
|
|
75
|
+
* `Badge`, where a `Button` would add a second frame and its own height. It
|
|
76
|
+
* takes the size of its content and inherits its font and colour.
|
|
77
|
+
*
|
|
78
|
+
* ```tsx
|
|
79
|
+
* <Menu
|
|
80
|
+
* trigger={
|
|
81
|
+
* <MenuTrigger aria-label={`Status: ${status}. Change status`}>
|
|
82
|
+
* <Badge variant="info" appearance="plain">{status}</Badge>
|
|
83
|
+
* </MenuTrigger>
|
|
84
|
+
* }
|
|
85
|
+
* …
|
|
86
|
+
* />
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function MenuTrigger({ indicator, className, children, ...props }: MenuTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
59
90
|
/**
|
|
60
91
|
* A menu of mutually exclusive choices, opened from a trigger and applied
|
|
61
92
|
* at once, built on Ark UI's Menu.
|
package/dist/menu/menu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/menu/menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAA2B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../src/menu/menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAA2B,MAAM,OAAO,CAAC;AAGxF,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,YAAY,CAAC;AAEpB,MAAM,WAAW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 import { Menu as ArkMenu } from '@ark-ui/react/menu';
|
|
|
3
3
|
import { Portal } from '@ark-ui/react/portal';
|
|
4
4
|
import { useCallback, useContext } from 'react';
|
|
5
5
|
import { cx } from '../cx';
|
|
6
|
-
import { Check } from '../fallback-glyphs';
|
|
6
|
+
import { Check, ChevronRight } from '../fallback-glyphs';
|
|
7
7
|
import { Icon } from '../icon/icon';
|
|
8
8
|
import { PortalContainerContext } from '../portal-container';
|
|
9
9
|
import './menu.css';
|
|
10
|
+
/**
|
|
11
|
+
* A quiet, compact trigger for a `Menu`: the content it is given, then a
|
|
12
|
+
* chevron, with a fill on hover and while open, and the focus ring.
|
|
13
|
+
*
|
|
14
|
+
* For a trigger that wraps something with its own look, such as a status
|
|
15
|
+
* `Badge`, where a `Button` would add a second frame and its own height. It
|
|
16
|
+
* takes the size of its content and inherits its font and colour.
|
|
17
|
+
*
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <Menu
|
|
20
|
+
* trigger={
|
|
21
|
+
* <MenuTrigger aria-label={`Status: ${status}. Change status`}>
|
|
22
|
+
* <Badge variant="info" appearance="plain">{status}</Badge>
|
|
23
|
+
* </MenuTrigger>
|
|
24
|
+
* }
|
|
25
|
+
* …
|
|
26
|
+
* />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function MenuTrigger({ indicator = ChevronRight, className, children, ...props }) {
|
|
30
|
+
return (_jsxs("button", { type: "button", className: cx('ds-menu__trigger', className), ...props, children: [children, _jsx(Icon, { source: indicator, size: "sm", decorative: true, className: "ds-menu__trigger-indicator" })] }));
|
|
31
|
+
}
|
|
10
32
|
/**
|
|
11
33
|
* A menu of mutually exclusive choices, opened from a trigger and applied
|
|
12
34
|
* at once, built on Ark UI's Menu.
|
package/dist/menu/menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../src/menu/menu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,IAA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,IAAI,EAAC,UAAU,SAAG,GAC9B,KATnB,IAAI,CAAC,KAAK,CAUG,CACrB,CAAC,IACqB,GACT,GACC,GACd,IACI,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -38,6 +38,13 @@ export interface PopoverProps {
|
|
|
38
38
|
* its content, up to the room beside the trigger.
|
|
39
39
|
*/
|
|
40
40
|
sameWidth?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Move focus to the first focusable thing in the panel when it opens.
|
|
43
|
+
* On by default. Turn it off when the content places focus itself, as a
|
|
44
|
+
* `Calendar` with `autoFocus` does on its chosen day: the popover would
|
|
45
|
+
* otherwise move it to the first button a frame later.
|
|
46
|
+
*/
|
|
47
|
+
autoFocus?: boolean;
|
|
41
48
|
/** Extra class names on the popover's panel. */
|
|
42
49
|
className?: string;
|
|
43
50
|
}
|
|
@@ -73,5 +80,5 @@ export interface PopoverProps {
|
|
|
73
80
|
* listbox and Menu's popup do, so it paints above the page or dialog it
|
|
74
81
|
* opens from.
|
|
75
82
|
*/
|
|
76
|
-
export declare function Popover({ trigger, label, children, open, defaultOpen, onOpenChange, placement, sameWidth, className, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
export declare function Popover({ trigger, label, children, open, defaultOpen, onOpenChange, placement, sameWidth, autoFocus, className, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
77
84
|
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -1 +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;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,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;;;;;OAKG;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,SAAgB,EAChB,SAAS,GACV,EAAE,YAAY,2CA+Bd"}
|
package/dist/popover/popover.js
CHANGED
|
@@ -37,8 +37,8 @@ import './popover.css';
|
|
|
37
37
|
* listbox and Menu's popup do, so it paints above the page or dialog it
|
|
38
38
|
* opens from.
|
|
39
39
|
*/
|
|
40
|
-
export function Popover({ trigger, label, children, open, defaultOpen, onOpenChange, placement = 'bottom-start', sameWidth = false, className, }) {
|
|
40
|
+
export function Popover({ trigger, label, children, open, defaultOpen, onOpenChange, placement = 'bottom-start', sameWidth = false, autoFocus = true, className, }) {
|
|
41
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 }) }) })] }));
|
|
42
|
+
return (_jsxs(ArkPopover.Root, { lazyMount: true, unmountOnExit: true, open: open, defaultOpen: defaultOpen, onOpenChange: (details) => onOpenChange?.(details.open), positioning: { placement, sameWidth }, autoFocus: autoFocus, 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
43
|
}
|
|
44
44
|
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +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;
|
|
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;AA0DvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,GAAG,IAAI,EAChB,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,EACrC,SAAS,EAAE,SAAS,aAEpB,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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manakind/ui-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"types": "./dist/button/index.d.ts",
|
|
37
37
|
"import": "./dist/button/index.js"
|
|
38
38
|
},
|
|
39
|
+
"./calendar": {
|
|
40
|
+
"types": "./dist/calendar/index.d.ts",
|
|
41
|
+
"import": "./dist/calendar/index.js"
|
|
42
|
+
},
|
|
39
43
|
"./card": {
|
|
40
44
|
"types": "./dist/card/index.d.ts",
|
|
41
45
|
"import": "./dist/card/index.js"
|
|
@@ -104,6 +108,10 @@
|
|
|
104
108
|
"types": "./dist/button/button.css.d.ts",
|
|
105
109
|
"default": "./dist/button/button.css"
|
|
106
110
|
},
|
|
111
|
+
"./css/calendar": {
|
|
112
|
+
"types": "./dist/calendar/calendar.css.d.ts",
|
|
113
|
+
"default": "./dist/calendar/calendar.css"
|
|
114
|
+
},
|
|
107
115
|
"./css/card": {
|
|
108
116
|
"types": "./dist/card/card.css.d.ts",
|
|
109
117
|
"default": "./dist/card/card.css"
|
|
@@ -179,7 +187,7 @@
|
|
|
179
187
|
},
|
|
180
188
|
"devDependencies": {
|
|
181
189
|
"@manakind/ds-config": "*",
|
|
182
|
-
"@manakind/manuia-tokens": "0.
|
|
190
|
+
"@manakind/manuia-tokens": "0.15.0",
|
|
183
191
|
"@testing-library/jest-dom": "^6.9.1",
|
|
184
192
|
"@testing-library/react": "^16.3.2",
|
|
185
193
|
"@testing-library/user-event": "^14.6.1",
|