@lab206/ui 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 +114 -0
- package/README.md +6 -0
- package/dist/components/Accordion.d.ts +25 -0
- package/dist/components/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion.js +123 -0
- package/dist/components/Accordion.js.map +1 -0
- package/dist/components/Alert.d.ts +17 -0
- package/dist/components/Alert.d.ts.map +1 -0
- package/dist/components/Alert.js +59 -0
- package/dist/components/Alert.js.map +1 -0
- package/dist/components/AspectRatio.d.ts +13 -0
- package/dist/components/AspectRatio.d.ts.map +1 -0
- package/dist/components/AspectRatio.js +38 -0
- package/dist/components/AspectRatio.js.map +1 -0
- package/dist/components/Avatar.d.ts +17 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar.js +57 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.d.ts +12 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Badge.js +62 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Breadcrumb.d.ts +16 -0
- package/dist/components/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Breadcrumb.js +76 -0
- package/dist/components/Breadcrumb.js.map +1 -0
- package/dist/components/Button.d.ts +28 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +110 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Card.d.ts +18 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +57 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/Checkbox.d.ts +23 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox.js +107 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/Chip.d.ts +18 -0
- package/dist/components/Chip.d.ts.map +1 -0
- package/dist/components/Chip.js +103 -0
- package/dist/components/Chip.js.map +1 -0
- package/dist/components/Code.d.ts +12 -0
- package/dist/components/Code.d.ts.map +1 -0
- package/dist/components/Code.js +57 -0
- package/dist/components/Code.js.map +1 -0
- package/dist/components/Collapse.d.ts +15 -0
- package/dist/components/Collapse.d.ts.map +1 -0
- package/dist/components/Collapse.js +49 -0
- package/dist/components/Collapse.js.map +1 -0
- package/dist/components/Combobox.d.ts +47 -0
- package/dist/components/Combobox.d.ts.map +1 -0
- package/dist/components/Combobox.js +325 -0
- package/dist/components/Combobox.js.map +1 -0
- package/dist/components/Command.d.ts +42 -0
- package/dist/components/Command.d.ts.map +1 -0
- package/dist/components/Command.js +263 -0
- package/dist/components/Command.js.map +1 -0
- package/dist/components/Container.d.ts +11 -0
- package/dist/components/Container.d.ts.map +1 -0
- package/dist/components/Container.js +38 -0
- package/dist/components/Container.js.map +1 -0
- package/dist/components/Dialog.d.ts +26 -0
- package/dist/components/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog.js +159 -0
- package/dist/components/Dialog.js.map +1 -0
- package/dist/components/Divider.d.ts +10 -0
- package/dist/components/Divider.d.ts.map +1 -0
- package/dist/components/Divider.js +52 -0
- package/dist/components/Divider.js.map +1 -0
- package/dist/components/Drawer.d.ts +19 -0
- package/dist/components/Drawer.d.ts.map +1 -0
- package/dist/components/Drawer.js +131 -0
- package/dist/components/Drawer.js.map +1 -0
- package/dist/components/Empty.d.ts +17 -0
- package/dist/components/Empty.d.ts.map +1 -0
- package/dist/components/Empty.js +51 -0
- package/dist/components/Empty.js.map +1 -0
- package/dist/components/Field.d.ts +27 -0
- package/dist/components/Field.d.ts.map +1 -0
- package/dist/components/Field.js +153 -0
- package/dist/components/Field.js.map +1 -0
- package/dist/components/Grid.d.ts +13 -0
- package/dist/components/Grid.d.ts.map +1 -0
- package/dist/components/Grid.js +44 -0
- package/dist/components/Grid.js.map +1 -0
- package/dist/components/Input.d.ts +55 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/Input.js +113 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/Kbd.d.ts +10 -0
- package/dist/components/Kbd.d.ts.map +1 -0
- package/dist/components/Kbd.js +41 -0
- package/dist/components/Kbd.js.map +1 -0
- package/dist/components/Label.d.ts +13 -0
- package/dist/components/Label.d.ts.map +1 -0
- package/dist/components/Label.js +34 -0
- package/dist/components/Label.js.map +1 -0
- package/dist/components/Link.d.ts +18 -0
- package/dist/components/Link.d.ts.map +1 -0
- package/dist/components/Link.js +41 -0
- package/dist/components/Link.js.map +1 -0
- package/dist/components/List.d.ts +22 -0
- package/dist/components/List.d.ts.map +1 -0
- package/dist/components/List.js +157 -0
- package/dist/components/List.js.map +1 -0
- package/dist/components/Menu.d.ts +28 -0
- package/dist/components/Menu.d.ts.map +1 -0
- package/dist/components/Menu.js +126 -0
- package/dist/components/Menu.js.map +1 -0
- package/dist/components/NumberInput.d.ts +27 -0
- package/dist/components/NumberInput.d.ts.map +1 -0
- package/dist/components/NumberInput.js +92 -0
- package/dist/components/NumberInput.js.map +1 -0
- package/dist/components/Pagination.d.ts +13 -0
- package/dist/components/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination.js +104 -0
- package/dist/components/Pagination.js.map +1 -0
- package/dist/components/Popover.d.ts +26 -0
- package/dist/components/Popover.d.ts.map +1 -0
- package/dist/components/Popover.js +165 -0
- package/dist/components/Popover.js.map +1 -0
- package/dist/components/Progress.d.ts +15 -0
- package/dist/components/Progress.d.ts.map +1 -0
- package/dist/components/Progress.js +63 -0
- package/dist/components/Progress.js.map +1 -0
- package/dist/components/Radio.d.ts +25 -0
- package/dist/components/Radio.d.ts.map +1 -0
- package/dist/components/Radio.js +95 -0
- package/dist/components/Radio.js.map +1 -0
- package/dist/components/ScrollArea.d.ts +13 -0
- package/dist/components/ScrollArea.d.ts.map +1 -0
- package/dist/components/ScrollArea.js +33 -0
- package/dist/components/ScrollArea.js.map +1 -0
- package/dist/components/Select.d.ts +34 -0
- package/dist/components/Select.d.ts.map +1 -0
- package/dist/components/Select.js +108 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Skeleton.d.ts +18 -0
- package/dist/components/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton.js +86 -0
- package/dist/components/Skeleton.js.map +1 -0
- package/dist/components/Slider.d.ts +26 -0
- package/dist/components/Slider.d.ts.map +1 -0
- package/dist/components/Slider.js +113 -0
- package/dist/components/Slider.js.map +1 -0
- package/dist/components/Spinner.d.ts +12 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +44 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Stack.d.ts +21 -0
- package/dist/components/Stack.d.ts.map +1 -0
- package/dist/components/Stack.js +48 -0
- package/dist/components/Stack.js.map +1 -0
- package/dist/components/Stat.d.ts +23 -0
- package/dist/components/Stat.d.ts.map +1 -0
- package/dist/components/Stat.js +115 -0
- package/dist/components/Stat.js.map +1 -0
- package/dist/components/Steps.d.ts +20 -0
- package/dist/components/Steps.d.ts.map +1 -0
- package/dist/components/Steps.js +126 -0
- package/dist/components/Steps.js.map +1 -0
- package/dist/components/Switch.d.ts +23 -0
- package/dist/components/Switch.d.ts.map +1 -0
- package/dist/components/Switch.js +108 -0
- package/dist/components/Switch.js.map +1 -0
- package/dist/components/Table.d.ts +27 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/Table.js +112 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/components/Tabs.d.ts +27 -0
- package/dist/components/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs.js +171 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/components/Text.d.ts +17 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/Text.js +48 -0
- package/dist/components/Text.js.map +1 -0
- package/dist/components/Textarea.d.ts +32 -0
- package/dist/components/Textarea.d.ts.map +1 -0
- package/dist/components/Textarea.js +91 -0
- package/dist/components/Textarea.js.map +1 -0
- package/dist/components/Timeline.d.ts +17 -0
- package/dist/components/Timeline.d.ts.map +1 -0
- package/dist/components/Timeline.js +95 -0
- package/dist/components/Timeline.js.map +1 -0
- package/dist/components/Toast.d.ts +36 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +143 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/ToggleGroup.d.ts +25 -0
- package/dist/components/ToggleGroup.d.ts.map +1 -0
- package/dist/components/ToggleGroup.js +103 -0
- package/dist/components/ToggleGroup.js.map +1 -0
- package/dist/components/Tooltip.d.ts +19 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip.js +141 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/Transition.d.ts +22 -0
- package/dist/components/Transition.d.ts.map +1 -0
- package/dist/components/Transition.js +139 -0
- package/dist/components/Transition.js.map +1 -0
- package/dist/density.d.ts +21 -0
- package/dist/density.d.ts.map +1 -0
- package/dist/density.js +31 -0
- package/dist/density.js.map +1 -0
- package/dist/dev.d.ts +27 -0
- package/dist/dev.d.ts.map +1 -0
- package/dist/dev.js +77 -0
- package/dist/dev.js.map +1 -0
- package/dist/focusTrap.d.ts +6 -0
- package/dist/focusTrap.d.ts.map +1 -0
- package/dist/focusTrap.js +55 -0
- package/dist/focusTrap.js.map +1 -0
- package/dist/form.d.ts +125 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +192 -0
- package/dist/form.js.map +1 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/motion.d.ts +29 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +43 -0
- package/dist/motion.js.map +1 -0
- package/dist/overlay.d.ts +63 -0
- package/dist/overlay.d.ts.map +1 -0
- package/dist/overlay.js +172 -0
- package/dist/overlay.js.map +1 -0
- package/dist/palette.d.ts +20 -0
- package/dist/palette.d.ts.map +1 -0
- package/dist/palette.js +52 -0
- package/dist/palette.js.map +1 -0
- package/dist/reactive.d.ts +25 -0
- package/dist/reactive.d.ts.map +1 -0
- package/dist/reactive.js +43 -0
- package/dist/reactive.js.map +1 -0
- package/dist/rovingFocus.d.ts +36 -0
- package/dist/rovingFocus.d.ts.map +1 -0
- package/dist/rovingFocus.js +127 -0
- package/dist/rovingFocus.js.map +1 -0
- package/dist/size-entries/form-kit.d.ts +12 -0
- package/dist/size-entries/form-kit.d.ts.map +1 -0
- package/dist/size-entries/form-kit.js +12 -0
- package/dist/size-entries/form-kit.js.map +1 -0
- package/dist/styles.d.ts +29 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +53 -0
- package/dist/styles.js.map +1 -0
- package/dist/theme.d.ts +22 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +32 -0
- package/dist/theme.js.map +1 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +24 -0
- package/dist/utils.js.map +1 -0
- package/package.json +71 -0
- package/src/components/Accordion.tsx +194 -0
- package/src/components/Alert.tsx +88 -0
- package/src/components/AspectRatio.tsx +64 -0
- package/src/components/Avatar.tsx +89 -0
- package/src/components/Badge.tsx +84 -0
- package/src/components/Breadcrumb.tsx +116 -0
- package/src/components/Button.tsx +148 -0
- package/src/components/Card.tsx +92 -0
- package/src/components/Checkbox.tsx +143 -0
- package/src/components/Chip.tsx +153 -0
- package/src/components/Code.tsx +71 -0
- package/src/components/Collapse.tsx +76 -0
- package/src/components/Combobox.tsx +438 -0
- package/src/components/Command.tsx +380 -0
- package/src/components/Container.tsx +58 -0
- package/src/components/Dialog.tsx +226 -0
- package/src/components/Divider.tsx +72 -0
- package/src/components/Drawer.tsx +191 -0
- package/src/components/Empty.tsx +86 -0
- package/src/components/Field.tsx +184 -0
- package/src/components/Grid.tsx +67 -0
- package/src/components/Input.tsx +169 -0
- package/src/components/Kbd.tsx +57 -0
- package/src/components/Label.tsx +54 -0
- package/src/components/Link.tsx +87 -0
- package/src/components/List.tsx +236 -0
- package/src/components/Menu.tsx +195 -0
- package/src/components/NumberInput.tsx +158 -0
- package/src/components/Pagination.tsx +153 -0
- package/src/components/Popover.tsx +219 -0
- package/src/components/Progress.tsx +108 -0
- package/src/components/Radio.tsx +161 -0
- package/src/components/ScrollArea.tsx +58 -0
- package/src/components/Select.tsx +128 -0
- package/src/components/Skeleton.tsx +117 -0
- package/src/components/Slider.tsx +175 -0
- package/src/components/Spinner.tsx +70 -0
- package/src/components/Stack.tsx +79 -0
- package/src/components/Stat.tsx +169 -0
- package/src/components/Steps.tsx +191 -0
- package/src/components/Switch.tsx +146 -0
- package/src/components/Table.tsx +168 -0
- package/src/components/Tabs.tsx +246 -0
- package/src/components/Text.tsx +69 -0
- package/src/components/Textarea.tsx +128 -0
- package/src/components/Timeline.tsx +150 -0
- package/src/components/Toast.tsx +221 -0
- package/src/components/ToggleGroup.tsx +161 -0
- package/src/components/Tooltip.tsx +187 -0
- package/src/components/Transition.tsx +155 -0
- package/src/density.ts +46 -0
- package/src/dev.ts +87 -0
- package/src/focusTrap.ts +61 -0
- package/src/form.ts +269 -0
- package/src/index.ts +243 -0
- package/src/motion.ts +62 -0
- package/src/overlay.ts +232 -0
- package/src/palette.ts +70 -0
- package/src/reactive.ts +54 -0
- package/src/rovingFocus.ts +171 -0
- package/src/size-entries/form-kit.ts +11 -0
- package/src/styles/base.css +70 -0
- package/src/styles/theme.css +14 -0
- package/src/styles/tokens.css +377 -0
- package/src/styles/utilities.css +216 -0
- package/src/styles.ts +52 -0
- package/src/theme.ts +48 -0
- package/src/utils.ts +25 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lab206/ui — integrated design system (styling + components)
|
|
3
|
+
*
|
|
4
|
+
* Layers: tokens → primitives → optional utilities (see docs/STYLING.md)
|
|
5
|
+
*
|
|
6
|
+
* 1. import "@lab206/ui/theme.css" // tokens + base + utilities
|
|
7
|
+
* 2. createTheme().bind(); createDensity().bind();
|
|
8
|
+
* 3. Use Button, Field, Stack… (prefer primitives over raw utilities)
|
|
9
|
+
* 4. Forms: <Input bind={signal} /> + Field error={…} — see docs/USABILITY.md
|
|
10
|
+
*
|
|
11
|
+
* Edit brand in: packages/ui/src/styles/tokens.css
|
|
12
|
+
* Author new primitives: createStyleSheet + component() — see docs/COMPONENTS.md
|
|
13
|
+
* Public docs hub: docs/README.md
|
|
14
|
+
*/
|
|
15
|
+
export { createTheme } from "./theme.js";
|
|
16
|
+
export type { ThemeMode, ThemeController } from "./theme.js";
|
|
17
|
+
export { createDensity } from "./density.js";
|
|
18
|
+
export type { Density, DensityController } from "./density.js";
|
|
19
|
+
export { createPalette } from "./palette.js";
|
|
20
|
+
export type { PaletteId, PaletteController } from "./palette.js";
|
|
21
|
+
export { cx, puId } from "./utils.js";
|
|
22
|
+
export { createStyleSheet, styleVars } from "./styles.js";
|
|
23
|
+
export { readProp, readBool, readStr, readNum, type MaybeReactive, } from "./reactive.js";
|
|
24
|
+
export { trapFocus } from "./focusTrap.js";
|
|
25
|
+
export { attachOverlay } from "./overlay.js";
|
|
26
|
+
export type { OverlayAttachOptions, OverlayContext } from "./overlay.js";
|
|
27
|
+
export { listRovingItems, applyRovingTabIndex, focusRovingItem, handleRovingKeydown, initRovingFocus, } from "./rovingFocus.js";
|
|
28
|
+
export type { RovingKeyOptions } from "./rovingFocus.js";
|
|
29
|
+
export { firstError, required, minLength, maxLength, emailFormat, matches, validateForm, eventValue, eventChecked, bindInput, bindString, bindSelect, bindChecked, asSelectBind, createField, } from "./form.js";
|
|
30
|
+
export type { FieldError, Bindable, FieldHandle, CreateFieldOptions, } from "./form.js";
|
|
31
|
+
export { MOTION_PRESETS, motionVars } from "./motion.js";
|
|
32
|
+
export type { MotionPreset, MotionPresetName } from "./motion.js";
|
|
33
|
+
export { devWarnOnce, warnIfThemeMissing, warnPossibleSnapshotValue, setDevWarnings, installDevWarnings, } from "./dev.js";
|
|
34
|
+
export { Stack } from "./components/Stack.js";
|
|
35
|
+
export type { StackProps } from "./components/Stack.js";
|
|
36
|
+
export { Grid } from "./components/Grid.js";
|
|
37
|
+
export type { GridProps } from "./components/Grid.js";
|
|
38
|
+
export { Container } from "./components/Container.js";
|
|
39
|
+
export type { ContainerProps } from "./components/Container.js";
|
|
40
|
+
export { Divider } from "./components/Divider.js";
|
|
41
|
+
export type { DividerProps } from "./components/Divider.js";
|
|
42
|
+
export { AspectRatio } from "./components/AspectRatio.js";
|
|
43
|
+
export type { AspectRatioProps } from "./components/AspectRatio.js";
|
|
44
|
+
export { ScrollArea } from "./components/ScrollArea.js";
|
|
45
|
+
export type { ScrollAreaProps } from "./components/ScrollArea.js";
|
|
46
|
+
export { Collapse } from "./components/Collapse.js";
|
|
47
|
+
export type { CollapseProps } from "./components/Collapse.js";
|
|
48
|
+
export { Text } from "./components/Text.js";
|
|
49
|
+
export type { TextProps } from "./components/Text.js";
|
|
50
|
+
export { Code } from "./components/Code.js";
|
|
51
|
+
export type { CodeProps } from "./components/Code.js";
|
|
52
|
+
export { Kbd } from "./components/Kbd.js";
|
|
53
|
+
export type { KbdProps } from "./components/Kbd.js";
|
|
54
|
+
export { Link } from "./components/Link.js";
|
|
55
|
+
export type { LinkProps } from "./components/Link.js";
|
|
56
|
+
export { Button } from "./components/Button.js";
|
|
57
|
+
export type { ButtonProps, ButtonVariant, ButtonSize } from "./components/Button.js";
|
|
58
|
+
export { Input } from "./components/Input.js";
|
|
59
|
+
export type { InputProps } from "./components/Input.js";
|
|
60
|
+
export { Textarea } from "./components/Textarea.js";
|
|
61
|
+
export type { TextareaProps } from "./components/Textarea.js";
|
|
62
|
+
export { Select } from "./components/Select.js";
|
|
63
|
+
export type { SelectProps, SelectOption } from "./components/Select.js";
|
|
64
|
+
export { Label } from "./components/Label.js";
|
|
65
|
+
export type { LabelProps } from "./components/Label.js";
|
|
66
|
+
export { Field } from "./components/Field.js";
|
|
67
|
+
export type { FieldProps } from "./components/Field.js";
|
|
68
|
+
export { Switch } from "./components/Switch.js";
|
|
69
|
+
export type { SwitchProps } from "./components/Switch.js";
|
|
70
|
+
export { Checkbox } from "./components/Checkbox.js";
|
|
71
|
+
export type { CheckboxProps } from "./components/Checkbox.js";
|
|
72
|
+
export { RadioGroup } from "./components/Radio.js";
|
|
73
|
+
export type { RadioGroupProps, RadioOption } from "./components/Radio.js";
|
|
74
|
+
export { Slider } from "./components/Slider.js";
|
|
75
|
+
export type { SliderProps } from "./components/Slider.js";
|
|
76
|
+
export { NumberInput } from "./components/NumberInput.js";
|
|
77
|
+
export type { NumberInputProps } from "./components/NumberInput.js";
|
|
78
|
+
export { ToggleGroup } from "./components/ToggleGroup.js";
|
|
79
|
+
export type { ToggleGroupProps, ToggleOption } from "./components/ToggleGroup.js";
|
|
80
|
+
export { Combobox } from "./components/Combobox.js";
|
|
81
|
+
export type { ComboboxProps, ComboboxOption } from "./components/Combobox.js";
|
|
82
|
+
export { Card } from "./components/Card.js";
|
|
83
|
+
export type { CardProps } from "./components/Card.js";
|
|
84
|
+
export { Badge } from "./components/Badge.js";
|
|
85
|
+
export type { BadgeProps } from "./components/Badge.js";
|
|
86
|
+
export { Chip } from "./components/Chip.js";
|
|
87
|
+
export type { ChipProps, ChipTone } from "./components/Chip.js";
|
|
88
|
+
export { Avatar } from "./components/Avatar.js";
|
|
89
|
+
export type { AvatarProps, AvatarSize } from "./components/Avatar.js";
|
|
90
|
+
export { Alert } from "./components/Alert.js";
|
|
91
|
+
export type { AlertProps, AlertTone } from "./components/Alert.js";
|
|
92
|
+
export { Spinner } from "./components/Spinner.js";
|
|
93
|
+
export type { SpinnerProps, SpinnerSize } from "./components/Spinner.js";
|
|
94
|
+
export { Progress } from "./components/Progress.js";
|
|
95
|
+
export type { ProgressProps } from "./components/Progress.js";
|
|
96
|
+
export { Skeleton } from "./components/Skeleton.js";
|
|
97
|
+
export type { SkeletonProps } from "./components/Skeleton.js";
|
|
98
|
+
export { Empty } from "./components/Empty.js";
|
|
99
|
+
export type { EmptyProps } from "./components/Empty.js";
|
|
100
|
+
export { Stat } from "./components/Stat.js";
|
|
101
|
+
export type { StatProps } from "./components/Stat.js";
|
|
102
|
+
export { Toaster, createToaster } from "./components/Toast.js";
|
|
103
|
+
export type { ToasterProps, ToastController, ToastItem, ToastTone, } from "./components/Toast.js";
|
|
104
|
+
export { Tabs } from "./components/Tabs.js";
|
|
105
|
+
export type { TabsProps, TabItem } from "./components/Tabs.js";
|
|
106
|
+
export { Accordion } from "./components/Accordion.js";
|
|
107
|
+
export type { AccordionProps, AccordionItem } from "./components/Accordion.js";
|
|
108
|
+
export { Breadcrumb } from "./components/Breadcrumb.js";
|
|
109
|
+
export type { BreadcrumbProps, BreadcrumbItem } from "./components/Breadcrumb.js";
|
|
110
|
+
export { Pagination } from "./components/Pagination.js";
|
|
111
|
+
export type { PaginationProps } from "./components/Pagination.js";
|
|
112
|
+
export { Steps } from "./components/Steps.js";
|
|
113
|
+
export type { StepsProps, StepItem } from "./components/Steps.js";
|
|
114
|
+
export { Timeline } from "./components/Timeline.js";
|
|
115
|
+
export type { TimelineProps, TimelineItem } from "./components/Timeline.js";
|
|
116
|
+
export { List } from "./components/List.js";
|
|
117
|
+
export type { ListProps, ListItemData } from "./components/List.js";
|
|
118
|
+
export { Table } from "./components/Table.js";
|
|
119
|
+
export type { TableProps, TableColumn } from "./components/Table.js";
|
|
120
|
+
export { Dialog } from "./components/Dialog.js";
|
|
121
|
+
export type { DialogProps } from "./components/Dialog.js";
|
|
122
|
+
export { Drawer } from "./components/Drawer.js";
|
|
123
|
+
export type { DrawerProps } from "./components/Drawer.js";
|
|
124
|
+
export { Tooltip } from "./components/Tooltip.js";
|
|
125
|
+
export type { TooltipProps } from "./components/Tooltip.js";
|
|
126
|
+
export { Popover } from "./components/Popover.js";
|
|
127
|
+
export type { PopoverProps } from "./components/Popover.js";
|
|
128
|
+
export { Menu } from "./components/Menu.js";
|
|
129
|
+
export type { MenuProps, MenuItem } from "./components/Menu.js";
|
|
130
|
+
export { Command } from "./components/Command.js";
|
|
131
|
+
export type { CommandProps, CommandItem } from "./components/Command.js";
|
|
132
|
+
export { Transition } from "./components/Transition.js";
|
|
133
|
+
export type { TransitionProps } from "./components/Transition.js";
|
|
134
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,EACP,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,OAAO,EACP,YAAY,EACZ,UAAU,EACV,YAAY,E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AY,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGrE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGzE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @lab206/ui — integrated design system (styling + components)
|
|
3
|
+
*
|
|
4
|
+
* Layers: tokens → primitives → optional utilities (see docs/STYLING.md)
|
|
5
|
+
*
|
|
6
|
+
* 1. import "@lab206/ui/theme.css" // tokens + base + utilities
|
|
7
|
+
* 2. createTheme().bind(); createDensity().bind();
|
|
8
|
+
* 3. Use Button, Field, Stack… (prefer primitives over raw utilities)
|
|
9
|
+
* 4. Forms: <Input bind={signal} /> + Field error={…} — see docs/USABILITY.md
|
|
10
|
+
*
|
|
11
|
+
* Edit brand in: packages/ui/src/styles/tokens.css
|
|
12
|
+
* Author new primitives: createStyleSheet + component() — see docs/COMPONENTS.md
|
|
13
|
+
* Public docs hub: docs/README.md
|
|
14
|
+
*/
|
|
15
|
+
export { createTheme } from "./theme.js";
|
|
16
|
+
export { createDensity } from "./density.js";
|
|
17
|
+
export { createPalette } from "./palette.js";
|
|
18
|
+
export { cx, puId } from "./utils.js";
|
|
19
|
+
export { createStyleSheet, styleVars } from "./styles.js";
|
|
20
|
+
export { readProp, readBool, readStr, readNum, } from "./reactive.js";
|
|
21
|
+
export { trapFocus } from "./focusTrap.js";
|
|
22
|
+
export { attachOverlay } from "./overlay.js";
|
|
23
|
+
export { listRovingItems, applyRovingTabIndex, focusRovingItem, handleRovingKeydown, initRovingFocus, } from "./rovingFocus.js";
|
|
24
|
+
export { firstError, required, minLength, maxLength, emailFormat, matches, validateForm, eventValue, eventChecked, bindInput, bindString, bindSelect, bindChecked, asSelectBind, createField, } from "./form.js";
|
|
25
|
+
export { MOTION_PRESETS, motionVars } from "./motion.js";
|
|
26
|
+
export { devWarnOnce, warnIfThemeMissing, warnPossibleSnapshotValue, setDevWarnings, installDevWarnings, } from "./dev.js";
|
|
27
|
+
// —— Layout ——
|
|
28
|
+
export { Stack } from "./components/Stack.js";
|
|
29
|
+
export { Grid } from "./components/Grid.js";
|
|
30
|
+
export { Container } from "./components/Container.js";
|
|
31
|
+
export { Divider } from "./components/Divider.js";
|
|
32
|
+
export { AspectRatio } from "./components/AspectRatio.js";
|
|
33
|
+
export { ScrollArea } from "./components/ScrollArea.js";
|
|
34
|
+
export { Collapse } from "./components/Collapse.js";
|
|
35
|
+
// —— Type ——
|
|
36
|
+
export { Text } from "./components/Text.js";
|
|
37
|
+
export { Code } from "./components/Code.js";
|
|
38
|
+
export { Kbd } from "./components/Kbd.js";
|
|
39
|
+
export { Link } from "./components/Link.js";
|
|
40
|
+
// —— Forms ——
|
|
41
|
+
export { Button } from "./components/Button.js";
|
|
42
|
+
export { Input } from "./components/Input.js";
|
|
43
|
+
export { Textarea } from "./components/Textarea.js";
|
|
44
|
+
export { Select } from "./components/Select.js";
|
|
45
|
+
export { Label } from "./components/Label.js";
|
|
46
|
+
export { Field } from "./components/Field.js";
|
|
47
|
+
export { Switch } from "./components/Switch.js";
|
|
48
|
+
export { Checkbox } from "./components/Checkbox.js";
|
|
49
|
+
export { RadioGroup } from "./components/Radio.js";
|
|
50
|
+
export { Slider } from "./components/Slider.js";
|
|
51
|
+
export { NumberInput } from "./components/NumberInput.js";
|
|
52
|
+
export { ToggleGroup } from "./components/ToggleGroup.js";
|
|
53
|
+
export { Combobox } from "./components/Combobox.js";
|
|
54
|
+
// —— Surfaces & chrome ——
|
|
55
|
+
export { Card } from "./components/Card.js";
|
|
56
|
+
export { Badge } from "./components/Badge.js";
|
|
57
|
+
export { Chip } from "./components/Chip.js";
|
|
58
|
+
export { Avatar } from "./components/Avatar.js";
|
|
59
|
+
// —— Feedback ——
|
|
60
|
+
export { Alert } from "./components/Alert.js";
|
|
61
|
+
export { Spinner } from "./components/Spinner.js";
|
|
62
|
+
export { Progress } from "./components/Progress.js";
|
|
63
|
+
export { Skeleton } from "./components/Skeleton.js";
|
|
64
|
+
export { Empty } from "./components/Empty.js";
|
|
65
|
+
export { Stat } from "./components/Stat.js";
|
|
66
|
+
export { Toaster, createToaster } from "./components/Toast.js";
|
|
67
|
+
// —— Navigation & structure ——
|
|
68
|
+
export { Tabs } from "./components/Tabs.js";
|
|
69
|
+
export { Accordion } from "./components/Accordion.js";
|
|
70
|
+
export { Breadcrumb } from "./components/Breadcrumb.js";
|
|
71
|
+
export { Pagination } from "./components/Pagination.js";
|
|
72
|
+
export { Steps } from "./components/Steps.js";
|
|
73
|
+
export { Timeline } from "./components/Timeline.js";
|
|
74
|
+
export { List } from "./components/List.js";
|
|
75
|
+
export { Table } from "./components/Table.js";
|
|
76
|
+
// —— Overlays ——
|
|
77
|
+
export { Dialog } from "./components/Dialog.js";
|
|
78
|
+
export { Drawer } from "./components/Drawer.js";
|
|
79
|
+
export { Tooltip } from "./components/Tooltip.js";
|
|
80
|
+
export { Popover } from "./components/Popover.js";
|
|
81
|
+
export { Menu } from "./components/Menu.js";
|
|
82
|
+
export { Command } from "./components/Command.js";
|
|
83
|
+
// —— Motion ——
|
|
84
|
+
export { Transition } from "./components/Transition.js";
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGzC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,OAAO,GAER,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,UAAU,EACV,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,OAAO,EACP,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,GACZ,MAAM,WAAW,CAAC;AAQnB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,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MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAG5C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD,eAAe;AACf,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/motion.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Motion language — named enter/exit class presets for Transition / CSS.
|
|
3
|
+
*
|
|
4
|
+
* Use with `<Transition name="pu-fade" show={…}>` or apply classes yourself.
|
|
5
|
+
* All presets respect `prefers-reduced-motion` via Transition's built-in CSS
|
|
6
|
+
* and global base.css rules.
|
|
7
|
+
*/
|
|
8
|
+
export type MotionPreset = {
|
|
9
|
+
/** Class prefix for Transition `name` prop */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Human label */
|
|
12
|
+
label: string;
|
|
13
|
+
/** When to use */
|
|
14
|
+
use: string;
|
|
15
|
+
/** Suggested duration ms */
|
|
16
|
+
duration: number;
|
|
17
|
+
};
|
|
18
|
+
/** Built-in Transition names shipped in Transition.tsx styles. */
|
|
19
|
+
export declare const MOTION_PRESETS: readonly MotionPreset[];
|
|
20
|
+
export type MotionPresetName = (typeof MOTION_PRESETS)[number]["name"];
|
|
21
|
+
/**
|
|
22
|
+
* CSS custom-property recipe for one-off motion on a node
|
|
23
|
+
* (pair with your own transition: rules).
|
|
24
|
+
*/
|
|
25
|
+
export declare function motionVars(opts: {
|
|
26
|
+
duration?: string | number;
|
|
27
|
+
ease?: "out" | "spring" | "default";
|
|
28
|
+
}): Record<string, string>;
|
|
29
|
+
//# sourceMappingURL=motion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.d.ts","sourceRoot":"","sources":["../src/motion.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,YAAY,GAAG;IACzB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,kEAAkE;AAClE,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAaxC,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;CACrC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiBzB"}
|
package/dist/motion.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Motion language — named enter/exit class presets for Transition / CSS.
|
|
3
|
+
*
|
|
4
|
+
* Use with `<Transition name="pu-fade" show={…}>` or apply classes yourself.
|
|
5
|
+
* All presets respect `prefers-reduced-motion` via Transition's built-in CSS
|
|
6
|
+
* and global base.css rules.
|
|
7
|
+
*/
|
|
8
|
+
/** Built-in Transition names shipped in Transition.tsx styles. */
|
|
9
|
+
export const MOTION_PRESETS = [
|
|
10
|
+
{
|
|
11
|
+
name: "pu-fade",
|
|
12
|
+
label: "Fade",
|
|
13
|
+
use: "Default enter/exit for overlays, panels, soft content swaps",
|
|
14
|
+
duration: 220,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "pu-collapse",
|
|
18
|
+
label: "Collapse",
|
|
19
|
+
use: "Accordion-like height expand/collapse (max-height)",
|
|
20
|
+
duration: 360,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* CSS custom-property recipe for one-off motion on a node
|
|
25
|
+
* (pair with your own transition: rules).
|
|
26
|
+
*/
|
|
27
|
+
export function motionVars(opts) {
|
|
28
|
+
const duration = opts.duration == null
|
|
29
|
+
? "var(--pu-duration)"
|
|
30
|
+
: typeof opts.duration === "number"
|
|
31
|
+
? `${opts.duration}ms`
|
|
32
|
+
: opts.duration;
|
|
33
|
+
const ease = opts.ease === "spring"
|
|
34
|
+
? "var(--pu-ease-spring)"
|
|
35
|
+
: opts.ease === "out"
|
|
36
|
+
? "var(--pu-ease-out)"
|
|
37
|
+
: "var(--pu-ease)";
|
|
38
|
+
return {
|
|
39
|
+
"--pu-motion-duration": duration,
|
|
40
|
+
"--pu-motion-ease": ease,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=motion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"motion.js","sourceRoot":"","sources":["../src/motion.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,kEAAkE;AAClE,MAAM,CAAC,MAAM,cAAc,GAA4B;IACrD;QACE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,6DAA6D;QAClE,QAAQ,EAAE,GAAG;KACd;IACD;QACE,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,UAAU;QACjB,GAAG,EAAE,oDAAoD;QACzD,QAAQ,EAAE,GAAG;KACd;CACO,CAAC;AAIX;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,IAG1B;IACC,MAAM,QAAQ,GACZ,IAAI,CAAC,QAAQ,IAAI,IAAI;QACnB,CAAC,CAAC,oBAAoB;QACtB,CAAC,CAAC,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ;YACjC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,IAAI;YACtB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IACtB,MAAM,IAAI,GACR,IAAI,CAAC,IAAI,KAAK,QAAQ;QACpB,CAAC,CAAC,uBAAuB;QACzB,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK;YACnB,CAAC,CAAC,oBAAoB;YACtB,CAAC,CAAC,gBAAgB,CAAC;IACzB,OAAO;QACL,sBAAsB,EAAE,QAAQ;QAChC,kBAAkB,EAAE,IAAI;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared overlay runtime for Dialog · Drawer · Popover · Command · Menu.
|
|
3
|
+
*
|
|
4
|
+
* Goals (FOUNDATION week 2):
|
|
5
|
+
* - One place for Escape, body scroll lock, focus trap, outside dismiss
|
|
6
|
+
* - Stacked layers: only the topmost Escape / outside-dismiss handler fires
|
|
7
|
+
* - Scroll lock is ref-counted (two dialogs open → one unlock when both close)
|
|
8
|
+
* - ownerDocument-aware (Lab iframes)
|
|
9
|
+
*/
|
|
10
|
+
export type OverlayContext = {
|
|
11
|
+
doc: Document;
|
|
12
|
+
win: Window & typeof globalThis;
|
|
13
|
+
root: HTMLElement | null;
|
|
14
|
+
};
|
|
15
|
+
export type OverlayAttachOptions = {
|
|
16
|
+
/** Overlay root (for document + outside-click containment). */
|
|
17
|
+
getRoot: () => HTMLElement | null;
|
|
18
|
+
/** Panel to focus-trap; omit for non-modal popovers/menus. */
|
|
19
|
+
getFocusRoot?: () => HTMLElement | null;
|
|
20
|
+
/** Close / dismiss callback. */
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
/** Lock document.body scroll while open. Default false. */
|
|
23
|
+
scrollLock?: boolean;
|
|
24
|
+
/** Escape closes (topmost only). Default true. */
|
|
25
|
+
escape?: boolean;
|
|
26
|
+
/** Pointer down outside `getRoot()` closes (topmost only). Default false. */
|
|
27
|
+
dismissOutside?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Optional override for “inside” detection (portaled lists, multi-node roots).
|
|
30
|
+
* When omitted, uses `getRoot()?.contains(node)`.
|
|
31
|
+
*/
|
|
32
|
+
isInside?: (node: Node) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Run after deferred attach (refs ready). Return optional extra cleanup
|
|
35
|
+
* (e.g. Popover reposition on scroll/resize).
|
|
36
|
+
*/
|
|
37
|
+
onAttach?: (ctx: OverlayContext) => (() => void) | void;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Attach overlay behaviors while open. Call from an `effect` when open is true;
|
|
41
|
+
* return the dispose as the effect cleanup.
|
|
42
|
+
*
|
|
43
|
+
* Attach is deferred one macrotask so `ref` callbacks have run.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* effect(() => {
|
|
48
|
+
* if (!isOpen()) return;
|
|
49
|
+
* return attachOverlay({
|
|
50
|
+
* getRoot: () => rootEl,
|
|
51
|
+
* getFocusRoot: () => panelEl,
|
|
52
|
+
* onClose: () => props.onClose?.(),
|
|
53
|
+
* scrollLock: true,
|
|
54
|
+
* });
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function attachOverlay(options: OverlayAttachOptions): () => void;
|
|
59
|
+
/** Test helper — current stack depth (all documents). */
|
|
60
|
+
export declare function __overlayStackSize(): number;
|
|
61
|
+
/** Test helper — clear stack (does not restore scroll). */
|
|
62
|
+
export declare function __resetOverlayStack(): void;
|
|
63
|
+
//# sourceMappingURL=overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,QAAQ,CAAC;IACd,GAAG,EAAE,MAAM,GAAG,OAAO,UAAU,CAAC;IAChC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,+DAA+D;IAC/D,OAAO,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IAClC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACxC,gCAAgC;IAChC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kDAAkD;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6EAA6E;IAC7E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;CACzD,CAAC;AA4DF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAoGvE;AAED,yDAAyD;AACzD,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,2DAA2D;AAC3D,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C"}
|
package/dist/overlay.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { trapFocus } from "./focusTrap.js";
|
|
2
|
+
let nextLayerId = 1;
|
|
3
|
+
const layers = [];
|
|
4
|
+
function topLayer(doc, pred) {
|
|
5
|
+
for (let i = layers.length - 1; i >= 0; i--) {
|
|
6
|
+
const l = layers[i];
|
|
7
|
+
if (l.doc === doc && pred(l))
|
|
8
|
+
return l;
|
|
9
|
+
}
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
function pushLayer(layer) {
|
|
13
|
+
layers.push(layer);
|
|
14
|
+
return () => {
|
|
15
|
+
const i = layers.findIndex((l) => l.id === layer.id);
|
|
16
|
+
if (i >= 0)
|
|
17
|
+
layers.splice(i, 1);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Per-document scroll lock refcount. */
|
|
21
|
+
const scrollLocks = new WeakMap();
|
|
22
|
+
function lockBodyScroll(doc) {
|
|
23
|
+
let entry = scrollLocks.get(doc);
|
|
24
|
+
if (!entry) {
|
|
25
|
+
entry = { count: 0, prev: doc.body.style.overflow };
|
|
26
|
+
scrollLocks.set(doc, entry);
|
|
27
|
+
}
|
|
28
|
+
if (entry.count === 0) {
|
|
29
|
+
entry.prev = doc.body.style.overflow;
|
|
30
|
+
doc.body.style.overflow = "hidden";
|
|
31
|
+
}
|
|
32
|
+
entry.count++;
|
|
33
|
+
return () => {
|
|
34
|
+
const e = scrollLocks.get(doc);
|
|
35
|
+
if (!e)
|
|
36
|
+
return;
|
|
37
|
+
e.count--;
|
|
38
|
+
if (e.count <= 0) {
|
|
39
|
+
e.count = 0;
|
|
40
|
+
doc.body.style.overflow = e.prev;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Attach overlay behaviors while open. Call from an `effect` when open is true;
|
|
46
|
+
* return the dispose as the effect cleanup.
|
|
47
|
+
*
|
|
48
|
+
* Attach is deferred one macrotask so `ref` callbacks have run.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* effect(() => {
|
|
53
|
+
* if (!isOpen()) return;
|
|
54
|
+
* return attachOverlay({
|
|
55
|
+
* getRoot: () => rootEl,
|
|
56
|
+
* getFocusRoot: () => panelEl,
|
|
57
|
+
* onClose: () => props.onClose?.(),
|
|
58
|
+
* scrollLock: true,
|
|
59
|
+
* });
|
|
60
|
+
* });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function attachOverlay(options) {
|
|
64
|
+
const escape = options.escape !== false;
|
|
65
|
+
const dismissOutside = !!options.dismissOutside;
|
|
66
|
+
const scrollLock = !!options.scrollLock;
|
|
67
|
+
let disposed = false;
|
|
68
|
+
const cleanups = [];
|
|
69
|
+
const attach = () => {
|
|
70
|
+
if (disposed)
|
|
71
|
+
return;
|
|
72
|
+
const root = options.getRoot();
|
|
73
|
+
const doc = root?.ownerDocument ?? document;
|
|
74
|
+
const win = (doc.defaultView ?? window);
|
|
75
|
+
const focusRoot = options.getFocusRoot?.() ?? null;
|
|
76
|
+
const layer = {
|
|
77
|
+
id: nextLayerId++,
|
|
78
|
+
doc,
|
|
79
|
+
onClose: options.onClose,
|
|
80
|
+
escape,
|
|
81
|
+
dismissOutside,
|
|
82
|
+
getRoot: options.getRoot,
|
|
83
|
+
...(options.isInside ? { isInside: options.isInside } : {}),
|
|
84
|
+
};
|
|
85
|
+
cleanups.push(pushLayer(layer));
|
|
86
|
+
if (scrollLock) {
|
|
87
|
+
cleanups.push(lockBodyScroll(doc));
|
|
88
|
+
}
|
|
89
|
+
if (escape) {
|
|
90
|
+
const onKey = (e) => {
|
|
91
|
+
if (e.key !== "Escape")
|
|
92
|
+
return;
|
|
93
|
+
const top = topLayer(doc, (l) => l.escape);
|
|
94
|
+
if (!top || top.id !== layer.id)
|
|
95
|
+
return;
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
options.onClose();
|
|
99
|
+
};
|
|
100
|
+
win.addEventListener("keydown", onKey, true);
|
|
101
|
+
cleanups.push(() => win.removeEventListener("keydown", onKey, true));
|
|
102
|
+
}
|
|
103
|
+
if (dismissOutside) {
|
|
104
|
+
const contains = (node) => {
|
|
105
|
+
if (options.isInside)
|
|
106
|
+
return options.isInside(node);
|
|
107
|
+
const r = options.getRoot();
|
|
108
|
+
return !!(r && r.contains(node));
|
|
109
|
+
};
|
|
110
|
+
const onPointer = (e) => {
|
|
111
|
+
const top = topLayer(doc, (l) => l.dismissOutside);
|
|
112
|
+
if (!top || top.id !== layer.id)
|
|
113
|
+
return;
|
|
114
|
+
const t = e.target;
|
|
115
|
+
if (!t)
|
|
116
|
+
return;
|
|
117
|
+
if (contains(t))
|
|
118
|
+
return;
|
|
119
|
+
options.onClose();
|
|
120
|
+
};
|
|
121
|
+
// Skip the opening interaction
|
|
122
|
+
const skipTimer = win.setTimeout(() => {
|
|
123
|
+
if (disposed)
|
|
124
|
+
return;
|
|
125
|
+
doc.addEventListener("pointerdown", onPointer, true);
|
|
126
|
+
}, 0);
|
|
127
|
+
cleanups.push(() => {
|
|
128
|
+
win.clearTimeout(skipTimer);
|
|
129
|
+
doc.removeEventListener("pointerdown", onPointer, true);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
if (focusRoot) {
|
|
133
|
+
cleanups.push(trapFocus(focusRoot));
|
|
134
|
+
}
|
|
135
|
+
const extra = options.onAttach?.({ doc, win, root });
|
|
136
|
+
if (typeof extra === "function")
|
|
137
|
+
cleanups.push(extra);
|
|
138
|
+
};
|
|
139
|
+
const win = typeof window !== "undefined"
|
|
140
|
+
? window
|
|
141
|
+
: undefined;
|
|
142
|
+
const timer = win?.setTimeout(attach, 0);
|
|
143
|
+
if (timer != null && win) {
|
|
144
|
+
cleanups.push(() => win.clearTimeout(timer));
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
attach();
|
|
148
|
+
}
|
|
149
|
+
return () => {
|
|
150
|
+
disposed = true;
|
|
151
|
+
// LIFO cleanup for stable lock / stack order
|
|
152
|
+
for (let i = cleanups.length - 1; i >= 0; i--) {
|
|
153
|
+
try {
|
|
154
|
+
cleanups[i]();
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
/* ignore */
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
cleanups.length = 0;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/** Test helper — current stack depth (all documents). */
|
|
164
|
+
export function __overlayStackSize() {
|
|
165
|
+
return layers.length;
|
|
166
|
+
}
|
|
167
|
+
/** Test helper — clear stack (does not restore scroll). */
|
|
168
|
+
export function __resetOverlayStack() {
|
|
169
|
+
layers.length = 0;
|
|
170
|
+
nextLayerId = 1;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=overlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay.js","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAsD3C,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,MAAM,MAAM,GAAY,EAAE,CAAC;AAE3B,SAAS,QAAQ,CACf,GAAa,EACb,IAA2B;IAE3B,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAE,CAAC;QACrB,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,SAAS,CAAC,KAAY;IAC7B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,GAAG,EAAE;QACV,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,IAAI,CAAC;YAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClC,CAAC,CAAC;AACJ,CAAC;AAED,yCAAyC;AACzC,MAAM,WAAW,GAAG,IAAI,OAAO,EAA6C,CAAC;AAE7E,SAAS,cAAc,CAAC,GAAa;IACnC,IAAI,KAAK,GAAG,WAAW,CAAC,GAAG,CA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AG,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,kBAAkB;IAChC,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,mBAAmB;IACjC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,WAAW,GAAG,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Signal } from "@lab206/core";
|
|
2
|
+
/**
|
|
3
|
+
* Preview palettes for the design system.
|
|
4
|
+
* - `instrument` — current default (cool navy + green signal)
|
|
5
|
+
* - `dual` — dual electric (navy primary + cyan secondary; green = success only)
|
|
6
|
+
*/
|
|
7
|
+
export type PaletteId = "instrument" | "dual";
|
|
8
|
+
export interface PaletteController {
|
|
9
|
+
id: Signal<PaletteId>;
|
|
10
|
+
set(id: PaletteId): void;
|
|
11
|
+
toggle(): void;
|
|
12
|
+
/** Apply `data-pu-palette` on documentElement (or target). */
|
|
13
|
+
bind(target?: Element): () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Switchable token palette via `data-pu-palette` on `<html>`.
|
|
17
|
+
* Default: `dual` for preview (option 3); flip to `instrument` to restore the prior look.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createPalette(initial?: PaletteId): PaletteController;
|
|
20
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../src/palette.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,MAAM,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IACtB,GAAG,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,MAAM,IAAI,IAAI,CAAC;IACf,8DAA8D;IAC9D,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,IAAI,CAAC;CACpC;AAwBD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,SAAkB,GAAG,iBAAiB,CA0B5E"}
|
package/dist/palette.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { signal, effect } from "@lab206/core";
|
|
2
|
+
const STORAGE_KEY = "pu-palette";
|
|
3
|
+
function readStored() {
|
|
4
|
+
if (typeof localStorage === "undefined")
|
|
5
|
+
return null;
|
|
6
|
+
try {
|
|
7
|
+
const v = localStorage.getItem(STORAGE_KEY);
|
|
8
|
+
if (v === "instrument" || v === "dual")
|
|
9
|
+
return v;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
/* private mode */
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
function writeStored(id) {
|
|
17
|
+
if (typeof localStorage === "undefined")
|
|
18
|
+
return;
|
|
19
|
+
try {
|
|
20
|
+
localStorage.setItem(STORAGE_KEY, id);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
/* private mode */
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Switchable token palette via `data-pu-palette` on `<html>`.
|
|
28
|
+
* Default: `dual` for preview (option 3); flip to `instrument` to restore the prior look.
|
|
29
|
+
*/
|
|
30
|
+
export function createPalette(initial = "dual") {
|
|
31
|
+
// Prefer last choice so “Instrument” sticks after you flip back
|
|
32
|
+
const start = readStored() ?? initial;
|
|
33
|
+
const id = signal(start);
|
|
34
|
+
function set(next) {
|
|
35
|
+
id.set(next);
|
|
36
|
+
writeStored(next);
|
|
37
|
+
}
|
|
38
|
+
function toggle() {
|
|
39
|
+
set(id() === "dual" ? "instrument" : "dual");
|
|
40
|
+
}
|
|
41
|
+
function bind(target) {
|
|
42
|
+
const el = target ??
|
|
43
|
+
(typeof document !== "undefined" ? document.documentElement : null);
|
|
44
|
+
if (!el)
|
|
45
|
+
return () => { };
|
|
46
|
+
return effect(() => {
|
|
47
|
+
el.setAttribute("data-pu-palette", id());
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return { id, set, toggle, bind };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=palette.js.map
|