aporia 0.1.0 → 0.2.1
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/README.md +31 -23
- package/dist/ThemeProvider.d.ts +1 -3
- package/dist/ThemeProvider.d.ts.map +1 -1
- package/dist/components/Category.d.ts +21 -0
- package/dist/components/Category.d.ts.map +1 -0
- package/dist/components/ColorPicker.d.ts +6 -0
- package/dist/components/ColorPicker.d.ts.map +1 -0
- package/dist/components/ColorRow.d.ts +2 -1
- package/dist/components/ColorRow.d.ts.map +1 -1
- package/dist/components/GradientPicker.d.ts +1 -1
- package/dist/components/GradientPicker.d.ts.map +1 -1
- package/dist/components/GradientRow.d.ts +2 -1
- package/dist/components/GradientRow.d.ts.map +1 -1
- package/dist/components/Panel.d.ts +10 -0
- package/dist/components/Panel.d.ts.map +1 -0
- package/dist/components/SliderRow.d.ts +3 -1
- package/dist/components/SliderRow.d.ts.map +1 -1
- package/dist/components/SwatchPopover.d.ts +7 -1
- package/dist/components/SwatchPopover.d.ts.map +1 -1
- package/dist/components/ToggleRow.d.ts +2 -1
- package/dist/components/ToggleRow.d.ts.map +1 -1
- package/dist/components/ValueInput.d.ts +66 -0
- package/dist/components/ValueInput.d.ts.map +1 -0
- package/dist/components/categoryDisabledContext.d.ts +8 -0
- package/dist/components/categoryDisabledContext.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1682 -433
- package/dist/index.js.map +1 -1
- package/dist/style.css +624 -245
- package/dist/utils/colorSpace.d.ts +41 -0
- package/dist/utils/colorSpace.d.ts.map +1 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -10,8 +10,11 @@ npm install aporia
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
+
The usual setup is a **Panel** with one or more **Category** blocks, each containing rows (`SliderRow`, `ColorRow`, etc.). The package default export is `Panel`, so you can import it as the default or by name.
|
|
14
|
+
|
|
13
15
|
```tsx
|
|
14
|
-
import {
|
|
16
|
+
import { useState } from 'react'
|
|
17
|
+
import Panel, { Category, SliderRow, ColorRow, ToggleRow, GradientRow, ThemeProvider } from 'aporia'
|
|
15
18
|
import 'aporia/styles.css'
|
|
16
19
|
|
|
17
20
|
function App() {
|
|
@@ -21,35 +24,40 @@ function App() {
|
|
|
21
24
|
|
|
22
25
|
return (
|
|
23
26
|
<ThemeProvider>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/>
|
|
42
|
-
<GradientRow
|
|
43
|
-
label="Background"
|
|
44
|
-
onChange={(gradient) => console.log(gradient)}
|
|
45
|
-
/>
|
|
27
|
+
<Panel>
|
|
28
|
+
<Category title="Basics">
|
|
29
|
+
<SliderRow
|
|
30
|
+
label="Intensity"
|
|
31
|
+
value={intensity}
|
|
32
|
+
min={0}
|
|
33
|
+
max={100}
|
|
34
|
+
step={1}
|
|
35
|
+
onChange={setIntensity}
|
|
36
|
+
/>
|
|
37
|
+
<ColorRow label="Accent" value={color} onChange={setColor} />
|
|
38
|
+
<ToggleRow label="Enabled" checked={enabled} onChange={setEnabled} />
|
|
39
|
+
</Category>
|
|
40
|
+
<Category title="Background">
|
|
41
|
+
<GradientRow label="Gradient" onChange={(gradient) => console.log(gradient)} />
|
|
42
|
+
</Category>
|
|
43
|
+
</Panel>
|
|
46
44
|
</ThemeProvider>
|
|
47
45
|
)
|
|
48
46
|
}
|
|
49
47
|
```
|
|
50
48
|
|
|
49
|
+
You can also compose rows without `Panel` / `Category` if you only need individual controls.
|
|
50
|
+
|
|
51
51
|
## Components
|
|
52
52
|
|
|
53
|
+
### Panel
|
|
54
|
+
|
|
55
|
+
Rounded shell for a configurator: drop in `Category` sections and row components as children.
|
|
56
|
+
|
|
57
|
+
### Category
|
|
58
|
+
|
|
59
|
+
Collapsible section with a title and optional disable-all behavior for its children.
|
|
60
|
+
|
|
53
61
|
### SliderRow
|
|
54
62
|
|
|
55
63
|
A polished slider with spring animations, keyboard support, and inline editing.
|
package/dist/ThemeProvider.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export type Theme = 'dark'
|
|
2
|
+
export type Theme = 'dark';
|
|
3
3
|
type ThemeContextValue = {
|
|
4
4
|
theme: Theme;
|
|
5
|
-
setTheme: (t: Theme) => void;
|
|
6
|
-
toggleTheme: () => void;
|
|
7
5
|
};
|
|
8
6
|
export declare function ThemeProvider({ children }: {
|
|
9
7
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAEd,MAAM,MAAM,KAAK,GAAG,MAAM,CAAA;AAE1B,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAID,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAYlE;AAED,wBAAgB,QAAQ,sBAMvB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type CategoryProps = {
|
|
3
|
+
title: ReactNode;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** When true, rows inside respect disabled styling and ignore interaction. */
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* When set, renders a 4×4 toggle dot (e.g. bind to UI that enables/disables the block).
|
|
9
|
+
* Called with the next disabled state when the dot is activated.
|
|
10
|
+
*/
|
|
11
|
+
onDisabledChange?: (nextDisabled: boolean) => void;
|
|
12
|
+
/** Controlled collapse; use with `onCollapsedChange`. */
|
|
13
|
+
collapsed?: boolean;
|
|
14
|
+
/** Collapse state change (controlled or uncontrolled). */
|
|
15
|
+
onCollapsedChange?: (nextCollapsed: boolean) => void;
|
|
16
|
+
/** Initial collapsed state when uncontrolled. */
|
|
17
|
+
defaultCollapsed?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function Category({ title, children, disabled, onDisabledChange, collapsed: collapsedProp, onCollapsedChange, defaultCollapsed, className, }: CategoryProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=Category.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Category.d.ts","sourceRoot":"","sources":["../../src/components/Category.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEpE,OAAO,gBAAgB,CAAA;AAEvB,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,SAAS,CAAA;IAChB,QAAQ,EAAE,SAAS,CAAA;IACnB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAA;IAClD,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,KAAK,IAAI,CAAA;IACpD,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,gBAAgB,EAChB,SAAS,EAAE,aAAa,EACxB,iBAAiB,EACjB,gBAAwB,EACxB,SAAS,GACV,EAAE,aAAa,2CAmFf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../src/components/ColorPicker.tsx"],"names":[],"mappings":"AAwBA,OAAO,mBAAmB,CAAA;AAE1B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAChC,CAAA;AAoGD,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAwehE"}
|
|
@@ -2,6 +2,7 @@ export type ColorRowProps = {
|
|
|
2
2
|
label?: string;
|
|
3
3
|
value: string;
|
|
4
4
|
onChange: (hex: string) => void;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare function ColorRow({ label, value, onChange }: ColorRowProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function ColorRow({ label, value, onChange, disabled: disabledProp }: ColorRowProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
//# sourceMappingURL=ColorRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorRow.d.ts","sourceRoot":"","sources":["../../src/components/ColorRow.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ColorRow.d.ts","sourceRoot":"","sources":["../../src/components/ColorRow.tsx"],"names":[],"mappings":"AAMA,OAAO,gBAAgB,CAAA;AAevB,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAe,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,aAAa,2CA4DnG"}
|
|
@@ -15,5 +15,5 @@ export declare function stopsToGradient(stops: GradientStop[], angle?: number):
|
|
|
15
15
|
export declare function parseGradient(gradient: string): GradientStop[];
|
|
16
16
|
/** Default 6 colors for gradient picker (dark to light, top to bottom) */
|
|
17
17
|
export declare const DEFAULT_GRADIENT_STOPS: GradientStop[];
|
|
18
|
-
export declare function GradientPicker({ stops, onChange }: GradientPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function GradientPicker({ stops, onChange, angle }: GradientPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
19
|
//# sourceMappingURL=GradientPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GradientPicker.d.ts","sourceRoot":"","sources":["../../src/components/GradientPicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GradientPicker.d.ts","sourceRoot":"","sources":["../../src/components/GradientPicker.tsx"],"names":[],"mappings":"AAIA,OAAO,sBAAsB,CAAA;AAE7B,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,wEAAwE;IACxE,KAAK,EAAE,YAAY,EAAE,CAAA;IACrB,+BAA+B;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAA;IACzC,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAmDD,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,KAAK,SAAK,GAAG,MAAM,CAWzE;AAED,gDAAgD;AAChD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,EAAE,CAmB9D;AAED,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,EAAE,YAAY,EAOhD,CAAA;AA+ED,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAU,EAAE,EAAE,mBAAmB,2CAiHlF"}
|
|
@@ -7,6 +7,7 @@ export type GradientRowProps = {
|
|
|
7
7
|
onChange?: (gradient: string) => void;
|
|
8
8
|
/** Gradient angle in degrees, default 90 */
|
|
9
9
|
angle?: number;
|
|
10
|
+
disabled?: boolean;
|
|
10
11
|
};
|
|
11
|
-
export declare function GradientRow({ label, initialStops, onChange, angle }: GradientRowProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function GradientRow({ label, initialStops, onChange, angle, disabled: disabledProp, }: GradientRowProps): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
//# sourceMappingURL=GradientRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GradientRow.d.ts","sourceRoot":"","sources":["../../src/components/GradientRow.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA2D,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"GradientRow.d.ts","sourceRoot":"","sources":["../../src/components/GradientRow.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA2D,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE7G,OAAO,mBAAmB,CAAA;AAE1B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iEAAiE;IACjE,YAAY,CAAC,EAAE,YAAY,EAAE,CAAA;IAC7B,mCAAmC;IACnC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAkB,EAClB,YAAY,EACZ,QAAQ,EACR,KAAU,EACV,QAAQ,EAAE,YAAY,GACvB,EAAE,gBAAgB,2CA8ClB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type PanelProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Default shell for configurator blocks: black surface, 24px radius, 16px padding,
|
|
7
|
+
* column flex anchored to the start (top).
|
|
8
|
+
*/
|
|
9
|
+
export declare function Panel({ children, className, ...rest }: PanelProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=Panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../../src/components/Panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,aAAa,CAAA;AAEpB,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACxD,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,2CASjE"}
|
|
@@ -6,6 +6,8 @@ export type SliderRowProps = {
|
|
|
6
6
|
step: number;
|
|
7
7
|
onChange: (value: number) => void;
|
|
8
8
|
fmt?: (value: number) => string;
|
|
9
|
+
/** When true, or when inside a disabled `Category`, the row is non-interactive. */
|
|
10
|
+
disabled?: boolean;
|
|
9
11
|
};
|
|
10
|
-
export declare function SliderRow({ label, value, min, max, step, onChange, fmt, }: SliderRowProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function SliderRow({ label, value, min, max, step, onChange, fmt, disabled: disabledProp, }: SliderRowProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
//# sourceMappingURL=SliderRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderRow.d.ts","sourceRoot":"","sources":["../../src/components/SliderRow.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SliderRow.d.ts","sourceRoot":"","sources":["../../src/components/SliderRow.tsx"],"names":[],"mappings":"AAQA,OAAO,iBAAiB,CAAA;AAuDxB,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAC/B,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAgDD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,GAAG,EACH,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,GAAG,EACH,QAAQ,EAAE,YAAY,GACvB,EAAE,cAAc,2CA8bhB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Popover } from '@base-ui/react';
|
|
1
2
|
import { PopoverTrigger } from '@base-ui/react/popover';
|
|
2
3
|
import { ReactNode } from 'react';
|
|
3
4
|
export type SwatchPopoverRenderTrigger = PopoverTrigger.Props['render'];
|
|
@@ -5,12 +6,17 @@ type SwatchPopoverProps = {
|
|
|
5
6
|
title?: string;
|
|
6
7
|
renderTrigger: NonNullable<SwatchPopoverRenderTrigger>;
|
|
7
8
|
children: ReactNode;
|
|
9
|
+
modal?: boolean;
|
|
10
|
+
side?: Popover.Positioner.Props['side'];
|
|
11
|
+
align?: Popover.Positioner.Props['align'];
|
|
12
|
+
sideOffset?: Popover.Positioner.Props['sideOffset'];
|
|
13
|
+
zIndex?: number;
|
|
8
14
|
};
|
|
9
15
|
/**
|
|
10
16
|
* Base UI Popover anchored to a swatch: opens below, aligned to the inline end (bottom-trailing in LTR).
|
|
11
17
|
* `modal={true}` is required for the internal backdrop (blocks clicks/scroll on the rest of the page).
|
|
12
18
|
* `modal="trap-focus"` does not mount that layer, so controls underneath stayed clickable.
|
|
13
19
|
*/
|
|
14
|
-
export declare function SwatchPopover({ title, renderTrigger, children }: SwatchPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function SwatchPopover({ title, renderTrigger, children, modal, side, align, sideOffset, zIndex, }: SwatchPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
15
21
|
export {};
|
|
16
22
|
//# sourceMappingURL=SwatchPopover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwatchPopover.d.ts","sourceRoot":"","sources":["../../src/components/SwatchPopover.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SwatchPopover.d.ts","sourceRoot":"","sources":["../../src/components/SwatchPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,qBAAqB,CAAA;AAE5B,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;AAEvE,KAAK,kBAAkB,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,WAAW,CAAC,0BAA0B,CAAC,CAAA;IACtD,QAAQ,EAAE,SAAS,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,aAAa,EACb,QAAQ,EACR,KAAY,EACZ,IAAe,EACf,KAAa,EACb,UAAc,EACd,MAAM,GACP,EAAE,kBAAkB,2CA2BpB"}
|
|
@@ -2,6 +2,7 @@ export type ToggleRowProps = {
|
|
|
2
2
|
label: string;
|
|
3
3
|
checked: boolean;
|
|
4
4
|
onChange: (next: boolean) => void;
|
|
5
|
+
disabled?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare function ToggleRow({ label, checked, onChange }: ToggleRowProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function ToggleRow({ label, checked, onChange, disabled: disabledProp }: ToggleRowProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
//# sourceMappingURL=ToggleRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleRow.d.ts","sourceRoot":"","sources":["../../src/components/ToggleRow.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToggleRow.d.ts","sourceRoot":"","sources":["../../src/components/ToggleRow.tsx"],"names":[],"mappings":"AAEA,OAAO,iBAAiB,CAAA;AAExB,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,cAAc,2CAwC7F"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ValueInputProps = {
|
|
3
|
+
/** The display value (shown when not editing) */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Optional prefix that appears before the value (e.g., "#" for hex) */
|
|
6
|
+
prefix?: ReactNode;
|
|
7
|
+
/** Optional suffix that appears after the value (e.g., "%" for percentages) */
|
|
8
|
+
suffix?: ReactNode;
|
|
9
|
+
/** Called when editing is committed */
|
|
10
|
+
onCommit: (value: string) => void;
|
|
11
|
+
/** Optional validation/sanitization function for input changes */
|
|
12
|
+
sanitize?: (input: string) => string;
|
|
13
|
+
/** Optional validation function that determines if value can be committed */
|
|
14
|
+
validate?: (value: string) => boolean;
|
|
15
|
+
/** Maximum length for the input */
|
|
16
|
+
maxLength?: number;
|
|
17
|
+
/** Input mode for mobile keyboards */
|
|
18
|
+
inputMode?: 'text' | 'numeric' | 'decimal';
|
|
19
|
+
/** Text alignment */
|
|
20
|
+
align?: 'left' | 'right';
|
|
21
|
+
/** Aria label for the input */
|
|
22
|
+
ariaLabel?: string;
|
|
23
|
+
/** Whether the parent is in an "active" state (hovered/dragging) */
|
|
24
|
+
isActive?: boolean;
|
|
25
|
+
/** Optional class name for the container */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Whether to auto-size the input width to content */
|
|
28
|
+
autoWidth?: boolean;
|
|
29
|
+
/** Ref to the value text element for external measurements */
|
|
30
|
+
valueTextRef?: React.RefObject<HTMLSpanElement | null>;
|
|
31
|
+
/** Handle paste events (return the processed value or null to use default) */
|
|
32
|
+
onPaste?: (pasted: string) => string | null;
|
|
33
|
+
/** Custom renderer for the display value (useful for animations like TextMorph) */
|
|
34
|
+
renderValue?: (value: string) => ReactNode;
|
|
35
|
+
/** Ref to the input element when editing */
|
|
36
|
+
inputRef?: React.RefObject<HTMLInputElement | null>;
|
|
37
|
+
/** Callback when editing state changes */
|
|
38
|
+
onEditingChange?: (editing: boolean) => void;
|
|
39
|
+
/** Non-interactive display-only value */
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
/** External control of editing state */
|
|
42
|
+
editing?: boolean;
|
|
43
|
+
/** External control of draft value */
|
|
44
|
+
draft?: string;
|
|
45
|
+
/** External control of draft value changes */
|
|
46
|
+
onDraftChange?: (draft: string) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Optional ArrowUp/ArrowDown nudge step while editing (Figma-like).
|
|
49
|
+
* If omitted, arrow keys behave normally.
|
|
50
|
+
*/
|
|
51
|
+
arrowStep?: number;
|
|
52
|
+
/** Optional clamp bounds for arrow nudging only. */
|
|
53
|
+
arrowMin?: number;
|
|
54
|
+
/** Optional clamp bounds for arrow nudging only. */
|
|
55
|
+
arrowMax?: number;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Unified value input component with consistent hover/edit states.
|
|
59
|
+
*
|
|
60
|
+
* Behavior:
|
|
61
|
+
* - Default: muted text, transparent underline
|
|
62
|
+
* - Hover: full opacity text, underline visible
|
|
63
|
+
* - Editing: no underline, white bg/black text selection
|
|
64
|
+
*/
|
|
65
|
+
export declare function ValueInput({ value, prefix, suffix, onCommit, sanitize, validate, maxLength, inputMode, align, ariaLabel, isActive, className, autoWidth, valueTextRef, onPaste, renderValue, inputRef: externalInputRef, onEditingChange, editing: externalEditing, draft: externalDraft, onDraftChange, arrowStep, arrowMin, arrowMax, disabled, }: ValueInputProps): import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
//# sourceMappingURL=ValueInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValueInput.d.ts","sourceRoot":"","sources":["../../src/components/ValueInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AACd,OAAO,kBAAkB,CAAA;AAEzB,MAAM,MAAM,eAAe,GAAG;IAC5B,iDAAiD;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IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAmB,EACnB,QAAqB,EACrB,SAAS,EACT,SAAkB,EAClB,KAAc,EACd,SAAS,EACT,QAAgB,EAChB,SAAS,EACT,SAAiB,EACjB,YAAY,EACZ,OAAO,EACP,WAAW,EACX,QAAQ,EAAE,gBAAgB,EAC1B,eAAe,EACf,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,aAAa,EACpB,aAAa,EACb,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAgB,GACjB,EAAE,eAAe,2CAkMjB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare function CategoryDisabledProvider({ value, children, }: {
|
|
3
|
+
value: boolean;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
/** `true` when wrapped in `Category` with `disabled`. */
|
|
7
|
+
export declare function useCategoryDisabled(): boolean;
|
|
8
|
+
//# sourceMappingURL=categoryDisabledContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categoryDisabledContext.d.ts","sourceRoot":"","sources":["../../src/components/categoryDisabledContext.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjE,wBAAgB,wBAAwB,CAAC,EACvC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,SAAS,CAAA;CACpB,2CAMA;AAED,yDAAyD;AACzD,wBAAgB,mBAAmB,YAElC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
export { Panel, Panel as default } from './components/Panel';
|
|
2
|
+
export type { PanelProps } from './components/Panel';
|
|
3
|
+
export { Category } from './components/Category';
|
|
4
|
+
export type { CategoryProps } from './components/Category';
|
|
5
|
+
export { useCategoryDisabled } from './components/categoryDisabledContext';
|
|
1
6
|
export { SliderRow } from './components/SliderRow';
|
|
2
7
|
export type { SliderRowProps } from './components/SliderRow';
|
|
3
8
|
export { ColorRow } from './components/ColorRow';
|
|
4
9
|
export type { ColorRowProps } from './components/ColorRow';
|
|
10
|
+
export { ColorPicker } from './components/ColorPicker';
|
|
11
|
+
export type { ColorPickerProps } from './components/ColorPicker';
|
|
5
12
|
export { ToggleRow } from './components/ToggleRow';
|
|
6
13
|
export type { ToggleRowProps } from './components/ToggleRow';
|
|
7
14
|
export { GradientRow } from './components/GradientRow';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D,OAAO,EAAE,WAAW,EA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