@open-mercato/ui 0.6.7 → 0.6.8-develop.6874.1.982d6097d8
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/.turbo/turbo-build.log +1 -1
- package/AGENTS.md +4 -2
- package/agentic/standalone-guide.md +1 -1
- package/build.mjs +2 -54
- package/dist/ai/AiChat.js +26 -7
- package/dist/ai/AiChat.js.map +2 -2
- package/dist/ai/LoopDisabledBanner.js +1 -1
- package/dist/ai/LoopDisabledBanner.js.map +2 -2
- package/dist/ai/parts/ConfirmationCard.js +4 -4
- package/dist/ai/parts/ConfirmationCard.js.map +2 -2
- package/dist/ai/parts/FieldDiffCard.js +2 -2
- package/dist/ai/parts/FieldDiffCard.js.map +2 -2
- package/dist/ai/parts/MutationResultCard.js +3 -3
- package/dist/ai/parts/MutationResultCard.js.map +2 -2
- package/dist/ai/ui-parts/pending-phase3-placeholder.js +1 -1
- package/dist/ai/ui-parts/pending-phase3-placeholder.js.map +2 -2
- package/dist/backend/AppShell.js +43 -4
- package/dist/backend/AppShell.js.map +2 -2
- package/dist/backend/AuthSessionGuard.js +14 -0
- package/dist/backend/AuthSessionGuard.js.map +2 -2
- package/dist/backend/BackendChromeProvider.js +6 -1
- package/dist/backend/BackendChromeProvider.js.map +2 -2
- package/dist/backend/CrudForm.js +6 -4
- package/dist/backend/CrudForm.js.map +2 -2
- package/dist/backend/DataTable.js +20 -18
- package/dist/backend/DataTable.js.map +2 -2
- package/dist/backend/JsonBuilder.js +3 -3
- package/dist/backend/JsonBuilder.js.map +2 -2
- package/dist/backend/NextStepCallout.js +4 -4
- package/dist/backend/NextStepCallout.js.map +1 -1
- package/dist/backend/PerspectiveSidebar.js +1 -1
- package/dist/backend/PerspectiveSidebar.js.map +2 -2
- package/dist/backend/ProfileDropdown.js +2 -1
- package/dist/backend/ProfileDropdown.js.map +2 -2
- package/dist/backend/RowActions.js +2 -2
- package/dist/backend/RowActions.js.map +2 -2
- package/dist/backend/confirm-dialog/ConfirmDialog.js +13 -1
- package/dist/backend/confirm-dialog/ConfirmDialog.js.map +2 -2
- package/dist/backend/crud/useGroupOrder.js +14 -21
- package/dist/backend/crud/useGroupOrder.js.map +2 -2
- package/dist/backend/custom-fields/FieldDefinitionsManager.js +1 -1
- package/dist/backend/custom-fields/FieldDefinitionsManager.js.map +2 -2
- package/dist/backend/dashboard/DashboardScreen.js +3 -3
- package/dist/backend/dashboard/DashboardScreen.js.map +2 -2
- package/dist/backend/detail/AddressTiles.js +4 -5
- package/dist/backend/detail/AddressTiles.js.map +2 -2
- package/dist/backend/detail/AttachmentDeleteDialog.js +1 -1
- package/dist/backend/detail/AttachmentDeleteDialog.js.map +2 -2
- package/dist/backend/detail/AttachmentMetadataDialog.js.map +1 -1
- package/dist/backend/detail/AttachmentsSection.js +1 -1
- package/dist/backend/detail/AttachmentsSection.js.map +2 -2
- package/dist/backend/detail/NotesSection.js +1 -1
- package/dist/backend/detail/NotesSection.js.map +2 -2
- package/dist/backend/detail/TagsSection.js +1 -1
- package/dist/backend/detail/TagsSection.js.map +2 -2
- package/dist/backend/filters/AdvancedFilterPanel.js +1 -1
- package/dist/backend/filters/AdvancedFilterPanel.js.map +2 -2
- package/dist/backend/forms/FormHeader.js +1 -2
- package/dist/backend/forms/FormHeader.js.map +2 -2
- package/dist/backend/icons/lucideRegistry.generated.js +1 -25
- package/dist/backend/icons/lucideRegistry.generated.js.map +2 -2
- package/dist/backend/icons/lucideRegistry.js +3 -3
- package/dist/backend/icons/lucideRegistry.js.map +2 -2
- package/dist/backend/icons/lucideRegistryRuntime.js +28 -0
- package/dist/backend/icons/lucideRegistryRuntime.js.map +7 -0
- package/dist/backend/injection/spotIds.js +23 -18
- package/dist/backend/injection/spotIds.js.map +2 -2
- package/dist/backend/inputs/ComboboxInput.js.map +1 -1
- package/dist/backend/messages/EmailThreadsPanel.js +1 -1
- package/dist/backend/messages/EmailThreadsPanel.js.map +2 -2
- package/dist/backend/perspectiveState.js +34 -0
- package/dist/backend/perspectiveState.js.map +7 -0
- package/dist/backend/schedule/ScheduleAgenda.js +3 -3
- package/dist/backend/schedule/ScheduleAgenda.js.map +1 -1
- package/dist/backend/schedule/ScheduleGrid.js +3 -3
- package/dist/backend/schedule/ScheduleGrid.js.map +1 -1
- package/dist/backend/schedule/ScheduleToolbar.js +87 -70
- package/dist/backend/schedule/ScheduleToolbar.js.map +2 -2
- package/dist/backend/sidebar/SidebarCustomizationEditor.js +30 -2
- package/dist/backend/sidebar/SidebarCustomizationEditor.js.map +2 -2
- package/dist/backend/sidebar/customization-helpers.js +30 -0
- package/dist/backend/sidebar/customization-helpers.js.map +2 -2
- package/dist/backend/utils/apiCall.js +21 -1
- package/dist/backend/utils/apiCall.js.map +2 -2
- package/dist/backend/utils/customFieldDefs.js.map +2 -2
- package/dist/backend/utils/customFieldForms.js +10 -9
- package/dist/backend/utils/customFieldForms.js.map +2 -2
- package/dist/backend/utils/fetchAllPages.js +57 -0
- package/dist/backend/utils/fetchAllPages.js.map +7 -0
- package/dist/backend/utils/nav.js +5 -2
- package/dist/backend/utils/nav.js.map +2 -2
- package/dist/backend/version-history/VersionHistoryPanel.js +1 -1
- package/dist/backend/version-history/VersionHistoryPanel.js.map +2 -2
- package/dist/frontend/LanguageSwitcher.js +2 -1
- package/dist/frontend/LanguageSwitcher.js.map +2 -2
- package/dist/portal/PortalContext.js +1 -1
- package/dist/portal/PortalContext.js.map +2 -2
- package/dist/portal/hooks/portalBridgeStatus.js +25 -0
- package/dist/portal/hooks/portalBridgeStatus.js.map +7 -0
- package/dist/portal/hooks/usePortalEventBridge.js +6 -0
- package/dist/portal/hooks/usePortalEventBridge.js.map +2 -2
- package/dist/portal/hooks/usePortalNotifications.js +42 -4
- package/dist/portal/hooks/usePortalNotifications.js.map +2 -2
- package/dist/portal/utils/nav.js +2 -3
- package/dist/portal/utils/nav.js.map +2 -2
- package/dist/primitives/ErrorNotice.js +1 -1
- package/dist/primitives/ErrorNotice.js.map +2 -2
- package/dist/primitives/Notice.js +1 -1
- package/dist/primitives/Notice.js.map +1 -1
- package/dist/primitives/button.js +9 -4
- package/dist/primitives/button.js.map +2 -2
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/theme/ThemeProvider.js.map +2 -2
- package/dist/theme/index.js +3 -0
- package/dist/theme/index.js.map +2 -2
- package/dist/theme/theme-init-script.js +17 -0
- package/dist/theme/theme-init-script.js.map +7 -0
- package/figma/alert.figma.tsx +35 -0
- package/figma/badge.figma.tsx +33 -0
- package/figma/button.figma.tsx +33 -0
- package/figma/checkbox.figma.tsx +28 -0
- package/figma/drawer.figma.tsx +40 -0
- package/figma/input-variants.figma.tsx +58 -0
- package/figma/radio.figma.tsx +16 -0
- package/figma/select.figma.tsx +24 -0
- package/figma/status-badge.figma.tsx +24 -0
- package/figma/switch.figma.tsx +28 -0
- package/figma/tabs.figma.tsx +22 -0
- package/figma/tag.figma.tsx +27 -0
- package/figma.config.json +6 -0
- package/jest.config.cjs +2 -1
- package/package.json +21 -18
- package/scripts/lucideRegistrySource.cjs +133 -0
- package/src/ai/AiChat.tsx +36 -7
- package/src/ai/LoopDisabledBanner.tsx +1 -1
- package/src/ai/__tests__/AiChat.test.tsx +31 -0
- package/src/ai/parts/ConfirmationCard.tsx +4 -4
- package/src/ai/parts/FieldDiffCard.tsx +2 -2
- package/src/ai/parts/MutationResultCard.tsx +3 -3
- package/src/ai/ui-parts/pending-phase3-placeholder.tsx +2 -2
- package/src/backend/AppShell.tsx +55 -4
- package/src/backend/AuthSessionGuard.tsx +29 -0
- package/src/backend/BackendChromeProvider.tsx +19 -1
- package/src/backend/CrudForm.tsx +18 -4
- package/src/backend/DataTable.tsx +36 -19
- package/src/backend/JsonBuilder.tsx +3 -3
- package/src/backend/NextStepCallout.tsx +4 -4
- package/src/backend/PerspectiveSidebar.tsx +1 -1
- package/src/backend/ProfileDropdown.tsx +1 -0
- package/src/backend/RowActions.tsx +2 -2
- package/src/backend/__tests__/AppShell.test.tsx +65 -7
- package/src/backend/__tests__/AuthSessionGuard.test.tsx +52 -0
- package/src/backend/__tests__/BackendChromeProvider.test.tsx +98 -2
- package/src/backend/__tests__/CrudForm.fieldsetBinding.test.tsx +158 -0
- package/src/backend/__tests__/CrudForm.groupInjectionColumn.test.tsx +98 -0
- package/src/backend/__tests__/DataTable.metaHiddenLateColumns.test.tsx +105 -0
- package/src/backend/__tests__/DataTable.perspectiveStorage.test.ts +62 -1
- package/src/backend/__tests__/nav-utils.test.ts +139 -0
- package/src/backend/confirm-dialog/ConfirmDialog.tsx +16 -1
- package/src/backend/confirm-dialog/__tests__/ConfirmDialog.test.tsx +68 -1
- package/src/backend/crud/__tests__/useGroupOrder.test.ts +39 -1
- package/src/backend/crud/useGroupOrder.ts +30 -25
- package/src/backend/custom-fields/FieldDefinitionsManager.tsx +1 -1
- package/src/backend/dashboard/DashboardScreen.tsx +3 -3
- package/src/backend/detail/AddressTiles.tsx +3 -6
- package/src/backend/detail/AttachmentDeleteDialog.tsx +1 -1
- package/src/backend/detail/AttachmentMetadataDialog.tsx +1 -1
- package/src/backend/detail/AttachmentsSection.tsx +1 -1
- package/src/backend/detail/NotesSection.tsx +1 -1
- package/src/backend/detail/TagsSection.tsx +1 -1
- package/src/backend/detail/__tests__/AttachmentAssignmentsEditor.test.tsx +21 -0
- package/src/backend/filters/AdvancedFilterPanel.tsx +1 -1
- package/src/backend/forms/FormHeader.tsx +1 -2
- package/src/backend/icons/__tests__/lucideRegistryGenerator.test.ts +177 -0
- package/src/backend/icons/lucideRegistry.generated.tsx +3 -37
- package/src/backend/icons/lucideRegistry.ts +2 -2
- package/src/backend/icons/lucideRegistryRuntime.tsx +36 -0
- package/src/backend/injection/__tests__/spotIds.extension-points.test.ts +38 -0
- package/src/backend/injection/spotIds.ts +23 -18
- package/src/backend/inputs/ComboboxInput.tsx +1 -1
- package/src/backend/messages/EmailThreadsPanel.tsx +1 -1
- package/src/backend/perspectiveState.ts +44 -0
- package/src/backend/schedule/ScheduleAgenda.tsx +3 -3
- package/src/backend/schedule/ScheduleGrid.tsx +3 -3
- package/src/backend/schedule/ScheduleToolbar.tsx +89 -68
- package/src/backend/sidebar/SidebarCustomizationEditor.tsx +42 -3
- package/src/backend/sidebar/__tests__/group-visibility.test.ts +131 -0
- package/src/backend/sidebar/customization-helpers.ts +47 -0
- package/src/backend/utils/__tests__/apiCall.test.ts +61 -0
- package/src/backend/utils/__tests__/customFieldForms.optionsPaging.test.ts +95 -0
- package/src/backend/utils/__tests__/fetchAllPages.test.ts +103 -0
- package/src/backend/utils/apiCall.ts +29 -1
- package/src/backend/utils/customFieldDefs.ts +1 -0
- package/src/backend/utils/customFieldForms.ts +15 -11
- package/src/backend/utils/fetchAllPages.ts +93 -0
- package/src/backend/utils/nav.ts +22 -2
- package/src/backend/version-history/VersionHistoryPanel.tsx +1 -1
- package/src/frontend/LanguageSwitcher.tsx +1 -0
- package/src/portal/PortalContext.tsx +1 -1
- package/src/portal/hooks/__tests__/usePortalEventBridge.test.tsx +66 -0
- package/src/portal/hooks/__tests__/usePortalNotifications.test.tsx +155 -0
- package/src/portal/hooks/portalBridgeStatus.ts +29 -0
- package/src/portal/hooks/usePortalEventBridge.ts +6 -0
- package/src/portal/hooks/usePortalNotifications.ts +55 -12
- package/src/portal/utils/__tests__/nav.test.ts +2 -2
- package/src/portal/utils/nav.ts +3 -4
- package/src/primitives/ErrorNotice.tsx +1 -1
- package/src/primitives/Notice.tsx +5 -5
- package/src/primitives/__tests__/button.test.tsx +70 -0
- package/src/primitives/button.tsx +10 -4
- package/src/theme/ThemeProvider.tsx +1 -2
- package/src/theme/__tests__/theme-init-script.test.ts +70 -0
- package/src/theme/index.ts +1 -0
- package/src/theme/theme-init-script.ts +23 -0
|
@@ -8,10 +8,15 @@ const buttonVariants = cva(
|
|
|
8
8
|
variants: {
|
|
9
9
|
variant: {
|
|
10
10
|
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary-hover",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
/* Destructive is quiet by design: red text on a calm surface. A wall
|
|
12
|
+
of solid red buttons trains users to ignore red. The filled form is
|
|
13
|
+
`destructive-solid`, reserved for the single point-of-no-return
|
|
14
|
+
confirmation inside a dialog — never for the button that opens it. */
|
|
15
|
+
destructive: "border border-destructive bg-background text-destructive shadow-xs hover:bg-destructive/10 aria-invalid:ring-destructive dark:aria-invalid:ring-destructive",
|
|
16
|
+
"destructive-solid": "bg-destructive text-white shadow-xs hover:bg-destructive/90 aria-invalid:ring-destructive dark:aria-invalid:ring-destructive",
|
|
17
|
+
"destructive-outline": "border border-destructive bg-background text-destructive shadow-xs hover:bg-destructive/10",
|
|
18
|
+
"destructive-soft": "bg-destructive/10 text-destructive hover:bg-destructive/15",
|
|
19
|
+
"destructive-ghost": "text-destructive hover:bg-destructive/10",
|
|
15
20
|
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
16
21
|
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
17
22
|
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/primitives/button.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '@open-mercato/shared/lib/utils'\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium cursor-pointer transition-all disabled:pointer-events-none disabled:bg-bg-disabled disabled:text-text-disabled disabled:border-border-disabled disabled:shadow-none disabled:[background-image:none] [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:outline-none focus-visible:shadow-focus aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary-hover',\n destructive:\n '
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { cn } from '@open-mercato/shared/lib/utils'\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium cursor-pointer transition-all disabled:pointer-events-none disabled:bg-bg-disabled disabled:text-text-disabled disabled:border-border-disabled disabled:shadow-none disabled:[background-image:none] [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:outline-none focus-visible:shadow-focus aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary-hover',\n /* Destructive is quiet by design: red text on a calm surface. A wall\n of solid red buttons trains users to ignore red. The filled form is\n `destructive-solid`, reserved for the single point-of-no-return\n confirmation inside a dialog \u2014 never for the button that opens it. */\n destructive:\n 'border border-destructive bg-background text-destructive shadow-xs hover:bg-destructive/10 aria-invalid:ring-destructive dark:aria-invalid:ring-destructive',\n 'destructive-solid':\n 'bg-destructive text-white shadow-xs hover:bg-destructive/90 aria-invalid:ring-destructive dark:aria-invalid:ring-destructive',\n 'destructive-outline':\n 'border border-destructive bg-background text-destructive shadow-xs hover:bg-destructive/10',\n 'destructive-soft':\n 'bg-destructive/10 text-destructive hover:bg-destructive/15',\n 'destructive-ghost':\n 'text-destructive hover:bg-destructive/10',\n outline:\n 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',\n secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',\n muted: 'text-muted-foreground hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n default: 'h-9 px-4 py-2 has-[>svg]:px-3',\n sm: 'h-8 gap-1.5 px-3 has-[>svg]:px-2.5',\n lg: 'h-10 px-6 has-[>svg]:px-4',\n '2xs': 'h-7 gap-1 px-2 py-0.5 has-[>svg]:px-1.5 text-xs',\n icon: 'size-9',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n }\n)\n\nexport function Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<'button'> &\n VariantProps<typeof buttonVariants> & { asChild?: boolean }) {\n const Comp = asChild ? Slot : 'button'\n return <Comp data-slot=\"button\" className={cn(buttonVariants({ variant, size, className }))} {...props} />\n}\n\nexport { buttonVariants }\n\n"],
|
|
5
|
+
"mappings": "AAwDS;AAvDT,SAAS,YAAY;AACrB,SAAS,WAA8B;AACvC,SAAS,UAAU;AAEnB,MAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,QAKT,aACE;AAAA,QACF,qBACE;AAAA,QACF,uBACE;AAAA,QACF,oBACE;AAAA,QACF,qBACE;AAAA,QACF,SACE;AAAA,QACF,WAAW;AAAA,QACX,OAAO;AAAA,QACP,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAEO,SAAS,OAAO;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,GAAG;AACL,GAC+D;AAC7D,QAAM,OAAO,UAAU,OAAO;AAC9B,SAAO,oBAAC,QAAK,aAAU,UAAS,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC,GAAI,GAAG,OAAO;AAC1G;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,9 +3,9 @@ import { Fragment, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { createContext, useContext } from "react";
|
|
5
5
|
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
6
|
+
import { THEME_STORAGE_KEY } from "./theme-init-script.js";
|
|
6
7
|
const logger = createLogger("ui").child({ component: "ThemeProvider" });
|
|
7
8
|
const ThemeContext = createContext(void 0);
|
|
8
|
-
const THEME_STORAGE_KEY = "om-theme";
|
|
9
9
|
function getSystemTheme() {
|
|
10
10
|
if (typeof window === "undefined") return "light";
|
|
11
11
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/theme/ThemeProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { createContext, useContext } from 'react'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('ui').child({ component: 'ThemeProvider' })\n\nexport type Theme = 'light' | 'dark' | 'system'\n\ntype ThemeContextValue = {\n theme: Theme\n resolvedTheme: 'light' | 'dark'\n setTheme: (theme: Theme) => void\n}\n\nconst ThemeContext = createContext<ThemeContextValue | undefined>(undefined)\n\
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { createContext, useContext } from 'react'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\nimport { THEME_STORAGE_KEY } from './theme-init-script'\n\nconst logger = createLogger('ui').child({ component: 'ThemeProvider' })\n\nexport type Theme = 'light' | 'dark' | 'system'\n\ntype ThemeContextValue = {\n theme: Theme\n resolvedTheme: 'light' | 'dark'\n setTheme: (theme: Theme) => void\n}\n\nconst ThemeContext = createContext<ThemeContextValue | undefined>(undefined)\n\nfunction getSystemTheme(): 'light' | 'dark' {\n if (typeof window === 'undefined') return 'light'\n return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'\n}\n\nfunction getStoredTheme(): Theme {\n if (typeof window === 'undefined') return 'system'\n try {\n const stored = localStorage.getItem(THEME_STORAGE_KEY)\n if (stored === 'light' || stored === 'dark' || stored === 'system') {\n return stored\n }\n } catch (error) {\n // localStorage may be unavailable in private browsing, iframes, or restricted contexts\n // Theme will default to system preference - this is expected graceful degradation\n if (process.env.NODE_ENV === 'development') {\n logger.warn('localStorage read failed', { err: error })\n }\n }\n return 'system'\n}\n\nfunction applyTheme(resolvedTheme: 'light' | 'dark') {\n const root = document.documentElement\n if (resolvedTheme === 'dark') {\n root.classList.add('dark')\n } else {\n root.classList.remove('dark')\n }\n}\n\nexport function ThemeProvider({ children }: { children: React.ReactNode }) {\n const [theme, setThemeState] = React.useState<Theme>('system')\n const [resolvedTheme, setResolvedTheme] = React.useState<'light' | 'dark'>('light')\n const [mounted, setMounted] = React.useState(false)\n\n // Initialize theme from localStorage on mount\n React.useEffect(() => {\n const stored = getStoredTheme()\n setThemeState(stored)\n const resolved = stored === 'system' ? getSystemTheme() : stored\n setResolvedTheme(resolved)\n applyTheme(resolved)\n setMounted(true)\n }, [])\n\n // Listen for system theme changes\n React.useEffect(() => {\n if (typeof window === 'undefined') return\n\n const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)')\n const handleChange = () => {\n if (theme === 'system') {\n const newResolved = getSystemTheme()\n setResolvedTheme(newResolved)\n applyTheme(newResolved)\n }\n }\n\n mediaQuery.addEventListener('change', handleChange)\n return () => mediaQuery.removeEventListener('change', handleChange)\n }, [theme])\n\n const setTheme = React.useCallback((newTheme: Theme) => {\n setThemeState(newTheme)\n try {\n localStorage.setItem(THEME_STORAGE_KEY, newTheme)\n } catch (error) {\n // localStorage may be unavailable - theme still works for this session, just won't persist\n if (process.env.NODE_ENV === 'development') {\n logger.warn('localStorage write failed', { err: error })\n }\n }\n const resolved = newTheme === 'system' ? getSystemTheme() : newTheme\n setResolvedTheme(resolved)\n applyTheme(resolved)\n }, [])\n\n const value = React.useMemo(\n () => ({ theme, resolvedTheme, setTheme }),\n [theme, resolvedTheme, setTheme]\n )\n\n // Prevent flash of wrong theme during hydration\n if (!mounted) {\n return <>{children}</>\n }\n\n return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>\n}\n\nexport function useTheme(): ThemeContextValue {\n const context = useContext(ThemeContext)\n if (context === undefined) {\n // Return safe defaults when not in provider (e.g., server render)\n return {\n theme: 'system',\n resolvedTheme: 'light',\n setTheme: () => {},\n }\n }\n return context\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/theme/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ThemeProvider, useTheme } from "./ThemeProvider.js";
|
|
2
|
+
import { THEME_INIT_SCRIPT, THEME_STORAGE_KEY } from "./theme-init-script.js";
|
|
2
3
|
import { ThemeToggle } from "./ThemeToggle.js";
|
|
3
4
|
import { QueryProvider } from "./QueryProvider.js";
|
|
4
5
|
export {
|
|
5
6
|
QueryProvider,
|
|
7
|
+
THEME_INIT_SCRIPT,
|
|
8
|
+
THEME_STORAGE_KEY,
|
|
6
9
|
ThemeProvider,
|
|
7
10
|
ThemeToggle,
|
|
8
11
|
useTheme
|
package/dist/theme/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/theme/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { ThemeProvider, useTheme } from './ThemeProvider'\nexport { ThemeToggle } from './ThemeToggle'\nexport { QueryProvider } from './QueryProvider'\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,eAAe,gBAAgB;AACxC,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;",
|
|
4
|
+
"sourcesContent": ["export { ThemeProvider, useTheme } from './ThemeProvider'\nexport { THEME_INIT_SCRIPT, THEME_STORAGE_KEY } from './theme-init-script'\nexport { ThemeToggle } from './ThemeToggle'\nexport { QueryProvider } from './QueryProvider'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,eAAe,gBAAgB;AACxC,SAAS,mBAAmB,yBAAyB;AACrD,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const THEME_STORAGE_KEY = "om-theme";
|
|
2
|
+
const THEME_INIT_SCRIPT = `
|
|
3
|
+
(function () {
|
|
4
|
+
try {
|
|
5
|
+
var stored = localStorage.getItem(${JSON.stringify(THEME_STORAGE_KEY)});
|
|
6
|
+
var theme = stored === 'dark' ? 'dark'
|
|
7
|
+
: stored === 'light' ? 'light'
|
|
8
|
+
: window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
9
|
+
if (theme === 'dark') document.documentElement.classList.add('dark');
|
|
10
|
+
} catch (error) {}
|
|
11
|
+
})();
|
|
12
|
+
`;
|
|
13
|
+
export {
|
|
14
|
+
THEME_INIT_SCRIPT,
|
|
15
|
+
THEME_STORAGE_KEY
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=theme-init-script.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/theme/theme-init-script.ts"],
|
|
4
|
+
"sourcesContent": ["export const THEME_STORAGE_KEY = 'om-theme'\n\n/**\n * Inline source for the root layout's theme initializer.\n *\n * It MUST be rendered as a plain, non-deferred `<script>` element so the browser\n * executes it while parsing the document, before the first paint. Deferring it \u2014\n * for example through `next/script` with `strategy=\"beforeInteractive\"`, which in\n * the App Router only queues the code onto `self.__next_s` for the client runtime\n * to replay once hydration starts \u2014 makes the page paint in light theme first and\n * flash to dark afterwards.\n */\nexport const THEME_INIT_SCRIPT = `\n(function () {\n try {\n var stored = localStorage.getItem(${JSON.stringify(THEME_STORAGE_KEY)});\n var theme = stored === 'dark' ? 'dark'\n : stored === 'light' ? 'light'\n : window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n if (theme === 'dark') document.documentElement.classList.add('dark');\n } catch (error) {}\n})();\n`\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,oBAAoB;AAY1B,MAAM,oBAAoB;AAAA;AAAA;AAAA,wCAGO,KAAK,UAAU,iBAAiB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Alert, AlertDescription, AlertTitle } from '../src/primitives/alert'
|
|
4
|
+
|
|
5
|
+
figma.connect(Alert, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=169-2358', {
|
|
6
|
+
imports: ["import { Alert, AlertTitle, AlertDescription } from '@open-mercato/ui/primitives/alert'"],
|
|
7
|
+
props: {
|
|
8
|
+
status: figma.enum('Status', {
|
|
9
|
+
Error: 'error',
|
|
10
|
+
Warning: 'warning',
|
|
11
|
+
Success: 'success',
|
|
12
|
+
Information: 'information',
|
|
13
|
+
Feature: 'feature',
|
|
14
|
+
}),
|
|
15
|
+
style: figma.enum('Style', {
|
|
16
|
+
Filled: 'filled',
|
|
17
|
+
Light: 'light',
|
|
18
|
+
Lighter: 'lighter',
|
|
19
|
+
Stroke: 'stroke',
|
|
20
|
+
}),
|
|
21
|
+
size: figma.enum('Size', {
|
|
22
|
+
XS: 'xs',
|
|
23
|
+
Small: 'sm',
|
|
24
|
+
Default: 'default',
|
|
25
|
+
}),
|
|
26
|
+
title: figma.string('Title'),
|
|
27
|
+
description: figma.string('Description'),
|
|
28
|
+
},
|
|
29
|
+
example: ({ status, style, size, title, description }) => (
|
|
30
|
+
<Alert status={status} style={style} size={size}>
|
|
31
|
+
<AlertTitle>{title}</AlertTitle>
|
|
32
|
+
<AlertDescription>{description}</AlertDescription>
|
|
33
|
+
</Alert>
|
|
34
|
+
),
|
|
35
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Badge } from '../src/primitives/badge'
|
|
4
|
+
|
|
5
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
6
|
+
figma.connect(Badge, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
7
|
+
imports: ["import { Badge } from '@open-mercato/ui/primitives/badge'"],
|
|
8
|
+
props: {
|
|
9
|
+
variant: figma.enum('Variant', {
|
|
10
|
+
Default: 'default',
|
|
11
|
+
Secondary: 'secondary',
|
|
12
|
+
Outline: 'outline',
|
|
13
|
+
Muted: 'muted',
|
|
14
|
+
Success: 'success',
|
|
15
|
+
Warning: 'warning',
|
|
16
|
+
Info: 'info',
|
|
17
|
+
Neutral: 'neutral',
|
|
18
|
+
Error: 'error',
|
|
19
|
+
Brand: 'brand',
|
|
20
|
+
}),
|
|
21
|
+
size: figma.enum('Size', {
|
|
22
|
+
Small: 'sm',
|
|
23
|
+
Default: 'default',
|
|
24
|
+
Large: 'lg',
|
|
25
|
+
}),
|
|
26
|
+
label: figma.string('Label'),
|
|
27
|
+
},
|
|
28
|
+
example: ({ variant, size, label }) => (
|
|
29
|
+
<Badge variant={variant} size={size}>
|
|
30
|
+
{label}
|
|
31
|
+
</Badge>
|
|
32
|
+
),
|
|
33
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Button } from '../src/primitives/button'
|
|
4
|
+
|
|
5
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
6
|
+
figma.connect(Button, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
7
|
+
imports: ["import { Button } from '@open-mercato/ui/primitives/button'"],
|
|
8
|
+
props: {
|
|
9
|
+
variant: figma.enum('Variant', {
|
|
10
|
+
Primary: 'default',
|
|
11
|
+
Destructive: 'destructive',
|
|
12
|
+
Outline: 'outline',
|
|
13
|
+
Secondary: 'secondary',
|
|
14
|
+
Ghost: 'ghost',
|
|
15
|
+
Muted: 'muted',
|
|
16
|
+
Link: 'link',
|
|
17
|
+
}),
|
|
18
|
+
size: figma.enum('Size', {
|
|
19
|
+
Default: 'default',
|
|
20
|
+
Small: 'sm',
|
|
21
|
+
Large: 'lg',
|
|
22
|
+
'2XS': '2xs',
|
|
23
|
+
Icon: 'icon',
|
|
24
|
+
}),
|
|
25
|
+
disabled: figma.boolean('Disabled'),
|
|
26
|
+
label: figma.string('Label'),
|
|
27
|
+
},
|
|
28
|
+
example: ({ variant, size, disabled, label }) => (
|
|
29
|
+
<Button variant={variant} size={size} disabled={disabled}>
|
|
30
|
+
{label}
|
|
31
|
+
</Button>
|
|
32
|
+
),
|
|
33
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Checkbox } from '../src/primitives/checkbox'
|
|
4
|
+
import { CheckboxField } from '../src/primitives/checkbox-field'
|
|
5
|
+
|
|
6
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
7
|
+
figma.connect(Checkbox, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
8
|
+
imports: ["import { Checkbox } from '@open-mercato/ui/primitives/checkbox'"],
|
|
9
|
+
variant: { Label: 'False' },
|
|
10
|
+
props: {
|
|
11
|
+
checked: figma.boolean('Checked'),
|
|
12
|
+
disabled: figma.boolean('Disabled'),
|
|
13
|
+
},
|
|
14
|
+
example: ({ checked, disabled }) => <Checkbox checked={checked} disabled={disabled} />,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
figma.connect(CheckboxField, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
18
|
+
imports: ["import { CheckboxField } from '@open-mercato/ui/primitives/checkbox-field'"],
|
|
19
|
+
variant: { Label: 'True' },
|
|
20
|
+
props: {
|
|
21
|
+
checked: figma.boolean('Checked'),
|
|
22
|
+
disabled: figma.boolean('Disabled'),
|
|
23
|
+
label: figma.string('Label text'),
|
|
24
|
+
},
|
|
25
|
+
example: ({ checked, disabled, label }) => (
|
|
26
|
+
<CheckboxField checked={checked} disabled={disabled} label={label} />
|
|
27
|
+
),
|
|
28
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import {
|
|
4
|
+
Drawer,
|
|
5
|
+
DrawerBody,
|
|
6
|
+
DrawerClose,
|
|
7
|
+
DrawerContent,
|
|
8
|
+
DrawerDescription,
|
|
9
|
+
DrawerFooter,
|
|
10
|
+
DrawerHeader,
|
|
11
|
+
DrawerTitle,
|
|
12
|
+
} from '../src/primitives/drawer'
|
|
13
|
+
import { Button } from '../src/primitives/button'
|
|
14
|
+
|
|
15
|
+
figma.connect(Drawer, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=486-7366', {
|
|
16
|
+
imports: [
|
|
17
|
+
"import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, DrawerBody, DrawerFooter, DrawerClose } from '@open-mercato/ui/primitives/drawer'",
|
|
18
|
+
],
|
|
19
|
+
props: {
|
|
20
|
+
title: figma.string('Title'),
|
|
21
|
+
description: figma.string('Description'),
|
|
22
|
+
},
|
|
23
|
+
example: ({ title, description }) => (
|
|
24
|
+
<Drawer>
|
|
25
|
+
<DrawerContent>
|
|
26
|
+
<DrawerHeader>
|
|
27
|
+
<DrawerTitle>{title}</DrawerTitle>
|
|
28
|
+
<DrawerDescription>{description}</DrawerDescription>
|
|
29
|
+
</DrawerHeader>
|
|
30
|
+
<DrawerBody>Content</DrawerBody>
|
|
31
|
+
<DrawerFooter layout="equal">
|
|
32
|
+
<DrawerClose asChild>
|
|
33
|
+
<Button variant="outline">Cancel</Button>
|
|
34
|
+
</DrawerClose>
|
|
35
|
+
<Button>Save</Button>
|
|
36
|
+
</DrawerFooter>
|
|
37
|
+
</DrawerContent>
|
|
38
|
+
</Drawer>
|
|
39
|
+
),
|
|
40
|
+
})
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Input } from '../src/primitives/input'
|
|
4
|
+
import { EmailInput } from '../src/primitives/email-input'
|
|
5
|
+
import { SearchInput } from '../src/primitives/search-input'
|
|
6
|
+
import { PasswordInput } from '../src/primitives/password-input'
|
|
7
|
+
import { WebsiteInput } from '../src/primitives/website-input'
|
|
8
|
+
|
|
9
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
10
|
+
figma.connect(Input, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
11
|
+
imports: ["import { Input } from '@open-mercato/ui/primitives/input'"],
|
|
12
|
+
variant: { Type: 'Text' },
|
|
13
|
+
props: {
|
|
14
|
+
placeholder: figma.string('Placeholder'),
|
|
15
|
+
disabled: figma.boolean('Disabled'),
|
|
16
|
+
},
|
|
17
|
+
example: ({ placeholder, disabled }) => <Input placeholder={placeholder} disabled={disabled} />,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
figma.connect(EmailInput, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
21
|
+
imports: ["import { EmailInput } from '@open-mercato/ui/primitives/email-input'"],
|
|
22
|
+
variant: { Type: 'Email' },
|
|
23
|
+
props: {
|
|
24
|
+
placeholder: figma.string('Placeholder'),
|
|
25
|
+
disabled: figma.boolean('Disabled'),
|
|
26
|
+
},
|
|
27
|
+
example: ({ placeholder, disabled }) => <EmailInput placeholder={placeholder} disabled={disabled} />,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
figma.connect(SearchInput, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
31
|
+
imports: ["import { SearchInput } from '@open-mercato/ui/primitives/search-input'"],
|
|
32
|
+
variant: { Type: 'Search' },
|
|
33
|
+
props: {
|
|
34
|
+
placeholder: figma.string('Placeholder'),
|
|
35
|
+
disabled: figma.boolean('Disabled'),
|
|
36
|
+
},
|
|
37
|
+
example: ({ placeholder, disabled }) => <SearchInput placeholder={placeholder} disabled={disabled} />,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
figma.connect(PasswordInput, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
41
|
+
imports: ["import { PasswordInput } from '@open-mercato/ui/primitives/password-input'"],
|
|
42
|
+
variant: { Type: 'Password' },
|
|
43
|
+
props: {
|
|
44
|
+
placeholder: figma.string('Placeholder'),
|
|
45
|
+
disabled: figma.boolean('Disabled'),
|
|
46
|
+
},
|
|
47
|
+
example: ({ placeholder, disabled }) => <PasswordInput placeholder={placeholder} disabled={disabled} />,
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
figma.connect(WebsiteInput, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
51
|
+
imports: ["import { WebsiteInput } from '@open-mercato/ui/primitives/website-input'"],
|
|
52
|
+
variant: { Type: 'Website' },
|
|
53
|
+
props: {
|
|
54
|
+
placeholder: figma.string('Placeholder'),
|
|
55
|
+
disabled: figma.boolean('Disabled'),
|
|
56
|
+
},
|
|
57
|
+
example: ({ placeholder, disabled }) => <WebsiteInput placeholder={placeholder} disabled={disabled} />,
|
|
58
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Radio, RadioGroup } from '../src/primitives/radio'
|
|
4
|
+
|
|
5
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
6
|
+
figma.connect(Radio, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
7
|
+
imports: ["import { Radio, RadioGroup } from '@open-mercato/ui/primitives/radio'"],
|
|
8
|
+
props: {
|
|
9
|
+
disabled: figma.boolean('Disabled'),
|
|
10
|
+
},
|
|
11
|
+
example: ({ disabled }) => (
|
|
12
|
+
<RadioGroup defaultValue="first">
|
|
13
|
+
<Radio value="first" disabled={disabled} />
|
|
14
|
+
</RadioGroup>
|
|
15
|
+
),
|
|
16
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../src/primitives/select'
|
|
4
|
+
|
|
5
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
6
|
+
figma.connect(Select, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
7
|
+
imports: [
|
|
8
|
+
"import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@open-mercato/ui/primitives/select'",
|
|
9
|
+
],
|
|
10
|
+
props: {
|
|
11
|
+
placeholder: figma.string('Placeholder'),
|
|
12
|
+
disabled: figma.boolean('Disabled'),
|
|
13
|
+
},
|
|
14
|
+
example: ({ placeholder, disabled }) => (
|
|
15
|
+
<Select>
|
|
16
|
+
<SelectTrigger disabled={disabled}>
|
|
17
|
+
<SelectValue placeholder={placeholder} />
|
|
18
|
+
</SelectTrigger>
|
|
19
|
+
<SelectContent>
|
|
20
|
+
<SelectItem value="first">First option</SelectItem>
|
|
21
|
+
</SelectContent>
|
|
22
|
+
</Select>
|
|
23
|
+
),
|
|
24
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { StatusBadge } from '../src/primitives/status-badge'
|
|
4
|
+
|
|
5
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
6
|
+
figma.connect(StatusBadge, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
7
|
+
imports: ["import { StatusBadge } from '@open-mercato/ui/primitives/status-badge'"],
|
|
8
|
+
props: {
|
|
9
|
+
variant: figma.enum('Variant', {
|
|
10
|
+
Success: 'success',
|
|
11
|
+
Warning: 'warning',
|
|
12
|
+
Error: 'error',
|
|
13
|
+
Info: 'info',
|
|
14
|
+
Neutral: 'neutral',
|
|
15
|
+
}),
|
|
16
|
+
dot: figma.boolean('Dot'),
|
|
17
|
+
label: figma.string('Label'),
|
|
18
|
+
},
|
|
19
|
+
example: ({ variant, dot, label }) => (
|
|
20
|
+
<StatusBadge variant={variant} dot={dot}>
|
|
21
|
+
{label}
|
|
22
|
+
</StatusBadge>
|
|
23
|
+
),
|
|
24
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Switch } from '../src/primitives/switch'
|
|
4
|
+
import { SwitchField } from '../src/primitives/switch-field'
|
|
5
|
+
|
|
6
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
7
|
+
figma.connect(Switch, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
8
|
+
imports: ["import { Switch } from '@open-mercato/ui/primitives/switch'"],
|
|
9
|
+
variant: { Label: 'False' },
|
|
10
|
+
props: {
|
|
11
|
+
checked: figma.boolean('Checked'),
|
|
12
|
+
disabled: figma.boolean('Disabled'),
|
|
13
|
+
},
|
|
14
|
+
example: ({ checked, disabled }) => <Switch checked={checked} disabled={disabled} />,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
figma.connect(SwitchField, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
18
|
+
imports: ["import { SwitchField } from '@open-mercato/ui/primitives/switch-field'"],
|
|
19
|
+
variant: { Label: 'True' },
|
|
20
|
+
props: {
|
|
21
|
+
checked: figma.boolean('Checked'),
|
|
22
|
+
disabled: figma.boolean('Disabled'),
|
|
23
|
+
label: figma.string('Label text'),
|
|
24
|
+
},
|
|
25
|
+
example: ({ checked, disabled, label }) => (
|
|
26
|
+
<SwitchField checked={checked} disabled={disabled} label={label} />
|
|
27
|
+
),
|
|
28
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../src/primitives/tabs'
|
|
4
|
+
|
|
5
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
6
|
+
figma.connect(Tabs, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
7
|
+
imports: ["import { Tabs, TabsList, TabsTrigger, TabsContent } from '@open-mercato/ui/primitives/tabs'"],
|
|
8
|
+
props: {
|
|
9
|
+
label: figma.string('Label'),
|
|
10
|
+
count: figma.string('Count'),
|
|
11
|
+
},
|
|
12
|
+
example: ({ label, count }) => (
|
|
13
|
+
<Tabs defaultValue="first" variant="underline">
|
|
14
|
+
<TabsList aria-label="Sections">
|
|
15
|
+
<TabsTrigger value="first" count={count}>
|
|
16
|
+
{label}
|
|
17
|
+
</TabsTrigger>
|
|
18
|
+
</TabsList>
|
|
19
|
+
<TabsContent value="first">Content</TabsContent>
|
|
20
|
+
</Tabs>
|
|
21
|
+
),
|
|
22
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import figma from '@figma/code-connect'
|
|
3
|
+
import { Tag } from '../src/primitives/tag'
|
|
4
|
+
|
|
5
|
+
// TODO(figma): resolve the real node id in the DS file before ds:code-connect:publish.
|
|
6
|
+
figma.connect(Tag, 'https://www.figma.com/design/qCq9z6q1if0mpoRstV5OEA/Design-System?node-id=0-1', {
|
|
7
|
+
imports: ["import { Tag } from '@open-mercato/ui/primitives/tag'"],
|
|
8
|
+
props: {
|
|
9
|
+
variant: figma.enum('Variant', {
|
|
10
|
+
Default: 'default',
|
|
11
|
+
Success: 'success',
|
|
12
|
+
Warning: 'warning',
|
|
13
|
+
Error: 'error',
|
|
14
|
+
Info: 'info',
|
|
15
|
+
Neutral: 'neutral',
|
|
16
|
+
Brand: 'brand',
|
|
17
|
+
Pink: 'pink',
|
|
18
|
+
}),
|
|
19
|
+
dot: figma.boolean('Dot'),
|
|
20
|
+
label: figma.string('Label'),
|
|
21
|
+
},
|
|
22
|
+
example: ({ variant, dot, label }) => (
|
|
23
|
+
<Tag variant={variant} dot={dot}>
|
|
24
|
+
{label}
|
|
25
|
+
</Tag>
|
|
26
|
+
),
|
|
27
|
+
})
|
package/jest.config.cjs
CHANGED
|
@@ -16,7 +16,8 @@ module.exports = {
|
|
|
16
16
|
'^remark-gfm$': '<rootDir>/jest.markdown-mock.tsx',
|
|
17
17
|
},
|
|
18
18
|
transform: {
|
|
19
|
-
|
|
19
|
+
// `.cjs` is included so the build-time source emitters under scripts/ are testable.
|
|
20
|
+
'^.+\\.(cjs|(t|j)sx?)$': [
|
|
20
21
|
'<rootDir>/../../scripts/jest-mikroorm-transformer.cjs',
|
|
21
22
|
{
|
|
22
23
|
tsconfig: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8-develop.6874.1.982d6097d8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -137,43 +137,45 @@
|
|
|
137
137
|
"@dnd-kit/sortable": "^10.0.0",
|
|
138
138
|
"@dnd-kit/utilities": "^3.2.2",
|
|
139
139
|
"@mdxeditor/editor": "^4.0.4",
|
|
140
|
-
"@radix-ui/react-accordion": "^1.2.
|
|
141
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
142
|
-
"@radix-ui/react-popover": "^1.1.
|
|
143
|
-
"@radix-ui/react-radio-group": "^1.4.
|
|
144
|
-
"@radix-ui/react-scroll-area": "^1.2.
|
|
145
|
-
"@radix-ui/react-select": "^2.3.
|
|
146
|
-
"@radix-ui/react-slider": "^1.4.
|
|
147
|
-
"@radix-ui/react-tooltip": "^1.2.
|
|
140
|
+
"@radix-ui/react-accordion": "^1.2.20",
|
|
141
|
+
"@radix-ui/react-dialog": "^1.1.23",
|
|
142
|
+
"@radix-ui/react-popover": "^1.1.23",
|
|
143
|
+
"@radix-ui/react-radio-group": "^1.4.7",
|
|
144
|
+
"@radix-ui/react-scroll-area": "^1.2.18",
|
|
145
|
+
"@radix-ui/react-select": "^2.3.7",
|
|
146
|
+
"@radix-ui/react-slider": "^1.4.7",
|
|
147
|
+
"@radix-ui/react-tooltip": "^1.2.16",
|
|
148
148
|
"@tanstack/react-virtual": "^3.14.6",
|
|
149
149
|
"cmdk": "^1.0.0",
|
|
150
150
|
"date-fns": "4.4.0",
|
|
151
151
|
"react-big-calendar": "^1.20.0",
|
|
152
152
|
"react-day-picker": "^10.0.1",
|
|
153
153
|
"react-markdown": "^10.1.0",
|
|
154
|
-
"recharts": "^3.
|
|
154
|
+
"recharts": "^3.10.1",
|
|
155
155
|
"remark-gfm": "^4.0.1"
|
|
156
156
|
},
|
|
157
157
|
"peerDependencies": {
|
|
158
|
-
"@open-mercato/shared": "0.6.
|
|
158
|
+
"@open-mercato/shared": "0.6.8-develop.6874.1.982d6097d8",
|
|
159
159
|
"react": ">=18.0.0",
|
|
160
160
|
"react-dom": ">=18.0.0",
|
|
161
161
|
"react-is": ">=18.0.0"
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
|
-
"@
|
|
164
|
+
"@figma/code-connect": "^1.3.4",
|
|
165
|
+
"@open-mercato/shared": "0.6.8-develop.6874.1.982d6097d8",
|
|
165
166
|
"@testing-library/dom": "^10.4.1",
|
|
166
|
-
"@testing-library/jest-dom": "^
|
|
167
|
+
"@testing-library/jest-dom": "^7.0.0",
|
|
167
168
|
"@testing-library/react": "^16.3.1",
|
|
168
169
|
"@types/jest": "^30.0.0",
|
|
169
170
|
"@types/react": "^19.2.17",
|
|
170
171
|
"@types/react-dom": "^19.2.3",
|
|
171
172
|
"jest": "^30.4.2",
|
|
172
173
|
"jest-environment-jsdom": "^30.4.1",
|
|
173
|
-
"react": "19.2.
|
|
174
|
-
"react-dom": "19.2.
|
|
175
|
-
"react-is": "^19.2.
|
|
176
|
-
"ts-jest": "^29.4.
|
|
174
|
+
"react": "19.2.8",
|
|
175
|
+
"react-dom": "19.2.8",
|
|
176
|
+
"react-is": "^19.2.8",
|
|
177
|
+
"ts-jest": "^29.4.12",
|
|
178
|
+
"ts-morph": "^28.0.0",
|
|
177
179
|
"typescript": "7.0.2"
|
|
178
180
|
},
|
|
179
181
|
"publishConfig": {
|
|
@@ -183,5 +185,6 @@
|
|
|
183
185
|
"type": "git",
|
|
184
186
|
"url": "https://github.com/open-mercato/open-mercato",
|
|
185
187
|
"directory": "packages/ui"
|
|
186
|
-
}
|
|
188
|
+
},
|
|
189
|
+
"stableVersion": "0.6.7"
|
|
187
190
|
}
|