@devalok/shilp-sutra 0.48.0 → 0.49.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/BREAKING.json +32 -0
- package/MIGRATION.md +891 -881
- package/dist/_chunks/badge-group.js +50 -63
- package/dist/_chunks/badge-group.js.map +1 -1
- package/dist/_chunks/chat.js +1 -1
- package/dist/_chunks/chat.js.map +1 -1
- package/dist/_chunks/field-state.js +8 -0
- package/dist/_chunks/field-state.js.map +1 -0
- package/dist/_chunks/popover.js +50 -47
- package/dist/_chunks/popover.js.map +1 -1
- package/dist/_chunks/primitives.js +155 -155
- package/dist/_chunks/primitives.js.map +1 -1
- package/dist/_chunks/shared.js +4 -4
- package/dist/_chunks/tiptap.js +10 -10
- package/dist/_chunks/use-calendar.js +1 -1
- package/dist/_chunks/use-calendar.js.map +1 -1
- package/dist/_chunks/use-controllable-open.js +15 -0
- package/dist/_chunks/use-controllable-open.js.map +1 -0
- package/dist/composed/command-palette.js +3 -3
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/confirm-dialog.js +3 -3
- package/dist/composed/confirm-dialog.js.map +1 -1
- package/dist/composed/date-picker/index.js +3 -3
- package/dist/composed/date-picker/index.js.map +1 -1
- package/dist/composed/error-boundary.js +1 -1
- package/dist/composed/error-boundary.js.map +1 -1
- package/dist/composed/index.d.ts +3 -1
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +4 -3
- package/dist/composed/loading-skeleton.js +15 -15
- package/dist/composed/loading-skeleton.js.map +1 -1
- package/dist/composed/page-header.d.ts.map +1 -1
- package/dist/composed/page-header.js +32 -45
- package/dist/composed/page-header.js.map +1 -1
- package/dist/composed/page-skeletons.js +19 -19
- package/dist/composed/page-skeletons.js.map +1 -1
- package/dist/composed/responsive-modal.d.ts +39 -0
- package/dist/composed/responsive-modal.d.ts.map +1 -0
- package/dist/composed/responsive-modal.js +212 -0
- package/dist/composed/responsive-modal.js.map +1 -0
- package/dist/composed/rich-chat-input.js +4 -4
- package/dist/composed/rich-text-editor.js +1 -1
- package/dist/composed/rich-text-editor.js.map +1 -1
- package/dist/composed/schedule-view.d.ts +1 -1
- package/dist/composed/schedule-view.d.ts.map +1 -1
- package/dist/composed/schedule-view.js +48 -54
- package/dist/composed/schedule-view.js.map +1 -1
- package/dist/composed/status-badge.d.ts +13 -11
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js +54 -130
- package/dist/composed/status-badge.js.map +1 -1
- package/dist/shell/bottom-navbar.js +1 -1
- package/dist/shell/bottom-navbar.js.map +1 -1
- package/dist/shell/top-bar.js +1 -1
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/tokens/semantic.css +8 -1
- package/dist/ui/accordion.js +9 -9
- package/dist/ui/alert-dialog.js +26 -26
- package/dist/ui/aspect-ratio.js +1 -1
- package/dist/ui/autocomplete.js +7 -7
- package/dist/ui/avatar.d.ts.map +1 -1
- package/dist/ui/avatar.js +87 -82
- package/dist/ui/avatar.js.map +1 -1
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/breadcrumb.d.ts +0 -1
- package/dist/ui/breadcrumb.d.ts.map +1 -1
- package/dist/ui/breadcrumb.js +58 -35
- package/dist/ui/breadcrumb.js.map +1 -1
- package/dist/ui/button.js +3 -3
- package/dist/ui/checkbox.d.ts +4 -2
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +33 -28
- package/dist/ui/checkbox.js.map +1 -1
- package/dist/ui/collapsible.js +4 -4
- package/dist/ui/combobox.d.ts +3 -0
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +137 -132
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/context-menu.js +46 -46
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +53 -50
- package/dist/ui/dialog.js.map +1 -1
- package/dist/ui/dot.d.ts +38 -0
- package/dist/ui/dot.d.ts.map +1 -0
- package/dist/ui/dot.js +92 -0
- package/dist/ui/dot.js.map +1 -0
- package/dist/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/ui/dropdown-menu.js +70 -65
- package/dist/ui/dropdown-menu.js.map +1 -1
- package/dist/ui/hover-card.js +11 -11
- package/dist/ui/index.d.ts +3 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +67 -67
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/input-otp.js +1 -1
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/input.d.ts +4 -2
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +38 -37
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/lib/field-state.d.ts +21 -0
- package/dist/ui/lib/field-state.d.ts.map +1 -0
- package/dist/ui/lib/use-controllable-open.d.ts +32 -0
- package/dist/ui/lib/use-controllable-open.d.ts.map +1 -0
- package/dist/ui/link.js +1 -1
- package/dist/ui/number-input.d.ts +4 -2
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +51 -50
- package/dist/ui/number-input.js.map +1 -1
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/popover.d.ts.map +1 -1
- package/dist/ui/progress.d.ts +66 -42
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +144 -40
- package/dist/ui/progress.js.map +1 -1
- package/dist/ui/radio.d.ts +6 -2
- package/dist/ui/radio.d.ts.map +1 -1
- package/dist/ui/radio.js +44 -33
- package/dist/ui/radio.js.map +1 -1
- package/dist/ui/select.d.ts +1 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +58 -57
- package/dist/ui/select.js.map +1 -1
- package/dist/ui/separator.js +2 -2
- package/dist/ui/separator.js.map +1 -1
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +59 -56
- package/dist/ui/sheet.js.map +1 -1
- package/dist/ui/sidebar.js +5 -5
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/slider.js +6 -6
- package/dist/ui/slider.js.map +1 -1
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +122 -125
- package/dist/ui/stat-card.js.map +1 -1
- package/dist/ui/surface.js +1 -1
- package/dist/ui/switch.d.ts +3 -1
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +32 -27
- package/dist/ui/switch.js.map +1 -1
- package/dist/ui/textarea.d.ts +3 -3
- package/dist/ui/textarea.d.ts.map +1 -1
- package/dist/ui/textarea.js +18 -17
- package/dist/ui/textarea.js.map +1 -1
- package/dist/ui/toast.js +2 -2
- package/dist/ui/toast.js.map +1 -1
- package/dist/ui/toggle-group.js +1 -1
- package/dist/ui/toggle.js +1 -1
- package/dist/ui/tooltip.d.ts.map +1 -1
- package/dist/ui/tooltip.js +36 -33
- package/dist/ui/tooltip.js.map +1 -1
- package/docs/components/ai/ai-command-provider.md +46 -0
- package/docs/components/ai/block-renderer.md +59 -0
- package/docs/components/ai/command-bar.md +78 -0
- package/docs/components/ai/conversation.md +59 -0
- package/docs/components/ai/devadoot-icon.md +41 -0
- package/docs/components/composed/page-header.md +1 -1
- package/docs/components/composed/responsive-modal.md +66 -0
- package/docs/components/composed/schedule-view.md +6 -2
- package/docs/components/ui/breadcrumb.md +1 -1
- package/docs/components/ui/checkbox.md +4 -1
- package/docs/components/ui/combobox.md +4 -0
- package/docs/components/ui/dot.md +61 -0
- package/docs/components/ui/progress.md +54 -16
- package/docs/components/ui/radio.md +6 -2
- package/docs/components/ui/select.md +9 -5
- package/docs/components/ui/switch.md +4 -1
- package/docs/components/ui/table.md +2 -1
- package/llms.txt +11 -3
- package/make-kit/components/form.md +2 -2
- package/make-kit/components/icon.md +2 -2
- package/make-kit/components/overview.md +2 -2
- package/make-kit/components/select.md +1 -1
- package/make-kit/components/table.md +1 -1
- package/mcp-manifest.json +2656 -1068
- package/mcp-manifest.schema.json +18 -0
- package/package.json +11 -6
- package/skill/SKILL.md +1 -1
- package/skill/references/components.md +11 -3
- package/dist/ui/status-dot.d.ts +0 -27
- package/dist/ui/status-dot.d.ts.map +0 -1
- package/dist/ui/status-dot.js +0 -68
- package/dist/ui/status-dot.js.map +0 -1
- package/docs/components/ui/status-dot.md +0 -35
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/**
|
|
3
|
+
* Options for {@link useControllableOpen}. Mirrors the standard Radix open-state
|
|
4
|
+
* prop trio so a component can spread its own props straight in.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseControllableOpenOptions {
|
|
7
|
+
/** Controlled open value. When defined, the hook is in controlled mode. */
|
|
8
|
+
open?: boolean;
|
|
9
|
+
/** Initial open value in uncontrolled mode. @default false */
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
/** Called on every open/close request (both modes). */
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface ControllableOpen {
|
|
15
|
+
/** The effective open state (controlled value, or internal state). */
|
|
16
|
+
open: boolean;
|
|
17
|
+
/** Request a new open state — updates internal state (uncontrolled) and always fires `onOpenChange`. */
|
|
18
|
+
setOpen: (next: boolean) => void;
|
|
19
|
+
/** Convenience: `setOpen(false)`. Stable across renders. */
|
|
20
|
+
close: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Controlled/uncontrolled open-state machine shared by every overlay
|
|
24
|
+
* (Dialog, Popover, Sheet, Tooltip, DropdownMenu, …). The effective `open` is
|
|
25
|
+
* kept in React state even in controlled mode so overlays can drive
|
|
26
|
+
* `AnimatePresence` exit animations from it.
|
|
27
|
+
*
|
|
28
|
+
* Extracted so the identical block isn't hand-copied per overlay — one fix
|
|
29
|
+
* site instead of six.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useControllableOpen({ open: controlledOpen, defaultOpen, onOpenChange, }: UseControllableOpenOptions): ControllableOpen;
|
|
32
|
+
//# sourceMappingURL=use-controllable-open.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-controllable-open.d.ts","sourceRoot":"","sources":["../../../src/ui/lib/use-controllable-open.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,2EAA2E;IAC3E,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,uDAAuD;IACvD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,IAAI,EAAE,OAAO,CAAA;IACb,wGAAwG;IACxG,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAChC,4DAA4D;IAC5D,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EAAE,cAAc,EACpB,WAAmB,EACnB,YAAY,GACb,EAAE,0BAA0B,GAAG,gBAAgB,CAgB/C"}
|
package/dist/ui/link.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { FieldState } from './lib/field-state';
|
|
3
4
|
import * as React from 'react';
|
|
4
|
-
|
|
5
|
+
/** @deprecated Use `FieldState` — the shared control-state type. Kept as an alias. */
|
|
6
|
+
export type NumberInputState = FieldState;
|
|
5
7
|
declare const numberInputWrapperVariants: (props?: ({
|
|
6
8
|
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
7
9
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -47,7 +49,7 @@ export interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInp
|
|
|
47
49
|
/** Size of the number input. Controls height, button sizes, text size. */
|
|
48
50
|
size?: NumberInputSize;
|
|
49
51
|
/** Validation state controlling border color. */
|
|
50
|
-
state?:
|
|
52
|
+
state?: FieldState;
|
|
51
53
|
}
|
|
52
54
|
declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
53
55
|
export { NumberInput, numberInputWrapperVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-input.d.ts","sourceRoot":"","sources":["../../src/ui/number-input.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"number-input.d.ts","sourceRoot":"","sources":["../../src/ui/number-input.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,mBAAmB,CAAA;AAGtE,sFAAsF;AACtF,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAA;AAEzC,QAAA,MAAM,0BAA0B;;8EAa/B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAkClG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IACjI,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0EAA0E;IAC1E,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,iDAAiD;IACjD,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB;AAED,QAAA,MAAM,WAAW,2FAmHhB,CAAA;AAGD,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,CAAA"}
|
package/dist/ui/number-input.js
CHANGED
|
@@ -3,11 +3,12 @@ import { t as e } from "../_chunks/vendor-utils.js";
|
|
|
3
3
|
import { cn as t } from "./lib/utils.js";
|
|
4
4
|
import { Icon as n } from "./icon.js";
|
|
5
5
|
import { useFormField as r } from "./form.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
6
|
+
import { t as i } from "../_chunks/field-state.js";
|
|
7
|
+
import * as a from "react";
|
|
8
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
9
|
+
import { IconMinus as c, IconPlus as l } from "@tabler/icons-react";
|
|
9
10
|
//#region src/ui/number-input.tsx
|
|
10
|
-
var
|
|
11
|
+
var u = e("flex items-center justify-between rounded-control border border-surface-border-strong", {
|
|
11
12
|
variants: { size: {
|
|
12
13
|
xs: "h-ds-xs-plus",
|
|
13
14
|
sm: "h-ds-sm",
|
|
@@ -15,89 +16,89 @@ var l = e("flex items-center justify-between rounded-control border border-surfa
|
|
|
15
16
|
lg: "h-ds-lg"
|
|
16
17
|
} },
|
|
17
18
|
defaultVariants: { size: "md" }
|
|
18
|
-
}),
|
|
19
|
+
}), d = {
|
|
19
20
|
xs: "h-[22px] w-[22px]",
|
|
20
21
|
sm: "h-ds-sm w-ds-sm",
|
|
21
22
|
md: "h-ds-sm w-ds-sm",
|
|
22
23
|
lg: "h-ds-md w-ds-md"
|
|
23
|
-
},
|
|
24
|
+
}, f = {
|
|
24
25
|
xs: "xs",
|
|
25
26
|
sm: "sm",
|
|
26
27
|
md: "sm",
|
|
27
28
|
lg: "md"
|
|
28
|
-
},
|
|
29
|
-
xs: "text-ds-sm w-
|
|
29
|
+
}, p = {
|
|
30
|
+
xs: "text-ds-sm w-ds-06b",
|
|
30
31
|
sm: "text-ds-sm w-ds-sm-plus",
|
|
31
32
|
md: "text-ds-md w-ds-sm-plus",
|
|
32
33
|
lg: "text-ds-md w-ds-md"
|
|
33
|
-
},
|
|
34
|
+
}, m = {
|
|
34
35
|
default: "",
|
|
35
36
|
error: "border-error-7",
|
|
36
37
|
warning: "border-warning-7",
|
|
37
38
|
success: "border-success-7"
|
|
38
|
-
},
|
|
39
|
-
let
|
|
39
|
+
}, h = a.forwardRef(({ value: e = 0, onValueChange: a, min: h = -(2 ** 53 - 1), max: g = 2 ** 53 - 1, step: _ = 1, disabled: v = !1, className: y, size: b = "md", state: x, "aria-label": S, ...C }, w) => {
|
|
40
|
+
let T = b ?? "md", E = r(), D = S ?? (C.id || E.helperTextId ? void 0 : "Numeric value"), O = i(x, E.state) ?? "default", k = (e) => {
|
|
40
41
|
let t = e.target.value.trim();
|
|
41
42
|
if (t === "" || t === "-") {
|
|
42
|
-
|
|
43
|
+
a?.(h >= 0 ? h : 0);
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
46
|
let n = Number(t);
|
|
46
|
-
Number.isNaN(n) ||
|
|
47
|
-
}, k = (t) => {
|
|
48
|
-
t.preventDefault();
|
|
49
|
-
let n = e + g;
|
|
50
|
-
n <= h && i?.(n);
|
|
47
|
+
Number.isNaN(n) || a?.(Math.min(Math.max(n, h), g));
|
|
51
48
|
}, A = (t) => {
|
|
52
49
|
t.preventDefault();
|
|
53
|
-
let n = e
|
|
54
|
-
n
|
|
55
|
-
}, j =
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
let n = e + _;
|
|
51
|
+
n <= g && a?.(n);
|
|
52
|
+
}, j = (t) => {
|
|
53
|
+
t.preventDefault();
|
|
54
|
+
let n = e - _;
|
|
55
|
+
n >= h && a?.(n);
|
|
56
|
+
}, M = d[T], N = f[T], P = p[T];
|
|
57
|
+
return /* @__PURE__ */ s("div", {
|
|
58
|
+
className: t(u({ size: T }), m[O], y),
|
|
58
59
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ o("button", {
|
|
60
61
|
type: "button",
|
|
61
|
-
onClick:
|
|
62
|
-
disabled:
|
|
62
|
+
onClick: j,
|
|
63
|
+
disabled: v || e <= h,
|
|
63
64
|
"aria-label": "Decrease value",
|
|
64
65
|
title: "Decrease",
|
|
65
|
-
className: t("flex items-center justify-center border-0 rounded-control-inner text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg-muted active:scale-90 transition-[color,background-color,transform] duration-fast-01 ease-productive-standard disabled:opacity-action-disabled disabled:pointer-events-none",
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
icon:
|
|
68
|
-
size:
|
|
66
|
+
className: t("flex items-center justify-center border-0 rounded-control-inner text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg-muted active:scale-90 transition-[color,background-color,transform] duration-fast-01 ease-productive-standard disabled:opacity-action-disabled disabled:pointer-events-none", M),
|
|
67
|
+
children: /* @__PURE__ */ o(n, {
|
|
68
|
+
icon: c,
|
|
69
|
+
size: N
|
|
69
70
|
})
|
|
70
71
|
}),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
ref:
|
|
72
|
+
/* @__PURE__ */ o("input", {
|
|
73
|
+
ref: w,
|
|
73
74
|
type: "number",
|
|
74
75
|
value: e,
|
|
75
|
-
onChange:
|
|
76
|
-
min:
|
|
77
|
-
max:
|
|
78
|
-
step:
|
|
79
|
-
disabled:
|
|
80
|
-
"aria-label":
|
|
81
|
-
"aria-invalid":
|
|
82
|
-
"aria-describedby":
|
|
83
|
-
className: t("bg-transparent font-semibold border-0 text-center text-surface-fg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
|
|
84
|
-
...
|
|
76
|
+
onChange: k,
|
|
77
|
+
min: h,
|
|
78
|
+
max: g,
|
|
79
|
+
step: _,
|
|
80
|
+
disabled: v,
|
|
81
|
+
"aria-label": D,
|
|
82
|
+
"aria-invalid": O === "error" || void 0,
|
|
83
|
+
"aria-describedby": C["aria-describedby"] ?? E.helperTextId,
|
|
84
|
+
className: t("bg-transparent font-semibold border-0 text-center text-surface-fg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none", P),
|
|
85
|
+
...C
|
|
85
86
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ o("button", {
|
|
87
88
|
type: "button",
|
|
88
|
-
onClick:
|
|
89
|
-
disabled:
|
|
89
|
+
onClick: A,
|
|
90
|
+
disabled: v || e >= g,
|
|
90
91
|
"aria-label": "Increase value",
|
|
91
92
|
title: "Increase",
|
|
92
|
-
className: t("flex items-center justify-center border-0 rounded-control-inner text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg-muted active:scale-90 transition-[color,background-color,transform] duration-fast-01 ease-productive-standard disabled:opacity-action-disabled disabled:pointer-events-none",
|
|
93
|
-
children: /* @__PURE__ */
|
|
94
|
-
icon:
|
|
95
|
-
size:
|
|
93
|
+
className: t("flex items-center justify-center border-0 rounded-control-inner text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg-muted active:scale-90 transition-[color,background-color,transform] duration-fast-01 ease-productive-standard disabled:opacity-action-disabled disabled:pointer-events-none", M),
|
|
94
|
+
children: /* @__PURE__ */ o(n, {
|
|
95
|
+
icon: l,
|
|
96
|
+
size: N
|
|
96
97
|
})
|
|
97
98
|
})
|
|
98
99
|
]
|
|
99
100
|
});
|
|
100
101
|
});
|
|
101
|
-
|
|
102
|
+
h.displayName = "NumberInput";
|
|
102
103
|
//#endregion
|
|
103
|
-
export {
|
|
104
|
+
export { h as NumberInput, u as numberInputWrapperVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-input.js","names":[],"sources":["../../src/ui/number-input.tsx"],"sourcesContent":["'use client'\n\nimport { IconMinus, IconPlus } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { useFormField } from './form'\nimport { Icon } from './icon'\nimport type { IconSize } from './icon-context'\nimport { cn } from './lib/utils'\n\
|
|
1
|
+
{"version":3,"file":"number-input.js","names":[],"sources":["../../src/ui/number-input.tsx"],"sourcesContent":["'use client'\n\nimport { IconMinus, IconPlus } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { useFormField } from './form'\nimport { Icon } from './icon'\nimport type { IconSize } from './icon-context'\nimport { type FieldState, resolveFieldState } from './lib/field-state'\nimport { cn } from './lib/utils'\n\n/** @deprecated Use `FieldState` — the shared control-state type. Kept as an alias. */\nexport type NumberInputState = FieldState\n\nconst numberInputWrapperVariants = cva(\n 'flex items-center justify-between rounded-control border border-surface-border-strong',\n {\n variants: {\n size: {\n xs: 'h-ds-xs-plus',\n sm: 'h-ds-sm',\n md: 'h-ds-md',\n lg: 'h-ds-lg',\n },\n },\n defaultVariants: { size: 'md' },\n },\n)\n\nexport type NumberInputSize = NonNullable<VariantProps<typeof numberInputWrapperVariants>['size']>\n\n/** Maps size to stepper button dimensions */\nconst buttonSizeMap: Record<NonNullable<NumberInputSize>, string> = {\n xs: 'h-[22px] w-[22px]',\n sm: 'h-ds-sm w-ds-sm',\n md: 'h-ds-sm w-ds-sm',\n lg: 'h-ds-md w-ds-md',\n}\n\n/** Maps size to Icon component size */\nconst iconSizeMap: Record<NonNullable<NumberInputSize>, IconSize> = {\n xs: 'xs',\n sm: 'sm',\n md: 'sm',\n lg: 'md',\n}\n\n/** Maps size to input text and width classes */\nconst inputSizeMap: Record<NonNullable<NumberInputSize>, string> = {\n xs: 'text-ds-sm w-ds-06b',\n sm: 'text-ds-sm w-ds-sm-plus',\n md: 'text-ds-md w-ds-sm-plus',\n lg: 'text-ds-md w-ds-md',\n}\n\n/** Maps state to border color classes */\nconst stateColorMap: Record<NonNullable<NumberInputState>, string> = {\n default: '',\n error: 'border-error-7',\n warning: 'border-warning-7',\n success: 'border-success-7',\n}\n\n/**\n * Props for NumberInput — a stepper control with \"−\" and \"+\" buttons flanking a numeric input,\n * clamped between `min` and `max`. The decrement/increment buttons are disabled when bounds are reached.\n *\n * **Controlled only:** Pass `value` + `onValueChange` for controlled usage. Uncontrolled usage is\n * possible but the buttons won't update the displayed value without `onValueChange`.\n *\n * **Step:** The `step` prop controls how much each button press increments/decrements (default 1).\n * Direct text input is also clamped to `[min, max]` on change.\n *\n * **Sizes:** `xs` (28px) | `sm` (32px) | `md` (40px, default) | `lg` (48px)\n *\n * **Validation states:** `state=\"error\"` colors the border red.\n * Use with `<FormField>` to show helper text below the input.\n *\n * @example\n * // Quantity selector with 1–99 range:\n * <NumberInput value={qty} onValueChange={setQty} min={1} max={99} />\n *\n * @example\n * // Rating input (1–10, step 1):\n * <NumberInput value={rating} onValueChange={setRating} min={1} max={10} />\n *\n * @example\n * // Fine-grained opacity control (0–100, step 5):\n * <NumberInput value={opacity} onValueChange={setOpacity} min={0} max={100} step={5} />\n *\n * @example\n * // Disabled number display (read-only-like):\n * <NumberInput value={autoCalcValue} onValueChange={() => {}} disabled />\n * // These are just a few ways — feel free to combine props creatively!\n */\nexport interface NumberInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'type' | 'size'> {\n value?: number\n onValueChange?: (value: number) => void\n min?: number\n max?: number\n step?: number\n /** Size of the number input. Controls height, button sizes, text size. */\n size?: NumberInputSize\n /** Validation state controlling border color. */\n state?: FieldState\n}\n\nconst NumberInput = React.forwardRef<HTMLInputElement, NumberInputProps>(\n (\n {\n value = 0,\n onValueChange,\n min = Number.MIN_SAFE_INTEGER,\n max = Number.MAX_SAFE_INTEGER,\n step = 1,\n disabled = false,\n className,\n size: sizeProp = 'md',\n state: stateProp,\n 'aria-label': ariaLabelProp,\n ...rest\n },\n ref,\n ) => {\n const size = sizeProp ?? 'md'\n const fieldCtx = useFormField()\n // If no explicit aria-label and not inside a FormField (no id to associate with Label),\n // provide a sensible default\n const ariaLabel = ariaLabelProp ?? (rest.id || fieldCtx.helperTextId ? undefined : 'Numeric value')\n\n // Merge FormField context — explicit props always win (shared precedence)\n const state = resolveFieldState(stateProp, fieldCtx.state) ?? 'default'\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const raw = e.target.value.trim()\n if (raw === '' || raw === '-') {\n onValueChange?.(min >= 0 ? min : 0)\n return\n }\n const parsed = Number(raw)\n if (Number.isNaN(parsed)) return\n const clamped = Math.min(Math.max(parsed, min), max)\n onValueChange?.(clamped)\n }\n\n const handleIncrement = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault() // Prevent form submission\n const newValue = value + step\n if (newValue <= max) {\n onValueChange?.(newValue)\n }\n }\n\n const handleDecrement = (e: React.MouseEvent<HTMLButtonElement>) => {\n e.preventDefault() // Prevent form submission\n const newValue = value - step\n if (newValue >= min) {\n onValueChange?.(newValue)\n }\n }\n\n const resolvedButtonSize = buttonSizeMap[size]\n const resolvedIconSize = iconSizeMap[size]\n const resolvedInputSize = inputSizeMap[size]\n\n return (\n <div\n className={cn(\n numberInputWrapperVariants({ size }),\n stateColorMap[state],\n className,\n )}\n >\n <button\n type=\"button\"\n onClick={handleDecrement}\n disabled={disabled || value <= min}\n aria-label=\"Decrease value\"\n title=\"Decrease\"\n className={cn(\n 'flex items-center justify-center border-0 rounded-control-inner text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg-muted active:scale-90 transition-[color,background-color,transform] duration-fast-01 ease-productive-standard disabled:opacity-action-disabled disabled:pointer-events-none',\n resolvedButtonSize,\n )}\n >\n <Icon icon={IconMinus} size={resolvedIconSize} />\n </button>\n\n <input\n ref={ref}\n type=\"number\"\n value={value}\n onChange={handleInputChange}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-invalid={state === 'error' || undefined}\n aria-describedby={rest['aria-describedby'] ?? fieldCtx.helperTextId}\n className={cn(\n 'bg-transparent font-semibold border-0 text-center text-surface-fg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none',\n resolvedInputSize,\n )}\n {...rest}\n />\n\n <button\n type=\"button\"\n onClick={handleIncrement}\n disabled={disabled || value >= max}\n aria-label=\"Increase value\"\n title=\"Increase\"\n className={cn(\n 'flex items-center justify-center border-0 rounded-control-inner text-surface-fg-subtle hover:bg-surface-raised-hover hover:text-surface-fg-muted active:scale-90 transition-[color,background-color,transform] duration-fast-01 ease-productive-standard disabled:opacity-action-disabled disabled:pointer-events-none',\n resolvedButtonSize,\n )}\n >\n <Icon icon={IconPlus} size={resolvedIconSize} />\n </button>\n </div>\n )\n },\n)\nNumberInput.displayName = 'NumberInput'\n\nexport { NumberInput, numberInputWrapperVariants }\n"],"mappings":";;;;;;;;;;AAeA,IAAM,IAA6B,EACjC,yFACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACL,EACF;CACD,iBAAiB,EAAE,MAAM,MAAM;CAChC,CACF,EAKK,IAA8D;CAClE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAGK,IAA8D;CAClE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAGK,IAA6D;CACjE,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAGK,IAA+D;CACnE,SAAS;CACT,OAAO;CACP,SAAS;CACT,SAAS;CACV,EA8CK,IAAc,EAAM,YAEtB,EACE,WAAQ,GACR,kBACA,SAAM,gBACN,sBACA,UAAO,GACP,cAAW,IACX,cACA,MAAM,IAAW,MACjB,OAAO,GACP,cAAc,GACd,GAAG,KAEL,MACG;CACH,IAAM,IAAO,KAAY,MACnB,IAAW,GAAc,EAGzB,IAAY,MAAkB,EAAK,MAAM,EAAS,eAAe,KAAA,IAAY,kBAG7E,IAAQ,EAAkB,GAAW,EAAS,MAAM,IAAI,WAExD,KAAqB,MAA2C;EACpE,IAAM,IAAM,EAAE,OAAO,MAAM,MAAM;AACjC,MAAI,MAAQ,MAAM,MAAQ,KAAK;AAC7B,OAAgB,KAAO,IAAI,IAAM,EAAE;AACnC;;EAEF,IAAM,IAAS,OAAO,EAAI;AACtB,SAAO,MAAM,EAAO,IAExB,IADgB,KAAK,IAAI,KAAK,IAAI,GAAQ,EAAI,EAAE,EAAI,CAC5B;IAGpB,KAAmB,MAA2C;AAClE,IAAE,gBAAgB;EAClB,IAAM,IAAW,IAAQ;AACzB,EAAI,KAAY,KACd,IAAgB,EAAS;IAIvB,KAAmB,MAA2C;AAClE,IAAE,gBAAgB;EAClB,IAAM,IAAW,IAAQ;AACzB,EAAI,KAAY,KACd,IAAgB,EAAS;IAIvB,IAAqB,EAAc,IACnC,IAAmB,EAAY,IAC/B,IAAoB,EAAa;AAEvC,QACE,kBAAC,OAAD;EACE,WAAW,EACT,EAA2B,EAAE,SAAM,CAAC,EACpC,EAAc,IACd,EACD;YALH;GAOE,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,UAAU,KAAY,KAAS;IAC/B,cAAW;IACX,OAAM;IACN,WAAW,EACT,0TACA,EACD;cAED,kBAAC,GAAD;KAAM,MAAM;KAAW,MAAM;KAAoB,CAAA;IAC1C,CAAA;GAET,kBAAC,SAAD;IACO;IACL,MAAK;IACE;IACP,UAAU;IACL;IACA;IACC;IACI;IACV,cAAY;IACZ,gBAAc,MAAU,WAAW,KAAA;IACnC,oBAAkB,EAAK,uBAAuB,EAAS;IACvD,WAAW,EACT,8QACA,EACD;IACD,GAAI;IACJ,CAAA;GAEF,kBAAC,UAAD;IACE,MAAK;IACL,SAAS;IACT,UAAU,KAAY,KAAS;IAC/B,cAAW;IACX,OAAM;IACN,WAAW,EACT,0TACA,EACD;cAED,kBAAC,GAAD;KAAM,MAAM;KAAU,MAAM;KAAoB,CAAA;IACzC,CAAA;GACL;;EAGX;AACD,EAAY,cAAc"}
|
package/dist/ui/pagination.js
CHANGED
package/dist/ui/popover.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/ui/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAA;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/ui/popover.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAA;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAkBnF,CAAA;AAGD,QAAA,MAAM,cAAc,gHAA2B,CAAA;AAE/C,QAAA,MAAM,aAAa,4GAA0B,CAAA;AAE7C,QAAA,MAAM,cAAc,gKAiDlB,CAAA;AAGF,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAA;AAEjG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAC,cAAc,EAAE,cAAc,EAAE,CAAA"}
|
package/dist/ui/progress.d.ts
CHANGED
|
@@ -2,51 +2,75 @@
|
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
import * as ProgressPrimitive from '../primitives/react-progress';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
|
|
5
|
+
export type ProgressSize = 'sm' | 'md' | 'lg';
|
|
6
|
+
export type ProgressColor = 'accent' | 'success' | 'warning' | 'error';
|
|
7
|
+
export declare const progressTrackVariants: (props?: ({
|
|
6
8
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
7
9
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
|
-
declare const progressIndicatorVariants: (props?: ({
|
|
9
|
-
color?:
|
|
10
|
+
export declare const progressIndicatorVariants: (props?: ({
|
|
11
|
+
color?: ProgressColor | null | undefined;
|
|
10
12
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* <Progress value={uploadPercent} color="default" showLabel />
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* // Indeterminate loading bar (while waiting for an async operation):
|
|
30
|
-
* <Progress size="sm" />
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* // Success-colored completion bar (e.g. after all tasks done):
|
|
34
|
-
* <Progress value={100} color="success" size="md" />
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* // Warning threshold indicator (disk usage at 80%):
|
|
38
|
-
* <Progress value={80} color="warning" showLabel size="lg" />
|
|
39
|
-
* // These are just a few ways — feel free to combine props creatively!
|
|
40
|
-
*/
|
|
41
|
-
interface ProgressProps extends Omit<React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>, 'color'>, VariantProps<typeof progressTrackVariants>, VariantProps<typeof progressIndicatorVariants> {
|
|
42
|
-
/** Additional class names for the indicator element */
|
|
43
|
-
indicatorClassName?: string;
|
|
44
|
-
/** Display the percentage label next to the progress bar */
|
|
45
|
-
showLabel?: boolean;
|
|
46
|
-
/** When true, color auto-shifts by value: 0-59 = default (accent), 60-84 = warning, 85-100 = success, >100 = error. @default false */
|
|
13
|
+
export interface ProgressRootProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
/** 0–max. Omit (or null) for an indeterminate bar. */
|
|
15
|
+
value?: number | null;
|
|
16
|
+
/** Scale maximum. @default 100 */
|
|
17
|
+
max?: number;
|
|
18
|
+
/** Track thickness. @default 'md' */
|
|
19
|
+
size?: ProgressSize;
|
|
20
|
+
}
|
|
21
|
+
declare const ProgressRoot: React.ForwardRefExoticComponent<ProgressRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export type ProgressTrackProps = React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>;
|
|
23
|
+
declare const ProgressTrack: React.ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export interface ProgressIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
25
|
+
/** Fill colour. Omit to auto-colour by value. */
|
|
26
|
+
color?: ProgressColor;
|
|
27
|
+
/** Force auto-colour even when `color` is unset. @default true when color unset */
|
|
47
28
|
autoColor?: boolean;
|
|
48
29
|
}
|
|
49
|
-
declare const
|
|
50
|
-
export
|
|
51
|
-
|
|
30
|
+
declare const ProgressIndicator: React.ForwardRefExoticComponent<ProgressIndicatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
export interface ProgressSegmentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
32
|
+
/** This segment's portion of `max`. */
|
|
33
|
+
value: number;
|
|
34
|
+
color?: ProgressColor;
|
|
35
|
+
}
|
|
36
|
+
declare const ProgressSegment: React.ForwardRefExoticComponent<ProgressSegmentProps & React.RefAttributes<HTMLDivElement>>;
|
|
37
|
+
export type ProgressLabelProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
38
|
+
declare const ProgressLabel: React.ForwardRefExoticComponent<ProgressLabelProps & React.RefAttributes<HTMLSpanElement>>;
|
|
39
|
+
export interface ProgressValueProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
40
|
+
/** Format the percentage. Default: `${round(pct)}%`. */
|
|
41
|
+
format?: (pct: number, value: number | null, max: number) => React.ReactNode;
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
declare const ProgressValue: React.ForwardRefExoticComponent<ProgressValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
45
|
+
export interface ProgressProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>, VariantProps<typeof progressTrackVariants> {
|
|
46
|
+
/** 0–max. Omit (or null) for an indeterminate bar. */
|
|
47
|
+
value?: number | null;
|
|
48
|
+
max?: number;
|
|
49
|
+
/** Fill colour. Omit + set `autoColor` to colour by value. */
|
|
50
|
+
color?: ProgressColor;
|
|
51
|
+
/** Auto-colour the fill by value (0–59 accent · 60–84 warning · 85–100 success · >100 error). @default false */
|
|
52
|
+
autoColor?: boolean;
|
|
53
|
+
/** Descriptive label rendered before the bar. */
|
|
54
|
+
label?: React.ReactNode;
|
|
55
|
+
/** Show the `{n}%` readout after the bar. */
|
|
56
|
+
showValue?: boolean;
|
|
57
|
+
/** Multi-segment bar: each slice is `value` (portion of max) + `color`. Overrides the single indicator. */
|
|
58
|
+
segments?: Array<{
|
|
59
|
+
value: number;
|
|
60
|
+
color?: ProgressColor;
|
|
61
|
+
}>;
|
|
62
|
+
/** Class for the Track element. */
|
|
63
|
+
trackClassName?: string;
|
|
64
|
+
/** Class for the single Indicator (ignored when `segments` is set). */
|
|
65
|
+
indicatorClassName?: string;
|
|
66
|
+
}
|
|
67
|
+
declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>> & {
|
|
68
|
+
Root: React.ForwardRefExoticComponent<ProgressRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
69
|
+
Track: React.ForwardRefExoticComponent<Omit<ProgressPrimitive.ProgressProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
70
|
+
Indicator: React.ForwardRefExoticComponent<ProgressIndicatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
71
|
+
Segment: React.ForwardRefExoticComponent<ProgressSegmentProps & React.RefAttributes<HTMLDivElement>>;
|
|
72
|
+
Label: React.ForwardRefExoticComponent<ProgressLabelProps & React.RefAttributes<HTMLSpanElement>>;
|
|
73
|
+
Value: React.ForwardRefExoticComponent<ProgressValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
74
|
+
};
|
|
75
|
+
export { Progress, ProgressIndicator, ProgressLabel, ProgressRoot, ProgressSegment, ProgressTrack, ProgressValue, };
|
|
52
76
|
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/ui/progress.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/ui/progress.tsx"],"names":[],"mappings":"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"}
|
package/dist/ui/progress.js
CHANGED
|
@@ -1,52 +1,156 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { springs as
|
|
4
|
-
import { t as
|
|
5
|
-
import { cn as
|
|
6
|
-
import * as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { motion as
|
|
2
|
+
import { k as e } from "../_chunks/primitives.js";
|
|
3
|
+
import { springs as t } from "./lib/motion.js";
|
|
4
|
+
import { t as n } from "../_chunks/vendor-utils.js";
|
|
5
|
+
import { cn as r } from "./lib/utils.js";
|
|
6
|
+
import * as i from "react";
|
|
7
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
8
|
+
import { motion as s } from "framer-motion";
|
|
9
9
|
//#region src/ui/progress.tsx
|
|
10
|
-
var
|
|
10
|
+
var c = n("relative w-full overflow-hidden rounded-pill bg-surface-raised", {
|
|
11
11
|
variants: { size: {
|
|
12
12
|
sm: "h-1",
|
|
13
13
|
md: "h-2",
|
|
14
14
|
lg: "h-3"
|
|
15
15
|
} },
|
|
16
16
|
defaultVariants: { size: "md" }
|
|
17
|
-
}),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
defaultVariants: { color: "
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
17
|
+
}), l = {
|
|
18
|
+
accent: "bg-accent-9",
|
|
19
|
+
success: "bg-success-9",
|
|
20
|
+
warning: "bg-warning-9",
|
|
21
|
+
error: "bg-error-9"
|
|
22
|
+
}, u = n("h-full transition-[width] duration-moderate-02 ease-expressive-standard", {
|
|
23
|
+
variants: { color: l },
|
|
24
|
+
defaultVariants: { color: "accent" }
|
|
25
|
+
});
|
|
26
|
+
function d(e) {
|
|
27
|
+
return e == null ? "accent" : e > 100 ? "error" : e >= 85 ? "success" : e >= 60 ? "warning" : "accent";
|
|
28
|
+
}
|
|
29
|
+
var f = (e, t) => Math.max(0, Math.min(100, e / t * 100)), p = i.createContext(null);
|
|
30
|
+
function m(e) {
|
|
31
|
+
let t = i.useContext(p);
|
|
32
|
+
if (!t) throw Error(`<Progress.${e}> must be rendered inside <Progress.Root>.`);
|
|
33
|
+
return t;
|
|
34
|
+
}
|
|
35
|
+
var h = i.forwardRef(({ value: e = null, max: t = 100, size: n = "md", className: o, children: s, ...c }, l) => {
|
|
36
|
+
let u = i.useMemo(() => ({
|
|
37
|
+
value: e,
|
|
38
|
+
max: t,
|
|
39
|
+
size: n,
|
|
40
|
+
indeterminate: e == null
|
|
41
|
+
}), [
|
|
42
|
+
e,
|
|
43
|
+
t,
|
|
44
|
+
n
|
|
45
|
+
]);
|
|
46
|
+
return /* @__PURE__ */ a(p.Provider, {
|
|
47
|
+
value: u,
|
|
48
|
+
children: /* @__PURE__ */ a("div", {
|
|
49
|
+
ref: l,
|
|
50
|
+
className: r("flex w-full items-center gap-ds-03", o),
|
|
51
|
+
...c,
|
|
52
|
+
children: s
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
h.displayName = "Progress.Root";
|
|
57
|
+
var g = i.forwardRef(({ className: t, children: n, ...i }, o) => {
|
|
58
|
+
let { value: s, max: l, size: u, indeterminate: d } = m("Track");
|
|
59
|
+
return /* @__PURE__ */ a(e, {
|
|
60
|
+
ref: o,
|
|
61
|
+
value: d ? null : s,
|
|
62
|
+
max: l,
|
|
63
|
+
className: r(c({ size: u }), "flex-1", t),
|
|
64
|
+
...i,
|
|
65
|
+
children: n
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
g.displayName = "Progress.Track";
|
|
69
|
+
var _ = i.forwardRef(({ color: e, autoColor: n, className: i, ...o }, c) => {
|
|
70
|
+
let { value: l, max: p, indeterminate: h } = m("Indicator"), g = e ?? (n === !1 ? "accent" : d(l));
|
|
71
|
+
return h ? /* @__PURE__ */ a("div", {
|
|
72
|
+
ref: c,
|
|
73
|
+
className: r(u({ color: g }), "w-2/5 animate-progress-indeterminate motion-reduce:animate-none", i),
|
|
74
|
+
...o
|
|
75
|
+
}) : /* @__PURE__ */ a(s.div, {
|
|
76
|
+
ref: c,
|
|
77
|
+
className: r(u({ color: g }), "transition-colors", i),
|
|
78
|
+
initial: !1,
|
|
79
|
+
animate: { width: `${f(l ?? 0, p)}%` },
|
|
80
|
+
transition: t.smooth,
|
|
81
|
+
...o
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
_.displayName = "Progress.Indicator";
|
|
85
|
+
var v = i.forwardRef(({ value: e, color: t = "accent", className: n, style: i, ...o }, s) => {
|
|
86
|
+
let { max: c } = m("Segment");
|
|
87
|
+
return /* @__PURE__ */ a("div", {
|
|
88
|
+
ref: s,
|
|
89
|
+
"aria-hidden": "true",
|
|
90
|
+
className: r("h-full first:rounded-l-pill last:rounded-r-pill", l[t], n),
|
|
91
|
+
style: {
|
|
92
|
+
width: `${f(e, c)}%`,
|
|
93
|
+
...i
|
|
94
|
+
},
|
|
95
|
+
...o
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
v.displayName = "Progress.Segment";
|
|
99
|
+
var y = i.forwardRef(({ className: e, ...t }, n) => (m("Label"), /* @__PURE__ */ a("span", {
|
|
100
|
+
ref: n,
|
|
101
|
+
className: r("shrink-0 text-ds-sm font-medium text-surface-fg", e),
|
|
102
|
+
...t
|
|
103
|
+
})));
|
|
104
|
+
y.displayName = "Progress.Label";
|
|
105
|
+
var b = i.forwardRef(({ className: e, format: t, children: n, ...i }, o) => {
|
|
106
|
+
let { value: s, max: c, indeterminate: l } = m("Value"), u = l ? 0 : f(s ?? 0, c);
|
|
107
|
+
return /* @__PURE__ */ a("span", {
|
|
108
|
+
ref: o,
|
|
109
|
+
className: r("shrink-0 text-ds-xs text-surface-fg-muted tabular-nums", e),
|
|
110
|
+
...i,
|
|
111
|
+
children: n ?? (l ? "" : t ? t(u, s, c) : `${Math.round(u)}%`)
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
b.displayName = "Progress.Value";
|
|
115
|
+
var x = i.forwardRef(({ value: e = null, max: t = 100, size: n, color: s, autoColor: c, label: l, showValue: u, segments: d, trackClassName: f, indicatorClassName: p, className: m, "aria-label": x, "aria-labelledby": S, ...C }, w) => {
|
|
116
|
+
let T = i.useId(), E = l != null;
|
|
117
|
+
return /* @__PURE__ */ o(h, {
|
|
118
|
+
ref: w,
|
|
119
|
+
value: e,
|
|
120
|
+
max: t,
|
|
121
|
+
size: n ?? "md",
|
|
122
|
+
className: m,
|
|
123
|
+
...C,
|
|
124
|
+
children: [
|
|
125
|
+
E && /* @__PURE__ */ a(y, {
|
|
126
|
+
id: T,
|
|
127
|
+
children: l
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ a(g, {
|
|
130
|
+
"aria-label": x,
|
|
131
|
+
"aria-labelledby": S ?? (E ? T : void 0),
|
|
132
|
+
className: r(d && "flex", f),
|
|
133
|
+
children: d ? d.map((e, t) => /* @__PURE__ */ a(v, {
|
|
134
|
+
value: e.value,
|
|
135
|
+
color: e.color
|
|
136
|
+
}, t)) : /* @__PURE__ */ a(_, {
|
|
137
|
+
color: s,
|
|
138
|
+
autoColor: c,
|
|
139
|
+
className: p
|
|
42
140
|
})
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
children: [a, "%"]
|
|
47
|
-
})]
|
|
141
|
+
}),
|
|
142
|
+
u && e != null && /* @__PURE__ */ a(b, {})
|
|
143
|
+
]
|
|
48
144
|
});
|
|
49
145
|
});
|
|
50
|
-
|
|
146
|
+
x.displayName = "Progress";
|
|
147
|
+
var S = Object.assign(x, {
|
|
148
|
+
Root: h,
|
|
149
|
+
Track: g,
|
|
150
|
+
Indicator: _,
|
|
151
|
+
Segment: v,
|
|
152
|
+
Label: y,
|
|
153
|
+
Value: b
|
|
154
|
+
});
|
|
51
155
|
//#endregion
|
|
52
|
-
export {
|
|
156
|
+
export { S as Progress, _ as ProgressIndicator, y as ProgressLabel, h as ProgressRoot, v as ProgressSegment, g as ProgressTrack, b as ProgressValue, u as progressIndicatorVariants, c as progressTrackVariants };
|