@spatika/react 1.1.0 → 1.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/AGENTS.md +71 -0
- package/README.md +4 -3
- package/dist/composites/Card.d.ts +7 -1
- package/dist/composites/Card.d.ts.map +1 -1
- package/dist/composites/Card.js +10 -0
- package/dist/composites/ChartDataGrid.d.ts +33 -0
- package/dist/composites/ChartDataGrid.d.ts.map +1 -0
- package/dist/composites/ChartDataGrid.js +77 -0
- package/dist/composites/CoverHero.d.ts +1 -1
- package/dist/composites/CoverHero.d.ts.map +1 -1
- package/dist/composites/CoverHero.js +2 -2
- package/dist/composites/EntityMediaCard.d.ts +1 -1
- package/dist/composites/EntityMediaCard.d.ts.map +1 -1
- package/dist/composites/EntityMediaCard.js +12 -4
- package/dist/composites/EventCalendar.d.ts +35 -0
- package/dist/composites/EventCalendar.d.ts.map +1 -0
- package/dist/composites/EventCalendar.js +339 -0
- package/dist/composites/EventEditor.d.ts +22 -0
- package/dist/composites/EventEditor.d.ts.map +1 -0
- package/dist/composites/EventEditor.js +86 -0
- package/dist/composites/EventTimeline.d.ts +24 -0
- package/dist/composites/EventTimeline.d.ts.map +1 -0
- package/dist/composites/EventTimeline.js +184 -0
- package/dist/composites/MapChart.d.ts +24 -0
- package/dist/composites/MapChart.d.ts.map +1 -0
- package/dist/composites/MapChart.js +58 -0
- package/dist/composites/ProfileHero.d.ts +6 -4
- package/dist/composites/ProfileHero.d.ts.map +1 -1
- package/dist/composites/ProfileHero.js +8 -8
- package/dist/composites/ScatterWebGL.d.ts +22 -0
- package/dist/composites/ScatterWebGL.d.ts.map +1 -0
- package/dist/composites/ScatterWebGL.js +45 -0
- package/dist/composites/SiteFooter.d.ts +1 -1
- package/dist/composites/SiteFooter.js +1 -1
- package/dist/composites/SiteNav.d.ts +7 -2
- package/dist/composites/SiteNav.d.ts.map +1 -1
- package/dist/composites/SiteNav.js +9 -5
- package/dist/composites/StatCard.d.ts +2 -1
- package/dist/composites/StatCard.d.ts.map +1 -1
- package/dist/composites/StatCard.js +3 -3
- package/dist/composites/StatusDot.d.ts +1 -1
- package/dist/composites/Wordmark.d.ts +2 -2
- package/dist/composites/Wordmark.d.ts.map +1 -1
- package/dist/composites/cartesian-charts.d.ts +138 -0
- package/dist/composites/cartesian-charts.d.ts.map +1 -0
- package/dist/composites/cartesian-charts.js +401 -0
- package/dist/composites/chart-composition.d.ts +139 -0
- package/dist/composites/chart-composition.d.ts.map +1 -0
- package/dist/composites/chart-composition.js +486 -0
- package/dist/composites/chart-ui.d.ts +83 -0
- package/dist/composites/chart-ui.d.ts.map +1 -0
- package/dist/composites/chart-ui.js +108 -0
- package/dist/composites/charts-3d.d.ts +37 -0
- package/dist/composites/charts-3d.d.ts.map +1 -0
- package/dist/composites/charts-3d.js +121 -0
- package/dist/composites/flow-charts.d.ts +89 -0
- package/dist/composites/flow-charts.d.ts.map +1 -0
- package/dist/composites/flow-charts.js +186 -0
- package/dist/composites/radial-charts.d.ts +109 -0
- package/dist/composites/radial-charts.d.ts.map +1 -0
- package/dist/composites/radial-charts.js +176 -0
- package/dist/composites/scheduler-ui.d.ts +43 -0
- package/dist/composites/scheduler-ui.d.ts.map +1 -0
- package/dist/composites/scheduler-ui.js +71 -0
- package/dist/index.d.ts +67 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -7
- package/dist/lib/chart-export.d.ts +10 -0
- package/dist/lib/chart-export.d.ts.map +1 -0
- package/dist/lib/chart-export.js +102 -0
- package/dist/lib/charts.d.ts +235 -0
- package/dist/lib/charts.d.ts.map +1 -0
- package/dist/lib/charts.js +744 -0
- package/dist/lib/geo.d.ts +39 -0
- package/dist/lib/geo.d.ts.map +1 -0
- package/dist/lib/geo.js +101 -0
- package/dist/lib/iso.d.ts +21 -0
- package/dist/lib/iso.d.ts.map +1 -0
- package/dist/lib/iso.js +56 -0
- package/dist/lib/rrule.d.ts +20 -0
- package/dist/lib/rrule.d.ts.map +1 -0
- package/dist/lib/rrule.js +236 -0
- package/dist/lib/scheduler.d.ts +152 -0
- package/dist/lib/scheduler.d.ts.map +1 -0
- package/dist/lib/scheduler.js +501 -0
- package/dist/lib/webgl-scatter.d.ts +44 -0
- package/dist/lib/webgl-scatter.d.ts.map +1 -0
- package/dist/lib/webgl-scatter.js +185 -0
- package/dist/primitives/Accordion.d.ts +44 -20
- package/dist/primitives/Accordion.d.ts.map +1 -1
- package/dist/primitives/Accordion.js +82 -22
- package/dist/primitives/AppBar.d.ts +13 -0
- package/dist/primitives/AppBar.d.ts.map +1 -0
- package/dist/primitives/AppBar.js +27 -0
- package/dist/primitives/Autocomplete.d.ts +28 -0
- package/dist/primitives/Autocomplete.d.ts.map +1 -0
- package/dist/primitives/Autocomplete.js +118 -0
- package/dist/primitives/Avatar.d.ts +13 -1
- package/dist/primitives/Avatar.d.ts.map +1 -1
- package/dist/primitives/Avatar.js +17 -2
- package/dist/primitives/Backdrop.d.ts +17 -0
- package/dist/primitives/Backdrop.d.ts.map +1 -0
- package/dist/primitives/Backdrop.js +17 -0
- package/dist/primitives/BottomNavigation.d.ts +23 -0
- package/dist/primitives/BottomNavigation.d.ts.map +1 -0
- package/dist/primitives/BottomNavigation.js +30 -0
- package/dist/primitives/ButtonBase.d.ts +14 -0
- package/dist/primitives/ButtonBase.d.ts.map +1 -0
- package/dist/primitives/ButtonBase.js +13 -0
- package/dist/primitives/ButtonGroup.d.ts +25 -0
- package/dist/primitives/ButtonGroup.d.ts.map +1 -0
- package/dist/primitives/ButtonGroup.js +44 -0
- package/dist/primitives/CircularProgress.d.ts +16 -0
- package/dist/primitives/CircularProgress.d.ts.map +1 -0
- package/dist/primitives/CircularProgress.js +17 -0
- package/dist/primitives/ClickAwayListener.d.ts +16 -0
- package/dist/primitives/ClickAwayListener.d.ts.map +1 -0
- package/dist/primitives/ClickAwayListener.js +33 -0
- package/dist/primitives/Collapse.d.ts +19 -0
- package/dist/primitives/Collapse.d.ts.map +1 -0
- package/dist/primitives/Collapse.js +14 -0
- package/dist/primitives/Container.d.ts +13 -0
- package/dist/primitives/Container.d.ts.map +1 -0
- package/dist/primitives/Container.js +26 -0
- package/dist/primitives/Fab.d.ts +22 -0
- package/dist/primitives/Fab.d.ts.map +1 -0
- package/dist/primitives/Fab.js +42 -0
- package/dist/primitives/FormControl.d.ts +27 -0
- package/dist/primitives/FormControl.d.ts.map +1 -0
- package/dist/primitives/FormControl.js +24 -0
- package/dist/primitives/FormControlLabel.d.ts +18 -0
- package/dist/primitives/FormControlLabel.d.ts.map +1 -0
- package/dist/primitives/FormControlLabel.js +19 -0
- package/dist/primitives/Grid.d.ts +32 -0
- package/dist/primitives/Grid.d.ts.map +1 -0
- package/dist/primitives/Grid.js +50 -0
- package/dist/primitives/IconButton.d.ts +22 -0
- package/dist/primitives/IconButton.d.ts.map +1 -0
- package/dist/primitives/IconButton.js +39 -0
- package/dist/primitives/ImageList.d.ts +31 -0
- package/dist/primitives/ImageList.d.ts.map +1 -0
- package/dist/primitives/ImageList.js +33 -0
- package/dist/primitives/InputAdornment.d.ts +28 -0
- package/dist/primitives/InputAdornment.d.ts.map +1 -0
- package/dist/primitives/InputAdornment.js +13 -0
- package/dist/primitives/Link.d.ts +17 -0
- package/dist/primitives/Link.d.ts.map +1 -0
- package/dist/primitives/Link.js +29 -0
- package/dist/primitives/List.d.ts +41 -0
- package/dist/primitives/List.d.ts.map +1 -0
- package/dist/primitives/List.js +22 -0
- package/dist/primitives/Masonry.d.ts +14 -0
- package/dist/primitives/Masonry.d.ts.map +1 -0
- package/dist/primitives/Masonry.js +15 -0
- package/dist/primitives/Menu.d.ts +28 -0
- package/dist/primitives/Menu.d.ts.map +1 -0
- package/dist/primitives/Menu.js +54 -0
- package/dist/primitives/MobileStepper.d.ts +15 -0
- package/dist/primitives/MobileStepper.d.ts.map +1 -0
- package/dist/primitives/MobileStepper.js +8 -0
- package/dist/primitives/Modal.d.ts +18 -0
- package/dist/primitives/Modal.d.ts.map +1 -0
- package/dist/primitives/Modal.js +29 -0
- package/dist/primitives/NoSsr.d.ts +15 -0
- package/dist/primitives/NoSsr.d.ts.map +1 -0
- package/dist/primitives/NoSsr.js +19 -0
- package/dist/primitives/Paper.d.ts +22 -0
- package/dist/primitives/Paper.d.ts.map +1 -0
- package/dist/primitives/Paper.js +33 -0
- package/dist/primitives/Progress.d.ts +6 -2
- package/dist/primitives/Progress.d.ts.map +1 -1
- package/dist/primitives/Progress.js +8 -3
- package/dist/primitives/Snackbar.d.ts +23 -0
- package/dist/primitives/Snackbar.d.ts.map +1 -0
- package/dist/primitives/Snackbar.js +33 -0
- package/dist/primitives/SpeedDial.d.ts +26 -0
- package/dist/primitives/SpeedDial.d.ts.map +1 -0
- package/dist/primitives/SpeedDial.js +26 -0
- package/dist/primitives/Stack.d.ts +15 -0
- package/dist/primitives/Stack.d.ts.map +1 -0
- package/dist/primitives/Stack.js +45 -0
- package/dist/primitives/StarRating.d.ts +19 -1
- package/dist/primitives/StarRating.d.ts.map +1 -1
- package/dist/primitives/StarRating.js +36 -6
- package/dist/primitives/Stepper.d.ts +36 -0
- package/dist/primitives/Stepper.d.ts.map +1 -0
- package/dist/primitives/Stepper.js +53 -0
- package/dist/primitives/TablePagination.d.ts +16 -0
- package/dist/primitives/TablePagination.d.ts.map +1 -0
- package/dist/primitives/TablePagination.js +12 -0
- package/dist/primitives/TextField.d.ts +24 -0
- package/dist/primitives/TextField.d.ts.map +1 -0
- package/dist/primitives/TextField.js +19 -0
- package/dist/primitives/TextareaAutosize.d.ts +11 -0
- package/dist/primitives/TextareaAutosize.d.ts.map +1 -0
- package/dist/primitives/TextareaAutosize.js +26 -0
- package/dist/primitives/ToggleButton.d.ts +28 -0
- package/dist/primitives/ToggleButton.d.ts.map +1 -0
- package/dist/primitives/ToggleButton.js +56 -0
- package/dist/primitives/TransferList.d.ts +21 -0
- package/dist/primitives/TransferList.d.ts.map +1 -0
- package/dist/primitives/TransferList.js +40 -0
- package/dist/primitives/Typography.d.ts +23 -0
- package/dist/primitives/Typography.d.ts.map +1 -0
- package/dist/primitives/Typography.js +69 -0
- package/dist/primitives/transitions.d.ts +29 -0
- package/dist/primitives/transitions.d.ts.map +1 -0
- package/dist/primitives/transitions.js +52 -0
- package/package.json +28 -4
- package/skills/spatika-ui/SKILL.md +96 -0
- package/src/composites/Card.tsx +51 -1
- package/src/composites/ChartDataGrid.test.tsx +57 -0
- package/src/composites/ChartDataGrid.tsx +196 -0
- package/src/composites/CoverHero.test.tsx +38 -0
- package/src/composites/CoverHero.tsx +29 -22
- package/src/composites/EntityMediaCard.test.tsx +58 -0
- package/src/composites/EntityMediaCard.tsx +31 -13
- package/src/composites/EventCalendar.tsx +928 -0
- package/src/composites/EventEditor.tsx +268 -0
- package/src/composites/EventTimeline.tsx +357 -0
- package/src/composites/MapChart.test.tsx +39 -0
- package/src/composites/MapChart.tsx +130 -0
- package/src/composites/ProfileHero.test.tsx +33 -0
- package/src/composites/ProfileHero.tsx +96 -79
- package/src/composites/ScatterWebGL.test.tsx +25 -0
- package/src/composites/ScatterWebGL.tsx +79 -0
- package/src/composites/SiteFooter.test.tsx +37 -0
- package/src/composites/SiteFooter.tsx +1 -1
- package/src/composites/SiteNav.test.tsx +46 -0
- package/src/composites/SiteNav.tsx +14 -4
- package/src/composites/StatCard.test.tsx +30 -0
- package/src/composites/StatCard.tsx +4 -0
- package/src/composites/Wordmark.test.tsx +23 -0
- package/src/composites/Wordmark.tsx +2 -2
- package/src/composites/cartesian-charts.test.tsx +52 -0
- package/src/composites/cartesian-charts.tsx +1287 -0
- package/src/composites/chart-composition.test.tsx +53 -0
- package/src/composites/chart-composition.tsx +898 -0
- package/src/composites/chart-ui.tsx +328 -0
- package/src/composites/charts-3d.test.tsx +25 -0
- package/src/composites/charts-3d.tsx +318 -0
- package/src/composites/charts.test.tsx +254 -0
- package/src/composites/chrome.test.tsx +29 -0
- package/src/composites/flow-charts.test.tsx +79 -0
- package/src/composites/flow-charts.tsx +607 -0
- package/src/composites/marketing.test.tsx +38 -34
- package/src/composites/radial-charts.test.tsx +74 -0
- package/src/composites/radial-charts.tsx +617 -0
- package/src/composites/scheduler-ui.tsx +304 -0
- package/src/composites/scheduler.test.tsx +194 -0
- package/src/index.test.ts +22 -0
- package/src/index.ts +277 -5
- package/src/lib/chart-export.test.ts +20 -0
- package/src/lib/chart-export.ts +99 -0
- package/src/lib/charts-platform.test.ts +93 -0
- package/src/lib/charts.test.ts +132 -0
- package/src/lib/charts.ts +1021 -0
- package/src/lib/geo.test.ts +42 -0
- package/src/lib/geo.ts +138 -0
- package/src/lib/iso.test.ts +22 -0
- package/src/lib/iso.ts +102 -0
- package/src/lib/rrule.test.ts +53 -0
- package/src/lib/rrule.ts +281 -0
- package/src/lib/scheduler.test.ts +186 -0
- package/src/lib/scheduler.ts +688 -0
- package/src/lib/tokens.test.ts +2 -2
- package/src/lib/webgl-scatter.test.ts +36 -0
- package/src/lib/webgl-scatter.ts +230 -0
- package/src/primitives/Accordion.tsx +218 -63
- package/src/primitives/AppBar.tsx +39 -0
- package/src/primitives/Autocomplete.tsx +236 -0
- package/src/primitives/Avatar.tsx +52 -1
- package/src/primitives/Backdrop.tsx +48 -0
- package/src/primitives/BottomNavigation.tsx +102 -0
- package/src/primitives/ButtonBase.tsx +34 -0
- package/src/primitives/ButtonGroup.tsx +90 -0
- package/src/primitives/CircularProgress.tsx +104 -0
- package/src/primitives/ClickAwayListener.tsx +46 -0
- package/src/primitives/Collapse.tsx +39 -0
- package/src/primitives/Container.tsx +40 -0
- package/src/primitives/Fab.tsx +62 -0
- package/src/primitives/FormControl.tsx +90 -0
- package/src/primitives/FormControlLabel.tsx +51 -0
- package/src/primitives/Grid.tsx +101 -0
- package/src/primitives/IconButton.tsx +59 -0
- package/src/primitives/ImageList.test.tsx +48 -0
- package/src/primitives/ImageList.tsx +112 -0
- package/src/primitives/InputAdornment.tsx +86 -0
- package/src/primitives/Link.tsx +48 -0
- package/src/primitives/List.tsx +121 -0
- package/src/primitives/Masonry.tsx +32 -0
- package/src/primitives/Menu.tsx +112 -0
- package/src/primitives/MobileStepper.tsx +64 -0
- package/src/primitives/Modal.tsx +70 -0
- package/src/primitives/NoSsr.tsx +28 -0
- package/src/primitives/Paper.tsx +55 -0
- package/src/primitives/Progress.tsx +25 -7
- package/src/primitives/Snackbar.tsx +83 -0
- package/src/primitives/SpeedDial.tsx +110 -0
- package/src/primitives/Stack.tsx +88 -0
- package/src/primitives/StarRating.tsx +87 -28
- package/src/primitives/Stepper.tsx +184 -0
- package/src/primitives/TablePagination.tsx +58 -0
- package/src/primitives/TextField.tsx +105 -0
- package/src/primitives/TextareaAutosize.tsx +49 -0
- package/src/primitives/ToggleButton.tsx +148 -0
- package/src/primitives/TransferList.tsx +110 -0
- package/src/primitives/Typography.tsx +90 -0
- package/src/primitives/mui-more.test.tsx +76 -0
- package/src/primitives/mui.test.tsx +134 -0
- package/src/primitives/transitions.tsx +120 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const paperVariants: (props?: ({
|
|
4
|
+
variant?: "glass" | "elevation" | "outlined" | null | undefined;
|
|
5
|
+
square?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export type PaperProps = React.ComponentPropsWithoutRef<"div"> & VariantProps<typeof paperVariants> & {
|
|
8
|
+
/** 0–3. Ignored when variant is outlined. */
|
|
9
|
+
elevation?: 0 | 1 | 2 | 3;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Surface primitive. Prefer Card / GlassCard for structured content.
|
|
13
|
+
*/
|
|
14
|
+
declare const Paper: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
15
|
+
variant?: "glass" | "elevation" | "outlined" | null | undefined;
|
|
16
|
+
square?: boolean | null | undefined;
|
|
17
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
18
|
+
/** 0–3. Ignored when variant is outlined. */
|
|
19
|
+
elevation?: 0 | 1 | 2 | 3;
|
|
20
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export { Paper, paperVariants };
|
|
22
|
+
//# sourceMappingURL=Paper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Paper.d.ts","sourceRoot":"","sources":["../../src/primitives/Paper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,QAAA,MAAM,aAAa;;;8EAgBjB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAC5D,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IACnC,6CAA6C;IAC7C,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CAC3B,CAAC;AASJ;;GAEG;AACH,QAAA,MAAM,KAAK;;;;IAdP,6CAA6C;gBACjC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC;wCA0B5B,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../lib/cn";
|
|
5
|
+
const paperVariants = cva("text-card-foreground", {
|
|
6
|
+
variants: {
|
|
7
|
+
variant: {
|
|
8
|
+
elevation: "bg-card/70 shadow-sm",
|
|
9
|
+
outlined: "border border-border/50 bg-card/40",
|
|
10
|
+
glass: "glass",
|
|
11
|
+
},
|
|
12
|
+
square: {
|
|
13
|
+
true: "rounded-none",
|
|
14
|
+
false: "rounded-[var(--radius-card)]",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: "elevation",
|
|
19
|
+
square: false,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const elevationClass = {
|
|
23
|
+
0: "shadow-none",
|
|
24
|
+
1: "shadow-sm",
|
|
25
|
+
2: "shadow-md",
|
|
26
|
+
3: "shadow-lg",
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Surface primitive. Prefer Card / GlassCard for structured content.
|
|
30
|
+
*/
|
|
31
|
+
const Paper = React.forwardRef(({ className, variant, square, elevation = 1, ...props }, ref) => (_jsx("div", { ref: ref, "data-slot": "paper", className: cn(paperVariants({ variant, square }), variant !== "outlined" && elevationClass[elevation], className), ...props })));
|
|
32
|
+
Paper.displayName = "Paper";
|
|
33
|
+
export { Paper, paperVariants };
|
|
@@ -2,7 +2,11 @@ import * as React from "react";
|
|
|
2
2
|
type ProgressProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
3
3
|
value?: number | null;
|
|
4
4
|
max?: number;
|
|
5
|
+
variant?: "determinate" | "indeterminate";
|
|
5
6
|
};
|
|
6
|
-
declare function Progress({ className, value, max, ...props }: ProgressProps): React.JSX.Element;
|
|
7
|
-
|
|
7
|
+
declare function Progress({ className, value, max, variant, ...props }: ProgressProps): React.JSX.Element;
|
|
8
|
+
/** MUI-compatible alias. */
|
|
9
|
+
declare const LinearProgress: typeof Progress;
|
|
10
|
+
export { Progress, LinearProgress };
|
|
11
|
+
export type { ProgressProps };
|
|
8
12
|
//# sourceMappingURL=Progress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../../src/primitives/Progress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,aAAa,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IAC3D,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../../src/primitives/Progress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,aAAa,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IAC3D,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,aAAa,GAAG,eAAe,CAAC;CAC3C,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,KAAK,EACL,GAAS,EACT,OAAuB,EACvB,GAAG,KAAK,EACT,EAAE,aAAa,qBA2Bf;AAED,4BAA4B;AAC5B,QAAA,MAAM,cAAc,iBAAW,CAAC;AAEhC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../lib/cn";
|
|
3
|
-
function Progress({ className, value, max = 100, ...props }) {
|
|
3
|
+
function Progress({ className, value, max = 100, variant = "determinate", ...props }) {
|
|
4
4
|
const pct = Math.min(100, Math.max(0, ((value || 0) / max) * 100));
|
|
5
|
-
|
|
5
|
+
const indeterminate = variant === "indeterminate";
|
|
6
|
+
return (_jsx("div", { "data-slot": "progress", role: "progressbar", "aria-valuemin": indeterminate ? undefined : 0, "aria-valuemax": indeterminate ? undefined : max, "aria-valuenow": indeterminate ? undefined : (value ?? undefined), "aria-label": indeterminate ? "Loading" : undefined, className: cn("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full", className), ...props, children: _jsx("div", { "data-slot": "progress-indicator", className: cn("bg-primary h-full", indeterminate
|
|
7
|
+
? "absolute inset-y-0 left-0 w-1/3 animate-progress-indeterminate"
|
|
8
|
+
: "w-full flex-1 transition-transform duration-300"), style: indeterminate ? undefined : { transform: `translateX(-${100 - pct}%)` } }) }));
|
|
6
9
|
}
|
|
7
|
-
|
|
10
|
+
/** MUI-compatible alias. */
|
|
11
|
+
const LinearProgress = Progress;
|
|
12
|
+
export { Progress, LinearProgress };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type SnackbarOrigin = {
|
|
3
|
+
vertical?: "top" | "bottom";
|
|
4
|
+
horizontal?: "left" | "center" | "right";
|
|
5
|
+
};
|
|
6
|
+
export type SnackbarProps = Omit<React.ComponentPropsWithoutRef<"div">, "content"> & {
|
|
7
|
+
open?: boolean;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
autoHideDuration?: number | null;
|
|
10
|
+
message?: React.ReactNode;
|
|
11
|
+
action?: React.ReactNode;
|
|
12
|
+
anchorOrigin?: SnackbarOrigin;
|
|
13
|
+
};
|
|
14
|
+
declare function Snackbar({ open, onClose, autoHideDuration, message, action, anchorOrigin, className, children, ...props }: SnackbarProps): React.JSX.Element | null;
|
|
15
|
+
declare namespace Snackbar {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|
|
18
|
+
declare function SnackbarContent({ className, ...props }: React.ComponentPropsWithoutRef<"div">): React.JSX.Element;
|
|
19
|
+
declare namespace SnackbarContent {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
22
|
+
export { Snackbar, SnackbarContent };
|
|
23
|
+
//# sourceMappingURL=Snackbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../src/primitives/Snackbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,GAAG;IACnF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,YAAY,CAAC,EAAE,cAAc,CAAC;CAC/B,CAAC;AAWF,iBAAS,QAAQ,CAAC,EAChB,IAAY,EACZ,OAAO,EACP,gBAAuB,EACvB,OAAO,EACP,MAAM,EACN,YAAyD,EACzD,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,4BAkCf;kBA5CQ,QAAQ;;;AA+CjB,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,qBAEtF;kBAFQ,eAAe;;;AAKxB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { X } from "lucide-react";
|
|
4
|
+
import { Portal } from "../lib/portal";
|
|
5
|
+
import { cn } from "../lib/cn";
|
|
6
|
+
import { OVERLAY_Z_INDEX, fixedLayerStyle } from "../lib/overlay-stack";
|
|
7
|
+
import { IconButton } from "./IconButton";
|
|
8
|
+
const originClass = {
|
|
9
|
+
"top-left": "top-4 left-4",
|
|
10
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2",
|
|
11
|
+
"top-right": "top-4 right-4",
|
|
12
|
+
"bottom-left": "bottom-4 left-4",
|
|
13
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2",
|
|
14
|
+
"bottom-right": "bottom-4 right-4",
|
|
15
|
+
};
|
|
16
|
+
function Snackbar({ open = false, onClose, autoHideDuration = 4000, message, action, anchorOrigin = { vertical: "bottom", horizontal: "left" }, className, children, ...props }) {
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
if (!open || !autoHideDuration || !onClose)
|
|
19
|
+
return;
|
|
20
|
+
const id = window.setTimeout(onClose, autoHideDuration);
|
|
21
|
+
return () => window.clearTimeout(id);
|
|
22
|
+
}, [open, autoHideDuration, onClose]);
|
|
23
|
+
if (!open)
|
|
24
|
+
return null;
|
|
25
|
+
const key = `${anchorOrigin.vertical ?? "bottom"}-${anchorOrigin.horizontal ?? "left"}`;
|
|
26
|
+
return (_jsx(Portal, { children: _jsxs("div", { role: "status", "data-slot": "snackbar", className: cn("glass-menu fixed z-[11000] flex max-w-sm items-center gap-3 rounded-xl border border-border/50 px-4 py-3 text-sm font-medium shadow-xl", originClass[key], className), style: fixedLayerStyle(OVERLAY_Z_INDEX.modal), ...props, children: [_jsx("div", { className: "min-w-0 flex-1", children: message ?? children }), action, onClose ? (_jsx(IconButton, { "aria-label": "Close", size: "sm", onClick: onClose, children: _jsx(X, { className: "size-3.5" }) })) : null] }) }));
|
|
27
|
+
}
|
|
28
|
+
Snackbar.displayName = "Snackbar";
|
|
29
|
+
function SnackbarContent({ className, ...props }) {
|
|
30
|
+
return _jsx("div", { "data-slot": "snackbar-content", className: cn("text-sm font-medium", className), ...props });
|
|
31
|
+
}
|
|
32
|
+
SnackbarContent.displayName = "SnackbarContent";
|
|
33
|
+
export { Snackbar, SnackbarContent };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type SpeedDialProps = Omit<React.ComponentPropsWithoutRef<"div">, "onChange"> & {
|
|
3
|
+
ariaLabel: string;
|
|
4
|
+
icon?: React.ReactNode;
|
|
5
|
+
openIcon?: React.ReactNode;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
direction?: "up" | "down" | "left" | "right";
|
|
10
|
+
/** Hide the dimmer behind actions. */
|
|
11
|
+
hideBackdrop?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function SpeedDial({ ariaLabel, icon, openIcon, open: openProp, defaultOpen, onOpenChange, direction, hideBackdrop, className, children, ...props }: SpeedDialProps): React.JSX.Element;
|
|
14
|
+
declare namespace SpeedDial {
|
|
15
|
+
var displayName: string;
|
|
16
|
+
}
|
|
17
|
+
export type SpeedDialActionProps = React.ComponentPropsWithoutRef<"button"> & {
|
|
18
|
+
icon: React.ReactNode;
|
|
19
|
+
tooltipTitle?: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
declare function SpeedDialAction({ icon, tooltipTitle, className, ...props }: SpeedDialActionProps): React.JSX.Element;
|
|
22
|
+
declare namespace SpeedDialAction {
|
|
23
|
+
var displayName: string;
|
|
24
|
+
}
|
|
25
|
+
export { SpeedDial, SpeedDialAction };
|
|
26
|
+
//# sourceMappingURL=SpeedDial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpeedDial.d.ts","sourceRoot":"","sources":["../../src/primitives/SpeedDial.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACrF,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC7C,sCAAsC;IACtC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AASF,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,IAAI,EAAE,QAAQ,EACd,WAAmB,EACnB,YAAY,EACZ,SAAgB,EAChB,YAAoB,EACpB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,qBAsChB;kBAlDQ,SAAS;;;AAqDlB,MAAM,MAAM,oBAAoB,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAAG;IAC5E,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,oBAAoB,qBAiBtB;kBAtBQ,eAAe;;;AAyBxB,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Plus, X } from "lucide-react";
|
|
3
|
+
import { useControllableState } from "../lib/use-controllable-state";
|
|
4
|
+
import { cn } from "../lib/cn";
|
|
5
|
+
import { Backdrop } from "./Backdrop";
|
|
6
|
+
import { Fab } from "./Fab";
|
|
7
|
+
const directionClass = {
|
|
8
|
+
up: "bottom-full mb-3 flex-col-reverse",
|
|
9
|
+
down: "top-full mt-3 flex-col",
|
|
10
|
+
left: "right-full mr-3 flex-row-reverse",
|
|
11
|
+
right: "left-full ml-3 flex-row",
|
|
12
|
+
};
|
|
13
|
+
function SpeedDial({ ariaLabel, icon, openIcon, open: openProp, defaultOpen = false, onOpenChange, direction = "up", hideBackdrop = false, className, children, ...props }) {
|
|
14
|
+
const [open = false, setOpen] = useControllableState({
|
|
15
|
+
prop: openProp,
|
|
16
|
+
defaultProp: defaultOpen,
|
|
17
|
+
onChange: onOpenChange,
|
|
18
|
+
});
|
|
19
|
+
return (_jsxs("div", { "data-slot": "speed-dial", "data-open": open ? "" : undefined, className: cn("relative inline-flex", className), ...props, children: [!hideBackdrop ? (_jsx(Backdrop, { open: open, invisible: true, onClick: () => setOpen(false) })) : null, _jsx("div", { className: cn("absolute z-10 flex items-center gap-3 transition-[opacity,transform] duration-200", directionClass[direction], open ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0"), role: "menu", "aria-hidden": !open, children: children }), _jsx(Fab, { "aria-label": ariaLabel, "aria-expanded": open, size: "md", onClick: () => setOpen(!open), children: open ? (openIcon ?? _jsx(X, { className: "size-5" })) : (icon ?? _jsx(Plus, { className: "size-5" })) })] }));
|
|
20
|
+
}
|
|
21
|
+
SpeedDial.displayName = "SpeedDial";
|
|
22
|
+
function SpeedDialAction({ icon, tooltipTitle, className, ...props }) {
|
|
23
|
+
return (_jsxs("button", { type: "button", role: "menuitem", "data-slot": "speed-dial-action", title: typeof tooltipTitle === "string" ? tooltipTitle : undefined, className: cn("flex size-10 items-center justify-center rounded-full border border-border/50 bg-card text-foreground shadow-md outline-none transition-[transform,box-shadow] duration-150 hover:-translate-y-0.5 hover:shadow-lg focus-visible:ring-ring/50 focus-visible:ring-[3px]", className), ...props, children: [_jsx("span", { className: "sr-only", children: tooltipTitle }), icon] }));
|
|
24
|
+
}
|
|
25
|
+
SpeedDialAction.displayName = "SpeedDialAction";
|
|
26
|
+
export { SpeedDial, SpeedDialAction };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type StackProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
3
|
+
direction?: "row" | "column" | "row-reverse" | "column-reverse";
|
|
4
|
+
spacing?: number;
|
|
5
|
+
align?: "start" | "center" | "end" | "stretch" | "baseline";
|
|
6
|
+
justify?: "start" | "center" | "end" | "between" | "around" | "evenly";
|
|
7
|
+
wrap?: boolean;
|
|
8
|
+
divider?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare function Stack({ direction, spacing, align, justify, wrap, divider, className, children, ...props }: StackProps): React.JSX.Element;
|
|
11
|
+
declare namespace Stack {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
14
|
+
export { Stack };
|
|
15
|
+
//# sourceMappingURL=Stack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/primitives/Stack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IAC/D,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,aAAa,GAAG,gBAAgB,CAAC;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5D,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AA0BF,iBAAS,KAAK,CAAC,EACb,SAAoB,EACpB,OAAW,EACX,KAAK,EACL,OAAO,EACP,IAAY,EACZ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,qBAyBZ;kBAnCQ,KAAK;;;AAsCd,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/cn";
|
|
4
|
+
const gapClass = {
|
|
5
|
+
0: "gap-0",
|
|
6
|
+
1: "gap-1",
|
|
7
|
+
2: "gap-2",
|
|
8
|
+
3: "gap-3",
|
|
9
|
+
4: "gap-4",
|
|
10
|
+
5: "gap-5",
|
|
11
|
+
6: "gap-6",
|
|
12
|
+
8: "gap-8",
|
|
13
|
+
10: "gap-10",
|
|
14
|
+
12: "gap-12",
|
|
15
|
+
};
|
|
16
|
+
const directionClass = {
|
|
17
|
+
row: "flex-row",
|
|
18
|
+
column: "flex-col",
|
|
19
|
+
"row-reverse": "flex-row-reverse",
|
|
20
|
+
"column-reverse": "flex-col-reverse",
|
|
21
|
+
};
|
|
22
|
+
const alignClass = {
|
|
23
|
+
start: "items-start",
|
|
24
|
+
center: "items-center",
|
|
25
|
+
end: "items-end",
|
|
26
|
+
stretch: "items-stretch",
|
|
27
|
+
baseline: "items-baseline",
|
|
28
|
+
};
|
|
29
|
+
const justifyClass = {
|
|
30
|
+
start: "justify-start",
|
|
31
|
+
center: "justify-center",
|
|
32
|
+
end: "justify-end",
|
|
33
|
+
between: "justify-between",
|
|
34
|
+
around: "justify-around",
|
|
35
|
+
evenly: "justify-evenly",
|
|
36
|
+
};
|
|
37
|
+
function Stack({ direction = "column", spacing = 2, align, justify, wrap = false, divider, className, children, ...props }) {
|
|
38
|
+
const items = React.Children.toArray(children).filter(Boolean);
|
|
39
|
+
const gap = gapClass[spacing] ?? "gap-2";
|
|
40
|
+
return (_jsx("div", { "data-slot": "stack", className: cn("flex", directionClass[direction], align && alignClass[align], justify && justifyClass[justify], wrap && "flex-wrap", !divider && gap, className), ...props, children: divider
|
|
41
|
+
? items.flatMap((child, index) => index === 0 ? [child] : [divider, child])
|
|
42
|
+
: items }));
|
|
43
|
+
}
|
|
44
|
+
Stack.displayName = "Stack";
|
|
45
|
+
export { Stack };
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
export type RatingProps = Omit<React.ComponentPropsWithoutRef<"div">, "onChange" | "defaultValue"> & {
|
|
3
|
+
value?: number;
|
|
4
|
+
defaultValue?: number;
|
|
5
|
+
onChange?: (value: number) => void;
|
|
6
|
+
max?: number;
|
|
7
|
+
precision?: 0.5 | 1;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
size?: "sm" | "md" | "lg";
|
|
11
|
+
emptyLabelText?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Star rating. `StarRating` is the same component with a required `value`.
|
|
15
|
+
*/
|
|
16
|
+
declare function Rating({ value: valueProp, defaultValue, onChange, max, precision, readOnly, disabled, size, emptyLabelText, className, ...props }: RatingProps): React.JSX.Element;
|
|
17
|
+
declare namespace Rating {
|
|
18
|
+
var displayName: string;
|
|
19
|
+
}
|
|
2
20
|
declare function StarRating({ value, onChange, max, readOnly, className, }: {
|
|
3
21
|
value: number;
|
|
4
22
|
onChange?: (next: number) => void;
|
|
@@ -6,5 +24,5 @@ declare function StarRating({ value, onChange, max, readOnly, className, }: {
|
|
|
6
24
|
readOnly?: boolean;
|
|
7
25
|
className?: string;
|
|
8
26
|
}): React.JSX.Element;
|
|
9
|
-
export { StarRating };
|
|
27
|
+
export { Rating, StarRating };
|
|
10
28
|
//# sourceMappingURL=StarRating.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StarRating.d.ts","sourceRoot":"","sources":["../../src/primitives/StarRating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StarRating.d.ts","sourceRoot":"","sources":["../../src/primitives/StarRating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC,GAAG;IACnG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAQF;;GAEG;AACH,iBAAS,MAAM,CAAC,EACd,KAAK,EAAE,SAAS,EAChB,YAAgB,EAChB,QAAQ,EACR,GAAO,EACP,SAAa,EACb,QAAgB,EAChB,QAAgB,EAChB,IAAW,EACX,cAAyB,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,qBAoDb;kBAhEQ,MAAM;;;AAmEf,iBAAS,UAAU,CAAC,EAClB,KAAK,EACL,QAAQ,EACR,GAAO,EACP,QAAgB,EAChB,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,qBAIA;AAED,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,11 +1,41 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
import { Star } from "lucide-react";
|
|
4
|
+
import { useControllableState } from "../lib/use-controllable-state";
|
|
3
5
|
import { cn } from "../lib/cn";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
const sizeClass = {
|
|
7
|
+
sm: "size-4",
|
|
8
|
+
md: "size-5",
|
|
9
|
+
lg: "size-6",
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Star rating. `StarRating` is the same component with a required `value`.
|
|
13
|
+
*/
|
|
14
|
+
function Rating({ value: valueProp, defaultValue = 0, onChange, max = 5, precision = 1, readOnly = false, disabled = false, size = "md", emptyLabelText = "Rating", className, ...props }) {
|
|
15
|
+
const [value = 0, setValue] = useControllableState({
|
|
16
|
+
prop: valueProp,
|
|
17
|
+
defaultProp: defaultValue,
|
|
18
|
+
onChange,
|
|
19
|
+
});
|
|
20
|
+
const [hover, setHover] = React.useState(null);
|
|
21
|
+
const display = hover ?? value;
|
|
22
|
+
const locked = readOnly || disabled;
|
|
23
|
+
return (_jsx("div", { "data-slot": "rating", role: locked ? "img" : "radiogroup", "aria-label": `${display} of ${max} stars`, className: cn("inline-flex items-center gap-0.5", disabled && "opacity-50", className), ...props, children: Array.from({ length: max }, (_, i) => {
|
|
6
24
|
const n = i + 1;
|
|
7
|
-
const
|
|
8
|
-
return (
|
|
25
|
+
const fill = Math.min(1, Math.max(0, display - i));
|
|
26
|
+
return (_jsxs("button", { type: "button", role: locked ? undefined : "radio", "aria-checked": locked ? undefined : n === Math.ceil(value), "aria-label": `${n} ${emptyLabelText}`, disabled: locked, className: cn("relative rounded p-0.5", locked ? "cursor-default" : "hover:scale-110 active:scale-95"), onMouseEnter: () => {
|
|
27
|
+
if (!locked)
|
|
28
|
+
setHover(n);
|
|
29
|
+
}, onMouseLeave: () => setHover(null), onClick: () => {
|
|
30
|
+
if (locked)
|
|
31
|
+
return;
|
|
32
|
+
const next = precision === 0.5 && value === n ? n - 0.5 : n;
|
|
33
|
+
setValue(next);
|
|
34
|
+
}, children: [_jsx(Star, { className: cn(sizeClass[size], "text-muted-foreground/35") }), _jsx("span", { className: "absolute inset-0.5 overflow-hidden", style: { width: `${fill * 100}%` }, children: _jsx(Star, { className: cn(sizeClass[size], "fill-primary text-primary") }) })] }, n));
|
|
9
35
|
}) }));
|
|
10
36
|
}
|
|
11
|
-
|
|
37
|
+
Rating.displayName = "Rating";
|
|
38
|
+
function StarRating({ value, onChange, max = 5, readOnly = false, className, }) {
|
|
39
|
+
return (_jsx(Rating, { value: value, onChange: onChange, max: max, readOnly: readOnly, className: className }));
|
|
40
|
+
}
|
|
41
|
+
export { Rating, StarRating };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type StepperProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
3
|
+
activeStep?: number;
|
|
4
|
+
orientation?: "horizontal" | "vertical";
|
|
5
|
+
alternativeLabel?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare function Stepper({ activeStep, orientation, alternativeLabel, className, children, ...props }: StepperProps): React.JSX.Element;
|
|
8
|
+
declare namespace Stepper {
|
|
9
|
+
var displayName: string;
|
|
10
|
+
}
|
|
11
|
+
export type StepProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
12
|
+
completed?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare function Step({ completed, disabled, className, children, ...props }: StepProps): React.JSX.Element;
|
|
16
|
+
declare namespace Step {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
19
|
+
declare function StepConnector({ className, ...props }: React.ComponentPropsWithoutRef<"div">): React.JSX.Element;
|
|
20
|
+
declare namespace StepConnector {
|
|
21
|
+
var displayName: string;
|
|
22
|
+
}
|
|
23
|
+
export type StepLabelProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
24
|
+
optional?: React.ReactNode;
|
|
25
|
+
error?: boolean;
|
|
26
|
+
};
|
|
27
|
+
declare function StepLabel({ className, optional, error, children, ...props }: StepLabelProps): React.JSX.Element;
|
|
28
|
+
declare namespace StepLabel {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
31
|
+
declare function StepContent({ className, children, ...props }: React.ComponentPropsWithoutRef<"div">): React.JSX.Element | null;
|
|
32
|
+
declare namespace StepContent {
|
|
33
|
+
var displayName: string;
|
|
34
|
+
}
|
|
35
|
+
export { Stepper, Step, StepLabel, StepContent, StepConnector };
|
|
36
|
+
//# sourceMappingURL=Stepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../src/primitives/Stepper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmB/B,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,iBAAS,OAAO,CAAC,EACf,UAAc,EACd,WAA0B,EAC1B,gBAAwB,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,YAAY,qBA0Bd;kBAjCQ,OAAO;;;AAoChB,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,iBAAS,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAuB9E;kBAvBQ,IAAI;;;AA0Bb,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,qBAmBpF;kBAnBQ,aAAa;;;AAsBtB,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG;IACnE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,iBAAS,SAAS,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,qBA2CpF;kBA3CQ,SAAS;;;AA8ClB,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,4BAe5F;kBAfQ,WAAW;;;AAkBpB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Check } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/cn";
|
|
5
|
+
const StepperContext = React.createContext(null);
|
|
6
|
+
const StepIndexContext = React.createContext(0);
|
|
7
|
+
function useStepper(component) {
|
|
8
|
+
const ctx = React.useContext(StepperContext);
|
|
9
|
+
if (!ctx)
|
|
10
|
+
throw new Error(`${component} must be used within <Stepper>`);
|
|
11
|
+
return ctx;
|
|
12
|
+
}
|
|
13
|
+
function Stepper({ activeStep = 0, orientation = "horizontal", alternativeLabel = false, className, children, ...props }) {
|
|
14
|
+
const steps = React.Children.toArray(children);
|
|
15
|
+
return (_jsx(StepperContext.Provider, { value: { activeStep, orientation, alternativeLabel }, children: _jsx("div", { "data-slot": "stepper", "data-orientation": orientation, className: cn("flex w-full", orientation === "vertical" ? "flex-col gap-0" : "flex-row items-start", className), ...props, children: steps.map((child, index) => (_jsxs(StepIndexContext.Provider, { value: index, children: [child, index < steps.length - 1 ? _jsx(StepConnector, {}) : null] }, index))) }) }));
|
|
16
|
+
}
|
|
17
|
+
Stepper.displayName = "Stepper";
|
|
18
|
+
function Step({ completed, disabled, className, children, ...props }) {
|
|
19
|
+
const stepper = useStepper("Step");
|
|
20
|
+
const index = React.useContext(StepIndexContext);
|
|
21
|
+
const active = stepper.activeStep === index;
|
|
22
|
+
const isCompleted = completed ?? index < stepper.activeStep;
|
|
23
|
+
return (_jsx("div", { "data-slot": "step", "data-active": active ? "" : undefined, "data-completed": isCompleted ? "" : undefined, "data-disabled": disabled ? "" : undefined, className: cn("flex min-w-0", stepper.orientation === "vertical" ? "flex-col" : "flex-none", stepper.alternativeLabel && "flex-col items-center", className), ...props, children: children }));
|
|
24
|
+
}
|
|
25
|
+
Step.displayName = "Step";
|
|
26
|
+
function StepConnector({ className, ...props }) {
|
|
27
|
+
const stepper = useStepper("StepConnector");
|
|
28
|
+
const index = React.useContext(StepIndexContext);
|
|
29
|
+
const completed = index < stepper.activeStep;
|
|
30
|
+
return (_jsx("div", { "data-slot": "step-connector", "aria-hidden": true, className: cn(stepper.orientation === "vertical"
|
|
31
|
+
? "ml-[15px] h-6 w-px shrink-0"
|
|
32
|
+
: "mx-2 mt-[15px] h-px min-w-4 flex-1", completed ? "bg-primary" : "bg-border", className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
StepConnector.displayName = "StepConnector";
|
|
35
|
+
function StepLabel({ className, optional, error, children, ...props }) {
|
|
36
|
+
const stepper = useStepper("StepLabel");
|
|
37
|
+
const index = React.useContext(StepIndexContext);
|
|
38
|
+
const active = stepper.activeStep === index;
|
|
39
|
+
const completed = index < stepper.activeStep;
|
|
40
|
+
return (_jsxs("div", { "data-slot": "step-label", className: cn("flex items-center gap-3", stepper.alternativeLabel && "flex-col gap-2 text-center", className), ...props, children: [_jsx("span", { className: cn("flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-black", completed && "bg-primary text-primary-foreground", active && !completed && "bg-primary text-primary-foreground ring-4 ring-primary/20", !active && !completed && "border border-border/60 bg-muted/40 text-muted-foreground", error && "bg-destructive text-white ring-0"), children: completed ? _jsx(Check, { className: "size-4" }) : index + 1 }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: cn("text-sm font-bold", active || completed ? "text-foreground" : "text-muted-foreground", error && "text-destructive"), children: children }), optional ? (_jsx("div", { className: "text-xs font-medium text-muted-foreground", children: optional })) : null] })] }));
|
|
41
|
+
}
|
|
42
|
+
StepLabel.displayName = "StepLabel";
|
|
43
|
+
function StepContent({ className, children, ...props }) {
|
|
44
|
+
const stepper = useStepper("StepContent");
|
|
45
|
+
const index = React.useContext(StepIndexContext);
|
|
46
|
+
if (stepper.orientation !== "vertical")
|
|
47
|
+
return null;
|
|
48
|
+
if (stepper.activeStep !== index)
|
|
49
|
+
return null;
|
|
50
|
+
return (_jsx("div", { "data-slot": "step-content", className: cn("ml-4 border-l border-border/40 py-3 pl-7 text-sm", className), ...props, children: children }));
|
|
51
|
+
}
|
|
52
|
+
StepContent.displayName = "StepContent";
|
|
53
|
+
export { Stepper, Step, StepLabel, StepContent, StepConnector };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type TablePaginationProps = {
|
|
3
|
+
count: number;
|
|
4
|
+
page: number;
|
|
5
|
+
onPageChange: (page: number) => void;
|
|
6
|
+
rowsPerPage?: number;
|
|
7
|
+
onRowsPerPageChange?: (rows: number) => void;
|
|
8
|
+
rowsPerPageOptions?: number[];
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
declare function TablePagination({ count, page, onPageChange, rowsPerPage, onRowsPerPageChange, rowsPerPageOptions, className, }: TablePaginationProps): React.JSX.Element;
|
|
12
|
+
declare namespace TablePagination {
|
|
13
|
+
var displayName: string;
|
|
14
|
+
}
|
|
15
|
+
export { TablePagination };
|
|
16
|
+
//# sourceMappingURL=TablePagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TablePagination.d.ts","sourceRoot":"","sources":["../../src/primitives/TablePagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,WAAgB,EAChB,mBAAmB,EACnB,kBAAgC,EAChC,SAAS,GACV,EAAE,oBAAoB,qBA+BtB;kBAvCQ,eAAe;;;AA0CxB,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/cn";
|
|
3
|
+
import { NativeSelect } from "./NativeSelect";
|
|
4
|
+
import { Pagination } from "../composites/Pagination";
|
|
5
|
+
function TablePagination({ count, page, onPageChange, rowsPerPage = 10, onRowsPerPageChange, rowsPerPageOptions = [5, 10, 25], className, }) {
|
|
6
|
+
const pageCount = Math.max(1, Math.ceil(count / rowsPerPage));
|
|
7
|
+
const from = count === 0 ? 0 : page * rowsPerPage + 1;
|
|
8
|
+
const to = Math.min(count, (page + 1) * rowsPerPage);
|
|
9
|
+
return (_jsxs("div", { "data-slot": "table-pagination", className: cn("flex flex-wrap items-center justify-end gap-4 px-2 py-2 text-sm", className), children: [onRowsPerPageChange ? (_jsxs("label", { className: "flex items-center gap-2 text-xs font-bold text-muted-foreground", children: ["Rows", _jsx(NativeSelect, { value: String(rowsPerPage), onChange: (event) => onRowsPerPageChange(Number(event.target.value)), children: rowsPerPageOptions.map((n) => (_jsx("option", { value: n, children: n }, n))) })] })) : null, _jsxs("span", { className: "text-xs font-medium text-muted-foreground", children: [from, "\u2013", to, " of ", count] }), _jsx(Pagination, { page: page + 1, pageCount: pageCount, onPageChange: (next) => onPageChange(next - 1) })] }));
|
|
10
|
+
}
|
|
11
|
+
TablePagination.displayName = "TablePagination";
|
|
12
|
+
export { TablePagination };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type TextFieldProps = Omit<React.ComponentPropsWithoutRef<"input">, "size"> & {
|
|
3
|
+
label?: React.ReactNode;
|
|
4
|
+
helperText?: React.ReactNode;
|
|
5
|
+
error?: boolean;
|
|
6
|
+
multiline?: boolean;
|
|
7
|
+
rows?: number;
|
|
8
|
+
fullWidth?: boolean;
|
|
9
|
+
size?: "sm" | "md";
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Labeled input (or textarea) with helper / error copy — MUI TextField analogue.
|
|
13
|
+
*/
|
|
14
|
+
declare const TextField: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "size"> & {
|
|
15
|
+
label?: React.ReactNode;
|
|
16
|
+
helperText?: React.ReactNode;
|
|
17
|
+
error?: boolean;
|
|
18
|
+
multiline?: boolean;
|
|
19
|
+
rows?: number;
|
|
20
|
+
fullWidth?: boolean;
|
|
21
|
+
size?: "sm" | "md";
|
|
22
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
23
|
+
export { TextField };
|
|
24
|
+
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../src/primitives/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,GAAG;IACnF,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,SAAS;YAZL,KAAK,CAAC,SAAS;iBACV,KAAK,CAAC,SAAS;YACpB,OAAO;gBACH,OAAO;WACZ,MAAM;gBACD,OAAO;WACZ,IAAI,GAAG,IAAI;0CAwFnB,CAAC;AAGF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../lib/cn";
|
|
4
|
+
import { Input } from "./Input";
|
|
5
|
+
import { Label } from "./Label";
|
|
6
|
+
import { Textarea } from "./Textarea";
|
|
7
|
+
/**
|
|
8
|
+
* Labeled input (or textarea) with helper / error copy — MUI TextField analogue.
|
|
9
|
+
*/
|
|
10
|
+
const TextField = React.forwardRef(({ id, label, helperText, error, multiline, rows = 3, fullWidth, size = "md", className, disabled, required, type, ...props }, ref) => {
|
|
11
|
+
const autoId = React.useId();
|
|
12
|
+
const fieldId = id ?? autoId;
|
|
13
|
+
const helperId = helperText ? `${fieldId}-helper` : undefined;
|
|
14
|
+
const fieldClass = cn(size === "sm" && "h-8 text-sm", error && "aria-invalid:border-destructive", className);
|
|
15
|
+
const control = multiline ? (_jsx(Textarea, { id: fieldId, rows: rows, disabled: disabled, required: required, "aria-invalid": error || undefined, "aria-describedby": helperId, className: cn(fullWidth && "w-full", className), ...props })) : (_jsx(Input, { ref: ref, id: fieldId, type: type, disabled: disabled, required: required, "aria-invalid": error || undefined, "aria-describedby": helperId, className: cn(fullWidth && "w-full", fieldClass), ...props }));
|
|
16
|
+
return (_jsxs("div", { "data-slot": "text-field", "data-error": error ? "" : undefined, className: cn("flex flex-col gap-1.5", fullWidth && "w-full"), children: [label ? (_jsxs(Label, { htmlFor: fieldId, children: [label, required ? _jsx("span", { className: "text-destructive", children: "*" }) : null] })) : null, control, helperText ? (_jsx("p", { id: helperId, "data-slot": "text-field-helper", className: cn("text-xs font-medium", error ? "text-destructive" : "text-muted-foreground"), children: helperText })) : null] }));
|
|
17
|
+
});
|
|
18
|
+
TextField.displayName = "TextField";
|
|
19
|
+
export { TextField };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type TextareaAutosizeProps = React.ComponentPropsWithoutRef<"textarea"> & {
|
|
3
|
+
minRows?: number;
|
|
4
|
+
maxRows?: number;
|
|
5
|
+
};
|
|
6
|
+
declare const TextareaAutosize: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & {
|
|
7
|
+
minRows?: number;
|
|
8
|
+
maxRows?: number;
|
|
9
|
+
} & React.RefAttributes<HTMLTextAreaElement>>;
|
|
10
|
+
export { TextareaAutosize };
|
|
11
|
+
//# sourceMappingURL=TextareaAutosize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextareaAutosize.d.ts","sourceRoot":"","sources":["../../src/primitives/TextareaAutosize.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,qBAAqB,GAAG,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,GAAG;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,gBAAgB;cAJV,MAAM;cACN,MAAM;6CAuCjB,CAAC;AAGF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { composeRefs } from "../lib/compose-refs";
|
|
4
|
+
import { cn } from "../lib/cn";
|
|
5
|
+
const TextareaAutosize = React.forwardRef(({ className, minRows = 2, maxRows, onChange, style, ...props }, ref) => {
|
|
6
|
+
const inner = React.useRef(null);
|
|
7
|
+
const resize = React.useCallback(() => {
|
|
8
|
+
const node = inner.current;
|
|
9
|
+
if (!node)
|
|
10
|
+
return;
|
|
11
|
+
node.style.height = "auto";
|
|
12
|
+
const line = Number.parseFloat(getComputedStyle(node).lineHeight) || 20;
|
|
13
|
+
const min = minRows * line;
|
|
14
|
+
const max = maxRows ? maxRows * line : Number.POSITIVE_INFINITY;
|
|
15
|
+
node.style.height = `${Math.min(max, Math.max(min, node.scrollHeight))}px`;
|
|
16
|
+
}, [minRows, maxRows]);
|
|
17
|
+
React.useLayoutEffect(() => {
|
|
18
|
+
resize();
|
|
19
|
+
});
|
|
20
|
+
return (_jsx("textarea", { ref: composeRefs(ref, inner), "data-slot": "textarea-autosize", rows: minRows, className: cn("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 flex w-full rounded-md border bg-input-background px-3 py-2 text-sm outline-none focus-visible:ring-[3px]", className), style: { overflow: "hidden", resize: "none", ...style }, onChange: (event) => {
|
|
21
|
+
onChange?.(event);
|
|
22
|
+
resize();
|
|
23
|
+
}, ...props }));
|
|
24
|
+
});
|
|
25
|
+
TextareaAutosize.displayName = "TextareaAutosize";
|
|
26
|
+
export { TextareaAutosize };
|