@justanarthur/modo-ui 0.0.0-stage → 0.2.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 +21 -0
- package/LICENSE.beui +21 -0
- package/LICENSE.fluid-functionalism +21 -0
- package/LICENSE.motion-primitives +21 -0
- package/LICENSE.sileo +21 -0
- package/README.md +608 -2
- package/dist/base.css +994 -0
- package/dist/blocks/sidebar-app/index.d.ts +34 -0
- package/dist/blocks/sidebar-app/index.js +31 -0
- package/dist/components/badge/index.d.ts +59 -0
- package/dist/components/badge/index.js +16 -0
- package/dist/components/button/index.d.ts +59 -0
- package/dist/components/button/index.js +14 -0
- package/dist/components/card/index.d.ts +141 -0
- package/dist/components/card/index.js +42 -0
- package/dist/components/inputs/checkbox-group/index.d.ts +50 -0
- package/dist/components/inputs/checkbox-group/index.js +21 -0
- package/dist/components/inputs/color-picker/index.d.ts +137 -0
- package/dist/components/inputs/color-picker/index.js +35 -0
- package/dist/components/inputs/combobox/index.d.ts +161 -0
- package/dist/components/inputs/combobox/index.js +38 -0
- package/dist/components/inputs/date-time/calendar/index.d.ts +45 -0
- package/dist/components/inputs/date-time/calendar/index.js +18 -0
- package/dist/components/inputs/date-time/date-picker/index.d.ts +82 -0
- package/dist/components/inputs/date-time/date-picker/index.js +32 -0
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +64 -0
- package/dist/components/inputs/date-time/date-range-picker/index.js +31 -0
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +57 -0
- package/dist/components/inputs/date-time/duration-picker/index.js +31 -0
- package/dist/components/inputs/date-time/month-picker/index.d.ts +57 -0
- package/dist/components/inputs/date-time/month-picker/index.js +30 -0
- package/dist/components/inputs/date-time/time-picker/index.d.ts +59 -0
- package/dist/components/inputs/date-time/time-picker/index.js +31 -0
- package/dist/components/inputs/input/index.d.ts +84 -0
- package/dist/components/inputs/input/index.js +19 -0
- package/dist/components/inputs/input-copy/index.d.ts +44 -0
- package/dist/components/inputs/input-copy/index.js +16 -0
- package/dist/components/inputs/input-message/index.d.ts +125 -0
- package/dist/components/inputs/input-message/index.js +25 -0
- package/dist/components/inputs/radio-group/index.d.ts +58 -0
- package/dist/components/inputs/radio-group/index.js +20 -0
- package/dist/components/inputs/search/index.d.ts +83 -0
- package/dist/components/inputs/search/index.js +25 -0
- package/dist/components/inputs/select/index.d.ts +105 -0
- package/dist/components/inputs/select/index.js +34 -0
- package/dist/components/inputs/slider/index.d.ts +108 -0
- package/dist/components/inputs/slider/index.js +14 -0
- package/dist/components/inputs/switch/index.d.ts +43 -0
- package/dist/components/inputs/switch/index.js +14 -0
- package/dist/components/navigation/accordion/index.d.ts +117 -0
- package/dist/components/navigation/accordion/index.js +28 -0
- package/dist/components/navigation/sidebar/index.d.ts +388 -0
- package/dist/components/navigation/sidebar/index.js +99 -0
- package/dist/components/navigation/tabs/index.d.ts +70 -0
- package/dist/components/navigation/tabs/index.js +23 -0
- package/dist/components/navigation/tabs-subtle/index.d.ts +73 -0
- package/dist/components/navigation/tabs-subtle/index.js +21 -0
- package/dist/components/overlays/alert-dialog/index.d.ts +67 -0
- package/dist/components/overlays/alert-dialog/index.js +22 -0
- package/dist/components/overlays/command/index.d.ts +121 -0
- package/dist/components/overlays/command/index.js +36 -0
- package/dist/components/overlays/context-menu/index.d.ts +97 -0
- package/dist/components/overlays/context-menu/index.js +29 -0
- package/dist/components/overlays/dialog/index.d.ts +130 -0
- package/dist/components/overlays/dialog/index.js +37 -0
- package/dist/components/overlays/dropdown/index.d.ts +222 -0
- package/dist/components/overlays/dropdown/index.js +44 -0
- package/dist/components/overlays/popover/index.d.ts +87 -0
- package/dist/components/overlays/popover/index.js +26 -0
- package/dist/components/overlays/preview-card/index.d.ts +75 -0
- package/dist/components/overlays/preview-card/index.js +19 -0
- package/dist/components/overlays/sheet/index.d.ts +67 -0
- package/dist/components/overlays/sheet/index.js +24 -0
- package/dist/components/overlays/toast/index.d.ts +107 -0
- package/dist/components/overlays/toast/index.js +21 -0
- package/dist/components/overlays/tooltip/index.d.ts +75 -0
- package/dist/components/overlays/tooltip/index.js +17 -0
- package/dist/components/table/index.d.ts +44 -0
- package/dist/components/table/index.js +26 -0
- package/dist/components/thinking-indicator/index.d.ts +32 -0
- package/dist/components/thinking-indicator/index.js +13 -0
- package/dist/index.d.ts +3926 -0
- package/dist/index.js +511 -0
- package/dist/preset.d.ts +104 -0
- package/dist/preset.js +124 -0
- package/dist/primitives/code/index.d.ts +23 -0
- package/dist/primitives/code/index.js +11 -0
- package/dist/primitives/craft/index.d.ts +31 -0
- package/dist/primitives/craft/index.js +11 -0
- package/dist/primitives/fluid-hover/index.d.ts +233 -0
- package/dist/primitives/fluid-hover/index.js +25 -0
- package/dist/primitives/morph/index.d.ts +127 -0
- package/dist/primitives/morph/index.js +19 -0
- package/dist/primitives/motion/index.d.ts +115 -0
- package/dist/primitives/motion/index.js +19 -0
- package/dist/primitives/scroll-area/index.d.ts +41 -0
- package/dist/primitives/scroll-area/index.js +12 -0
- package/dist/primitives/sizes/index.d.ts +128 -0
- package/dist/primitives/sizes/index.js +21 -0
- package/dist/primitives/surface/index.d.ts +69 -0
- package/dist/primitives/surface/index.js +17 -0
- package/dist/shared/components-0ke6xada.js +123 -0
- package/dist/shared/components-0q0sqfh4.js +146 -0
- package/dist/shared/components-0sn7ypjw.js +61 -0
- package/dist/shared/components-1j9791sn.js +345 -0
- package/dist/shared/components-1rfwbyyc.js +361 -0
- package/dist/shared/components-1v7rxytx.js +30 -0
- package/dist/shared/components-1xekx2hx.js +215 -0
- package/dist/shared/components-39jq9va1.js +86 -0
- package/dist/shared/components-3gae8nta.js +719 -0
- package/dist/shared/components-3k8xpnpq.js +1759 -0
- package/dist/shared/components-3ky44908.js +9 -0
- package/dist/shared/components-3mkepka5.js +111 -0
- package/dist/shared/components-3wk0w46f.js +667 -0
- package/dist/shared/components-4cnjmgex.js +124 -0
- package/dist/shared/components-59efxjd9.js +298 -0
- package/dist/shared/components-5xc2j8jz.js +159 -0
- package/dist/shared/components-62ybc7t2.js +496 -0
- package/dist/shared/components-66mv71kx.js +262 -0
- package/dist/shared/components-7ans7ce5.js +120 -0
- package/dist/shared/components-7btqt08d.js +270 -0
- package/dist/shared/components-7r3etddy.js +171 -0
- package/dist/shared/components-7x9kawxv.js +152 -0
- package/dist/shared/components-8fpr3s4p.js +292 -0
- package/dist/shared/components-9jvzzvt1.js +198 -0
- package/dist/shared/components-apdwtweq.js +484 -0
- package/dist/shared/components-asr5pg50.js +191 -0
- package/dist/shared/components-b2wyq2cq.js +232 -0
- package/dist/shared/components-c6s6b43g.js +15 -0
- package/dist/shared/components-ca2c898n.js +1828 -0
- package/dist/shared/components-cbxjn9p8.js +141 -0
- package/dist/shared/components-chacnk61.js +216 -0
- package/dist/shared/components-cv16mryv.js +62 -0
- package/dist/shared/components-ez65vtbq.js +110 -0
- package/dist/shared/components-ezxhrmer.js +17 -0
- package/dist/shared/components-gc5vtq2f.js +149 -0
- package/dist/shared/components-gf5s6ap9.js +42 -0
- package/dist/shared/components-gvr9w41t.js +193 -0
- package/dist/shared/components-h2dpcwgc.js +137 -0
- package/dist/shared/components-hawvy2qz.js +105 -0
- package/dist/shared/components-hqeq3w9q.js +375 -0
- package/dist/shared/components-jjw69c4c.js +28 -0
- package/dist/shared/components-jwst3vtj.js +346 -0
- package/dist/shared/components-kvr7f9hy.js +45 -0
- package/dist/shared/components-men63rwj.js +9 -0
- package/dist/shared/components-mhd39z7x.js +22 -0
- package/dist/shared/components-n7mjr357.js +26 -0
- package/dist/shared/components-ng72k97e.js +128 -0
- package/dist/shared/components-nh8tma1n.js +986 -0
- package/dist/shared/components-njzgqdwy.js +445 -0
- package/dist/shared/components-ny774h8p.js +293 -0
- package/dist/shared/components-q4daerx0.js +58 -0
- package/dist/shared/components-q5xj5c16.js +79 -0
- package/dist/shared/components-rr7a6ja9.js +160 -0
- package/dist/shared/components-s2bz1xpk.js +63 -0
- package/dist/shared/components-tqvarbfv.js +288 -0
- package/dist/shared/components-v6xp325t.js +304 -0
- package/dist/shared/components-v7wtz8hk.js +144 -0
- package/dist/shared/components-vc7vq5nz.js +32 -0
- package/dist/shared/components-vfbhxf5r.js +58 -0
- package/dist/shared/components-vynjtrk6.js +19 -0
- package/dist/shared/components-wvp1m52g.js +1200 -0
- package/dist/shared/components-yh3kwdhr.js +981 -0
- package/dist/shared/components-ytb2tefr.js +291 -0
- package/dist/shared/components-zfnmn5d4.js +220 -0
- package/dist/shared/components-zrkzcayz.js +141 -0
- package/dist/shared/components-zx6b6yby.js +42 -0
- package/dist/styles.css +1949 -0
- package/dist/tailwind.css +219 -0
- package/dist/tokens.css +345 -0
- package/package.json +103 -4
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
declare const spring: {
|
|
3
|
+
readonly fast: {
|
|
4
|
+
readonly type: "spring";
|
|
5
|
+
readonly duration: 0.08;
|
|
6
|
+
readonly bounce: 0;
|
|
7
|
+
readonly exit: {
|
|
8
|
+
readonly duration: 0.06;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
readonly moderate: {
|
|
12
|
+
readonly type: "spring";
|
|
13
|
+
readonly duration: 0.16;
|
|
14
|
+
readonly bounce: 0;
|
|
15
|
+
readonly exit: {
|
|
16
|
+
readonly duration: 0.12;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
readonly slow: {
|
|
20
|
+
readonly type: "spring";
|
|
21
|
+
readonly duration: 0.24;
|
|
22
|
+
readonly bounce: 0.12;
|
|
23
|
+
readonly exit: {
|
|
24
|
+
readonly duration: 0.16;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
readonly goo: {
|
|
28
|
+
readonly type: "spring";
|
|
29
|
+
readonly visualDuration: 0.25;
|
|
30
|
+
readonly bounce: 0.15;
|
|
31
|
+
readonly exit: {
|
|
32
|
+
readonly type: "spring";
|
|
33
|
+
readonly visualDuration: 0.2;
|
|
34
|
+
readonly bounce: 0;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
declare const exitFallbackMs: (tier: {
|
|
39
|
+
exit: {
|
|
40
|
+
duration: number;
|
|
41
|
+
} | {
|
|
42
|
+
visualDuration: number;
|
|
43
|
+
};
|
|
44
|
+
}) => number;
|
|
45
|
+
import { JSX as JSX_1kxb } from "react";
|
|
46
|
+
type SpringTier = keyof typeof spring;
|
|
47
|
+
interface MotionProps {
|
|
48
|
+
/** Spring tier the children enter on (`spring.<tier>`); they leave on its `.exit` tween. `fast` for hover, fades and small toggles, `moderate` for dropdowns and tabs, `slow` for dialogs and large surfaces. Defaults to `'moderate'`. */
|
|
49
|
+
tier?: "fast" | "moderate" | "slow";
|
|
50
|
+
/** Controlled visibility — `true` animates the children in, `false` animates them out. Pair with `onShowChange`. */
|
|
51
|
+
show?: boolean;
|
|
52
|
+
/** Uncontrolled initial visibility, toggled by the built-in trigger. Defaults to `true`. */
|
|
53
|
+
defaultShow?: boolean;
|
|
54
|
+
/** Called with the next visibility when the built-in trigger is pressed. */
|
|
55
|
+
onShowChange?: (show: boolean) => void;
|
|
56
|
+
/** Leave on the tier's enter spring instead of its faster `.exit` tween — the drag FF's motion rules avoid; only for side-by-side comparisons. Defaults to `false`. */
|
|
57
|
+
sameExit?: boolean;
|
|
58
|
+
/** Forwarded to motion's `<MotionConfig reducedMotion>`: `'user'` follows the OS setting, `'always'` previews it (transforms drop out, opacity fades stay), `'never'` ignores it. Defaults to `'user'`. */
|
|
59
|
+
reducedMotion?: "user" | "always" | "never";
|
|
60
|
+
/** Extra classes for the wrapper (stage + trigger column). */
|
|
61
|
+
className?: string;
|
|
62
|
+
/** The content that animates in and out. */
|
|
63
|
+
children: ReactNode;
|
|
64
|
+
}
|
|
65
|
+
type Element_12xgc = JSX_1kxb["Element"];
|
|
66
|
+
/**
|
|
67
|
+
* Three spring speeds, exits a little faster than entrances, and one fluid
|
|
68
|
+
* hover shared by every list. Pick a speed, wire it in — every component
|
|
69
|
+
* follows the same pattern.
|
|
70
|
+
*
|
|
71
|
+
* All animation comes from one of three springs in `lib/springs`
|
|
72
|
+
* (re-exported here as `spring`). Hover states and small toggles use `fast`,
|
|
73
|
+
* dropdowns and tabs use `moderate`, dialogs and drawers use `slow`. No
|
|
74
|
+
* component invents its own timing, so things you've never thought about
|
|
75
|
+
* together move at the same pace.
|
|
76
|
+
*
|
|
77
|
+
* Each tier's value is the **enter** transition; its `.exit` is the matching
|
|
78
|
+
* **exit** — a plain tween, no bounce, one tier quicker — so a dismissal reads
|
|
79
|
+
* as crisp and final rather than replaying the entrance in reverse. The bigger
|
|
80
|
+
* the thing that moves, the slower the tier. `moderate` is critically damped: it
|
|
81
|
+
* lands exactly with no overshoot, so it also carries panels that must settle
|
|
82
|
+
* precisely.
|
|
83
|
+
*
|
|
84
|
+
* A fourth tier, `goo`, belongs to the morph engine alone (see Morph): the goo
|
|
85
|
+
* effect lands in about 200ms with a little bounce and springs back rather
|
|
86
|
+
* than tweening, so its liquid neck has time to stretch and pinch off.
|
|
87
|
+
*
|
|
88
|
+
* ## Usage
|
|
89
|
+
*
|
|
90
|
+
* Enter with `transition={spring.fast}` and leave with `exit={{ opacity: 0,
|
|
91
|
+
* transition: spring.fast.exit }}`. Never hand-write a duration: the values
|
|
92
|
+
* belong in `springs`, not in component code.
|
|
93
|
+
*
|
|
94
|
+
* - `exitFallbackMs(tier)` (also exported) is the tier's exit in ms plus a 100ms
|
|
95
|
+
* buffer, for deferred-unmount timers that guard an exit tween.
|
|
96
|
+
* - CSS consumers get the same tiers from `tokens/motion.css`
|
|
97
|
+
* (`--duration-<tier>` and `--duration-<tier>-exit`).
|
|
98
|
+
*
|
|
99
|
+
* ## Reduced motion
|
|
100
|
+
*
|
|
101
|
+
* Every spring respects the OS setting once the app tree is wrapped in
|
|
102
|
+
* `<MotionConfig reducedMotion="user">`. With reduced motion on, position and
|
|
103
|
+
* scale changes drop out and only the opacity fades remain.
|
|
104
|
+
*
|
|
105
|
+
* ## The `Motion` demo
|
|
106
|
+
*
|
|
107
|
+
* `Motion` itself is a docs demo, not a building block: it shows or hides its
|
|
108
|
+
* children with one tier's enter spring and exit tween (fade + scale + a short
|
|
109
|
+
* rise), with a built-in Show/Hide trigger and a readout of the token it plays.
|
|
110
|
+
* Hidden children keep their space and leave the accessibility tree.
|
|
111
|
+
*
|
|
112
|
+
* @example {@include ./examples.mdx}
|
|
113
|
+
*/
|
|
114
|
+
declare function Motion({ tier, show, defaultShow, onShowChange, sameExit, reducedMotion, className, children }: MotionProps): Element_12xgc;
|
|
115
|
+
export { Motion, MotionProps, SpringTier, Motion as default, exitFallbackMs, spring };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Motion2
|
|
3
|
+
} from "../../shared/components-q5xj5c16.js";
|
|
4
|
+
import"../../shared/components-b2wyq2cq.js";
|
|
5
|
+
import"../../shared/components-n7mjr357.js";
|
|
6
|
+
import"../../shared/components-men63rwj.js";
|
|
7
|
+
import {
|
|
8
|
+
spring2,
|
|
9
|
+
exitFallbackMs2
|
|
10
|
+
} from "../../shared/components-1v7rxytx.js";
|
|
11
|
+
import"../../shared/components-0sn7ypjw.js";
|
|
12
|
+
import"../../shared/components-cv16mryv.js";
|
|
13
|
+
import"../../shared/components-ezxhrmer.js";
|
|
14
|
+
export {
|
|
15
|
+
Motion2 as Motion,
|
|
16
|
+
Motion2 as default,
|
|
17
|
+
exitFallbackMs2 as exitFallbackMs,
|
|
18
|
+
spring2 as spring
|
|
19
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ForwardRefExoticComponent, ReactNode, RefAttributes } from "react";
|
|
2
|
+
import { ScrollAreaScrollbarProps as ScrollAreaScrollbarProps_g9nf4s } from "@base-ui/react";
|
|
3
|
+
type Orientation = "vertical" | "horizontal" | "both";
|
|
4
|
+
interface ScrollAreaProps extends ComponentPropsWithoutRef<"div"> {
|
|
5
|
+
/** Classes for the inner scrolling viewport — where the `scroll-fade` / `scroll-fade-x` utility goes. */
|
|
6
|
+
viewportClassName?: string;
|
|
7
|
+
/** Which axes get scrollbars. Defaults to `"vertical"`. */
|
|
8
|
+
orientation?: Orientation;
|
|
9
|
+
/** Classes for the outer container — set the height/width constraint here. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** The scrolling content. Give it an intrinsic size (`w-max`, `whitespace-nowrap`) to overflow horizontally. */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
interface ScrollAreaStatics {
|
|
15
|
+
/** `ScrollBar` — one scrollbar, for composing a Base UI scroll area by hand. */
|
|
16
|
+
Bar: typeof ScrollBar;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A scrollbar that stays out of the way but never disappears, over shadcn's
|
|
20
|
+
* scroll-fade as the baseline edge treatment — restyled to the shape system,
|
|
21
|
+
* with native scroll physics on touch.
|
|
22
|
+
*
|
|
23
|
+
* macOS hides the scrollbar until you start scrolling, so a clipped list
|
|
24
|
+
* gives no sign it has more below. Here the thumb rests narrow and
|
|
25
|
+
* low-contrast, then widens and darkens on hover, and its radius follows the
|
|
26
|
+
* shape system. `className` constrains the outer box; `viewportClassName`
|
|
27
|
+
* goes on the inner scrolling viewport, where the `scroll-fade` (or
|
|
28
|
+
* `scroll-fade-x`) utility dissolves the edges that have more to scroll. On
|
|
29
|
+
* touch-primary devices the whole thing steps aside for native overflow
|
|
30
|
+
* scrolling. Built on Base UI's ScrollArea; scrollbar machinery adapted from
|
|
31
|
+
* Lina (https://lina.sameer.sh).
|
|
32
|
+
*
|
|
33
|
+
* Statics:
|
|
34
|
+
* - `ScrollArea.Bar` — the standalone `ScrollBar`, for hand-composed scroll
|
|
35
|
+
* areas.
|
|
36
|
+
*
|
|
37
|
+
* @example {@include ./examples.mdx}
|
|
38
|
+
*/
|
|
39
|
+
declare const ScrollArea: ForwardRefExoticComponent<ScrollAreaProps & RefAttributes<HTMLDivElement>> & ScrollAreaStatics;
|
|
40
|
+
declare const ScrollBar: ForwardRefExoticComponent<Omit<Omit<ScrollAreaScrollbarProps_g9nf4s, "ref"> & RefAttributes<HTMLDivElement>, "ref"> & RefAttributes<HTMLDivElement>>;
|
|
41
|
+
export { ScrollArea, ScrollAreaProps, ScrollBar, ScrollArea as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ScrollArea2,
|
|
3
|
+
ScrollBar2,
|
|
4
|
+
scroll_area_default
|
|
5
|
+
} from "../../shared/components-hawvy2qz.js";
|
|
6
|
+
import"../../shared/components-cv16mryv.js";
|
|
7
|
+
import"../../shared/components-ezxhrmer.js";
|
|
8
|
+
export {
|
|
9
|
+
ScrollArea2 as ScrollArea,
|
|
10
|
+
ScrollBar2 as ScrollBar,
|
|
11
|
+
scroll_area_default as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { JSX as JSX_1kxb } from "react";
|
|
3
|
+
type SizeVariant = "default" | "compact";
|
|
4
|
+
interface SizeClasses {
|
|
5
|
+
/** The variant these classes belong to — handy for conditionals. */
|
|
6
|
+
variant: SizeVariant;
|
|
7
|
+
/** Bounded control height — buttons, inputs, select triggers, subtle tabs —
|
|
8
|
+
* AND list/menu rows (select options, dropdown, checkbox and radio rows).
|
|
9
|
+
* One token by design: a popup row lines up with the trigger that opened
|
|
10
|
+
* it because they share this height. */
|
|
11
|
+
control: string;
|
|
12
|
+
/** `control` as a number, for consumers that need raw pixels. */
|
|
13
|
+
controlHeight: number;
|
|
14
|
+
/** Tab trigger height inside a padded segmented list. Sized so
|
|
15
|
+
* `segmentPad` + `segmentItem` adds back up to the control height —
|
|
16
|
+
* the segmented control's outer box stays on the same ladder. */
|
|
17
|
+
segmentItem: string;
|
|
18
|
+
/** Padding of the segmented list around its tabs. */
|
|
19
|
+
segmentPad: string;
|
|
20
|
+
/** Body text inside controls. */
|
|
21
|
+
text: string;
|
|
22
|
+
/** Horizontal padding of bounded controls (select trigger, inputs). */
|
|
23
|
+
px: string;
|
|
24
|
+
/** Horizontal padding of list/menu rows, which sit inside a padded popup
|
|
25
|
+
* or group and need less inset than a bounded control. */
|
|
26
|
+
itemPx: string;
|
|
27
|
+
/** Gap between an icon / control glyph and its label, and between
|
|
28
|
+
* neighbouring controls in a row (toolbars, filter bars, button
|
|
29
|
+
* clusters). Density is spacing as much as control height, so the
|
|
30
|
+
* compact step halves it. */
|
|
31
|
+
gap: string;
|
|
32
|
+
/** Glyph size in px: leading/trailing icons inside controls, and the
|
|
33
|
+
* checkbox square / radio circle. */
|
|
34
|
+
icon: number;
|
|
35
|
+
}
|
|
36
|
+
declare const sizeMap: Record<SizeVariant, SizeClasses>;
|
|
37
|
+
/** One role of the type scale: px per ladder step. */
|
|
38
|
+
interface TypeScaleStep {
|
|
39
|
+
default: number;
|
|
40
|
+
compact: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Role-based type scale, per ladder step (px values).
|
|
44
|
+
*
|
|
45
|
+
* The default column is the system as shipped; the compact column steps each
|
|
46
|
+
* role down one notch so dense regions read as a smaller sibling of the same
|
|
47
|
+
* hierarchy, not a squeezed copy. `body`, `caption`, and `subtitle` are what
|
|
48
|
+
* the sized components already render through `SizeClasses.text` and their
|
|
49
|
+
* compact conditionals; `display` and `title` are the page-level roles
|
|
50
|
+
* for consumers composing their own screens.
|
|
51
|
+
*/
|
|
52
|
+
declare const typeScale: {
|
|
53
|
+
/** Page titles. */
|
|
54
|
+
readonly display: {
|
|
55
|
+
readonly default: 28;
|
|
56
|
+
readonly compact: 24;
|
|
57
|
+
};
|
|
58
|
+
/** Section headings, dialog titles. */
|
|
59
|
+
readonly title: {
|
|
60
|
+
readonly default: 16;
|
|
61
|
+
readonly compact: 15;
|
|
62
|
+
};
|
|
63
|
+
/** Card titles, chat bubbles, emphasized rows. */
|
|
64
|
+
readonly subtitle: {
|
|
65
|
+
readonly default: 14;
|
|
66
|
+
readonly compact: 13;
|
|
67
|
+
};
|
|
68
|
+
/** Control labels and body copy — `SizeClasses.text`. */
|
|
69
|
+
readonly body: {
|
|
70
|
+
readonly default: 13;
|
|
71
|
+
readonly compact: 12;
|
|
72
|
+
};
|
|
73
|
+
/** Secondary text: descriptions, meta rows, errors, eyebrows and group
|
|
74
|
+
* labels (the former overline role — an uppercase or muted caption). */
|
|
75
|
+
readonly caption: {
|
|
76
|
+
readonly default: 12;
|
|
77
|
+
readonly compact: 11;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
type TypeScaleRole = keyof typeof typeScale;
|
|
81
|
+
/** The type scale resolved for the active ladder step (px per role):
|
|
82
|
+
* explicit override > surrounding SizeProvider > "default". */
|
|
83
|
+
declare function useTypeScale(override?: SizeVariant | null): Record<TypeScaleRole, number>;
|
|
84
|
+
interface SizeContextValue {
|
|
85
|
+
size: SizeVariant;
|
|
86
|
+
setSize: (size: SizeVariant) => void;
|
|
87
|
+
classes: SizeClasses;
|
|
88
|
+
}
|
|
89
|
+
/** Resolve the active size variant: explicit prop > provider > "default". */
|
|
90
|
+
declare function useSizeVariant(override?: SizeVariant | null): SizeVariant;
|
|
91
|
+
/** Resolve size classes: explicit prop > provider > "default". */
|
|
92
|
+
declare function useSize(override?: SizeVariant | null): SizeClasses;
|
|
93
|
+
declare function useSizeContext(): SizeContextValue;
|
|
94
|
+
type Element_12xgc = JSX_1kxb["Element"];
|
|
95
|
+
/**
|
|
96
|
+
* Two component sizes: a 36px default and a 28px compact. An interface reads
|
|
97
|
+
* as one product when its controls share a sizing rhythm — a button next to a
|
|
98
|
+
* select next to a tab should land on the same height. Each size scales text,
|
|
99
|
+
* icons, padding and gaps together, not just the box. Compact is for dense,
|
|
100
|
+
* data-heavy tools (filter bars, toolbars, table headers, sidebars); default
|
|
101
|
+
* is the right call for everything else.
|
|
102
|
+
*
|
|
103
|
+
* Density is a region decision, not a per-control one: wrap the region in a
|
|
104
|
+
* `SizeProvider` and every sized component inside follows — menus included,
|
|
105
|
+
* since React context crosses portals. Precedence is explicit `size` prop on
|
|
106
|
+
* the component > nearest `SizeProvider` > `'default'`. Button, Badge,
|
|
107
|
+
* Select, Tabs, TabsSubtle, Dropdown, CheckboxGroup, RadioGroup, Input,
|
|
108
|
+
* InputGroup, InputCopy, InputMessage, Table, Switch, Slider, Accordion, Card,
|
|
109
|
+
* ColorPicker, ThinkingIndicator, Calendar and the date and time pickers all
|
|
110
|
+
* take that per-component `size`. Type follows the ladder too: compact drops
|
|
111
|
+
* each type role one notch.
|
|
112
|
+
*
|
|
113
|
+
* Also exported from this item: `useSize(override?)`, `useSizeVariant(override?)`,
|
|
114
|
+
* `useSizeContext()` (`{ size, setSize }` inside a provider), `useTypeScale(override?)`,
|
|
115
|
+
* the `sizeMap` and `typeScale` tables, and the `SizeVariant`, `SizeClasses`,
|
|
116
|
+
* `TypeScaleRole`, `TypeScaleStep` types.
|
|
117
|
+
*
|
|
118
|
+
* @example {@include ./examples.mdx}
|
|
119
|
+
*/
|
|
120
|
+
declare function SizeProvider({ children, size, defaultSize }: {
|
|
121
|
+
/** The region whose controls follow the step — popups opened from inside it included. */
|
|
122
|
+
children: ReactNode;
|
|
123
|
+
/** Controlled variant — pins every control in the subtree to one step, overriding internal state. `'default'` is 36px controls, `'compact'` is 28px. */
|
|
124
|
+
size?: "default" | "compact";
|
|
125
|
+
/** Uncontrolled initial variant, switchable via `useSizeContext().setSize`. Defaults to `'default'`. */
|
|
126
|
+
defaultSize?: "default" | "compact";
|
|
127
|
+
}): Element_12xgc;
|
|
128
|
+
export { SizeClasses, SizeProvider, SizeVariant, TypeScaleRole, TypeScaleStep, SizeProvider as default, sizeMap, typeScale, useSize, useSizeContext, useSizeVariant, useTypeScale };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SizeProvider2
|
|
3
|
+
} from "../../shared/components-jjw69c4c.js";
|
|
4
|
+
import {
|
|
5
|
+
sizeMap2,
|
|
6
|
+
typeScale2,
|
|
7
|
+
useTypeScale2,
|
|
8
|
+
useSizeVariant2,
|
|
9
|
+
useSize2,
|
|
10
|
+
useSizeContext2
|
|
11
|
+
} from "../../shared/components-0sn7ypjw.js";
|
|
12
|
+
export {
|
|
13
|
+
SizeProvider2 as SizeProvider,
|
|
14
|
+
SizeProvider2 as default,
|
|
15
|
+
sizeMap2 as sizeMap,
|
|
16
|
+
typeScale2 as typeScale,
|
|
17
|
+
useSize2 as useSize,
|
|
18
|
+
useSizeContext2 as useSizeContext,
|
|
19
|
+
useSizeVariant2 as useSizeVariant,
|
|
20
|
+
useTypeScale2 as useTypeScale
|
|
21
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ForwardRefExoticComponent, ReactNode as ReactNode2, RefAttributes } from "react";
|
|
2
|
+
declare function surfaceClasses(bgLevel: number, shadowLevel?: number): string;
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { JSX as JSX_1kxb } from "react";
|
|
5
|
+
declare function useSurface(): number;
|
|
6
|
+
type Element_12xgc = JSX_1kxb["Element"];
|
|
7
|
+
declare function SurfaceProvider({ value, children }: {
|
|
8
|
+
value: number;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}): Element_12xgc;
|
|
11
|
+
interface ElevatedProps extends ComponentPropsWithoutRef<"div"> {
|
|
12
|
+
/**
|
|
13
|
+
* Steps above the current substrate.
|
|
14
|
+
*
|
|
15
|
+
* The component's own surface level becomes `min(substrate + offset, 8)`
|
|
16
|
+
* and is re-provided to descendants via SurfaceProvider, so further
|
|
17
|
+
* nesting walks up the ladder automatically.
|
|
18
|
+
*
|
|
19
|
+
* Conventional offsets:
|
|
20
|
+
* 2 — dropdown / popover / select menu
|
|
21
|
+
* 4 — dialog / modal
|
|
22
|
+
*/
|
|
23
|
+
offset: number;
|
|
24
|
+
/**
|
|
25
|
+
* Override for the shadow level. Defaults to the computed surface level.
|
|
26
|
+
*
|
|
27
|
+
* Pass a fixed value when the component should keep a constant shadow
|
|
28
|
+
* weight regardless of how deeply it's nested — e.g. a dropdown always
|
|
29
|
+
* reads `shadow-surface-3` whether it opens on the page or inside a
|
|
30
|
+
* dialog, even though its background tracks the substrate.
|
|
31
|
+
*/
|
|
32
|
+
shadowLevel?: number;
|
|
33
|
+
/** Merged after the surface classes; radius and padding go here. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Content of the surface. Everything inside reads this surface's level as its substrate. */
|
|
36
|
+
children?: ReactNode2;
|
|
37
|
+
}
|
|
38
|
+
interface ElevatedStatics {
|
|
39
|
+
/** `SurfaceProvider` — set the substrate for a subtree by hand. */
|
|
40
|
+
Provider: typeof SurfaceProvider;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Eight surface levels that nest. Components read their substrate from
|
|
44
|
+
* context and lift relative to it, so popovers, dropdowns, and dialogs stay
|
|
45
|
+
* visible at any depth — in both light and dark mode.
|
|
46
|
+
*
|
|
47
|
+
* Three pieces: tokens, substrate context, and the primitive. The tokens are
|
|
48
|
+
* eight `bg-surface-N` / `shadow-surface-N` pairs. The substrate is a React
|
|
49
|
+
* context holding the level of the container you are in (1, the page, when
|
|
50
|
+
* nothing provides one). `Elevated` reads that substrate, settles at
|
|
51
|
+
* `min(substrate + offset, 8)`, paints the matching background and shadow,
|
|
52
|
+
* and re-provides its own level, so nested surfaces keep climbing the ladder
|
|
53
|
+
* without anything passed between them. Conventional offsets: 2 for a
|
|
54
|
+
* dropdown, popover or select menu; 4 for a dialog or modal. All other props
|
|
55
|
+
* (ref included) go to the `div`.
|
|
56
|
+
*
|
|
57
|
+
* Statics:
|
|
58
|
+
* - `Elevated.Provider` — `SurfaceProvider`: set the substrate for a subtree
|
|
59
|
+
* by hand (1 page, 3 popover, 5 dialog).
|
|
60
|
+
*
|
|
61
|
+
* Also exported: `SurfaceProvider`, `useSurface()` (the current substrate
|
|
62
|
+
* level, 1 when no provider is present) and `surfaceClasses(bgLevel,
|
|
63
|
+
* shadowLevel = bgLevel)` for components that paint a level without
|
|
64
|
+
* `Elevated`.
|
|
65
|
+
*
|
|
66
|
+
* @example {@include ./examples.mdx}
|
|
67
|
+
*/
|
|
68
|
+
declare const Elevated: ForwardRefExoticComponent<ElevatedProps & RefAttributes<HTMLDivElement>> & ElevatedStatics;
|
|
69
|
+
export { Elevated, ElevatedProps, SurfaceProvider, Elevated as default, surfaceClasses, useSurface };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Elevated2,
|
|
3
|
+
surface_default
|
|
4
|
+
} from "../../shared/components-vc7vq5nz.js";
|
|
5
|
+
import {
|
|
6
|
+
surfaceClasses2,
|
|
7
|
+
useSurface2,
|
|
8
|
+
SurfaceProvider2
|
|
9
|
+
} from "../../shared/components-zx6b6yby.js";
|
|
10
|
+
import"../../shared/components-ezxhrmer.js";
|
|
11
|
+
export {
|
|
12
|
+
Elevated2 as Elevated,
|
|
13
|
+
SurfaceProvider2 as SurfaceProvider,
|
|
14
|
+
surface_default as default,
|
|
15
|
+
surfaceClasses2 as surfaceClasses,
|
|
16
|
+
useSurface2 as useSurface
|
|
17
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn2
|
|
3
|
+
} from "./components-ezxhrmer.js";
|
|
4
|
+
import {
|
|
5
|
+
FluidHoverHighlight2
|
|
6
|
+
} from "./components-kvr7f9hy.js";
|
|
7
|
+
import {
|
|
8
|
+
useSize2
|
|
9
|
+
} from "./components-0sn7ypjw.js";
|
|
10
|
+
import {
|
|
11
|
+
useFluidHover2,
|
|
12
|
+
useRegisterFluidHoverItem2
|
|
13
|
+
} from "./components-59efxjd9.js";
|
|
14
|
+
import {
|
|
15
|
+
SizeProvider2
|
|
16
|
+
} from "./components-jjw69c4c.js";
|
|
17
|
+
|
|
18
|
+
// components/table/index.tsx
|
|
19
|
+
import {
|
|
20
|
+
createContext,
|
|
21
|
+
forwardRef,
|
|
22
|
+
useContext,
|
|
23
|
+
useMemo,
|
|
24
|
+
useRef
|
|
25
|
+
} from "react";
|
|
26
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
27
|
+
var TableContext = createContext(null);
|
|
28
|
+
var Table2 = forwardRef(({ children, size, className, ...props }, ref) => {
|
|
29
|
+
const containerRef = useRef(null);
|
|
30
|
+
const sizeClasses = useSize2(size);
|
|
31
|
+
const hover = useFluidHover2(containerRef);
|
|
32
|
+
const { activeIndex, handlers, registerItem } = hover;
|
|
33
|
+
const contextValue = useMemo(() => ({ registerItem, activeIndex }), [registerItem, activeIndex]);
|
|
34
|
+
const table = /* @__PURE__ */ jsx(TableContext.Provider, {
|
|
35
|
+
value: contextValue,
|
|
36
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
37
|
+
ref: containerRef,
|
|
38
|
+
className: "relative",
|
|
39
|
+
onMouseEnter: handlers.onMouseEnter,
|
|
40
|
+
onMouseMove: handlers.onMouseMove,
|
|
41
|
+
onMouseLeave: handlers.onMouseLeave,
|
|
42
|
+
onClick: handlers.onClick,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(FluidHoverHighlight2, {
|
|
45
|
+
hover
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsx("table", {
|
|
48
|
+
ref,
|
|
49
|
+
className: cn2("w-full border-collapse", sizeClasses.text, className),
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
return size ? /* @__PURE__ */ jsx(SizeProvider2, {
|
|
57
|
+
size,
|
|
58
|
+
children: table
|
|
59
|
+
}) : table;
|
|
60
|
+
});
|
|
61
|
+
Table2.displayName = "Table";
|
|
62
|
+
var TableHeader2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", {
|
|
63
|
+
ref,
|
|
64
|
+
className: cn2("", className),
|
|
65
|
+
...props
|
|
66
|
+
}));
|
|
67
|
+
TableHeader2.displayName = "TableHeader";
|
|
68
|
+
var TableBody2 = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tbody", {
|
|
69
|
+
ref,
|
|
70
|
+
className: cn2("", className),
|
|
71
|
+
...props
|
|
72
|
+
}));
|
|
73
|
+
TableBody2.displayName = "TableBody";
|
|
74
|
+
var TableRow2 = forwardRef(({ index, className, style, ...props }, ref) => {
|
|
75
|
+
const internalRef = useRef(null);
|
|
76
|
+
const ctx = useContext(TableContext);
|
|
77
|
+
useRegisterFluidHoverItem2(ctx?.registerItem, index, internalRef);
|
|
78
|
+
const isBodyRow = index !== undefined;
|
|
79
|
+
const activeIdx = ctx?.activeIndex ?? null;
|
|
80
|
+
const hideBorder = activeIdx !== null && (isBodyRow && (index === activeIdx || index === activeIdx - 1) || !isBodyRow && activeIdx === 0);
|
|
81
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
82
|
+
ref: (node) => {
|
|
83
|
+
internalRef.current = node;
|
|
84
|
+
if (typeof ref === "function")
|
|
85
|
+
ref(node);
|
|
86
|
+
else if (ref)
|
|
87
|
+
ref.current = node;
|
|
88
|
+
},
|
|
89
|
+
"data-fluid-hover-index": index,
|
|
90
|
+
className: cn2("group/row relative z-10 border-b transition-[border-color] duration-fast", hideBorder ? "border-transparent" : "border-accent/40", isBodyRow && activeIdx === index && "is-active", isBodyRow ? "weight-normal" : "weight-semibold", className),
|
|
91
|
+
style,
|
|
92
|
+
...props
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
TableRow2.displayName = "TableRow";
|
|
96
|
+
var TableHead2 = forwardRef(({ className, ...props }, ref) => {
|
|
97
|
+
const sizeClasses = useSize2();
|
|
98
|
+
return /* @__PURE__ */ jsx("th", {
|
|
99
|
+
ref,
|
|
100
|
+
className: cn2("text-left text-foreground", sizeClasses.variant === "compact" ? "px-2.5 py-[5px]" : "px-3 py-2", className),
|
|
101
|
+
...props
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
TableHead2.displayName = "TableHead";
|
|
105
|
+
var TableCell2 = forwardRef(({ className, ...props }, ref) => {
|
|
106
|
+
const sizeClasses = useSize2();
|
|
107
|
+
return /* @__PURE__ */ jsx("td", {
|
|
108
|
+
ref,
|
|
109
|
+
className: cn2("text-muted-foreground transition-colors duration-fast group-[.is-active]/row:text-foreground", sizeClasses.variant === "compact" ? "px-2.5 py-[5px]" : "px-3 py-2", className),
|
|
110
|
+
...props
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
TableCell2.displayName = "TableCell";
|
|
114
|
+
Object.assign(Table2, {
|
|
115
|
+
Header: TableHeader2,
|
|
116
|
+
Body: TableBody2,
|
|
117
|
+
Row: TableRow2,
|
|
118
|
+
Head: TableHead2,
|
|
119
|
+
Cell: TableCell2
|
|
120
|
+
});
|
|
121
|
+
var table_default = Table2;
|
|
122
|
+
|
|
123
|
+
export { Table2, TableHeader2, TableBody2, TableRow2, TableHead2, TableCell2, table_default };
|