@sharadox/graphical-user-interface-web-library 0.2.0-development.29 → 0.2.0-disclosure.31
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 +3 -0
- package/distribution/accordion/index.d.ts +11 -0
- package/distribution/accordion/index.d.ts.map +1 -0
- package/distribution/accordion/index.js +36 -0
- package/distribution/accordion/index.js.map +1 -0
- package/distribution/accordion/index.module.css +1 -0
- package/distribution/accordion/index.module.scss +56 -0
- package/distribution/accordion/type.d.ts +21 -0
- package/distribution/accordion/type.d.ts.map +1 -0
- package/distribution/accordion/type.js +2 -0
- package/distribution/accordion/type.js.map +1 -0
- package/distribution/button/index.js +1 -1
- package/distribution/button/index.js.map +1 -1
- package/distribution/date-picker/index.d.ts +35 -0
- package/distribution/date-picker/index.d.ts.map +1 -0
- package/distribution/date-picker/index.js +161 -0
- package/distribution/date-picker/index.js.map +1 -0
- package/distribution/date-picker/index.module.css +1 -0
- package/distribution/date-picker/index.module.scss +70 -0
- package/distribution/date-picker/type.d.ts +41 -0
- package/distribution/date-picker/type.d.ts.map +1 -0
- package/distribution/date-picker/type.js +2 -0
- package/distribution/date-picker/type.js.map +1 -0
- package/distribution/tabs/index.d.ts +11 -0
- package/distribution/tabs/index.d.ts.map +1 -0
- package/distribution/tabs/index.js +45 -0
- package/distribution/tabs/index.js.map +1 -0
- package/distribution/tabs/index.module.css +1 -0
- package/distribution/tabs/index.module.scss +13 -0
- package/distribution/tabs/type.d.ts +19 -0
- package/distribution/tabs/type.d.ts.map +1 -0
- package/distribution/tabs/type.js +2 -0
- package/distribution/tabs/type.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,6 +113,9 @@ everything below it: on the page, in one part of it, or on one piece.
|
|
|
113
113
|
| `…/copy-button` | `CopyButton({ value, label, copiedLabel, onCopied? })` | Copies a value and says so for two seconds |
|
|
114
114
|
| `…/code-boxes` | `CodeBoxes({ label, digitLabel, ofLabel, name?, length?, onComplete? })` | One field box per digit of a one-time code |
|
|
115
115
|
| `…/navigation` | `Navigation({ brand, label, links, actions?, menuLabel, closeLabel, collapse? })` | The sticky bar, and a phone menu below `collapse` (960) |
|
|
116
|
+
| `…/tabs` | `Tabs({ label, tabs, value?, defaultValue?, onChange? })` | Tab buttons over the chosen tab's panel, with the arrow keys |
|
|
117
|
+
| `…/accordion` | `Accordion({ items, multiple?, open?, defaultOpen?, onChange? })` | Titles that open and close their content smoothly |
|
|
118
|
+
| `…/date-picker` | `DatePicker({ label, value?, min?, max?, locale?, previousLabel, nextLabel })`, `parseDay`, `formatDay`, `monthDays` | A field opening a calendar grid |
|
|
116
119
|
|
|
117
120
|
### Box
|
|
118
121
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AccordionProperties } from "@sharadox/graphical-user-interface-web-library/accordion/type";
|
|
2
|
+
/**
|
|
3
|
+
* An accordion: titles that open and close their content, smoothly (its height grows and shrinks). Each title is a
|
|
4
|
+
* heading holding a button, which says whether its region is open; a closed region is inert. One item open at a time,
|
|
5
|
+
* or several with `multiple`. Each item is a box (outlined foreground by default).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Accordion items={[{ value: "price", title: "How much is it?", content: <p>…</p> }]} />
|
|
9
|
+
*/
|
|
10
|
+
export declare function Accordion(properties: AccordionProperties): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/accordion/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAC;AAGzG;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,mBAAmB,+BA6DxD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { Icon } from "@sharadox/icon-web-library/icon";
|
|
5
|
+
import { Box } from "@sharadox/graphical-user-interface-web-library/box";
|
|
6
|
+
import styles from "./index.module.css";
|
|
7
|
+
/**
|
|
8
|
+
* An accordion: titles that open and close their content, smoothly (its height grows and shrinks). Each title is a
|
|
9
|
+
* heading holding a button, which says whether its region is open; a closed region is inert. One item open at a time,
|
|
10
|
+
* or several with `multiple`. Each item is a box (outlined foreground by default).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <Accordion items={[{ value: "price", title: "How much is it?", content: <p>…</p> }]} />
|
|
14
|
+
*/
|
|
15
|
+
export function Accordion(properties) {
|
|
16
|
+
const { items, multiple, open, defaultOpen = [], onChange, headingLevel = 3, className, variant = "outlined", color = "foreground", ...look } = properties;
|
|
17
|
+
const id = useId();
|
|
18
|
+
const [own, setOwn] = useState(defaultOpen);
|
|
19
|
+
const current = open ?? own;
|
|
20
|
+
const Heading = `h${headingLevel}`;
|
|
21
|
+
const toggle = (value) => {
|
|
22
|
+
const next = current.includes(value)
|
|
23
|
+
? current.filter((entry) => entry !== value)
|
|
24
|
+
: multiple
|
|
25
|
+
? [...current, value]
|
|
26
|
+
: [value];
|
|
27
|
+
if (open === undefined)
|
|
28
|
+
setOwn(next);
|
|
29
|
+
onChange?.(next);
|
|
30
|
+
};
|
|
31
|
+
return (_jsx(Box, { direction: "top-to-bottom", align: "stretch", gap: 8, className: className, children: items.map((item, index) => {
|
|
32
|
+
const expanded = current.includes(item.value);
|
|
33
|
+
return (_jsxs(Box, { variant: variant, color: color, direction: "top-to-bottom", align: "stretch", ...look, children: [_jsx(Heading, { className: styles.heading, children: _jsxs("button", { type: "button", id: `${id}-${index}`, "aria-expanded": expanded, "aria-controls": `${id}-${index}-region`, onClick: () => toggle(item.value), className: styles.button, children: [_jsx("span", { children: item.title }), _jsx(Icon, { name: "chevron-down", className: styles.chevron })] }) }), _jsx("div", { id: `${id}-${index}-region`, role: "region", "aria-labelledby": `${id}-${index}`, ...(expanded ? { "data-open": "" } : { inert: true }), className: styles.region, children: _jsx("div", { className: styles.inner, children: _jsx("div", { className: styles.content, children: item.content }) }) })] }, item.value));
|
|
34
|
+
}) }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/accordion/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AAEzE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,UAA+B;IACvD,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,WAAW,GAAG,EAAE,EAChB,QAAQ,EACR,YAAY,GAAG,CAAC,EAChB,SAAS,EACT,OAAO,GAAG,UAAU,EACpB,KAAK,GAAG,YAAY,EACpB,GAAG,IAAI,EACR,GAAG,UAAU,CAAC;IACf,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAoB,WAAW,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,IAAI,IAAI,GAAG,CAAC;IAC5B,MAAM,OAAO,GAAG,IAAI,YAAY,EAAW,CAAC;IAC5C,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE;QAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;YAClC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC;YAC5C,CAAC,C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W,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EACtD,SAAS,EAAE,MAAM,CAAC,MAAM,YAExB,cAAK,SAAS,EAAE,MAAM,CAAC,KAAK,YAC1B,cAAK,SAAS,EAAE,MAAM,CAAC,OAAO,YAAG,IAAI,CAAC,OAAO,GAAO,GAChD,GACF,KAxBE,IAAI,CAAC,KAAK,CAyBd,CACP,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.heading){margin:0;font-size:inherit}:where(.button){display:flex;justify-content:space-between;align-items:center;gap:var(--scale-16);inline-size:100%;min-block-size:var(--large-minimum-size);padding:var(--scale-12) var(--scale-16);border:0;background:none;color:inherit;font:inherit;font-weight:var(--interactive-font-weight);text-align:start;cursor:pointer}:where(.button):focus-visible{outline:var(--focus-thickness) solid var(--current-color);outline-offset:calc(-1*var(--focus-thickness))}:where(.chevron){flex:none;transition:transform var(--duration) var(--easing)}:where(.button[aria-expanded=true]) :where(.chevron){transform:rotate(180deg)}:where(.region){display:grid;grid-template-rows:0fr;transition:grid-template-rows var(--duration) var(--easing)}:where(.region[data-open]){grid-template-rows:1fr}:where(.inner){min-block-size:0;overflow:hidden}:where(.content){padding:0 var(--scale-16) var(--scale-16);text-align:start}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
:where(.heading) {
|
|
2
|
+
margin: 0;
|
|
3
|
+
font-size: inherit;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:where(.button) {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: var(--scale-16);
|
|
11
|
+
inline-size: 100%;
|
|
12
|
+
min-block-size: var(--large-minimum-size);
|
|
13
|
+
padding: var(--scale-12) var(--scale-16);
|
|
14
|
+
border: 0;
|
|
15
|
+
background: none;
|
|
16
|
+
color: inherit;
|
|
17
|
+
font: inherit;
|
|
18
|
+
font-weight: var(--interactive-font-weight);
|
|
19
|
+
text-align: start;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
|
|
22
|
+
&:focus-visible {
|
|
23
|
+
outline: var(--focus-thickness) solid var(--current-color);
|
|
24
|
+
outline-offset: calc(-1 * var(--focus-thickness));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:where(.chevron) {
|
|
29
|
+
flex: none;
|
|
30
|
+
transition: transform var(--duration) var(--easing);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:where(.button[aria-expanded="true"]) :where(.chevron) {
|
|
34
|
+
transform: rotate(180deg);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// The region grows from nothing to its content's height (a grid row from 0fr to 1fr), and back.
|
|
38
|
+
:where(.region) {
|
|
39
|
+
display: grid;
|
|
40
|
+
grid-template-rows: 0fr;
|
|
41
|
+
transition: grid-template-rows var(--duration) var(--easing);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:where(.region[data-open]) {
|
|
45
|
+
grid-template-rows: 1fr;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:where(.inner) {
|
|
49
|
+
min-block-size: 0;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:where(.content) {
|
|
54
|
+
padding: 0 var(--scale-16) var(--scale-16);
|
|
55
|
+
text-align: start;
|
|
56
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { BoxLook } from "@sharadox/graphical-user-interface-web-library/box/type";
|
|
3
|
+
export interface AccordionItem {
|
|
4
|
+
value: string;
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface AccordionProperties extends Pick<BoxLook, "variant" | "color" | "corner" | "line"> {
|
|
9
|
+
items: readonly AccordionItem[];
|
|
10
|
+
/** Several open at once (one at a time by default). */
|
|
11
|
+
multiple?: boolean;
|
|
12
|
+
/** Controlled: the open items. */
|
|
13
|
+
open?: readonly string[];
|
|
14
|
+
/** Uncontrolled: the items open at first. */
|
|
15
|
+
defaultOpen?: readonly string[];
|
|
16
|
+
onChange?: (open: string[]) => void;
|
|
17
|
+
/** The titles' heading level (3 by default), to fit the page's outline. */
|
|
18
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/accordion/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yDAAyD,CAAC;AAEvF,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IACjG,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kCAAkC;IAClC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,2EAA2E;IAC3E,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/accordion/type.ts"],"names":[],"mappings":""}
|
|
@@ -37,6 +37,6 @@ export function Button(properties) {
|
|
|
37
37
|
}
|
|
38
38
|
const { type = "button", link: _link, ...button } = box;
|
|
39
39
|
void _link;
|
|
40
|
-
return (_jsx(Box, { ...button, as: "button", type: type, disabled:
|
|
40
|
+
return (_jsx(Box, { ...button, as: "button", type: type, disabled: disabled, children: content }));
|
|
41
41
|
}
|
|
42
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/button/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AAIzE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,MAAM,CAAC,UAA4B;IACjD,MAAM,EACJ,OAAO,GAAG,QAAQ,EAClB,KAAK,GAAG,OAAO,EACf,KAAK,EACL,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,OAAO,EACP,GAAG,IAAI,EACR,GAAG,UAAU,CAAC;IACf,MAAM,YAAY,GAAa,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAClG,MAAM,OAAO,GAAG,YAAY,KAAK,SAAS,IAAI,YAAY,KAAK,UAAU,CAAC;IAC1E,MAAM,KAAK,GAAG,CAAC,KAA8B,EAAE,EAAE;QAC/C,IAAI,OAAO;YAAE,KAAK,CAAC,cAAc,EAAE,CAAC;;YAC9B,OAAkE,EAAE,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AAM,EAAE,EAAE,EAAC,GAAG,EAAC,IAAI,EAAC,MAAM,YAChC,OAAO,GACJ,CACP,CAAC;QACJ,CAAC;QACD,OAAO,CACL,KAAC,GAAG,OAAK,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,YACpC,OAAO,GACJ,CACP,CAAC;IACJ,CAAC;IACD,MAAM,EAAE,IAAI,GAAG,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,GAAG,GAAuD,CAAC;IAC5G,KAAK,KAAK,CAAC;IACX,OAAO,CACL,KAAC,GAAG,OAAK,MAAM,EAAE,EAAE,EAAC,QAAQ,EAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,YACxD,OAAO,GACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DatePickerProperties, Day } from "@sharadox/graphical-user-interface-web-library/date-picker/type";
|
|
2
|
+
/**
|
|
3
|
+
* A day written as `yyyy-mm-dd`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* formatDay({ year: 2026, month: 1, day: 28 }); // "2026-02-28"
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatDay({ year, month, day }: Day): string;
|
|
9
|
+
/**
|
|
10
|
+
* A `yyyy-mm-dd` day, or `undefined` when it isn't one (a 13th month, a 30th of February).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* parseDay("2026-02-28"); // { year: 2026, month: 1, day: 28 }
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseDay(text: string | undefined): Day | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* A month's calendar: whole weeks (starting on `weekStart`, 1 for Monday or 0 for Sunday) as `yyyy-mm-dd` days,
|
|
18
|
+
* with the days of the months before and after that fill them.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* monthDays(2026, 1, 1)[0]; // ["2026-01-26", …, "2026-02-01"]
|
|
22
|
+
*/
|
|
23
|
+
export declare function monthDays(year: number, month: number, weekStart: 0 | 1): string[][];
|
|
24
|
+
/**
|
|
25
|
+
* A date picker: a field box showing the chosen day in the page's language, with a calendar section, opening a
|
|
26
|
+
* calendar under it. The calendar's grid follows the ARIA date picker pattern: the arrows move by day and week,
|
|
27
|
+
* Home and End to the week's start and end, Page Up and Page Down by month, Enter chooses, Escape closes; the month
|
|
28
|
+
* buttons change month; days outside `min` and `max` can't be chosen; a press outside closes. Days are `yyyy-mm-dd`,
|
|
29
|
+
* free of time zones, and with a `name` the day goes in a hidden field for forms.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* <DatePicker label="Visit" name="visit" locale="pt-PT" min={today} previousLabel="Mês anterior" nextLabel="Mês seguinte" />
|
|
33
|
+
*/
|
|
34
|
+
export declare function DatePicker(properties: DatePickerProperties): import("react").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/date-picker/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,iEAAiE,CAAC;AAKjH;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,GAAG,GAAG,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,GAAG,SAAS,CAMlE;AAiBD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE,EAAE,CAQnF;AAQD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,oBAAoB,+BA0N1D"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { Icon } from "@sharadox/icon-web-library/icon";
|
|
5
|
+
import { classNames } from "@sharadox/web-library/class-name";
|
|
6
|
+
import { Box } from "@sharadox/graphical-user-interface-web-library/box";
|
|
7
|
+
import { Button } from "@sharadox/graphical-user-interface-web-library/button";
|
|
8
|
+
import { Field } from "@sharadox/graphical-user-interface-web-library/field";
|
|
9
|
+
import styles from "./index.module.css";
|
|
10
|
+
const pad = (number, length = 2) => String(number).padStart(length, "0");
|
|
11
|
+
/**
|
|
12
|
+
* A day written as `yyyy-mm-dd`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* formatDay({ year: 2026, month: 1, day: 28 }); // "2026-02-28"
|
|
16
|
+
*/
|
|
17
|
+
export function formatDay({ year, month, day }) {
|
|
18
|
+
return `${pad(year, 4)}-${pad(month + 1)}-${pad(day)}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A `yyyy-mm-dd` day, or `undefined` when it isn't one (a 13th month, a 30th of February).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* parseDay("2026-02-28"); // { year: 2026, month: 1, day: 28 }
|
|
25
|
+
*/
|
|
26
|
+
export function parseDay(text) {
|
|
27
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text ?? "");
|
|
28
|
+
if (!match)
|
|
29
|
+
return undefined;
|
|
30
|
+
const [year, month, day] = [Number(match[1]), Number(match[2]) - 1, Number(match[3])];
|
|
31
|
+
const date = new Date(Date.UTC(year, month, day));
|
|
32
|
+
return date.getUTCMonth() === month && date.getUTCDate() === day ? { year, month, day } : undefined;
|
|
33
|
+
}
|
|
34
|
+
/** The day `days` after a day (before, when negative). */
|
|
35
|
+
const addDays = (text, days) => {
|
|
36
|
+
const { year, month, day } = parseDay(text);
|
|
37
|
+
const date = new Date(Date.UTC(year, month, day + days));
|
|
38
|
+
return formatDay({ year: date.getUTCFullYear(), month: date.getUTCMonth(), day: date.getUTCDate() });
|
|
39
|
+
};
|
|
40
|
+
/** The same day `months` later (the month's last day when it has fewer). */
|
|
41
|
+
const addMonths = (text, months) => {
|
|
42
|
+
const { year, month, day } = parseDay(text);
|
|
43
|
+
const last = new Date(Date.UTC(year, month + months + 1, 0)).getUTCDate();
|
|
44
|
+
const date = new Date(Date.UTC(year, month + months, Math.min(day, last)));
|
|
45
|
+
return formatDay({ year: date.getUTCFullYear(), month: date.getUTCMonth(), day: date.getUTCDate() });
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A month's calendar: whole weeks (starting on `weekStart`, 1 for Monday or 0 for Sunday) as `yyyy-mm-dd` days,
|
|
49
|
+
* with the days of the months before and after that fill them.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* monthDays(2026, 1, 1)[0]; // ["2026-01-26", …, "2026-02-01"]
|
|
53
|
+
*/
|
|
54
|
+
export function monthDays(year, month, weekStart) {
|
|
55
|
+
const first = formatDay({ year, month, day: 1 });
|
|
56
|
+
const lead = (new Date(Date.UTC(year, month, 1)).getUTCDay() - weekStart + 7) % 7;
|
|
57
|
+
const length = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
|
58
|
+
const weeks = Math.ceil((lead + length) / 7);
|
|
59
|
+
return Array.from({ length: weeks }, (_, week) => Array.from({ length: 7 }, (_, weekday) => addDays(first, week * 7 + weekday - lead)));
|
|
60
|
+
}
|
|
61
|
+
/** Today on this device, as `yyyy-mm-dd`. */
|
|
62
|
+
const deviceToday = () => {
|
|
63
|
+
const now = new Date();
|
|
64
|
+
return formatDay({ year: now.getFullYear(), month: now.getMonth(), day: now.getDate() });
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* A date picker: a field box showing the chosen day in the page's language, with a calendar section, opening a
|
|
68
|
+
* calendar under it. The calendar's grid follows the ARIA date picker pattern: the arrows move by day and week,
|
|
69
|
+
* Home and End to the week's start and end, Page Up and Page Down by month, Enter chooses, Escape closes; the month
|
|
70
|
+
* buttons change month; days outside `min` and `max` can't be chosen; a press outside closes. Days are `yyyy-mm-dd`,
|
|
71
|
+
* free of time zones, and with a `name` the day goes in a hidden field for forms.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* <DatePicker label="Visit" name="visit" locale="pt-PT" min={today} previousLabel="Mês anterior" nextLabel="Mês seguinte" />
|
|
75
|
+
*/
|
|
76
|
+
export function DatePicker(properties) {
|
|
77
|
+
const { label, hideLabel, hint, error, value, defaultValue, onChange, name, min, max, locale = "en", weekStart = 1, today = deviceToday(), placeholder, previousLabel, nextLabel, disabled, state, id, className, color, variant = "outlined", ...look } = properties;
|
|
78
|
+
const [own, setOwn] = useState(defaultValue ?? "");
|
|
79
|
+
const chosen = value ?? own;
|
|
80
|
+
const [open, setOpen] = useState(false);
|
|
81
|
+
const [focused, setFocused] = useState(chosen || today);
|
|
82
|
+
const root = useRef(null);
|
|
83
|
+
const field = useRef(null);
|
|
84
|
+
const write = (text, options) => {
|
|
85
|
+
const { year, month, day } = parseDay(text);
|
|
86
|
+
return new Intl.DateTimeFormat(locale, { ...options, timeZone: "UTC" }).format(new Date(Date.UTC(year, month, day)));
|
|
87
|
+
};
|
|
88
|
+
const allowed = (day) => (min === undefined || day >= min) && (max === undefined || day <= max);
|
|
89
|
+
const view = parseDay(focused);
|
|
90
|
+
const monthStart = formatDay({ ...view, day: 1 });
|
|
91
|
+
const weeks = monthDays(view.year, view.month, weekStart);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (!open)
|
|
94
|
+
return;
|
|
95
|
+
root.current?.querySelector(`[data-day="${focused}"]`)?.focus();
|
|
96
|
+
}, [open, focused]);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (!open)
|
|
99
|
+
return;
|
|
100
|
+
const outside = (event) => {
|
|
101
|
+
if (!root.current.contains(event.target))
|
|
102
|
+
setOpen(false);
|
|
103
|
+
};
|
|
104
|
+
document.addEventListener("pointerdown", outside);
|
|
105
|
+
return () => document.removeEventListener("pointerdown", outside);
|
|
106
|
+
}, [open]);
|
|
107
|
+
const show = () => {
|
|
108
|
+
setFocused(chosen || today);
|
|
109
|
+
setOpen(true);
|
|
110
|
+
};
|
|
111
|
+
const choose = (day) => {
|
|
112
|
+
if (!allowed(day))
|
|
113
|
+
return;
|
|
114
|
+
if (value === undefined)
|
|
115
|
+
setOwn(day);
|
|
116
|
+
onChange?.(day);
|
|
117
|
+
setOpen(false);
|
|
118
|
+
field.current?.focus();
|
|
119
|
+
};
|
|
120
|
+
const keyDown = (event) => {
|
|
121
|
+
const weekday = (new Date(Date.UTC(view.year, view.month, view.day)).getUTCDay() - weekStart + 7) % 7;
|
|
122
|
+
const moves = {
|
|
123
|
+
ArrowRight: () => addDays(focused, 1),
|
|
124
|
+
ArrowLeft: () => addDays(focused, -1),
|
|
125
|
+
ArrowDown: () => addDays(focused, 7),
|
|
126
|
+
ArrowUp: () => addDays(focused, -7),
|
|
127
|
+
Home: () => addDays(focused, -weekday),
|
|
128
|
+
End: () => addDays(focused, 6 - weekday),
|
|
129
|
+
PageDown: () => addMonths(focused, 1),
|
|
130
|
+
PageUp: () => addMonths(focused, -1),
|
|
131
|
+
};
|
|
132
|
+
if (event.key in moves) {
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
setFocused(moves[event.key]());
|
|
135
|
+
}
|
|
136
|
+
else if (event.key === "Enter") {
|
|
137
|
+
event.preventDefault();
|
|
138
|
+
choose(focused);
|
|
139
|
+
}
|
|
140
|
+
else if (event.key === "Escape") {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
setOpen(false);
|
|
143
|
+
field.current?.focus();
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const previousMonth = addMonths(monthStart, -1);
|
|
147
|
+
const nextMonth = addMonths(monthStart, 1);
|
|
148
|
+
const lastOfMonth = (start) => addDays(addMonths(start, 1), -1);
|
|
149
|
+
const weekdays = weeks[0].map((day) => ({
|
|
150
|
+
short: write(day, { weekday: "short" }).replace(/\.$/, "").slice(0, 2),
|
|
151
|
+
long: write(day, { weekday: "long" }),
|
|
152
|
+
}));
|
|
153
|
+
return (_jsx(Field, { label: label, hideLabel: hideLabel, hint: hint, error: error, id: id, className: className, children: (control) => (_jsxs("div", { ref: root, className: styles.anchor, children: [name && _jsx("input", { type: "hidden", name: name, value: chosen }), _jsx(Box, { field: true, variant: variant, color: color ?? (error === undefined ? "middleground" : "error"), state: state ?? (disabled ? "disabled" : "enabled"), suffix: _jsx(Icon, { name: "calendar" }), ...look, className: styles.field, children: _jsx("button", { ...control, ref: field, type: "button", "aria-haspopup": "dialog", "aria-expanded": open, disabled: disabled, onClick: () => (open ? setOpen(false) : show()), className: styles.button, children: _jsx("span", { className: classNames(!chosen && styles.placeholder), children: chosen ? write(chosen, { dateStyle: "long" }) : placeholder }) }) }), open && (_jsxs(Box, { role: "dialog", "aria-labelledby": `${control.id}-label`, variant: "outlined", color: "foreground", direction: "top-to-bottom", align: "stretch", gap: 8, padding: 12, className: styles.calendar, children: [_jsxs(Box, { justify: "space-between", gap: 8, children: [_jsx(Button, { square: true, variant: "transparent", color: "middleground", icon: "chevron-left", "aria-label": previousLabel, disabled: min !== undefined && lastOfMonth(previousMonth) < min, onClick: () => setFocused(addMonths(focused, -1)) }), _jsx("span", { "aria-live": "polite", className: styles.month, children: write(monthStart, { month: "long", year: "numeric" }) }), _jsx(Button, { square: true, variant: "transparent", color: "middleground", icon: "chevron-right", "aria-label": nextLabel, disabled: max !== undefined && nextMonth > max, onClick: () => setFocused(addMonths(focused, 1)) })] }), _jsxs("table", { role: "grid", className: styles.grid, children: [_jsx("thead", { children: _jsx("tr", { children: weekdays.map((weekday) => (_jsx("th", { role: "columnheader", abbr: weekday.long, className: styles.weekday, children: weekday.short }, weekday.long))) }) }), _jsx("tbody", { children: weeks.map((week) => (_jsx("tr", { children: week.map((day) => (_jsx("td", { role: "gridcell", "aria-selected": day === chosen, ...(parseDay(day).month !== view.month && { "data-outside": "" }), className: styles.cell, children: _jsx(Button, { "data-day": day, square: true, variant: day === chosen ? "filled" : "transparent", color: day === chosen
|
|
154
|
+
? "brand"
|
|
155
|
+
: parseDay(day).month === view.month
|
|
156
|
+
? "foreground"
|
|
157
|
+
: "middleground", tabIndex: day === focused ? 0 : -1, "aria-label": write(day, { dateStyle: "full" }), "aria-current": day === today ? "date" : undefined,
|
|
158
|
+
// Disabled but still focusable, so the arrow keys can pass over it.
|
|
159
|
+
state: allowed(day) ? undefined : "disabled", onClick: () => choose(day), onKeyDown: keyDown, className: styles.day, children: parseDay(day).day }) }, day))) }, week[0]))) })] })] }))] })) }));
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/date-picker/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,oDAAoD,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,uDAAuD,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAE7E,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,MAAM,GAAG,GAAG,CAAC,MAAc,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EA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gBACK,GAAG,EACb,MAAM,QACN,OAAO,EAAE,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,EAClD,KAAK,EACH,GAAG,KAAK,MAAM;oDACZ,CAAC,CAAC,OAAO;oDACT,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAE,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK;wDACnC,CAAC,CAAC,YAAY;wDACd,CAAC,CAAC,cAAc,EAEtB,QAAQ,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBACtB,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,kBAC/B,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gDAChD,oEAAoE;gDACpE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAC1B,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,MAAM,CAAC,GAAG,YAEpB,QAAQ,CAAC,GAAG,CAAE,CAAC,GAAG,GACZ,IA3BJ,GAAG,CA4BL,CACN,CAAC,IAhCK,IAAI,CAAC,CAAC,CAAC,CAiCX,CACN,CAAC,GACI,IACF,IACJ,CACP,IACG,CACP,GACK,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.anchor){position:relative;display:flex;flex-direction:column}:where(.anchor)>.field{cursor:pointer}:where(.button){display:flex;align-items:center;inline-size:100%;min-block-size:var(--section-minimum-size);margin:0;padding:0;border:0;outline:0;background:none;color:inherit;font:inherit;text-align:start;cursor:inherit}:where(.field:not([data-variant=filled])) :where(.button){color:var(--current-hover-color)}:where(.placeholder){opacity:.6}.calendar{position:absolute;z-index:20;inset-block-start:calc(100% + var(--scale-4));inset-inline-start:0;inline-size:max-content;background:rgb(var(--background-color-rgb)/90%)}:where(.month){font-weight:600;text-transform:capitalize}:where(.grid){border-collapse:collapse}:where(.weekday){padding-block:var(--scale-4);color:var(--middleground-color);font-size:var(--scale-12);font-weight:500}:where(.cell){padding:1px;text-align:center}:where(.day[aria-current=date]){text-decoration:underline;text-underline-offset:.25em}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
:where(.anchor) {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:where(.anchor) > .field {
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:where(.button) {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
inline-size: 100%;
|
|
15
|
+
min-block-size: var(--section-minimum-size);
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
border: 0;
|
|
19
|
+
outline: 0;
|
|
20
|
+
background: none;
|
|
21
|
+
color: inherit;
|
|
22
|
+
font: inherit;
|
|
23
|
+
text-align: start;
|
|
24
|
+
cursor: inherit;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:where(.field:not([data-variant="filled"])) :where(.button) {
|
|
28
|
+
color: var(--current-hover-color);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:where(.placeholder) {
|
|
32
|
+
opacity: 0.6;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Under the field, above what follows; nearly opaque behind the glass.
|
|
36
|
+
.calendar {
|
|
37
|
+
position: absolute;
|
|
38
|
+
z-index: 20;
|
|
39
|
+
inset-block-start: calc(100% + var(--scale-4));
|
|
40
|
+
inset-inline-start: 0;
|
|
41
|
+
inline-size: max-content;
|
|
42
|
+
background: rgb(var(--background-color-rgb) / 90%);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:where(.month) {
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
text-transform: capitalize;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:where(.grid) {
|
|
51
|
+
border-collapse: collapse;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:where(.weekday) {
|
|
55
|
+
padding-block: var(--scale-4);
|
|
56
|
+
color: var(--middleground-color);
|
|
57
|
+
font-size: var(--scale-12);
|
|
58
|
+
font-weight: 500;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:where(.cell) {
|
|
62
|
+
padding: 1px;
|
|
63
|
+
text-align: center;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Today is underlined, so it is found at a glance.
|
|
67
|
+
:where(.day[aria-current="date"]) {
|
|
68
|
+
text-decoration: underline;
|
|
69
|
+
text-underline-offset: 0.25em;
|
|
70
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { BoxLook, BoxState } from "@sharadox/graphical-user-interface-web-library/box/type";
|
|
3
|
+
/** A calendar day, without time or time zone; `month` counts from 0. */
|
|
4
|
+
export interface Day {
|
|
5
|
+
year: number;
|
|
6
|
+
month: number;
|
|
7
|
+
day: number;
|
|
8
|
+
}
|
|
9
|
+
export interface DatePickerProperties extends Pick<BoxLook, "variant" | "color" | "colorStyle" | "corner" | "line" | "size"> {
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
hideLabel?: boolean;
|
|
12
|
+
hint?: ReactNode;
|
|
13
|
+
error?: ReactNode;
|
|
14
|
+
/** Controlled: the day as `yyyy-mm-dd` (empty for none). */
|
|
15
|
+
value?: string;
|
|
16
|
+
/** Uncontrolled: the day at first. */
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
/** With a name, the day goes in a hidden field for forms (`yyyy-mm-dd`). */
|
|
20
|
+
name?: string;
|
|
21
|
+
/** The first and last days that can be chosen (`yyyy-mm-dd`). */
|
|
22
|
+
min?: string;
|
|
23
|
+
max?: string;
|
|
24
|
+
/** The language days, months and weekdays are written in (`en`, `pt-PT`…); `en` by default. */
|
|
25
|
+
locale?: string;
|
|
26
|
+
/** The weekday weeks start on: 1 (Monday, the default) or 0 (Sunday). */
|
|
27
|
+
weekStart?: 0 | 1;
|
|
28
|
+
/** Today (`yyyy-mm-dd`), where the calendar opens when no day is chosen; the device's today by default. */
|
|
29
|
+
today?: string;
|
|
30
|
+
/** Shown while no day is chosen. */
|
|
31
|
+
placeholder?: ReactNode;
|
|
32
|
+
/** The month buttons' names ("Previous month", "Next month"). */
|
|
33
|
+
previousLabel: string;
|
|
34
|
+
nextLabel: string;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** Forces a state (for the design system). */
|
|
37
|
+
state?: BoxState;
|
|
38
|
+
id?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/date-picker/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,yDAAyD,CAAC;AAEjG,wEAAwE;AACxE,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,OAAO,EACP,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAChE;IACC,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+FAA+F;IAC/F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAClB,2GAA2G;IAC3G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/date-picker/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TabsProperties } from "@sharadox/graphical-user-interface-web-library/tabs/type";
|
|
2
|
+
/**
|
|
3
|
+
* Tabs: a row of tab buttons (the chosen one filled) over the chosen tab's panel. As the ARIA tabs pattern asks, the
|
|
4
|
+
* row is one stop in the tab order; the arrow keys choose the next or previous tab (wrapping around) and Home and End
|
|
5
|
+
* the first and last; the panel is named by its tab and can be reached with Tab.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Tabs label="Account" tabs={[{ value: "profile", label: "Profile", content: <Profile /> }, …]} />
|
|
9
|
+
*/
|
|
10
|
+
export declare function Tabs({ label, tabs, value, defaultValue, onChange, color, size, className, }: TabsProperties): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/tabs/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0DAA0D,CAAC;AAK/F;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,IAAI,EACJ,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,KAAoB,EACpB,IAAI,EACJ,SAAS,GACV,EAAE,cAAc,+BA6DhB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useRef, useState } from "react";
|
|
4
|
+
import { Box } from "@sharadox/graphical-user-interface-web-library/box";
|
|
5
|
+
import { Button } from "@sharadox/graphical-user-interface-web-library/button";
|
|
6
|
+
import styles from "./index.module.css";
|
|
7
|
+
const STEPS = { ArrowRight: 1, ArrowLeft: -1 };
|
|
8
|
+
/**
|
|
9
|
+
* Tabs: a row of tab buttons (the chosen one filled) over the chosen tab's panel. As the ARIA tabs pattern asks, the
|
|
10
|
+
* row is one stop in the tab order; the arrow keys choose the next or previous tab (wrapping around) and Home and End
|
|
11
|
+
* the first and last; the panel is named by its tab and can be reached with Tab.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <Tabs label="Account" tabs={[{ value: "profile", label: "Profile", content: <Profile /> }, …]} />
|
|
15
|
+
*/
|
|
16
|
+
export function Tabs({ label, tabs, value, defaultValue, onChange, color = "foreground", size, className, }) {
|
|
17
|
+
const id = useId();
|
|
18
|
+
const list = useRef(null);
|
|
19
|
+
const [own, setOwn] = useState(defaultValue ?? tabs[0].value);
|
|
20
|
+
const chosen = value ?? own;
|
|
21
|
+
const index = Math.max(0, tabs.findIndex((tab) => tab.value === chosen));
|
|
22
|
+
const choose = (next) => {
|
|
23
|
+
const tab = tabs[next];
|
|
24
|
+
if (value === undefined)
|
|
25
|
+
setOwn(tab.value);
|
|
26
|
+
onChange?.(tab.value);
|
|
27
|
+
};
|
|
28
|
+
const move = (event) => {
|
|
29
|
+
const step = STEPS[event.key];
|
|
30
|
+
const next = event.key === "Home"
|
|
31
|
+
? 0
|
|
32
|
+
: event.key === "End"
|
|
33
|
+
? tabs.length - 1
|
|
34
|
+
: step === undefined
|
|
35
|
+
? undefined
|
|
36
|
+
: (index + step + tabs.length) % tabs.length;
|
|
37
|
+
if (next === undefined)
|
|
38
|
+
return;
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
choose(next);
|
|
41
|
+
list.current?.querySelectorAll('[role="tab"]')[next]?.focus();
|
|
42
|
+
};
|
|
43
|
+
return (_jsxs(Box, { direction: "top-to-bottom", align: "stretch", gap: 16, className: className, children: [_jsx(Box, { ref: list, role: "tablist", "aria-label": label, gap: 4, justify: "start", wrap: "wrap", className: styles.list, children: tabs.map((tab, at) => (_jsx(Button, { id: `${id}-tab-${at}`, role: "tab", "aria-selected": at === index, "aria-controls": `${id}-panel`, tabIndex: at === index ? 0 : -1, variant: at === index ? "filled" : "transparent", color: color, size: size, onClick: () => choose(at), onKeyDown: move, children: tab.label }, tab.value))) }), _jsx("div", { id: `${id}-panel`, role: "tabpanel", "aria-labelledby": `${id}-tab-${index}`, tabIndex: 0, className: styles.panel, children: tabs[index].content })] }));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/tabs/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AACp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AAa,EAChD,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,EACzB,SAAS,EAAE,IAAI,YAEd,GAAG,CAAC,KAAK,IAZL,GAAG,CAAC,KAAK,CAaP,CACV,CAAC,GACE,EACN,cACE,EAAE,EAAE,GAAG,EAAE,QAAQ,EACjB,IAAI,EAAC,UAAU,qBACE,GAAG,EAAE,QAAQ,KAAK,EAAE,EACrC,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,MAAM,CAAC,KAAK,YAEtB,IAAI,CAAC,KAAK,CAAE,CAAC,OAAO,GACjB,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:where(.list){padding-block-end:var(--scale-8);border-block-end:var(--line-thickness) var(--line-style) var(--foreground-border-color)}:where(.panel){text-align:start}:where(.panel):focus-visible{outline:var(--focus-thickness) solid var(--foreground-color);outline-offset:var(--focus-offset)}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
:where(.list) {
|
|
2
|
+
padding-block-end: var(--scale-8);
|
|
3
|
+
border-block-end: var(--line-thickness) var(--line-style) var(--foreground-border-color);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:where(.panel) {
|
|
7
|
+
text-align: start;
|
|
8
|
+
|
|
9
|
+
&:focus-visible {
|
|
10
|
+
outline: var(--focus-thickness) solid var(--foreground-color);
|
|
11
|
+
outline-offset: var(--focus-offset);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { BoxLook } from "@sharadox/graphical-user-interface-web-library/box/type";
|
|
3
|
+
export interface Tab {
|
|
4
|
+
value: string;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface TabsProperties extends Pick<BoxLook, "color" | "size"> {
|
|
9
|
+
/** The tab list's name for assistive technology. */
|
|
10
|
+
label: string;
|
|
11
|
+
tabs: readonly Tab[];
|
|
12
|
+
/** Controlled: the chosen tab. */
|
|
13
|
+
value?: string;
|
|
14
|
+
/** Uncontrolled: the tab chosen at first (the first one otherwise). */
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
onChange?: (value: string) => void;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/tabs/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yDAAyD,CAAC;AAEvF,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC;IACrE,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,GAAG,EAAE,CAAC;IACrB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/tabs/type.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharadox/graphical-user-interface-web-library",
|
|
3
|
-
"version": "0.2.0-
|
|
3
|
+
"version": "0.2.0-disclosure.31",
|
|
4
4
|
"description": "One generic, accessible, fully configurable component library: every interface piece in every variant, color, corner, line, size and state, styled from a single source of truth that each brand configures.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "SEE LICENSE IN LICENCA.md",
|