@alfakit/react 0.1.1 → 0.1.6
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/CHANGELOG.md +16 -0
- package/dist/components/actions/action-button.d.ts.map +1 -1
- package/dist/components/actions/action-button.js +5 -4
- package/dist/components/actions/action-button.js.map +1 -1
- package/dist/components/actions/action-modals.d.ts.map +1 -1
- package/dist/components/actions/action-modals.js +6 -5
- package/dist/components/actions/action-modals.js.map +1 -1
- package/dist/components/ai/copilot.d.ts +3 -1
- package/dist/components/ai/copilot.d.ts.map +1 -1
- package/dist/components/ai/copilot.js +4 -1
- package/dist/components/ai/copilot.js.map +1 -1
- package/dist/components/cms/live-preview.js +3 -2
- package/dist/components/cms/live-preview.js.map +1 -1
- package/dist/components/cms/page.js +1 -1
- package/dist/components/fields/builder.js +15 -6
- package/dist/components/fields/builder.js.map +1 -1
- package/dist/components/fields/color-picker.js +1 -0
- package/dist/components/fields/color-picker.js.map +1 -1
- package/dist/components/fields/file-upload.js +11 -10
- package/dist/components/fields/file-upload.js.map +1 -1
- package/dist/components/fields/image-editor-dialog.js +4 -2
- package/dist/components/fields/image-editor-dialog.js.map +1 -1
- package/dist/components/fields/item-actions.js +10 -10
- package/dist/components/fields/item-actions.js.map +1 -1
- package/dist/components/fields/key-value.d.ts.map +1 -1
- package/dist/components/fields/key-value.js +3 -3
- package/dist/components/fields/key-value.js.map +1 -1
- package/dist/components/fields/modal-table-select.js +6 -5
- package/dist/components/fields/modal-table-select.js.map +1 -1
- package/dist/components/fields/one-time-code-input.js +1 -1
- package/dist/components/fields/one-time-code-input.js.map +1 -1
- package/dist/components/fields/repeater-table.js +12 -1
- package/dist/components/fields/repeater-table.js.map +1 -1
- package/dist/components/fields/repeater.js +2 -2
- package/dist/components/fields/repeater.js.map +1 -1
- package/dist/components/fields/rich-editor.js +2 -1
- package/dist/components/fields/rich-editor.js.map +1 -1
- package/dist/components/fields/select.js +3 -3
- package/dist/components/fields/select.js.map +1 -1
- package/dist/components/file-manager/file-manager.js +1 -1
- package/dist/components/file-manager/file-manager.js.map +1 -1
- package/dist/components/form/form-block.d.ts.map +1 -1
- package/dist/components/form/form-block.js +14 -2
- package/dist/components/form/form-block.js.map +1 -1
- package/dist/components/form/form-context.js +7 -3
- package/dist/components/form/form-context.js.map +1 -1
- package/dist/components/kanban/kanban.js +4 -3
- package/dist/components/kanban/kanban.js.map +1 -1
- package/dist/components/layout/fused-group.js +1 -0
- package/dist/components/layout/fused-group.js.map +1 -1
- package/dist/components/layout/section.js +2 -2
- package/dist/components/layout/section.js.map +1 -1
- package/dist/components/layout/tabs.d.ts.map +1 -1
- package/dist/components/layout/tabs.js +54 -15
- package/dist/components/layout/tabs.js.map +1 -1
- package/dist/components/panel/app-sidebar.d.ts +2 -3
- package/dist/components/panel/app-sidebar.d.ts.map +1 -1
- package/dist/components/panel/app-sidebar.js +1 -24
- package/dist/components/panel/app-sidebar.js.map +1 -1
- package/dist/components/panel/brand.d.ts +10 -0
- package/dist/components/panel/brand.d.ts.map +1 -0
- package/dist/components/panel/brand.js +37 -0
- package/dist/components/panel/brand.js.map +1 -0
- package/dist/components/panel/global-search.js +1 -0
- package/dist/components/panel/global-search.js.map +1 -1
- package/dist/components/panel/index.d.ts +2 -1
- package/dist/components/panel/shortcut-keys.js +1 -0
- package/dist/components/panel/shortcut-keys.js.map +1 -1
- package/dist/components/panel/tenant-menu.js +2 -2
- package/dist/components/panel/tenant-menu.js.map +1 -1
- package/dist/components/panel/topbar.js +1 -1
- package/dist/components/realtime/live-records-pill.d.ts.map +1 -1
- package/dist/components/realtime/live-records-pill.js +6 -3
- package/dist/components/realtime/live-records-pill.js.map +1 -1
- package/dist/components/table/cells.d.ts +6 -0
- package/dist/components/table/cells.d.ts.map +1 -1
- package/dist/components/table/cells.js +15 -3
- package/dist/components/table/cells.js.map +1 -1
- package/dist/components/table/column-manager.js +8 -7
- package/dist/components/table/column-manager.js.map +1 -1
- package/dist/components/table/content-layout.js +2 -1
- package/dist/components/table/content-layout.js.map +1 -1
- package/dist/components/table/grouping.js +11 -1
- package/dist/components/table/grouping.js.map +1 -1
- package/dist/components/table/pagination.js +16 -13
- package/dist/components/table/pagination.js.map +1 -1
- package/dist/components/table/table-block.js +14 -4
- package/dist/components/table/table-block.js.map +1 -1
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +3 -1
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +3 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +3 -1
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/tooltip.js +3 -1
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components.css +347 -0
- package/dist/context.d.ts +5 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +5 -1
- package/dist/context.js.map +1 -1
- package/dist/create-alfakit.d.ts.map +1 -1
- package/dist/create-alfakit.js +8 -5
- package/dist/create-alfakit.js.map +1 -1
- package/dist/eject-manifest.json +16 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +24 -21
- package/dist/layouts/app-layout.d.ts.map +1 -1
- package/dist/layouts/app-layout.js +2 -29
- package/dist/layouts/app-layout.js.map +1 -1
- package/dist/layouts/auth-layout.js +2 -2
- package/dist/layouts/auth-layout.js.map +1 -1
- package/dist/layouts/fullscreen-layout.js +1 -1
- package/dist/layouts/fullscreen-layout.js.map +1 -1
- package/dist/layouts/lazy-layouts.js +15 -0
- package/dist/layouts/lazy-layouts.js.map +1 -0
- package/dist/layouts/max-widths.js +34 -0
- package/dist/layouts/max-widths.js.map +1 -0
- package/dist/layouts/panel-layouts.d.ts +10 -0
- package/dist/layouts/panel-layouts.d.ts.map +1 -0
- package/dist/layouts/panel-layouts.js +20 -0
- package/dist/layouts/panel-layouts.js.map +1 -0
- package/dist/layouts/top-nav-layout.js +2 -2
- package/dist/layouts/top-nav-layout.js.map +1 -1
- package/dist/pages/page.d.ts.map +1 -1
- package/dist/pages/page.js +12 -7
- package/dist/pages/page.js.map +1 -1
- package/dist/standalone/alfakit-component.js +11 -6
- package/dist/standalone/alfakit-component.js.map +1 -1
- package/dist/standalone/alfakit-toaster.d.ts.map +1 -1
- package/dist/standalone/alfakit-toaster.js +8 -1
- package/dist/standalone/alfakit-toaster.js.map +1 -1
- package/dist/standalone.css +54 -0
- package/dist/starter-kit/dashboard-widgets.d.ts +33 -0
- package/dist/starter-kit/dashboard-widgets.d.ts.map +1 -0
- package/dist/starter-kit/dashboard-widgets.js +53 -0
- package/dist/starter-kit/dashboard-widgets.js.map +1 -0
- package/dist/starter-kit/impersonation-banner.js +34 -0
- package/dist/starter-kit/impersonation-banner.js.map +1 -0
- package/dist/starter-kit/index.d.ts +3 -2
- package/dist/starter-kit/index.js +3 -2
- package/dist/starter-kit/starter-kit.d.ts +6 -0
- package/dist/starter-kit/starter-kit.d.ts.map +1 -1
- package/dist/starter-kit/starter-kit.js +18 -7
- package/dist/starter-kit/starter-kit.js.map +1 -1
- package/dist/starter-kit/widgets-loaded.js +21 -5
- package/dist/starter-kit/widgets-loaded.js.map +1 -1
- package/dist/starter-kit/widgets-triggers.js +35 -3
- package/dist/starter-kit/widgets-triggers.js.map +1 -1
- package/dist/starter-kit/widgets.d.ts +13 -5
- package/dist/starter-kit/widgets.d.ts.map +1 -1
- package/dist/starter-kit/widgets.js +56 -18
- package/dist/starter-kit/widgets.js.map +1 -1
- package/dist/styles.css +15 -2
- package/dist/themes.css +8 -335
- package/package.json +2 -2
- package/src/components/actions/action-button.tsx +7 -4
- package/src/components/actions/action-modals.tsx +13 -1
- package/src/components/ai/copilot.tsx +14 -1
- package/src/components/cms/live-preview.tsx +5 -2
- package/src/components/fields/builder.tsx +14 -5
- package/src/components/fields/color-picker.tsx +1 -0
- package/src/components/fields/file-upload.tsx +21 -10
- package/src/components/fields/image-editor-dialog.tsx +7 -2
- package/src/components/fields/item-actions.tsx +32 -9
- package/src/components/fields/key-value.tsx +3 -2
- package/src/components/fields/modal-table-select.tsx +8 -3
- package/src/components/fields/one-time-code-input.tsx +1 -1
- package/src/components/fields/repeater-table.tsx +12 -1
- package/src/components/fields/repeater.tsx +2 -3
- package/src/components/fields/rich-editor.tsx +3 -0
- package/src/components/fields/select.tsx +7 -3
- package/src/components/file-manager/file-manager.tsx +1 -1
- package/src/components/form/form-block.tsx +26 -1
- package/src/components/form/form-context.tsx +3 -6
- package/src/components/kanban/kanban.tsx +16 -3
- package/src/components/layout/fused-group.tsx +5 -1
- package/src/components/layout/section.tsx +2 -2
- package/src/components/layout/tabs.tsx +72 -17
- package/src/components/panel/app-sidebar.tsx +2 -38
- package/src/components/panel/brand.tsx +46 -0
- package/src/components/panel/global-search.tsx +1 -1
- package/src/components/panel/shortcut-keys.tsx +4 -1
- package/src/components/panel/tenant-menu.tsx +2 -2
- package/src/components/realtime/live-records-pill.tsx +4 -3
- package/src/components/table/cells.tsx +27 -5
- package/src/components/table/column-manager.tsx +12 -10
- package/src/components/table/content-layout.tsx +5 -1
- package/src/components/table/grouping.tsx +15 -1
- package/src/components/table/pagination.tsx +16 -9
- package/src/components/table/table-block.tsx +25 -12
- package/src/components/ui/dialog.tsx +5 -1
- package/src/components/ui/popover.tsx +5 -1
- package/src/components/ui/sheet.tsx +5 -1
- package/src/components/ui/tooltip.tsx +5 -1
- package/src/context.tsx +10 -0
- package/src/create-alfakit.tsx +11 -2
- package/src/index.ts +2 -0
- package/src/layouts/app-layout.tsx +4 -28
- package/src/layouts/auth-layout.tsx +2 -2
- package/src/layouts/fullscreen-layout.tsx +1 -1
- package/src/layouts/lazy-layouts.ts +14 -0
- package/src/layouts/max-widths.ts +29 -0
- package/src/layouts/panel-layouts.ts +17 -0
- package/src/layouts/top-nav-layout.tsx +2 -2
- package/src/pages/page.tsx +21 -12
- package/src/standalone/alfakit-component.tsx +18 -7
- package/src/standalone/alfakit-toaster.tsx +21 -2
- package/src/starter-kit/dashboard-widgets.tsx +78 -0
- package/src/starter-kit/impersonation-banner.tsx +48 -0
- package/src/starter-kit/index.ts +2 -0
- package/src/starter-kit/starter-kit.tsx +31 -4
- package/src/starter-kit/widgets-loaded.tsx +23 -1
- package/src/starter-kit/widgets-triggers.tsx +37 -2
- package/src/starter-kit/widgets.tsx +95 -20
- package/src/styles.css +15 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "../../lib/utils.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { Popover } from "radix-ui";
|
|
3
|
+
import { Direction, Popover } from "radix-ui";
|
|
4
4
|
//#region src/components/ui/popover.tsx
|
|
5
5
|
function Popover$1({ ...props }) {
|
|
6
6
|
return /* @__PURE__ */ jsx(Popover.Root, {
|
|
@@ -15,7 +15,9 @@ function PopoverTrigger({ ...props }) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
18
|
+
const dir = Direction.useDirection();
|
|
18
19
|
return /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Content, {
|
|
20
|
+
dir,
|
|
19
21
|
"data-slot": "popover-content",
|
|
20
22
|
align,
|
|
21
23
|
sideOffset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["Popover","PopoverPrimitive"],"sources":["../../../src/components/ui/popover.tsx"],"sourcesContent":["import { Popover as PopoverPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { cn } from '../../lib/utils'\n\nfunction Popover({ ...props }: ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({ ...props }: ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n ...props\n}: ComponentProps<typeof PopoverPrimitive.Content>) {\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({ ...props }: ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nexport { Popover, PopoverAnchor, PopoverContent, PopoverTrigger }\n"],"mappings":";;;;AAIA,SAASA,UAAQ,EAAE,GAAG,SAAuD;CAC3E,OAAO,oBAACC,QAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ,CAAA;AAChE;AAEA,SAAS,eAAe,EAAE,GAAG,SAA0D;CACrF,OAAO,oBAACA,QAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;CAAQ,CAAA;AAC3E;AAEA,SAAS,eAAe,EACtB,WACA,QAAQ,UACR,aAAa,GACb,GAAG,SAC+C;
|
|
1
|
+
{"version":3,"file":"popover.js","names":["Popover","PopoverPrimitive"],"sources":["../../../src/components/ui/popover.tsx"],"sourcesContent":["import { Direction, Popover as PopoverPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { cn } from '../../lib/utils'\n\nfunction Popover({ ...props }: ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />\n}\n\nfunction PopoverTrigger({ ...props }: ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n ...props\n}: ComponentProps<typeof PopoverPrimitive.Content>) {\n // Portaled outside Alfakit's root: carry the reading direction (starter kit pages and\n // standalone components leave <html dir> to the host).\n const dir = Direction.useDirection()\n return (\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n dir={dir}\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n )\n}\n\nfunction PopoverAnchor({ ...props }: ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />\n}\n\nexport { Popover, PopoverAnchor, PopoverContent, PopoverTrigger }\n"],"mappings":";;;;AAIA,SAASA,UAAQ,EAAE,GAAG,SAAuD;CAC3E,OAAO,oBAACC,QAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ,CAAA;AAChE;AAEA,SAAS,eAAe,EAAE,GAAG,SAA0D;CACrF,OAAO,oBAACA,QAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;CAAQ,CAAA;AAC3E;AAEA,SAAS,eAAe,EACtB,WACA,QAAQ,UACR,aAAa,GACb,GAAG,SAC+C;CAGlD,MAAM,MAAM,UAAU,aAAa;CACnC,OACE,oBAACA,QAAiB,QAAlB,EAAA,UACE,oBAACA,QAAiB,SAAlB;EACO;EACL,aAAU;EACH;EACK;EACZ,WAAW,GACT,keACA,SACF;EACA,GAAI;CACL,CAAA,EACsB,CAAA;AAE7B;AAEA,SAAS,cAAc,EAAE,GAAG,SAAyD;CACnF,OAAO,oBAACA,QAAiB,QAAlB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet.d.ts","names":["SheetPrimitive"],"sources":["../../../src/components/ui/sheet.tsx"],"mappings":";;;iBAOS,WAAW,SAAS,sBAAsBA,OAAe,wBAAK,IAAA;iBAI9D,kBAAkB,SAAS,sBAAsBA,OAAe,2BAAQ,IAAA;iBAIxE,gBAAgB,SAAS,sBAAsBA,OAAe,yBAAM,IAAA;iBAqBpE,eACP,WACA,UACA,MACA,oBACG,SACF,sBAAsBA,OAAe;EACtC;EACA;oBACD,IAAA;
|
|
1
|
+
{"version":3,"file":"sheet.d.ts","names":["SheetPrimitive"],"sources":["../../../src/components/ui/sheet.tsx"],"mappings":";;;iBAOS,WAAW,SAAS,sBAAsBA,OAAe,wBAAK,IAAA;iBAI9D,kBAAkB,SAAS,sBAAsBA,OAAe,2BAAQ,IAAA;iBAIxE,gBAAgB,SAAS,sBAAsBA,OAAe,yBAAM,IAAA;iBAqBpE,eACP,WACA,UACA,MACA,oBACG,SACF,sBAAsBA,OAAe;EACtC;EACA;oBACD,IAAA;iBAqCQ,cAAc,cAAc,SAAS,wCAAqB,IAAA;iBAU1D,cAAc,cAAc,SAAS,wCAAqB,IAAA;iBAU1D,aAAa,cAAc,SAAS,sBAAsBA,OAAe,yBAAM,IAAA;iBAU/E,mBACP,cACG,SACF,sBAAsBA,OAAe,+BAAY,IAAA"}
|
|
@@ -2,7 +2,7 @@ import { useT } from "../../context.js";
|
|
|
2
2
|
import { cn } from "../../lib/utils.js";
|
|
3
3
|
import { Icon } from "../../lib/icons.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { Dialog } from "radix-ui";
|
|
5
|
+
import { Dialog, Direction } from "radix-ui";
|
|
6
6
|
import { XIcon } from "lucide-react";
|
|
7
7
|
//#region src/components/ui/sheet.tsx
|
|
8
8
|
function Sheet({ ...props }) {
|
|
@@ -37,8 +37,10 @@ function SheetOverlay({ className, ...props }) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
function SheetContent({ className, children, side = "right", showCloseButton = true, ...props }) {
|
|
40
|
+
const dir = Direction.useDirection();
|
|
40
41
|
const t = useT();
|
|
41
42
|
return /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
43
|
+
dir,
|
|
42
44
|
"data-slot": "sheet-content",
|
|
43
45
|
className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", className),
|
|
44
46
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet.js","names":["SheetPrimitive"],"sources":["../../../src/components/ui/sheet.tsx"],"sourcesContent":["import { XIcon } from 'lucide-react'\nimport { Dialog as SheetPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { useT } from '../../context'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\n\nfunction Sheet({ ...props }: ComponentProps<typeof SheetPrimitive.Root>) {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />\n}\n\nfunction SheetTrigger({ ...props }: ComponentProps<typeof SheetPrimitive.Trigger>) {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />\n}\n\nfunction SheetClose({ ...props }: ComponentProps<typeof SheetPrimitive.Close>) {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />\n}\n\nfunction SheetPortal({ ...props }: ComponentProps<typeof SheetPrimitive.Portal>) {\n return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />\n}\n\nfunction SheetOverlay({ className, ...props }: ComponentProps<typeof SheetPrimitive.Overlay>) {\n return (\n <SheetPrimitive.Overlay\n data-slot=\"sheet-overlay\"\n className={cn(\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction SheetContent({\n className,\n children,\n side = 'right',\n showCloseButton = true,\n ...props\n}: ComponentProps<typeof SheetPrimitive.Content> & {\n side?: 'top' | 'right' | 'bottom' | 'left'\n showCloseButton?: boolean\n}) {\n const t = useT()\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\n data-slot=\"sheet-content\"\n className={cn(\n 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',\n side === 'right' &&\n 'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm',\n side === 'left' &&\n 'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',\n side === 'top' &&\n 'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',\n side === 'bottom' &&\n 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <SheetPrimitive.Close className=\"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute end-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none\">\n <Icon name=\"alfakit::support.modal.close-button\" fallback={XIcon} className=\"size-4\" />\n <span className=\"sr-only\">{t('close', {}, 'Close')}</span>\n </SheetPrimitive.Close>\n )}\n </SheetPrimitive.Content>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sheet-header\"\n className={cn('flex flex-col gap-1.5 p-4', className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sheet-footer\"\n className={cn('mt-auto flex flex-col gap-2 p-4', className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({ className, ...props }: ComponentProps<typeof SheetPrimitive.Title>) {\n return (\n <SheetPrimitive.Title\n data-slot=\"sheet-title\"\n className={cn('text-foreground font-semibold', className)}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({\n className,\n ...props\n}: ComponentProps<typeof SheetPrimitive.Description>) {\n return (\n <SheetPrimitive.Description\n data-slot=\"sheet-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n}\n"],"mappings":";;;;;;;AAOA,SAAS,MAAM,EAAE,GAAG,SAAqD;CACvE,OAAO,oBAACA,OAAe,MAAhB;EAAqB,aAAU;EAAQ,GAAI;CAAQ,CAAA;AAC5D;AAEA,SAAS,aAAa,EAAE,GAAG,SAAwD;CACjF,OAAO,oBAACA,OAAe,SAAhB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,WAAW,EAAE,GAAG,SAAsD;CAC7E,OAAO,oBAACA,OAAe,OAAhB;EAAsB,aAAU;EAAc,GAAI;CAAQ,CAAA;AACnE;AAEA,SAAS,YAAY,EAAE,GAAG,SAAuD;CAC/E,OAAO,oBAACA,OAAe,QAAhB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAwD;CAC5F,OACE,oBAACA,OAAe,SAAhB;EACE,aAAU;EACV,WAAW,GACT,0JACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,UACA,OAAO,SACP,kBAAkB,MAClB,GAAG,SAIF;
|
|
1
|
+
{"version":3,"file":"sheet.js","names":["SheetPrimitive"],"sources":["../../../src/components/ui/sheet.tsx"],"sourcesContent":["import { XIcon } from 'lucide-react'\nimport { Direction, Dialog as SheetPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { useT } from '../../context'\nimport { Icon } from '../../lib/icons'\nimport { cn } from '../../lib/utils'\n\nfunction Sheet({ ...props }: ComponentProps<typeof SheetPrimitive.Root>) {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />\n}\n\nfunction SheetTrigger({ ...props }: ComponentProps<typeof SheetPrimitive.Trigger>) {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />\n}\n\nfunction SheetClose({ ...props }: ComponentProps<typeof SheetPrimitive.Close>) {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />\n}\n\nfunction SheetPortal({ ...props }: ComponentProps<typeof SheetPrimitive.Portal>) {\n return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />\n}\n\nfunction SheetOverlay({ className, ...props }: ComponentProps<typeof SheetPrimitive.Overlay>) {\n return (\n <SheetPrimitive.Overlay\n data-slot=\"sheet-overlay\"\n className={cn(\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction SheetContent({\n className,\n children,\n side = 'right',\n showCloseButton = true,\n ...props\n}: ComponentProps<typeof SheetPrimitive.Content> & {\n side?: 'top' | 'right' | 'bottom' | 'left'\n showCloseButton?: boolean\n}) {\n // Portaled outside Alfakit's root: carry the reading direction (starter kit pages and\n // standalone components leave <html dir> to the host).\n const dir = Direction.useDirection()\n const t = useT()\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\n dir={dir}\n data-slot=\"sheet-content\"\n className={cn(\n 'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',\n side === 'right' &&\n 'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm',\n side === 'left' &&\n 'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',\n side === 'top' &&\n 'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',\n side === 'bottom' &&\n 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <SheetPrimitive.Close className=\"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute end-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none\">\n <Icon name=\"alfakit::support.modal.close-button\" fallback={XIcon} className=\"size-4\" />\n <span className=\"sr-only\">{t('close', {}, 'Close')}</span>\n </SheetPrimitive.Close>\n )}\n </SheetPrimitive.Content>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sheet-header\"\n className={cn('flex flex-col gap-1.5 p-4', className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"sheet-footer\"\n className={cn('mt-auto flex flex-col gap-2 p-4', className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({ className, ...props }: ComponentProps<typeof SheetPrimitive.Title>) {\n return (\n <SheetPrimitive.Title\n data-slot=\"sheet-title\"\n className={cn('text-foreground font-semibold', className)}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({\n className,\n ...props\n}: ComponentProps<typeof SheetPrimitive.Description>) {\n return (\n <SheetPrimitive.Description\n data-slot=\"sheet-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n}\n"],"mappings":";;;;;;;AAOA,SAAS,MAAM,EAAE,GAAG,SAAqD;CACvE,OAAO,oBAACA,OAAe,MAAhB;EAAqB,aAAU;EAAQ,GAAI;CAAQ,CAAA;AAC5D;AAEA,SAAS,aAAa,EAAE,GAAG,SAAwD;CACjF,OAAO,oBAACA,OAAe,SAAhB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,WAAW,EAAE,GAAG,SAAsD;CAC7E,OAAO,oBAACA,OAAe,OAAhB;EAAsB,aAAU;EAAc,GAAI;CAAQ,CAAA;AACnE;AAEA,SAAS,YAAY,EAAE,GAAG,SAAuD;CAC/E,OAAO,oBAACA,OAAe,QAAhB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAwD;CAC5F,OACE,oBAACA,OAAe,SAAhB;EACE,aAAU;EACV,WAAW,GACT,0JACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,UACA,OAAO,SACP,kBAAkB,MAClB,GAAG,SAIF;CAGD,MAAM,MAAM,UAAU,aAAa;CACnC,MAAM,IAAI,KAAK;CACf,OACE,qBAAC,aAAD,EAAA,UAAA,CACE,oBAAC,cAAD,CAAe,CAAA,GACf,qBAACA,OAAe,SAAhB;EACO;EACL,aAAU;EACV,WAAW,GACT,8MACA,SAAS,WACP,oIACF,SAAS,UACP,iIACF,SAAS,SACP,4GACF,SAAS,YACP,qHACF,SACF;EACA,GAAI;EAfN,UAAA,CAiBG,UACA,mBACC,qBAACA,OAAe,OAAhB;GAAsB,WAAU;GAAhC,UAAA,CACE,oBAAC,MAAD;IAAM,MAAK;IAAsC,UAAU;IAAO,WAAU;GAAU,CAAA,GACtF,oBAAC,QAAD;IAAM,WAAU;IAAW,UAAA,EAAE,SAAS,CAAC,GAAG,OAAO;GAAQ,CAAA,CACrC;EAEF,CAAA,CAAA;CACb,CAAA,CAAA,EAAA,CAAA;AAEjB;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAgC;CACnE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,6BAA6B,SAAS;EACpD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAgC;CACnE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,mCAAmC,SAAS;EAC1D,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsD;CACxF,OACE,oBAACA,OAAe,OAAhB;EACE,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EACxB,WACA,GAAG,SACiD;CACpD,OACE,oBAACA,OAAe,aAAhB;EACE,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "../../lib/utils.js";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Tooltip } from "radix-ui";
|
|
3
|
+
import { Direction, Tooltip } from "radix-ui";
|
|
4
4
|
//#region src/components/ui/tooltip.tsx
|
|
5
5
|
function TooltipProvider({ delayDuration = 0, ...props }) {
|
|
6
6
|
return /* @__PURE__ */ jsx(Tooltip.Provider, {
|
|
@@ -22,7 +22,9 @@ function TooltipTrigger({ ...props }) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
function TooltipContent({ className, sideOffset = 4, children, ...props }) {
|
|
25
|
+
const dir = Direction.useDirection();
|
|
25
26
|
return /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsxs(Tooltip.Content, {
|
|
27
|
+
dir,
|
|
26
28
|
"data-slot": "tooltip-content",
|
|
27
29
|
sideOffset,
|
|
28
30
|
className: cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance", className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","names":["TooltipPrimitive","Tooltip"],"sources":["../../../src/components/ui/tooltip.tsx"],"sourcesContent":["import { Tooltip as TooltipPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { cn } from '../../lib/utils'\n\nfunction TooltipProvider({\n delayDuration = 0,\n ...props\n}: ComponentProps<typeof TooltipPrimitive.Provider>) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delayDuration={delayDuration}\n {...props}\n />\n )\n}\n\nfunction Tooltip({ ...props }: ComponentProps<typeof TooltipPrimitive.Root>) {\n return <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n}\n\nfunction TooltipTrigger({ ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />\n}\n\nfunction TooltipContent({\n className,\n sideOffset = 4,\n children,\n ...props\n}: ComponentProps<typeof TooltipPrimitive.Content>) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n 'bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',\n className,\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]\" />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n )\n}\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n"],"mappings":";;;;AAIA,SAAS,gBAAgB,EACvB,gBAAgB,GAChB,GAAG,SACgD;CACnD,OACE,oBAACA,QAAiB,UAAlB;EACE,aAAU;EACK;EACf,GAAI;CACL,CAAA;AAEL;AAEA,SAASC,UAAQ,EAAE,GAAG,SAAuD;CAC3E,OAAO,oBAACD,QAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ,CAAA;AAChE;AAEA,SAAS,eAAe,EAAE,GAAG,SAA0D;CACrF,OAAO,oBAACA,QAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;CAAQ,CAAA;AAC3E;AAEA,SAAS,eAAe,EACtB,WACA,aAAa,GACb,UACA,GAAG,SAC+C;
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":["TooltipPrimitive","Tooltip"],"sources":["../../../src/components/ui/tooltip.tsx"],"sourcesContent":["import { Direction, Tooltip as TooltipPrimitive } from 'radix-ui'\nimport type { ComponentProps } from 'react'\nimport { cn } from '../../lib/utils'\n\nfunction TooltipProvider({\n delayDuration = 0,\n ...props\n}: ComponentProps<typeof TooltipPrimitive.Provider>) {\n return (\n <TooltipPrimitive.Provider\n data-slot=\"tooltip-provider\"\n delayDuration={delayDuration}\n {...props}\n />\n )\n}\n\nfunction Tooltip({ ...props }: ComponentProps<typeof TooltipPrimitive.Root>) {\n return <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n}\n\nfunction TooltipTrigger({ ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>) {\n return <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />\n}\n\nfunction TooltipContent({\n className,\n sideOffset = 4,\n children,\n ...props\n}: ComponentProps<typeof TooltipPrimitive.Content>) {\n // Portaled outside Alfakit's root: carry the reading direction (starter kit pages and\n // standalone components leave <html dir> to the host).\n const dir = Direction.useDirection()\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n dir={dir}\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n 'bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',\n className,\n )}\n {...props}\n >\n {children}\n <TooltipPrimitive.Arrow className=\"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]\" />\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n )\n}\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }\n"],"mappings":";;;;AAIA,SAAS,gBAAgB,EACvB,gBAAgB,GAChB,GAAG,SACgD;CACnD,OACE,oBAACA,QAAiB,UAAlB;EACE,aAAU;EACK;EACf,GAAI;CACL,CAAA;AAEL;AAEA,SAASC,UAAQ,EAAE,GAAG,SAAuD;CAC3E,OAAO,oBAACD,QAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ,CAAA;AAChE;AAEA,SAAS,eAAe,EAAE,GAAG,SAA0D;CACrF,OAAO,oBAACA,QAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;CAAQ,CAAA;AAC3E;AAEA,SAAS,eAAe,EACtB,WACA,aAAa,GACb,UACA,GAAG,SAC+C;CAGlD,MAAM,MAAM,UAAU,aAAa;CACnC,OACE,oBAACA,QAAiB,QAAlB,EAAA,UACE,qBAACA,QAAiB,SAAlB;EACO;EACL,aAAU;EACE;EACZ,WAAW,GACT,qaACA,SACF;EACA,GAAI;EARN,UAAA,CAUG,UACD,oBAACA,QAAiB,OAAlB,EAAwB,WAAU,qGAAsG,CAAA,CAChH;CACH,CAAA,EAAA,CAAA;AAE7B"}
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Component styles shared by panels (themes.css) and by Alfakit outside panels
|
|
3
|
+
* (standalone.css, starter-kit panels): chart colours, RichEditor columns, the calendar,
|
|
4
|
+
* tree and Kanban plugins, and field positioning. They read the theme tokens (`--primary`,
|
|
5
|
+
* `--border`…), whichever stylesheet defines them. Copied into each renderer's dist.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* ------------------------------------------------------------------ Charts */
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Chart.js paints axes, legends and tooltips on the canvas, so chart widgets read these
|
|
12
|
+
* properties from <html> (re-read when the theme or dark mode changes). Colours take any
|
|
13
|
+
* CSS colour; the widths and radius are unitless numbers. Override them in a theme:
|
|
14
|
+
* :root[data-alfakit-theme~='acme'] { --chart-tooltip-bg: oklch(0.2 0 0); }
|
|
15
|
+
* Stat sparklines (`[data-slot='stat-chart']`) use the `--stat-chart-*` properties.
|
|
16
|
+
*/
|
|
17
|
+
:root {
|
|
18
|
+
--chart-text: var(--muted-foreground);
|
|
19
|
+
--chart-grid: var(--border);
|
|
20
|
+
--chart-legend-foreground: var(--muted-foreground);
|
|
21
|
+
--chart-tooltip-bg: var(--popover);
|
|
22
|
+
--chart-tooltip-foreground: var(--popover-foreground);
|
|
23
|
+
--chart-tooltip-border: var(--border);
|
|
24
|
+
--chart-tooltip-border-width: 1;
|
|
25
|
+
--chart-tooltip-radius: 6;
|
|
26
|
+
--stat-chart-stroke-width: 2;
|
|
27
|
+
--stat-chart-fill-opacity: 0.12;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* RichEditor `grid` column blocks and `lead` / `small` text, in the editor and in rendered
|
|
32
|
+
* content (`RichContentRenderer`). Columns stack on small screens. Stored as
|
|
33
|
+
* `<div data-type="grid" class="alfakit-grid alfakit-grid-cols-2"><div data-type="gridColumn">`
|
|
34
|
+
* and `<p class="alfakit-lead">`; copy these rules when showing content outside a panel.
|
|
35
|
+
*/
|
|
36
|
+
:where(.alfakit-grid) {
|
|
37
|
+
display: grid;
|
|
38
|
+
gap: 1rem;
|
|
39
|
+
grid-template-columns: minmax(0, 1fr);
|
|
40
|
+
margin-block: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
:where(.alfakit-grid-column) {
|
|
43
|
+
min-width: 0;
|
|
44
|
+
}
|
|
45
|
+
:where(.alfakit-grid-column) > :first-child {
|
|
46
|
+
margin-block-start: 0;
|
|
47
|
+
}
|
|
48
|
+
@media (min-width: 768px) {
|
|
49
|
+
:where(.alfakit-grid-cols-2) {
|
|
50
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
51
|
+
}
|
|
52
|
+
:where(.alfakit-grid-cols-3) {
|
|
53
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
54
|
+
}
|
|
55
|
+
:where(.alfakit-grid-cols-4) {
|
|
56
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
57
|
+
}
|
|
58
|
+
:where(.alfakit-grid-cols-5) {
|
|
59
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
60
|
+
}
|
|
61
|
+
:where(.alfakit-grid-cols-6) {
|
|
62
|
+
grid-template-columns: repeat(6, minmax(0, 1fr));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
:where([contenteditable] .alfakit-grid-column) {
|
|
66
|
+
border: 1px dashed var(--border);
|
|
67
|
+
border-radius: 0.375rem;
|
|
68
|
+
padding: 0.25rem 0.5rem;
|
|
69
|
+
}
|
|
70
|
+
:where(.alfakit-lead) {
|
|
71
|
+
font-size: 1.125em;
|
|
72
|
+
line-height: 1.6;
|
|
73
|
+
}
|
|
74
|
+
:where(.alfakit-prose small) {
|
|
75
|
+
font-size: 0.8125em;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* ---------------------------------------------------------- Calendar and tree */
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
* The calendar widget (alfasix/alfakit-calendar) draws FullCalendar inside
|
|
82
|
+
* `[data-slot="calendar"]`; FullCalendar reads these `--fc-*` variables, so every theme's
|
|
83
|
+
* tokens (and dark mode) apply. Override them on the slot to restyle one calendar.
|
|
84
|
+
*/
|
|
85
|
+
:where(.fc[data-slot='calendar']) {
|
|
86
|
+
--fc-small-font-size: 0.75rem;
|
|
87
|
+
--fc-page-bg-color: var(--card);
|
|
88
|
+
--fc-neutral-bg-color: var(--muted);
|
|
89
|
+
--fc-neutral-text-color: var(--muted-foreground);
|
|
90
|
+
--fc-border-color: var(--border);
|
|
91
|
+
--fc-button-text-color: var(--foreground);
|
|
92
|
+
--fc-button-bg-color: var(--background);
|
|
93
|
+
--fc-button-border-color: var(--border);
|
|
94
|
+
--fc-button-hover-bg-color: var(--accent);
|
|
95
|
+
--fc-button-hover-border-color: var(--border);
|
|
96
|
+
--fc-button-active-bg-color: var(--secondary);
|
|
97
|
+
--fc-button-active-border-color: var(--border);
|
|
98
|
+
--fc-event-bg-color: var(--primary);
|
|
99
|
+
--fc-event-border-color: var(--primary);
|
|
100
|
+
--fc-event-text-color: var(--primary-foreground);
|
|
101
|
+
--fc-event-selected-overlay-color: color-mix(in oklab, var(--foreground) 25%, transparent);
|
|
102
|
+
--fc-more-link-bg-color: var(--muted);
|
|
103
|
+
--fc-more-link-text-color: var(--foreground);
|
|
104
|
+
--fc-non-business-color: color-mix(in oklab, var(--muted) 60%, transparent);
|
|
105
|
+
--fc-bg-event-color: var(--primary);
|
|
106
|
+
--fc-bg-event-opacity: 0.2;
|
|
107
|
+
--fc-highlight-color: color-mix(in oklab, var(--primary) 15%, transparent);
|
|
108
|
+
--fc-today-bg-color: color-mix(in oklab, var(--primary) 6%, transparent);
|
|
109
|
+
--fc-now-indicator-color: var(--destructive);
|
|
110
|
+
--fc-list-event-hover-bg-color: var(--accent);
|
|
111
|
+
color: var(--card-foreground);
|
|
112
|
+
}
|
|
113
|
+
/*
|
|
114
|
+
* FullCalendar puts its `fc` class on the slot element itself and injects its own CSS
|
|
115
|
+
* (`.fc .fc-button`, two classes), so these rules are plain selectors anchored on
|
|
116
|
+
* `.fc[data-slot='calendar']` (three) rather than `:where()`, which would always lose.
|
|
117
|
+
* Restyle one calendar with a more specific selector or with the `--fc-*` variables.
|
|
118
|
+
*/
|
|
119
|
+
.fc[data-slot='calendar'] .fc-toolbar-title {
|
|
120
|
+
font-size: 1.125rem;
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
line-height: 1.75rem;
|
|
123
|
+
color: var(--foreground);
|
|
124
|
+
}
|
|
125
|
+
.fc[data-slot='calendar'] .fc-button {
|
|
126
|
+
display: inline-flex;
|
|
127
|
+
align-items: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
min-height: 2.25rem;
|
|
130
|
+
padding: 0.375rem 0.75rem;
|
|
131
|
+
border-radius: var(--radius);
|
|
132
|
+
font-size: 0.875rem;
|
|
133
|
+
font-weight: 500;
|
|
134
|
+
line-height: 1.25rem;
|
|
135
|
+
box-shadow: none;
|
|
136
|
+
text-transform: capitalize;
|
|
137
|
+
}
|
|
138
|
+
.fc[data-slot='calendar'] .fc-button .fc-icon {
|
|
139
|
+
font-size: 1.125rem;
|
|
140
|
+
}
|
|
141
|
+
.fc[data-slot='calendar'] .fc-button-group > .fc-button:not(:first-child) {
|
|
142
|
+
border-start-start-radius: 0;
|
|
143
|
+
border-end-start-radius: 0;
|
|
144
|
+
}
|
|
145
|
+
.fc[data-slot='calendar'] .fc-button-group > .fc-button:not(:last-child) {
|
|
146
|
+
border-start-end-radius: 0;
|
|
147
|
+
border-end-end-radius: 0;
|
|
148
|
+
}
|
|
149
|
+
.fc[data-slot='calendar'] .fc-button-primary:disabled {
|
|
150
|
+
opacity: 0.5;
|
|
151
|
+
}
|
|
152
|
+
.fc[data-slot='calendar'] .fc-button-primary:not(:disabled).fc-button-active,
|
|
153
|
+
.fc[data-slot='calendar'] .fc-button-primary:not(:disabled):active {
|
|
154
|
+
color: var(--secondary-foreground);
|
|
155
|
+
}
|
|
156
|
+
.fc[data-slot='calendar'] .fc-button-primary:focus,
|
|
157
|
+
.fc[data-slot='calendar'] .fc-button-primary:not(:disabled).fc-button-active:focus,
|
|
158
|
+
.fc[data-slot='calendar'] .fc-button-primary:not(:disabled):active:focus {
|
|
159
|
+
box-shadow: none;
|
|
160
|
+
}
|
|
161
|
+
.fc[data-slot='calendar'] .fc-button:focus-visible {
|
|
162
|
+
outline: 2px solid var(--ring);
|
|
163
|
+
outline-offset: 2px;
|
|
164
|
+
z-index: 2;
|
|
165
|
+
}
|
|
166
|
+
.fc[data-slot='calendar'] a {
|
|
167
|
+
color: inherit;
|
|
168
|
+
}
|
|
169
|
+
.fc[data-slot='calendar'] .fc-daygrid-day-number,
|
|
170
|
+
.fc[data-slot='calendar'] .fc-col-header-cell-cushion {
|
|
171
|
+
text-decoration: none;
|
|
172
|
+
}
|
|
173
|
+
.fc[data-slot='calendar'] .fc-col-header-cell-cushion {
|
|
174
|
+
padding-block: 0.375rem;
|
|
175
|
+
font-size: 0.75rem;
|
|
176
|
+
font-weight: 500;
|
|
177
|
+
color: var(--muted-foreground);
|
|
178
|
+
}
|
|
179
|
+
.fc[data-slot='calendar'] .fc-daygrid-day-number {
|
|
180
|
+
font-size: 0.875rem;
|
|
181
|
+
}
|
|
182
|
+
.fc[data-slot='calendar'] .fc-day-other .fc-daygrid-day-number {
|
|
183
|
+
color: var(--muted-foreground);
|
|
184
|
+
}
|
|
185
|
+
/* Today: a tinted cell (`--fc-today-bg-color`) and the date in a primary pill. */
|
|
186
|
+
.fc[data-slot='calendar'] .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
|
|
187
|
+
display: inline-flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
justify-content: center;
|
|
190
|
+
min-width: 1.75rem;
|
|
191
|
+
height: 1.75rem;
|
|
192
|
+
margin: 0.25rem;
|
|
193
|
+
padding: 0 0.375rem;
|
|
194
|
+
border-radius: 9999px;
|
|
195
|
+
background: var(--primary);
|
|
196
|
+
color: var(--primary-foreground);
|
|
197
|
+
font-weight: 600;
|
|
198
|
+
}
|
|
199
|
+
.fc[data-slot='calendar'] .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion {
|
|
200
|
+
color: var(--primary);
|
|
201
|
+
font-weight: 600;
|
|
202
|
+
}
|
|
203
|
+
.fc[data-slot='calendar'] .fc-event {
|
|
204
|
+
border-radius: min(var(--radius), 0.375rem);
|
|
205
|
+
}
|
|
206
|
+
.fc[data-slot='calendar'] .fc-daygrid-event,
|
|
207
|
+
.fc[data-slot='calendar'] .fc-timegrid-event .fc-event-main,
|
|
208
|
+
.fc[data-slot='calendar'] .fc-list-event td {
|
|
209
|
+
font-size: 0.75rem;
|
|
210
|
+
}
|
|
211
|
+
/* Clipped titles keep their beginning and end with an ellipsis, also a Latin title in a
|
|
212
|
+
right-to-left calendar (its direction follows its own text). */
|
|
213
|
+
.fc[data-slot='calendar'] .fc-event-title {
|
|
214
|
+
text-overflow: ellipsis;
|
|
215
|
+
unicode-bidi: plaintext;
|
|
216
|
+
text-align: start;
|
|
217
|
+
}
|
|
218
|
+
.fc[data-slot='calendar'] .fc-daygrid-dot-event:hover,
|
|
219
|
+
.fc[data-slot='calendar'] .fc-daygrid-dot-event.fc-event-mirror {
|
|
220
|
+
background: var(--accent);
|
|
221
|
+
}
|
|
222
|
+
.fc[data-slot='calendar'] .fc-list-day-cushion,
|
|
223
|
+
.fc[data-slot='calendar'] .fc-popover-header {
|
|
224
|
+
color: var(--foreground);
|
|
225
|
+
}
|
|
226
|
+
.fc[data-slot='calendar'] .fc-popover {
|
|
227
|
+
border-radius: var(--radius);
|
|
228
|
+
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
|
|
229
|
+
overflow: hidden;
|
|
230
|
+
}
|
|
231
|
+
.fc[data-slot='calendar'] .fc-timegrid-slot-label,
|
|
232
|
+
.fc[data-slot='calendar'] .fc-timegrid-axis,
|
|
233
|
+
.fc[data-slot='calendar'] .fc-list-event-time {
|
|
234
|
+
color: var(--muted-foreground);
|
|
235
|
+
font-size: 0.75rem;
|
|
236
|
+
}
|
|
237
|
+
/*
|
|
238
|
+
* The list view hides its column headers for screen readers with `left: -10000px`. Right to
|
|
239
|
+
* left that is scrollable overflow: the whole page gains a 10 000 px horizontal scroll and the
|
|
240
|
+
* top bar slides under the sidebar. Clip it in place instead (still read by screen readers).
|
|
241
|
+
*/
|
|
242
|
+
.fc[data-slot='calendar'] .fc-list-table thead {
|
|
243
|
+
left: auto;
|
|
244
|
+
inset-inline-start: 0;
|
|
245
|
+
width: 1px;
|
|
246
|
+
height: 1px;
|
|
247
|
+
overflow: hidden;
|
|
248
|
+
clip-path: inset(50%);
|
|
249
|
+
white-space: nowrap;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/*
|
|
253
|
+
* Fields contain what they position. Headless switches, checkboxes and radios render a
|
|
254
|
+
* visually hidden native input beside the control, absolutely positioned (and shifted by
|
|
255
|
+
* -100%); without a positioned field it lands at the page edge and, right to left, widens
|
|
256
|
+
* the page on phones.
|
|
257
|
+
*/
|
|
258
|
+
:where([data-slot='field']) {
|
|
259
|
+
position: relative;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/*
|
|
263
|
+
* Narrow screens: FullCalendar keeps its header toolbar on one row, wider than a phone.
|
|
264
|
+
* Its chunks (navigation, title, views) wrap instead, and the title shrinks. Flex gaps and
|
|
265
|
+
* `justify-content` follow the writing direction, so this works right to left too. (Plain
|
|
266
|
+
* selectors: FullCalendar injects its own CSS, which would beat `:where()`; the slot is
|
|
267
|
+
* the `.fc` element itself.)
|
|
268
|
+
*/
|
|
269
|
+
@media (max-width: 39.99rem) {
|
|
270
|
+
[data-slot='calendar'] .fc-toolbar.fc-header-toolbar {
|
|
271
|
+
flex-wrap: wrap;
|
|
272
|
+
gap: 0.5rem;
|
|
273
|
+
}
|
|
274
|
+
[data-slot='calendar'] .fc-toolbar .fc-toolbar-chunk {
|
|
275
|
+
display: flex;
|
|
276
|
+
flex-wrap: wrap;
|
|
277
|
+
align-items: center;
|
|
278
|
+
gap: 0.25rem;
|
|
279
|
+
min-width: 0;
|
|
280
|
+
}
|
|
281
|
+
[data-slot='calendar'] .fc-toolbar .fc-toolbar-title {
|
|
282
|
+
font-size: 1rem;
|
|
283
|
+
overflow-wrap: anywhere;
|
|
284
|
+
}
|
|
285
|
+
[data-slot='calendar'] .fc-toolbar .fc-button {
|
|
286
|
+
font-size: 0.8125rem;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/*
|
|
291
|
+
* The tree (alfasix/alfakit-tree): the drop indicator while dragging. Rows carry
|
|
292
|
+
* `data-drop="before|after|inside"`; lines are drawn above or below the row, so they
|
|
293
|
+
* need no direction.
|
|
294
|
+
*/
|
|
295
|
+
:where([data-slot='tree-item'][data-drop='before']) {
|
|
296
|
+
box-shadow: inset 0 2px 0 0 var(--primary);
|
|
297
|
+
}
|
|
298
|
+
:where([data-slot='tree-item'][data-drop='after']) {
|
|
299
|
+
box-shadow: inset 0 -2px 0 0 var(--primary);
|
|
300
|
+
}
|
|
301
|
+
:where([data-slot='tree-item'][data-drop='inside']) {
|
|
302
|
+
background-color: color-mix(in oklab, var(--primary) 10%, transparent);
|
|
303
|
+
outline: 1px dashed var(--primary);
|
|
304
|
+
outline-offset: -1px;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/*
|
|
308
|
+
* The Kanban board (alfasix/alfakit-kanban). A card being dragged leaves a dashed
|
|
309
|
+
* placeholder (`data-picked="pointer"`) while a copy follows the pointer
|
|
310
|
+
* (`data-slot="kanban-ghost"`); a card picked up with the keyboard is lifted
|
|
311
|
+
* (`data-picked="keyboard"`). A list the picked card may not enter has `data-refused`.
|
|
312
|
+
*/
|
|
313
|
+
:where([data-slot='kanban-card'][data-picked='pointer']) {
|
|
314
|
+
opacity: 0.45;
|
|
315
|
+
}
|
|
316
|
+
:where([data-slot='kanban-card'][data-picked='pointer'] > [data-slot='kanban-card-body']) {
|
|
317
|
+
border-style: dashed;
|
|
318
|
+
box-shadow: none;
|
|
319
|
+
}
|
|
320
|
+
:where([data-slot='kanban-card'][data-picked='keyboard'] > [data-slot='kanban-card-body']) {
|
|
321
|
+
outline: 2px solid var(--primary);
|
|
322
|
+
outline-offset: 2px;
|
|
323
|
+
box-shadow: 0 10px 24px -12px color-mix(in oklab, var(--foreground) 45%, transparent);
|
|
324
|
+
}
|
|
325
|
+
:where([data-slot='kanban-card'][data-saving]) {
|
|
326
|
+
opacity: 0.7;
|
|
327
|
+
}
|
|
328
|
+
:where([data-slot='kanban-ghost']) {
|
|
329
|
+
cursor: grabbing;
|
|
330
|
+
list-style: none;
|
|
331
|
+
box-shadow: 0 18px 40px -16px color-mix(in oklab, var(--foreground) 55%, transparent);
|
|
332
|
+
}
|
|
333
|
+
:where([data-slot='kanban-dropzone'][data-refused]) {
|
|
334
|
+
background-color: color-mix(in oklab, var(--destructive) 8%, transparent);
|
|
335
|
+
outline: 1px dashed var(--destructive);
|
|
336
|
+
outline-offset: -1px;
|
|
337
|
+
}
|
|
338
|
+
:where(body[data-kanban-dragging]) {
|
|
339
|
+
cursor: grabbing;
|
|
340
|
+
user-select: none;
|
|
341
|
+
-webkit-user-select: none;
|
|
342
|
+
}
|
|
343
|
+
@media (prefers-reduced-motion: reduce) {
|
|
344
|
+
:where([data-slot='kanban-card'] > [data-slot='kanban-card-body']) {
|
|
345
|
+
transition: none;
|
|
346
|
+
}
|
|
347
|
+
}
|
package/dist/context.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ export interface AlfakitContextValue {
|
|
|
13
13
|
* their own schemas by token.
|
|
14
14
|
*/
|
|
15
15
|
poll?: (target: string, interval: string | number | null | undefined) => () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Fetches fresh schemas of components now (`live()` tables and widgets after a record
|
|
18
|
+
* change). Panels leave it out (a partial reload); components outside panels fetch theirs.
|
|
19
|
+
*/
|
|
20
|
+
refresh?: (targets: string[]) => Promise<void>;
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* Outside panels there is no shared `alfakit` prop and no `page` prop: `<AlfakitComponent>`
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","names":[],"sources":["../src/context.tsx"],"mappings":";;;YAiBY,eAAe;iBAEV;EACf,UAAU,kBAAkB;EAC5B,OAAO,eAAe;EACtB,SAAS;EACT,YAAY;;;;;;EAMZ,QAAQ,gBAAgB;;;;;;
|
|
1
|
+
{"version":3,"file":"context.d.ts","names":[],"sources":["../src/context.tsx"],"mappings":";;;YAiBY,eAAe;iBAEV;EACf,UAAU,kBAAkB;EAC5B,OAAO,eAAe;EACtB,SAAS;EACT,YAAY;;;;;;EAMZ,QAAQ,gBAAgB;;;;;EAKxB,WAAW,sBAAsB;;;;;;iBAwBlB;EACf,OAAO;EACP,MAAM;;wBAKQ,qBACd,OACA;EAEA,OAAO;EACP,UAAU;oBACX,IAAA;wBAIe,iBAAiB;wBAIjB,kBACd,OACA;EAEA,OAAO;EACP,UAAU;oBACX,IAAA;wBAIe,cAAc;;wBAmBd,sBAAsB;;wBAKtB,YAAY;wBAQZ,iBAAiB;;wBAQjB,oBAAoB,YAAY;wBAShC,mBAAmB;;wBAWnB,QAAQ;;wBAOR,aAAa;;wBAOb,mBAAmB;wBAInB;;wBAQA,gBAAgB;wBAehB,mBAAmB;wBAInB,eAAe,kBAAkB"}
|
package/dist/context.js
CHANGED
|
@@ -64,6 +64,10 @@ function usePageSchema() {
|
|
|
64
64
|
function usePollComponent() {
|
|
65
65
|
return useContext(AlfakitContext)?.poll ?? pollComponent;
|
|
66
66
|
}
|
|
67
|
+
/** How `live()` components refresh: their own fetch outside panels, else a partial reload. */
|
|
68
|
+
function useRefreshComponents() {
|
|
69
|
+
return useContext(AlfakitContext)?.refresh;
|
|
70
|
+
}
|
|
67
71
|
function useAlfakitProps() {
|
|
68
72
|
return useOptionalPageProps();
|
|
69
73
|
}
|
|
@@ -110,6 +114,6 @@ function useRegistry() {
|
|
|
110
114
|
return useAlfakit().registry;
|
|
111
115
|
}
|
|
112
116
|
//#endregion
|
|
113
|
-
export { AlfakitProvider, StandaloneProvider, useActionRunner, useAlfakit, useAlfakitProps, useChoice, useDirection, useFormatter, useLocalization, useOptionalAlfakit, useOptionalRegistry, usePageSchema, usePanel, usePollComponent, useRegistry, useStandalone, useT };
|
|
117
|
+
export { AlfakitProvider, StandaloneProvider, useActionRunner, useAlfakit, useAlfakitProps, useChoice, useDirection, useFormatter, useLocalization, useOptionalAlfakit, useOptionalRegistry, usePageSchema, usePanel, usePollComponent, useRefreshComponents, useRegistry, useStandalone, useT };
|
|
114
118
|
|
|
115
119
|
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":["globalTranslator"],"sources":["../src/context.tsx"],"sourcesContent":["import {\n translator as globalTranslator,\n LocaleFormatter,\n pollComponent,\n resolvePanelNavigation,\n type ActionRunner,\n type AlfakitPageProps,\n type ComponentRegistry,\n type LocalizationSchema,\n type PageSchema,\n type PanelSchema,\n type Translator,\n} from '@alfakit/core'\nimport { usePage } from '@inertiajs/react'\nimport { createContext, useContext, useMemo, type ComponentType, type ReactNode } from 'react'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyComponent = ComponentType<any>\n\nexport interface AlfakitContextValue {\n registry: ComponentRegistry<AnyComponent>\n pages: Record<string, AnyComponent>\n actions: ActionRunner\n translator: Translator\n /**\n * Polls a component (`table`, `widget:<id>`) and returns an unsubscribe. Panels use the\n * shared `pollComponent()` (an Inertia partial reload); components outside panels fetch\n * their own schemas by token.\n */\n poll?: (target: string, interval: string | number | null | undefined) => () => void\n}\n\nconst AlfakitContext = createContext<AlfakitContextValue | null>(null)\n\nconst NO_PROPS: AlfakitPageProps = {} as AlfakitPageProps\n\n/**\n * The Inertia page props, or an empty object outside an Inertia app (component tests,\n * Storybook, a plain server render of an `<AlfakitComponent>`). `usePage()` only reads a\n * context before throwing, so the hook order is the same on both paths.\n */\nfunction useOptionalPageProps(): AlfakitPageProps {\n try {\n return usePage<AlfakitPageProps>().props\n } catch {\n return NO_PROPS\n }\n}\n\n/**\n * Outside panels there is no shared `alfakit` prop and no `page` prop: `<AlfakitComponent>`\n * provides both from its payload, and the hooks below read them first.\n */\nexport interface StandaloneContextValue {\n panel: PanelSchema\n page: PageSchema\n}\n\nconst StandaloneContext = createContext<StandaloneContextValue | null>(null)\n\nexport function StandaloneProvider({\n value,\n children,\n}: {\n value: StandaloneContextValue\n children: ReactNode\n}) {\n return <StandaloneContext.Provider value={value}>{children}</StandaloneContext.Provider>\n}\n\nexport function useStandalone(): StandaloneContextValue | null {\n return useContext(StandaloneContext)\n}\n\nexport function AlfakitProvider({\n value,\n children,\n}: {\n value: AlfakitContextValue\n children: ReactNode\n}) {\n return <AlfakitContext.Provider value={value}>{children}</AlfakitContext.Provider>\n}\n\nexport function useAlfakit(): AlfakitContextValue {\n const context = useContext(AlfakitContext)\n\n if (!context) {\n throw new Error('Alfakit components must be rendered inside createAlfakit().')\n }\n\n return context\n}\n\n/**\n * The component registry when rendered inside `createAlfakit()`, otherwise null (primitives\n * rendered on their own in tests or Storybook).\n */\nexport function useOptionalRegistry(): ComponentRegistry<AnyComponent> | null {\n return useContext(AlfakitContext)?.registry ?? null\n}\n\n/** The context the component renders in, or null outside `createAlfakit()` and `<AlfakitComponent>`. */\nexport function useOptionalAlfakit(): AlfakitContextValue | null {\n return useContext(AlfakitContext)\n}\n\n/** The shared `alfakit` prop (panel, navigation, user, endpoints…). */\nexport function usePanel(): PanelSchema {\n const standalone = useContext(StandaloneContext)\n const props = useOptionalPageProps()\n\n // The navigation structure is a once prop; its active items and badges are merged in here.\n return resolvePanelNavigation(standalone?.panel ?? props.alfakit, props.alfakitNavigationBadges)\n}\n\nexport function usePageSchema(): PageSchema | undefined {\n const standalone = useContext(StandaloneContext)\n const page = useOptionalPageProps().page\n\n return standalone?.page ?? page\n}\n\n/** Poll a component (`table`, `widget:<id>`); the returned function stops it. */\nexport function usePollComponent(): NonNullable<AlfakitContextValue['poll']> {\n return useContext(AlfakitContext)?.poll ?? pollComponent\n}\n\nexport function useAlfakitProps(): AlfakitPageProps {\n return useOptionalPageProps()\n}\n\nfunction useTranslator(): Translator {\n // Primitives may render outside createAlfakit() (tests, Storybook); fall back to the\n // shared translator so they still show their English defaults.\n return useContext(AlfakitContext)?.translator ?? globalTranslator\n}\n\n/** `t('table.showing', { first: 1, last: 10, total: 42 }, 'Fallback')` */\nexport function useT(): Translator['t'] {\n const translator = useTranslator()\n\n return translator.t.bind(translator)\n}\n\n/** Plural-aware lines: `choice('table.selected', 3)` (Laravel `trans_choice` syntax). */\nexport function useChoice(): Translator['choice'] {\n const translator = useTranslator()\n\n return translator.choice.bind(translator)\n}\n\n/** The current language, direction, currency, timezone and language list. */\nexport function useLocalization(): LocalizationSchema {\n return usePanel().localization\n}\n\nexport function useDirection(): 'ltr' | 'rtl' {\n const standalone = useContext(StandaloneContext)\n const panel = useOptionalPageProps().alfakit\n\n return (standalone?.panel ?? panel)?.localization?.direction ?? 'ltr'\n}\n\n/** `Intl` formatting in the user's locale: `format.money(12.5)`, `format.relative(date)`. */\nexport function useFormatter(): LocaleFormatter {\n const standalone = useContext(StandaloneContext)\n const panel = useOptionalPageProps().alfakit\n const localization = (standalone?.panel ?? panel)?.localization\n\n const tag = localization?.tag\n const currency = localization?.currency\n const timezone = localization?.timezone\n\n return useMemo(\n () => new LocaleFormatter(tag ?? 'en', currency ?? 'USD', timezone),\n [tag, currency, timezone],\n )\n}\n\nexport function useActionRunner(): ActionRunner {\n return useAlfakit().actions\n}\n\nexport function useRegistry(): ComponentRegistry<AnyComponent> {\n return useAlfakit().registry\n}\n"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"context.js","names":["globalTranslator"],"sources":["../src/context.tsx"],"sourcesContent":["import {\n translator as globalTranslator,\n LocaleFormatter,\n pollComponent,\n resolvePanelNavigation,\n type ActionRunner,\n type AlfakitPageProps,\n type ComponentRegistry,\n type LocalizationSchema,\n type PageSchema,\n type PanelSchema,\n type Translator,\n} from '@alfakit/core'\nimport { usePage } from '@inertiajs/react'\nimport { createContext, useContext, useMemo, type ComponentType, type ReactNode } from 'react'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type AnyComponent = ComponentType<any>\n\nexport interface AlfakitContextValue {\n registry: ComponentRegistry<AnyComponent>\n pages: Record<string, AnyComponent>\n actions: ActionRunner\n translator: Translator\n /**\n * Polls a component (`table`, `widget:<id>`) and returns an unsubscribe. Panels use the\n * shared `pollComponent()` (an Inertia partial reload); components outside panels fetch\n * their own schemas by token.\n */\n poll?: (target: string, interval: string | number | null | undefined) => () => void\n /**\n * Fetches fresh schemas of components now (`live()` tables and widgets after a record\n * change). Panels leave it out (a partial reload); components outside panels fetch theirs.\n */\n refresh?: (targets: string[]) => Promise<void>\n}\n\nconst AlfakitContext = createContext<AlfakitContextValue | null>(null)\n\nconst NO_PROPS: AlfakitPageProps = {} as AlfakitPageProps\n\n/**\n * The Inertia page props, or an empty object outside an Inertia app (component tests,\n * Storybook, a plain server render of an `<AlfakitComponent>`). `usePage()` only reads a\n * context before throwing, so the hook order is the same on both paths.\n */\nfunction useOptionalPageProps(): AlfakitPageProps {\n try {\n return usePage<AlfakitPageProps>().props\n } catch {\n return NO_PROPS\n }\n}\n\n/**\n * Outside panels there is no shared `alfakit` prop and no `page` prop: `<AlfakitComponent>`\n * provides both from its payload, and the hooks below read them first.\n */\nexport interface StandaloneContextValue {\n panel: PanelSchema\n page: PageSchema\n}\n\nconst StandaloneContext = createContext<StandaloneContextValue | null>(null)\n\nexport function StandaloneProvider({\n value,\n children,\n}: {\n value: StandaloneContextValue\n children: ReactNode\n}) {\n return <StandaloneContext.Provider value={value}>{children}</StandaloneContext.Provider>\n}\n\nexport function useStandalone(): StandaloneContextValue | null {\n return useContext(StandaloneContext)\n}\n\nexport function AlfakitProvider({\n value,\n children,\n}: {\n value: AlfakitContextValue\n children: ReactNode\n}) {\n return <AlfakitContext.Provider value={value}>{children}</AlfakitContext.Provider>\n}\n\nexport function useAlfakit(): AlfakitContextValue {\n const context = useContext(AlfakitContext)\n\n if (!context) {\n throw new Error('Alfakit components must be rendered inside createAlfakit().')\n }\n\n return context\n}\n\n/**\n * The component registry when rendered inside `createAlfakit()`, otherwise null (primitives\n * rendered on their own in tests or Storybook).\n */\nexport function useOptionalRegistry(): ComponentRegistry<AnyComponent> | null {\n return useContext(AlfakitContext)?.registry ?? null\n}\n\n/** The context the component renders in, or null outside `createAlfakit()` and `<AlfakitComponent>`. */\nexport function useOptionalAlfakit(): AlfakitContextValue | null {\n return useContext(AlfakitContext)\n}\n\n/** The shared `alfakit` prop (panel, navigation, user, endpoints…). */\nexport function usePanel(): PanelSchema {\n const standalone = useContext(StandaloneContext)\n const props = useOptionalPageProps()\n\n // The navigation structure is a once prop; its active items and badges are merged in here.\n return resolvePanelNavigation(standalone?.panel ?? props.alfakit, props.alfakitNavigationBadges)\n}\n\nexport function usePageSchema(): PageSchema | undefined {\n const standalone = useContext(StandaloneContext)\n const page = useOptionalPageProps().page\n\n return standalone?.page ?? page\n}\n\n/** Poll a component (`table`, `widget:<id>`); the returned function stops it. */\nexport function usePollComponent(): NonNullable<AlfakitContextValue['poll']> {\n return useContext(AlfakitContext)?.poll ?? pollComponent\n}\n\n/** How `live()` components refresh: their own fetch outside panels, else a partial reload. */\nexport function useRefreshComponents(): AlfakitContextValue['refresh'] {\n return useContext(AlfakitContext)?.refresh\n}\n\nexport function useAlfakitProps(): AlfakitPageProps {\n return useOptionalPageProps()\n}\n\nfunction useTranslator(): Translator {\n // Primitives may render outside createAlfakit() (tests, Storybook); fall back to the\n // shared translator so they still show their English defaults.\n return useContext(AlfakitContext)?.translator ?? globalTranslator\n}\n\n/** `t('table.showing', { first: 1, last: 10, total: 42 }, 'Fallback')` */\nexport function useT(): Translator['t'] {\n const translator = useTranslator()\n\n return translator.t.bind(translator)\n}\n\n/** Plural-aware lines: `choice('table.selected', 3)` (Laravel `trans_choice` syntax). */\nexport function useChoice(): Translator['choice'] {\n const translator = useTranslator()\n\n return translator.choice.bind(translator)\n}\n\n/** The current language, direction, currency, timezone and language list. */\nexport function useLocalization(): LocalizationSchema {\n return usePanel().localization\n}\n\nexport function useDirection(): 'ltr' | 'rtl' {\n const standalone = useContext(StandaloneContext)\n const panel = useOptionalPageProps().alfakit\n\n return (standalone?.panel ?? panel)?.localization?.direction ?? 'ltr'\n}\n\n/** `Intl` formatting in the user's locale: `format.money(12.5)`, `format.relative(date)`. */\nexport function useFormatter(): LocaleFormatter {\n const standalone = useContext(StandaloneContext)\n const panel = useOptionalPageProps().alfakit\n const localization = (standalone?.panel ?? panel)?.localization\n\n const tag = localization?.tag\n const currency = localization?.currency\n const timezone = localization?.timezone\n\n return useMemo(\n () => new LocaleFormatter(tag ?? 'en', currency ?? 'USD', timezone),\n [tag, currency, timezone],\n )\n}\n\nexport function useActionRunner(): ActionRunner {\n return useAlfakit().actions\n}\n\nexport function useRegistry(): ComponentRegistry<AnyComponent> {\n return useAlfakit().registry\n}\n"],"mappings":";;;;;AAqCA,MAAM,iBAAiB,cAA0C,IAAI;AAErE,MAAM,WAA6B,CAAC;;;;;;AAOpC,SAAS,uBAAyC;CAChD,IAAI;EACF,OAAO,QAA0B,CAAC,CAAC;CACrC,QAAQ;EACN,OAAO;CACT;AACF;AAWA,MAAM,oBAAoB,cAA6C,IAAI;AAE3E,SAAgB,mBAAmB,EACjC,OACA,YAIC;CACD,OAAO,oBAAC,kBAAkB,UAAnB;EAAmC;EAAQ;CAAqC,CAAA;AACzF;AAEA,SAAgB,gBAA+C;CAC7D,OAAO,WAAW,iBAAiB;AACrC;AAEA,SAAgB,gBAAgB,EAC9B,OACA,YAIC;CACD,OAAO,oBAAC,eAAe,UAAhB;EAAgC;EAAQ;CAAkC,CAAA;AACnF;AAEA,SAAgB,aAAkC;CAChD,MAAM,UAAU,WAAW,cAAc;CAEzC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,6DAA6D;CAG/E,OAAO;AACT;;;;;AAMA,SAAgB,sBAA8D;CAC5E,OAAO,WAAW,cAAc,CAAC,EAAE,YAAY;AACjD;;AAGA,SAAgB,qBAAiD;CAC/D,OAAO,WAAW,cAAc;AAClC;;AAGA,SAAgB,WAAwB;CACtC,MAAM,aAAa,WAAW,iBAAiB;CAC/C,MAAM,QAAQ,qBAAqB;CAGnC,OAAO,uBAAuB,YAAY,SAAS,MAAM,SAAS,MAAM,uBAAuB;AACjG;AAEA,SAAgB,gBAAwC;CACtD,MAAM,aAAa,WAAW,iBAAiB;CAC/C,MAAM,OAAO,qBAAqB,CAAC,CAAC;CAEpC,OAAO,YAAY,QAAQ;AAC7B;;AAGA,SAAgB,mBAA6D;CAC3E,OAAO,WAAW,cAAc,CAAC,EAAE,QAAQ;AAC7C;;AAGA,SAAgB,uBAAuD;CACrE,OAAO,WAAW,cAAc,CAAC,EAAE;AACrC;AAEA,SAAgB,kBAAoC;CAClD,OAAO,qBAAqB;AAC9B;AAEA,SAAS,gBAA4B;CAGnC,OAAO,WAAW,cAAc,CAAC,EAAE,cAAcA;AACnD;;AAGA,SAAgB,OAAwB;CACtC,MAAM,aAAa,cAAc;CAEjC,OAAO,WAAW,EAAE,KAAK,UAAU;AACrC;;AAGA,SAAgB,YAAkC;CAChD,MAAM,aAAa,cAAc;CAEjC,OAAO,WAAW,OAAO,KAAK,UAAU;AAC1C;;AAGA,SAAgB,kBAAsC;CACpD,OAAO,SAAS,CAAC,CAAC;AACpB;AAEA,SAAgB,eAA8B;CAC5C,MAAM,aAAa,WAAW,iBAAiB;CAC/C,MAAM,QAAQ,qBAAqB,CAAC,CAAC;CAErC,QAAQ,YAAY,SAAS,MAAA,EAAQ,cAAc,aAAa;AAClE;;AAGA,SAAgB,eAAgC;CAC9C,MAAM,aAAa,WAAW,iBAAiB;CAC/C,MAAM,QAAQ,qBAAqB,CAAC,CAAC;CACrC,MAAM,gBAAgB,YAAY,SAAS,MAAA,EAAQ;CAEnD,MAAM,MAAM,cAAc;CAC1B,MAAM,WAAW,cAAc;CAC/B,MAAM,WAAW,cAAc;CAE/B,OAAO,cACC,IAAI,gBAAgB,OAAO,MAAM,YAAY,OAAO,QAAQ,GAClE;EAAC;EAAK;EAAU;CAAQ,CAC1B;AACF;AAEA,SAAgB,kBAAgC;CAC9C,OAAO,WAAW,CAAC,CAAC;AACtB;AAEA,SAAgB,cAA+C;CAC7D,OAAO,WAAW,CAAC,CAAC;AACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-alfakit.d.ts","names":[],"sources":["../src/create-alfakit.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"create-alfakit.d.ts","names":[],"sources":["../src/create-alfakit.tsx"],"mappings":";;;;;iBAsHiB,6BAA6B,eAAe;;EAE3D,WAAW,KAAK,cAAc;EAC9B;;;;;;;;;;;;;;wBAsLoB,cAAc,UAAS,uBAA4B"}
|
package/dist/create-alfakit.js
CHANGED
|
@@ -4,15 +4,16 @@ import { TooltipProvider } from "./components/ui/tooltip.js";
|
|
|
4
4
|
import { discoverComponents } from "./lib/discovery.js";
|
|
5
5
|
import { builtInComponents, createDefaultRegistry } from "./registry.js";
|
|
6
6
|
import { FlashToasts, showToast } from "./components/notifications/flash-toasts.js";
|
|
7
|
-
import { PwaManager } from "./components/panel/pwa.js";
|
|
8
7
|
import { AlfakitPage } from "./pages/page.js";
|
|
9
8
|
import { ActionModals } from "./components/actions/action-modals.js";
|
|
10
9
|
import { RealtimeNotifications } from "./components/notifications/realtime-notifications.js";
|
|
10
|
+
import { PwaManager } from "./components/panel/pwa.js";
|
|
11
11
|
import { ImpersonationBanner } from "./components/panel/impersonation-banner.js";
|
|
12
12
|
import { DevToolsSlot } from "./components/dev-tools/dev-tools-slot.js";
|
|
13
13
|
import { SchemaContractGuard } from "./components/panel/schema-contract-guard.js";
|
|
14
14
|
import { Toaster } from "./components/ui/sonner.js";
|
|
15
|
-
import {
|
|
15
|
+
import { panelLayouts } from "./layouts/panel-layouts.js";
|
|
16
|
+
import { ActionRunner, PANEL_TOAST_OFFSET, Translator, applyDocumentLocale, applyPanelTheme, configureCharts, configureRealtime, debugRecorder, documentNonce, effectiveErrorNotifications, initializeAppearance, installErrorNotifications, installPrefetchInvalidation, installSpaUrlExceptions, registerRichEditorExtensions, reloadOnExpiredPage, resolveRequestErrorNotification, resolveToastPosition, setRequestErrorReporter, whenIdle } from "@alfakit/core";
|
|
16
17
|
import { createInertiaApp, router, usePage } from "@inertiajs/react";
|
|
17
18
|
import { StrictMode, createElement, useLayoutEffect } from "react";
|
|
18
19
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -31,9 +32,10 @@ function AlfakitRoot({ children, toasterId }) {
|
|
|
31
32
|
translator.setTranslations(panel.translations ?? {});
|
|
32
33
|
translator.setLocale(localization?.tag ?? "en");
|
|
33
34
|
}
|
|
35
|
+
const ownsDocument = panel?.starterKit !== true;
|
|
34
36
|
useLayoutEffect(() => {
|
|
35
|
-
applyDocumentLocale(localization);
|
|
36
|
-
}, [localization]);
|
|
37
|
+
if (ownsDocument) applyDocumentLocale(localization);
|
|
38
|
+
}, [localization, ownsDocument]);
|
|
37
39
|
useLayoutEffect(() => {
|
|
38
40
|
applyPanelTheme(panel);
|
|
39
41
|
}, [panel]);
|
|
@@ -72,7 +74,7 @@ function AlfakitRoot({ children, toasterId }) {
|
|
|
72
74
|
*/
|
|
73
75
|
function bootAlfakit(options = {}) {
|
|
74
76
|
const discovered = discoverComponents(options.discover);
|
|
75
|
-
const registry = createDefaultRegistry().registerMany(discovered.components).registerMany(options.components ?? {});
|
|
77
|
+
const registry = createDefaultRegistry().registerMany(panelLayouts).registerMany(discovered.components).registerMany(options.components ?? {});
|
|
76
78
|
const pages = {
|
|
77
79
|
"Alfakit/Page": AlfakitPage,
|
|
78
80
|
...discovered.pages,
|
|
@@ -138,6 +140,7 @@ function bootAlfakit(options = {}) {
|
|
|
138
140
|
return createInertiaApp({
|
|
139
141
|
title: (title) => title,
|
|
140
142
|
progress: options.progress === void 0 ? { color: "var(--primary)" } : options.progress,
|
|
143
|
+
nonce: documentNonce(),
|
|
141
144
|
resolve: (name, page) => {
|
|
142
145
|
const component = pages[name];
|
|
143
146
|
if (!component) throw new Error(`Alfakit: page component "${name}" is not registered. Pass it to createAlfakit({ pages }).`);
|