@kanso-labs/kanso-ui 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calendar/index.js +80 -0
- package/dist/calendar/index.js.map +1 -0
- package/dist/calendar/months.js +14 -0
- package/dist/calendar/months.js.map +1 -0
- package/dist/calendar/styles.js +150 -0
- package/dist/calendar/styles.js.map +1 -0
- package/dist/components/calendar/index.d.ts +32 -0
- package/dist/components/calendar/index.js +97 -0
- package/dist/components/calendar/index.js.map +1 -0
- package/dist/components/color-area/index.d.ts +50 -0
- package/dist/components/color-area/index.js +63 -0
- package/dist/components/color-area/index.js.map +1 -0
- package/dist/components/color-slider/index.d.ts +41 -0
- package/dist/components/color-slider/index.js +70 -0
- package/dist/components/color-slider/index.js.map +1 -0
- package/dist/components/color-swatch/index.d.ts +37 -0
- package/dist/components/color-swatch/index.js +88 -0
- package/dist/components/color-swatch/index.js.map +1 -0
- package/dist/components/color-swatch-picker/index.d.ts +49 -0
- package/dist/components/color-swatch-picker/index.js +99 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -0
- package/dist/components/date-field/index.d.ts +54 -0
- package/dist/components/date-field/index.js +58 -0
- package/dist/components/date-field/index.js.map +1 -0
- package/dist/components/date-picker/index.d.ts +57 -0
- package/dist/components/date-picker/index.js +75 -0
- package/dist/components/date-picker/index.js.map +1 -0
- package/dist/components/date-range-picker/index.d.ts +69 -0
- package/dist/components/date-range-picker/index.js +95 -0
- package/dist/components/date-range-picker/index.js.map +1 -0
- package/dist/components/disclosure/index.js +3 -3
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/drop-zone/index.d.ts +60 -0
- package/dist/components/drop-zone/index.js +118 -0
- package/dist/components/drop-zone/index.js.map +1 -0
- package/dist/components/drop-zone/styles.js +61 -0
- package/dist/components/drop-zone/styles.js.map +1 -0
- package/dist/components/icon-button/index.d.ts +4 -3
- package/dist/components/icon-button/index.js +48 -2
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +15 -1
- package/dist/components/list/index.js +3 -3
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.js +3 -3
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/list-item/index.d.ts +16 -6
- package/dist/components/list-item/index.js +16 -8
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +94 -0
- package/dist/components/navigation-tree/index.js +266 -0
- package/dist/components/navigation-tree/index.js.map +1 -0
- package/dist/components/range-calendar/index.d.ts +39 -0
- package/dist/components/range-calendar/index.js +105 -0
- package/dist/components/range-calendar/index.js.map +1 -0
- package/dist/components/separator/index.d.ts +17 -4
- package/dist/components/separator/index.js +38 -20
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/table/index.d.ts +197 -0
- package/dist/components/table/index.js +327 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/time-field/index.d.ts +53 -0
- package/dist/components/time-field/index.js +57 -0
- package/dist/components/time-field/index.js.map +1 -0
- package/dist/components/tree/index.d.ts +116 -0
- package/dist/components/tree/index.js +245 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/date.d.ts +1 -0
- package/dist/date.js +1 -0
- package/dist/drag/hooks.d.ts +25 -0
- package/dist/drag/hooks.js +55 -0
- package/dist/drag/hooks.js.map +1 -0
- package/dist/drag/index.js +28 -0
- package/dist/drag/index.js.map +1 -0
- package/dist/drag/styles.js +46 -0
- package/dist/drag/styles.js.map +1 -0
- package/dist/glyphs/index.js +64 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/index.d.ts +18 -2
- package/dist/index.js +18 -2
- package/dist/layout.d.ts +40 -0
- package/dist/layout.js +41 -0
- package/dist/layout.js.map +1 -0
- package/dist/react-aria.d.ts +3 -2
- package/dist/react-aria.js +3 -2
- package/dist/row/index.js +25 -13
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js +34 -0
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/index.js +22 -0
- package/dist/segments/index.js.map +1 -0
- package/dist/segments/styles.js +42 -0
- package/dist/segments/styles.js.map +1 -0
- package/dist/styles/chequer.js +14 -0
- package/dist/styles/chequer.js.map +1 -0
- package/dist/styles/color.js +17 -0
- package/dist/styles/color.js.map +1 -0
- package/dist/styles/picker.js +61 -0
- package/dist/styles/picker.js.map +1 -0
- package/dist/styles.css +263 -3
- package/dist/tokens/design.tokens.stylex.js +61 -1
- package/dist/tokens/design.tokens.stylex.js.map +1 -1
- package/package.json +7 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { props } from "../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
|
+
import { ChevronEndGlyph } from "../glyphs/index.js";
|
|
3
|
+
import { calendarStyles } from "./styles.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { Button, CalendarGridHeader, CalendarHeaderCell, Heading } from "react-aria-components";
|
|
7
|
+
//#region src/calendar/index.tsx
|
|
8
|
+
function CalendarGridHeader$1() {
|
|
9
|
+
const $ = c(1);
|
|
10
|
+
let t0;
|
|
11
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
12
|
+
t0 = /* @__PURE__ */ jsx(CalendarGridHeader, { children: calendarHeaderCell });
|
|
13
|
+
$[0] = t0;
|
|
14
|
+
} else t0 = $[0];
|
|
15
|
+
return t0;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The two chevrons with the month between them. React Aria wires
|
|
19
|
+
* `slot="previous"` and `slot="next"` on its own `Button`, and `IconButton`
|
|
20
|
+
* renders React Aria's `Button` too — so nesting one inside a slot would put
|
|
21
|
+
* two buttons where the date pickers page draws one. The chevrons take the
|
|
22
|
+
* icon buttons page's 40dp square and its state layer instead.
|
|
23
|
+
*
|
|
24
|
+
* A plain element rather than a `<header>`: a header is a banner landmark,
|
|
25
|
+
* landmarks may not nest, and React Aria puts a calendar in
|
|
26
|
+
* `role="application"` — axe fails the page on it.
|
|
27
|
+
*/
|
|
28
|
+
function CalendarHeader() {
|
|
29
|
+
const $ = c(4);
|
|
30
|
+
let t0;
|
|
31
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
32
|
+
t0 = props(calendarStyles.header);
|
|
33
|
+
$[0] = t0;
|
|
34
|
+
} else t0 = $[0];
|
|
35
|
+
let t1;
|
|
36
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
37
|
+
t1 = /* @__PURE__ */ jsx(Button, {
|
|
38
|
+
className: chevronClassName,
|
|
39
|
+
slot: "previous",
|
|
40
|
+
children: /* @__PURE__ */ jsx(ChevronEndGlyph, { ...props(calendarStyles.chevronGlyph, calendarStyles.chevronGlyphPrevious) })
|
|
41
|
+
});
|
|
42
|
+
$[1] = t1;
|
|
43
|
+
} else t1 = $[1];
|
|
44
|
+
let t2;
|
|
45
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
46
|
+
t2 = /* @__PURE__ */ jsx(Heading, { ...props(calendarStyles.heading) });
|
|
47
|
+
$[2] = t2;
|
|
48
|
+
} else t2 = $[2];
|
|
49
|
+
let t3;
|
|
50
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
51
|
+
t3 = /* @__PURE__ */ jsxs("div", {
|
|
52
|
+
...t0,
|
|
53
|
+
children: [
|
|
54
|
+
t1,
|
|
55
|
+
t2,
|
|
56
|
+
/* @__PURE__ */ jsx(Button, {
|
|
57
|
+
className: chevronClassName,
|
|
58
|
+
slot: "next",
|
|
59
|
+
children: /* @__PURE__ */ jsx(ChevronEndGlyph, { ...props(calendarStyles.chevronGlyph) })
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
$[3] = t3;
|
|
64
|
+
} else t3 = $[3];
|
|
65
|
+
return t3;
|
|
66
|
+
}
|
|
67
|
+
/** The weekday row, in the type the page gives both it and the dates. */
|
|
68
|
+
function calendarHeaderCell(day) {
|
|
69
|
+
return /* @__PURE__ */ jsx(CalendarHeaderCell, {
|
|
70
|
+
...props(calendarStyles.headerCell),
|
|
71
|
+
children: day
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function chevronClassName() {
|
|
75
|
+
return props(calendarStyles.chevron).className ?? "";
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { CalendarGridHeader$1 as CalendarGridHeader, CalendarHeader };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["calendarHeaderCell","chevronClassName"],"sources":["../../src/calendar/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, CalendarGridHeader as RACCalendarGridHeader, CalendarHeaderCell as RACCalendarHeaderCell, Heading as RACHeading } from 'react-aria-components';\nimport { ChevronEndGlyph } from '../glyphs';\nimport { calendarStyles } from './styles';\n\n// The parts Calendar and RangeCalendar both render: the row that moves the\n// month, the weekday header, and the offsets that put more than one month\n// side by side. Apart from either component so the two cannot drift, and\n// outside `src/components` for the reason ./styles.ts gives.\n\nfunction CalendarGridHeader(): ReactElement {\n return <RACCalendarGridHeader>{calendarHeaderCell}</RACCalendarGridHeader>;\n}\n\n/**\n * The two chevrons with the month between them. React Aria wires\n * `slot=\"previous\"` and `slot=\"next\"` on its own `Button`, and `IconButton`\n * renders React Aria's `Button` too — so nesting one inside a slot would put\n * two buttons where the date pickers page draws one. The chevrons take the\n * icon buttons page's 40dp square and its state layer instead.\n *\n * A plain element rather than a `<header>`: a header is a banner landmark,\n * landmarks may not nest, and React Aria puts a calendar in\n * `role=\"application\"` — axe fails the page on it.\n */\nfunction CalendarHeader(): ReactElement {\n return <div {...stylex.props(calendarStyles.header)}>\n <RACButton className={chevronClassName} slot=\"previous\">\n <ChevronEndGlyph {...stylex.props(calendarStyles.chevronGlyph, calendarStyles.chevronGlyphPrevious)} />\n </RACButton>\n <RACHeading {...stylex.props(calendarStyles.heading)} />\n <RACButton className={chevronClassName} slot=\"next\">\n <ChevronEndGlyph {...stylex.props(calendarStyles.chevronGlyph)} />\n </RACButton>\n </div>;\n}\n\n/** The weekday row, in the type the page gives both it and the dates. */\nfunction calendarHeaderCell(day: string): ReactElement {\n return <RACCalendarHeaderCell {...stylex.props(calendarStyles.headerCell)}>\n {day}\n </RACCalendarHeaderCell>;\n}\nfunction chevronClassName() {\n return stylex.props(calendarStyles.chevron).className ?? '';\n}\nexport { CalendarGridHeader, CalendarHeader };"],"mappings":";;;;;;;AAWA,SAAA,uBAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EACS,KAAA,oBAAC,oBAAD,EAAA,UAAwB,mBAAF,CAAA;EAA6C,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAAnE;AAAmE;;;;;;;;;;;;AAc5E,SAAA,iBAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EACkB,KAAA,MAAa,eAAc,MAAO;EAAC,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EAC/C,KAAA,oBAAC,QAAD;GAAsBC,WAAA;GAAuB,MAAA;GAC3C,UAAA,oBAAC,iBAAD,EAAgB,GAAK,MAAa,eAAc,cAAe,eAAc,oBAAqB,EAAC,CAAA;EAD3F,CAAA;EAEE,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EACZ,KAAA,oBAAC,SAAD,EAAW,GAAK,MAAa,eAAc,OAAQ,EAAC,CAAA;EAAI,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EAJrD,KAAA,qBAAA,OAAA;GAQC,GARQ;GAAT,UAAA;IACH;IAGA;IACA,oBAAC,QAAD;KAAsBA,WAAA;KAAuB,MAAA;KAC3C,UAAA,oBAAC,iBAAD,EAAgB,GAAK,MAAa,eAAc,YAAa,EAAC,CAAA;IADtD,CAAA;GAGN;;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OARD;AAQC;;AAIV,SAAS,mBAAmB,KAA2B;CACrD,OAAO,oBAAC,oBAAD;EAAuB,GAAI,MAAa,eAAe,UAAU;EACnE,UAAA;CACoB,CAAA;AAC3B;AACA,SAAS,mBAAmB;CAC1B,OAAO,MAAa,eAAe,OAAO,CAAC,CAAC,aAAa;AAC3D"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/calendar/months.ts
|
|
2
|
+
/**
|
|
3
|
+
* One offset per visible month, so `visibleDuration` of more than one draws
|
|
4
|
+
* the months side by side rather than one grid that scrolls between them.
|
|
5
|
+
* React Aria positions each grid from its own offset; the heading names the
|
|
6
|
+
* whole range, which is what its own `Heading` renders.
|
|
7
|
+
*/
|
|
8
|
+
function monthOffsets(months) {
|
|
9
|
+
return Array.from({ length: Math.max(1, months) }, (_unused, index) => ({ months: index }));
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { monthOffsets };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=months.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"months.js","names":[],"sources":["../../src/calendar/months.ts"],"sourcesContent":["// Apart from ./index.tsx so that file exports components alone, which is what\n// keeps fast refresh working for it — the same arrangement `src/row` uses.\n\n/**\n * One offset per visible month, so `visibleDuration` of more than one draws\n * the months side by side rather than one grid that scrolls between them.\n * React Aria positions each grid from its own offset; the heading names the\n * whole range, which is what its own `Heading` renders.\n */\nfunction monthOffsets(months: number) {\n return Array.from({ length: Math.max(1, months) }, (_unused, index) => ({\n months: index,\n }))\n}\n\nexport { monthOffsets }\n"],"mappings":";;;;;;;AASA,SAAS,aAAa,QAAgB;CACpC,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EACtE,QAAQ,MACV,EAAE;AACJ"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
//#region src/calendar/styles.ts
|
|
2
|
+
const calendarStyles = {
|
|
3
|
+
cell: {
|
|
4
|
+
kGNEyG: "x6s0dn4",
|
|
5
|
+
kWkggS: "x83qkoq x1p2om7n xjbqb8w",
|
|
6
|
+
kZKoxP: "x1vqgdyp",
|
|
7
|
+
kaIpWk: "x3y1ksm",
|
|
8
|
+
kB7OPa: "x9f619",
|
|
9
|
+
kMwMTN: "x139gbkf",
|
|
10
|
+
kkrTdU: "x1ypdohk",
|
|
11
|
+
k1xSpc: "x78zum5",
|
|
12
|
+
kMv6JI: "x16svsjw",
|
|
13
|
+
kGuDYH: "x1848etk",
|
|
14
|
+
k63SB2: "x1c52epr",
|
|
15
|
+
kzqmXN: "x100vrsf",
|
|
16
|
+
kjj79g: "xl56j7k",
|
|
17
|
+
kb6lSQ: "x1qn8t5l",
|
|
18
|
+
kLWn49: "xh7dzej",
|
|
19
|
+
kUOVxO: "x34s64n",
|
|
20
|
+
kjBf7l: "xrgy624",
|
|
21
|
+
kInvED: "x1hl8ikr",
|
|
22
|
+
k3XXqK: "x9v5kkp x1t137rt",
|
|
23
|
+
kMeerF: "x1de99jn",
|
|
24
|
+
$$css: true
|
|
25
|
+
},
|
|
26
|
+
cellDisabled: {
|
|
27
|
+
kWkggS: "xjbqb8w",
|
|
28
|
+
kMwMTN: "x9w6zvh",
|
|
29
|
+
kkrTdU: "x1h6gzvc",
|
|
30
|
+
$$css: true
|
|
31
|
+
},
|
|
32
|
+
cellInRange: {
|
|
33
|
+
kWkggS: "x1mpme18 x1q7sp4o x15dekr4",
|
|
34
|
+
kaIpWk: "x2u8bby",
|
|
35
|
+
kMwMTN: "x1sawysd",
|
|
36
|
+
kzqmXN: "xh8yej3",
|
|
37
|
+
kUOVxO: "xrxpjvj",
|
|
38
|
+
$$css: true
|
|
39
|
+
},
|
|
40
|
+
cellRangeEnd: {
|
|
41
|
+
kT0f0o: "x1mh50ju",
|
|
42
|
+
kfmiAY: "x13dhofw",
|
|
43
|
+
$$css: true
|
|
44
|
+
},
|
|
45
|
+
cellRangeStart: {
|
|
46
|
+
kVL7Gh: "xqmr837",
|
|
47
|
+
krdFHd: "xz4iguh",
|
|
48
|
+
$$css: true
|
|
49
|
+
},
|
|
50
|
+
cellSelected: {
|
|
51
|
+
kWkggS: "x1nik15g x1q2w5h1 xnety89",
|
|
52
|
+
kMwMTN: "xwjo7ld",
|
|
53
|
+
$$css: true
|
|
54
|
+
},
|
|
55
|
+
cellToday: {
|
|
56
|
+
kVAM5u: "x1uajy3w",
|
|
57
|
+
ksu8eU: "x1y0btm7",
|
|
58
|
+
kMzoRj: "xmkeg23",
|
|
59
|
+
kMwMTN: "x1mxwv8y",
|
|
60
|
+
$$css: true
|
|
61
|
+
},
|
|
62
|
+
chevron: {
|
|
63
|
+
kGNEyG: "x6s0dn4",
|
|
64
|
+
kWkggS: "x1dg9itu x1728qcm xjbqb8w",
|
|
65
|
+
kZKoxP: "x1vqgdyp",
|
|
66
|
+
kaIpWk: "x3y1ksm",
|
|
67
|
+
kMzoRj: "xc342km",
|
|
68
|
+
kB7OPa: "x9f619",
|
|
69
|
+
kMwMTN: "x1w5n3ug",
|
|
70
|
+
kkrTdU: "x1ypdohk",
|
|
71
|
+
k1xSpc: "x78zum5",
|
|
72
|
+
kmuXW: "x2lah0s",
|
|
73
|
+
kzqmXN: "x100vrsf",
|
|
74
|
+
kjj79g: "xl56j7k",
|
|
75
|
+
kUOVxO: "x34s64n",
|
|
76
|
+
kjBf7l: "xrgy624",
|
|
77
|
+
kInvED: "x1hl8ikr",
|
|
78
|
+
k3XXqK: "x9v5kkp x1t137rt",
|
|
79
|
+
kMeerF: "x1de99jn",
|
|
80
|
+
kmVPX3: "x1717udv",
|
|
81
|
+
$$css: true
|
|
82
|
+
},
|
|
83
|
+
chevronGlyph: {
|
|
84
|
+
kZKoxP: "xxk0z11",
|
|
85
|
+
kzqmXN: "xvy4d1p",
|
|
86
|
+
k3aq6I: "x19axjrm x1c071of",
|
|
87
|
+
$$css: true
|
|
88
|
+
},
|
|
89
|
+
chevronGlyphPrevious: {
|
|
90
|
+
k3aq6I: "xdg80k9 xpk2tj9",
|
|
91
|
+
$$css: true
|
|
92
|
+
},
|
|
93
|
+
grid: {
|
|
94
|
+
kLvRdT: "x1vathgz",
|
|
95
|
+
kheTzg: "x1gukg7c",
|
|
96
|
+
kzqmXN: "xh8yej3",
|
|
97
|
+
$$css: true
|
|
98
|
+
},
|
|
99
|
+
header: {
|
|
100
|
+
kGNEyG: "x6s0dn4",
|
|
101
|
+
k1xSpc: "x78zum5",
|
|
102
|
+
kOIVth: "x126z3so",
|
|
103
|
+
kjj79g: "x1qughib",
|
|
104
|
+
kAzted: "x1ba4aug",
|
|
105
|
+
$$css: true
|
|
106
|
+
},
|
|
107
|
+
headerCell: {
|
|
108
|
+
kZKoxP: "x1vqgdyp",
|
|
109
|
+
kMwMTN: "x139gbkf",
|
|
110
|
+
kMv6JI: "x16svsjw",
|
|
111
|
+
kGuDYH: "x1848etk",
|
|
112
|
+
k63SB2: "x1c52epr",
|
|
113
|
+
kb6lSQ: "x1qn8t5l",
|
|
114
|
+
kLWn49: "xh7dzej",
|
|
115
|
+
$$css: true
|
|
116
|
+
},
|
|
117
|
+
heading: {
|
|
118
|
+
kMwMTN: "x1w5n3ug",
|
|
119
|
+
kMv6JI: "xkknnkr",
|
|
120
|
+
kGuDYH: "x14zspaw",
|
|
121
|
+
k63SB2: "x1v9cpvo",
|
|
122
|
+
kb6lSQ: "x155f00i",
|
|
123
|
+
kLWn49: "x1lz68p4",
|
|
124
|
+
kogj98: "x1ghz6dp",
|
|
125
|
+
k9WMMc: "x2b8uid",
|
|
126
|
+
$$css: true
|
|
127
|
+
},
|
|
128
|
+
months: {
|
|
129
|
+
k1xSpc: "x78zum5",
|
|
130
|
+
kOIVth: "xj2l1yv",
|
|
131
|
+
$$css: true
|
|
132
|
+
},
|
|
133
|
+
root: {
|
|
134
|
+
kWkggS: "xvkjz1l",
|
|
135
|
+
kaIpWk: "xhpdng0",
|
|
136
|
+
kB7OPa: "x9f619",
|
|
137
|
+
kMwMTN: "x139gbkf",
|
|
138
|
+
k1xSpc: "x78zum5",
|
|
139
|
+
kXwgrk: "xdt5ytf",
|
|
140
|
+
kOIVth: "x1gka490",
|
|
141
|
+
kzqmXN: "xeq5yr9",
|
|
142
|
+
k7Eaqz: "x1gvwcb",
|
|
143
|
+
kmVPX3: "xa36j16",
|
|
144
|
+
$$css: true
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
//#endregion
|
|
148
|
+
export { calendarStyles };
|
|
149
|
+
|
|
150
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","names":[],"sources":["../../src/calendar/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The styles Calendar and RangeCalendar both draw. Apart from either\n// component so the two cannot drift, and outside `src/components` because a\n// directory there is a public component with stories, a barrel entry and a\n// `styling.test.tsx` case — which shared styles are none of.\n//\n// The values are the date pickers page's docked calendar, named in\n// `src/components/calendar/index.tsx` along with the departures from it. What\n// is only a range's — the band between the two ends — is marked as the\n// library's own where it is defined, since the page tokenises no such thing.\n\nconst calendarStyles = {\n cell: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"x83qkoq x1p2om7n xjbqb8w\",\n kZKoxP: \"x1vqgdyp\",\n kaIpWk: \"x3y1ksm\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kzqmXN: \"x100vrsf\",\n kjj79g: \"xl56j7k\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n kUOVxO: \"x34s64n\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x1hl8ikr\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n $$css: true\n },\n cellDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x9w6zvh\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n cellInRange: {\n kWkggS: \"x1mpme18 x1q7sp4o x15dekr4\",\n kaIpWk: \"x2u8bby\",\n kMwMTN: \"x1sawysd\",\n kzqmXN: \"xh8yej3\",\n kUOVxO: \"xrxpjvj\",\n $$css: true\n },\n cellRangeEnd: {\n kT0f0o: \"x1mh50ju\",\n kfmiAY: \"x13dhofw\",\n $$css: true\n },\n cellRangeStart: {\n kVL7Gh: \"xqmr837\",\n krdFHd: \"xz4iguh\",\n $$css: true\n },\n cellSelected: {\n kWkggS: \"x1nik15g x1q2w5h1 xnety89\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n cellToday: {\n kVAM5u: \"x1uajy3w\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n chevron: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"x1dg9itu x1728qcm xjbqb8w\",\n kZKoxP: \"x1vqgdyp\",\n kaIpWk: \"x3y1ksm\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x100vrsf\",\n kjj79g: \"xl56j7k\",\n kUOVxO: \"x34s64n\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x1hl8ikr\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n kmVPX3: \"x1717udv\",\n $$css: true\n },\n chevronGlyph: {\n kZKoxP: \"xxk0z11\",\n kzqmXN: \"xvy4d1p\",\n k3aq6I: \"x19axjrm x1c071of\",\n $$css: true\n },\n chevronGlyphPrevious: {\n k3aq6I: \"xdg80k9 xpk2tj9\",\n $$css: true\n },\n grid: {\n kLvRdT: \"x1vathgz\",\n kheTzg: \"x1gukg7c\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n header: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kOIVth: \"x126z3so\",\n kjj79g: \"x1qughib\",\n kAzted: \"x1ba4aug\",\n $$css: true\n },\n headerCell: {\n kZKoxP: \"x1vqgdyp\",\n kMwMTN: \"x139gbkf\",\n kMv6JI: \"x16svsjw\",\n kGuDYH: \"x1848etk\",\n k63SB2: \"x1c52epr\",\n kb6lSQ: \"x1qn8t5l\",\n kLWn49: \"xh7dzej\",\n $$css: true\n },\n heading: {\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n kogj98: \"x1ghz6dp\",\n k9WMMc: \"x2b8uid\",\n $$css: true\n },\n months: {\n k1xSpc: \"x78zum5\",\n kOIVth: \"xj2l1yv\",\n $$css: true\n },\n root: {\n kWkggS: \"xvkjz1l\",\n kaIpWk: \"xhpdng0\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x139gbkf\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kOIVth: \"x1gka490\",\n kzqmXN: \"xeq5yr9\",\n k7Eaqz: \"x1gvwcb\",\n kmVPX3: \"xa36j16\",\n $$css: true\n }\n};\nexport { calendarStyles };"],"mappings":";AAcA,MAAM,iBAAiB;CACrB,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,cAAc;EACZ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,cAAc;EACZ,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,cAAc;EACZ,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,WAAW;EACT,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,cAAc;EACZ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,sBAAsB;EACpB,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,SAAS;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CalendarProps, DateValue } from "react-aria-components";
|
|
2
|
+
//#region src/components/calendar/index.d.ts
|
|
3
|
+
type CalendarProps$1<T extends DateValue> = Omit<CalendarProps<T>, 'children' | 'className' | 'style'> & {
|
|
4
|
+
/** A function may compute the class from the calendar's render state. */
|
|
5
|
+
className?: CalendarProps<T>['className'];
|
|
6
|
+
/** A function may compute the style from the calendar's render state. */
|
|
7
|
+
style?: CalendarProps<T>['style'];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* A month calendar for picking a date. The value is React Aria's: pass
|
|
11
|
+
* `value` with `onChange` to control it, or `defaultValue` to let it keep its
|
|
12
|
+
* own, both as an `@internationalized/date` value from this package's
|
|
13
|
+
* `./date` subpath.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { today, getLocalTimeZone } from '@kanso-labs/kanso-ui/date'
|
|
17
|
+
*
|
|
18
|
+
* <Calendar aria-label="Label" defaultValue={today(getLocalTimeZone())} />
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* `minValue` and `maxValue` bound it, `isDateUnavailable` rules individual
|
|
22
|
+
* dates out, and `visibleDuration` of `{ months: 2 }` draws two months side
|
|
23
|
+
* by side. Name it with `aria-label` or `aria-labelledby`; React Aria
|
|
24
|
+
* composes the visible month into that name itself.
|
|
25
|
+
*
|
|
26
|
+
* The call site's `className` and `style` land on the container, which is the
|
|
27
|
+
* element a layout positions.
|
|
28
|
+
*/
|
|
29
|
+
declare function Calendar$1<T extends DateValue>(props: CalendarProps$1<T>): import("react").JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { type CalendarProps$1 as CalendarProps, Calendar$1 as default };
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
|
+
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
3
|
+
import { calendarStyles } from "../../calendar/styles.js";
|
|
4
|
+
import { CalendarGridHeader as CalendarGridHeader$1, CalendarHeader } from "../../calendar/index.js";
|
|
5
|
+
import { monthOffsets } from "../../calendar/months.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { c } from "react/compiler-runtime";
|
|
8
|
+
import { Calendar, CalendarCell, CalendarGrid, CalendarGridBody } from "react-aria-components";
|
|
9
|
+
//#region src/components/calendar/index.tsx
|
|
10
|
+
/**
|
|
11
|
+
* A month calendar for picking a date. The value is React Aria's: pass
|
|
12
|
+
* `value` with `onChange` to control it, or `defaultValue` to let it keep its
|
|
13
|
+
* own, both as an `@internationalized/date` value from this package's
|
|
14
|
+
* `./date` subpath.
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { today, getLocalTimeZone } from '@kanso-labs/kanso-ui/date'
|
|
18
|
+
*
|
|
19
|
+
* <Calendar aria-label="Label" defaultValue={today(getLocalTimeZone())} />
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* `minValue` and `maxValue` bound it, `isDateUnavailable` rules individual
|
|
23
|
+
* dates out, and `visibleDuration` of `{ months: 2 }` draws two months side
|
|
24
|
+
* by side. Name it with `aria-label` or `aria-labelledby`; React Aria
|
|
25
|
+
* composes the visible month into that name itself.
|
|
26
|
+
*
|
|
27
|
+
* The call site's `className` and `style` land on the container, which is the
|
|
28
|
+
* element a layout positions.
|
|
29
|
+
*/
|
|
30
|
+
function Calendar$1(props$1) {
|
|
31
|
+
const $ = c(12);
|
|
32
|
+
let t0;
|
|
33
|
+
if ($[0] !== props$1) {
|
|
34
|
+
t0 = mergeStatefulStyles(props(calendarStyles.root), props$1);
|
|
35
|
+
$[0] = props$1;
|
|
36
|
+
$[1] = t0;
|
|
37
|
+
} else t0 = $[1];
|
|
38
|
+
let t1;
|
|
39
|
+
let t2;
|
|
40
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
41
|
+
t1 = /* @__PURE__ */ jsx(CalendarHeader, {});
|
|
42
|
+
t2 = props(calendarStyles.months);
|
|
43
|
+
$[2] = t1;
|
|
44
|
+
$[3] = t2;
|
|
45
|
+
} else {
|
|
46
|
+
t1 = $[2];
|
|
47
|
+
t2 = $[3];
|
|
48
|
+
}
|
|
49
|
+
let t3;
|
|
50
|
+
if ($[4] !== props$1.visibleDuration?.months) {
|
|
51
|
+
t3 = monthOffsets(props$1.visibleDuration?.months ?? 1).map(_temp);
|
|
52
|
+
$[4] = props$1.visibleDuration?.months;
|
|
53
|
+
$[5] = t3;
|
|
54
|
+
} else t3 = $[5];
|
|
55
|
+
let t4;
|
|
56
|
+
if ($[6] !== t3) {
|
|
57
|
+
t4 = /* @__PURE__ */ jsx("div", {
|
|
58
|
+
...t2,
|
|
59
|
+
children: t3
|
|
60
|
+
});
|
|
61
|
+
$[6] = t3;
|
|
62
|
+
$[7] = t4;
|
|
63
|
+
} else t4 = $[7];
|
|
64
|
+
let t5;
|
|
65
|
+
if ($[8] !== props$1 || $[9] !== t0 || $[10] !== t4) {
|
|
66
|
+
t5 = /* @__PURE__ */ jsxs(Calendar, {
|
|
67
|
+
...props$1,
|
|
68
|
+
...t0,
|
|
69
|
+
children: [t1, t4]
|
|
70
|
+
});
|
|
71
|
+
$[8] = props$1;
|
|
72
|
+
$[9] = t0;
|
|
73
|
+
$[10] = t4;
|
|
74
|
+
$[11] = t5;
|
|
75
|
+
} else t5 = $[11];
|
|
76
|
+
return t5;
|
|
77
|
+
}
|
|
78
|
+
function _temp(offset) {
|
|
79
|
+
return /* @__PURE__ */ jsxs(CalendarGrid, {
|
|
80
|
+
offset,
|
|
81
|
+
...props(calendarStyles.grid),
|
|
82
|
+
children: [/* @__PURE__ */ jsx(CalendarGridHeader$1, {}), /* @__PURE__ */ jsx(CalendarGridBody, { children: gridCell })]
|
|
83
|
+
}, offset.months);
|
|
84
|
+
}
|
|
85
|
+
function cellClassName(state) {
|
|
86
|
+
return props(calendarStyles.cell, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellSelected, state.isDisabled && calendarStyles.cellDisabled).className ?? "";
|
|
87
|
+
}
|
|
88
|
+
function gridCell(date) {
|
|
89
|
+
return /* @__PURE__ */ jsx(CalendarCell, {
|
|
90
|
+
className: cellClassName,
|
|
91
|
+
date
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { Calendar$1 as default };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["offset","gridCell"],"sources":["../../../src/components/calendar/index.tsx"],"sourcesContent":["import type { CalendarDate } from '@internationalized/date';\nimport type { ReactElement } from 'react';\nimport type { DateValue, CalendarProps as RACCalendarProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Calendar as RACCalendar, CalendarCell as RACCalendarCell, CalendarGrid as RACCalendarGrid, CalendarGridBody as RACCalendarGridBody } from 'react-aria-components';\nimport { CalendarGridHeader, CalendarHeader } from '../../calendar';\nimport { monthOffsets } from '../../calendar/months';\nimport { calendarStyles } from '../../calendar/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// The date pickers page's docked calendar: a month grid with a circle on the\n// selected date and an outline on today. Its values are that page's — a\n// 360dp container on the high surface container, 48dp date cells with a 40dp\n// state layer inside them, body-large for both the weekday row and the dates,\n// primary for the selected circle and for today's outline.\n//\n// The page's container is 456dp tall, which this does not fix: that height is\n// a picker's, counting a headline and an action row the calendar itself does\n// not draw. A month grid is as tall as its weeks, and six-week months are\n// taller than five-week ones — pinning 456 would crop one or pad the other.\n//\n// Three things are this component's own.\n//\n// **The cell is a circle in a square.** The page gives the date a 48dp\n// container and a 40dp state layer, which is a 40dp circle with 4dp of room\n// around it. The grid's `border-spacing` is what supplies that room, so the\n// circle is the element and the square is the space between circles — rather\n// than a 48dp box with a 40dp box inside it.\n//\n// **A date from the month either side is faded because it is disabled, not\n// because it is outside.** React Aria marks those cells `data-outside-month`\n// and disables them in the same breath, so a treatment keyed on the first\n// would never draw anything the second had not already drawn. The disabled\n// fade is the page's 38% either way.\n//\n// **Today reads as today whether or not it is selected.** The page gives it\n// an outline and the primary label; selected gives it a filled circle and the\n// on-primary label. A selected today takes the fill, since a circle already\n// says where you are and two rings would say it twice.\n//\n// **The month is moved by IconButton's shape rather than by IconButton.**\n// React Aria wires `slot=\"previous\"` and `slot=\"next\"` on its own `Button`,\n// and IconButton renders React Aria's `Button` too — so nesting one inside\n// the slot would put two buttons where the page draws one. The chevrons take\n// the standard icon button's 40dp square and its state layer instead.\n\ntype CalendarProps<T extends DateValue> = Omit<RACCalendarProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the calendar's render state. */\n className?: RACCalendarProps<T>['className'];\n /** A function may compute the style from the calendar's render state. */\n style?: RACCalendarProps<T>['style'];\n};\n\n/**\n * A month calendar for picking a date. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep its\n * own, both as an `@internationalized/date` value from this package's\n * `./date` subpath.\n *\n * ```tsx\n * import { today, getLocalTimeZone } from '@kanso-labs/kanso-ui/date'\n *\n * <Calendar aria-label=\"Label\" defaultValue={today(getLocalTimeZone())} />\n * ```\n *\n * `minValue` and `maxValue` bound it, `isDateUnavailable` rules individual\n * dates out, and `visibleDuration` of `{ months: 2 }` draws two months side\n * by side. Name it with `aria-label` or `aria-labelledby`; React Aria\n * composes the visible month into that name itself.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction Calendar<T extends DateValue>(props: CalendarProps<T>) {\n return <RACCalendar<T> {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n <CalendarHeader />\n <div {...stylex.props(calendarStyles.months)}>\n {monthOffsets(props.visibleDuration?.months ?? 1).map(offset => <RACCalendarGrid key={offset.months} offset={offset} {...stylex.props(calendarStyles.grid)}>\n <CalendarGridHeader />\n <RACCalendarGridBody>{gridCell}</RACCalendarGridBody>\n </RACCalendarGrid>)}\n </div>\n </RACCalendar>;\n}\n\n// A date's classes, from React Aria's render state. StyleX cannot target\n// `[data-selected]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order matters. `selected` is applied after `today`, so a selected today\n// takes the fill rather than the outline — a circle already says where you\n// are, and two rings would say it twice. `disabled` is last of all, and\n// StyleX replaces a property whole, so it takes the hover branches with it.\nfunction cellClassName(state: {\n isDisabled: boolean;\n isSelected: boolean;\n isToday: boolean;\n}) {\n return stylex.props(calendarStyles.cell, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellSelected, state.isDisabled && calendarStyles.cellDisabled).className ?? '';\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <RACCalendarCell className={cellClassName} date={date} />;\n}\nexport type { CalendarProps };\nexport default Calendar;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,SAAA,WAAA,SAAA;CAAA,MAAA,IAAA,EAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,SAAA;EACwC,KAAA,oBAAoB,MAAa,eAAc,IAAK,GAAG,OAAK;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EAC/F,KAAA,oBAAC,gBAAD,CAAe,CAAA;EACN,KAAA,MAAa,eAAc,MAAO;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA;EAAA,KAAA,EAAA;EAAA,KAAA,EAAA;CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,QAAA,iBAAA,QAAA;EACzC,KAAA,aAAa,QAAK,iBAAwB,UAA7B,CAAkC,CAAC,CAAA,IAAK,KAGlC;EAAC,EAAA,KAAA,QAAA,iBAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAJvB,KAAA,oBAAA,OAAA;GAKM,GALG;GACN,UAAA;EAIG,CAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,WAAA,EAAA,OAAA,MAAA,EAAA,QAAA,IAAA;EAPH,KAAA,qBAAC,UAAD;GAAY,GAAQ;GAAK,GAAM;GAA/B,UAAA,CACH,IACA,EAFe;;EAQH,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OART;AAQS;AATlB,SAAA,MAAA,QAAA;CAAA,OAIwE,qBAAC,cAAD;EAA6C;EAAM,GAAM,MAAa,eAAc,IAAK;EAAzF,UAAA,CAC5D,oBAAC,sBAAD,CAAmB,CAAA,GACnB,oBAAC,kBAAD,EAAA,UAAsB,SAAF,CAAA,CAFwD;CAAM,GAAA,OAAM,MAAZ;AAG5D;AAa5B,SAAS,cAAc,OAIpB;CACD,OAAO,MAAa,eAAe,MAAM,MAAM,WAAW,eAAe,WAAW,MAAM,cAAc,eAAe,cAAc,MAAM,cAAc,eAAe,YAAY,CAAC,CAAC,aAAa;AACrM;AACA,SAAS,SAAS,MAAkC;CAClD,OAAO,oBAAC,cAAD;EAAiB,WAAW;EAAqB;CAAK,CAAA;AAC/D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
import { ColorAreaProps } from "react-aria-components";
|
|
3
|
+
//#region src/components/color-area/index.d.ts
|
|
4
|
+
type ColorAreaProps$1 = Omit<ColorAreaProps, 'children' | 'className' | 'style'> & {
|
|
5
|
+
/**
|
|
6
|
+
* Lands on the square around the plane, which is the element a layout
|
|
7
|
+
* positions and the one that carries its size.
|
|
8
|
+
*/
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Lands on the square around the plane, as `className` does. */
|
|
11
|
+
style?: CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Two channels of a colour as a plane, with a handle where they meet. The
|
|
15
|
+
* value is React Aria's: pass `value` with `onChange` to control it, or
|
|
16
|
+
* `defaultValue`, as a CSS colour string or a `Color` from `parseColor`,
|
|
17
|
+
* which this package re-exports.
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <ColorArea
|
|
21
|
+
* defaultValue="hsl(200, 100%, 50%)"
|
|
22
|
+
* xChannel="saturation"
|
|
23
|
+
* yChannel="lightness"
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* **`xChannel` and `yChannel` have to name channels the value's own space
|
|
28
|
+
* has.** A hex or `rgb()` value parses as RGB, which has no saturation, so
|
|
29
|
+
* naming one against it throws rather than converting — pass `colorSpace` to
|
|
30
|
+
* convert it, or give the value in the space you mean to work in. The same
|
|
31
|
+
* trap `ColorSlider` documents.
|
|
32
|
+
*
|
|
33
|
+
* **`alpha` is a channel here only in RGB.** Asked for it in HSL, React Aria
|
|
34
|
+
* quietly draws the saturation and lightness plane instead, so a plane that
|
|
35
|
+
* will not fade is the only sign anything was ignored.
|
|
36
|
+
*
|
|
37
|
+
* React Aria names the handle "Color picker" and announces both channels;
|
|
38
|
+
* pass `aria-label` to say what the plane is for instead.
|
|
39
|
+
*
|
|
40
|
+
* The call site's `className` and `style` land on the square around the
|
|
41
|
+
* plane rather than on the plane itself, so setting an `inlineSize` is what
|
|
42
|
+
* resizes one — and it stays square, since two channels sharing a box want
|
|
43
|
+
* equal travel. React Aria's function forms are not taken here for the same
|
|
44
|
+
* reason `ColorSwatch` does not take them: the element they would read
|
|
45
|
+
* state for is not the one a layout reaches.
|
|
46
|
+
*/
|
|
47
|
+
declare function ColorArea$1({ className, isDisabled, style, ...props }: ColorAreaProps$1): import("react").JSX.Element;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { type ColorAreaProps$1 as ColorAreaProps, ColorArea$1 as default };
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { mergeStyles } from "../../styles/merge.js";
|
|
2
|
+
import { thumbClassName } from "../../styles/color.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { ColorArea, ColorThumb } from "react-aria-components";
|
|
5
|
+
//#region src/components/color-area/index.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Two channels of a colour as a plane, with a handle where they meet. The
|
|
8
|
+
* value is React Aria's: pass `value` with `onChange` to control it, or
|
|
9
|
+
* `defaultValue`, as a CSS colour string or a `Color` from `parseColor`,
|
|
10
|
+
* which this package re-exports.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <ColorArea
|
|
14
|
+
* defaultValue="hsl(200, 100%, 50%)"
|
|
15
|
+
* xChannel="saturation"
|
|
16
|
+
* yChannel="lightness"
|
|
17
|
+
* />
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* **`xChannel` and `yChannel` have to name channels the value's own space
|
|
21
|
+
* has.** A hex or `rgb()` value parses as RGB, which has no saturation, so
|
|
22
|
+
* naming one against it throws rather than converting — pass `colorSpace` to
|
|
23
|
+
* convert it, or give the value in the space you mean to work in. The same
|
|
24
|
+
* trap `ColorSlider` documents.
|
|
25
|
+
*
|
|
26
|
+
* **`alpha` is a channel here only in RGB.** Asked for it in HSL, React Aria
|
|
27
|
+
* quietly draws the saturation and lightness plane instead, so a plane that
|
|
28
|
+
* will not fade is the only sign anything was ignored.
|
|
29
|
+
*
|
|
30
|
+
* React Aria names the handle "Color picker" and announces both channels;
|
|
31
|
+
* pass `aria-label` to say what the plane is for instead.
|
|
32
|
+
*
|
|
33
|
+
* The call site's `className` and `style` land on the square around the
|
|
34
|
+
* plane rather than on the plane itself, so setting an `inlineSize` is what
|
|
35
|
+
* resizes one — and it stays square, since two channels sharing a box want
|
|
36
|
+
* equal travel. React Aria's function forms are not taken here for the same
|
|
37
|
+
* reason `ColorSwatch` does not take them: the element they would read
|
|
38
|
+
* state for is not the one a layout reaches.
|
|
39
|
+
*/
|
|
40
|
+
function ColorArea$1({ className, isDisabled = false, style, ...props }) {
|
|
41
|
+
return /* @__PURE__ */ jsx("div", {
|
|
42
|
+
...mergeStyles({
|
|
43
|
+
0: { className: "x1plog1 x1xdvaa9 x9f619 xh8yej3" },
|
|
44
|
+
1: { className: "x1plog1 x1xdvaa9 x9f619 xh8yej3 x1ppv7y9" }
|
|
45
|
+
}[!!isDisabled << 0], {
|
|
46
|
+
className,
|
|
47
|
+
style
|
|
48
|
+
}),
|
|
49
|
+
children: /* @__PURE__ */ jsx(ColorArea, {
|
|
50
|
+
isDisabled,
|
|
51
|
+
...props,
|
|
52
|
+
...{
|
|
53
|
+
0: { className: "x5yr21d x1xdvaa9 x9f619 xsid9ct xh8yej3 x5ve5x3" },
|
|
54
|
+
1: { className: "x5yr21d x1xdvaa9 x9f619 xh8yej3 x5ve5x3 x1h6gzvc" }
|
|
55
|
+
}[!!isDisabled << 0],
|
|
56
|
+
children: /* @__PURE__ */ jsx(ColorThumb, { className: thumbClassName })
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { ColorArea$1 as default };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/color-area/index.tsx"],"sourcesContent":["import type { CSSProperties } from 'react';\nimport type { ColorAreaProps as RACColorAreaProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorArea as RACColorArea, ColorThumb as RACColorThumb } from 'react-aria-components';\nimport { thumbClassName } from '../../styles/color';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { radii, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// Two channels of a colour at once, as a plane: one runs along the inline\n// axis and one along the block axis, and the handle sits where they meet.\n// React Aria paints both gradients on the plane's own inline `background`\n// and moves the handle in two axes, so what is here is the plane's shape and\n// the handle `ColorSlider` already draws, from `src/styles/color.ts`.\n//\n// The design carries no page for this, so the two choices below are the\n// library's own.\n//\n// **It is square, and takes the width it is given.** A plane has no natural\n// size, and a box that was not square would give its two channels unequal\n// travel — the same drag would move one further than the other, which is a\n// difference a reader cannot see and would feel as the control being wrong.\n//\n// **It carries no chequer, unlike a swatch or a colour slider's alpha\n// track.** Those two show the surface behind them where a colour thins out,\n// and a plane does not: React Aria stacks its gradients so the topmost is\n// opaque across the whole box, so nothing laid behind the plane is ever\n// seen. A chequer here was written first and then taken out, because it\n// could not be made to show under any pairing tried — including the RGB\n// alpha pairing whose gradient really does carry a `rgba(0, 0, 0, 0)` stop.\n//\n// **Alpha is a channel here only in RGB, and even there it does not thin\n// the plane.** Asked for it in HSL, React Aria draws the saturation and\n// lightness plane instead and says nothing — the gradients come out\n// identical to the pair it would have drawn anyway. It does not throw the\n// way an unknown channel does, so the only sign is a plane that will not\n// change, which is why it is written down here.\n\ntype ColorAreaProps = Omit<RACColorAreaProps, 'children' | 'className' | 'style'> & {\n /**\n * Lands on the square around the plane, which is the element a layout\n * positions and the one that carries its size.\n */\n className?: string;\n /** Lands on the square around the plane, as `className` does. */\n style?: CSSProperties;\n};\n\n/**\n * Two channels of a colour as a plane, with a handle where they meet. The\n * value is React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue`, as a CSS colour string or a `Color` from `parseColor`,\n * which this package re-exports.\n *\n * ```tsx\n * <ColorArea\n * defaultValue=\"hsl(200, 100%, 50%)\"\n * xChannel=\"saturation\"\n * yChannel=\"lightness\"\n * />\n * ```\n *\n * **`xChannel` and `yChannel` have to name channels the value's own space\n * has.** A hex or `rgb()` value parses as RGB, which has no saturation, so\n * naming one against it throws rather than converting — pass `colorSpace` to\n * convert it, or give the value in the space you mean to work in. The same\n * trap `ColorSlider` documents.\n *\n * **`alpha` is a channel here only in RGB.** Asked for it in HSL, React Aria\n * quietly draws the saturation and lightness plane instead, so a plane that\n * will not fade is the only sign anything was ignored.\n *\n * React Aria names the handle \"Color picker\" and announces both channels;\n * pass `aria-label` to say what the plane is for instead.\n *\n * The call site's `className` and `style` land on the square around the\n * plane rather than on the plane itself, so setting an `inlineSize` is what\n * resizes one — and it stays square, since two channels sharing a box want\n * equal travel. React Aria's function forms are not taken here for the same\n * reason `ColorSwatch` does not take them: the element they would read\n * state for is not the one a layout reaches.\n */\nfunction ColorArea({\n className,\n isDisabled = false,\n style,\n ...props\n}: ColorAreaProps) {\n return <div {...mergeStyles({\n 0: {\n className: \"x1plog1 x1xdvaa9 x9f619 xh8yej3\"\n },\n 1: {\n className: \"x1plog1 x1xdvaa9 x9f619 xh8yej3 x1ppv7y9\"\n }\n }[!!isDisabled << 0], {\n className,\n style\n })}>\n <RACColorArea isDisabled={isDisabled} {...props} {...{\n 0: {\n className: \"x5yr21d x1xdvaa9 x9f619 xsid9ct xh8yej3 x5ve5x3\"\n },\n 1: {\n className: \"x5yr21d x1xdvaa9 x9f619 xh8yej3 x5ve5x3 x1h6gzvc\"\n }\n }[!!isDisabled << 0]}>\n <RACColorThumb className={thumbClassName} />\n </RACColorArea>\n </div>;\n}\nexport type { ColorAreaProps };\nexport default ColorArea;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFA,SAAS,YAAU,EACjB,WACA,aAAa,OACb,OACA,GAAG,SACc;CACjB,OAAO,oBAAC,OAAD;EAAK,GAAI,YAAY;GAC1B,GAAG,EACD,WAAW,kCACb;GACA,GAAG,EACD,WAAW,2CACb;EACF,EAAE,CAAC,CAAC,cAAc,IAAI;GACpB;GACA;EACF,CAAC;EACG,UAAA,oBAAC,WAAD;GAA0B;GAAY,GAAI;GAAO,GAAI;IACrD,GAAG,EACD,WAAW,kDACb;IACA,GAAG,EACD,WAAW,mDACb;GACF,EAAE,CAAC,CAAC,cAAc;GACd,UAAA,oBAAC,YAAD,EAAe,WAAW,eAAe,CAAA;EAC7B,CAAA;CACX,CAAA;AACT"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ColorSliderProps } from "react-aria-components";
|
|
2
|
+
//#region src/components/color-slider/index.d.ts
|
|
3
|
+
type ColorSliderProps$1 = Omit<ColorSliderProps, 'children' | 'className' | 'style'> & {
|
|
4
|
+
/** A function may compute the class from the slider's render state. */
|
|
5
|
+
className?: ColorSliderProps['className'];
|
|
6
|
+
/** What the slider is for. Always rendered; React Aria names the channel otherwise. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the value React Aria announces is also shown, at the end of the
|
|
10
|
+
* label's line.
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
showValue?: boolean;
|
|
14
|
+
/** A function may compute the style from the slider's render state. */
|
|
15
|
+
style?: ColorSliderProps['style'];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A slider over one channel of a colour — hue, saturation, lightness, alpha
|
|
19
|
+
* and the rest. The value is React Aria's: pass `value` with `onChange` to
|
|
20
|
+
* control it, or `defaultValue`, as a CSS colour string or a `Color` from
|
|
21
|
+
* `parseColor`, which this package re-exports.
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <ColorSlider channel="hue" defaultValue="hsl(200, 100%, 50%)" label="Label" />
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* **`channel` has to name a channel the value's own space has.** A hex or
|
|
28
|
+
* `rgb()` value parses as RGB, which has no hue, so `channel="hue"` against
|
|
29
|
+
* one throws rather than converting — pass `colorSpace="hsl"` to convert it,
|
|
30
|
+
* or give the value in the space you mean to slide.
|
|
31
|
+
*
|
|
32
|
+
* React Aria paints the gradient and names the value — "200°, cyan blue" —
|
|
33
|
+
* so the readout beside the label is what it announces.
|
|
34
|
+
*
|
|
35
|
+
* The call site's `className` and `style` land on the slider as a whole,
|
|
36
|
+
* which is the element a layout positions.
|
|
37
|
+
*/
|
|
38
|
+
declare function ColorSlider$1({ isDisabled, label, showValue, ...props }: ColorSliderProps$1): import("react").JSX.Element;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { type ColorSliderProps$1 as ColorSliderProps, ColorSlider$1 as default };
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|