@lattice-php/lattice 0.19.0 → 0.20.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/dist/core/index.js +2 -2
- package/dist/core/types.d.ts +16 -4
- package/dist/create-app.d.ts +31 -3
- package/dist/create-app.js +48 -10
- package/dist/create-app.js.map +1 -1
- package/dist/effects/registry.d.ts +3 -3
- package/dist/effects/registry.js +4 -4
- package/dist/effects/registry.js.map +1 -1
- package/dist/form/components/base/field.d.ts +2 -2
- package/dist/form/components/base/field.js +2 -2
- package/dist/form/components/base/field.js.map +1 -1
- package/dist/form/components/fields/color-picker-field.d.ts +2 -0
- package/dist/form/components/fields/color-picker-field.js +57 -0
- package/dist/form/components/fields/color-picker-field.js.map +1 -0
- package/dist/form/components/fields/date-input.js +1 -1
- package/dist/form/components/fields/date-picker-field.js +1 -1
- package/dist/form/components/fields/date-time-input.js +1 -1
- package/dist/form/components/fields/file-upload.js +7 -12
- package/dist/form/components/fields/file-upload.js.map +1 -1
- package/dist/form/components/fields/number-input.js +1 -1
- package/dist/form/components/fields/rich-editor-field.js +35 -276
- package/dist/form/components/fields/rich-editor-field.js.map +1 -1
- package/dist/form/components/fields/row-action-menu.js +2 -2
- package/dist/form/components/fields/row-action-menu.js.map +1 -1
- package/dist/form/components/fields/row-actions.js +3 -1
- package/dist/form/components/fields/row-actions.js.map +1 -1
- package/dist/form/components/fields/select.js +59 -16
- package/dist/form/components/fields/select.js.map +1 -1
- package/dist/form/components/fields/table-rows.js +2 -2
- package/dist/form/components/fields/table-rows.js.map +1 -1
- package/dist/form/components/fields/text-input.js +8 -1
- package/dist/form/components/fields/text-input.js.map +1 -1
- package/dist/form/components/fields/time-input.js +1 -1
- package/dist/form/components/index.d.ts +1 -0
- package/dist/form/components/index.js +2 -1
- package/dist/form/embed.d.ts +1 -0
- package/dist/form/embed.js +2 -1
- package/dist/form/hooks/use-form-resolver.js.map +1 -1
- package/dist/form/index.js +2 -1
- package/dist/form/lib/conditions.d.ts +4 -10
- package/dist/form/lib/conditions.js.map +1 -1
- package/dist/form/lib/field-props.d.ts +4 -18
- package/dist/form/lib/field-props.js.map +1 -1
- package/dist/form/plugin.js +2 -0
- package/dist/form/plugin.js.map +1 -1
- package/dist/form/rich-editor/builtins.d.ts +6 -0
- package/dist/form/rich-editor/builtins.js +400 -0
- package/dist/form/rich-editor/builtins.js.map +1 -0
- package/dist/form/rich-editor/index.d.ts +7 -0
- package/dist/form/rich-editor/index.js +3 -0
- package/dist/form/rich-editor/registry.d.ts +67 -0
- package/dist/form/rich-editor/registry.js +79 -0
- package/dist/form/rich-editor/registry.js.map +1 -0
- package/dist/form/rich-editor/toolbar-button.d.ts +12 -0
- package/dist/form/rich-editor/toolbar-button.js +28 -0
- package/dist/form/rich-editor/toolbar-button.js.map +1 -0
- package/dist/form/types.d.ts +1 -6
- package/dist/format/date-time.d.ts +3 -2
- package/dist/format/date-time.js.map +1 -1
- package/dist/i18n/backend.js +1 -1
- package/dist/i18n/date-time.d.ts +3 -2
- package/dist/i18n/date-time.js.map +1 -1
- package/dist/i18n/index.js +3 -2
- package/dist/i18n/instance.js +1 -1
- package/dist/i18n/page-props.d.ts +3 -2
- package/dist/i18n/page-props.js +1 -15
- package/dist/i18n/page-props.js.map +1 -1
- package/dist/i18n/shared-props.d.ts +7 -0
- package/dist/i18n/shared-props.js +25 -0
- package/dist/i18n/shared-props.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +7 -6
- package/dist/lattice.css +107 -47
- package/dist/layout/components/breadcrumbs.js +3 -1
- package/dist/layout/components/breadcrumbs.js.map +1 -1
- package/dist/layout/components/callouts.js +1 -1
- package/dist/lib/color.d.ts +9 -0
- package/dist/lib/color.js +48 -0
- package/dist/lib/color.js.map +1 -0
- package/dist/notifications/api.d.ts +6 -6
- package/dist/notifications/api.js.map +1 -1
- package/dist/notifications/types.d.ts +2 -10
- package/dist/provider-base.js +1 -1
- package/dist/realtime/build-effects.js +5 -5
- package/dist/realtime/build-effects.js.map +1 -1
- package/dist/realtime/listeners.d.ts +2 -2
- package/dist/realtime/listeners.js.map +1 -1
- package/dist/realtime/subscriptions.d.ts +2 -2
- package/dist/realtime/subscriptions.js.map +1 -1
- package/dist/table/components/bulk-bar.js +5 -5
- package/dist/table/components/bulk-bar.js.map +1 -1
- package/dist/table/components/cells/badge-cell.js +4 -1
- package/dist/table/components/cells/badge-cell.js.map +1 -1
- package/dist/table/components/cells/boolean-cell.js +3 -1
- package/dist/table/components/cells/boolean-cell.js.map +1 -1
- package/dist/table/components/cells/icon-cell.js +5 -2
- package/dist/table/components/cells/icon-cell.js.map +1 -1
- package/dist/table/components/cells/image-cell.js +8 -9
- package/dist/table/components/cells/image-cell.js.map +1 -1
- package/dist/table/components/cells/money-cell.js +9 -1
- package/dist/table/components/cells/money-cell.js.map +1 -1
- package/dist/table/components/cells/number-cell.js +9 -1
- package/dist/table/components/cells/number-cell.js.map +1 -1
- package/dist/table/components/cells/text-cell.js +4 -1
- package/dist/table/components/cells/text-cell.js.map +1 -1
- package/dist/table/components/column-filter-control.js +25 -32
- package/dist/table/components/column-filter-control.js.map +1 -1
- package/dist/table/components/column-header.d.ts +3 -3
- package/dist/table/components/column-header.js +5 -3
- package/dist/table/components/column-header.js.map +1 -1
- package/dist/table/components/column-visibility-menu.js +6 -11
- package/dist/table/components/column-visibility-menu.js.map +1 -1
- package/dist/table/components/filter-bar.d.ts +2 -2
- package/dist/table/components/filter-bar.js +13 -22
- package/dist/table/components/filter-bar.js.map +1 -1
- package/dist/table/components/filter-controls.d.ts +2 -1
- package/dist/table/components/filter-controls.js +36 -35
- package/dist/table/components/filter-controls.js.map +1 -1
- package/dist/table/components/filter-value-input.d.ts +0 -1
- package/dist/table/components/filter-value-input.js +21 -20
- package/dist/table/components/filter-value-input.js.map +1 -1
- package/dist/table/components/pagination.js +16 -20
- package/dist/table/components/pagination.js.map +1 -1
- package/dist/table/components/sort-bar.d.ts +3 -3
- package/dist/table/components/sort-bar.js +11 -12
- package/dist/table/components/sort-bar.js.map +1 -1
- package/dist/table/components/table-search.d.ts +9 -0
- package/dist/table/components/table-search.js +75 -0
- package/dist/table/components/table-search.js.map +1 -0
- package/dist/table/components/table.js +72 -19
- package/dist/table/components/table.js.map +1 -1
- package/dist/table/hooks/use-expanded-rows.d.ts +8 -0
- package/dist/table/hooks/use-expanded-rows.js +24 -0
- package/dist/table/hooks/use-expanded-rows.js.map +1 -0
- package/dist/table/hooks/use-table.d.ts +5 -3
- package/dist/table/hooks/use-table.js +56 -44
- package/dist/table/hooks/use-table.js.map +1 -1
- package/dist/table/lib/payload.d.ts +3 -2
- package/dist/table/lib/payload.js +16 -10
- package/dist/table/lib/payload.js.map +1 -1
- package/dist/table/lib/query.d.ts +5 -5
- package/dist/table/lib/query.js +20 -18
- package/dist/table/lib/query.js.map +1 -1
- package/dist/table/types.d.ts +3 -26
- package/dist/toast/callout.js +1 -3
- package/dist/toast/callout.js.map +1 -1
- package/dist/toast/toast.d.ts +1 -5
- package/dist/toast/toast.js +2 -7
- package/dist/toast/toast.js.map +1 -1
- package/dist/toast/toaster.js +2 -2
- package/dist/toast/toaster.js.map +1 -1
- package/dist/types/generated.d.ts +263 -188
- package/dist/ui/affix-group.d.ts +2 -1
- package/dist/ui/affix-group.js +9 -7
- package/dist/ui/affix-group.js.map +1 -1
- package/dist/ui/avatar.d.ts +3 -0
- package/dist/ui/avatar.js +52 -0
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/button.d.ts +3 -1
- package/dist/ui/button.js +10 -3
- package/dist/ui/button.js.map +1 -1
- package/dist/ui/chart-view.js +161 -11
- package/dist/ui/chart-view.js.map +1 -1
- package/dist/ui/click-behavior.d.ts +1 -1
- package/dist/ui/click-behavior.js.map +1 -1
- package/dist/ui/color-picker.d.ts +8 -0
- package/dist/ui/color-picker.js +59 -0
- package/dist/ui/color-picker.js.map +1 -0
- package/dist/ui/combobox.d.ts +11 -2
- package/dist/ui/combobox.js +51 -8
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/copyable-text.d.ts +7 -0
- package/dist/ui/copyable-text.js +21 -13
- package/dist/ui/copyable-text.js.map +1 -1
- package/dist/ui/fragment.js.map +1 -1
- package/dist/ui/heading.js +39 -21
- package/dist/ui/heading.js.map +1 -1
- package/dist/ui/icon-button.d.ts +22 -0
- package/dist/ui/icon-button.js +51 -0
- package/dist/ui/icon-button.js.map +1 -0
- package/dist/ui/icon.js +10 -11
- package/dist/ui/icon.js.map +1 -1
- package/dist/ui/image-preview.d.ts +12 -0
- package/dist/ui/image-preview.js +65 -0
- package/dist/ui/image-preview.js.map +1 -0
- package/dist/ui/image.d.ts +3 -0
- package/dist/ui/image.js +21 -0
- package/dist/ui/image.js.map +1 -0
- package/dist/ui/index.d.ts +2 -1
- package/dist/ui/index.js +4 -3
- package/dist/ui/info-tooltip.js +1 -1
- package/dist/ui/info-tooltip.js.map +1 -1
- package/dist/ui/input.d.ts +3 -1
- package/dist/ui/input.js +2 -2
- package/dist/ui/input.js.map +1 -1
- package/dist/ui/modal.js +14 -2
- package/dist/ui/modal.js.map +1 -1
- package/dist/ui/native-select.d.ts +10 -0
- package/dist/ui/native-select.js +23 -0
- package/dist/ui/native-select.js.map +1 -0
- package/dist/ui/plugin.js +11 -1
- package/dist/ui/plugin.js.map +1 -1
- package/dist/ui/progress.d.ts +3 -0
- package/dist/ui/progress.js +114 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/separator.d.ts +3 -0
- package/dist/ui/separator.js +15 -0
- package/dist/ui/separator.js.map +1 -0
- package/dist/ui/text.js +5 -10
- package/dist/ui/text.js.map +1 -1
- package/dist/ui/tree-context.d.ts +33 -0
- package/dist/ui/tree-context.js +137 -0
- package/dist/ui/tree-context.js.map +1 -0
- package/dist/ui/tree.d.ts +19 -0
- package/dist/ui/tree.js +187 -0
- package/dist/ui/tree.js.map +1 -0
- package/dist-standalone/chunks/chart-view-wJmnVu7L.js +36 -0
- package/dist-standalone/chunks/date-picker-field-VbH9xrQO.js +1 -0
- package/dist-standalone/chunks/jsx-runtime-Drll_-DD.js +1 -0
- package/dist-standalone/chunks/locale-CXqr7LPR.js +1 -0
- package/dist-standalone/chunks/page-props-AIa5UR6n.js +1 -0
- package/dist-standalone/chunks/rich-editor-field-DLQTyt36.js +154 -0
- package/dist-standalone/chunks/{subscriptions-B3UuDBmx.js → subscriptions-DY2tj9Im.js} +1 -1
- package/dist-standalone/chunks/use-effect-dispatcher-feEs0GCP.js +97 -0
- package/dist-standalone/lattice.css +1 -1
- package/dist-standalone/lattice.js +15 -15
- package/dist-standalone/manifest.json +11 -9
- package/dist-standalone/sprite.svg +1 -1
- package/package.json +6 -1
- package/resources/icons/code-xml.svg +17 -0
- package/resources/icons/heading.svg +17 -0
- package/dist-standalone/chunks/chart-view-CK5fKIkR.js +0 -36
- package/dist-standalone/chunks/date-picker-field-BlCPFhZd.js +0 -1
- package/dist-standalone/chunks/jsx-runtime-CJ_btYLc.js +0 -1
- package/dist-standalone/chunks/rich-editor-field-DH5dS5c1.js +0 -154
- package/dist-standalone/chunks/use-effect-dispatcher-k98Nzf9M.js +0 -97
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useT } from "../i18n/instance.js";
|
|
2
|
+
import { Button } from "./button.js";
|
|
3
|
+
import { Dialog, DialogClose, DialogContent, DialogTitle } from "./dialog.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region resources/js/ui/image-preview.tsx
|
|
7
|
+
function PreviewableImage({ src, alt, previewable, width, height, className, testId }) {
|
|
8
|
+
const { t } = useT("lattice");
|
|
9
|
+
const [open, setOpen] = useState(false);
|
|
10
|
+
const image = /* @__PURE__ */ jsx("img", {
|
|
11
|
+
alt,
|
|
12
|
+
src,
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
className,
|
|
16
|
+
style: width ? {
|
|
17
|
+
width,
|
|
18
|
+
height
|
|
19
|
+
} : void 0
|
|
20
|
+
});
|
|
21
|
+
if (!previewable) return image;
|
|
22
|
+
const openLabel = t("common.image.open-preview", "View image");
|
|
23
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("button", {
|
|
24
|
+
type: "button",
|
|
25
|
+
"data-test": testId,
|
|
26
|
+
className: "cursor-zoom-in",
|
|
27
|
+
"aria-label": openLabel,
|
|
28
|
+
onClick: () => setOpen(true),
|
|
29
|
+
children: image
|
|
30
|
+
}), /* @__PURE__ */ jsx(Dialog, {
|
|
31
|
+
open,
|
|
32
|
+
onOpenChange: setOpen,
|
|
33
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
34
|
+
"aria-describedby": void 0,
|
|
35
|
+
className: "max-h-[90vh] max-w-[90vw] border-none bg-transparent p-0 shadow-none",
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ jsx(DialogTitle, {
|
|
38
|
+
className: "sr-only",
|
|
39
|
+
children: alt || openLabel
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx("img", {
|
|
42
|
+
alt,
|
|
43
|
+
src,
|
|
44
|
+
"data-slot": "image-lightbox",
|
|
45
|
+
className: "max-h-[90vh] max-w-[90vw] rounded-lt object-contain"
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsx(DialogClose, {
|
|
48
|
+
asChild: true,
|
|
49
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
50
|
+
icon: "x",
|
|
51
|
+
"aria-label": t("common.close", "Close"),
|
|
52
|
+
"data-test": "lightbox-close",
|
|
53
|
+
size: "icon",
|
|
54
|
+
variant: "ghost",
|
|
55
|
+
className: "absolute top-2 right-2 bg-lt-bg/80 hover:bg-lt-bg"
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
})] });
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { PreviewableImage };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=image-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-preview.js","names":[],"sources":["../../resources/js/ui/image-preview.tsx"],"sourcesContent":["import { useT } from \"@lattice-php/lattice/i18n\";\nimport { type ReactNode, useState } from \"react\";\nimport { Button } from \"@lattice-php/lattice/ui/button\";\nimport { Dialog, DialogClose, DialogContent, DialogTitle } from \"./dialog\";\n\ninterface PreviewableImageProps {\n src: string;\n alt: string;\n previewable: boolean;\n width?: number;\n height?: number;\n className?: string;\n testId?: string;\n}\n\nexport function PreviewableImage({\n src,\n alt,\n previewable,\n width,\n height,\n className,\n testId,\n}: PreviewableImageProps): ReactNode {\n const { t } = useT(\"lattice\");\n const [open, setOpen] = useState(false);\n\n const image = (\n <img\n alt={alt}\n src={src}\n width={width}\n height={height}\n className={className}\n style={width ? { width, height } : undefined}\n />\n );\n\n if (!previewable) {\n return image;\n }\n\n const openLabel = t(\"common.image.open-preview\", \"View image\");\n\n return (\n <>\n <button\n type=\"button\"\n data-test={testId}\n className=\"cursor-zoom-in\"\n aria-label={openLabel}\n onClick={() => setOpen(true)}\n >\n {image}\n </button>\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogContent\n aria-describedby={undefined}\n className=\"max-h-[90vh] max-w-[90vw] border-none bg-transparent p-0 shadow-none\"\n >\n <DialogTitle className=\"sr-only\">{alt || openLabel}</DialogTitle>\n <img\n alt={alt}\n src={src}\n data-slot=\"image-lightbox\"\n className=\"max-h-[90vh] max-w-[90vw] rounded-lt object-contain\"\n />\n <DialogClose asChild>\n <Button\n icon=\"x\"\n aria-label={t(\"common.close\", \"Close\")}\n data-test=\"lightbox-close\"\n size=\"icon\"\n variant=\"ghost\"\n className=\"absolute top-2 right-2 bg-lt-bg/80 hover:bg-lt-bg\"\n />\n </DialogClose>\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"mappings":";;;;;;AAeA,SAAgB,iBAAiB,EAC/B,KACA,KACA,aACA,OACA,QACA,WACA,UACmC;CACnC,MAAM,EAAE,MAAM,KAAK,SAAS;CAC5B,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CAEtC,MAAM,QACJ,oBAAC,OAAD;EACO;EACA;EACE;EACC;EACG;EACX,OAAO,QAAQ;GAAE;GAAO;EAAO,IAAI,KAAA;CACpC,CAAA;CAGH,IAAI,CAAC,aACH,OAAO;CAGT,MAAM,YAAY,EAAE,6BAA6B,YAAY;CAE7D,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,UAAD;EACE,MAAK;EACL,aAAW;EACX,WAAU;EACV,cAAY;EACZ,eAAe,QAAQ,IAAI;YAE1B;CACK,CAAA,GACR,oBAAC,QAAD;EAAc;EAAM,cAAc;YAChC,qBAAC,eAAD;GACE,oBAAkB,KAAA;GAClB,WAAU;aAFZ;IAIE,oBAAC,aAAD;KAAa,WAAU;eAAW,OAAO;IAAuB,CAAA;IAChE,oBAAC,OAAD;KACO;KACA;KACL,aAAU;KACV,WAAU;IACX,CAAA;IACD,oBAAC,aAAD;KAAa,SAAA;eACX,oBAAC,QAAD;MACE,MAAK;MACL,cAAY,EAAE,gBAAgB,OAAO;MACrC,aAAU;MACV,MAAK;MACL,SAAQ;MACR,WAAU;KACX,CAAA;IACU,CAAA;GACA;;CACT,CAAA,CACR,EAAA,CAAA;AAEN"}
|
package/dist/ui/image.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { nodeIdentity } from "../core/test-id.js";
|
|
3
|
+
import { PreviewableImage } from "./image-preview.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region resources/js/ui/image.tsx
|
|
6
|
+
var ImageComponent = ({ node }) => {
|
|
7
|
+
const { src, alt, size, circular, previewable } = node.props;
|
|
8
|
+
return /* @__PURE__ */ jsx(PreviewableImage, {
|
|
9
|
+
alt: alt ?? "",
|
|
10
|
+
className: cn("object-cover", circular ? "rounded-full" : "rounded-lt-sm"),
|
|
11
|
+
height: size ?? void 0,
|
|
12
|
+
previewable,
|
|
13
|
+
src,
|
|
14
|
+
testId: nodeIdentity(node),
|
|
15
|
+
width: size ?? void 0
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { ImageComponent as default };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","names":[],"sources":["../../resources/js/ui/image.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport { nodeIdentity } from \"@lattice-php/lattice/core/test-id\";\nimport { PreviewableImage } from \"./image-preview\";\n\nconst ImageComponent: RendererComponent<\"image\"> = ({ node }) => {\n const { src, alt, size, circular, previewable } = node.props;\n\n return (\n <PreviewableImage\n alt={alt ?? \"\"}\n className={cn(\"object-cover\", circular ? \"rounded-full\" : \"rounded-lt-sm\")}\n height={size ?? undefined}\n previewable={previewable}\n src={src}\n testId={nodeIdentity(node)}\n width={size ?? undefined}\n />\n );\n};\n\nexport default ImageComponent;\n"],"mappings":";;;;;AAKA,IAAM,kBAA8C,EAAE,WAAW;CAC/D,MAAM,EAAE,KAAK,KAAK,MAAM,UAAU,gBAAgB,KAAK;CAEvD,OACE,oBAAC,kBAAD;EACE,KAAK,OAAO;EACZ,WAAW,GAAG,gBAAgB,WAAW,iBAAiB,eAAe;EACzE,QAAQ,QAAQ,KAAA;EACH;EACR;EACL,QAAQ,aAAa,IAAI;EACzB,OAAO,QAAQ,KAAA;CAChB,CAAA;AAEL"}
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -10,8 +10,9 @@ export { ConfirmDialog } from './confirm-dialog.js';
|
|
|
10
10
|
export { ActionTrigger, ActionTriggerProvider, useActionTrigger, useClickBehavior, } from './click-behavior.js';
|
|
11
11
|
export type { ActionTriggerRenderer, ClickBehavior, TriggerState } from './click-behavior.js';
|
|
12
12
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from './dialog.js';
|
|
13
|
-
export { CopyableText, copyToClipboard } from './copyable-text.js';
|
|
13
|
+
export { CopyButton, CopyableText, copyToClipboard } from './copyable-text.js';
|
|
14
14
|
export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from './dropdown-menu.js';
|
|
15
|
+
export { PreviewableImage } from './image-preview.js';
|
|
15
16
|
export { InfoTooltip } from './info-tooltip.js';
|
|
16
17
|
export { Input } from './input.js';
|
|
17
18
|
export { default as InputError } from './input-error.js';
|
package/dist/ui/index.js
CHANGED
|
@@ -10,17 +10,18 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigge
|
|
|
10
10
|
import { Badge, badgeVariants } from "./badge.js";
|
|
11
11
|
import { InfoTooltip } from "./info-tooltip.js";
|
|
12
12
|
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./card.js";
|
|
13
|
+
import { CopyButton, CopyableText, copyToClipboard } from "./copyable-text.js";
|
|
14
|
+
import { PreviewableImage } from "./image-preview.js";
|
|
13
15
|
import { TextLink } from "./link.js";
|
|
14
16
|
import { SegmentedPills } from "./segmented-pills.js";
|
|
15
|
-
import { CopyableText, copyToClipboard } from "./copyable-text.js";
|
|
16
17
|
import { uiComponents } from "./plugin.js";
|
|
17
18
|
import InputError from "./input-error.js";
|
|
18
19
|
import { Label } from "./label.js";
|
|
19
20
|
import { Checkbox } from "./checkbox.js";
|
|
20
|
-
import { AffixGroup } from "./affix-group.js";
|
|
21
21
|
import { Input } from "./input.js";
|
|
22
|
+
import { AffixGroup } from "./affix-group.js";
|
|
22
23
|
import { InputOTP } from "./input-otp.js";
|
|
23
24
|
import PasswordInput from "./password-input.js";
|
|
24
25
|
import { Combobox } from "./combobox.js";
|
|
25
26
|
import { Textarea } from "./textarea.js";
|
|
26
|
-
export { ActionMenuProvider, ActionTrigger, ActionTriggerProvider, AffixGroup, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, ConfirmDialog, CopyableText, Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, InfoTooltip, Input, InputError, InputOTP, Label, PasswordInput, Popover, PopoverClose, PopoverContent, PopoverTrigger, SegmentedPills, Skeleton, Spinner, TextLink, Textarea, actionMenuItemClassName, badgeVariants, buttonVariants, copyToClipboard, uiComponents, useActionMenu, useActionTrigger, useClickBehavior };
|
|
27
|
+
export { ActionMenuProvider, ActionTrigger, ActionTriggerProvider, AffixGroup, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, ConfirmDialog, CopyButton, CopyableText, Dialog, DialogClose, DialogContent, DialogDescription, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, InfoTooltip, Input, InputError, InputOTP, Label, PasswordInput, Popover, PopoverClose, PopoverContent, PopoverTrigger, PreviewableImage, SegmentedPills, Skeleton, Spinner, TextLink, Textarea, actionMenuItemClassName, badgeVariants, buttonVariants, copyToClipboard, uiComponents, useActionMenu, useActionTrigger, useClickBehavior };
|
package/dist/ui/info-tooltip.js
CHANGED
|
@@ -8,7 +8,7 @@ function InfoTooltip({ content }) {
|
|
|
8
8
|
if (!content) return null;
|
|
9
9
|
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
10
10
|
type: "button",
|
|
11
|
-
"aria-label": t("common.
|
|
11
|
+
"aria-label": t("common.more-info", "More information"),
|
|
12
12
|
className: "ml-1 inline-flex rounded-lt-sm text-lt-muted-fg outline-none hover:text-lt-fg focus-visible:text-lt-fg focus-visible:ring-lt-ring/50 focus-visible:ring-[3px]",
|
|
13
13
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
14
14
|
name: "info",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-tooltip.js","names":[],"sources":["../../resources/js/ui/info-tooltip.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\nexport function InfoTooltip({ content }: { content?: string | null }) {\n const { t } = useT(\"lattice\");\n\n if (!content) {\n return null;\n }\n\n return (\n <Popover>\n <PopoverTrigger\n type=\"button\"\n aria-label={t(\"common.
|
|
1
|
+
{"version":3,"file":"info-tooltip.js","names":[],"sources":["../../resources/js/ui/info-tooltip.tsx"],"sourcesContent":["import { Icon } from \"@lattice-php/lattice/icons\";\nimport { useT } from \"@lattice-php/lattice/i18n\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"./popover\";\n\nexport function InfoTooltip({ content }: { content?: string | null }) {\n const { t } = useT(\"lattice\");\n\n if (!content) {\n return null;\n }\n\n return (\n <Popover>\n <PopoverTrigger\n type=\"button\"\n aria-label={t(\"common.more-info\", \"More information\")}\n className=\"ml-1 inline-flex rounded-lt-sm text-lt-muted-fg outline-none hover:text-lt-fg focus-visible:text-lt-fg focus-visible:ring-lt-ring/50 focus-visible:ring-[3px]\"\n >\n <Icon name=\"info\" className=\"size-lt-icon-sm\" />\n </PopoverTrigger>\n <PopoverContent\n align=\"start\"\n className=\"max-w-xs p-3 text-sm [&_a]:underline\"\n dangerouslySetInnerHTML={{ __html: content }}\n />\n </Popover>\n );\n}\n"],"mappings":";;;;;AAIA,SAAgB,YAAY,EAAE,WAAwC;CACpE,MAAM,EAAE,MAAM,KAAK,SAAS;CAE5B,IAAI,CAAC,SACH,OAAO;CAGT,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,MAAK;EACL,cAAY,EAAE,oBAAoB,kBAAkB;EACpD,WAAU;YAEV,oBAAC,MAAD;GAAM,MAAK;GAAO,WAAU;EAAmB,CAAA;CACjC,CAAA,GAChB,oBAAC,gBAAD;EACE,OAAM;EACN,WAAU;EACV,yBAAyB,EAAE,QAAQ,QAAQ;CAC5C,CAAA,CACM,EAAA,CAAA;AAEb"}
|
package/dist/ui/input.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { controlSurface } from './control.js';
|
|
1
3
|
import * as React from "react";
|
|
2
|
-
declare function Input({ className, type, ...props }: React.ComponentProps<"input">): React.JSX.Element;
|
|
4
|
+
declare function Input({ className, type, density, ...props }: React.ComponentProps<"input"> & VariantProps<typeof controlSurface>): React.JSX.Element;
|
|
3
5
|
export { Input };
|
package/dist/ui/input.js
CHANGED
|
@@ -3,11 +3,11 @@ import { controlSurface } from "./control.js";
|
|
|
3
3
|
import "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region resources/js/ui/input.tsx
|
|
6
|
-
function Input({ className, type, ...props }) {
|
|
6
|
+
function Input({ className, type, density, ...props }) {
|
|
7
7
|
return /* @__PURE__ */ jsx("input", {
|
|
8
8
|
type,
|
|
9
9
|
"data-slot": "input",
|
|
10
|
-
className: cn(controlSurface(), "file:text-lt-fg selection:bg-lt-primary selection:text-lt-primary-fg file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium", className),
|
|
10
|
+
className: cn(controlSurface({ density }), "file:text-lt-fg selection:bg-lt-primary selection:text-lt-primary-fg file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium", className),
|
|
11
11
|
...props
|
|
12
12
|
});
|
|
13
13
|
}
|
package/dist/ui/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","names":[],"sources":["../../resources/js/ui/input.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { controlSurface } from \"@lattice-php/lattice/ui/control\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nfunction Input({
|
|
1
|
+
{"version":3,"file":"input.js","names":[],"sources":["../../resources/js/ui/input.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { VariantProps } from \"class-variance-authority\";\n\nimport { controlSurface } from \"@lattice-php/lattice/ui/control\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nfunction Input({\n className,\n type,\n density,\n ...props\n}: React.ComponentProps<\"input\"> & VariantProps<typeof controlSurface>) {\n return (\n <input\n type={type}\n data-slot=\"input\"\n className={cn(\n controlSurface({ density }),\n \"file:text-lt-fg selection:bg-lt-primary selection:text-lt-primary-fg file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Input };\n"],"mappings":";;;;;AAMA,SAAS,MAAM,EACb,WACA,MACA,SACA,GAAG,SACmE;CACtE,OACE,oBAAC,SAAD;EACQ;EACN,aAAU;EACV,WAAW,GACT,eAAe,EAAE,QAAQ,CAAC,GAC1B,kKACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
package/dist/ui/modal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LATTICE_EVENT } from "../events/event-names.js";
|
|
2
2
|
import { Dialog, DialogContent, DialogHeader } from "./dialog.js";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
//#region resources/js/ui/modal.tsx
|
|
6
6
|
function matchesModal(event, modal) {
|
|
@@ -12,12 +12,17 @@ var ModalComponent = ({ children, node }) => {
|
|
|
12
12
|
const description = node.props.description;
|
|
13
13
|
const closeLabel = node.props.closeLabel;
|
|
14
14
|
const [isOpen, setIsOpen] = useState(node.props.open === true);
|
|
15
|
+
const openerRef = useRef(null);
|
|
16
|
+
const wasOpenRef = useRef(isOpen);
|
|
15
17
|
useEffect(() => {
|
|
16
18
|
if (node.props.open === true) setIsOpen(true);
|
|
17
19
|
}, [node.props.open]);
|
|
18
20
|
useEffect(() => {
|
|
19
21
|
function open(event) {
|
|
20
|
-
if (node.id && matchesModal(event, node.id))
|
|
22
|
+
if (node.id && matchesModal(event, node.id)) {
|
|
23
|
+
openerRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
24
|
+
setIsOpen(true);
|
|
25
|
+
}
|
|
21
26
|
}
|
|
22
27
|
function close(event) {
|
|
23
28
|
if (!node.id || matchesModal(event, node.id)) setIsOpen(false);
|
|
@@ -29,6 +34,13 @@ var ModalComponent = ({ children, node }) => {
|
|
|
29
34
|
window.removeEventListener(LATTICE_EVENT.closeModal, close);
|
|
30
35
|
};
|
|
31
36
|
}, [node.id]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (wasOpenRef.current && !isOpen) {
|
|
39
|
+
const opener = openerRef.current;
|
|
40
|
+
if (opener) requestAnimationFrame(() => opener.focus());
|
|
41
|
+
}
|
|
42
|
+
wasOpenRef.current = isOpen;
|
|
43
|
+
}, [isOpen]);
|
|
32
44
|
return /* @__PURE__ */ jsx(Dialog, {
|
|
33
45
|
open: isOpen,
|
|
34
46
|
onOpenChange: setIsOpen,
|
package/dist/ui/modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","names":[],"sources":["../../resources/js/ui/modal.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Dialog, DialogContent, DialogHeader } from \"@lattice-php/lattice/ui/dialog\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { LATTICE_EVENT } from \"@lattice-php/lattice/events/event-names\";\n\ntype ModalEvent = CustomEvent<{\n modal: string | null;\n}>;\n\nfunction matchesModal(event: Event, modal: string): boolean {\n const target = (event as ModalEvent).detail?.modal;\n\n return target == null || target === modal;\n}\n\nconst ModalComponent: RendererComponent<\"modal\"> = ({ children, node }) => {\n const title = node.props.title ?? \"Dialog\";\n const description = node.props.description;\n const closeLabel = node.props.closeLabel;\n const [isOpen, setIsOpen] = useState(node.props.open === true);\n\n // Honour server-driven open changes across re-renders, not just on mount. One\n // way on purpose: closing stays user/closeModal-driven so it never fights a\n // manual close, and the dep keeps it from re-firing while open stays true.\n useEffect(() => {\n if (node.props.open === true) {\n setIsOpen(true);\n }\n }, [node.props.open]);\n\n useEffect(() => {\n function open(event: Event): void {\n if (node.id && matchesModal(event, node.id)) {\n setIsOpen(true);\n }\n }\n\n function close(event: Event): void {\n if (!node.id || matchesModal(event, node.id)) {\n setIsOpen(false);\n }\n }\n\n window.addEventListener(LATTICE_EVENT.openModal, open);\n window.addEventListener(LATTICE_EVENT.closeModal, close);\n\n return () => {\n window.removeEventListener(LATTICE_EVENT.openModal, open);\n window.removeEventListener(LATTICE_EVENT.closeModal, close);\n };\n }, [node.id]);\n\n return (\n <Dialog open={isOpen} onOpenChange={setIsOpen}>\n <DialogContent\n {...(description ? {} : { \"aria-describedby\": undefined })}\n className=\"max-h-[min(680px,calc(100vh-2rem))] w-full max-w-lg overflow-y-auto\"\n >\n <DialogHeader closeLabel={closeLabel} description={description} title={title} />\n <div className=\"mt-6 space-y-6\">{children}</div>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport default ModalComponent;\n"],"mappings":";;;;;AASA,SAAS,aAAa,OAAc,OAAwB;CAC1D,MAAM,SAAU,MAAqB,QAAQ;CAE7C,OAAO,UAAU,QAAQ,WAAW;AACtC;AAEA,IAAM,kBAA8C,EAAE,UAAU,WAAW;CACzE,MAAM,QAAQ,KAAK,MAAM,SAAS;CAClC,MAAM,cAAc,KAAK,MAAM;CAC/B,MAAM,aAAa,KAAK,MAAM;CAC9B,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK,MAAM,SAAS,IAAI;
|
|
1
|
+
{"version":3,"file":"modal.js","names":[],"sources":["../../resources/js/ui/modal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport { Dialog, DialogContent, DialogHeader } from \"@lattice-php/lattice/ui/dialog\";\nimport type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { LATTICE_EVENT } from \"@lattice-php/lattice/events/event-names\";\n\ntype ModalEvent = CustomEvent<{\n modal: string | null;\n}>;\n\nfunction matchesModal(event: Event, modal: string): boolean {\n const target = (event as ModalEvent).detail?.modal;\n\n return target == null || target === modal;\n}\n\nconst ModalComponent: RendererComponent<\"modal\"> = ({ children, node }) => {\n const title = node.props.title ?? \"Dialog\";\n const description = node.props.description;\n const closeLabel = node.props.closeLabel;\n const [isOpen, setIsOpen] = useState(node.props.open === true);\n const openerRef = useRef<HTMLElement | null>(null);\n const wasOpenRef = useRef(isOpen);\n\n // Honour server-driven open changes across re-renders, not just on mount. One\n // way on purpose: closing stays user/closeModal-driven so it never fights a\n // manual close, and the dep keeps it from re-firing while open stays true.\n useEffect(() => {\n if (node.props.open === true) {\n setIsOpen(true);\n }\n }, [node.props.open]);\n\n useEffect(() => {\n function open(event: Event): void {\n if (node.id && matchesModal(event, node.id)) {\n openerRef.current =\n document.activeElement instanceof HTMLElement ? document.activeElement : null;\n setIsOpen(true);\n }\n }\n\n function close(event: Event): void {\n if (!node.id || matchesModal(event, node.id)) {\n setIsOpen(false);\n }\n }\n\n window.addEventListener(LATTICE_EVENT.openModal, open);\n window.addEventListener(LATTICE_EVENT.closeModal, close);\n\n return () => {\n window.removeEventListener(LATTICE_EVENT.openModal, open);\n window.removeEventListener(LATTICE_EVENT.closeModal, close);\n };\n }, [node.id]);\n\n // Radix only restores focus to a `DialogTrigger`-registered element, and this\n // modal is opened imperatively rather than through one. Own the restore\n // ourselves instead: whatever had focus when the modal opened gets it back\n // once the closing dialog has finished unmounting.\n useEffect(() => {\n if (wasOpenRef.current && !isOpen) {\n const opener = openerRef.current;\n\n if (opener) {\n requestAnimationFrame(() => opener.focus());\n }\n }\n\n wasOpenRef.current = isOpen;\n }, [isOpen]);\n\n return (\n <Dialog open={isOpen} onOpenChange={setIsOpen}>\n <DialogContent\n {...(description ? {} : { \"aria-describedby\": undefined })}\n className=\"max-h-[min(680px,calc(100vh-2rem))] w-full max-w-lg overflow-y-auto\"\n >\n <DialogHeader closeLabel={closeLabel} description={description} title={title} />\n <div className=\"mt-6 space-y-6\">{children}</div>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport default ModalComponent;\n"],"mappings":";;;;;AASA,SAAS,aAAa,OAAc,OAAwB;CAC1D,MAAM,SAAU,MAAqB,QAAQ;CAE7C,OAAO,UAAU,QAAQ,WAAW;AACtC;AAEA,IAAM,kBAA8C,EAAE,UAAU,WAAW;CACzE,MAAM,QAAQ,KAAK,MAAM,SAAS;CAClC,MAAM,cAAc,KAAK,MAAM;CAC/B,MAAM,aAAa,KAAK,MAAM;CAC9B,MAAM,CAAC,QAAQ,aAAa,SAAS,KAAK,MAAM,SAAS,IAAI;CAC7D,MAAM,YAAY,OAA2B,IAAI;CACjD,MAAM,aAAa,OAAO,MAAM;CAKhC,gBAAgB;EACd,IAAI,KAAK,MAAM,SAAS,MACtB,UAAU,IAAI;CAElB,GAAG,CAAC,KAAK,MAAM,IAAI,CAAC;CAEpB,gBAAgB;EACd,SAAS,KAAK,OAAoB;GAChC,IAAI,KAAK,MAAM,aAAa,OAAO,KAAK,EAAE,GAAG;IAC3C,UAAU,UACR,SAAS,yBAAyB,cAAc,SAAS,gBAAgB;IAC3E,UAAU,IAAI;GAChB;EACF;EAEA,SAAS,MAAM,OAAoB;GACjC,IAAI,CAAC,KAAK,MAAM,aAAa,OAAO,KAAK,EAAE,GACzC,UAAU,KAAK;EAEnB;EAEA,OAAO,iBAAiB,cAAc,WAAW,IAAI;EACrD,OAAO,iBAAiB,cAAc,YAAY,KAAK;EAEvD,aAAa;GACX,OAAO,oBAAoB,cAAc,WAAW,IAAI;GACxD,OAAO,oBAAoB,cAAc,YAAY,KAAK;EAC5D;CACF,GAAG,CAAC,KAAK,EAAE,CAAC;CAMZ,gBAAgB;EACd,IAAI,WAAW,WAAW,CAAC,QAAQ;GACjC,MAAM,SAAS,UAAU;GAEzB,IAAI,QACF,4BAA4B,OAAO,MAAM,CAAC;EAE9C;EAEA,WAAW,UAAU;CACvB,GAAG,CAAC,MAAM,CAAC;CAEX,OACE,oBAAC,QAAD;EAAQ,MAAM;EAAQ,cAAc;YAClC,qBAAC,eAAD;GACE,GAAK,cAAc,CAAC,IAAI,EAAE,oBAAoB,KAAA,EAAU;GACxD,WAAU;aAFZ,CAIE,oBAAC,cAAD;IAA0B;IAAyB;IAAoB;GAAQ,CAAA,GAC/E,oBAAC,OAAD;IAAK,WAAU;IAAkB;GAAc,CAAA,CAClC;;CACT,CAAA;AAEZ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { controlSurface } from './control.js';
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
/**
|
|
5
|
+
* A native `<select>` wearing the shared control chrome — for short, fixed
|
|
6
|
+
* option lists (filter operators, boolean/ternary states) where the full
|
|
7
|
+
* Combobox is overkill. `density` matches {@link Input}; defaults to comfortable.
|
|
8
|
+
*/
|
|
9
|
+
declare function NativeSelect({ className, density, children, ref, ...props }: React.ComponentProps<"select"> & VariantProps<typeof controlSurface>): React.JSX.Element;
|
|
10
|
+
export { NativeSelect };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { controlSurface } from "./control.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region resources/js/ui/native-select.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A native `<select>` wearing the shared control chrome — for short, fixed
|
|
8
|
+
* option lists (filter operators, boolean/ternary states) where the full
|
|
9
|
+
* Combobox is overkill. `density` matches {@link Input}; defaults to comfortable.
|
|
10
|
+
*/
|
|
11
|
+
function NativeSelect({ className, density, children, ref, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx("select", {
|
|
13
|
+
ref,
|
|
14
|
+
"data-slot": "native-select",
|
|
15
|
+
className: cn(controlSurface({ density }), "cursor-pointer", className),
|
|
16
|
+
...props,
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { NativeSelect };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=native-select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-select.js","names":[],"sources":["../../resources/js/ui/native-select.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { VariantProps } from \"class-variance-authority\";\n\nimport { controlSurface } from \"@lattice-php/lattice/ui/control\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\n/**\n * A native `<select>` wearing the shared control chrome — for short, fixed\n * option lists (filter operators, boolean/ternary states) where the full\n * Combobox is overkill. `density` matches {@link Input}; defaults to comfortable.\n */\nfunction NativeSelect({\n className,\n density,\n children,\n ref,\n ...props\n}: React.ComponentProps<\"select\"> & VariantProps<typeof controlSurface>) {\n return (\n <select\n ref={ref}\n data-slot=\"native-select\"\n className={cn(controlSurface({ density }), \"cursor-pointer\", className)}\n {...props}\n >\n {children}\n </select>\n );\n}\n\nexport { NativeSelect };\n"],"mappings":";;;;;;;;;;AAWA,SAAS,aAAa,EACpB,WACA,SACA,UACA,KACA,GAAG,SACoE;CACvE,OACE,oBAAC,UAAD;EACO;EACL,aAAU;EACV,WAAW,GAAG,eAAe,EAAE,QAAQ,CAAC,GAAG,kBAAkB,SAAS;EACtE,GAAI;EAEH;CACK,CAAA;AAEZ"}
|
package/dist/ui/plugin.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPlugin, eagerComponent } from "../core/registry.js";
|
|
2
2
|
import ButtonComponent from "./button.js";
|
|
3
|
+
import AvatarComponent from "./avatar.js";
|
|
3
4
|
import BadgeComponent from "./badge.js";
|
|
4
5
|
import CardComponent from "./card.js";
|
|
5
6
|
import ChartComponent from "./chart.js";
|
|
@@ -9,18 +10,23 @@ import FragmentComponent from "./fragment.js";
|
|
|
9
10
|
import GridComponent from "./grid.js";
|
|
10
11
|
import HeadingComponent from "./heading.js";
|
|
11
12
|
import IconComponent from "./icon.js";
|
|
13
|
+
import ImageComponent from "./image.js";
|
|
12
14
|
import LinkComponent from "./link.js";
|
|
13
15
|
import ModalComponent from "./modal.js";
|
|
16
|
+
import ProgressComponent from "./progress.js";
|
|
14
17
|
import RawBlockComponent from "./raw-block.js";
|
|
15
18
|
import SectionComponent from "./section.js";
|
|
16
19
|
import SegmentedControlComponent from "./segmented-control.js";
|
|
20
|
+
import SeparatorComponent from "./separator.js";
|
|
17
21
|
import StackComponent from "./stack.js";
|
|
18
22
|
import TabComponent, { TabsComponent } from "./tabs.js";
|
|
19
23
|
import TextComponent from "./text.js";
|
|
20
24
|
import TooltipComponent from "./tooltip.js";
|
|
25
|
+
import TreeComponent from "./tree.js";
|
|
21
26
|
//#region resources/js/ui/plugin.ts
|
|
22
27
|
var uiComponents = createPlugin({
|
|
23
28
|
components: {
|
|
29
|
+
avatar: eagerComponent(AvatarComponent),
|
|
24
30
|
badge: eagerComponent(BadgeComponent),
|
|
25
31
|
button: eagerComponent(ButtonComponent),
|
|
26
32
|
card: eagerComponent(CardComponent),
|
|
@@ -31,16 +37,20 @@ var uiComponents = createPlugin({
|
|
|
31
37
|
grid: eagerComponent(GridComponent),
|
|
32
38
|
heading: eagerComponent(HeadingComponent),
|
|
33
39
|
icon: eagerComponent(IconComponent),
|
|
40
|
+
image: eagerComponent(ImageComponent),
|
|
34
41
|
link: eagerComponent(LinkComponent),
|
|
35
42
|
modal: eagerComponent(ModalComponent),
|
|
43
|
+
progress: eagerComponent(ProgressComponent),
|
|
36
44
|
"raw-block": eagerComponent(RawBlockComponent),
|
|
37
45
|
section: eagerComponent(SectionComponent),
|
|
38
46
|
"segmented-control": eagerComponent(SegmentedControlComponent),
|
|
47
|
+
separator: eagerComponent(SeparatorComponent),
|
|
39
48
|
stack: eagerComponent(StackComponent),
|
|
40
49
|
tab: eagerComponent(TabComponent),
|
|
41
50
|
tabs: eagerComponent(TabsComponent),
|
|
42
51
|
text: eagerComponent(TextComponent),
|
|
43
|
-
tooltip: eagerComponent(TooltipComponent)
|
|
52
|
+
tooltip: eagerComponent(TooltipComponent),
|
|
53
|
+
tree: eagerComponent(TreeComponent)
|
|
44
54
|
},
|
|
45
55
|
name: "lattice/ui"
|
|
46
56
|
});
|
package/dist/ui/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","names":[],"sources":["../../resources/js/ui/plugin.ts"],"sourcesContent":["import {\n createPlugin,\n eagerComponent,\n type ComponentRegistryFor,\n} from \"@lattice-php/lattice/core/registry\";\nimport type { ActionNodeType, FormNodeType, NodeType } from \"@lattice-php/lattice/types/generated\";\nimport type { ChatComponentType } from \"@lattice-php/lattice/chat/plugin\";\nimport type { LayoutComponentType } from \"@lattice-php/lattice/layout/plugin\";\nimport type { NotificationsComponentType } from \"@lattice-php/lattice/notifications/plugin\";\nimport type { RemoteComponentType } from \"@lattice-php/lattice/remote/plugin\";\nimport type { TableComponentType } from \"@lattice-php/lattice/table/plugin\";\nimport BadgeComponent from \"./badge\";\nimport ButtonComponent from \"./button\";\nimport CardComponent from \"./card\";\nimport ChartComponent from \"./chart\";\nimport CollapsibleComponent from \"./collapsible\";\nimport FloatingPanelComponent from \"./floating-panel\";\nimport FragmentComponent from \"./fragment\";\nimport GridComponent from \"./grid\";\nimport HeadingComponent from \"./heading\";\nimport IconComponent from \"./icon\";\nimport LinkComponent from \"./link\";\nimport ModalComponent from \"./modal\";\nimport RawBlockComponent from \"./raw-block\";\nimport SectionComponent from \"./section\";\nimport SegmentedControlComponent from \"./segmented-control\";\nimport StackComponent from \"./stack\";\nimport TabComponent, { TabsComponent } from \"./tabs\";\nimport TextComponent from \"./text\";\nimport TooltipComponent from \"./tooltip\";\n\ntype NonUiComponentType =\n | ActionNodeType\n | ChatComponentType\n | FormNodeType\n | LayoutComponentType\n | NotificationsComponentType\n | RemoteComponentType\n | TableComponentType;\n\ntype UiComponentType = Exclude<NodeType, NonUiComponentType>;\n\nexport const uiComponents = createPlugin({\n components: {\n badge: eagerComponent(BadgeComponent),\n button: eagerComponent(ButtonComponent),\n card: eagerComponent(CardComponent),\n chart: eagerComponent(ChartComponent),\n collapsible: eagerComponent(CollapsibleComponent),\n \"floating-panel\": eagerComponent(FloatingPanelComponent),\n fragment: eagerComponent(FragmentComponent),\n grid: eagerComponent(GridComponent),\n heading: eagerComponent(HeadingComponent),\n icon: eagerComponent(IconComponent),\n link: eagerComponent(LinkComponent),\n modal: eagerComponent(ModalComponent),\n \"raw-block\": eagerComponent(RawBlockComponent),\n section: eagerComponent(SectionComponent),\n \"segmented-control\": eagerComponent(SegmentedControlComponent),\n stack: eagerComponent(StackComponent),\n tab: eagerComponent(TabComponent),\n tabs: eagerComponent(TabsComponent),\n text: eagerComponent(TextComponent),\n tooltip: eagerComponent(TooltipComponent),\n } satisfies ComponentRegistryFor<UiComponentType>,\n name: \"lattice/ui\",\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.js","names":[],"sources":["../../resources/js/ui/plugin.ts"],"sourcesContent":["import {\n createPlugin,\n eagerComponent,\n type ComponentRegistryFor,\n} from \"@lattice-php/lattice/core/registry\";\nimport type { ActionNodeType, FormNodeType, NodeType } from \"@lattice-php/lattice/types/generated\";\nimport type { ChatComponentType } from \"@lattice-php/lattice/chat/plugin\";\nimport type { LayoutComponentType } from \"@lattice-php/lattice/layout/plugin\";\nimport type { NotificationsComponentType } from \"@lattice-php/lattice/notifications/plugin\";\nimport type { RemoteComponentType } from \"@lattice-php/lattice/remote/plugin\";\nimport type { TableComponentType } from \"@lattice-php/lattice/table/plugin\";\nimport AvatarComponent from \"./avatar\";\nimport BadgeComponent from \"./badge\";\nimport ButtonComponent from \"./button\";\nimport CardComponent from \"./card\";\nimport ChartComponent from \"./chart\";\nimport CollapsibleComponent from \"./collapsible\";\nimport FloatingPanelComponent from \"./floating-panel\";\nimport FragmentComponent from \"./fragment\";\nimport GridComponent from \"./grid\";\nimport HeadingComponent from \"./heading\";\nimport IconComponent from \"./icon\";\nimport ImageComponent from \"./image\";\nimport LinkComponent from \"./link\";\nimport ModalComponent from \"./modal\";\nimport ProgressComponent from \"./progress\";\nimport RawBlockComponent from \"./raw-block\";\nimport SectionComponent from \"./section\";\nimport SegmentedControlComponent from \"./segmented-control\";\nimport SeparatorComponent from \"./separator\";\nimport StackComponent from \"./stack\";\nimport TabComponent, { TabsComponent } from \"./tabs\";\nimport TextComponent from \"./text\";\nimport TooltipComponent from \"./tooltip\";\nimport TreeComponent from \"./tree\";\n\ntype NonUiComponentType =\n | ActionNodeType\n | ChatComponentType\n | FormNodeType\n | LayoutComponentType\n | NotificationsComponentType\n | RemoteComponentType\n | TableComponentType;\n\ntype UiComponentType = Exclude<NodeType, NonUiComponentType>;\n\nexport const uiComponents = createPlugin({\n components: {\n avatar: eagerComponent(AvatarComponent),\n badge: eagerComponent(BadgeComponent),\n button: eagerComponent(ButtonComponent),\n card: eagerComponent(CardComponent),\n chart: eagerComponent(ChartComponent),\n collapsible: eagerComponent(CollapsibleComponent),\n \"floating-panel\": eagerComponent(FloatingPanelComponent),\n fragment: eagerComponent(FragmentComponent),\n grid: eagerComponent(GridComponent),\n heading: eagerComponent(HeadingComponent),\n icon: eagerComponent(IconComponent),\n image: eagerComponent(ImageComponent),\n link: eagerComponent(LinkComponent),\n modal: eagerComponent(ModalComponent),\n progress: eagerComponent(ProgressComponent),\n \"raw-block\": eagerComponent(RawBlockComponent),\n section: eagerComponent(SectionComponent),\n \"segmented-control\": eagerComponent(SegmentedControlComponent),\n separator: eagerComponent(SeparatorComponent),\n stack: eagerComponent(StackComponent),\n tab: eagerComponent(TabComponent),\n tabs: eagerComponent(TabsComponent),\n text: eagerComponent(TextComponent),\n tooltip: eagerComponent(TooltipComponent),\n tree: eagerComponent(TreeComponent),\n } satisfies ComponentRegistryFor<UiComponentType>,\n name: \"lattice/ui\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,eAAe,aAAa;CACvC,YAAY;EACV,QAAQ,eAAe,eAAe;EACtC,OAAO,eAAe,cAAc;EACpC,QAAQ,eAAe,eAAe;EACtC,MAAM,eAAe,aAAa;EAClC,OAAO,eAAe,cAAc;EACpC,aAAa,eAAe,oBAAoB;EAChD,kBAAkB,eAAe,sBAAsB;EACvD,UAAU,eAAe,iBAAiB;EAC1C,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;EACxC,MAAM,eAAe,aAAa;EAClC,OAAO,eAAe,cAAc;EACpC,MAAM,eAAe,aAAa;EAClC,OAAO,eAAe,cAAc;EACpC,UAAU,eAAe,iBAAiB;EAC1C,aAAa,eAAe,iBAAiB;EAC7C,SAAS,eAAe,gBAAgB;EACxC,qBAAqB,eAAe,yBAAyB;EAC7D,WAAW,eAAe,kBAAkB;EAC5C,OAAO,eAAe,cAAc;EACpC,KAAK,eAAe,YAAY;EAChC,MAAM,eAAe,aAAa;EAClC,MAAM,eAAe,aAAa;EAClC,SAAS,eAAe,gBAAgB;EACxC,MAAM,eAAe,aAAa;CACpC;CACA,MAAM;AACR,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { useLocale } from "../i18n/locale.js";
|
|
3
|
+
import { coerceColor, colorValue, namedColor } from "../lib/color.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region resources/js/ui/progress.tsx
|
|
6
|
+
var barHeights = {
|
|
7
|
+
xs: "h-1",
|
|
8
|
+
sm: "h-1.5",
|
|
9
|
+
md: "h-2.5",
|
|
10
|
+
lg: "h-3",
|
|
11
|
+
xl: "h-4",
|
|
12
|
+
"2xl": "h-5",
|
|
13
|
+
"3xl": "h-6",
|
|
14
|
+
"4xl": "h-8"
|
|
15
|
+
};
|
|
16
|
+
var circleDiameters = {
|
|
17
|
+
xs: 24,
|
|
18
|
+
sm: 32,
|
|
19
|
+
md: 40,
|
|
20
|
+
lg: 48,
|
|
21
|
+
xl: 64,
|
|
22
|
+
"2xl": 80,
|
|
23
|
+
"3xl": 96,
|
|
24
|
+
"4xl": 128
|
|
25
|
+
};
|
|
26
|
+
var circleReadouts = {
|
|
27
|
+
xs: "text-[0.5rem]",
|
|
28
|
+
sm: "text-[0.625rem]",
|
|
29
|
+
md: "text-xs",
|
|
30
|
+
lg: "text-sm",
|
|
31
|
+
xl: "text-base",
|
|
32
|
+
"2xl": "text-lg",
|
|
33
|
+
"3xl": "text-xl",
|
|
34
|
+
"4xl": "text-2xl"
|
|
35
|
+
};
|
|
36
|
+
var ProgressComponent = ({ node }) => {
|
|
37
|
+
const { value, max, variant, showValue, color, size } = node.props;
|
|
38
|
+
const { locale } = useLocale();
|
|
39
|
+
const paint = colorValue(coerceColor(color) ?? namedColor("primary"));
|
|
40
|
+
const clamped = max > 0 ? Math.min(Math.max(value, 0), max) : 0;
|
|
41
|
+
const ratio = max > 0 ? clamped / max : 0;
|
|
42
|
+
const percent = new Intl.NumberFormat(locale, {
|
|
43
|
+
maximumFractionDigits: 0,
|
|
44
|
+
style: "percent"
|
|
45
|
+
}).format(ratio);
|
|
46
|
+
const aria = {
|
|
47
|
+
"aria-valuemax": max,
|
|
48
|
+
"aria-valuemin": 0,
|
|
49
|
+
"aria-valuenow": clamped,
|
|
50
|
+
"aria-valuetext": percent,
|
|
51
|
+
role: "progressbar"
|
|
52
|
+
};
|
|
53
|
+
if (variant === "circle") {
|
|
54
|
+
const diameter = circleDiameters[size];
|
|
55
|
+
const strokeWidth = Math.max(3, diameter / 10);
|
|
56
|
+
const radius = (diameter - strokeWidth) / 2;
|
|
57
|
+
const circumference = 2 * Math.PI * radius;
|
|
58
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
59
|
+
...aria,
|
|
60
|
+
className: "relative inline-flex",
|
|
61
|
+
"data-lattice-progress": "circle",
|
|
62
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
63
|
+
className: "-rotate-90",
|
|
64
|
+
height: diameter,
|
|
65
|
+
width: diameter,
|
|
66
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
67
|
+
className: "text-lt-muted",
|
|
68
|
+
cx: diameter / 2,
|
|
69
|
+
cy: diameter / 2,
|
|
70
|
+
fill: "none",
|
|
71
|
+
r: radius,
|
|
72
|
+
stroke: "currentColor",
|
|
73
|
+
strokeWidth
|
|
74
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
75
|
+
cx: diameter / 2,
|
|
76
|
+
cy: diameter / 2,
|
|
77
|
+
fill: "none",
|
|
78
|
+
r: radius,
|
|
79
|
+
stroke: "currentColor",
|
|
80
|
+
strokeDasharray: circumference,
|
|
81
|
+
strokeDashoffset: circumference * (1 - ratio),
|
|
82
|
+
strokeLinecap: "round",
|
|
83
|
+
strokeWidth,
|
|
84
|
+
style: { color: paint }
|
|
85
|
+
})]
|
|
86
|
+
}), showValue && /* @__PURE__ */ jsx("span", {
|
|
87
|
+
className: cn("absolute inset-0 flex items-center justify-center font-medium text-lt-fg tabular-nums", circleReadouts[size]),
|
|
88
|
+
children: percent
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
93
|
+
className: "flex w-full items-center gap-2",
|
|
94
|
+
"data-lattice-progress": "bar",
|
|
95
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
96
|
+
...aria,
|
|
97
|
+
className: cn("w-full overflow-hidden rounded-full bg-lt-muted", barHeights[size]),
|
|
98
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
99
|
+
className: "h-full rounded-full",
|
|
100
|
+
style: {
|
|
101
|
+
background: paint,
|
|
102
|
+
width: `${ratio * 100}%`
|
|
103
|
+
}
|
|
104
|
+
})
|
|
105
|
+
}), showValue && /* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: "shrink-0 text-lt-muted-fg text-sm tabular-nums",
|
|
107
|
+
children: percent
|
|
108
|
+
})]
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
//#endregion
|
|
112
|
+
export { ProgressComponent as default };
|
|
113
|
+
|
|
114
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","names":[],"sources":["../../resources/js/ui/progress.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { useLocale } from \"@lattice-php/lattice/i18n\";\nimport { coerceColor, colorValue, namedColor } from \"@lattice-php/lattice/lib/color\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Size } from \"@lattice-php/lattice/types/generated\";\n\nconst barHeights: Record<Size, string> = {\n xs: \"h-1\",\n sm: \"h-1.5\",\n md: \"h-2.5\",\n lg: \"h-3\",\n xl: \"h-4\",\n \"2xl\": \"h-5\",\n \"3xl\": \"h-6\",\n \"4xl\": \"h-8\",\n};\n\nconst circleDiameters: Record<Size, number> = {\n xs: 24,\n sm: 32,\n md: 40,\n lg: 48,\n xl: 64,\n \"2xl\": 80,\n \"3xl\": 96,\n \"4xl\": 128,\n};\n\nconst circleReadouts: Record<Size, string> = {\n xs: \"text-[0.5rem]\",\n sm: \"text-[0.625rem]\",\n md: \"text-xs\",\n lg: \"text-sm\",\n xl: \"text-base\",\n \"2xl\": \"text-lg\",\n \"3xl\": \"text-xl\",\n \"4xl\": \"text-2xl\",\n};\n\nconst ProgressComponent: RendererComponent<\"progress\"> = ({ node }) => {\n const { value, max, variant, showValue, color, size } = node.props;\n const { locale } = useLocale();\n const paint = colorValue(coerceColor(color) ?? namedColor(\"primary\"));\n\n const clamped = max > 0 ? Math.min(Math.max(value, 0), max) : 0;\n const ratio = max > 0 ? clamped / max : 0;\n const percent = new Intl.NumberFormat(locale, {\n maximumFractionDigits: 0,\n style: \"percent\",\n }).format(ratio);\n\n const aria = {\n \"aria-valuemax\": max,\n \"aria-valuemin\": 0,\n \"aria-valuenow\": clamped,\n \"aria-valuetext\": percent,\n role: \"progressbar\",\n } as const;\n\n if (variant === \"circle\") {\n const diameter = circleDiameters[size];\n const strokeWidth = Math.max(3, diameter / 10);\n const radius = (diameter - strokeWidth) / 2;\n const circumference = 2 * Math.PI * radius;\n\n return (\n <div {...aria} className=\"relative inline-flex\" data-lattice-progress=\"circle\">\n <svg className=\"-rotate-90\" height={diameter} width={diameter}>\n <circle\n className=\"text-lt-muted\"\n cx={diameter / 2}\n cy={diameter / 2}\n fill=\"none\"\n r={radius}\n stroke=\"currentColor\"\n strokeWidth={strokeWidth}\n />\n <circle\n cx={diameter / 2}\n cy={diameter / 2}\n fill=\"none\"\n r={radius}\n stroke=\"currentColor\"\n strokeDasharray={circumference}\n strokeDashoffset={circumference * (1 - ratio)}\n strokeLinecap=\"round\"\n strokeWidth={strokeWidth}\n style={{ color: paint }}\n />\n </svg>\n {showValue && (\n <span\n className={cn(\n \"absolute inset-0 flex items-center justify-center font-medium text-lt-fg tabular-nums\",\n circleReadouts[size],\n )}\n >\n {percent}\n </span>\n )}\n </div>\n );\n }\n\n return (\n <div className=\"flex w-full items-center gap-2\" data-lattice-progress=\"bar\">\n <div\n {...aria}\n className={cn(\"w-full overflow-hidden rounded-full bg-lt-muted\", barHeights[size])}\n >\n <div\n className=\"h-full rounded-full\"\n style={{ background: paint, width: `${ratio * 100}%` }}\n />\n </div>\n {showValue && (\n <span className=\"shrink-0 text-lt-muted-fg text-sm tabular-nums\">{percent}</span>\n )}\n </div>\n );\n};\n\nexport default ProgressComponent;\n"],"mappings":";;;;;AAMA,IAAM,aAAmC;CACvC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,kBAAwC;CAC5C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,iBAAuC;CAC3C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,qBAAoD,EAAE,WAAW;CACrE,MAAM,EAAE,OAAO,KAAK,SAAS,WAAW,OAAO,SAAS,KAAK;CAC7D,MAAM,EAAE,WAAW,UAAU;CAC7B,MAAM,QAAQ,WAAW,YAAY,KAAK,KAAK,WAAW,SAAS,CAAC;CAEpE,MAAM,UAAU,MAAM,IAAI,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,GAAG,IAAI;CAC9D,MAAM,QAAQ,MAAM,IAAI,UAAU,MAAM;CACxC,MAAM,UAAU,IAAI,KAAK,aAAa,QAAQ;EAC5C,uBAAuB;EACvB,OAAO;CACT,CAAC,EAAE,OAAO,KAAK;CAEf,MAAM,OAAO;EACX,iBAAiB;EACjB,iBAAiB;EACjB,iBAAiB;EACjB,kBAAkB;EAClB,MAAM;CACR;CAEA,IAAI,YAAY,UAAU;EACxB,MAAM,WAAW,gBAAgB;EACjC,MAAM,cAAc,KAAK,IAAI,GAAG,WAAW,EAAE;EAC7C,MAAM,UAAU,WAAW,eAAe;EAC1C,MAAM,gBAAgB,IAAI,KAAK,KAAK;EAEpC,OACE,qBAAC,OAAD;GAAK,GAAI;GAAM,WAAU;GAAuB,yBAAsB;aAAtE,CACE,qBAAC,OAAD;IAAK,WAAU;IAAa,QAAQ;IAAU,OAAO;cAArD,CACE,oBAAC,UAAD;KACE,WAAU;KACV,IAAI,WAAW;KACf,IAAI,WAAW;KACf,MAAK;KACL,GAAG;KACH,QAAO;KACM;IACd,CAAA,GACD,oBAAC,UAAD;KACE,IAAI,WAAW;KACf,IAAI,WAAW;KACf,MAAK;KACL,GAAG;KACH,QAAO;KACP,iBAAiB;KACjB,kBAAkB,iBAAiB,IAAI;KACvC,eAAc;KACD;KACb,OAAO,EAAE,OAAO,MAAM;IACvB,CAAA,CACE;OACJ,aACC,oBAAC,QAAD;IACE,WAAW,GACT,yFACA,eAAe,KACjB;cAEC;GACG,CAAA,CAEL;;CAET;CAEA,OACE,qBAAC,OAAD;EAAK,WAAU;EAAiC,yBAAsB;YAAtE,CACE,oBAAC,OAAD;GACE,GAAI;GACJ,WAAW,GAAG,mDAAmD,WAAW,KAAK;aAEjF,oBAAC,OAAD;IACE,WAAU;IACV,OAAO;KAAE,YAAY;KAAO,OAAO,GAAG,QAAQ,IAAI;IAAG;GACtD,CAAA;EACE,CAAA,GACJ,aACC,oBAAC,QAAD;GAAM,WAAU;aAAkD;EAAc,CAAA,CAE/E;;AAET"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cn } from "../lib/utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region resources/js/ui/separator.tsx
|
|
4
|
+
var SeparatorComponent = ({ node }) => {
|
|
5
|
+
const horizontal = node.props.orientation === "horizontal";
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
role: "separator",
|
|
8
|
+
"aria-orientation": node.props.orientation,
|
|
9
|
+
className: cn("shrink-0 bg-lt-border", horizontal ? "h-px w-full" : "h-full w-px self-stretch")
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { SeparatorComponent as default };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=separator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separator.js","names":[],"sources":["../../resources/js/ui/separator.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\n\nconst SeparatorComponent: RendererComponent<\"separator\"> = ({ node }) => {\n const horizontal = node.props.orientation === \"horizontal\";\n\n return (\n <div\n role=\"separator\"\n aria-orientation={node.props.orientation}\n className={cn(\n \"shrink-0 bg-lt-border\",\n horizontal ? \"h-px w-full\" : \"h-full w-px self-stretch\",\n )}\n />\n );\n};\n\nexport default SeparatorComponent;\n"],"mappings":";;;AAGA,IAAM,sBAAsD,EAAE,WAAW;CACvE,MAAM,aAAa,KAAK,MAAM,gBAAgB;CAE9C,OACE,oBAAC,OAAD;EACE,MAAK;EACL,oBAAkB,KAAK,MAAM;EAC7B,WAAW,GACT,yBACA,aAAa,gBAAgB,0BAC/B;CACD,CAAA;AAEL"}
|
package/dist/ui/text.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { cn } from "../lib/utils.js";
|
|
2
2
|
import { CopyableText } from "./copyable-text.js";
|
|
3
|
+
import { coerceColor, colorValue, namedColor } from "../lib/color.js";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region resources/js/ui/text.tsx
|
|
5
6
|
var textAlignments = {
|
|
6
7
|
center: "text-center",
|
|
7
8
|
left: "text-left"
|
|
8
9
|
};
|
|
9
|
-
var textColors = {
|
|
10
|
-
default: "text-lt-fg",
|
|
11
|
-
muted: "text-lt-muted-fg",
|
|
12
|
-
primary: "text-lt-primary",
|
|
13
|
-
success: "text-lt-success",
|
|
14
|
-
info: "text-lt-info",
|
|
15
|
-
warning: "text-lt-warning",
|
|
16
|
-
danger: "text-lt-danger"
|
|
17
|
-
};
|
|
18
10
|
var textSizes = {
|
|
19
11
|
xs: "text-xs leading-5",
|
|
20
12
|
sm: "text-sm leading-6",
|
|
@@ -26,8 +18,11 @@ var textSizes = {
|
|
|
26
18
|
"4xl": "text-4xl leading-none"
|
|
27
19
|
};
|
|
28
20
|
var TextComponent = ({ node }) => {
|
|
21
|
+
const align = node.props.align ?? "left";
|
|
22
|
+
const color = colorValue(coerceColor(node.props.color) ?? namedColor("muted"));
|
|
29
23
|
const text = /* @__PURE__ */ jsx("p", {
|
|
30
|
-
className: cn("m-0", "max-w-2xl", textAlignments[
|
|
24
|
+
className: cn("m-0", "max-w-2xl", textAlignments[align] ?? textAlignments.left, textSizes[node.props.size]),
|
|
25
|
+
style: { color },
|
|
31
26
|
children: node.props.text
|
|
32
27
|
});
|
|
33
28
|
if (!node.props.copyable) return text;
|
package/dist/ui/text.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","names":[],"sources":["../../resources/js/ui/text.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type {
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../resources/js/ui/text.tsx"],"sourcesContent":["import type { RendererComponent } from \"@lattice-php/lattice/core/types\";\nimport { coerceColor, colorValue, namedColor } from \"@lattice-php/lattice/lib/color\";\nimport { cn } from \"@lattice-php/lattice/lib/utils\";\nimport type { Size } from \"@lattice-php/lattice/types/generated\";\nimport { CopyableText } from \"./copyable-text\";\n\nconst textAlignments: Record<string, string> = {\n center: \"text-center\",\n left: \"text-left\",\n};\n\nconst textSizes: Record<Size, string> = {\n xs: \"text-xs leading-5\",\n sm: \"text-sm leading-6\",\n md: \"text-base leading-7\",\n lg: \"text-lg leading-8\",\n xl: \"text-xl leading-8\",\n \"2xl\": \"text-2xl leading-9\",\n \"3xl\": \"text-3xl leading-10\",\n \"4xl\": \"text-4xl leading-none\",\n};\n\nconst TextComponent: RendererComponent<\"text\"> = ({ node }) => {\n const align = node.props.align ?? \"left\";\n const color = colorValue(coerceColor(node.props.color) ?? namedColor(\"muted\"));\n\n const text = (\n <p\n className={cn(\n \"m-0\",\n \"max-w-2xl\",\n textAlignments[align] ?? textAlignments.left,\n textSizes[node.props.size],\n )}\n style={{ color }}\n >\n {node.props.text}\n </p>\n );\n\n if (!node.props.copyable) {\n return text;\n }\n\n return (\n <CopyableText value={node.props.text} label={node.props.text}>\n {text}\n </CopyableText>\n );\n};\n\nexport default TextComponent;\n"],"mappings":";;;;;AAMA,IAAM,iBAAyC;CAC7C,QAAQ;CACR,MAAM;AACR;AAEA,IAAM,YAAkC;CACtC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;AACT;AAEA,IAAM,iBAA4C,EAAE,WAAW;CAC7D,MAAM,QAAQ,KAAK,MAAM,SAAS;CAClC,MAAM,QAAQ,WAAW,YAAY,KAAK,MAAM,KAAK,KAAK,WAAW,OAAO,CAAC;CAE7E,MAAM,OACJ,oBAAC,KAAD;EACE,WAAW,GACT,OACA,aACA,eAAe,UAAU,eAAe,MACxC,UAAU,KAAK,MAAM,KACvB;EACA,OAAO,EAAE,MAAM;YAEd,KAAK,MAAM;CACX,CAAA;CAGL,IAAI,CAAC,KAAK,MAAM,UACd,OAAO;CAGT,OACE,oBAAC,cAAD;EAAc,OAAO,KAAK,MAAM;EAAM,OAAO,KAAK,MAAM;YACrD;CACW,CAAA;AAElB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type TreeItemRegistration = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
orderPath: string;
|
|
6
|
+
parentPath: string | null;
|
|
7
|
+
path: string;
|
|
8
|
+
ref: RefObject<HTMLLIElement | null>;
|
|
9
|
+
};
|
|
10
|
+
export type TreeFocusDirection = "first" | "firstChild" | "last" | "next" | "parent" | "prev";
|
|
11
|
+
export type TreeContextValue = {
|
|
12
|
+
activate: (id: string) => void;
|
|
13
|
+
activeId: string | null;
|
|
14
|
+
expanded: Set<string>;
|
|
15
|
+
focus: (id: string) => void;
|
|
16
|
+
focusedId: string | null;
|
|
17
|
+
moveFocus: (fromId: string, direction: TreeFocusDirection) => void;
|
|
18
|
+
register: (entry: TreeItemRegistration) => void;
|
|
19
|
+
toggle: (id: string) => void;
|
|
20
|
+
typeAhead: (fromId: string, character: string) => void;
|
|
21
|
+
unregister: (path: string) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const TreeContext: import('react').Context<TreeContextValue>;
|
|
24
|
+
export declare function useTreeContext(): TreeContextValue;
|
|
25
|
+
export declare function useTreeState({ activeId: initialActiveId, defaultExpanded, nodes, rememberState, storageKey, }: {
|
|
26
|
+
activeId: string | null;
|
|
27
|
+
defaultExpanded: string[];
|
|
28
|
+
nodes: Array<{
|
|
29
|
+
id: string;
|
|
30
|
+
}>;
|
|
31
|
+
rememberState: boolean;
|
|
32
|
+
storageKey: string;
|
|
33
|
+
}): TreeContextValue;
|