@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,62 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
//#region src/card/card.tsx
|
|
4
|
+
function CardRoot({ tone = "surface", padding = "md", elevation = 0, render, className, ...rest }) {
|
|
5
|
+
return renderElement("div", render, {
|
|
6
|
+
tone,
|
|
7
|
+
padding,
|
|
8
|
+
elevation
|
|
9
|
+
}, {
|
|
10
|
+
"data-slot": "card",
|
|
11
|
+
"data-tone": tone,
|
|
12
|
+
"data-padding": padding,
|
|
13
|
+
"data-elevation": elevation === 1 ? "1" : void 0,
|
|
14
|
+
"data-nz-scheme": tone === "inverse" ? "inverse" : void 0,
|
|
15
|
+
...rest,
|
|
16
|
+
className: cx("nz-card", className)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function CardHeader({ render, className, ...rest }) {
|
|
20
|
+
return renderElement("div", render, {}, {
|
|
21
|
+
"data-slot": "card-header",
|
|
22
|
+
...rest,
|
|
23
|
+
className: cx("nz-card-header", className)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function CardTitle({ level = 3, render, className, ...rest }) {
|
|
27
|
+
return renderElement(`h${level}`, render, {}, {
|
|
28
|
+
"data-slot": "card-title",
|
|
29
|
+
...rest,
|
|
30
|
+
className: cx("nz-card-title", className)
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function CardDescription({ render, className, ...rest }) {
|
|
34
|
+
return renderElement("p", render, {}, {
|
|
35
|
+
"data-slot": "card-description",
|
|
36
|
+
...rest,
|
|
37
|
+
className: cx("nz-card-description", className)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function CardAction({ render, className, ...rest }) {
|
|
41
|
+
return renderElement("div", render, {}, {
|
|
42
|
+
"data-slot": "card-action",
|
|
43
|
+
...rest,
|
|
44
|
+
className: cx("nz-card-action", className)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function CardBody({ render, className, ...rest }) {
|
|
48
|
+
return renderElement("div", render, {}, {
|
|
49
|
+
"data-slot": "card-body",
|
|
50
|
+
...rest,
|
|
51
|
+
className: cx("nz-card-body", className)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function CardFooter({ render, className, ...rest }) {
|
|
55
|
+
return renderElement("div", render, {}, {
|
|
56
|
+
"data-slot": "card-footer",
|
|
57
|
+
...rest,
|
|
58
|
+
className: cx("nz-card-footer", className)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from "./card.js";
|
|
2
|
+
declare namespace card_parts_d_exports {
|
|
3
|
+
export { CardAction as Action, CardBody as Body, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { CardAction as Action, CardBody as Body, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title, card_parts_d_exports };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from "./card.js";
|
|
3
|
+
//#region src/card/card.parts.ts
|
|
4
|
+
var card_parts_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Action: () => CardAction,
|
|
6
|
+
Body: () => CardBody,
|
|
7
|
+
Description: () => CardDescription,
|
|
8
|
+
Footer: () => CardFooter,
|
|
9
|
+
Header: () => CardHeader,
|
|
10
|
+
Root: () => CardRoot,
|
|
11
|
+
Title: () => CardTitle
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CardAction as Action, CardBody as Body, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title, card_parts_exports };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CardAction, CardActionProps, CardBody, CardBodyProps, CardDescription, CardDescriptionProps, CardElevation, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardPadding, CardRoot, CardRootProps, CardRootState, CardTitle, CardTitleLevel, CardTitleProps, CardTone } from "./card.js";
|
|
2
|
+
import { card_parts_d_exports } from "./card.parts.js";
|
|
3
|
+
export { card_parts_d_exports as Card, CardAction, type CardActionProps, CardBody, type CardBodyProps, CardDescription, type CardDescriptionProps, type CardElevation, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardPadding, CardRoot, type CardRootProps, type CardRootState, CardTitle, type CardTitleLevel, type CardTitleProps, type CardTone };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from "./card.js";
|
|
2
|
+
import { card_parts_exports } from "./card.parts.js";
|
|
3
|
+
export { card_parts_exports as Card, CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ChangeDetails } from "../contracts/details.js";
|
|
3
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
4
|
+
//#region src/checkbox/checkbox.client.d.ts
|
|
5
|
+
/** `'indeterminate'` is the mixed state of a "select all" box; it submits as unchecked. */
|
|
6
|
+
export type CheckboxCheckedState = boolean | "indeterminate";
|
|
7
|
+
/** Every change comes from the native `change` event: a click, Space, or a click on the label. */
|
|
8
|
+
export type CheckboxChangeReason = "input";
|
|
9
|
+
/** What a `render` function receives for the root `<label>`. */
|
|
10
|
+
export interface CheckboxState {
|
|
11
|
+
/** An error message is presented (the Field's, or the `invalid` prop). */
|
|
12
|
+
invalid: boolean;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
required: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface CheckboxProps extends Omit<ComponentPropsWithRef<"input">, "type" | "checked" | "defaultChecked" | "children" | "readOnly" | "size"> {
|
|
17
|
+
/** Controlled state. `'indeterminate'` shows the dash; a click then reports `true`. */
|
|
18
|
+
checked?: CheckboxCheckedState;
|
|
19
|
+
/** Uncontrolled initial state. @default false */
|
|
20
|
+
defaultChecked?: CheckboxCheckedState;
|
|
21
|
+
/** Called after the consumer's own `onChange`, unless it called `preventDefault()`. */
|
|
22
|
+
onCheckedChange?: (checked: boolean, details: ChangeDetails<CheckboxChangeReason>) => void;
|
|
23
|
+
/** An error message is presented for this box. Inside a Field, the Field decides. */
|
|
24
|
+
invalid?: boolean;
|
|
25
|
+
/** Replaces the internal check and dash glyphs (decorative), shown while checked or mixed. */
|
|
26
|
+
indicator?: ReactNode;
|
|
27
|
+
/** Composition of the root `<label>`, the hit target. */
|
|
28
|
+
render?: RenderProp<CheckboxState>;
|
|
29
|
+
/** The label, after the box. Without one, name the box with `aria-label`. */
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `className` and `style` go on the root `<label>`; every other attribute, `ref` included, goes on the
|
|
34
|
+
* native `<input>`, so form libraries (`register`, `setFocus`) reach the real control.
|
|
35
|
+
*/
|
|
36
|
+
export declare function Checkbox({ id, name, required, disabled, invalid, "aria-describedby": describedBy, checked, defaultChecked, onCheckedChange, indicator, render, className, style, children, ...rest }: CheckboxProps): ReactElement;
|
|
37
|
+
//#endregion
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../_internal/cx.js";
|
|
3
|
+
import { mergeProps } from "../contracts/merge-props.js";
|
|
4
|
+
import { renderElement } from "../contracts/render.js";
|
|
5
|
+
import { CheckGlyph, MinusGlyph } from "../_internal/glyphs.js";
|
|
6
|
+
import { details } from "../contracts/details.js";
|
|
7
|
+
import { stateAttrs } from "../contracts/state.js";
|
|
8
|
+
import { presented } from "../_internal/field.js";
|
|
9
|
+
import { useFieldControl } from "../field/field-scope.client.js";
|
|
10
|
+
import { useLayoutEffect, useRef } from "react";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
//#region src/checkbox/checkbox.client.tsx
|
|
13
|
+
/**
|
|
14
|
+
* `className` and `style` go on the root `<label>`; every other attribute, `ref` included, goes on the
|
|
15
|
+
* native `<input>`, so form libraries (`register`, `setFocus`) reach the real control.
|
|
16
|
+
*/
|
|
17
|
+
function Checkbox({ id, name, required, disabled, invalid, "aria-describedby": describedBy, checked, defaultChecked, onCheckedChange, indicator, render, className, style, children, ...rest }) {
|
|
18
|
+
const field = useFieldControl({
|
|
19
|
+
id,
|
|
20
|
+
name,
|
|
21
|
+
required,
|
|
22
|
+
disabled,
|
|
23
|
+
invalid,
|
|
24
|
+
"aria-describedby": describedBy
|
|
25
|
+
});
|
|
26
|
+
const { readOnly: _readOnly, ...control } = field.controlProps;
|
|
27
|
+
const input = useRef(null);
|
|
28
|
+
const initiallyMixed = useRef(defaultChecked === "indeterminate");
|
|
29
|
+
const mixed = checked === void 0 ? void 0 : checked === "indeterminate";
|
|
30
|
+
useLayoutEffect(() => {
|
|
31
|
+
const element = input.current;
|
|
32
|
+
if (element === null) return;
|
|
33
|
+
if (mixed !== void 0) element.indeterminate = mixed;
|
|
34
|
+
else if (initiallyMixed.current) {
|
|
35
|
+
element.indeterminate = true;
|
|
36
|
+
initiallyMixed.current = false;
|
|
37
|
+
}
|
|
38
|
+
}, [mixed]);
|
|
39
|
+
const own = {
|
|
40
|
+
...control,
|
|
41
|
+
ref: input,
|
|
42
|
+
checked: checked === void 0 ? void 0 : checked === true,
|
|
43
|
+
defaultChecked: defaultChecked === void 0 ? void 0 : defaultChecked === true,
|
|
44
|
+
onChange(event) {
|
|
45
|
+
if (mixed === true) event.currentTarget.indeterminate = true;
|
|
46
|
+
onCheckedChange?.(event.currentTarget.checked, details("input", event.nativeEvent));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const state = {
|
|
50
|
+
invalid: field.invalid,
|
|
51
|
+
disabled: field.disabled,
|
|
52
|
+
required: field.required
|
|
53
|
+
};
|
|
54
|
+
return renderElement("label", render, state, {
|
|
55
|
+
"data-slot": "checkbox",
|
|
56
|
+
...stateAttrs(state),
|
|
57
|
+
className: cx("nz-checkbox nz-hit-target", className),
|
|
58
|
+
style,
|
|
59
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx("input", {
|
|
61
|
+
...mergeProps(own, rest),
|
|
62
|
+
type: "checkbox",
|
|
63
|
+
className: "nz-checkbox-input",
|
|
64
|
+
"data-slot": "checkbox-input"
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsx("span", {
|
|
67
|
+
className: "nz-checkbox-indicator",
|
|
68
|
+
"data-slot": "checkbox-indicator",
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
children: indicator ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CheckGlyph, {}), /* @__PURE__ */ jsx(MinusGlyph, {})] })
|
|
71
|
+
}),
|
|
72
|
+
presented(children) && /* @__PURE__ */ jsx("span", {
|
|
73
|
+
className: "nz-checkbox-label",
|
|
74
|
+
"data-slot": "checkbox-label",
|
|
75
|
+
children
|
|
76
|
+
})
|
|
77
|
+
] })
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { Checkbox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox } from "./checkbox.client.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JSX, ReactNode } from "react";
|
|
2
|
+
//#region src/config/config.client.d.ts
|
|
3
|
+
export interface NizivoConfigProps {
|
|
4
|
+
/** BCP 47 tag used by engine-backed parts. @default 'en-US' */
|
|
5
|
+
locale?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function NizivoConfig({ locale, children }: NizivoConfigProps): JSX.Element;
|
|
9
|
+
//#endregion
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, use, useMemo } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/config/config.client.tsx
|
|
5
|
+
const ConfigContext = createContext({ locale: "en-US" });
|
|
6
|
+
function NizivoConfig({ locale = "en-US", children }) {
|
|
7
|
+
const value = useMemo(() => ({ locale }), [locale]);
|
|
8
|
+
return /* @__PURE__ */ jsx(ConfigContext, {
|
|
9
|
+
value,
|
|
10
|
+
children
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/** The resolved locale. Internal: engine roots read it through EngineLocale. */
|
|
14
|
+
function useResolvedLocale() {
|
|
15
|
+
return use(ConfigContext).locale;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { NizivoConfig, useResolvedLocale };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NizivoConfig } from "./config.client.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
3
|
+
//#region src/container/container.d.ts
|
|
4
|
+
export interface ContainerProps extends ComponentPropsWithRef<"div"> {
|
|
5
|
+
/** Another element, for example `render={<main />}`. */
|
|
6
|
+
render?: RenderProp<Record<string, never>>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Centres page content: at most `--nz-layout-content-max` wide (358, 976, 1280 px by viewport), with
|
|
10
|
+
* the responsive page margin `--nz-grid-margin` (16, 24, 32 px) on both sides.
|
|
11
|
+
*/
|
|
12
|
+
export declare function Container({ render, className, ...rest }: ContainerProps): ReactElement;
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
//#region src/container/container.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Centres page content: at most `--nz-layout-content-max` wide (358, 976, 1280 px by viewport), with
|
|
6
|
+
* the responsive page margin `--nz-grid-margin` (16, 24, 32 px) on both sides.
|
|
7
|
+
*/
|
|
8
|
+
function Container({ render, className, ...rest }) {
|
|
9
|
+
return renderElement("div", render, {}, {
|
|
10
|
+
"data-slot": "container",
|
|
11
|
+
...rest,
|
|
12
|
+
className: cx("nz-container", className)
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Container };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Container } from "./container.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/contracts/details.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The second argument of every `on<X>Change(value, details)`. `reason` is Nizivo-owned: where the
|
|
4
|
+
* engine reports no cause, it is `'unknown'`, never a guess.
|
|
5
|
+
*/
|
|
6
|
+
export interface ChangeDetails<R extends string> {
|
|
7
|
+
reason: R | "unknown";
|
|
8
|
+
event?: Event;
|
|
9
|
+
}
|
|
10
|
+
/** Why an overlay opened or closed (§12.2). */
|
|
11
|
+
export type OpenReason = "trigger" | "escape" | "outside-press" | "close-part" | "item-press" | "hidden" | "programmatic";
|
|
12
|
+
export declare function details<R extends string = never>(reason: NoInfer<R> | "unknown", event?: Event): ChangeDetails<R>;
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RenderProp, renderElement, toRenderFn } from "./render.js";
|
|
2
|
+
import { ChangeDetails, OpenReason, details } from "./details.js";
|
|
3
|
+
import { mergeProps } from "./merge-props.js";
|
|
4
|
+
import { Align, Orientation, STATE_ATTR_NAMES, Side, StateAttrs, StateInput, stateAttrs } from "./state.js";
|
|
5
|
+
export { type Align, type ChangeDetails, type OpenReason, type Orientation, type RenderProp, STATE_ATTR_NAMES, type Side, type StateAttrs, type StateInput, details, mergeProps, renderElement, stateAttrs, toRenderFn };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { mergeProps } from "./merge-props.js";
|
|
2
|
+
import { renderElement, toRenderFn } from "./render.js";
|
|
3
|
+
import { details } from "./details.js";
|
|
4
|
+
import { STATE_ATTR_NAMES, stateAttrs } from "./state.js";
|
|
5
|
+
export { STATE_ATTR_NAMES, details, mergeProps, renderElement, stateAttrs, toRenderFn };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/contracts/merge-props.d.ts
|
|
2
|
+
type Props = Record<string, unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* Merges prop objects from left ("ours") to right ("theirs"):
|
|
5
|
+
* - `className` is concatenated, ours first, without repeating a class;
|
|
6
|
+
* - `style` is shallow-merged, theirs winning;
|
|
7
|
+
* - `on*` handlers are chained theirs-first, and ours skip when the event was `defaultPrevented`;
|
|
8
|
+
* - refs are merged into one callback ref;
|
|
9
|
+
* - any other key: the right-most defined value wins, and `undefined` never overrides.
|
|
10
|
+
*
|
|
11
|
+
* A function is created only when both sides supply one, so a server component that merges a
|
|
12
|
+
* consumer element never synthesises a handler or ref (functions cannot cross the RSC boundary).
|
|
13
|
+
*/
|
|
14
|
+
export declare function mergeProps(...sources: ReadonlyArray<Props | undefined>): Props;
|
|
15
|
+
//#endregion
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
//#region src/contracts/merge-props.ts
|
|
3
|
+
/**
|
|
4
|
+
* Merges prop objects from left ("ours") to right ("theirs"):
|
|
5
|
+
* - `className` is concatenated, ours first, without repeating a class;
|
|
6
|
+
* - `style` is shallow-merged, theirs winning;
|
|
7
|
+
* - `on*` handlers are chained theirs-first, and ours skip when the event was `defaultPrevented`;
|
|
8
|
+
* - refs are merged into one callback ref;
|
|
9
|
+
* - any other key: the right-most defined value wins, and `undefined` never overrides.
|
|
10
|
+
*
|
|
11
|
+
* A function is created only when both sides supply one, so a server component that merges a
|
|
12
|
+
* consumer element never synthesises a handler or ref (functions cannot cross the RSC boundary).
|
|
13
|
+
*/
|
|
14
|
+
function mergeProps(...sources) {
|
|
15
|
+
const out = {};
|
|
16
|
+
for (const source of sources) {
|
|
17
|
+
if (source === void 0) continue;
|
|
18
|
+
for (const key of Object.keys(source)) {
|
|
19
|
+
const theirs = source[key];
|
|
20
|
+
if (theirs === void 0) continue;
|
|
21
|
+
const ours = out[key];
|
|
22
|
+
out[key] = ours === void 0 ? theirs : mergeValue(key, ours, theirs);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
function mergeValue(key, ours, theirs) {
|
|
28
|
+
if (key === "className" && typeof ours === "string" && typeof theirs === "string") return cx(ours, theirs);
|
|
29
|
+
if (key === "style" && isObject(ours) && isObject(theirs)) return {
|
|
30
|
+
...ours,
|
|
31
|
+
...theirs
|
|
32
|
+
};
|
|
33
|
+
if (key === "ref" && isRef(ours) && isRef(theirs)) return mergeRefs(ours, theirs);
|
|
34
|
+
if (/^on[A-Z]/.test(key) && isFunction(ours) && isFunction(theirs)) return chain(theirs, ours);
|
|
35
|
+
return theirs;
|
|
36
|
+
}
|
|
37
|
+
function chain(theirs, ours) {
|
|
38
|
+
return (...args) => {
|
|
39
|
+
theirs(...args);
|
|
40
|
+
if (!isPrevented(args[0])) ours(...args);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function isPrevented(event) {
|
|
44
|
+
return isObject(event) && event["defaultPrevented"] === true;
|
|
45
|
+
}
|
|
46
|
+
function isObject(value) {
|
|
47
|
+
return typeof value === "object" && value !== null;
|
|
48
|
+
}
|
|
49
|
+
function isFunction(value) {
|
|
50
|
+
return typeof value === "function";
|
|
51
|
+
}
|
|
52
|
+
function isRefObject(value) {
|
|
53
|
+
return isObject(value) && "current" in value;
|
|
54
|
+
}
|
|
55
|
+
function isRef(value) {
|
|
56
|
+
return isFunction(value) || isRefObject(value);
|
|
57
|
+
}
|
|
58
|
+
/** Assigns `node` and returns the ref's React 19 cleanup, if it returned one. */
|
|
59
|
+
function assignRef(ref, node) {
|
|
60
|
+
if (isFunction(ref)) {
|
|
61
|
+
const cleanup = ref(node);
|
|
62
|
+
return isFunction(cleanup) ? cleanup : void 0;
|
|
63
|
+
}
|
|
64
|
+
ref.current = node;
|
|
65
|
+
}
|
|
66
|
+
/** One callback ref for both; honours React 19 ref cleanups. */
|
|
67
|
+
function mergeRefs(a, b) {
|
|
68
|
+
return (node) => {
|
|
69
|
+
const cleanups = [assignRef(a, node), assignRef(b, node)];
|
|
70
|
+
return () => {
|
|
71
|
+
cleanups.forEach((cleanup, i) => cleanup ? cleanup() : assignRef(i === 0 ? a : b, null));
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { mergeProps };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
//#region src/contracts/render.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Composition without `asChild` or a polymorphic `as`:
|
|
5
|
+
* - element form: `render={<Link href="/orders" />}`, serializable from Server Components;
|
|
6
|
+
* - function form: `render={(props, state) => <a {...props} />}`, client code only.
|
|
7
|
+
*/
|
|
8
|
+
export type RenderProp<S> = ReactElement | ((props: Record<string, unknown>, state: S) => ReactElement);
|
|
9
|
+
/**
|
|
10
|
+
* Renders `tag` with `props`, or the consumer's element/function with `props` merged in (ours first).
|
|
11
|
+
* Element form: `mergeProps` semantics (the element's props win), except that the part's own
|
|
12
|
+
* `PART_OWNED` attributes win over the element's.
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderElement<S>(tag: string, render: RenderProp<S> | undefined, state: S, props: Record<string, unknown>): ReactElement;
|
|
15
|
+
/** Normalises any render prop to the function form that engine adapters receive. */
|
|
16
|
+
export declare function toRenderFn<S>(render: RenderProp<S> | undefined, tag: string): (props: Record<string, unknown>, state: S) => ReactElement;
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { mergeProps } from "./merge-props.js";
|
|
2
|
+
import { cloneElement, createElement, isValidElement } from "react";
|
|
3
|
+
//#region src/contracts/render.ts
|
|
4
|
+
/**
|
|
5
|
+
* The presentational attributes (the `presentational` group of contracts/vocabulary.json). They
|
|
6
|
+
* describe the part, so when a part renders through an element, the part's values win. That element
|
|
7
|
+
* may be a server Button that RSC has already rendered to a host `<button data-slot="button">`.
|
|
8
|
+
*/
|
|
9
|
+
const PART_OWNED = [
|
|
10
|
+
"data-slot",
|
|
11
|
+
"data-variant",
|
|
12
|
+
"data-size",
|
|
13
|
+
"data-tone",
|
|
14
|
+
"data-full-width",
|
|
15
|
+
"data-padding",
|
|
16
|
+
"data-elevation",
|
|
17
|
+
"data-shape",
|
|
18
|
+
"data-gap",
|
|
19
|
+
"data-span",
|
|
20
|
+
"data-span-sm",
|
|
21
|
+
"data-span-lg",
|
|
22
|
+
"data-ratio"
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Renders `tag` with `props`, or the consumer's element/function with `props` merged in (ours first).
|
|
26
|
+
* Element form: `mergeProps` semantics (the element's props win), except that the part's own
|
|
27
|
+
* `PART_OWNED` attributes win over the element's.
|
|
28
|
+
*/
|
|
29
|
+
function renderElement(tag, render, state, props) {
|
|
30
|
+
if (typeof render === "function") return render(props, state);
|
|
31
|
+
if (isValidElement(render)) {
|
|
32
|
+
const merged = mergeProps(props, render.props);
|
|
33
|
+
for (const name of PART_OWNED) if (props[name] !== void 0) merged[name] = props[name];
|
|
34
|
+
return cloneElement(render, merged);
|
|
35
|
+
}
|
|
36
|
+
return createElement(tag, props);
|
|
37
|
+
}
|
|
38
|
+
/** Normalises any render prop to the function form that engine adapters receive. */
|
|
39
|
+
function toRenderFn(render, tag) {
|
|
40
|
+
return (props, state) => renderElement(tag, render, state, props);
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { PART_OWNED, renderElement, toRenderFn };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/contracts/state.d.ts
|
|
2
|
+
/** Value sets of the valued attributes, in contracts/vocabulary.json order (checked by the test). */
|
|
3
|
+
export declare const SIDES: readonly ["top", "right", "bottom", "left"];
|
|
4
|
+
export declare const ALIGNS: readonly ["start", "center", "end"];
|
|
5
|
+
export declare const ORIENTATIONS: readonly ["horizontal", "vertical"];
|
|
6
|
+
export declare const MIRRORS: readonly ["rtl"];
|
|
7
|
+
export type Side = (typeof SIDES)[number];
|
|
8
|
+
export type Align = (typeof ALIGNS)[number];
|
|
9
|
+
export type Orientation = (typeof ORIENTATIONS)[number];
|
|
10
|
+
/** Engine-independent state, as adapters derive it from the engine's render state. */
|
|
11
|
+
export interface StateInput {
|
|
12
|
+
open?: boolean | undefined;
|
|
13
|
+
entering?: boolean | undefined;
|
|
14
|
+
exiting?: boolean | undefined;
|
|
15
|
+
side?: Side | undefined;
|
|
16
|
+
align?: Align | undefined;
|
|
17
|
+
nestedOpen?: boolean | undefined;
|
|
18
|
+
highlighted?: boolean | undefined;
|
|
19
|
+
selected?: boolean | undefined;
|
|
20
|
+
checked?: boolean | undefined;
|
|
21
|
+
indeterminate?: boolean | undefined;
|
|
22
|
+
pressed?: boolean | undefined;
|
|
23
|
+
focusVisible?: boolean | undefined;
|
|
24
|
+
disabled?: boolean | undefined;
|
|
25
|
+
readOnly?: boolean | undefined;
|
|
26
|
+
required?: boolean | undefined;
|
|
27
|
+
invalid?: boolean | undefined;
|
|
28
|
+
placeholder?: boolean | undefined;
|
|
29
|
+
orientation?: Orientation | undefined;
|
|
30
|
+
loading?: boolean | undefined;
|
|
31
|
+
pending?: boolean | undefined;
|
|
32
|
+
empty?: boolean | undefined;
|
|
33
|
+
error?: boolean | undefined;
|
|
34
|
+
mirror?: (typeof MIRRORS)[number] | undefined;
|
|
35
|
+
}
|
|
36
|
+
/** `data-*` attributes keyed by name; presence attributes carry `""`. */
|
|
37
|
+
export type StateAttrs = Record<`data-${string}`, string>;
|
|
38
|
+
/** Every attribute name `stateAttrs()` can emit. */
|
|
39
|
+
export declare const STATE_ATTR_NAMES: readonly string[];
|
|
40
|
+
/** Maps state to vocabulary attributes. False and absent states emit nothing. */
|
|
41
|
+
export declare function stateAttrs(state: StateInput): StateAttrs;
|
|
42
|
+
//#endregion
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/contracts/state.ts
|
|
2
|
+
const PRESENCE = [
|
|
3
|
+
["open", "data-open"],
|
|
4
|
+
["entering", "data-entering"],
|
|
5
|
+
["exiting", "data-exiting"],
|
|
6
|
+
["nestedOpen", "data-nested-open"],
|
|
7
|
+
["highlighted", "data-highlighted"],
|
|
8
|
+
["selected", "data-selected"],
|
|
9
|
+
["checked", "data-checked"],
|
|
10
|
+
["indeterminate", "data-indeterminate"],
|
|
11
|
+
["pressed", "data-pressed"],
|
|
12
|
+
["focusVisible", "data-focus-visible"],
|
|
13
|
+
["disabled", "data-disabled"],
|
|
14
|
+
["readOnly", "data-readonly"],
|
|
15
|
+
["required", "data-required"],
|
|
16
|
+
["invalid", "data-invalid"],
|
|
17
|
+
["placeholder", "data-placeholder"],
|
|
18
|
+
["loading", "data-loading"],
|
|
19
|
+
["pending", "data-pending"],
|
|
20
|
+
["empty", "data-empty"],
|
|
21
|
+
["error", "data-error"]
|
|
22
|
+
];
|
|
23
|
+
const VALUED = [
|
|
24
|
+
["side", "data-side"],
|
|
25
|
+
["align", "data-align"],
|
|
26
|
+
["orientation", "data-orientation"],
|
|
27
|
+
["mirror", "data-mirror"]
|
|
28
|
+
];
|
|
29
|
+
/** Every attribute name `stateAttrs()` can emit. */
|
|
30
|
+
const STATE_ATTR_NAMES = [...PRESENCE, ...VALUED].map(([, name]) => name);
|
|
31
|
+
/** Maps state to vocabulary attributes. False and absent states emit nothing. */
|
|
32
|
+
function stateAttrs(state) {
|
|
33
|
+
const out = {};
|
|
34
|
+
for (const [key, name] of PRESENCE) if (state[key] === true) out[name] = "";
|
|
35
|
+
for (const [key, name] of VALUED) {
|
|
36
|
+
const value = state[key];
|
|
37
|
+
if (value !== void 0) out[name] = value;
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { STATE_ATTR_NAMES, stateAttrs };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@layer nz.tokens, nz.themes, nz.reset, nz.base, nz.components, nz.patterns, nz.utilities;
|
|
2
|
+
@layer nz.components{.nz-alert{--_nz-alert-bg:var(--nz-bg-info-subtle);--_nz-alert-icon-fg:var(--nz-icon-info);align-items:flex-start;gap:var(--nz-alert-gap,var(--nz-space-3));padding-block:var(--nz-alert-padding-block,var(--nz-space-3));padding-inline:var(--nz-alert-padding-inline,var(--nz-space-4));border-radius:var(--nz-alert-radius,var(--nz-radius-lg));background:var(--nz-alert-bg,var(--_nz-alert-bg));color:var(--nz-text-primary);display:flex}.nz-alert-icon{inline-size:var(--nz-size-icon-md);block-size:var(--nz-size-icon-md);color:var(--nz-alert-icon-fg,var(--_nz-alert-icon-fg));font-size:var(--nz-size-icon-md);flex:none;display:inline-flex;&>svg{block-size:100%;inline-size:100%}}.nz-alert-content{gap:var(--nz-space-0-5);flex-direction:column;flex:1;min-inline-size:0;display:flex}.nz-alert-title{font:var(--nz-alert-title-font,var(--nz-font-label-m-strong))}.nz-alert-description{color:var(--nz-text-secondary);font:var(--nz-alert-description-font,var(--nz-font-body-m))}.nz-alert-action{gap:var(--nz-space-2);flex-wrap:wrap;margin-block-start:var(--nz-space-2);display:flex}.nz-alert-dismiss{flex:none}.nz-alert>.nz-icon-button.nz-alert-dismiss{--_nz-icon-button-fg:var(--nz-alert-dismiss-fg,var(--nz-icon-secondary));margin-block:calc((var(--nz-size-icon-md) - var(--nz-size-control-sm)) / 2);margin-inline:calc((var(--nz-size-icon-sm) - var(--nz-size-control-sm)) / 2)}.nz-alert[data-tone=success]{--_nz-alert-bg:var(--nz-bg-success-subtle);--_nz-alert-icon-fg:var(--nz-icon-success)}.nz-alert[data-tone=warning]{--_nz-alert-bg:var(--nz-bg-warning-subtle);--_nz-alert-icon-fg:var(--nz-icon-warning)}.nz-alert[data-tone=critical]{--_nz-alert-bg:var(--nz-bg-critical-subtle);--_nz-alert-icon-fg:var(--nz-icon-critical)}@media (forced-colors:active){.nz-alert{outline-offset:-1px;outline:1px solid canvastext}}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@layer nz.tokens, nz.themes, nz.reset, nz.base, nz.components, nz.patterns, nz.utilities;
|
|
2
|
+
@layer nz.components{.nz-badge{--_nz-badge-bg:var(--nz-bg-muted);--_nz-badge-fg:var(--nz-text-secondary);--_nz-badge-dot-bg:var(--nz-icon-secondary);align-items:center;gap:var(--nz-badge-gap,var(--nz-space-1-5));padding-block:var(--nz-space-0-5);padding-inline:var(--nz-badge-padding-inline,var(--nz-space-2));border-radius:var(--nz-badge-radius,var(--nz-radius-full));background:var(--nz-badge-bg,var(--_nz-badge-bg));color:var(--nz-badge-fg,var(--_nz-badge-fg));font:var(--nz-badge-font,var(--nz-font-label-m));white-space:nowrap;display:inline-flex}.nz-badge-dot{inline-size:var(--nz-space-1-5);block-size:var(--nz-space-1-5);border-radius:var(--nz-radius-full);background:var(--nz-badge-dot-bg,var(--_nz-badge-dot-bg));flex:none}.nz-badge[data-tone=success]{--_nz-badge-bg:var(--nz-bg-success-subtle);--_nz-badge-fg:var(--nz-text-success);--_nz-badge-dot-bg:var(--nz-icon-success)}.nz-badge[data-tone=warning]{--_nz-badge-bg:var(--nz-bg-warning-subtle);--_nz-badge-fg:var(--nz-text-warning);--_nz-badge-dot-bg:var(--nz-icon-warning)}.nz-badge[data-tone=critical]{--_nz-badge-bg:var(--nz-bg-critical-subtle);--_nz-badge-fg:var(--nz-text-critical);--_nz-badge-dot-bg:var(--nz-icon-critical)}.nz-badge[data-tone=info]{--_nz-badge-bg:var(--nz-bg-info-subtle);--_nz-badge-fg:var(--nz-text-info);--_nz-badge-dot-bg:var(--nz-icon-info)}.nz-badge[data-tone=brand]{--_nz-badge-bg:var(--nz-bg-brand);--_nz-badge-fg:var(--nz-text-on-brand);--_nz-badge-dot-bg:var(--nz-text-on-brand)}@media (forced-colors:active){.nz-badge{outline-offset:-1px;outline:1px solid canvastext}.nz-badge-dot{forced-color-adjust:none;background:canvastext}}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@layer nz.tokens, nz.themes, nz.reset, nz.base, nz.components, nz.patterns, nz.utilities;
|
|
2
|
+
@layer nz.base{:where(.nz-alert-dismiss,.nz-button,.nz-checkbox-input,.nz-dialog-close,.nz-dialog-trigger,.nz-icon-button,.nz-menu-trigger,.nz-native-select-trigger,.nz-radio-input,.nz-select-trigger,.nz-switch-input,.nz-tab-nav-link,.nz-tabs-tab,.nz-textarea,.nz-tooltip-trigger):is(:focus-visible,[data-focus-visible]){outline:var(--nz-border-width-focus) solid var(--nz-border-focus);outline-offset:2px}:where(.nz-menu-checkbox-item,.nz-menu-item,.nz-menu-radio-item,.nz-select-item):focus-visible{outline:none}:where(.nz-menu-checkbox-item,.nz-menu-item,.nz-menu-radio-item,.nz-select-item)[data-focus-visible],:where(.nz-segmented-control-item):is(:has(>input:focus-visible),[data-focus-visible]),:where(.nz-input):focus-within{outline:var(--nz-border-width-focus) solid var(--nz-border-focus);outline-offset:2px}[data-focus-inset]:is(:focus-visible,[data-focus-visible],:focus-within),[data-focus-inset]:has(>input:focus-visible){outline-offset:-2px}:where(.nz-alert-dismiss,.nz-button,.nz-checkbox-input,.nz-dialog-close,.nz-dialog-trigger,.nz-icon-button,.nz-menu-checkbox-item,.nz-menu-item,.nz-menu-radio-item,.nz-menu-trigger,.nz-native-select-trigger,.nz-radio-input,.nz-segmented-control-item,.nz-select-item,.nz-select-trigger,.nz-switch-input,.nz-tab-nav-link,.nz-tabs-tab,.nz-textarea,.nz-tooltip-trigger){touch-action:pan-x pan-y pinch-zoom}.nz-hit-target{position:relative}@media (pointer:coarse){.nz-hit-target:not([data-hit-inset]):after{content:"";inset:min(0px, calc((100% - var(--nz-size-touch-min)) / 2));position:absolute}}[data-nz-touch-targets=always] .nz-hit-target:not([data-hit-inset]):after{content:"";inset:min(0px, calc((100% - var(--nz-size-touch-min)) / 2));position:absolute}:dir(rtl) [data-mirror=rtl]{scale:-1 1}html{scroll-padding-block:var(--nz-layout-top-inset,0px) calc(var(--nz-layout-bottom-inset,0px) + var(--nz-toast-inset,0px))}@media (forced-colors:active){:where(.nz-checkbox-input,.nz-dialog-popup,.nz-menu-popup,.nz-radio-input,.nz-select-popup,.nz-switch-input,.nz-tooltip-popup){border:1px solid canvastext}:where(.nz-switch-thumb){forced-color-adjust:none;background:canvastext}:where(.nz-meter-track)::-moz-meter-bar{forced-color-adjust:none;background:highlight;outline-color:canvastext}:where(.nz-progress-bar-track)::-moz-progress-bar{forced-color-adjust:none;background:highlight;outline-color:canvastext}:where(.nz-meter-track)::-webkit-meter-even-less-good-value{forced-color-adjust:none;background:highlight;outline-color:canvastext}:where(.nz-meter-track)::-webkit-meter-optimum-value{forced-color-adjust:none;background:highlight;outline-color:canvastext}:where(.nz-meter-track)::-webkit-meter-suboptimum-value{forced-color-adjust:none;background:highlight;outline-color:canvastext}:where(.nz-progress-bar-track)::-webkit-progress-value{forced-color-adjust:none;background:highlight;outline-color:canvastext}:where(.nz-checkbox-input,.nz-radio-input,.nz-switch-input):checked{forced-color-adjust:none;background:highlight;outline-color:canvastext}:where(.nz-segmented-control-item):has(>input:checked){outline:2px solid highlight}:where(.nz-checkbox-input):indeterminate,:where(.nz-tab-nav-link)[aria-current=page]:before{forced-color-adjust:none;background:highlight;outline-color:canvastext}:where(.nz-icon-button)[aria-pressed=true],:where(.nz-menu-checkbox-item,.nz-menu-radio-item)[data-checked],:where(.nz-select-item)[data-selected]{color:highlighttext;forced-color-adjust:none;background:highlight;outline-color:canvastext}:where(.nz-tabs-tab)[data-selected]:before{forced-color-adjust:none;background:highlight;outline-color:canvastext}}}@layer nz.utilities{.nz-visually-hidden{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@layer nz.tokens, nz.themes, nz.reset, nz.base, nz.components, nz.patterns, nz.utilities;
|
|
2
|
+
@layer nz.components{.nz-button{--_nz-button-bg:var(--nz-bg-surface);--_nz-button-bg-hover:var(--nz-bg-hover);--_nz-button-bg-pressed:var(--nz-bg-pressed);--_nz-button-fg:var(--nz-text-primary);--_nz-button-border:var(--nz-border-default);--_nz-button-border-hover:var(--nz-border-strong);--_nz-button-shadow:none;--_nz-button-height:var(--nz-size-control-md);--_nz-button-padding-inline:var(--nz-space-4);--_nz-button-gap:var(--nz-space-2);--_nz-button-radius:var(--nz-radius-md);--_nz-button-font:var(--nz-font-label-m);--_nz-button-icon-size:var(--nz-size-icon-sm);box-sizing:border-box;justify-content:center;align-items:center;gap:var(--nz-button-gap,var(--_nz-button-gap));block-size:var(--nz-button-height,var(--_nz-button-height));padding-inline:var(--nz-button-padding-inline,var(--_nz-button-padding-inline));border:var(--nz-border-width-default) solid var(--nz-button-border,var(--_nz-button-border));border-radius:var(--nz-button-radius,var(--_nz-button-radius));background:var(--nz-button-bg,var(--_nz-button-bg));color:var(--nz-button-fg,var(--_nz-button-fg));box-shadow:var(--nz-button-shadow,var(--_nz-button-shadow));font:var(--nz-button-font,var(--_nz-button-font));cursor:pointer;transition:background-color var(--nz-duration-fast) var(--nz-easing-standard), border-color var(--nz-duration-fast) var(--nz-easing-standard), scale var(--nz-duration-instant) var(--nz-easing-standard);text-decoration:none;display:inline-flex;@media (hover:hover){&:hover:not(:disabled,[data-disabled],[aria-disabled=true]){background:var(--nz-button-bg-hover,var(--_nz-button-bg-hover));border-color:var(--nz-button-border-hover,var(--_nz-button-border-hover))}}&:active:not(:disabled,[data-disabled],[aria-disabled=true]){background:var(--nz-button-bg-pressed,var(--_nz-button-bg-pressed));border-color:var(--nz-button-border-hover,var(--_nz-button-border-hover));scale:var(--nz-scale-press)}&:focus-visible{box-shadow:var(--nz-button-shadow,var(--_nz-button-shadow)), 0 0 0 calc(var(--nz-border-width-focus) + 4px) var(--nz-focus-halo)}&:is(:disabled,[data-disabled]){background:var(--nz-button-bg-disabled,var(--nz-bg-disabled));color:var(--nz-button-fg-disabled,var(--nz-text-disabled));border-color:var(--nz-border-subtle);box-shadow:none;cursor:not-allowed}&[data-pending]{cursor:progress}&[data-full-width]{inline-size:100%}}.nz-button[data-variant=primary]{--_nz-button-bg:var(--nz-bg-brand);--_nz-button-bg-hover:var(--nz-bg-brand-hover);--_nz-button-bg-pressed:var(--nz-bg-brand-pressed);--_nz-button-fg:var(--nz-text-on-brand);--_nz-button-border:transparent;--_nz-button-border-hover:transparent;--_nz-button-shadow:var(--nz-elevation-button)}.nz-button[data-variant=tertiary]{--_nz-button-bg:transparent;--_nz-button-border:transparent;--_nz-button-border-hover:transparent}.nz-button[data-variant=critical]{--_nz-button-bg:var(--nz-bg-critical);--_nz-button-bg-hover:var(--nz-bg-critical-hover);--_nz-button-bg-pressed:var(--nz-bg-critical-hover);--_nz-button-fg:var(--nz-text-on-critical);--_nz-button-border:transparent;--_nz-button-border-hover:transparent}.nz-button[data-variant=accent]{--_nz-button-bg:var(--nz-bg-accent);--_nz-button-bg-hover:var(--nz-bg-accent-hover);--_nz-button-bg-pressed:var(--nz-bg-accent-hover);--_nz-button-fg:var(--nz-text-on-accent);--_nz-button-border:transparent;--_nz-button-border-hover:transparent}.nz-button[data-size=sm]{--_nz-button-height:var(--nz-size-control-sm);--_nz-button-padding-inline:var(--nz-space-3);--_nz-button-gap:var(--nz-space-1-5);--_nz-button-radius:var(--nz-radius-sm)}.nz-button[data-size=lg]{--_nz-button-height:var(--nz-size-control-lg);--_nz-button-padding-inline:var(--nz-space-5);--_nz-button-font:var(--nz-font-label-l);--_nz-button-icon-size:var(--nz-size-icon-md)}.nz-button-icon{inline-size:var(--_nz-button-icon-size);block-size:var(--_nz-button-icon-size);font-size:var(--_nz-button-icon-size);display:inline-flex}.nz-button[data-pending] .nz-glyph-spinner{animation:nz-button-spin var(--nz-duration-spin) linear infinite}.nz-button-pending-label{white-space:nowrap;text-overflow:ellipsis;text-align:center;grid-area:1/2;display:none;overflow:hidden}.nz-button-pending-label+.nz-button-label{grid-area:1/2}@media (prefers-reduced-motion:reduce){.nz-button[data-pending]{grid-auto-flow:column;align-content:center;display:inline-grid}.nz-button-pending-label{display:block}.nz-button-pending-label+.nz-button-label{opacity:0}}[data-nz-motion=reduce] .nz-button[data-pending]{grid-auto-flow:column;align-content:center;display:inline-grid}[data-nz-motion=reduce] .nz-button-pending-label{display:block}[data-nz-motion=reduce] .nz-button-pending-label+.nz-button-label{opacity:0}@keyframes nz-button-spin{to{rotate:1turn}}@media (forced-colors:active){.nz-button{border-color:buttontext}}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@layer nz.tokens, nz.themes, nz.reset, nz.base, nz.components, nz.patterns, nz.utilities;
|
|
2
|
+
@layer nz.components{.nz-card{--_nz-card-bg:var(--nz-bg-surface);--_nz-card-border:var(--nz-border-subtle);--_nz-card-padding:var(--nz-space-6);--_nz-card-shadow:none;gap:var(--nz-card-gap,var(--nz-space-5));padding:var(--nz-card-padding,var(--_nz-card-padding));border:var(--nz-border-width-default) solid var(--nz-card-border,var(--_nz-card-border));border-radius:var(--nz-card-radius,var(--nz-radius-xl));background:var(--nz-card-bg,var(--_nz-card-bg));box-shadow:var(--nz-card-shadow,var(--_nz-card-shadow));color:var(--nz-text-primary);flex-direction:column;display:flex}.nz-card[data-tone=subtle]{--_nz-card-bg:var(--nz-bg-subtle);--_nz-card-border:transparent}.nz-card[data-padding=sm]{--_nz-card-padding:var(--nz-space-5)}.nz-card[data-elevation="1"]{--_nz-card-shadow:var(--nz-elevation-1)}.nz-card[data-tone=inverse]{--_nz-card-border:transparent}.nz-card-header{align-items:center;gap:var(--nz-space-1) var(--nz-space-3);grid-template-columns:minmax(0,1fr);display:grid}.nz-card-title{font:var(--nz-card-title-font,var(--nz-font-heading-h4));letter-spacing:var(--nz-tracking-heading-h4);grid-column:1;margin:0}.nz-card-description{color:var(--nz-text-secondary);font:var(--nz-font-body-m);grid-column:1;margin:0}.nz-card-action{align-items:center;gap:var(--nz-space-2);color:var(--nz-icon-secondary);grid-area:1/2;display:flex}.nz-card-body{min-inline-size:0}.nz-card-footer{align-items:center;gap:var(--nz-space-3);flex-wrap:wrap;display:flex}@media (forced-colors:active){.nz-card{border-color:canvastext}}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@layer nz.tokens, nz.themes, nz.reset, nz.base, nz.components, nz.patterns, nz.utilities;
|
|
2
|
+
@layer nz.components{.nz-checkbox{--_nz-checkbox-size:1.25rem;justify-content:start;align-items:start;column-gap:var(--nz-checkbox-gap,var(--nz-space-2));color:var(--nz-text-primary);font:var(--nz-font-body-m);cursor:pointer;grid-template-columns:auto auto;display:inline-grid}.nz-checkbox-input,.nz-checkbox-indicator{grid-area:1/1;margin-block-start:calc((1lh - var(--nz-checkbox-size,var(--_nz-checkbox-size))) / 2)}.nz-checkbox-input{--_nz-checkbox-bg:var(--nz-bg-surface);--_nz-checkbox-border:var(--nz-border-control);appearance:none;box-sizing:border-box;inline-size:var(--nz-checkbox-size,var(--_nz-checkbox-size));block-size:var(--nz-checkbox-size,var(--_nz-checkbox-size));border:var(--nz-border-width-default) solid var(--_nz-checkbox-border);border-radius:var(--nz-checkbox-radius,var(--nz-radius-xs));background:var(--_nz-checkbox-bg);font:inherit;cursor:inherit;transition:background-color var(--nz-duration-fast) var(--nz-easing-standard), border-color var(--nz-duration-fast) var(--nz-easing-standard);margin-block-end:0;margin-inline:0}.nz-checkbox-input[aria-invalid=true]:not(:checked,:indeterminate){--_nz-checkbox-border:var(--nz-border-critical)}.nz-checkbox-input:is(:checked,:indeterminate){--_nz-checkbox-bg:var(--nz-checkbox-accent,var(--nz-bg-brand));--_nz-checkbox-border:transparent}@media (hover:hover){.nz-checkbox:hover>.nz-checkbox-input:not(:disabled,:checked,:indeterminate){--_nz-checkbox-border:var(--nz-border-control-hover)}}.nz-checkbox-input:disabled{--_nz-checkbox-bg:var(--nz-bg-disabled);--_nz-checkbox-border:var(--nz-border-subtle)}.nz-checkbox-input:disabled:is(:checked,:indeterminate){--_nz-checkbox-bg:var(--nz-bg-muted);--_nz-checkbox-border:transparent}.nz-checkbox-indicator{inline-size:var(--nz-checkbox-size,var(--_nz-checkbox-size));block-size:var(--nz-checkbox-size,var(--_nz-checkbox-size));color:var(--nz-text-on-brand);pointer-events:none;visibility:hidden;place-items:center;font-size:.875rem;display:grid;&>*{grid-area:1/1}}.nz-checkbox-input:is(:checked,:indeterminate)+.nz-checkbox-indicator{visibility:visible}.nz-checkbox-input:indeterminate+.nz-checkbox-indicator>.nz-glyph-check,.nz-checkbox-input:not(:indeterminate)+.nz-checkbox-indicator>.nz-glyph-minus{display:none}.nz-checkbox-input:disabled+.nz-checkbox-indicator{color:var(--nz-text-disabled)}.nz-checkbox-label{grid-area:1/2}.nz-checkbox:is([data-disabled],:has(>.nz-checkbox-input:disabled)){color:var(--nz-text-disabled);cursor:not-allowed}@media (forced-colors:active){.nz-checkbox-input:is(:checked,:indeterminate){forced-color-adjust:none;background:highlight}.nz-checkbox-input:disabled:is(:checked,:indeterminate){background:graytext}.nz-checkbox-indicator{color:highlighttext;forced-color-adjust:none}}}
|