@nizivo/react 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +120 -2
- package/THIRD_PARTY_NOTICES +61 -0
- package/dist/_engines/react-aria/dialog.client.js +134 -0
- package/dist/_engines/react-aria/dom-allowlist.js +19 -0
- package/dist/_engines/react-aria/dom.js +31 -0
- package/dist/_engines/react-aria/locale.client.js +13 -0
- package/dist/_engines/react-aria/menu.client.js +225 -0
- package/dist/_engines/react-aria/overlay.client.js +41 -0
- package/dist/_engines/react-aria/popup.client.js +127 -0
- package/dist/_engines/react-aria/select.client.js +170 -0
- package/dist/_engines/react-aria/tabs.client.js +95 -0
- package/dist/_engines/react-aria/tooltip.client.js +72 -0
- package/dist/_internal/cx.js +11 -0
- package/dist/_internal/engine-part.d.ts +1 -0
- package/dist/_internal/field.js +20 -0
- package/dist/_internal/glyphs.js +34 -0
- package/dist/_internal/keys.js +62 -0
- package/dist/_internal/overlay.d.ts +9 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/alert/alert-dismiss.client.d.ts +32 -0
- package/dist/alert/alert-dismiss.client.js +36 -0
- package/dist/alert/alert.d.ts +28 -0
- package/dist/alert/alert.js +44 -0
- package/dist/alert/index.d.ts +3 -0
- package/dist/alert/index.js +3 -0
- package/dist/augment.d.ts +13 -0
- package/dist/augment.js +0 -0
- package/dist/badge/badge.d.ts +19 -0
- package/dist/badge/badge.js +22 -0
- package/dist/badge/index.d.ts +2 -0
- package/dist/badge/index.js +1 -0
- package/dist/button/button.d.ts +54 -0
- package/dist/button/button.js +62 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/index.js +1 -0
- package/dist/card/card.d.ts +57 -0
- package/dist/card/card.js +62 -0
- package/dist/card/card.parts.d.ts +6 -0
- package/dist/card/card.parts.js +14 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/card/index.js +3 -0
- package/dist/checkbox/checkbox.client.d.ts +37 -0
- package/dist/checkbox/checkbox.client.js +81 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +1 -0
- package/dist/config/config.client.d.ts +9 -0
- package/dist/config/config.client.js +18 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +1 -0
- package/dist/container/container.d.ts +13 -0
- package/dist/container/container.js +16 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/container/index.js +1 -0
- package/dist/contracts/details.d.ts +13 -0
- package/dist/contracts/details.js +9 -0
- package/dist/contracts/index.d.ts +5 -0
- package/dist/contracts/index.js +5 -0
- package/dist/contracts/merge-props.d.ts +16 -0
- package/dist/contracts/merge-props.js +76 -0
- package/dist/contracts/render.d.ts +17 -0
- package/dist/contracts/render.js +43 -0
- package/dist/contracts/state.d.ts +42 -0
- package/dist/contracts/state.js +42 -0
- package/dist/css/alert.css +2 -0
- package/dist/css/badge.css +2 -0
- package/dist/css/base.css +2 -0
- package/dist/css/button.css +2 -0
- package/dist/css/card.css +2 -0
- package/dist/css/checkbox.css +2 -0
- package/dist/css/container.css +2 -0
- package/dist/css/delta.css +2 -0
- package/dist/css/dialog.css +2 -0
- package/dist/css/empty-state.css +2 -0
- package/dist/css/field.css +2 -0
- package/dist/css/fieldset.css +2 -0
- package/dist/css/grid.css +2 -0
- package/dist/css/heading.css +2 -0
- package/dist/css/icon-button.css +2 -0
- package/dist/css/image.css +2 -0
- package/dist/css/inline-error.css +2 -0
- package/dist/css/inline.css +2 -0
- package/dist/css/input.css +2 -0
- package/dist/css/kbd.css +2 -0
- package/dist/css/menu.css +2 -0
- package/dist/css/meter.css +2 -0
- package/dist/css/native-select.css +2 -0
- package/dist/css/progress-bar.css +2 -0
- package/dist/css/progress-ring.css +2 -0
- package/dist/css/radio-group.css +2 -0
- package/dist/css/segmented-control.css +2 -0
- package/dist/css/select.css +2 -0
- package/dist/css/separator.css +2 -0
- package/dist/css/skeleton.css +2 -0
- package/dist/css/stack.css +2 -0
- package/dist/css/switch.css +2 -0
- package/dist/css/tab-nav.css +2 -0
- package/dist/css/tabs.css +2 -0
- package/dist/css/text.css +2 -0
- package/dist/css/textarea.css +2 -0
- package/dist/css/tooltip.css +2 -0
- package/dist/delta/delta.d.ts +32 -0
- package/dist/delta/delta.js +50 -0
- package/dist/delta/index.d.ts +2 -0
- package/dist/delta/index.js +1 -0
- package/dist/dialog/dialog.client.d.ts +25 -0
- package/dist/dialog/dialog.client.js +167 -0
- package/dist/dialog/dialog.contract.d.ts +97 -0
- package/dist/dialog/dialog.parts.d.ts +6 -0
- package/dist/dialog/dialog.parts.js +15 -0
- package/dist/dialog/index.d.ts +5 -0
- package/dist/dialog/index.js +3 -0
- package/dist/empty-state/empty-state.d.ts +18 -0
- package/dist/empty-state/empty-state.js +32 -0
- package/dist/empty-state/index.d.ts +2 -0
- package/dist/empty-state/index.js +1 -0
- package/dist/field/field-scope.client.d.ts +50 -0
- package/dist/field/field-scope.client.js +205 -0
- package/dist/field/field-static.d.ts +122 -0
- package/dist/field/field-static.js +159 -0
- package/dist/field/field.d.ts +5 -0
- package/dist/field/field.js +53 -0
- package/dist/field/index.d.ts +4 -0
- package/dist/field/index.js +4 -0
- package/dist/fieldset/fieldset.d.ts +36 -0
- package/dist/fieldset/fieldset.js +63 -0
- package/dist/fieldset/index.d.ts +2 -0
- package/dist/fieldset/index.js +1 -0
- package/dist/grid/grid.d.ts +38 -0
- package/dist/grid/grid.js +28 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/grid/index.js +1 -0
- package/dist/heading/heading.d.ts +27 -0
- package/dist/heading/heading.js +26 -0
- package/dist/heading/index.d.ts +2 -0
- package/dist/heading/index.js +1 -0
- package/dist/icon-button/icon-button-static.d.ts +23 -0
- package/dist/icon-button/icon-button-static.js +83 -0
- package/dist/icon-button/icon-button.client.js +29 -0
- package/dist/icon-button/icon-button.contract.d.ts +89 -0
- package/dist/icon-button/icon-button.d.ts +5 -0
- package/dist/icon-button/icon-button.js +21 -0
- package/dist/icon-button/index.d.ts +4 -0
- package/dist/icon-button/index.js +3 -0
- package/dist/image/image.d.ts +28 -0
- package/dist/image/image.js +24 -0
- package/dist/image/index.d.ts +2 -0
- package/dist/image/index.js +1 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.js +51 -0
- package/dist/inline/index.d.ts +2 -0
- package/dist/inline/index.js +1 -0
- package/dist/inline/inline.d.ts +16 -0
- package/dist/inline/inline.js +14 -0
- package/dist/inline-error/index.d.ts +2 -0
- package/dist/inline-error/index.js +1 -0
- package/dist/inline-error/inline-error.d.ts +17 -0
- package/dist/inline-error/inline-error.js +33 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/index.js +1 -0
- package/dist/input/input.client.d.ts +39 -0
- package/dist/input/input.client.js +82 -0
- package/dist/kbd/index.d.ts +2 -0
- package/dist/kbd/index.js +1 -0
- package/dist/kbd/kbd.d.ts +19 -0
- package/dist/kbd/kbd.js +68 -0
- package/dist/menu/index.d.ts +5 -0
- package/dist/menu/index.js +3 -0
- package/dist/menu/menu.client.d.ts +14 -0
- package/dist/menu/menu.client.js +152 -0
- package/dist/menu/menu.contract.d.ts +152 -0
- package/dist/menu/menu.parts.d.ts +6 -0
- package/dist/menu/menu.parts.js +17 -0
- package/dist/meter/index.d.ts +2 -0
- package/dist/meter/index.js +1 -0
- package/dist/meter/meter.d.ts +43 -0
- package/dist/meter/meter.js +59 -0
- package/dist/native-select/index.d.ts +2 -0
- package/dist/native-select/index.js +1 -0
- package/dist/native-select/native-select.d.ts +43 -0
- package/dist/native-select/native-select.js +56 -0
- package/dist/progress-bar/index.d.ts +2 -0
- package/dist/progress-bar/index.js +1 -0
- package/dist/progress-bar/progress-bar.d.ts +34 -0
- package/dist/progress-bar/progress-bar.js +55 -0
- package/dist/progress-ring/index.d.ts +2 -0
- package/dist/progress-ring/index.js +1 -0
- package/dist/progress-ring/progress-ring.d.ts +38 -0
- package/dist/progress-ring/progress-ring.js +67 -0
- package/dist/radio-group/index.d.ts +3 -0
- package/dist/radio-group/index.js +3 -0
- package/dist/radio-group/radio-group.client.d.ts +22 -0
- package/dist/radio-group/radio-group.client.js +70 -0
- package/dist/radio-group/radio-group.d.ts +28 -0
- package/dist/radio-group/radio-group.js +35 -0
- package/dist/segmented-control/index.d.ts +3 -0
- package/dist/segmented-control/index.js +3 -0
- package/dist/segmented-control/segmented-control.client.d.ts +61 -0
- package/dist/segmented-control/segmented-control.client.js +156 -0
- package/dist/segmented-control/segmented-control.parts.d.ts +6 -0
- package/dist/segmented-control/segmented-control.parts.js +9 -0
- package/dist/select/index.d.ts +5 -0
- package/dist/select/index.js +3 -0
- package/dist/select/select.client.d.ts +12 -0
- package/dist/select/select.client.js +152 -0
- package/dist/select/select.contract.d.ts +119 -0
- package/dist/select/select.parts.d.ts +6 -0
- package/dist/select/select.parts.js +15 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/index.js +1 -0
- package/dist/separator/separator.d.ts +26 -0
- package/dist/separator/separator.js +23 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/index.js +1 -0
- package/dist/skeleton/skeleton.d.ts +20 -0
- package/dist/skeleton/skeleton.js +19 -0
- package/dist/stack/index.d.ts +2 -0
- package/dist/stack/index.js +1 -0
- package/dist/stack/stack.d.ts +17 -0
- package/dist/stack/stack.js +14 -0
- package/dist/styles.css +536 -0
- package/dist/switch/index.d.ts +2 -0
- package/dist/switch/index.js +1 -0
- package/dist/switch/switch.client.d.ts +33 -0
- package/dist/switch/switch.client.js +63 -0
- package/dist/tab-nav/index.d.ts +3 -0
- package/dist/tab-nav/index.js +3 -0
- package/dist/tab-nav/tab-nav.d.ts +36 -0
- package/dist/tab-nav/tab-nav.js +47 -0
- package/dist/tab-nav/tab-nav.parts.d.ts +6 -0
- package/dist/tab-nav/tab-nav.parts.js +9 -0
- package/dist/tabs/index.d.ts +4 -0
- package/dist/tabs/index.js +3 -0
- package/dist/tabs/tabs.client.d.ts +8 -0
- package/dist/tabs/tabs.client.js +68 -0
- package/dist/tabs/tabs.contract.d.ts +89 -0
- package/dist/tabs/tabs.parts.d.ts +6 -0
- package/dist/tabs/tabs.parts.js +11 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.js +1 -0
- package/dist/text/text.d.ts +21 -0
- package/dist/text/text.js +17 -0
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +1 -0
- package/dist/textarea/textarea.client.d.ts +18 -0
- package/dist/textarea/textarea.client.js +31 -0
- package/dist/theme-script/index.d.ts +2 -0
- package/dist/theme-script/index.js +1 -0
- package/dist/theme-script/theme-script.d.ts +43 -0
- package/dist/theme-script/theme-script.js +46 -0
- package/dist/tooltip/index.d.ts +5 -0
- package/dist/tooltip/index.js +3 -0
- package/dist/tooltip/tooltip.client.d.ts +12 -0
- package/dist/tooltip/tooltip.client.js +51 -0
- package/dist/tooltip/tooltip.contract.d.ts +60 -0
- package/dist/tooltip/tooltip.parts.d.ts +6 -0
- package/dist/tooltip/tooltip.parts.js +10 -0
- package/package.json +284 -3
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../_internal/cx.js";
|
|
3
|
+
import { toRenderFn } from "../contracts/render.js";
|
|
4
|
+
import { CheckGlyph, ChevronsUpDownGlyph } from "../_internal/glyphs.js";
|
|
5
|
+
import { joinIds } from "../_internal/field.js";
|
|
6
|
+
import { useFieldControl } from "../field/field-scope.client.js";
|
|
7
|
+
import { Group, GroupLabel, Item, Popup, Root, Separator, Trigger, Value } from "../_engines/react-aria/select.client.js";
|
|
8
|
+
import { createContext, use, useMemo } from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/select/select.client.tsx
|
|
11
|
+
const Scope = createContext({
|
|
12
|
+
size: "md",
|
|
13
|
+
invalid: false
|
|
14
|
+
});
|
|
15
|
+
const renderRoot = toRenderFn(void 0, "div");
|
|
16
|
+
const renderDiv = toRenderFn(void 0, "div");
|
|
17
|
+
function SelectRoot({ size = "md", name, required, disabled, invalid, "aria-labelledby": labelledBy, className, ...props }) {
|
|
18
|
+
const field = useFieldControl({
|
|
19
|
+
name,
|
|
20
|
+
required,
|
|
21
|
+
disabled,
|
|
22
|
+
invalid,
|
|
23
|
+
labelBehavior: "focus"
|
|
24
|
+
});
|
|
25
|
+
const { id, describedBy } = field;
|
|
26
|
+
const named = labelledBy ?? field.labelledBy;
|
|
27
|
+
const scope = useMemo(() => ({
|
|
28
|
+
size,
|
|
29
|
+
invalid: field.invalid,
|
|
30
|
+
id,
|
|
31
|
+
describedBy
|
|
32
|
+
}), [
|
|
33
|
+
size,
|
|
34
|
+
field.invalid,
|
|
35
|
+
id,
|
|
36
|
+
describedBy
|
|
37
|
+
]);
|
|
38
|
+
return /* @__PURE__ */ jsx(Scope, {
|
|
39
|
+
value: scope,
|
|
40
|
+
children: /* @__PURE__ */ jsx(Root, {
|
|
41
|
+
...props,
|
|
42
|
+
...field.name !== void 0 && { name: field.name },
|
|
43
|
+
...named !== void 0 && { "aria-labelledby": named },
|
|
44
|
+
required: field.required,
|
|
45
|
+
disabled: field.disabled,
|
|
46
|
+
invalid: field.invalid,
|
|
47
|
+
className: cx("nz-select", className),
|
|
48
|
+
"data-slot": "select",
|
|
49
|
+
"data-size": size,
|
|
50
|
+
render: renderRoot
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function SelectTrigger({ id, "aria-describedby": describedBy, className, leadingIcon, indicator, render, children, ...rest }) {
|
|
55
|
+
const { size, invalid, ...field } = use(Scope);
|
|
56
|
+
return /* @__PURE__ */ jsxs(Trigger, {
|
|
57
|
+
...rest,
|
|
58
|
+
id: id ?? field.id,
|
|
59
|
+
"aria-describedby": joinIds(field.describedBy, describedBy),
|
|
60
|
+
className: cx("nz-select-trigger nz-hit-target", className),
|
|
61
|
+
"data-slot": "select-trigger",
|
|
62
|
+
"data-size": size,
|
|
63
|
+
"data-invalid": invalid ? "" : void 0,
|
|
64
|
+
render: toRenderFn(render, "button"),
|
|
65
|
+
children: [
|
|
66
|
+
leadingIcon != null && /* @__PURE__ */ jsx("span", {
|
|
67
|
+
className: "nz-select-icon",
|
|
68
|
+
"data-slot": "select-icon",
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
children: leadingIcon
|
|
71
|
+
}),
|
|
72
|
+
children ?? /* @__PURE__ */ jsx(SelectValue, {}),
|
|
73
|
+
/* @__PURE__ */ jsx("span", {
|
|
74
|
+
className: "nz-select-chevron",
|
|
75
|
+
"data-slot": "select-chevron",
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
children: indicator ?? /* @__PURE__ */ jsx(ChevronsUpDownGlyph, {})
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function SelectValue({ className, render, ...rest }) {
|
|
83
|
+
return /* @__PURE__ */ jsx(Value, {
|
|
84
|
+
...rest,
|
|
85
|
+
className: cx("nz-select-value", className),
|
|
86
|
+
"data-slot": "select-value",
|
|
87
|
+
render: toRenderFn(render, "span")
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function SelectPopup({ side = "bottom", align = "start", sideOffset = 4, container, className, style, children }) {
|
|
91
|
+
return /* @__PURE__ */ jsx(Popup, {
|
|
92
|
+
side,
|
|
93
|
+
align,
|
|
94
|
+
sideOffset,
|
|
95
|
+
container,
|
|
96
|
+
className: cx("nz-select-popup", className),
|
|
97
|
+
style,
|
|
98
|
+
"data-slot": "select-popup",
|
|
99
|
+
render: renderDiv,
|
|
100
|
+
list: {
|
|
101
|
+
className: "nz-select-list",
|
|
102
|
+
"data-slot": "select-list"
|
|
103
|
+
},
|
|
104
|
+
children
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function SelectItem({ className, textValue, indicator, render, children, ...rest }) {
|
|
108
|
+
const base = toRenderFn(render, "div");
|
|
109
|
+
const check = indicator !== null && /* @__PURE__ */ jsx("span", {
|
|
110
|
+
className: "nz-select-item-indicator",
|
|
111
|
+
"aria-hidden": "true",
|
|
112
|
+
children: indicator ?? /* @__PURE__ */ jsx(CheckGlyph, {})
|
|
113
|
+
});
|
|
114
|
+
return /* @__PURE__ */ jsx(Item, {
|
|
115
|
+
...rest,
|
|
116
|
+
textValue: textValue ?? (typeof children === "string" ? children : void 0),
|
|
117
|
+
className: cx("nz-select-item", className),
|
|
118
|
+
"data-slot": "select-item",
|
|
119
|
+
"data-focus-inset": "",
|
|
120
|
+
render: (props, state) => base({
|
|
121
|
+
...props,
|
|
122
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [props["children"], check] })
|
|
123
|
+
}, state),
|
|
124
|
+
children
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function SelectGroup({ className, render, ...rest }) {
|
|
128
|
+
return /* @__PURE__ */ jsx(Group, {
|
|
129
|
+
...rest,
|
|
130
|
+
className: cx("nz-select-group", className),
|
|
131
|
+
"data-slot": "select-group",
|
|
132
|
+
render: toRenderFn(render, "section")
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function SelectGroupLabel({ className, render, ...rest }) {
|
|
136
|
+
return /* @__PURE__ */ jsx(GroupLabel, {
|
|
137
|
+
...rest,
|
|
138
|
+
className: cx("nz-select-group-label", className),
|
|
139
|
+
"data-slot": "select-group-label",
|
|
140
|
+
render: toRenderFn(render, "header")
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function SelectSeparator({ className, render, ...rest }) {
|
|
144
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
145
|
+
...rest,
|
|
146
|
+
className: cx("nz-select-separator", className),
|
|
147
|
+
"data-slot": "select-separator",
|
|
148
|
+
render: toRenderFn(render, "div")
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
export { SelectGroup, SelectGroupLabel, SelectItem, SelectPopup, SelectRoot, SelectSeparator, SelectTrigger, SelectValue };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ControlSize } from "../augment.js";
|
|
3
|
+
import { ChangeDetails, OpenReason } from "../contracts/details.js";
|
|
4
|
+
import { Align, Side } from "../contracts/state.js";
|
|
5
|
+
import "../_internal/engine-part.js";
|
|
6
|
+
import { CSSProperties, ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
7
|
+
//#region src/select/select.contract.d.ts
|
|
8
|
+
export type SelectValueReason = "item-press" | "keyboard" | "typeahead" | "form-reset";
|
|
9
|
+
/**
|
|
10
|
+
* Strings the engine renders (§9.3 rule 7). `placeholder` is passed to the engine.
|
|
11
|
+
* Engine-owned with React Aria (not overridable): the visually hidden "Dismiss" buttons in the popup.
|
|
12
|
+
*/
|
|
13
|
+
export interface SelectLabels {
|
|
14
|
+
/** Shown while no value is chosen. React Aria's default is its localized "Select an item". */
|
|
15
|
+
placeholder: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SelectRootProps {
|
|
18
|
+
value?: string | null;
|
|
19
|
+
defaultValue?: string | null;
|
|
20
|
+
/** `details.reason` is `'unknown'` with React Aria, which reports no cause. */
|
|
21
|
+
onValueChange?: (value: string | null, details: ChangeDetails<SelectValueReason>) => void;
|
|
22
|
+
open?: boolean;
|
|
23
|
+
defaultOpen?: boolean;
|
|
24
|
+
onOpenChange?: (open: boolean, details: ChangeDetails<OpenReason>) => void;
|
|
25
|
+
/**
|
|
26
|
+
* With `name`, a hidden native `<select>` carries the value into `FormData`. Inside a `Field`, the
|
|
27
|
+
* Field's `name`, `required`, `disabled` and presented error apply unless set here (an explicit
|
|
28
|
+
* `false` wins), and a click on its label focuses the trigger without opening the listbox.
|
|
29
|
+
*/
|
|
30
|
+
name?: string;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/** An error message is presented (owned by Field, never by the engine). Inside a Field, the Field sets it. */
|
|
34
|
+
invalid?: boolean;
|
|
35
|
+
placeholder?: SelectLabels["placeholder"];
|
|
36
|
+
"aria-label"?: string;
|
|
37
|
+
/** Names the trigger together with the value. Inside a Field, the Field label id goes here (§16.1). */
|
|
38
|
+
"aria-labelledby"?: string;
|
|
39
|
+
/** 32 / 40 / 48 px. @default 'md' */
|
|
40
|
+
size?: ControlSize;
|
|
41
|
+
className?: string;
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
export interface SelectRootState {
|
|
45
|
+
open: boolean;
|
|
46
|
+
disabled: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface SelectTriggerState {
|
|
49
|
+
open: boolean;
|
|
50
|
+
pressed: boolean;
|
|
51
|
+
focusVisible: boolean;
|
|
52
|
+
disabled: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface SelectValueState {
|
|
55
|
+
placeholder: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface SelectPopupState {
|
|
58
|
+
entering: boolean;
|
|
59
|
+
exiting: boolean;
|
|
60
|
+
side: Side;
|
|
61
|
+
}
|
|
62
|
+
export interface SelectItemState {
|
|
63
|
+
highlighted: boolean;
|
|
64
|
+
selected: boolean;
|
|
65
|
+
disabled: boolean;
|
|
66
|
+
focusVisible: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface SelectTriggerProps extends Omit<ComponentPropsWithRef<"button">, "children" | "disabled" | "type"> {
|
|
69
|
+
leadingIcon?: ReactNode;
|
|
70
|
+
/** Replaces the chevron glyph. */
|
|
71
|
+
indicator?: ReactNode;
|
|
72
|
+
/** Must render a `<button>` (a component that renders one is fine). */
|
|
73
|
+
render?: RenderProp<SelectTriggerState>;
|
|
74
|
+
/** Replaces the default `Select.Value`. */
|
|
75
|
+
children?: ReactNode;
|
|
76
|
+
}
|
|
77
|
+
export interface SelectValueProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
|
|
78
|
+
/** Must render a `<span>`. */
|
|
79
|
+
render?: RenderProp<SelectValueState>;
|
|
80
|
+
}
|
|
81
|
+
export interface SelectPopupProps {
|
|
82
|
+
/** @default 'bottom' */
|
|
83
|
+
side?: "top" | "bottom";
|
|
84
|
+
/** @default 'start' */
|
|
85
|
+
align?: Align;
|
|
86
|
+
/** Distance from the trigger in px. @default 4 */
|
|
87
|
+
sideOffset?: number;
|
|
88
|
+
/** Portal container. Defaults to the parent overlay, else `document.body` (§12.1 L2). */
|
|
89
|
+
container?: Element | null;
|
|
90
|
+
className?: string;
|
|
91
|
+
style?: CSSProperties;
|
|
92
|
+
children: ReactNode;
|
|
93
|
+
}
|
|
94
|
+
export interface SelectItemProps extends Omit<ComponentPropsWithRef<"div">, "children" | "id"> {
|
|
95
|
+
value: string;
|
|
96
|
+
/** Typeahead text; defaults to `children` when it is a string. */
|
|
97
|
+
textValue?: string;
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
/** Replaces the check shown at the end of the selected item; `null` shows none. Decorative. */
|
|
100
|
+
indicator?: ReactNode;
|
|
101
|
+
/** Must render a `<div>`. */
|
|
102
|
+
render?: RenderProp<SelectItemState>;
|
|
103
|
+
children: ReactNode;
|
|
104
|
+
}
|
|
105
|
+
type NoState = Record<string, never>;
|
|
106
|
+
export interface SelectGroupProps extends Omit<ComponentPropsWithRef<"section">, "id"> {
|
|
107
|
+
/** Must render a `<section>`. */
|
|
108
|
+
render?: RenderProp<NoState>;
|
|
109
|
+
}
|
|
110
|
+
export interface SelectGroupLabelProps extends Omit<ComponentPropsWithRef<"header">, "id"> {
|
|
111
|
+
/** Must render a `<header>`. */
|
|
112
|
+
render?: RenderProp<NoState>;
|
|
113
|
+
}
|
|
114
|
+
export interface SelectSeparatorProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
115
|
+
/** Must render a `<div>`. */
|
|
116
|
+
render?: RenderProp<NoState>;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export type { OpenReason };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SelectGroup, SelectGroupLabel, SelectItem, SelectPopup, SelectRoot, SelectSeparator, SelectTrigger, SelectValue } from "./select.client.js";
|
|
2
|
+
declare namespace select_parts_d_exports {
|
|
3
|
+
export { SelectGroup as Group, SelectGroupLabel as GroupLabel, SelectItem as Item, SelectPopup as Popup, SelectRoot as Root, SelectSeparator as Separator, SelectTrigger as Trigger, SelectValue as Value };
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { SelectGroup as Group, SelectGroupLabel as GroupLabel, SelectItem as Item, SelectPopup as Popup, SelectRoot as Root, SelectSeparator as Separator, SelectTrigger as Trigger, SelectValue as Value, select_parts_d_exports };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { SelectGroup, SelectGroupLabel, SelectItem, SelectPopup, SelectRoot, SelectSeparator, SelectTrigger, SelectValue } from "./select.client.js";
|
|
3
|
+
//#region src/select/select.parts.ts
|
|
4
|
+
var select_parts_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Group: () => SelectGroup,
|
|
6
|
+
GroupLabel: () => SelectGroupLabel,
|
|
7
|
+
Item: () => SelectItem,
|
|
8
|
+
Popup: () => SelectPopup,
|
|
9
|
+
Root: () => SelectRoot,
|
|
10
|
+
Separator: () => SelectSeparator,
|
|
11
|
+
Trigger: () => SelectTrigger,
|
|
12
|
+
Value: () => SelectValue
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SelectGroup as Group, SelectGroupLabel as GroupLabel, SelectItem as Item, SelectPopup as Popup, SelectRoot as Root, SelectSeparator as Separator, SelectTrigger as Trigger, SelectValue as Value, select_parts_exports };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Separator } from "./separator.js";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { Orientation } from "../contracts/state.js";
|
|
3
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
4
|
+
//#region src/separator/separator.d.ts
|
|
5
|
+
export interface SeparatorState {
|
|
6
|
+
orientation: Orientation;
|
|
7
|
+
decorative: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface SeparatorProps extends Omit<ComponentPropsWithRef<"hr">, "children"> {
|
|
10
|
+
/** A vertical separator stretches to the height of its flex row. @default 'horizontal' */
|
|
11
|
+
orientation?: Orientation;
|
|
12
|
+
/**
|
|
13
|
+
* Purely visual, hidden from assistive technology (`role="none"`): the Figma Divider default
|
|
14
|
+
* (7370:95, M35). Pass `decorative={false}` for a separator that means something on its own, a
|
|
15
|
+
* break between two groups a screen reader should hear (an `<hr>`'s implicit `separator` role,
|
|
16
|
+
* with `aria-orientation` when vertical). @default true
|
|
17
|
+
*/
|
|
18
|
+
decorative?: boolean;
|
|
19
|
+
render?: RenderProp<SeparatorState>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* An `<hr>`: a 1 px `border/subtle` line, Figma's Divider (7370:95). Decorative by default; spacing
|
|
23
|
+
* comes first, a line only when spacing is not enough (the Figma doc).
|
|
24
|
+
*/
|
|
25
|
+
export declare function Separator({ orientation, decorative, render, className, ...rest }: SeparatorProps): ReactElement;
|
|
26
|
+
//#endregion
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
//#region src/separator/separator.tsx
|
|
4
|
+
/**
|
|
5
|
+
* An `<hr>`: a 1 px `border/subtle` line, Figma's Divider (7370:95). Decorative by default; spacing
|
|
6
|
+
* comes first, a line only when spacing is not enough (the Figma doc).
|
|
7
|
+
*/
|
|
8
|
+
function Separator({ orientation = "horizontal", decorative = true, render, className, ...rest }) {
|
|
9
|
+
const native = render === void 0;
|
|
10
|
+
return renderElement("hr", render, {
|
|
11
|
+
orientation,
|
|
12
|
+
decorative
|
|
13
|
+
}, {
|
|
14
|
+
"data-slot": "separator",
|
|
15
|
+
"data-orientation": orientation,
|
|
16
|
+
...rest,
|
|
17
|
+
className: cx("nz-separator", className),
|
|
18
|
+
role: decorative ? "none" : native ? void 0 : "separator",
|
|
19
|
+
"aria-orientation": !decorative && orientation === "vertical" ? "vertical" : void 0
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Separator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Skeleton } from "./skeleton.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
3
|
+
//#region src/skeleton/skeleton.d.ts
|
|
4
|
+
/** Figma "Shape": a text line, a block (media, a chart) or a circle (an avatar). */
|
|
5
|
+
export type SkeletonShape = "line" | "block" | "circle";
|
|
6
|
+
export interface SkeletonState {
|
|
7
|
+
shape: SkeletonShape;
|
|
8
|
+
}
|
|
9
|
+
export interface SkeletonProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
|
|
10
|
+
/** @default 'line' */
|
|
11
|
+
shape?: SkeletonShape;
|
|
12
|
+
render?: RenderProp<SkeletonState>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One placeholder block, always hidden from assistive technology. The region it stands in for sets
|
|
16
|
+
* `aria-busy` and carries visually hidden "Loading …" text (§16.5). There is no `style` prop path:
|
|
17
|
+
* size it with a class, or with `--nz-skeleton-width`, `--nz-skeleton-height` and `--nz-skeleton-radius`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function Skeleton({ shape, render, className, ...rest }: SkeletonProps): ReactElement;
|
|
20
|
+
//#endregion
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
//#region src/skeleton/skeleton.tsx
|
|
4
|
+
/**
|
|
5
|
+
* One placeholder block, always hidden from assistive technology. The region it stands in for sets
|
|
6
|
+
* `aria-busy` and carries visually hidden "Loading …" text (§16.5). There is no `style` prop path:
|
|
7
|
+
* size it with a class, or with `--nz-skeleton-width`, `--nz-skeleton-height` and `--nz-skeleton-radius`.
|
|
8
|
+
*/
|
|
9
|
+
function Skeleton({ shape = "line", render, className, ...rest }) {
|
|
10
|
+
return renderElement("span", render, { shape }, {
|
|
11
|
+
"data-slot": "skeleton",
|
|
12
|
+
"data-shape": shape,
|
|
13
|
+
...rest,
|
|
14
|
+
className: cx("nz-skeleton", className),
|
|
15
|
+
"aria-hidden": true
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Skeleton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Stack } from "./stack.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
3
|
+
//#region src/stack/stack.d.ts
|
|
4
|
+
/** A `--nz-space-*` key: `'4'` is `--nz-space-4` (1rem), `'0-5'` is `--nz-space-0-5`. Token keys only. */
|
|
5
|
+
export type LayoutGap = "0" | "0-5" | "1" | "1-5" | "2" | "3" | "4" | "5" | "6" | "8" | "10" | "12" | "16" | "20" | "24";
|
|
6
|
+
export interface StackState {
|
|
7
|
+
gap: LayoutGap | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface StackProps extends ComponentPropsWithRef<"div"> {
|
|
10
|
+
/** Space between children. Absent, there is none. */
|
|
11
|
+
gap?: LayoutGap;
|
|
12
|
+
/** Another element, for example `render={<ul />}` for a list. */
|
|
13
|
+
render?: RenderProp<StackState>;
|
|
14
|
+
}
|
|
15
|
+
/** Children in a column. */
|
|
16
|
+
export declare function Stack({ gap, render, className, ...rest }: StackProps): ReactElement;
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
//#region src/stack/stack.tsx
|
|
4
|
+
/** Children in a column. */
|
|
5
|
+
function Stack({ gap, render, className, ...rest }) {
|
|
6
|
+
return renderElement("div", render, { gap }, {
|
|
7
|
+
"data-slot": "stack",
|
|
8
|
+
"data-gap": gap,
|
|
9
|
+
...rest,
|
|
10
|
+
className: cx("nz-stack", className)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Stack };
|