@flikk/ui 1.0.0-beta.27 → 1.0.0-beta.29
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/dist/bg/1.webp +0 -0
- package/dist/bg/10.webp +0 -0
- package/dist/bg/11.webp +0 -0
- package/dist/bg/12.webp +0 -0
- package/dist/bg/13.webp +0 -0
- package/dist/bg/14.webp +0 -0
- package/dist/bg/15.webp +0 -0
- package/dist/bg/16.webp +0 -0
- package/dist/bg/17.webp +0 -0
- package/dist/bg/18.webp +0 -0
- package/dist/bg/19.webp +0 -0
- package/dist/bg/2.webp +0 -0
- package/dist/bg/20.webp +0 -0
- package/dist/bg/21.webp +0 -0
- package/dist/bg/22.webp +0 -0
- package/dist/bg/3.webp +0 -0
- package/dist/bg/4.webp +0 -0
- package/dist/bg/5.webp +0 -0
- package/dist/bg/6.webp +0 -0
- package/dist/bg/7.webp +0 -0
- package/dist/bg/8.webp +0 -0
- package/dist/bg/9.webp +0 -0
- package/dist/components/ai/CodeBlock/CodeBlock.theme.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +7 -143
- package/dist/components/ai/PromptInput/VoiceRecorder.js +0 -88
- package/dist/components/ai/TokenCounter/TokenCounter.theme.js +1 -1
- package/dist/components/canvas/Background.d.ts +19 -0
- package/dist/components/canvas/Background.js +23 -0
- package/dist/components/canvas/BaseNode.d.ts +15 -0
- package/dist/components/canvas/BaseNode.js +20 -0
- package/dist/components/canvas/CanvasToolbar.d.ts +34 -0
- package/dist/components/canvas/CanvasToolbar.js +34 -0
- package/dist/components/canvas/Edge.d.ts +35 -0
- package/dist/components/canvas/Edge.js +97 -0
- package/dist/components/canvas/EdgeLayer.d.ts +18 -0
- package/dist/components/canvas/EdgeLayer.js +111 -0
- package/dist/components/canvas/Handle.d.ts +11 -0
- package/dist/components/canvas/Handle.js +63 -0
- package/dist/components/canvas/MiniMap.d.ts +22 -0
- package/dist/components/canvas/MiniMap.js +105 -0
- package/dist/components/canvas/NodeCanvas.d.ts +10 -0
- package/dist/components/canvas/NodeCanvas.js +477 -0
- package/dist/components/canvas/NodeCanvas.theme.d.ts +7 -0
- package/dist/components/canvas/NodeCanvas.theme.js +9 -0
- package/dist/components/canvas/NodeCanvas.types.d.ts +187 -0
- package/dist/components/canvas/NodeControls.d.ts +25 -0
- package/dist/components/canvas/NodeControls.js +40 -0
- package/dist/components/canvas/NodeRenderer.d.ts +19 -0
- package/dist/components/canvas/NodeRenderer.js +117 -0
- package/dist/components/canvas/changes.d.ts +11 -0
- package/dist/components/canvas/changes.js +76 -0
- package/dist/components/canvas/context/CanvasContext.d.ts +32 -0
- package/dist/components/canvas/context/CanvasContext.js +14 -0
- package/dist/components/canvas/context/ConnectionContext.d.ts +33 -0
- package/dist/components/canvas/context/ConnectionContext.js +13 -0
- package/dist/components/canvas/context/HandleRegistry.d.ts +24 -0
- package/dist/components/canvas/context/HandleRegistry.js +15 -0
- package/dist/components/canvas/context/InteractionContext.d.ts +18 -0
- package/dist/components/canvas/context/InteractionContext.js +14 -0
- package/dist/components/canvas/context/NodeIdContext.d.ts +3 -0
- package/dist/components/canvas/context/NodeIdContext.js +15 -0
- package/dist/components/canvas/hooks/useConnection.d.ts +17 -0
- package/dist/components/canvas/hooks/useConnection.js +29 -0
- package/dist/components/canvas/hooks/useMarquee.d.ts +25 -0
- package/dist/components/canvas/hooks/useMarquee.js +91 -0
- package/dist/components/canvas/hooks/useNodeDrag.d.ts +23 -0
- package/dist/components/canvas/hooks/useNodeDrag.js +110 -0
- package/dist/components/canvas/hooks/usePanZoom.d.ts +30 -0
- package/dist/components/canvas/hooks/usePanZoom.js +189 -0
- package/dist/components/canvas/hooks/useViewport.d.ts +21 -0
- package/dist/components/canvas/hooks/useViewport.js +35 -0
- package/dist/components/canvas/index.d.ts +14 -0
- package/dist/components/canvas/index.js +12 -0
- package/dist/components/canvas/layout.d.ts +22 -0
- package/dist/components/canvas/layout.js +67 -0
- package/dist/components/canvas/utils.d.ts +4 -0
- package/dist/components/canvas/utils.js +16 -0
- package/dist/components/charts/AreaChart/AreaChart.js +136 -101
- package/dist/components/charts/AreaChart/AreaChart.types.d.ts +5 -5
- package/dist/components/charts/AreaChart/AreaChart.types.js +1 -0
- package/dist/components/charts/BarChart/BarChart.js +207 -143
- package/dist/components/charts/BarChart/BarChart.types.d.ts +4 -4
- package/dist/components/charts/BarChart/BarChart.types.js +1 -0
- package/dist/components/charts/ComboChart/ComboChart.types.d.ts +2 -2
- package/dist/components/charts/LineChart/LineChart.js +88 -72
- package/dist/components/charts/LineChart/LineChart.types.d.ts +3 -3
- package/dist/components/charts/RadarChart/RadarChart.js +1 -1
- package/dist/components/charts/RadarChart/RadarChart.theme.js +5 -2
- package/dist/components/charts/ScatterPlot/ScatterPlot.js +62 -72
- package/dist/components/charts/ScatterPlot/ScatterPlot.theme.js +10 -1
- package/dist/components/charts/ScatterPlot/ScatterPlot.types.d.ts +3 -9
- package/dist/components/charts/StackedBarChart/StackedBarChart.js +33 -33
- package/dist/components/charts/StackedBarChart/StackedBarChart.types.d.ts +2 -2
- package/dist/components/charts/hooks/index.d.ts +2 -0
- package/dist/components/charts/hooks/useChartDimensions.d.ts +29 -0
- package/dist/components/charts/hooks/useChartDimensions.js +42 -0
- package/dist/components/charts/shared/ChartTooltip/ChartTooltip.theme.js +1 -1
- package/dist/components/charts/types/chart.types.d.ts +11 -2
- package/dist/components/charts/types/chart.types.js +10 -3
- package/dist/components/core/Avatar/Avatar.js +5 -1
- package/dist/components/core/AvatarGroup/AvatarGroup.js +5 -1
- package/dist/components/core/AvatarGroup/AvatarGroup.theme.js +4 -2
- package/dist/components/core/Badge/Badge.js +1 -1
- package/dist/components/core/Badge/Badge.theme.js +16 -15
- package/dist/components/core/Button/Button.js +1 -1
- package/dist/components/core/Button/Button.theme.js +2 -2
- package/dist/components/core/Calendar/Calendar.theme.js +1 -1
- package/dist/components/core/Card/Card.js +7 -3
- package/dist/components/core/Card/Card.theme.js +3 -3
- package/dist/components/core/Card/Card.types.d.ts +27 -2
- package/dist/components/core/CommandPalette/CommandPalette.theme.js +2 -2
- package/dist/components/core/ContextMenu/ContextMenu.theme.js +2 -2
- package/dist/components/core/ContextMenu/ContextMenuItem.js +1 -1
- package/dist/components/core/ContextMenu/ContextMenuSubTrigger.js +1 -1
- package/dist/components/core/Dropdown/Dropdown.theme.js +3 -3
- package/dist/components/core/Dropdown/DropdownMenu.js +57 -29
- package/dist/components/core/HeroCard/HeroCard.d.ts +5 -0
- package/dist/components/core/HeroCard/HeroCard.js +99 -0
- package/dist/components/core/HeroCard/HeroCard.theme.d.ts +3 -0
- package/dist/components/core/HeroCard/HeroCard.theme.js +8 -0
- package/dist/components/core/HeroCard/HeroCard.types.d.ts +70 -0
- package/dist/components/core/HeroCard/index.d.ts +4 -0
- package/dist/components/core/Kbd/Kbd.theme.js +1 -1
- package/dist/components/core/Modal/Modal.d.ts +1 -1
- package/dist/components/core/Modal/Modal.js +2 -7
- package/dist/components/core/Modal/Modal.theme.js +4 -8
- package/dist/components/core/Modal/Modal.types.d.ts +0 -10
- package/dist/components/core/Modal/index.d.ts +1 -1
- package/dist/components/core/ModalStack/ModalStack.d.ts +1 -1
- package/dist/components/core/ModalStack/ModalStack.types.d.ts +1 -2
- package/dist/components/core/ModalStack/ModalStackModal.d.ts +1 -1
- package/dist/components/core/ModalStack/ModalStackModal.js +2 -7
- package/dist/components/core/PageHeading/PageHeading.theme.js +2 -2
- package/dist/components/core/Popover/Popover.theme.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.js +242 -4
- package/dist/components/core/ScrollArea/ScrollArea.types.d.ts +12 -1
- package/dist/components/core/ScrollArea/smooth/SmoothScrollEngine.d.ts +4 -0
- package/dist/components/core/ScrollArea/smooth/SmoothScrollEngine.js +23 -0
- package/dist/components/core/ScrollArea/smooth/useSmoothScroll.js +4 -0
- package/dist/components/core/ScrollArea/smooth/useSmoothScroll.types.d.ts +5 -0
- package/dist/components/core/Segmented/Segmented.theme.js +2 -2
- package/dist/components/core/Tooltip/Tooltip.theme.js +1 -1
- package/dist/components/core/index.d.ts +1 -0
- package/dist/components/core/index.js +2 -0
- package/dist/components/data-display/DescriptionList/DescriptionList.js +23 -7
- package/dist/components/data-display/DescriptionList/DescriptionList.theme.js +10 -3
- package/dist/components/data-display/DescriptionList/DescriptionList.types.d.ts +49 -10
- package/dist/components/data-display/DescriptionList/index.d.ts +1 -1
- package/dist/components/data-display/Feed/Feed.js +28 -5
- package/dist/components/data-display/Feed/Feed.theme.js +1 -1
- package/dist/components/data-display/Feed/Feed.types.d.ts +32 -1
- package/dist/components/data-display/Feed/index.d.ts +1 -1
- package/dist/components/data-display/Metric/Metric.js +8 -8
- package/dist/components/data-display/Metric/Metric.theme.d.ts +3 -2
- package/dist/components/data-display/Metric/Metric.theme.js +50 -68
- package/dist/components/data-display/Metric/Metric.types.d.ts +19 -21
- package/dist/components/data-display/Table/Table.js +2 -2
- package/dist/components/data-display/Table/Table.theme.js +24 -4
- package/dist/components/data-display/Table/Table.types.d.ts +8 -0
- package/dist/components/data-display/Table/TableBody.js +2 -2
- package/dist/components/data-display/Table/TableCell.js +1 -1
- package/dist/components/data-display/Table/TableRow.d.ts +1 -1
- package/dist/components/data-display/Table/TableRow.js +9 -2
- package/dist/components/data-display/Timeline/Timeline.js +27 -5
- package/dist/components/data-display/Timeline/Timeline.theme.d.ts +10 -2
- package/dist/components/data-display/Timeline/Timeline.theme.js +14 -8
- package/dist/components/data-display/Timeline/Timeline.types.d.ts +48 -16
- package/dist/components/data-display/Timeline/Timeline.utils.d.ts +6 -0
- package/dist/components/data-display/Timeline/Timeline.utils.js +11 -0
- package/dist/components/data-display/Timeline/TimelineItem.js +13 -20
- package/dist/components/data-display/Timeline/TimelineMarker.js +10 -8
- package/dist/components/data-display/Timeline/index.d.ts +2 -2
- package/dist/components/effects/3d/index.d.ts +0 -2
- package/dist/components/effects/3d/index.js +0 -1
- package/dist/components/effects/DotPattern/DotPattern.js +1 -1
- package/dist/components/effects/Overlay/Overlay.theme.js +1 -2
- package/dist/components/effects/Preloader/Preloader.animations.d.ts +23 -0
- package/dist/components/effects/Preloader/Preloader.animations.js +150 -0
- package/dist/components/effects/Preloader/Preloader.d.ts +3 -0
- package/dist/components/effects/Preloader/Preloader.js +119 -0
- package/dist/components/effects/Preloader/Preloader.types.d.ts +63 -0
- package/dist/components/effects/Preloader/index.d.ts +2 -0
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.js +25 -14
- package/dist/components/effects/ProgressiveBlur/ProgressiveBlur.types.d.ts +2 -0
- package/dist/components/effects/TiltCard/TiltCard.d.ts +12 -0
- package/dist/components/effects/TiltCard/TiltCard.glow.d.ts +28 -0
- package/dist/components/effects/TiltCard/TiltCard.glow.js +114 -0
- package/dist/components/effects/TiltCard/TiltCard.js +177 -0
- package/dist/components/effects/{SpotlightBorder/SpotlightBorder.shaders.d.ts → TiltCard/TiltCard.shaders.d.ts} +1 -1
- package/dist/components/effects/{SpotlightBorder/SpotlightBorder.shaders.js → TiltCard/TiltCard.shaders.js} +1 -1
- package/dist/components/effects/TiltCard/TiltCard.types.d.ts +88 -0
- package/dist/components/effects/TiltCard/index.d.ts +2 -0
- package/dist/components/effects/index.d.ts +4 -12
- package/dist/components/effects/index.js +2 -6
- package/dist/components/forms/Checkbox/Checkbox.js +7 -1
- package/dist/components/forms/DatePicker/DatePicker.theme.js +2 -2
- package/dist/components/forms/DateRangePicker/DateRangePicker.theme.js +1 -1
- package/dist/components/forms/FileUpload/FileUpload.js +1 -89
- package/dist/components/forms/FormLabel/FormLabel.theme.js +1 -1
- package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +2 -2
- package/dist/components/forms/Slider/Slider.theme.js +1 -1
- package/dist/components/forms/Switch/Switch.js +27 -15
- package/dist/components/forms/Switch/Switch.theme.d.ts +36 -6
- package/dist/components/forms/Switch/Switch.theme.js +33 -4
- package/dist/components/forms/Switch/Switch.types.d.ts +12 -2
- package/dist/components/forms/TimePicker/TimePicker.theme.js +1 -2
- package/dist/components/forms/TimePicker/TimePickerContent.js +1 -90
- package/dist/components/forms/forms.theme.js +1 -1
- package/dist/components/forms/index.d.ts +0 -4
- package/dist/components/forms/index.js +0 -92
- package/dist/components/generative/GenerativeView.d.ts +21 -0
- package/dist/components/generative/GenerativeView.js +116 -0
- package/dist/components/generative/actions.d.ts +26 -0
- package/dist/components/generative/actions.js +51 -0
- package/dist/components/generative/index.d.ts +11 -0
- package/dist/components/generative/index.js +9 -0
- package/dist/components/generative/registry.d.ts +43 -0
- package/dist/components/generative/registry.js +114 -0
- package/dist/components/generative/resolvers.d.ts +35 -0
- package/dist/components/generative/resolvers.js +93 -0
- package/dist/components/generative/schema.generated.d.ts +2 -0
- package/dist/components/generative/schema.generated.js +1639 -0
- package/dist/components/generative/schemaTypes.d.ts +30 -0
- package/dist/components/generative/streaming.d.ts +39 -0
- package/dist/components/generative/streaming.js +283 -0
- package/dist/components/generative/tools.d.ts +21 -0
- package/dist/components/generative/tools.js +54 -0
- package/dist/components/generative/types.d.ts +41 -0
- package/dist/components/generative/useGenerativeStream.d.ts +37 -0
- package/dist/components/generative/useGenerativeStream.js +36 -0
- package/dist/components/generative/validate.d.ts +24 -0
- package/dist/components/generative/validate.js +259 -0
- package/dist/components/layout/AppShell/AppShell.theme.js +2 -2
- package/dist/components/layout/FormLayout/FormLayout.js +1 -90
- package/dist/components/layout/Grid/Grid.d.ts +3 -0
- package/dist/components/layout/Grid/Grid.js +50 -0
- package/dist/components/layout/Grid/Grid.theme.d.ts +2 -0
- package/dist/components/layout/Grid/Grid.theme.js +35 -0
- package/dist/components/layout/Grid/Grid.types.d.ts +57 -0
- package/dist/components/layout/Grid/index.d.ts +3 -0
- package/dist/components/layout/Section/Section.d.ts +3 -0
- package/dist/components/layout/Section/Section.js +18 -0
- package/dist/components/layout/Section/Section.theme.d.ts +2 -0
- package/dist/components/layout/Section/Section.theme.js +10 -0
- package/dist/components/layout/Section/Section.types.d.ts +34 -0
- package/dist/components/layout/Section/index.d.ts +3 -0
- package/dist/components/layout/Stack/Stack.d.ts +3 -0
- package/dist/components/layout/Stack/Stack.js +19 -0
- package/dist/components/layout/Stack/Stack.theme.d.ts +2 -0
- package/dist/components/layout/Stack/Stack.theme.js +10 -0
- package/dist/components/layout/Stack/Stack.types.d.ts +39 -0
- package/dist/components/layout/Stack/index.d.ts +3 -0
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.js +6 -0
- package/dist/generative.schema.json +1637 -0
- package/dist/index.js +180 -180
- package/dist/registry.json +648 -464
- package/dist/styles.css +1 -1
- package/dist/tools.json +1731 -0
- package/package.json +17 -4
- package/src/global.scss +53 -101
- package/src/styles/theme.css +687 -493
- package/dist/bg/1.jpg +0 -0
- package/dist/bg/10.jpg +0 -0
- package/dist/bg/11.jpg +0 -0
- package/dist/bg/14.jpg +0 -0
- package/dist/bg/15.jpg +0 -0
- package/dist/bg/16.jpg +0 -0
- package/dist/bg/17.jpg +0 -0
- package/dist/bg/18.jpg +0 -0
- package/dist/bg/19.jpg +0 -0
- package/dist/bg/2.jpg +0 -0
- package/dist/bg/20.jpg +0 -0
- package/dist/bg/21.jpg +0 -0
- package/dist/bg/22.jpg +0 -0
- package/dist/bg/23.jpg +0 -0
- package/dist/bg/24.jpg +0 -0
- package/dist/bg/3.jpg +0 -0
- package/dist/bg/4.jpg +0 -0
- package/dist/bg/5.jpg +0 -0
- package/dist/bg/6.jpg +0 -0
- package/dist/bg/7.jpg +0 -0
- package/dist/bg/8.jpg +0 -0
- package/dist/bg/9.jpg +0 -0
- package/dist/components/effects/MorphingText/MorphingText.d.ts +0 -17
- package/dist/components/effects/MorphingText/MorphingText.js +0 -125
- package/dist/components/effects/MorphingText/MorphingText.types.d.ts +0 -18
- package/dist/components/effects/MorphingText/index.d.ts +0 -2
- package/dist/components/effects/PageTransition/PageTransition.animations.d.ts +0 -8
- package/dist/components/effects/PageTransition/PageTransition.animations.js +0 -53
- package/dist/components/effects/PageTransition/PageTransition.d.ts +0 -3
- package/dist/components/effects/PageTransition/PageTransition.js +0 -82
- package/dist/components/effects/PageTransition/PageTransition.types.d.ts +0 -15
- package/dist/components/effects/PageTransition/index.d.ts +0 -2
- package/dist/components/effects/ParallaxSection/ParallaxSection.d.ts +0 -26
- package/dist/components/effects/ParallaxSection/ParallaxSection.js +0 -71
- package/dist/components/effects/ParallaxSection/ParallaxSection.types.d.ts +0 -11
- package/dist/components/effects/ParallaxSection/index.d.ts +0 -2
- package/dist/components/effects/Spotlight/Spotlight.d.ts +0 -36
- package/dist/components/effects/Spotlight/Spotlight.js +0 -112
- package/dist/components/effects/Spotlight/Spotlight.types.d.ts +0 -29
- package/dist/components/effects/Spotlight/index.d.ts +0 -2
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.d.ts +0 -18
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.js +0 -213
- package/dist/components/effects/SpotlightBorder/SpotlightBorder.types.d.ts +0 -61
- package/dist/components/effects/SpotlightBorder/index.d.ts +0 -2
- package/dist/components/effects/StickyScroll/StickyScroll.d.ts +0 -30
- package/dist/components/effects/StickyScroll/StickyScroll.js +0 -128
- package/dist/components/effects/StickyScroll/StickyScroll.types.d.ts +0 -19
- package/dist/components/effects/StickyScroll/index.d.ts +0 -2
- package/dist/components/forms/CronInput/CronInput.d.ts +0 -3
- package/dist/components/forms/CronInput/CronInput.js +0 -113
- package/dist/components/forms/CronInput/CronInput.theme.d.ts +0 -6
- package/dist/components/forms/CronInput/CronInput.theme.js +0 -75
- package/dist/components/forms/CronInput/CronInput.types.d.ts +0 -109
- package/dist/components/forms/CronInput/CronInput.utils.d.ts +0 -67
- package/dist/components/forms/CronInput/CronInput.utils.js +0 -505
- package/dist/components/forms/CronInput/index.d.ts +0 -4
- /package/dist/components/effects/{SpotlightBorder/SpotlightBorder.types.js → TiltCard/TiltCard.types.js} +0 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { GENERATIVE_SCHEMA } from './schema.generated.js';
|
|
2
|
+
|
|
3
|
+
/** Props that are NEVER accepted from a spec, regardless of schema. */
|
|
4
|
+
const BLOCKED_PROPS = new Set(["className", "style", "ref", "key", "theme", "dangerouslySetInnerHTML"]);
|
|
5
|
+
const isHandler = (key) => /^on[A-Z]/.test(key);
|
|
6
|
+
/**
|
|
7
|
+
* Validate + repair a model-emitted spec against the generated schema.
|
|
8
|
+
* Never throws; never mutates the input. Every repair is recorded in `issues`.
|
|
9
|
+
* Unknown components are kept (GenerativeView renders its safe placeholder)
|
|
10
|
+
* but their props/children are stripped.
|
|
11
|
+
*/
|
|
12
|
+
function validate(spec, options = {}) {
|
|
13
|
+
var _a;
|
|
14
|
+
const schema = (_a = options.schema) !== null && _a !== void 0 ? _a : GENERATIVE_SCHEMA;
|
|
15
|
+
const issues = [];
|
|
16
|
+
if (Array.isArray(spec)) {
|
|
17
|
+
return { spec: spec.map((n, i) => validateNode(n, schema, `$[${i}]`, issues)), issues };
|
|
18
|
+
}
|
|
19
|
+
return { spec: validateNode(spec, schema, "$", issues), issues };
|
|
20
|
+
}
|
|
21
|
+
function validateNode(node, schema, path, issues) {
|
|
22
|
+
if (!node || typeof node !== "object" || typeof node.component !== "string") {
|
|
23
|
+
issues.push({ path, code: "invalid-node", severity: "error", message: "Node is not an object with a string `component`" });
|
|
24
|
+
return { component: "__invalid__" };
|
|
25
|
+
}
|
|
26
|
+
const raw = node;
|
|
27
|
+
const comp = schema.components[raw.component];
|
|
28
|
+
if (!comp) {
|
|
29
|
+
issues.push({
|
|
30
|
+
path,
|
|
31
|
+
code: "unknown-component",
|
|
32
|
+
severity: "error",
|
|
33
|
+
message: `Unknown component "${raw.component}" — props/children stripped; renders as placeholder`,
|
|
34
|
+
});
|
|
35
|
+
return { component: raw.component, ...(raw.id ? { id: raw.id } : {}) };
|
|
36
|
+
}
|
|
37
|
+
const props = sanitizeProps(raw.props, comp, schema, path, issues);
|
|
38
|
+
// Fill required props that have a schema default; flag the rest.
|
|
39
|
+
for (const [name, ps] of Object.entries(comp.props)) {
|
|
40
|
+
if (!ps.required || props[name] !== undefined)
|
|
41
|
+
continue;
|
|
42
|
+
if (ps.default !== undefined) {
|
|
43
|
+
props[name] = ps.default;
|
|
44
|
+
issues.push({
|
|
45
|
+
path: `${path}.props.${name}`,
|
|
46
|
+
code: "applied-default",
|
|
47
|
+
severity: "warning",
|
|
48
|
+
message: `Required prop "${name}" missing — applied default ${JSON.stringify(ps.default)}`,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
issues.push({
|
|
53
|
+
path: `${path}.props.${name}`,
|
|
54
|
+
code: "missing-required",
|
|
55
|
+
severity: "error",
|
|
56
|
+
message: `Required prop "${name}" is missing`,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
let children;
|
|
61
|
+
if (Array.isArray(raw.children) && raw.children.length) {
|
|
62
|
+
if (comp.role !== "container") {
|
|
63
|
+
issues.push({
|
|
64
|
+
path: `${path}.children`,
|
|
65
|
+
code: "children-ignored",
|
|
66
|
+
severity: "warning",
|
|
67
|
+
message: `"${raw.component}" is not a container — children removed`,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
children = raw.children.map((c, i) => validateNode(c, schema, `${path}.children[${i}]`, issues));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
let actions;
|
|
75
|
+
if (raw.actions && typeof raw.actions === "object") {
|
|
76
|
+
for (const [key, descriptor] of Object.entries(raw.actions)) {
|
|
77
|
+
if (descriptor && typeof descriptor === "object" && typeof descriptor.type === "string") {
|
|
78
|
+
(actions !== null && actions !== void 0 ? actions : (actions = {}))[key] = {
|
|
79
|
+
type: descriptor.type,
|
|
80
|
+
...(descriptor.payload !== undefined ? { payload: descriptor.payload } : {}),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
issues.push({
|
|
85
|
+
path: `${path}.actions.${key}`,
|
|
86
|
+
code: "invalid-action",
|
|
87
|
+
severity: "warning",
|
|
88
|
+
message: `Action "${key}" must be { type: string, payload? } — removed`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
component: raw.component,
|
|
95
|
+
...(raw.id ? { id: raw.id } : {}),
|
|
96
|
+
...(raw.sizeHint ? { sizeHint: raw.sizeHint } : {}),
|
|
97
|
+
...(Object.keys(props).length ? { props } : {}),
|
|
98
|
+
...(children ? { children } : {}),
|
|
99
|
+
...(actions ? { actions } : {}),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function sanitizeProps(rawProps, comp, schema, path, issues) {
|
|
103
|
+
const out = {};
|
|
104
|
+
for (const [key, value] of Object.entries(rawProps !== null && rawProps !== void 0 ? rawProps : {})) {
|
|
105
|
+
const propPath = `${path}.props.${key}`;
|
|
106
|
+
if (BLOCKED_PROPS.has(key) || isHandler(key)) {
|
|
107
|
+
issues.push({
|
|
108
|
+
path: propPath,
|
|
109
|
+
code: "blocked-prop",
|
|
110
|
+
severity: "warning",
|
|
111
|
+
message: `"${key}" is not accepted from a spec (injection guard) — removed`,
|
|
112
|
+
});
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const ps = comp.props[key];
|
|
116
|
+
if (!ps) {
|
|
117
|
+
issues.push({
|
|
118
|
+
path: propPath,
|
|
119
|
+
code: "unknown-prop",
|
|
120
|
+
severity: "warning",
|
|
121
|
+
message: `"${key}" is not in the contract — removed (allow-list)`,
|
|
122
|
+
});
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const checked = checkValue(key, value, ps, schema, propPath, issues);
|
|
126
|
+
if (checked !== undefined)
|
|
127
|
+
out[key] = checked;
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
function checkValue(key, value, ps, schema, path, issues) {
|
|
132
|
+
var _a, _b;
|
|
133
|
+
const drop = (message, code = "invalid-value") => {
|
|
134
|
+
if (ps.default !== undefined) {
|
|
135
|
+
issues.push({ path, code, severity: "warning", message: `${message} — replaced with default ${JSON.stringify(ps.default)}` });
|
|
136
|
+
return ps.default;
|
|
137
|
+
}
|
|
138
|
+
issues.push({ path, code, severity: "warning", message: `${message} — removed` });
|
|
139
|
+
return undefined;
|
|
140
|
+
};
|
|
141
|
+
switch (ps.kind) {
|
|
142
|
+
case "enum": {
|
|
143
|
+
const options = (_a = ps.options) !== null && _a !== void 0 ? _a : [];
|
|
144
|
+
if (options.includes(value))
|
|
145
|
+
return value;
|
|
146
|
+
if (typeof value === "string") {
|
|
147
|
+
const ci = options.find((o) => typeof o === "string" && o.toLowerCase() === value.toLowerCase());
|
|
148
|
+
if (ci !== undefined) {
|
|
149
|
+
issues.push({ path, code: "coerced-value", severity: "warning", message: `"${value}" coerced to "${ci}"` });
|
|
150
|
+
return ci;
|
|
151
|
+
}
|
|
152
|
+
const num = Number(value);
|
|
153
|
+
if (!Number.isNaN(num) && options.includes(num)) {
|
|
154
|
+
issues.push({ path, code: "coerced-value", severity: "warning", message: `"${value}" coerced to ${num}` });
|
|
155
|
+
return num;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return drop(`${JSON.stringify(value)} is not one of ${JSON.stringify(options)}`, "invalid-enum");
|
|
159
|
+
}
|
|
160
|
+
case "boolean": {
|
|
161
|
+
if (typeof value === "boolean")
|
|
162
|
+
return value;
|
|
163
|
+
if (value === "true" || value === "false") {
|
|
164
|
+
issues.push({ path, code: "coerced-value", severity: "warning", message: `"${value}" coerced to boolean` });
|
|
165
|
+
return value === "true";
|
|
166
|
+
}
|
|
167
|
+
return drop(`Expected boolean, got ${JSON.stringify(value)}`);
|
|
168
|
+
}
|
|
169
|
+
case "number": {
|
|
170
|
+
if (typeof value === "number")
|
|
171
|
+
return value;
|
|
172
|
+
if (typeof value === "string" && value.trim() !== "" && !Number.isNaN(Number(value))) {
|
|
173
|
+
issues.push({ path, code: "coerced-value", severity: "warning", message: `"${value}" coerced to number` });
|
|
174
|
+
return Number(value);
|
|
175
|
+
}
|
|
176
|
+
return drop(`Expected number, got ${JSON.stringify(value)}`);
|
|
177
|
+
}
|
|
178
|
+
case "string":
|
|
179
|
+
case "text": {
|
|
180
|
+
if (typeof value === "string")
|
|
181
|
+
return value;
|
|
182
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
183
|
+
issues.push({ path, code: "coerced-value", severity: "warning", message: `${JSON.stringify(value)} coerced to string` });
|
|
184
|
+
return String(value);
|
|
185
|
+
}
|
|
186
|
+
return drop(`Expected string, got ${JSON.stringify(value)}`);
|
|
187
|
+
}
|
|
188
|
+
case "union": {
|
|
189
|
+
const types = (_b = ps.types) !== null && _b !== void 0 ? _b : [];
|
|
190
|
+
if (types.includes(typeof value))
|
|
191
|
+
return value;
|
|
192
|
+
if (types.includes("number") && typeof value === "string" && value.trim() !== "" && !Number.isNaN(Number(value))) {
|
|
193
|
+
issues.push({ path, code: "coerced-value", severity: "warning", message: `"${value}" coerced to number` });
|
|
194
|
+
return Number(value);
|
|
195
|
+
}
|
|
196
|
+
if (types.includes("string") && (typeof value === "number" || typeof value === "boolean")) {
|
|
197
|
+
issues.push({ path, code: "coerced-value", severity: "warning", message: `${JSON.stringify(value)} coerced to string` });
|
|
198
|
+
return String(value);
|
|
199
|
+
}
|
|
200
|
+
return drop(`Expected ${types.join(" | ")}, got ${JSON.stringify(value)}`);
|
|
201
|
+
}
|
|
202
|
+
case "icon": {
|
|
203
|
+
if (typeof value !== "string")
|
|
204
|
+
return drop(`Icon must be a NAME string, got ${JSON.stringify(value)}`);
|
|
205
|
+
if (schema.icons.includes(value))
|
|
206
|
+
return value;
|
|
207
|
+
const ci = schema.icons.find((n) => n.toLowerCase() === value.toLowerCase());
|
|
208
|
+
if (ci) {
|
|
209
|
+
issues.push({ path, code: "coerced-value", severity: "warning", message: `Icon "${value}" coerced to "${ci}"` });
|
|
210
|
+
return ci;
|
|
211
|
+
}
|
|
212
|
+
return drop(`Unknown icon "${value}" (closed set of ${schema.icons.length})`, "invalid-enum");
|
|
213
|
+
}
|
|
214
|
+
case "shape": {
|
|
215
|
+
if (ps.shape === "gridCols") {
|
|
216
|
+
if (typeof value === "number" || (value !== null && typeof value === "object" && !Array.isArray(value)))
|
|
217
|
+
return value;
|
|
218
|
+
return drop(`Expected a number or breakpoint map, got ${JSON.stringify(value)}`, "invalid-shape");
|
|
219
|
+
}
|
|
220
|
+
if (ps.shape === "chartConfig" || ps.shape === "donutColors") {
|
|
221
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value))
|
|
222
|
+
return value;
|
|
223
|
+
return drop(`Expected an object, got ${JSON.stringify(value)}`, "invalid-shape");
|
|
224
|
+
}
|
|
225
|
+
// every other shape is an array of objects
|
|
226
|
+
if (!Array.isArray(value))
|
|
227
|
+
return drop(`Expected an array, got ${JSON.stringify(value)}`, "invalid-shape");
|
|
228
|
+
const cleaned = value.filter((item) => item !== null && typeof item === "object" && !Array.isArray(item));
|
|
229
|
+
if (cleaned.length !== value.length) {
|
|
230
|
+
issues.push({
|
|
231
|
+
path,
|
|
232
|
+
code: "invalid-shape",
|
|
233
|
+
severity: "warning",
|
|
234
|
+
message: `${value.length - cleaned.length} non-object item(s) removed from "${key}"`,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
// strip blocked/handler keys inside structured items (injection guard at depth)
|
|
238
|
+
return cleaned.map((item) => {
|
|
239
|
+
const obj = item;
|
|
240
|
+
const next = {};
|
|
241
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
242
|
+
if (BLOCKED_PROPS.has(k) || isHandler(k)) {
|
|
243
|
+
issues.push({
|
|
244
|
+
path: `${path}.${k}`,
|
|
245
|
+
code: "blocked-prop",
|
|
246
|
+
severity: "warning",
|
|
247
|
+
message: `"${k}" inside "${key}" removed (injection guard)`,
|
|
248
|
+
});
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
next[k] = v;
|
|
252
|
+
}
|
|
253
|
+
return next;
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export { validate };
|
|
@@ -4,14 +4,14 @@ const appShellTheme = {
|
|
|
4
4
|
shell: "flex flex-1 min-h-0 min-w-0",
|
|
5
5
|
mainColumn: "flex flex-col flex-1 min-h-0 min-w-0",
|
|
6
6
|
topbar: "shrink-0 border-b border-[var(--color-border)] bg-[var(--color-background)]/90 backdrop-blur supports-[backdrop-filter]:bg-[var(--color-background)]/75",
|
|
7
|
-
sidebar: "flex flex-col shrink-0 overflow-hidden
|
|
7
|
+
sidebar: "flex flex-col shrink-0 overflow-hidden",
|
|
8
8
|
sidebarScroll: "min-h-0 flex-1",
|
|
9
9
|
sidebarCollapsed: "hidden lg:flex",
|
|
10
10
|
header: "shrink-0 border-b border-[var(--color-border)] bg-[var(--color-background)]/90 backdrop-blur supports-[backdrop-filter]:bg-[var(--color-background)]/75",
|
|
11
11
|
main: "flex flex-col flex-1 min-h-0 min-w-0",
|
|
12
12
|
mainScroll: "min-h-0 flex-1",
|
|
13
13
|
mainInner: "mx-auto w-full",
|
|
14
|
-
rightPanel: "flex flex-col shrink-0 overflow-hidden border-l border-[var(--color-border)]
|
|
14
|
+
rightPanel: "flex flex-col shrink-0 overflow-hidden border-l border-[var(--color-border)]",
|
|
15
15
|
rightPanelScroll: "min-h-0 flex-1",
|
|
16
16
|
footer: "shrink-0 border-t border-[var(--color-border)] bg-[var(--color-background)]/90 backdrop-blur supports-[backdrop-filter]:bg-[var(--color-background)]/75",
|
|
17
17
|
contentPadding: {
|
|
@@ -1,99 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { cn } from '../../../utils/cn.js';
|
|
4
|
-
import '../../core/Accordion/Accordion.js';
|
|
5
|
-
import '../../core/AlertDialog/AlertDialog.js';
|
|
6
|
-
import '../../core/AspectRatio/AspectRatio.js';
|
|
7
|
-
import '../../core/Avatar/Avatar.js';
|
|
8
|
-
import '../../core/AvatarGroup/AvatarGroup.js';
|
|
9
|
-
import '../../core/Badge/Badge.js';
|
|
10
|
-
import '../../core/Breadcrumbs/Breadcrumbs.js';
|
|
11
|
-
import '../../core/Breadcrumbs/Breadcrumbs.theme.js';
|
|
12
|
-
import '../../core/Button/Button.js';
|
|
13
|
-
import '../../core/ButtonGroup/ButtonGroup.js';
|
|
14
|
-
import '../../core/ButtonGroup/ButtonGroupSeparator.js';
|
|
15
|
-
import '../../core/ButtonGroup/ButtonGroupText.js';
|
|
16
|
-
import '../../core/Calendar/Calendar.js';
|
|
17
|
-
import '../../core/Calendar/CalendarMini/CalendarMini.js';
|
|
18
|
-
import '../../core/Card/Card.js';
|
|
19
|
-
import '../../core/CardStack/CardStack.js';
|
|
20
|
-
import '../../core/Carousel/Carousel.js';
|
|
21
|
-
import '../../core/Carousel/CarouselBody.js';
|
|
22
|
-
import '../../core/CommandPalette/CommandPalette.js';
|
|
23
|
-
import { Separator } from '../../core/Separator/Separator.js';
|
|
24
|
-
import '../../core/Drawer/Drawer.js';
|
|
25
|
-
import '../../core/Drawer/DrawerBody.js';
|
|
26
|
-
import '../../core/Dropdown/Dropdown.js';
|
|
27
|
-
import '../../core/Dropdown/DropdownTrigger.js';
|
|
28
|
-
import '../../core/Dropdown/DropdownMenu.js';
|
|
29
|
-
import '../../core/Dropdown/DropdownItem.js';
|
|
30
|
-
import '../../core/Dropdown/DropdownSection.js';
|
|
31
|
-
import '../../core/Dropdown/DropdownSeparator.js';
|
|
32
|
-
import '../../core/Dropdown/Dropdown.theme.js';
|
|
33
|
-
import '../../core/DotSeparator/DotSeparator.js';
|
|
34
|
-
import '../../core/Kbd/Kbd.js';
|
|
35
|
-
import '../../core/MenuItem/MenuItem.js';
|
|
36
|
-
import '../../core/Link/Link.js';
|
|
37
|
-
import '../../core/Modal/Modal.js';
|
|
38
|
-
import '../../core/ModalStack/ModalStack.js';
|
|
39
|
-
import '../../core/PageHeading/PageHeading.js';
|
|
40
|
-
import '../../core/Pagination/Pagination.js';
|
|
41
|
-
import '../../core/Popover/Popover.js';
|
|
42
|
-
import '../../core/Popover/PopoverContext.js';
|
|
43
|
-
import '../../core/Popover/PopoverBody.js';
|
|
44
|
-
import '../../core/Progress/Progress.js';
|
|
45
|
-
import '../../core/Rating/Rating.js';
|
|
46
|
-
import '../../core/ScrollArea/ScrollArea.js';
|
|
47
|
-
import '../../core/ScrollArea/smooth/SmoothScrollEngine.js';
|
|
48
|
-
import '../../core/Segmented/Segmented.js';
|
|
49
|
-
import '../../core/Skeleton/Skeleton.js';
|
|
50
|
-
import '../../core/SlidingNumber/SlidingNumber.js';
|
|
51
|
-
import '../../core/Tabs/Tabs.js';
|
|
52
|
-
import '../../core/Tabs/TabsList.js';
|
|
53
|
-
import '../../core/Tabs/TabsTrigger.js';
|
|
54
|
-
import '../../core/Tabs/TabsBody.js';
|
|
55
|
-
import '../../core/Tabs/TabsContext.js';
|
|
56
|
-
import '../../core/Tooltip/Tooltip.js';
|
|
57
|
-
import '../../core/Tooltip/Tooltip.animations.js';
|
|
58
|
-
import '../../core/Tree/Tree.js';
|
|
59
|
-
import '../../core/Tag/Tag.js';
|
|
60
|
-
import '../../core/Alert/Alert.js';
|
|
61
|
-
import '../../core/Toast/Toast.js';
|
|
62
|
-
import '../../core/Toast/ToastProvider.js';
|
|
63
|
-
import '@heroicons/react/24/solid';
|
|
64
|
-
import '../../core/Spinner/Spinner.js';
|
|
65
|
-
import '../../core/Message/Message.js';
|
|
66
|
-
import '../../core/Message/TypeWriter.js';
|
|
67
|
-
import '../../core/Message/MessageBody.js';
|
|
68
|
-
import '@heroicons/react/16/solid';
|
|
69
|
-
import '@heroicons/react/24/outline';
|
|
70
|
-
import '../../core/Empty/Empty.js';
|
|
71
|
-
import '../../core/Masonry/Masonry.js';
|
|
72
|
-
import '../../core/DragDrop/DragDrop.js';
|
|
73
|
-
import '../../core/Sortable/Sortable.js';
|
|
74
|
-
import '../../core/NavItem/NavItem.js';
|
|
75
|
-
import '../../core/Sidebar/Sidebar.js';
|
|
76
|
-
import '../../core/Sidebar/SidebarHeader.js';
|
|
77
|
-
import '../../core/Sidebar/SidebarContent.js';
|
|
78
|
-
import '../../core/Sidebar/SidebarFooter.js';
|
|
79
|
-
import '../../core/Sidebar/SidebarNav.js';
|
|
80
|
-
import '../../core/Sidebar/SidebarNavGroup.js';
|
|
81
|
-
import '../../core/Sidebar/SidebarToggle.js';
|
|
82
|
-
import '../../core/Sidebar/SidebarMobileTrigger.js';
|
|
83
|
-
import '../../core/Sidebar/SidebarUserProfile.js';
|
|
84
|
-
import '../../core/Sidebar/SidebarLogo.js';
|
|
85
|
-
import '../../core/Sidebar/SidebarSearch.js';
|
|
86
|
-
import '../../core/Sidebar/SidebarCard.js';
|
|
87
|
-
import '../../core/Sidebar/SidebarContext.js';
|
|
88
|
-
import '../../core/OfflineIndicator/OfflineIndicator.js';
|
|
89
|
-
import '../../core/ContextMenu/ContextMenu.js';
|
|
90
|
-
import '../../core/ContextMenu/ContextMenu.theme.js';
|
|
91
|
-
import '../../core/Pill/Pill.js';
|
|
92
|
-
import '../../core/Icon/Icon.js';
|
|
93
|
-
import '../../core/ImagePlaceholder/ImagePlaceholder.js';
|
|
94
4
|
import { formLayoutTheme } from './FormLayout.theme.js';
|
|
95
5
|
import { FormLayoutSection } from './FormLayoutSection.js';
|
|
96
6
|
import { FormLayoutFooter } from './FormLayoutFooter.js';
|
|
7
|
+
import { Separator } from '../../core/Separator/Separator.js';
|
|
97
8
|
|
|
98
9
|
const isFooter = (child) => React__default.isValidElement(child) && child.type === FormLayoutFooter;
|
|
99
10
|
const FormLayoutRoot = React__default.forwardRef(({ className, theme: customTheme, children, ...props }, ref) => {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useMemo } from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { gridTheme } from './Grid.theme.js';
|
|
5
|
+
|
|
6
|
+
const clampCols = (n) => Math.min(12, Math.max(1, Math.round(n)));
|
|
7
|
+
/** Turn a `cols` value into a space-separated literal class string. */
|
|
8
|
+
function resolveCols(cols, theme) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (typeof cols === "number") {
|
|
11
|
+
return (_a = theme.colsRamp[clampCols(cols)]) !== null && _a !== void 0 ? _a : theme.colsRamp[1];
|
|
12
|
+
}
|
|
13
|
+
const parts = [];
|
|
14
|
+
Object.keys(cols).forEach((bp) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const n = cols[bp];
|
|
17
|
+
if (typeof n === "number") {
|
|
18
|
+
const cls = (_a = theme.cols[bp]) === null || _a === void 0 ? void 0 : _a[clampCols(n)];
|
|
19
|
+
if (cls)
|
|
20
|
+
parts.push(cls);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return parts.join(" ");
|
|
24
|
+
}
|
|
25
|
+
const Grid = React__default.forwardRef(({ cols = 1, gap = 4, flow, align, justify, className, theme: customTheme = {}, ...props }, ref) => {
|
|
26
|
+
const theme = useMemo(() => {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28
|
+
return ({
|
|
29
|
+
...gridTheme,
|
|
30
|
+
...customTheme,
|
|
31
|
+
colsRamp: { ...gridTheme.colsRamp, ...customTheme.colsRamp },
|
|
32
|
+
cols: {
|
|
33
|
+
base: { ...gridTheme.cols.base, ...(_a = customTheme.cols) === null || _a === void 0 ? void 0 : _a.base },
|
|
34
|
+
sm: { ...gridTheme.cols.sm, ...(_b = customTheme.cols) === null || _b === void 0 ? void 0 : _b.sm },
|
|
35
|
+
md: { ...gridTheme.cols.md, ...(_c = customTheme.cols) === null || _c === void 0 ? void 0 : _c.md },
|
|
36
|
+
lg: { ...gridTheme.cols.lg, ...(_d = customTheme.cols) === null || _d === void 0 ? void 0 : _d.lg },
|
|
37
|
+
xl: { ...gridTheme.cols.xl, ...(_e = customTheme.cols) === null || _e === void 0 ? void 0 : _e.xl },
|
|
38
|
+
"2xl": { ...gridTheme.cols["2xl"], ...(_f = customTheme.cols) === null || _f === void 0 ? void 0 : _f["2xl"] },
|
|
39
|
+
},
|
|
40
|
+
gaps: { ...gridTheme.gaps, ...customTheme.gaps },
|
|
41
|
+
flow: { ...gridTheme.flow, ...customTheme.flow },
|
|
42
|
+
align: { ...gridTheme.align, ...customTheme.align },
|
|
43
|
+
justify: { ...gridTheme.justify, ...customTheme.justify },
|
|
44
|
+
});
|
|
45
|
+
}, [customTheme]);
|
|
46
|
+
return (jsx("div", { ref: ref, className: cn(theme.baseStyle, resolveCols(cols, theme), theme.gaps[gap], flow && theme.flow[flow], align && theme.align[align], justify && theme.justify[justify], className), ...props }));
|
|
47
|
+
});
|
|
48
|
+
Grid.displayName = "Grid";
|
|
49
|
+
|
|
50
|
+
export { Grid };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// ⚠️ PURGE-SAFETY: every class below MUST stay a verbatim literal string.
|
|
2
|
+
// Tailwind v4 scans this file's source text to decide which classes to emit —
|
|
3
|
+
// it cannot see runtime-built strings. Do NOT "simplify" these tables into a
|
|
4
|
+
// generated/interpolated form (e.g. `${bp}grid-cols-${n}`): that drops the
|
|
5
|
+
// literals from the scan and silently breaks the grid in production CSS.
|
|
6
|
+
const COLS_BASE = { 1: "grid-cols-1", 2: "grid-cols-2", 3: "grid-cols-3", 4: "grid-cols-4", 5: "grid-cols-5", 6: "grid-cols-6", 7: "grid-cols-7", 8: "grid-cols-8", 9: "grid-cols-9", 10: "grid-cols-10", 11: "grid-cols-11", 12: "grid-cols-12" };
|
|
7
|
+
const COLS_SM = { 1: "sm:grid-cols-1", 2: "sm:grid-cols-2", 3: "sm:grid-cols-3", 4: "sm:grid-cols-4", 5: "sm:grid-cols-5", 6: "sm:grid-cols-6", 7: "sm:grid-cols-7", 8: "sm:grid-cols-8", 9: "sm:grid-cols-9", 10: "sm:grid-cols-10", 11: "sm:grid-cols-11", 12: "sm:grid-cols-12" };
|
|
8
|
+
const COLS_MD = { 1: "md:grid-cols-1", 2: "md:grid-cols-2", 3: "md:grid-cols-3", 4: "md:grid-cols-4", 5: "md:grid-cols-5", 6: "md:grid-cols-6", 7: "md:grid-cols-7", 8: "md:grid-cols-8", 9: "md:grid-cols-9", 10: "md:grid-cols-10", 11: "md:grid-cols-11", 12: "md:grid-cols-12" };
|
|
9
|
+
const COLS_LG = { 1: "lg:grid-cols-1", 2: "lg:grid-cols-2", 3: "lg:grid-cols-3", 4: "lg:grid-cols-4", 5: "lg:grid-cols-5", 6: "lg:grid-cols-6", 7: "lg:grid-cols-7", 8: "lg:grid-cols-8", 9: "lg:grid-cols-9", 10: "lg:grid-cols-10", 11: "lg:grid-cols-11", 12: "lg:grid-cols-12" };
|
|
10
|
+
const COLS_XL = { 1: "xl:grid-cols-1", 2: "xl:grid-cols-2", 3: "xl:grid-cols-3", 4: "xl:grid-cols-4", 5: "xl:grid-cols-5", 6: "xl:grid-cols-6", 7: "xl:grid-cols-7", 8: "xl:grid-cols-8", 9: "xl:grid-cols-9", 10: "xl:grid-cols-10", 11: "xl:grid-cols-11", 12: "xl:grid-cols-12" };
|
|
11
|
+
const COLS_2XL = { 1: "2xl:grid-cols-1", 2: "2xl:grid-cols-2", 3: "2xl:grid-cols-3", 4: "2xl:grid-cols-4", 5: "2xl:grid-cols-5", 6: "2xl:grid-cols-6", 7: "2xl:grid-cols-7", 8: "2xl:grid-cols-8", 9: "2xl:grid-cols-9", 10: "2xl:grid-cols-10", 11: "2xl:grid-cols-11", 12: "2xl:grid-cols-12" };
|
|
12
|
+
const gridTheme = {
|
|
13
|
+
baseStyle: "grid",
|
|
14
|
+
colsRamp: {
|
|
15
|
+
1: "grid-cols-1",
|
|
16
|
+
2: "grid-cols-1 sm:grid-cols-2",
|
|
17
|
+
3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
|
18
|
+
4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",
|
|
19
|
+
5: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-5",
|
|
20
|
+
6: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-6",
|
|
21
|
+
7: "grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 xl:grid-cols-7",
|
|
22
|
+
8: "grid-cols-2 sm:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8",
|
|
23
|
+
9: "grid-cols-3 sm:grid-cols-4 lg:grid-cols-6 xl:grid-cols-9",
|
|
24
|
+
10: "grid-cols-3 sm:grid-cols-5 lg:grid-cols-6 xl:grid-cols-10",
|
|
25
|
+
11: "grid-cols-3 sm:grid-cols-5 lg:grid-cols-6 xl:grid-cols-11",
|
|
26
|
+
12: "grid-cols-3 sm:grid-cols-6 lg:grid-cols-6 xl:grid-cols-12",
|
|
27
|
+
},
|
|
28
|
+
cols: { base: COLS_BASE, sm: COLS_SM, md: COLS_MD, lg: COLS_LG, xl: COLS_XL, "2xl": COLS_2XL },
|
|
29
|
+
gaps: { 0: "gap-0", 1: "gap-1", 2: "gap-2", 3: "gap-3", 4: "gap-4", 5: "gap-5", 6: "gap-6", 8: "gap-8", 10: "gap-10", 12: "gap-12" },
|
|
30
|
+
flow: { row: "grid-flow-row", col: "grid-flow-col", dense: "grid-flow-row-dense" },
|
|
31
|
+
align: { start: "items-start", center: "items-center", end: "items-end", stretch: "items-stretch" },
|
|
32
|
+
justify: { start: "justify-start", center: "justify-center", end: "justify-end", between: "justify-between" },
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { gridTheme };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
/** Tailwind v4 default breakpoints; "base" = unprefixed (mobile-first). */
|
|
3
|
+
export type Breakpoint = "base" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
4
|
+
/** Tailwind spacing scale → gap-0 … gap-12. Use className for exotic values. */
|
|
5
|
+
export type GridGap = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12;
|
|
6
|
+
export type GridFlow = "row" | "col" | "dense";
|
|
7
|
+
export type GridAlign = "start" | "center" | "end" | "stretch";
|
|
8
|
+
export type GridJustify = "start" | "center" | "end" | "between";
|
|
9
|
+
/** A single column count (mobile-safe auto-ramp) OR an explicit per-breakpoint map. */
|
|
10
|
+
export type GridCols = number | Partial<Record<Breakpoint, number>>;
|
|
11
|
+
export interface GridTheme {
|
|
12
|
+
baseStyle: string;
|
|
13
|
+
/** cols={n} → a full responsive class string (mobile-first ramp). */
|
|
14
|
+
colsRamp: Record<number, string>;
|
|
15
|
+
/** cols={{ md: 2 }} → per-breakpoint literal class tables. */
|
|
16
|
+
cols: Record<Breakpoint, Record<number, string>>;
|
|
17
|
+
gaps: Record<GridGap, string>;
|
|
18
|
+
flow: Record<GridFlow, string>;
|
|
19
|
+
align: Record<GridAlign, string>;
|
|
20
|
+
justify: Record<GridJustify, string>;
|
|
21
|
+
}
|
|
22
|
+
export interface GridThemeOverrides {
|
|
23
|
+
baseStyle?: string;
|
|
24
|
+
colsRamp?: Partial<Record<number, string>>;
|
|
25
|
+
cols?: Partial<Record<Breakpoint, Record<number, string>>>;
|
|
26
|
+
gaps?: Partial<Record<GridGap, string>>;
|
|
27
|
+
flow?: Partial<Record<GridFlow, string>>;
|
|
28
|
+
align?: Partial<Record<GridAlign, string>>;
|
|
29
|
+
justify?: Partial<Record<GridJustify, string>>;
|
|
30
|
+
}
|
|
31
|
+
export interface GridProps extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
+
/**
|
|
33
|
+
* Columns: a number (mobile-safe auto-ramp) or a per-breakpoint map.
|
|
34
|
+
*
|
|
35
|
+
* A number is NOT a literal column count on every screen — it expands through
|
|
36
|
+
* a mobile-first responsive ramp, e.g. `cols={3}` renders 1 column on mobile,
|
|
37
|
+
* 2 from `sm`, and 3 from `lg`. Use a per-breakpoint map
|
|
38
|
+
* (`cols={{ base: 3 }}` or `{ base: 1, md: 2, lg: 3 }`) for explicit control.
|
|
39
|
+
* @default 1
|
|
40
|
+
*/
|
|
41
|
+
cols?: GridCols;
|
|
42
|
+
/**
|
|
43
|
+
* Gap between grid cells (Tailwind spacing scale → gap-N).
|
|
44
|
+
* @default 4
|
|
45
|
+
*/
|
|
46
|
+
gap?: GridGap;
|
|
47
|
+
/** Grid auto-flow direction. */
|
|
48
|
+
flow?: GridFlow;
|
|
49
|
+
/** align-items within cells. */
|
|
50
|
+
align?: GridAlign;
|
|
51
|
+
/** justify-content of tracks. */
|
|
52
|
+
justify?: GridJustify;
|
|
53
|
+
/** Custom class name (always wins). */
|
|
54
|
+
className?: string;
|
|
55
|
+
/** Component-level theme overrides. */
|
|
56
|
+
theme?: GridThemeOverrides;
|
|
57
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useMemo } from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { sectionTheme } from './Section.theme.js';
|
|
5
|
+
|
|
6
|
+
const Section = React__default.forwardRef(({ title, subtitle, actions, gap = 4, className, theme: customTheme = {}, children, ...props }, ref) => {
|
|
7
|
+
const headingId = React__default.useId();
|
|
8
|
+
const theme = useMemo(() => ({
|
|
9
|
+
...sectionTheme,
|
|
10
|
+
...customTheme,
|
|
11
|
+
bodyGaps: { ...sectionTheme.bodyGaps, ...customTheme.bodyGaps },
|
|
12
|
+
}), [customTheme]);
|
|
13
|
+
const hasHeader = Boolean(title || subtitle || actions);
|
|
14
|
+
return (jsxs("section", { ref: ref, className: cn(theme.baseStyle, className), "aria-labelledby": title ? headingId : undefined, ...props, children: [hasHeader && (jsxs("div", { className: theme.header, children: [jsxs("div", { children: [title && jsx("h2", { id: headingId, className: theme.title, children: title }), subtitle && jsx("p", { className: theme.subtitle, children: subtitle })] }), actions && jsx("div", { className: theme.actions, children: actions })] })), children != null && (jsx("div", { className: cn(hasHeader && theme.bodyGaps[gap]), children: children }))] }));
|
|
15
|
+
});
|
|
16
|
+
Section.displayName = "Section";
|
|
17
|
+
|
|
18
|
+
export { Section };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const sectionTheme = {
|
|
2
|
+
baseStyle: "block",
|
|
3
|
+
header: "flex items-start justify-between gap-4",
|
|
4
|
+
title: "text-base font-semibold text-[var(--color-text-primary)]",
|
|
5
|
+
subtitle: "mt-0.5 text-sm text-[var(--color-text-secondary)]",
|
|
6
|
+
actions: "flex shrink-0 items-center gap-2",
|
|
7
|
+
bodyGaps: { 0: "mt-0", 1: "mt-1", 2: "mt-2", 3: "mt-3", 4: "mt-4", 5: "mt-5", 6: "mt-6", 8: "mt-8", 10: "mt-10", 12: "mt-12" },
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { sectionTheme };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { GridGap } from "../Grid/Grid.types";
|
|
3
|
+
export interface SectionTheme {
|
|
4
|
+
baseStyle: string;
|
|
5
|
+
header: string;
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle: string;
|
|
8
|
+
actions: string;
|
|
9
|
+
/** Spacing (margin-top) between the header and the body. */
|
|
10
|
+
bodyGaps: Record<GridGap, string>;
|
|
11
|
+
}
|
|
12
|
+
export interface SectionThemeOverrides {
|
|
13
|
+
baseStyle?: string;
|
|
14
|
+
header?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
subtitle?: string;
|
|
17
|
+
actions?: string;
|
|
18
|
+
bodyGaps?: Partial<Record<GridGap, string>>;
|
|
19
|
+
}
|
|
20
|
+
export interface SectionProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
21
|
+
/** Section heading. */
|
|
22
|
+
title?: ReactNode;
|
|
23
|
+
/** Secondary line under the title. */
|
|
24
|
+
subtitle?: ReactNode;
|
|
25
|
+
/** Right-aligned actions in the header row. */
|
|
26
|
+
actions?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Spacing between the header and the body (Tailwind spacing scale → mt-N).
|
|
29
|
+
* @default 4
|
|
30
|
+
*/
|
|
31
|
+
gap?: GridGap;
|
|
32
|
+
className?: string;
|
|
33
|
+
theme?: SectionThemeOverrides;
|
|
34
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React__default, { useMemo } from 'react';
|
|
3
|
+
import { cn } from '../../../utils/cn.js';
|
|
4
|
+
import { stackTheme } from './Stack.theme.js';
|
|
5
|
+
|
|
6
|
+
const Stack = React__default.forwardRef(({ direction = "col", gap = 4, align, justify, wrap = false, className, theme: customTheme = {}, ...props }, ref) => {
|
|
7
|
+
const theme = useMemo(() => ({
|
|
8
|
+
...stackTheme,
|
|
9
|
+
...customTheme,
|
|
10
|
+
direction: { ...stackTheme.direction, ...customTheme.direction },
|
|
11
|
+
gaps: { ...stackTheme.gaps, ...customTheme.gaps },
|
|
12
|
+
align: { ...stackTheme.align, ...customTheme.align },
|
|
13
|
+
justify: { ...stackTheme.justify, ...customTheme.justify },
|
|
14
|
+
}), [customTheme]);
|
|
15
|
+
return (jsx("div", { ref: ref, className: cn(theme.baseStyle, theme.direction[direction], theme.gaps[gap], align && theme.align[align], justify && theme.justify[justify], wrap && theme.wrap, className), ...props }));
|
|
16
|
+
});
|
|
17
|
+
Stack.displayName = "Stack";
|
|
18
|
+
|
|
19
|
+
export { Stack };
|