@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,89 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ButtonVariant, ControlSize } from "../augment.js";
|
|
3
|
+
import { Align } from "../contracts/state.js";
|
|
4
|
+
import { TooltipSide } from "../tooltip/tooltip.contract.js";
|
|
5
|
+
import { ComponentPropsWithRef, ReactNode } from "react";
|
|
6
|
+
//#region src/icon-button/icon-button.contract.d.ts
|
|
7
|
+
export interface IconButtonState {
|
|
8
|
+
variant: ButtonVariant;
|
|
9
|
+
size: ControlSize;
|
|
10
|
+
pending: boolean;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
/** `true` or `false` for a toggle (`pressed` given); `undefined` for a plain action. */
|
|
13
|
+
pressed: boolean | undefined;
|
|
14
|
+
}
|
|
15
|
+
/** Where the tooltip goes and when it opens; `tooltip={{ side: 'bottom' }}`. */
|
|
16
|
+
export interface IconButtonTooltipOptions {
|
|
17
|
+
/** @default 'top' */
|
|
18
|
+
side?: TooltipSide;
|
|
19
|
+
/** @default 'center' */
|
|
20
|
+
align?: Align;
|
|
21
|
+
/** Hover delay in ms; keyboard focus opens it at once. @default 400 */
|
|
22
|
+
delay?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface IconButtonProps extends Omit<ComponentPropsWithRef<"button">, "children" | "aria-label" | "aria-pressed"> {
|
|
25
|
+
/**
|
|
26
|
+
* The action, in words: the button's accessible name (`aria-label`) and the tooltip text. Required,
|
|
27
|
+
* because the glyph alone names nothing. Keep it constant for a toggle (`"Bold"`, not "Bold on");
|
|
28
|
+
* `pressed` carries the state. An `aria-labelledby` you pass names the button instead, and the
|
|
29
|
+
* tooltip still shows `label`.
|
|
30
|
+
*/
|
|
31
|
+
label: string;
|
|
32
|
+
/** The glyph, decorative (`aria-hidden`): 16 px at `sm`, 20 px at `md`, 24 px at `lg`. */
|
|
33
|
+
icon: ReactNode;
|
|
34
|
+
/** Figma "Variant". @default 'secondary' */
|
|
35
|
+
variant?: ButtonVariant;
|
|
36
|
+
/** 32 / 40 / 48 px square. @default 'md' */
|
|
37
|
+
size?: ControlSize;
|
|
38
|
+
/**
|
|
39
|
+
* Makes it a toggle button: `aria-pressed` is written as given, so `false` is an unpressed toggle.
|
|
40
|
+
* Leave it out for a plain action.
|
|
41
|
+
*/
|
|
42
|
+
pressed?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* An action is in flight: the spinner replaces the glyph, and the button stays focusable with
|
|
45
|
+
* `aria-disabled` and swallows clicks. The spinner turns once per `--nz-duration-spin` and stops
|
|
46
|
+
* under Reduced motion; an icon-only button has no room for the "Loading…" text Button shows then,
|
|
47
|
+
* so show the progress in words next to it when the wait is long (for example a status line).
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
pending?: boolean;
|
|
51
|
+
/** Replaces the internal spinner glyph. */
|
|
52
|
+
pendingIndicator?: ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* Pairs the button with a Tooltip that shows `label` ("Icon-only buttons have an aria-label and a
|
|
55
|
+
* Tooltip", Figma). The tooltip is a client leaf; `false` renders the button with no client code
|
|
56
|
+
* running. Pass options to place it. Where visible text already names the action and the page
|
|
57
|
+
* should ship no JavaScript for the button, use `IconButtonStatic`: under Turbopack and `next dev`
|
|
58
|
+
* this module's import of the leaf ships the tooltip chain even with `tooltip={false}`.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
tooltip?: boolean | IconButtonTooltipOptions;
|
|
62
|
+
/**
|
|
63
|
+
* A keyboard shortcut shown in the tooltip after the label, with `Kbd` (`"mod+b"` is ⌘B on Apple
|
|
64
|
+
* platforms, Ctrl+B elsewhere). The app implements the shortcut; the button announces it through
|
|
65
|
+
* `aria-keyshortcuts` (`"Meta+B Control+B"`), with or without the tooltip.
|
|
66
|
+
*/
|
|
67
|
+
shortcut?: string;
|
|
68
|
+
/** Composition, for example `render={<Link href="/settings" />}`. */
|
|
69
|
+
render?: RenderProp<IconButtonState>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* IconButtonStatic's props: IconButton's, without the tooltip. `aria-label` is always required; an
|
|
73
|
+
* `aria-labelledby` pointing at visible text may be added, and then names the button, with
|
|
74
|
+
* `aria-label` as the fallback.
|
|
75
|
+
*/
|
|
76
|
+
export interface IconButtonStaticProps extends Omit<IconButtonProps, "label" | "tooltip" | "shortcut"> {
|
|
77
|
+
/** The action, in words: the button's accessible name. Required, because the glyph alone names nothing. */
|
|
78
|
+
"aria-label": string;
|
|
79
|
+
/** IconButtonStatic has no tooltip and no `label`: name it with `aria-label`. */
|
|
80
|
+
label?: never;
|
|
81
|
+
/** IconButtonStatic has no tooltip: use `IconButton` for one. */
|
|
82
|
+
tooltip?: never;
|
|
83
|
+
/**
|
|
84
|
+
* IconButtonStatic has no tooltip to show a shortcut in: pass `aria-keyshortcuts`
|
|
85
|
+
* (`"Meta+B Control+B"`) to announce one, or use `IconButton` with `shortcut`.
|
|
86
|
+
*/
|
|
87
|
+
shortcut?: never;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ariaKeyShortcuts } from "../_internal/keys.js";
|
|
2
|
+
import { iconButtonElement, warnUnnamed } from "./icon-button-static.js";
|
|
3
|
+
import { IconButtonTooltip } from "./icon-button.client.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/icon-button/icon-button.tsx
|
|
6
|
+
function IconButton({ tooltip = true, shortcut, ...props }) {
|
|
7
|
+
warnUnnamed(props.label, props["aria-labelledby"]);
|
|
8
|
+
const keyshortcuts = shortcut === void 0 ? void 0 : ariaKeyShortcuts(shortcut);
|
|
9
|
+
const button = keyshortcuts === void 0 || props["aria-keyshortcuts"] !== void 0 ? props : {
|
|
10
|
+
...props,
|
|
11
|
+
"aria-keyshortcuts": keyshortcuts
|
|
12
|
+
};
|
|
13
|
+
if (tooltip === false) return iconButtonElement(button);
|
|
14
|
+
return /* @__PURE__ */ jsx(IconButtonTooltip, {
|
|
15
|
+
...button,
|
|
16
|
+
tooltip: tooltip === true ? {} : tooltip,
|
|
17
|
+
...shortcut === void 0 ? {} : { shortcut }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { IconButton };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IconButtonProps, IconButtonState, IconButtonStaticProps, IconButtonTooltipOptions } from "./icon-button.contract.js";
|
|
2
|
+
import { IconButton } from "./icon-button.js";
|
|
3
|
+
import { IconButtonStatic } from "./icon-button-static.js";
|
|
4
|
+
export { IconButton, type IconButtonProps, type IconButtonState, IconButtonStatic, type IconButtonStaticProps, type IconButtonTooltipOptions };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
3
|
+
//#region src/image/image.d.ts
|
|
4
|
+
/** Aspect-ratio presets, emitted as `data-ratio` and cropped with `object-fit` (§14.3). */
|
|
5
|
+
export type ImageRatio = "1/1" | "4/5" | "3/2" | "16/9";
|
|
6
|
+
export interface ImageState {
|
|
7
|
+
ratio: ImageRatio | undefined;
|
|
8
|
+
priority: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ImageProps extends Omit<ComponentPropsWithRef<"img">, "src" | "alt" | "width" | "height" | "children"> {
|
|
11
|
+
src: string;
|
|
12
|
+
/** Required. `alt=""` marks a decorative image. */
|
|
13
|
+
alt: string;
|
|
14
|
+
/** Intrinsic width in px. Required with `height`, so the box is reserved before the image loads. */
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
ratio?: ImageRatio;
|
|
18
|
+
/** An above-the-fold image: eager loading and `fetchpriority="high"`. @default false */
|
|
19
|
+
priority?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* A framework image component, for example `render={<NextImage src={hero} alt="" />}`; it receives
|
|
22
|
+
* every prop, including `className` and `data-slot`.
|
|
23
|
+
*/
|
|
24
|
+
render?: RenderProp<ImageState>;
|
|
25
|
+
}
|
|
26
|
+
/** An `<img>` that never writes an inline `style`, so it renders under a strict CSP (§19.3). */
|
|
27
|
+
export declare function Image({ src, alt, width, height, ratio, priority, loading, fetchPriority, decoding, render, className, ...rest }: ImageProps): ReactElement;
|
|
28
|
+
//#endregion
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
//#region src/image/image.tsx
|
|
4
|
+
/** An `<img>` that never writes an inline `style`, so it renders under a strict CSP (§19.3). */
|
|
5
|
+
function Image({ src, alt, width, height, ratio, priority = false, loading, fetchPriority, decoding, render, className, ...rest }) {
|
|
6
|
+
return renderElement("img", render, {
|
|
7
|
+
ratio,
|
|
8
|
+
priority
|
|
9
|
+
}, {
|
|
10
|
+
"data-slot": "image",
|
|
11
|
+
"data-ratio": ratio,
|
|
12
|
+
...rest,
|
|
13
|
+
className: cx("nz-image", className),
|
|
14
|
+
src,
|
|
15
|
+
alt,
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
loading: priority ? "eager" : loading ?? "lazy",
|
|
19
|
+
fetchPriority: priority ? "high" : fetchPriority,
|
|
20
|
+
decoding: decoding ?? "async"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { Image };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Image } from "./image.js";
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Alert, AlertProps, AlertState, AlertTone } from "./alert/alert.js";
|
|
2
|
+
import { AlertDismiss, AlertDismissLabels, AlertDismissProps } from "./alert/alert-dismiss.client.js";
|
|
3
|
+
import "./alert/index.js";
|
|
4
|
+
import { Badge, BadgeProps, BadgeState, BadgeTone } from "./badge/badge.js";
|
|
5
|
+
import "./badge/index.js";
|
|
6
|
+
import { Button, ButtonLabels, ButtonProps, ButtonState } from "./button/button.js";
|
|
7
|
+
import "./button/index.js";
|
|
8
|
+
import { CardAction, CardActionProps, CardBody, CardBodyProps, CardDescription, CardDescriptionProps, CardElevation, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardPadding, CardRoot, CardRootProps, CardRootState, CardTitle, CardTitleLevel, CardTitleProps, CardTone } from "./card/card.js";
|
|
9
|
+
import { card_parts_d_exports } from "./card/card.parts.js";
|
|
10
|
+
import "./card/index.js";
|
|
11
|
+
import { OpenReason } from "./contracts/details.js";
|
|
12
|
+
import { Checkbox, CheckboxChangeReason, CheckboxCheckedState, CheckboxProps, CheckboxState } from "./checkbox/checkbox.client.js";
|
|
13
|
+
import "./checkbox/index.js";
|
|
14
|
+
import { Container, ContainerProps } from "./container/container.js";
|
|
15
|
+
import "./container/index.js";
|
|
16
|
+
import { Delta, DeltaProps, DeltaState, DeltaTone, DeltaTrend } from "./delta/delta.js";
|
|
17
|
+
import "./delta/index.js";
|
|
18
|
+
import { DialogBodyProps, DialogCloseProps, DialogCloseState, DialogDescriptionProps, DialogFooterProps, DialogLabels, DialogPopupProps, DialogPopupState, DialogRole, DialogRootProps, DialogSize, DialogTitleLevel, DialogTitleProps, DialogTriggerProps, DialogTriggerState } from "./dialog/dialog.contract.js";
|
|
19
|
+
import { DialogBody, DialogClose, DialogDescription, DialogFooter, DialogPopup, DialogRoot, DialogTitle, DialogTrigger } from "./dialog/dialog.client.js";
|
|
20
|
+
import { dialog_parts_d_exports } from "./dialog/dialog.parts.js";
|
|
21
|
+
import "./dialog/index.js";
|
|
22
|
+
import { EmptyState, EmptyStateProps, EmptyStateTitleLevel } from "./empty-state/empty-state.js";
|
|
23
|
+
import "./empty-state/index.js";
|
|
24
|
+
import { FieldControlProps, FieldIds, FieldProps, FieldState, FieldStatic, FieldStaticProps, FieldStaticWiring, FieldValidateOn, FieldValidityKey } from "./field/field-static.js";
|
|
25
|
+
import { Field } from "./field/field.js";
|
|
26
|
+
import { FieldControl, FieldControlElementProps, FieldControlOptions, FieldValidatable, useFieldControl } from "./field/field-scope.client.js";
|
|
27
|
+
import "./field/index.js";
|
|
28
|
+
import { Fieldset, FieldsetProps, FieldsetState } from "./fieldset/fieldset.js";
|
|
29
|
+
import "./fieldset/index.js";
|
|
30
|
+
import { LayoutGap, Stack, StackProps, StackState } from "./stack/stack.js";
|
|
31
|
+
import { Grid, GridItem, GridItemProps, GridItemState, GridProps, GridResponsiveSpan, GridSpan, GridState } from "./grid/grid.js";
|
|
32
|
+
import "./grid/index.js";
|
|
33
|
+
import { Text, TextProps, TextState, TextTone, TextVariant } from "./text/text.js";
|
|
34
|
+
import { Heading, HeadingLevel, HeadingProps, HeadingState, HeadingVariant } from "./heading/heading.js";
|
|
35
|
+
import "./heading/index.js";
|
|
36
|
+
import { TooltipLabels, TooltipPopupProps, TooltipPopupState, TooltipRootProps, TooltipSide, TooltipTriggerProps, TooltipTriggerState } from "./tooltip/tooltip.contract.js";
|
|
37
|
+
import { IconButtonProps, IconButtonState, IconButtonStaticProps, IconButtonTooltipOptions } from "./icon-button/icon-button.contract.js";
|
|
38
|
+
import { IconButton } from "./icon-button/icon-button.js";
|
|
39
|
+
import { IconButtonStatic } from "./icon-button/icon-button-static.js";
|
|
40
|
+
import "./icon-button/index.js";
|
|
41
|
+
import { Image, ImageProps, ImageRatio, ImageState } from "./image/image.js";
|
|
42
|
+
import "./image/index.js";
|
|
43
|
+
import { Inline, InlineProps, InlineState } from "./inline/inline.js";
|
|
44
|
+
import "./inline/index.js";
|
|
45
|
+
import { InlineError, InlineErrorProps } from "./inline-error/inline-error.js";
|
|
46
|
+
import "./inline-error/index.js";
|
|
47
|
+
import { Input, InputProps, InputState, InputType } from "./input/input.client.js";
|
|
48
|
+
import "./input/index.js";
|
|
49
|
+
import { Kbd, KbdPlatform, KbdProps } from "./kbd/kbd.js";
|
|
50
|
+
import "./kbd/index.js";
|
|
51
|
+
import { MenuCheckboxItemProps, MenuCheckedReason, MenuGroupLabelProps, MenuGroupProps, MenuItemProps, MenuItemState, MenuItemTone, MenuLabels, MenuPopupProps, MenuPopupState, MenuRadioGroupProps, MenuRadioItemProps, MenuRootProps, MenuSeparatorProps, MenuSide, MenuTriggerProps, MenuTriggerState } from "./menu/menu.contract.js";
|
|
52
|
+
import { MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuRoot, MenuSeparator, MenuTrigger } from "./menu/menu.client.js";
|
|
53
|
+
import { menu_parts_d_exports } from "./menu/menu.parts.js";
|
|
54
|
+
import "./menu/index.js";
|
|
55
|
+
import { Meter, MeterProps, MeterState, MeterTone } from "./meter/meter.js";
|
|
56
|
+
import "./meter/index.js";
|
|
57
|
+
import { NativeSelect, NativeSelectProps, NativeSelectState } from "./native-select/native-select.js";
|
|
58
|
+
import "./native-select/index.js";
|
|
59
|
+
import { ProgressBar, ProgressBarProps, ProgressBarState, ProgressBarTone } from "./progress-bar/progress-bar.js";
|
|
60
|
+
import "./progress-bar/index.js";
|
|
61
|
+
import { ProgressRing, ProgressRingProps, ProgressRingSize, ProgressRingState, ProgressRingTone } from "./progress-ring/progress-ring.js";
|
|
62
|
+
import "./progress-ring/index.js";
|
|
63
|
+
import { RadioGroup, RadioGroupChangeReason, RadioGroupProps } from "./radio-group/radio-group.js";
|
|
64
|
+
import { Radio, RadioProps, RadioState } from "./radio-group/radio-group.client.js";
|
|
65
|
+
import "./radio-group/index.js";
|
|
66
|
+
import { SegmentedControlChangeReason, SegmentedControlItem, SegmentedControlItemProps, SegmentedControlItemState, SegmentedControlRoot, SegmentedControlRootProps, SegmentedControlRootState } from "./segmented-control/segmented-control.client.js";
|
|
67
|
+
import { segmented_control_parts_d_exports } from "./segmented-control/segmented-control.parts.js";
|
|
68
|
+
import "./segmented-control/index.js";
|
|
69
|
+
import { SelectGroupLabelProps, SelectGroupProps, SelectItemProps, SelectItemState, SelectLabels, SelectPopupProps, SelectPopupState, SelectRootProps, SelectRootState, SelectSeparatorProps, SelectTriggerProps, SelectTriggerState, SelectValueProps, SelectValueReason, SelectValueState } from "./select/select.contract.js";
|
|
70
|
+
import { SelectGroup, SelectGroupLabel, SelectItem, SelectPopup, SelectRoot, SelectSeparator, SelectTrigger, SelectValue } from "./select/select.client.js";
|
|
71
|
+
import { select_parts_d_exports } from "./select/select.parts.js";
|
|
72
|
+
import "./select/index.js";
|
|
73
|
+
import { Separator, SeparatorProps, SeparatorState } from "./separator/separator.js";
|
|
74
|
+
import "./separator/index.js";
|
|
75
|
+
import { Skeleton, SkeletonProps, SkeletonShape, SkeletonState } from "./skeleton/skeleton.js";
|
|
76
|
+
import "./skeleton/index.js";
|
|
77
|
+
import "./stack/index.js";
|
|
78
|
+
import { Switch, SwitchChangeReason, SwitchProps, SwitchState } from "./switch/switch.client.js";
|
|
79
|
+
import "./switch/index.js";
|
|
80
|
+
import { TabNavLink, TabNavLinkProps, TabNavLinkState, TabNavRoot, TabNavRootProps } from "./tab-nav/tab-nav.js";
|
|
81
|
+
import { tab_nav_parts_d_exports } from "./tab-nav/tab-nav.parts.js";
|
|
82
|
+
import "./tab-nav/index.js";
|
|
83
|
+
import { TabsActivationMode, TabsListProps, TabsListState, TabsPanelProps, TabsPanelState, TabsRootProps, TabsRootState, TabsTabProps, TabsTabState, TabsValueReason } from "./tabs/tabs.contract.js";
|
|
84
|
+
import { TabsList, TabsPanel, TabsRoot, TabsTab } from "./tabs/tabs.client.js";
|
|
85
|
+
import { tabs_parts_d_exports } from "./tabs/tabs.parts.js";
|
|
86
|
+
import "./tabs/index.js";
|
|
87
|
+
import "./text/index.js";
|
|
88
|
+
import { Textarea, TextareaProps } from "./textarea/textarea.client.js";
|
|
89
|
+
import "./textarea/index.js";
|
|
90
|
+
import { ThemeScript, ThemeScriptProps, themeScript } from "./theme-script/theme-script.js";
|
|
91
|
+
import "./theme-script/index.js";
|
|
92
|
+
import { TooltipPopup, TooltipRoot, TooltipTrigger } from "./tooltip/tooltip.client.js";
|
|
93
|
+
import { tooltip_parts_d_exports } from "./tooltip/tooltip.parts.js";
|
|
94
|
+
import "./tooltip/index.js";
|
|
95
|
+
export { Alert, AlertDismiss, type AlertDismissLabels, type AlertDismissProps, type AlertProps, type AlertState, type AlertTone, Badge, type BadgeProps, type BadgeState, type BadgeTone, Button, type ButtonLabels, type ButtonProps, type ButtonState, 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, Checkbox, type CheckboxChangeReason, type CheckboxCheckedState, type CheckboxProps, type CheckboxState, Container, type ContainerProps, Delta, type DeltaProps, type DeltaState, type DeltaTone, type DeltaTrend, dialog_parts_d_exports as Dialog, DialogBody, type DialogBodyProps, DialogClose, type DialogCloseProps, type DialogCloseState, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, type DialogLabels, DialogPopup, type DialogPopupProps, type DialogPopupState, type DialogRole, DialogRoot, type DialogRootProps, type DialogSize, DialogTitle, type DialogTitleLevel, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, type DialogTriggerState, EmptyState, type EmptyStateProps, type EmptyStateTitleLevel, Field, type FieldControl, type FieldControlElementProps, type FieldControlOptions, type FieldControlProps, type FieldIds, type FieldProps, type FieldState, FieldStatic, type FieldStaticProps, type FieldStaticWiring, type FieldValidatable, type FieldValidateOn, type FieldValidityKey, Fieldset, type FieldsetProps, type FieldsetState, Grid, GridItem, type GridItemProps, type GridItemState, type GridProps, type GridResponsiveSpan, type GridSpan, type GridState, Heading, type HeadingLevel, type HeadingProps, type HeadingState, type HeadingVariant, IconButton, type IconButtonProps, type IconButtonState, IconButtonStatic, type IconButtonStaticProps, type IconButtonTooltipOptions, Image, type ImageProps, type ImageRatio, type ImageState, Inline, InlineError, type InlineErrorProps, type InlineProps, type InlineState, Input, type InputProps, type InputState, type InputType, Kbd, type KbdPlatform, type KbdProps, type LayoutGap, menu_parts_d_exports as Menu, MenuCheckboxItem, type MenuCheckboxItemProps, type MenuCheckedReason, MenuGroup, MenuGroupLabel, type MenuGroupLabelProps, type MenuGroupProps, MenuItem, type MenuItemProps, type MenuItemState, type MenuItemTone, type MenuLabels, MenuPopup, type MenuPopupProps, type MenuPopupState, MenuRadioGroup, type MenuRadioGroupProps, MenuRadioItem, type MenuRadioItemProps, MenuRoot, type MenuRootProps, MenuSeparator, type MenuSeparatorProps, type MenuSide, MenuTrigger, type MenuTriggerProps, type MenuTriggerState, Meter, type MeterProps, type MeterState, type MeterTone, NativeSelect, type NativeSelectProps, type NativeSelectState, type OpenReason, ProgressBar, type ProgressBarProps, type ProgressBarState, type ProgressBarTone, ProgressRing, type ProgressRingProps, type ProgressRingSize, type ProgressRingState, type ProgressRingTone, Radio, RadioGroup, type RadioGroupChangeReason, type RadioGroupProps, type RadioProps, type RadioState, segmented_control_parts_d_exports as SegmentedControl, type SegmentedControlChangeReason, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlItemState, SegmentedControlRoot, type SegmentedControlRootProps, type SegmentedControlRootState, select_parts_d_exports as Select, SelectGroup, SelectGroupLabel, type SelectGroupLabelProps, type SelectGroupProps, SelectItem, type SelectItemProps, type SelectItemState, type SelectLabels, SelectPopup, type SelectPopupProps, type SelectPopupState, SelectRoot, type SelectRootProps, type SelectRootState, SelectSeparator, type SelectSeparatorProps, SelectTrigger, type SelectTriggerProps, type SelectTriggerState, SelectValue, type SelectValueProps, type SelectValueReason, type SelectValueState, Separator, type SeparatorProps, type SeparatorState, Skeleton, type SkeletonProps, type SkeletonShape, type SkeletonState, Stack, type StackProps, type StackState, Switch, type SwitchChangeReason, type SwitchProps, type SwitchState, tab_nav_parts_d_exports as TabNav, TabNavLink, type TabNavLinkProps, type TabNavLinkState, TabNavRoot, type TabNavRootProps, tabs_parts_d_exports as Tabs, type TabsActivationMode, TabsList, type TabsListProps, type TabsListState, TabsPanel, type TabsPanelProps, type TabsPanelState, TabsRoot, type TabsRootProps, type TabsRootState, TabsTab, type TabsTabProps, type TabsTabState, type TabsValueReason, Text, type TextProps, type TextState, type TextTone, type TextVariant, Textarea, type TextareaProps, ThemeScript, type ThemeScriptProps, tooltip_parts_d_exports as Tooltip, type TooltipLabels, TooltipPopup, type TooltipPopupProps, type TooltipPopupState, TooltipRoot, type TooltipRootProps, type TooltipSide, TooltipTrigger, type TooltipTriggerProps, type TooltipTriggerState, themeScript, useFieldControl };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Alert } from "./alert/alert.js";
|
|
2
|
+
import { AlertDismiss } from "./alert/alert-dismiss.client.js";
|
|
3
|
+
import { Badge } from "./badge/badge.js";
|
|
4
|
+
import { Button } from "./button/button.js";
|
|
5
|
+
import { CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from "./card/card.js";
|
|
6
|
+
import { card_parts_exports } from "./card/card.parts.js";
|
|
7
|
+
import { InlineError } from "./inline-error/inline-error.js";
|
|
8
|
+
import { FieldStatic } from "./field/field-static.js";
|
|
9
|
+
import { useFieldControl } from "./field/field-scope.client.js";
|
|
10
|
+
import { Checkbox } from "./checkbox/checkbox.client.js";
|
|
11
|
+
import { Container } from "./container/container.js";
|
|
12
|
+
import { Delta } from "./delta/delta.js";
|
|
13
|
+
import { DialogBody, DialogClose, DialogDescription, DialogFooter, DialogPopup, DialogRoot, DialogTitle, DialogTrigger } from "./dialog/dialog.client.js";
|
|
14
|
+
import { dialog_parts_exports } from "./dialog/dialog.parts.js";
|
|
15
|
+
import { EmptyState } from "./empty-state/empty-state.js";
|
|
16
|
+
import { Field } from "./field/field.js";
|
|
17
|
+
import { Fieldset } from "./fieldset/fieldset.js";
|
|
18
|
+
import { Grid, GridItem } from "./grid/grid.js";
|
|
19
|
+
import { Heading } from "./heading/heading.js";
|
|
20
|
+
import { Kbd } from "./kbd/kbd.js";
|
|
21
|
+
import { TooltipPopup, TooltipRoot, TooltipTrigger } from "./tooltip/tooltip.client.js";
|
|
22
|
+
import { IconButtonStatic } from "./icon-button/icon-button-static.js";
|
|
23
|
+
import { IconButton } from "./icon-button/icon-button.js";
|
|
24
|
+
import { Image } from "./image/image.js";
|
|
25
|
+
import { Inline } from "./inline/inline.js";
|
|
26
|
+
import { Input } from "./input/input.client.js";
|
|
27
|
+
import { MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuRoot, MenuSeparator, MenuTrigger } from "./menu/menu.client.js";
|
|
28
|
+
import { menu_parts_exports } from "./menu/menu.parts.js";
|
|
29
|
+
import { Meter } from "./meter/meter.js";
|
|
30
|
+
import { NativeSelect } from "./native-select/native-select.js";
|
|
31
|
+
import { ProgressBar } from "./progress-bar/progress-bar.js";
|
|
32
|
+
import { ProgressRing } from "./progress-ring/progress-ring.js";
|
|
33
|
+
import { Radio } from "./radio-group/radio-group.client.js";
|
|
34
|
+
import { RadioGroup } from "./radio-group/radio-group.js";
|
|
35
|
+
import { SegmentedControlItem, SegmentedControlRoot } from "./segmented-control/segmented-control.client.js";
|
|
36
|
+
import { segmented_control_parts_exports } from "./segmented-control/segmented-control.parts.js";
|
|
37
|
+
import { SelectGroup, SelectGroupLabel, SelectItem, SelectPopup, SelectRoot, SelectSeparator, SelectTrigger, SelectValue } from "./select/select.client.js";
|
|
38
|
+
import { select_parts_exports } from "./select/select.parts.js";
|
|
39
|
+
import { Separator } from "./separator/separator.js";
|
|
40
|
+
import { Skeleton } from "./skeleton/skeleton.js";
|
|
41
|
+
import { Stack } from "./stack/stack.js";
|
|
42
|
+
import { Switch } from "./switch/switch.client.js";
|
|
43
|
+
import { TabNavLink, TabNavRoot } from "./tab-nav/tab-nav.js";
|
|
44
|
+
import { tab_nav_parts_exports } from "./tab-nav/tab-nav.parts.js";
|
|
45
|
+
import { TabsList, TabsPanel, TabsRoot, TabsTab } from "./tabs/tabs.client.js";
|
|
46
|
+
import { tabs_parts_exports } from "./tabs/tabs.parts.js";
|
|
47
|
+
import { Text } from "./text/text.js";
|
|
48
|
+
import { Textarea } from "./textarea/textarea.client.js";
|
|
49
|
+
import { ThemeScript, themeScript } from "./theme-script/theme-script.js";
|
|
50
|
+
import { tooltip_parts_exports } from "./tooltip/tooltip.parts.js";
|
|
51
|
+
export { Alert, AlertDismiss, Badge, Button, card_parts_exports as Card, CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle, Checkbox, Container, Delta, dialog_parts_exports as Dialog, DialogBody, DialogClose, DialogDescription, DialogFooter, DialogPopup, DialogRoot, DialogTitle, DialogTrigger, EmptyState, Field, FieldStatic, Fieldset, Grid, GridItem, Heading, IconButton, IconButtonStatic, Image, Inline, InlineError, Input, Kbd, menu_parts_exports as Menu, MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuRoot, MenuSeparator, MenuTrigger, Meter, NativeSelect, ProgressBar, ProgressRing, Radio, RadioGroup, segmented_control_parts_exports as SegmentedControl, SegmentedControlItem, SegmentedControlRoot, select_parts_exports as Select, SelectGroup, SelectGroupLabel, SelectItem, SelectPopup, SelectRoot, SelectSeparator, SelectTrigger, SelectValue, Separator, Skeleton, Stack, Switch, tab_nav_parts_exports as TabNav, TabNavLink, TabNavRoot, tabs_parts_exports as Tabs, TabsList, TabsPanel, TabsRoot, TabsTab, Text, Textarea, ThemeScript, tooltip_parts_exports as Tooltip, TooltipPopup, TooltipRoot, TooltipTrigger, themeScript, useFieldControl };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Inline } from "./inline.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { LayoutGap } from "../stack/stack.js";
|
|
3
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
4
|
+
//#region src/inline/inline.d.ts
|
|
5
|
+
export interface InlineState {
|
|
6
|
+
gap: LayoutGap | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface InlineProps extends ComponentPropsWithRef<"div"> {
|
|
9
|
+
/** Space between children, on both axes when they wrap. Absent, there is none. */
|
|
10
|
+
gap?: LayoutGap;
|
|
11
|
+
/** Another element, for example `render={<ul />}` for a list. */
|
|
12
|
+
render?: RenderProp<InlineState>;
|
|
13
|
+
}
|
|
14
|
+
/** Children in a row, centred on the cross axis, wrapping onto new lines when they do not fit. */
|
|
15
|
+
export declare function Inline({ gap, render, className, ...rest }: InlineProps): ReactElement;
|
|
16
|
+
//#endregion
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
//#region src/inline/inline.tsx
|
|
4
|
+
/** Children in a row, centred on the cross axis, wrapping onto new lines when they do not fit. */
|
|
5
|
+
function Inline({ gap, render, className, ...rest }) {
|
|
6
|
+
return renderElement("div", render, { gap }, {
|
|
7
|
+
"data-slot": "inline",
|
|
8
|
+
"data-gap": gap,
|
|
9
|
+
...rest,
|
|
10
|
+
className: cx("nz-inline", className)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Inline };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InlineError } from "./inline-error.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/inline-error/inline-error.d.ts
|
|
4
|
+
export interface InlineErrorProps extends ComponentPropsWithRef<"div"> {
|
|
5
|
+
/**
|
|
6
|
+
* The error mark, decorative: the message carries the meaning, and the mark keeps the error from
|
|
7
|
+
* being colour-only (§15.1). Defaults to the internal `circle-x` glyph; pass your icon set's glyph
|
|
8
|
+
* to replace it.
|
|
9
|
+
*/
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
/** A recovery control after the message, for example `<Button size="sm">Retry</Button>` (§16.5). */
|
|
12
|
+
action?: ReactNode;
|
|
13
|
+
render?: RenderProp<Record<string, never>>;
|
|
14
|
+
}
|
|
15
|
+
/** One error look for fields and data widgets: icon + text, never colour alone. Not a live region. */
|
|
16
|
+
export declare function InlineError({ icon, action, render, className, children, ...rest }: InlineErrorProps): ReactElement;
|
|
17
|
+
//#endregion
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
import { CircleXGlyph } from "../_internal/glyphs.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/inline-error/inline-error.tsx
|
|
6
|
+
/** One error look for fields and data widgets: icon + text, never colour alone. Not a live region. */
|
|
7
|
+
function InlineError({ icon, action, render, className, children, ...rest }) {
|
|
8
|
+
return renderElement("div", render, {}, {
|
|
9
|
+
"data-slot": "inline-error",
|
|
10
|
+
...rest,
|
|
11
|
+
className: cx("nz-inline-error", className),
|
|
12
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
|
+
/* @__PURE__ */ jsx("span", {
|
|
14
|
+
className: "nz-inline-error-icon",
|
|
15
|
+
"data-slot": "inline-error-icon",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
children: icon ?? /* @__PURE__ */ jsx(CircleXGlyph, {})
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ jsx("span", {
|
|
20
|
+
className: "nz-inline-error-message",
|
|
21
|
+
"data-slot": "inline-error-message",
|
|
22
|
+
children
|
|
23
|
+
}),
|
|
24
|
+
action != null && /* @__PURE__ */ jsx("span", {
|
|
25
|
+
className: "nz-inline-error-action",
|
|
26
|
+
"data-slot": "inline-error-action",
|
|
27
|
+
children: action
|
|
28
|
+
})
|
|
29
|
+
] })
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { InlineError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Input } from "./input.client.js";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ControlSize } from "../augment.js";
|
|
3
|
+
import { ComponentPropsWithRef, JSX, ReactNode } from "react";
|
|
4
|
+
//#region src/input/input.client.d.ts
|
|
5
|
+
/** Text-like input types; the others (checkbox, file, date, …) are other components. */
|
|
6
|
+
export type InputType = "text" | "email" | "search" | "password" | "number" | "tel" | "url";
|
|
7
|
+
export interface InputState {
|
|
8
|
+
size: ControlSize;
|
|
9
|
+
/** An error message is presented (the Field's, or the `invalid` prop). */
|
|
10
|
+
invalid: boolean;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
readOnly: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface InputProps extends Omit<ComponentPropsWithRef<"input">, "type" | "size" | "prefix" | "children"> {
|
|
15
|
+
/** @default 'text' */
|
|
16
|
+
type?: InputType;
|
|
17
|
+
/** 32 / 40 / 48 px, as Button and Select. @default 'md' */
|
|
18
|
+
size?: ControlSize;
|
|
19
|
+
/**
|
|
20
|
+
* An error message is presented for this input (§8.3). Inside a Field, the Field sets it; an
|
|
21
|
+
* explicit value here wins.
|
|
22
|
+
*/
|
|
23
|
+
invalid?: boolean;
|
|
24
|
+
/** Decorative icon before the value (`aria-hidden`). */
|
|
25
|
+
leadingIcon?: ReactNode;
|
|
26
|
+
/** Decorative icon after the value (`aria-hidden`). */
|
|
27
|
+
trailingIcon?: ReactNode;
|
|
28
|
+
/** Text before the value, such as a currency sign; joined to the input's `aria-describedby`. */
|
|
29
|
+
prefix?: ReactNode;
|
|
30
|
+
/** Text after the value, such as a unit; joined to the input's `aria-describedby`. */
|
|
31
|
+
suffix?: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Composition of the root, the bordered box around the native `<input>`. `className` and `style`
|
|
34
|
+
* go on the root too; every other prop, `ref` included, goes on the `<input>`.
|
|
35
|
+
*/
|
|
36
|
+
render?: RenderProp<InputState>;
|
|
37
|
+
}
|
|
38
|
+
export declare function Input({ type, size, id, name, required, disabled, readOnly, invalid, "aria-invalid": ariaInvalid, "aria-describedby": describedBy, leadingIcon, trailingIcon, prefix, suffix, render, className, style, ...rest }: InputProps): JSX.Element;
|
|
39
|
+
//#endregion
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { stateAttrs } from "../contracts/state.js";
|
|
6
|
+
import { joinIds } from "../_internal/field.js";
|
|
7
|
+
import { useFieldControl } from "../field/field-scope.client.js";
|
|
8
|
+
import { useId } from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/input/input.client.tsx
|
|
11
|
+
function Input({ type = "text", size = "md", id, name, required, disabled, readOnly, invalid, "aria-invalid": ariaInvalid, "aria-describedby": describedBy, leadingIcon, trailingIcon, prefix, suffix, render, className, style, ...rest }) {
|
|
12
|
+
const affix = useId();
|
|
13
|
+
const prefixId = prefix == null ? void 0 : `${affix}-prefix`;
|
|
14
|
+
const suffixId = suffix == null ? void 0 : `${affix}-suffix`;
|
|
15
|
+
const field = useFieldControl({
|
|
16
|
+
id,
|
|
17
|
+
name,
|
|
18
|
+
required,
|
|
19
|
+
disabled,
|
|
20
|
+
readOnly,
|
|
21
|
+
invalid: invalid ?? (ariaInvalid === true || ariaInvalid === "true" ? true : void 0),
|
|
22
|
+
"aria-describedby": joinIds(describedBy, prefixId, suffixId)
|
|
23
|
+
});
|
|
24
|
+
const state = {
|
|
25
|
+
size,
|
|
26
|
+
invalid: field.invalid,
|
|
27
|
+
disabled: field.disabled,
|
|
28
|
+
readOnly: field.readOnly
|
|
29
|
+
};
|
|
30
|
+
return renderElement("span", render, state, {
|
|
31
|
+
"data-slot": "input",
|
|
32
|
+
"data-size": size,
|
|
33
|
+
...stateAttrs({
|
|
34
|
+
invalid: state.invalid,
|
|
35
|
+
disabled: state.disabled,
|
|
36
|
+
readOnly: state.readOnly
|
|
37
|
+
}),
|
|
38
|
+
className: cx("nz-input", className),
|
|
39
|
+
style,
|
|
40
|
+
onMouseDown: focusInput,
|
|
41
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
42
|
+
leadingIcon != null && /* @__PURE__ */ jsx("span", {
|
|
43
|
+
className: "nz-input-icon",
|
|
44
|
+
"data-slot": "input-icon",
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
children: leadingIcon
|
|
47
|
+
}),
|
|
48
|
+
prefix != null && /* @__PURE__ */ jsx("span", {
|
|
49
|
+
className: "nz-input-prefix",
|
|
50
|
+
"data-slot": "input-prefix",
|
|
51
|
+
id: prefixId,
|
|
52
|
+
children: prefix
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ jsx("input", {
|
|
55
|
+
...mergeProps(field.controlProps, rest),
|
|
56
|
+
type,
|
|
57
|
+
className: "nz-input-control",
|
|
58
|
+
"data-slot": "input-control"
|
|
59
|
+
}),
|
|
60
|
+
suffix != null && /* @__PURE__ */ jsx("span", {
|
|
61
|
+
className: "nz-input-suffix",
|
|
62
|
+
"data-slot": "input-suffix",
|
|
63
|
+
id: suffixId,
|
|
64
|
+
children: suffix
|
|
65
|
+
}),
|
|
66
|
+
trailingIcon != null && /* @__PURE__ */ jsx("span", {
|
|
67
|
+
className: "nz-input-icon",
|
|
68
|
+
"data-slot": "input-icon",
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
children: trailingIcon
|
|
71
|
+
})
|
|
72
|
+
] })
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function focusInput(event) {
|
|
76
|
+
const input = event.currentTarget.querySelector(":scope > .nz-input-control");
|
|
77
|
+
if (input === null || event.target === input || input.disabled) return;
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
input.focus();
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { Input };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Kbd } from "./kbd.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/kbd/kbd.d.ts
|
|
4
|
+
/** The `data-platform` values of the glyph spans; they match `data-nz-platform` (§8.3). */
|
|
5
|
+
export type KbdPlatform = "apple" | "other";
|
|
6
|
+
export interface KbdProps extends ComponentPropsWithRef<"kbd"> {
|
|
7
|
+
/**
|
|
8
|
+
* A shortcut such as `"mod+k"` or `"mod+shift+d"`, drawn for both platforms (`⌘⇧D` and
|
|
9
|
+
* `Ctrl+Shift+D`); CSS shows the one `data-nz-platform` names, and `other` when no ancestor sets it.
|
|
10
|
+
* `mod` is ⌘ on Apple platforms and Ctrl elsewhere; the plus key is `plus` (`"mod+plus"`, or
|
|
11
|
+
* `"mod++"`). Replaces `children`.
|
|
12
|
+
*/
|
|
13
|
+
keys?: string;
|
|
14
|
+
/** Literal key text, for example `<Kbd>esc</Kbd>` or `<Kbd>↑↓</Kbd>`. */
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
render?: RenderProp<Record<string, never>>;
|
|
17
|
+
}
|
|
18
|
+
export declare function Kbd({ keys, render, className, children, ...rest }: KbdProps): ReactElement;
|
|
19
|
+
//#endregion
|