@finstack-com-public/design 0.7.0 → 0.8.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/CHANGELOG.md +35 -1
- package/dist/css/calendar.css +172 -0
- package/dist/css/calendar.md +169 -0
- package/dist/css/input.css +4 -2
- package/dist/css/input.md +3 -1
- package/dist/css/popover.css +7 -0
- package/dist/css/popover.md +2 -0
- package/dist/css/wave.css +20 -5
- package/dist/css/wave.md +6 -3
- package/dist/css-text/calendar.d.ts +2 -0
- package/dist/css-text/calendar.js +1 -0
- package/dist/css-text/input.js +1 -1
- package/dist/css-text/kit.js +204 -7
- package/dist/css-text/popover.js +1 -1
- package/dist/css-text/wave.js +20 -5
- package/dist/dom/calendar-dates.d.ts +45 -0
- package/dist/dom/calendar-dates.js +129 -0
- package/dist/dom/calendar.d.ts +79 -0
- package/dist/dom/calendar.js +396 -0
- package/dist/dom/index.d.ts +1 -0
- package/dist/dom/index.js +1 -0
- package/dist/kit.css +204 -7
- package/dist/react/inputs.d.ts +23 -2
- package/dist/react/inputs.js +55 -2
- package/dist/react/overlays.d.ts +15 -15
- package/package.json +1 -1
package/dist/react/inputs.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
// React wrappers for spec 02 B: inputs.
|
|
3
|
-
import { forwardRef, useId, } from 'react';
|
|
3
|
+
import { forwardRef, useId, useRef, } from 'react';
|
|
4
|
+
import { createCalendar, } from "../dom/calendar.js";
|
|
4
5
|
import { Icon } from "./icon.js";
|
|
5
|
-
import { cx } from "./util.js";
|
|
6
|
+
import { cx, useFsEvent, useIsoLayoutEffect, useLatest, useMergedRef } from "./util.js";
|
|
6
7
|
const MESSAGE_ICON = { warning: 'triangle-alert', danger: 'circle-alert' };
|
|
7
8
|
export const Field = forwardRef(function Field({ label, layout = 'stacked', full, wrap, required, invalid, message, messageTone = 'neutral', mark, count, className, children, ...rest }, ref) {
|
|
8
9
|
const id = useId();
|
|
@@ -66,3 +67,55 @@ export const ComputedValue = forwardRef(function ComputedValue({ className, ...r
|
|
|
66
67
|
export const ExplainableValue = forwardRef(function ExplainableValue({ className, type = 'button', ...rest }, ref) {
|
|
67
68
|
return _jsx("button", { ref: ref, type: type, className: cx('fs-value', 'fs-value--explainable', className), ...rest });
|
|
68
69
|
});
|
|
70
|
+
/**
|
|
71
|
+
* The calendar (D42): renders the empty `.fs-calendar` root and runs `createCalendar` on mount, which
|
|
72
|
+
* renders the header and the grid. On the server it is the empty root. Every name is a required prop.
|
|
73
|
+
*/
|
|
74
|
+
export const Calendar = forwardRef(function Calendar({ value, defaultValue, onChange, min, max, today, granularity, weekStart, monthNames, weekdayNames, heading, cellLabel, labels, announcer, autoFocus, className, ...rest }, ref) {
|
|
75
|
+
const own = useRef(null);
|
|
76
|
+
const ctl = useRef(null);
|
|
77
|
+
// The helper calls these through the latest props, so new functions on each render cost nothing.
|
|
78
|
+
const names = useLatest({ heading, cellLabel });
|
|
79
|
+
const latestValue = useLatest(value);
|
|
80
|
+
const set = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined));
|
|
81
|
+
const options = () => ({
|
|
82
|
+
// Undefined clears a bound or today; granularity and weekStart keep their defaults.
|
|
83
|
+
min,
|
|
84
|
+
max,
|
|
85
|
+
today,
|
|
86
|
+
...set({ granularity, weekStart }),
|
|
87
|
+
monthNames,
|
|
88
|
+
weekdayNames,
|
|
89
|
+
labels,
|
|
90
|
+
heading: (page) => names.current.heading(page),
|
|
91
|
+
cellLabel: (cell) => names.current.cellLabel(cell),
|
|
92
|
+
announcer: announcer?.current ?? undefined,
|
|
93
|
+
});
|
|
94
|
+
useIsoLayoutEffect(() => {
|
|
95
|
+
ctl.current = createCalendar(own.current, { ...options(), value: value === undefined ? defaultValue : value });
|
|
96
|
+
if (autoFocus)
|
|
97
|
+
ctl.current.focus();
|
|
98
|
+
return () => {
|
|
99
|
+
ctl.current?.destroy();
|
|
100
|
+
ctl.current = null;
|
|
101
|
+
};
|
|
102
|
+
}, []);
|
|
103
|
+
// New bounds, names or granularity: re-render in place, keeping the page and the focus.
|
|
104
|
+
useIsoLayoutEffect(() => {
|
|
105
|
+
ctl.current?.update(options());
|
|
106
|
+
}, [min, max, today, granularity, weekStart, monthNames, weekdayNames, labels, heading, cellLabel, announcer]);
|
|
107
|
+
useIsoLayoutEffect(() => {
|
|
108
|
+
if (value !== undefined && ctl.current && ctl.current.value !== value)
|
|
109
|
+
ctl.current.setValue(value);
|
|
110
|
+
}, [value]);
|
|
111
|
+
useFsEvent(own, 'fs-change', ({ value: picked }) => {
|
|
112
|
+
onChange?.(picked);
|
|
113
|
+
// A controlled value the parent didn't take is put back.
|
|
114
|
+
queueMicrotask(() => {
|
|
115
|
+
const held = latestValue.current;
|
|
116
|
+
if (held !== undefined && ctl.current && ctl.current.value !== held)
|
|
117
|
+
ctl.current.setValue(held);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
return _jsx("div", { ref: useMergedRef(own, ref), className: cx('fs-calendar', className), ...rest });
|
|
121
|
+
});
|
package/dist/react/overlays.d.ts
CHANGED
|
@@ -15,17 +15,17 @@ export declare function Heading({ level, ...rest }: HTMLAttributes<HTMLHeadingEl
|
|
|
15
15
|
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {});
|
|
16
16
|
autoFocus?: boolean | undefined;
|
|
17
17
|
className?: string | undefined;
|
|
18
|
-
contentEditable?: (boolean | "
|
|
18
|
+
contentEditable?: (boolean | "false" | "true") | "inherit" | "plaintext-only" | undefined;
|
|
19
19
|
contextMenu?: string | undefined;
|
|
20
20
|
dir?: string | undefined;
|
|
21
|
-
draggable?: (boolean | "
|
|
21
|
+
draggable?: (boolean | "false" | "true") | undefined;
|
|
22
22
|
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined;
|
|
23
23
|
hidden?: boolean | undefined;
|
|
24
24
|
id?: string | undefined;
|
|
25
25
|
lang?: string | undefined;
|
|
26
26
|
nonce?: string | undefined;
|
|
27
27
|
slot?: string | undefined;
|
|
28
|
-
spellCheck?: (boolean | "
|
|
28
|
+
spellCheck?: (boolean | "false" | "true") | undefined;
|
|
29
29
|
style?: import("react").CSSProperties | undefined;
|
|
30
30
|
tabIndex?: number | undefined;
|
|
31
31
|
title?: string | undefined;
|
|
@@ -63,11 +63,11 @@ export declare function Heading({ level, ...rest }: HTMLAttributes<HTMLHeadingEl
|
|
|
63
63
|
exportparts?: string | undefined;
|
|
64
64
|
part?: string | undefined;
|
|
65
65
|
"aria-activedescendant"?: string | undefined;
|
|
66
|
-
"aria-atomic"?: (boolean | "
|
|
66
|
+
"aria-atomic"?: (boolean | "false" | "true") | undefined;
|
|
67
67
|
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined;
|
|
68
68
|
"aria-braillelabel"?: string | undefined;
|
|
69
69
|
"aria-brailleroledescription"?: string | undefined;
|
|
70
|
-
"aria-busy"?: (boolean | "
|
|
70
|
+
"aria-busy"?: (boolean | "false" | "true") | undefined;
|
|
71
71
|
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
72
72
|
"aria-colcount"?: number | undefined;
|
|
73
73
|
"aria-colindex"?: number | undefined;
|
|
@@ -78,37 +78,37 @@ export declare function Heading({ level, ...rest }: HTMLAttributes<HTMLHeadingEl
|
|
|
78
78
|
"aria-describedby"?: string | undefined;
|
|
79
79
|
"aria-description"?: string | undefined;
|
|
80
80
|
"aria-details"?: string | undefined;
|
|
81
|
-
"aria-disabled"?: (boolean | "
|
|
81
|
+
"aria-disabled"?: (boolean | "false" | "true") | undefined;
|
|
82
82
|
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined;
|
|
83
83
|
"aria-errormessage"?: string | undefined;
|
|
84
|
-
"aria-expanded"?: (boolean | "
|
|
84
|
+
"aria-expanded"?: (boolean | "false" | "true") | undefined;
|
|
85
85
|
"aria-flowto"?: string | undefined;
|
|
86
|
-
"aria-grabbed"?: (boolean | "
|
|
86
|
+
"aria-grabbed"?: (boolean | "false" | "true") | undefined;
|
|
87
87
|
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
88
|
-
"aria-hidden"?: (boolean | "
|
|
88
|
+
"aria-hidden"?: (boolean | "false" | "true") | undefined;
|
|
89
89
|
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
|
|
90
90
|
"aria-keyshortcuts"?: string | undefined;
|
|
91
91
|
"aria-label"?: string | undefined;
|
|
92
92
|
"aria-labelledby"?: string | undefined;
|
|
93
93
|
"aria-level"?: number | undefined;
|
|
94
94
|
"aria-live"?: "off" | "assertive" | "polite" | undefined;
|
|
95
|
-
"aria-modal"?: (boolean | "
|
|
96
|
-
"aria-multiline"?: (boolean | "
|
|
97
|
-
"aria-multiselectable"?: (boolean | "
|
|
95
|
+
"aria-modal"?: (boolean | "false" | "true") | undefined;
|
|
96
|
+
"aria-multiline"?: (boolean | "false" | "true") | undefined;
|
|
97
|
+
"aria-multiselectable"?: (boolean | "false" | "true") | undefined;
|
|
98
98
|
"aria-orientation"?: "horizontal" | "vertical" | undefined;
|
|
99
99
|
"aria-owns"?: string | undefined;
|
|
100
100
|
"aria-placeholder"?: string | undefined;
|
|
101
101
|
"aria-posinset"?: number | undefined;
|
|
102
102
|
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined;
|
|
103
|
-
"aria-readonly"?: (boolean | "
|
|
103
|
+
"aria-readonly"?: (boolean | "false" | "true") | undefined;
|
|
104
104
|
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined;
|
|
105
|
-
"aria-required"?: (boolean | "
|
|
105
|
+
"aria-required"?: (boolean | "false" | "true") | undefined;
|
|
106
106
|
"aria-roledescription"?: string | undefined;
|
|
107
107
|
"aria-rowcount"?: number | undefined;
|
|
108
108
|
"aria-rowindex"?: number | undefined;
|
|
109
109
|
"aria-rowindextext"?: string | undefined;
|
|
110
110
|
"aria-rowspan"?: number | undefined;
|
|
111
|
-
"aria-selected"?: (boolean | "
|
|
111
|
+
"aria-selected"?: (boolean | "false" | "true") | undefined;
|
|
112
112
|
"aria-setsize"?: number | undefined;
|
|
113
113
|
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
114
114
|
"aria-valuemax"?: number | undefined;
|
package/package.json
CHANGED