@ankhorage/zora 0.13.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +39 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/patterns/theme-composer/ThemeComposer.d.ts +4 -0
- package/dist/patterns/theme-composer/ThemeComposer.d.ts.map +1 -0
- package/dist/patterns/theme-composer/ThemeComposer.js +164 -0
- package/dist/patterns/theme-composer/ThemeComposer.js.map +1 -0
- package/dist/patterns/theme-composer/index.d.ts +3 -0
- package/dist/patterns/theme-composer/index.d.ts.map +1 -0
- package/dist/patterns/theme-composer/index.js +2 -0
- package/dist/patterns/theme-composer/index.js.map +1 -0
- package/dist/patterns/theme-composer/types.d.ts +10 -0
- package/dist/patterns/theme-composer/types.d.ts.map +1 -0
- package/dist/patterns/theme-composer/types.js +2 -0
- package/dist/patterns/theme-composer/types.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/patterns/theme-composer/ThemeComposer.test.ts +97 -0
- package/src/patterns/theme-composer/ThemeComposer.tsx +245 -0
- package/src/patterns/theme-composer/index.ts +2 -0
- package/src/patterns/theme-composer/types.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 43ebda3: Add ThemeComposer showcase page for visual recipe testing
|
|
8
|
+
|
|
9
|
+
## 0.14.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 86c4fdd: Add `ThemeComposer` pattern for live theme seed editing. Exposes a controlled component that lets users edit `primaryColor`, `harmony`, `colorTone`, and `mode`, emitting an updated `ZoraTheme` through `onChange`. Includes a built-in preview area showing Button, Badge, and Card controls reflecting the active theme.
|
|
14
|
+
|
|
3
15
|
## 0.13.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1365,6 +1365,45 @@ ZORA props:
|
|
|
1365
1365
|
|
|
1366
1366
|
</details>
|
|
1367
1367
|
|
|
1368
|
+
### `ThemeComposer`
|
|
1369
|
+
|
|
1370
|
+
Interactive pattern for editing a `ZoraTheme` seed and previewing the result live.
|
|
1371
|
+
Pass your current theme as `value` and handle updates through `onChange`. Wrap both
|
|
1372
|
+
in a `ZoraProvider` so the preview area reflects every change immediately.
|
|
1373
|
+
|
|
1374
|
+
```tsx
|
|
1375
|
+
const [theme, setTheme] = React.useState<ZoraTheme>(zoraDefaultTheme);
|
|
1376
|
+
const [mode, setMode] = React.useState<ZoraThemeMode>('light');
|
|
1377
|
+
|
|
1378
|
+
return (
|
|
1379
|
+
<ZoraProvider theme={theme} initialMode={mode}>
|
|
1380
|
+
<ThemeComposer
|
|
1381
|
+
value={theme}
|
|
1382
|
+
onChange={setTheme}
|
|
1383
|
+
mode={mode}
|
|
1384
|
+
onModeChange={setMode}
|
|
1385
|
+
onSubmit={(t) => saveTheme(t)}
|
|
1386
|
+
/>
|
|
1387
|
+
</ZoraProvider>
|
|
1388
|
+
);
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
<details>
|
|
1392
|
+
<summary>Props</summary>
|
|
1393
|
+
|
|
1394
|
+
ZORA props:
|
|
1395
|
+
|
|
1396
|
+
| Prop | Type | Default | Notes |
|
|
1397
|
+
| -------------- | ------------------------------- | ------- | ---------------------------------------------------- |
|
|
1398
|
+
| `value` | `ZoraTheme` | - | Required controlled theme seed. |
|
|
1399
|
+
| `onChange` | `(theme: ZoraTheme) => void` | - | Required. Fires on every valid change. |
|
|
1400
|
+
| `mode` | `ZoraThemeMode` | - | Current light/dark mode shown in the mode toggle. |
|
|
1401
|
+
| `onModeChange` | `(mode: ZoraThemeMode) => void` | - | Called when the user switches the mode toggle. |
|
|
1402
|
+
| `onSubmit` | `(theme: ZoraTheme) => void` | - | Optional. Renders an "Apply theme" button if set. |
|
|
1403
|
+
| `testID` | `string` | - | Forwarded to the root element and child test points. |
|
|
1404
|
+
|
|
1405
|
+
</details>
|
|
1406
|
+
|
|
1368
1407
|
## Theme
|
|
1369
1408
|
|
|
1370
1409
|
### `ZoraProvider`
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,8 @@ export type { SettingsRowProps } from './patterns/settings-row';
|
|
|
74
74
|
export { SettingsRow } from './patterns/settings-row';
|
|
75
75
|
export type { SwitchFieldProps } from './patterns/switch-field';
|
|
76
76
|
export { SwitchField } from './patterns/switch-field';
|
|
77
|
+
export type { ThemeComposerProps } from './patterns/theme-composer';
|
|
78
|
+
export { ThemeComposer } from './patterns/theme-composer';
|
|
77
79
|
export type { PaletteItemProps, TileGridProps } from './patterns/tile-grid';
|
|
78
80
|
export { PaletteItem, TileGrid } from './patterns/tile-grid';
|
|
79
81
|
export type { TreeItemNode, TreeItemRenderProps, TreeViewProps } from './patterns/tree-view';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MA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,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ export { ResponsivePanel } from './patterns/responsive-panel';
|
|
|
36
36
|
export { SectionHeader } from './patterns/section-header';
|
|
37
37
|
export { SettingsRow } from './patterns/settings-row';
|
|
38
38
|
export { SwitchField } from './patterns/switch-field';
|
|
39
|
+
export { ThemeComposer } from './patterns/theme-composer';
|
|
39
40
|
export { PaletteItem, TileGrid } from './patterns/tile-grid';
|
|
40
41
|
export { TreeItem, TreeView } from './patterns/tree-view';
|
|
41
42
|
export * from './theme';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAmB7C,OAAO,EACL,IAAI,EACJ,WAAW,EACX,SAAS,EACT,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,aAAa,GACd,MAAM,mBAAmB,CAAC;AAS3B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CA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AA4B,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,cAAc,SAAS,CAAC","sourcesContent":["export type { BadgeProps } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonProps } from './components/button';\nexport { Button } from './components/button';\nexport type { CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CheckboxGroupOption, CheckboxGroupProps, CheckboxProps } from './components/checkbox';\nexport { Checkbox, CheckboxGroup } from './components/checkbox';\nexport type { DrawerProps } from './components/drawer';\nexport { Drawer } from './components/drawer';\nexport type {\n FormActionsProps,\n FormErrorProps,\n FormErrors,\n FormFieldConfig,\n FormFieldControlProps,\n FormFieldInputType,\n FormFieldProps,\n FormFieldValue,\n FormFieldWrapperProps,\n FormProps,\n FormValidationErrors,\n FormValidationResult,\n FormValues,\n UseFormControllerOptions,\n UseFormControllerResult,\n ValidationRule,\n} from './components/form';\nexport {\n Form,\n FormActions,\n FormError,\n FormField,\n hasRequiredRule,\n useFormController,\n validateField,\n validateFields,\n validateValue,\n} from './components/form';\nexport type {\n HeadingAlign,\n HeadingLevel,\n HeadingProps,\n HeadingSize,\n HeadingTone,\n HeadingWeight,\n} from './components/heading';\nexport { Heading } from './components/heading';\nexport type { IconProps } from './components/icon';\nexport { Icon } from './components/icon';\nexport type { IconButtonProps } from './components/icon-button';\nexport { IconButton } from './components/icon-button';\nexport type { InputProps } from './components/input';\nexport { Input } from './components/input';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type { RadioGroupOption, RadioGroupProps, RadioProps } from './components/radio';\nexport { Radio, RadioGroup } from './components/radio';\nexport type { SelectOption, SelectProps } from './components/select';\nexport { Select } from './components/select';\nexport type { TabItem, TabsProps } from './components/tabs';\nexport { Tabs } from './components/tabs';\nexport type { TextAlign, TextProps, TextTone, TextVariant, TextWeight } from './components/text';\nexport { Text } from './components/text';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { ToolbarActionProps, ToolbarProps } from './components/toolbar';\nexport { Toolbar, ToolbarAction } from './components/toolbar';\nexport type {\n BoxProps,\n CenterProps,\n ContainerProps,\n DividerProps,\n GridProps,\n InlineProps,\n ShowProps,\n SpacerProps,\n StackProps,\n SurfaceProps,\n SurfaceVariant,\n} from './foundation';\nexport {\n Box,\n Center,\n Container,\n Divider,\n Grid,\n Inline,\n Show,\n Spacer,\n Stack,\n Surface,\n} from './foundation';\nexport type { AppShellProps } from './layout/app-shell';\nexport { AppShell } from './layout/app-shell';\nexport type { AuthLayoutProps } from './layout/auth-layout';\nexport { AuthLayout } from './layout/auth-layout';\nexport type { PageProps } from './layout/page';\nexport { Page } from './layout/page';\nexport type { PageHeaderProps } from './layout/page-header';\nexport { PageHeader } from './layout/page-header';\nexport type { PageSectionProps } from './layout/page-section';\nexport { PageSection } from './layout/page-section';\nexport type { SettingsLayoutProps } from './layout/settings-layout';\nexport { SettingsLayout } from './layout/settings-layout';\nexport type { SidebarLayoutProps } from './layout/sidebar-layout';\nexport { SidebarLayout } from './layout/sidebar-layout';\nexport type { TopbarLayoutProps } from './layout/topbar-layout';\nexport { TopbarLayout } from './layout/topbar-layout';\nexport type {\n AuthFormBaseProps,\n AuthIdentifierKind,\n ForgotPasswordFormProps,\n ForgotPasswordFormValues,\n OtpFormProps,\n OtpFormValues,\n SignInFormProps,\n SignInFormValues,\n SignUpFormField,\n SignUpFormProps,\n SignUpFormValues,\n} from './patterns/auth';\nexport { ForgotPasswordForm, OtpForm, SignInForm, SignUpForm } from './patterns/auth';\nexport type {\n CollectionEditorProps,\n CollectionEditorRenderItemProps,\n} from './patterns/collection-editor';\nexport { CollectionEditor } from './patterns/collection-editor';\nexport type { ConfirmDialogProps } from './patterns/confirm-dialog';\nexport { ConfirmDialog } from './patterns/confirm-dialog';\nexport type { DisclosureSectionProps } from './patterns/disclosure-section';\nexport { DisclosureSection } from './patterns/disclosure-section';\nexport type { EmptyStateAction, EmptyStateProps } from './patterns/empty-state';\nexport { EmptyState } from './patterns/empty-state';\nexport type { InspectorFieldProps } from './patterns/inspector-field';\nexport { InspectorField } from './patterns/inspector-field';\nexport type { NoticeProps } from './patterns/notice';\nexport { Notice } from './patterns/notice';\nexport type { PanelProps } from './patterns/panel';\nexport { Panel } from './patterns/panel';\nexport type { ResponsivePanelProps } from './patterns/responsive-panel';\nexport { ResponsivePanel } from './patterns/responsive-panel';\nexport type { SectionHeaderProps } from './patterns/section-header';\nexport { SectionHeader } from './patterns/section-header';\nexport type { SettingsRowProps } from './patterns/settings-row';\nexport { SettingsRow } from './patterns/settings-row';\nexport type { SwitchFieldProps } from './patterns/switch-field';\nexport { SwitchField } from './patterns/switch-field';\nexport type { PaletteItemProps, TileGridProps } from './patterns/tile-grid';\nexport { PaletteItem, TileGrid } from './patterns/tile-grid';\nexport type { TreeItemNode, TreeItemRenderProps, TreeViewProps } from './patterns/tree-view';\nexport { TreeItem, TreeView } from './patterns/tree-view';\nexport * from './theme';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,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C;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AActD,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,cAAc,SAAS,CAAC","sourcesContent":["export type { BadgeProps } from './components/badge';\nexport { Badge } from './components/badge';\nexport type { ButtonProps } from './components/button';\nexport { Button } from './components/button';\nexport type { CardProps } from './components/card';\nexport { Card } from './components/card';\nexport type { CheckboxGroupOption, CheckboxGroupProps, CheckboxProps } from './components/checkbox';\nexport { Checkbox, CheckboxGroup } from './components/checkbox';\nexport type { DrawerProps } from './components/drawer';\nexport { Drawer } from './components/drawer';\nexport type {\n FormActionsProps,\n FormErrorProps,\n FormErrors,\n FormFieldConfig,\n FormFieldControlProps,\n FormFieldInputType,\n FormFieldProps,\n FormFieldValue,\n FormFieldWrapperProps,\n FormProps,\n FormValidationErrors,\n FormValidationResult,\n FormValues,\n UseFormControllerOptions,\n UseFormControllerResult,\n ValidationRule,\n} from './components/form';\nexport {\n Form,\n FormActions,\n FormError,\n FormField,\n hasRequiredRule,\n useFormController,\n validateField,\n validateFields,\n validateValue,\n} from './components/form';\nexport type {\n HeadingAlign,\n HeadingLevel,\n HeadingProps,\n HeadingSize,\n HeadingTone,\n HeadingWeight,\n} from './components/heading';\nexport { Heading } from './components/heading';\nexport type { IconProps } from './components/icon';\nexport { Icon } from './components/icon';\nexport type { IconButtonProps } from './components/icon-button';\nexport { IconButton } from './components/icon-button';\nexport type { InputProps } from './components/input';\nexport { Input } from './components/input';\nexport type { ModalProps } from './components/modal';\nexport { Modal } from './components/modal';\nexport type { RadioGroupOption, RadioGroupProps, RadioProps } from './components/radio';\nexport { Radio, RadioGroup } from './components/radio';\nexport type { SelectOption, SelectProps } from './components/select';\nexport { Select } from './components/select';\nexport type { TabItem, TabsProps } from './components/tabs';\nexport { Tabs } from './components/tabs';\nexport type { TextAlign, TextProps, TextTone, TextVariant, TextWeight } from './components/text';\nexport { Text } from './components/text';\nexport type { TextareaProps } from './components/textarea';\nexport { Textarea } from './components/textarea';\nexport type { ToolbarActionProps, ToolbarProps } from './components/toolbar';\nexport { Toolbar, ToolbarAction } from './components/toolbar';\nexport type {\n BoxProps,\n CenterProps,\n ContainerProps,\n DividerProps,\n GridProps,\n InlineProps,\n ShowProps,\n SpacerProps,\n StackProps,\n SurfaceProps,\n SurfaceVariant,\n} from './foundation';\nexport {\n Box,\n Center,\n Container,\n Divider,\n Grid,\n Inline,\n Show,\n Spacer,\n Stack,\n Surface,\n} from './foundation';\nexport type { AppShellProps } from './layout/app-shell';\nexport { AppShell } from './layout/app-shell';\nexport type { AuthLayoutProps } from './layout/auth-layout';\nexport { AuthLayout } from './layout/auth-layout';\nexport type { PageProps } from './layout/page';\nexport { Page } from './layout/page';\nexport type { PageHeaderProps } from './layout/page-header';\nexport { PageHeader } from './layout/page-header';\nexport type { PageSectionProps } from './layout/page-section';\nexport { PageSection } from './layout/page-section';\nexport type { SettingsLayoutProps } from './layout/settings-layout';\nexport { SettingsLayout } from './layout/settings-layout';\nexport type { SidebarLayoutProps } from './layout/sidebar-layout';\nexport { SidebarLayout } from './layout/sidebar-layout';\nexport type { TopbarLayoutProps } from './layout/topbar-layout';\nexport { TopbarLayout } from './layout/topbar-layout';\nexport type {\n AuthFormBaseProps,\n AuthIdentifierKind,\n ForgotPasswordFormProps,\n ForgotPasswordFormValues,\n OtpFormProps,\n OtpFormValues,\n SignInFormProps,\n SignInFormValues,\n SignUpFormField,\n SignUpFormProps,\n SignUpFormValues,\n} from './patterns/auth';\nexport { ForgotPasswordForm, OtpForm, SignInForm, SignUpForm } from './patterns/auth';\nexport type {\n CollectionEditorProps,\n CollectionEditorRenderItemProps,\n} from './patterns/collection-editor';\nexport { CollectionEditor } from './patterns/collection-editor';\nexport type { ConfirmDialogProps } from './patterns/confirm-dialog';\nexport { ConfirmDialog } from './patterns/confirm-dialog';\nexport type { DisclosureSectionProps } from './patterns/disclosure-section';\nexport { DisclosureSection } from './patterns/disclosure-section';\nexport type { EmptyStateAction, EmptyStateProps } from './patterns/empty-state';\nexport { EmptyState } from './patterns/empty-state';\nexport type { InspectorFieldProps } from './patterns/inspector-field';\nexport { InspectorField } from './patterns/inspector-field';\nexport type { NoticeProps } from './patterns/notice';\nexport { Notice } from './patterns/notice';\nexport type { PanelProps } from './patterns/panel';\nexport { Panel } from './patterns/panel';\nexport type { ResponsivePanelProps } from './patterns/responsive-panel';\nexport { ResponsivePanel } from './patterns/responsive-panel';\nexport type { SectionHeaderProps } from './patterns/section-header';\nexport { SectionHeader } from './patterns/section-header';\nexport type { SettingsRowProps } from './patterns/settings-row';\nexport { SettingsRow } from './patterns/settings-row';\nexport type { SwitchFieldProps } from './patterns/switch-field';\nexport { SwitchField } from './patterns/switch-field';\nexport type { ThemeComposerProps } from './patterns/theme-composer';\nexport { ThemeComposer } from './patterns/theme-composer';\nexport type { PaletteItemProps, TileGridProps } from './patterns/tile-grid';\nexport { PaletteItem, TileGrid } from './patterns/tile-grid';\nexport type { TreeItemNode, TreeItemRenderProps, TreeViewProps } from './patterns/tree-view';\nexport { TreeItem, TreeView } from './patterns/tree-view';\nexport * from './theme';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeComposer.d.ts","sourceRoot":"","sources":["../../../src/patterns/theme-composer/ThemeComposer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmB1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAgOlD,eAAO,MAAM,aAAa,0DAAyC,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { Box, Stack } from '@ankhorage/surface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Badge } from '../../components/badge';
|
|
4
|
+
import { Button } from '../../components/button';
|
|
5
|
+
import { Card } from '../../components/card';
|
|
6
|
+
import { Heading } from '../../components/heading';
|
|
7
|
+
import { Input } from '../../components/input';
|
|
8
|
+
import { Select } from '../../components/select';
|
|
9
|
+
import { Tabs } from '../../components/tabs';
|
|
10
|
+
import { Text } from '../../components/text';
|
|
11
|
+
import { ZORA_COLOR_HARMONIES, ZORA_COLOR_TONES, } from '../../theme/types';
|
|
12
|
+
import { useZoraTheme } from '../../theme/useZoraTheme';
|
|
13
|
+
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
14
|
+
const HEX_RE = /^#[0-9A-Fa-f]{6}$/;
|
|
15
|
+
function isValidHex(value) {
|
|
16
|
+
return HEX_RE.test(value);
|
|
17
|
+
}
|
|
18
|
+
const HARMONY_OPTIONS = ZORA_COLOR_HARMONIES.map((h) => ({ value: h, label: h }));
|
|
19
|
+
const TONE_OPTIONS = ZORA_COLOR_TONES.map((t) => ({ value: t, label: t }));
|
|
20
|
+
const MODE_TABS = [
|
|
21
|
+
{ value: 'light', label: 'Light' },
|
|
22
|
+
{ value: 'dark', label: 'Dark' },
|
|
23
|
+
];
|
|
24
|
+
const COLOR_TONE_BACKGROUND_TONE = {
|
|
25
|
+
neutral: 'Neutral',
|
|
26
|
+
pastel: 'Pastel',
|
|
27
|
+
earth: 'Earth',
|
|
28
|
+
mineral: 'Mineral',
|
|
29
|
+
muted: 'Muted',
|
|
30
|
+
jewel: 'Neutral',
|
|
31
|
+
fluorescent: 'Obsidian',
|
|
32
|
+
obsidian: 'Obsidian',
|
|
33
|
+
vaporwave: 'Pastel',
|
|
34
|
+
monochromeAccent: 'Neutral',
|
|
35
|
+
};
|
|
36
|
+
const COLOR_TONE_FOREGROUND_TONE = {
|
|
37
|
+
neutral: 'Jewel',
|
|
38
|
+
pastel: 'Jewel',
|
|
39
|
+
earth: 'Mineral',
|
|
40
|
+
mineral: 'Jewel',
|
|
41
|
+
muted: 'Jewel',
|
|
42
|
+
jewel: 'Jewel',
|
|
43
|
+
fluorescent: 'Fluorescent',
|
|
44
|
+
obsidian: 'Fluorescent',
|
|
45
|
+
vaporwave: 'Fluorescent',
|
|
46
|
+
monochromeAccent: 'Jewel',
|
|
47
|
+
};
|
|
48
|
+
function ThemeComposerInner({ themeId: _themeId, value, onChange, mode, onModeChange, onSubmit, testID, }) {
|
|
49
|
+
const { theme } = useZoraTheme();
|
|
50
|
+
const [hexInput, setHexInput] = React.useState(value.primaryColor);
|
|
51
|
+
const [hexError, setHexError] = React.useState(undefined);
|
|
52
|
+
// Keep local hex input in sync when value.primaryColor changes externally
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
setHexInput(value.primaryColor);
|
|
55
|
+
setHexError(undefined);
|
|
56
|
+
}, [value.primaryColor]);
|
|
57
|
+
function handleHexChange(text) {
|
|
58
|
+
// Ensure leading hash
|
|
59
|
+
const normalized = text.startsWith('#') ? text : `#${text}`;
|
|
60
|
+
setHexInput(normalized);
|
|
61
|
+
if (isValidHex(normalized)) {
|
|
62
|
+
setHexError(undefined);
|
|
63
|
+
onChange({ ...value, primaryColor: normalized });
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
setHexError('Enter a valid 6-digit hex color (e.g. #0f766e).');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const activeMode = mode ?? 'light';
|
|
70
|
+
return (<Stack gap="l" testID={testID}>
|
|
71
|
+
{/* Section: Primary Color */}
|
|
72
|
+
<Card title="Primary color" description="Set the seed color for your theme palette.">
|
|
73
|
+
<Stack gap="m">
|
|
74
|
+
<Stack direction="row" gap="m" align="center">
|
|
75
|
+
<Box flex={1}>
|
|
76
|
+
<Input value={hexInput} onChangeText={handleHexChange} placeholder="#0f766e" autoCapitalize="none" autoCorrect={false} maxLength={7} invalid={hexError !== undefined} testID={testID ? `${testID}-hex-input` : undefined}/>
|
|
77
|
+
</Box>
|
|
78
|
+
{/* Color preview chip */}
|
|
79
|
+
<Box width={36} height={36} radius="m" style={{
|
|
80
|
+
backgroundColor: isValidHex(hexInput) ? hexInput : theme.colors.border,
|
|
81
|
+
borderWidth: 1,
|
|
82
|
+
borderColor: theme.colors.border,
|
|
83
|
+
}}/>
|
|
84
|
+
</Stack>
|
|
85
|
+
{hexError ? (<Text tone="danger" variant="bodySmall">
|
|
86
|
+
{hexError}
|
|
87
|
+
</Text>) : null}
|
|
88
|
+
</Stack>
|
|
89
|
+
</Card>
|
|
90
|
+
|
|
91
|
+
{/* Section: Harmony */}
|
|
92
|
+
<Card title="Harmony" description="Choose how accent hues are generated from your primary color.">
|
|
93
|
+
<Select value={value.harmony} options={HARMONY_OPTIONS} onValueChange={(h) => onChange({ ...value, harmony: h })} testID={testID ? `${testID}-harmony-select` : undefined}/>
|
|
94
|
+
</Card>
|
|
95
|
+
|
|
96
|
+
{/* Section: Color tone */}
|
|
97
|
+
<Card title="Color tone" description="Controls the vibrancy and saturation style of the palette.">
|
|
98
|
+
<Stack gap="s">
|
|
99
|
+
<Select value={value.colorTone} options={TONE_OPTIONS} onValueChange={(t) => onChange({ ...value, colorTone: t })} testID={testID ? `${testID}-tone-select` : undefined}/>
|
|
100
|
+
<Stack direction="row" gap="s" align="center">
|
|
101
|
+
<Text tone="muted" variant="caption">
|
|
102
|
+
Background:
|
|
103
|
+
</Text>
|
|
104
|
+
<Badge tone="neutral" emphasis="soft">
|
|
105
|
+
{COLOR_TONE_BACKGROUND_TONE[value.colorTone]}
|
|
106
|
+
</Badge>
|
|
107
|
+
<Text tone="muted" variant="caption">
|
|
108
|
+
Foreground:
|
|
109
|
+
</Text>
|
|
110
|
+
<Badge tone="neutral" emphasis="soft">
|
|
111
|
+
{COLOR_TONE_FOREGROUND_TONE[value.colorTone]}
|
|
112
|
+
</Badge>
|
|
113
|
+
</Stack>
|
|
114
|
+
</Stack>
|
|
115
|
+
</Card>
|
|
116
|
+
|
|
117
|
+
{/* Section: Mode */}
|
|
118
|
+
<Card title="Mode" description="Switch between light and dark presentation.">
|
|
119
|
+
<Tabs value={activeMode} items={MODE_TABS} onValueChange={(m) => onModeChange?.(m)} variant="segmented" testID={testID ? `${testID}-mode-tabs` : undefined}/>
|
|
120
|
+
</Card>
|
|
121
|
+
|
|
122
|
+
{/* Section: Preview */}
|
|
123
|
+
<Card title="Preview" description="A quick look at how your theme renders common controls.">
|
|
124
|
+
<Stack gap="m">
|
|
125
|
+
<Heading level={4}>Heading</Heading>
|
|
126
|
+
<Text>Body text — this shows default text color and weight.</Text>
|
|
127
|
+
<Text tone="muted" variant="bodySmall">
|
|
128
|
+
Muted caption text.
|
|
129
|
+
</Text>
|
|
130
|
+
<Stack direction="row" gap="s" align="center">
|
|
131
|
+
<Button tone="primary" emphasis="solid" size="m">
|
|
132
|
+
Primary
|
|
133
|
+
</Button>
|
|
134
|
+
<Button tone="neutral" emphasis="soft" size="m">
|
|
135
|
+
Neutral
|
|
136
|
+
</Button>
|
|
137
|
+
<Button tone="danger" emphasis="ghost" size="m">
|
|
138
|
+
Danger
|
|
139
|
+
</Button>
|
|
140
|
+
</Stack>
|
|
141
|
+
<Stack direction="row" gap="s" align="center">
|
|
142
|
+
<Badge tone="primary">Primary</Badge>
|
|
143
|
+
<Badge tone="success" emphasis="soft">
|
|
144
|
+
Success
|
|
145
|
+
</Badge>
|
|
146
|
+
<Badge tone="warning" emphasis="soft">
|
|
147
|
+
Warning
|
|
148
|
+
</Badge>
|
|
149
|
+
<Badge tone="danger" emphasis="soft">
|
|
150
|
+
Danger
|
|
151
|
+
</Badge>
|
|
152
|
+
</Stack>
|
|
153
|
+
<Card tone="subtle" title="Nested card" description="Subtle tone inside the preview." compact/>
|
|
154
|
+
</Stack>
|
|
155
|
+
</Card>
|
|
156
|
+
|
|
157
|
+
{/* Submit */}
|
|
158
|
+
{onSubmit ? (<Button tone="primary" emphasis="solid" onPress={() => onSubmit(value)} testID={testID ? `${testID}-submit` : undefined}>
|
|
159
|
+
Apply theme
|
|
160
|
+
</Button>) : null}
|
|
161
|
+
</Stack>);
|
|
162
|
+
}
|
|
163
|
+
export const ThemeComposer = withZoraThemeScope(ThemeComposerInner);
|
|
164
|
+
//# sourceMappingURL=ThemeComposer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeComposer.js","sourceRoot":"","sources":["../../../src/patterns/theme-composer/ThemeComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;A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K,CACP;YAAA,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAClC;;YACF,EAAE,KAAK,CACT;UAAA,EAAE,KAAK,CACP;UAAA,CAAC,IAAI,CACH,IAAI,CAAC,QAAQ,CACb,KAAK,CAAC,aAAa,CACnB,WAAW,CAAC,iCAAiC,CAC7C,OAAO,EAEX;QAAA,EAAE,KAAK,CACT;MAAA,EAAE,IAAI,CAEN;;MAAA,CAAC,YAAY,CACb;MAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,CACV,CAAC,MAAM,CACL,IAAI,CAAC,SAAS,CACd,QAAQ,CAAC,OAAO,CAChB,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAC/B,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAEhD;;QACF,EAAE,MAAM,CAAC,CACV,CAAC,CAAC,CAAC,IAAI,CACV;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import { Box, Stack } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { Badge } from '../../components/badge';\nimport { Button } from '../../components/button';\nimport { Card } from '../../components/card';\nimport { Heading } from '../../components/heading';\nimport { Input } from '../../components/input';\nimport { Select } from '../../components/select';\nimport { Tabs } from '../../components/tabs';\nimport { Text } from '../../components/text';\nimport {\n ZORA_COLOR_HARMONIES,\n ZORA_COLOR_TONES,\n type ZoraColorTone,\n type ZoraTheme,\n type ZoraThemeMode,\n} from '../../theme/types';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport type { ThemeComposerProps } from './types';\n\nconst HEX_RE = /^#[0-9A-Fa-f]{6}$/;\n\nfunction isValidHex(value: string): boolean {\n return HEX_RE.test(value);\n}\n\nconst HARMONY_OPTIONS = ZORA_COLOR_HARMONIES.map((h) => ({ value: h, label: h }));\n\nconst TONE_OPTIONS = ZORA_COLOR_TONES.map((t) => ({ value: t, label: t }));\n\nconst MODE_TABS = [\n { value: 'light' as ZoraThemeMode, label: 'Light' },\n { value: 'dark' as ZoraThemeMode, label: 'Dark' },\n];\n\nconst COLOR_TONE_BACKGROUND_TONE: Record<ZoraColorTone, string> = {\n neutral: 'Neutral',\n pastel: 'Pastel',\n earth: 'Earth',\n mineral: 'Mineral',\n muted: 'Muted',\n jewel: 'Neutral',\n fluorescent: 'Obsidian',\n obsidian: 'Obsidian',\n vaporwave: 'Pastel',\n monochromeAccent: 'Neutral',\n};\n\nconst COLOR_TONE_FOREGROUND_TONE: Record<ZoraColorTone, string> = {\n neutral: 'Jewel',\n pastel: 'Jewel',\n earth: 'Mineral',\n mineral: 'Jewel',\n muted: 'Jewel',\n jewel: 'Jewel',\n fluorescent: 'Fluorescent',\n obsidian: 'Fluorescent',\n vaporwave: 'Fluorescent',\n monochromeAccent: 'Jewel',\n};\n\nfunction ThemeComposerInner({\n themeId: _themeId,\n value,\n onChange,\n mode,\n onModeChange,\n onSubmit,\n testID,\n}: ThemeComposerProps) {\n const { theme } = useZoraTheme();\n\n const [hexInput, setHexInput] = React.useState<string>(value.primaryColor);\n const [hexError, setHexError] = React.useState<string | undefined>(undefined);\n\n // Keep local hex input in sync when value.primaryColor changes externally\n React.useEffect(() => {\n setHexInput(value.primaryColor);\n setHexError(undefined);\n }, [value.primaryColor]);\n\n function handleHexChange(text: string) {\n // Ensure leading hash\n const normalized = text.startsWith('#') ? text : `#${text}`;\n setHexInput(normalized);\n\n if (isValidHex(normalized)) {\n setHexError(undefined);\n onChange({ ...value, primaryColor: normalized as ZoraTheme['primaryColor'] });\n } else {\n setHexError('Enter a valid 6-digit hex color (e.g. #0f766e).');\n }\n }\n\n const activeMode = mode ?? 'light';\n\n return (\n <Stack gap=\"l\" testID={testID}>\n {/* Section: Primary Color */}\n <Card title=\"Primary color\" description=\"Set the seed color for your theme palette.\">\n <Stack gap=\"m\">\n <Stack direction=\"row\" gap=\"m\" align=\"center\">\n <Box flex={1}>\n <Input\n value={hexInput}\n onChangeText={handleHexChange}\n placeholder=\"#0f766e\"\n autoCapitalize=\"none\"\n autoCorrect={false}\n maxLength={7}\n invalid={hexError !== undefined}\n testID={testID ? `${testID}-hex-input` : undefined}\n />\n </Box>\n {/* Color preview chip */}\n <Box\n width={36}\n height={36}\n radius=\"m\"\n style={{\n backgroundColor: isValidHex(hexInput) ? hexInput : theme.colors.border,\n borderWidth: 1,\n borderColor: theme.colors.border,\n }}\n />\n </Stack>\n {hexError ? (\n <Text tone=\"danger\" variant=\"bodySmall\">\n {hexError}\n </Text>\n ) : null}\n </Stack>\n </Card>\n\n {/* Section: Harmony */}\n <Card\n title=\"Harmony\"\n description=\"Choose how accent hues are generated from your primary color.\"\n >\n <Select\n value={value.harmony}\n options={HARMONY_OPTIONS}\n onValueChange={(h) => onChange({ ...value, harmony: h })}\n testID={testID ? `${testID}-harmony-select` : undefined}\n />\n </Card>\n\n {/* Section: Color tone */}\n <Card\n title=\"Color tone\"\n description=\"Controls the vibrancy and saturation style of the palette.\"\n >\n <Stack gap=\"s\">\n <Select\n value={value.colorTone}\n options={TONE_OPTIONS}\n onValueChange={(t) => onChange({ ...value, colorTone: t })}\n testID={testID ? `${testID}-tone-select` : undefined}\n />\n <Stack direction=\"row\" gap=\"s\" align=\"center\">\n <Text tone=\"muted\" variant=\"caption\">\n Background:\n </Text>\n <Badge tone=\"neutral\" emphasis=\"soft\">\n {COLOR_TONE_BACKGROUND_TONE[value.colorTone]}\n </Badge>\n <Text tone=\"muted\" variant=\"caption\">\n Foreground:\n </Text>\n <Badge tone=\"neutral\" emphasis=\"soft\">\n {COLOR_TONE_FOREGROUND_TONE[value.colorTone]}\n </Badge>\n </Stack>\n </Stack>\n </Card>\n\n {/* Section: Mode */}\n <Card title=\"Mode\" description=\"Switch between light and dark presentation.\">\n <Tabs\n value={activeMode}\n items={MODE_TABS}\n onValueChange={(m) => onModeChange?.(m)}\n variant=\"segmented\"\n testID={testID ? `${testID}-mode-tabs` : undefined}\n />\n </Card>\n\n {/* Section: Preview */}\n <Card title=\"Preview\" description=\"A quick look at how your theme renders common controls.\">\n <Stack gap=\"m\">\n <Heading level={4}>Heading</Heading>\n <Text>Body text — this shows default text color and weight.</Text>\n <Text tone=\"muted\" variant=\"bodySmall\">\n Muted caption text.\n </Text>\n <Stack direction=\"row\" gap=\"s\" align=\"center\">\n <Button tone=\"primary\" emphasis=\"solid\" size=\"m\">\n Primary\n </Button>\n <Button tone=\"neutral\" emphasis=\"soft\" size=\"m\">\n Neutral\n </Button>\n <Button tone=\"danger\" emphasis=\"ghost\" size=\"m\">\n Danger\n </Button>\n </Stack>\n <Stack direction=\"row\" gap=\"s\" align=\"center\">\n <Badge tone=\"primary\">Primary</Badge>\n <Badge tone=\"success\" emphasis=\"soft\">\n Success\n </Badge>\n <Badge tone=\"warning\" emphasis=\"soft\">\n Warning\n </Badge>\n <Badge tone=\"danger\" emphasis=\"soft\">\n Danger\n </Badge>\n </Stack>\n <Card\n tone=\"subtle\"\n title=\"Nested card\"\n description=\"Subtle tone inside the preview.\"\n compact\n />\n </Stack>\n </Card>\n\n {/* Submit */}\n {onSubmit ? (\n <Button\n tone=\"primary\"\n emphasis=\"solid\"\n onPress={() => onSubmit(value)}\n testID={testID ? `${testID}-submit` : undefined}\n >\n Apply theme\n </Button>\n ) : null}\n </Stack>\n );\n}\n\nexport const ThemeComposer = withZoraThemeScope(ThemeComposerInner);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/theme-composer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/theme-composer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { ThemeComposer } from './ThemeComposer';\nexport type { ThemeComposerProps } from './types';\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ZoraTheme, ZoraThemeMode } from '../../theme/types';
|
|
2
|
+
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
3
|
+
export interface ThemeComposerProps extends ZoraBaseProps {
|
|
4
|
+
value: ZoraTheme;
|
|
5
|
+
onChange: (theme: ZoraTheme) => void;
|
|
6
|
+
mode?: ZoraThemeMode;
|
|
7
|
+
onModeChange?: (mode: ZoraThemeMode) => void;
|
|
8
|
+
onSubmit?: (theme: ZoraTheme) => void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/patterns/theme-composer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/patterns/theme-composer/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ZoraTheme, ZoraThemeMode } from '../../theme/types';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface ThemeComposerProps extends ZoraBaseProps {\n value: ZoraTheme;\n onChange: (theme: ZoraTheme) => void;\n mode?: ZoraThemeMode;\n onModeChange?: (mode: ZoraThemeMode) => void;\n onSubmit?: (theme: ZoraTheme) => void;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/zora",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.15.0",
|
|
5
5
|
"description": "Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/zora#readme",
|
|
7
7
|
"bugs": {
|
package/src/index.ts
CHANGED
|
@@ -146,6 +146,8 @@ export type { SettingsRowProps } from './patterns/settings-row';
|
|
|
146
146
|
export { SettingsRow } from './patterns/settings-row';
|
|
147
147
|
export type { SwitchFieldProps } from './patterns/switch-field';
|
|
148
148
|
export { SwitchField } from './patterns/switch-field';
|
|
149
|
+
export type { ThemeComposerProps } from './patterns/theme-composer';
|
|
150
|
+
export { ThemeComposer } from './patterns/theme-composer';
|
|
149
151
|
export type { PaletteItemProps, TileGridProps } from './patterns/tile-grid';
|
|
150
152
|
export { PaletteItem, TileGrid } from './patterns/tile-grid';
|
|
151
153
|
export type { TreeItemNode, TreeItemRenderProps, TreeViewProps } from './patterns/tree-view';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import { ZORA_COLOR_HARMONIES, ZORA_COLOR_TONES } from '../../theme/types';
|
|
4
|
+
import { zoraDefaultTheme } from '../../theme/zoraDefaultTheme';
|
|
5
|
+
import type { ThemeComposerProps } from './types';
|
|
6
|
+
|
|
7
|
+
// Validate the exported types compile correctly by asserting shape
|
|
8
|
+
describe('ThemeComposerProps', () => {
|
|
9
|
+
test('accepts a valid ZoraTheme as value', () => {
|
|
10
|
+
const props: ThemeComposerProps = {
|
|
11
|
+
value: zoraDefaultTheme,
|
|
12
|
+
onChange: () => undefined,
|
|
13
|
+
};
|
|
14
|
+
expect(props.value.primaryColor).toBe('#0f766e');
|
|
15
|
+
expect(props.value.harmony).toBe('analogous');
|
|
16
|
+
expect(props.value.colorTone).toBe('jewel');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('accepts optional mode and onModeChange', () => {
|
|
20
|
+
const props: ThemeComposerProps = {
|
|
21
|
+
value: zoraDefaultTheme,
|
|
22
|
+
onChange: () => undefined,
|
|
23
|
+
mode: 'dark',
|
|
24
|
+
onModeChange: (_mode) => undefined,
|
|
25
|
+
};
|
|
26
|
+
expect(props.mode).toBe('dark');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('accepts optional onSubmit', () => {
|
|
30
|
+
let submitted = false;
|
|
31
|
+
const props: ThemeComposerProps = {
|
|
32
|
+
value: zoraDefaultTheme,
|
|
33
|
+
onChange: () => undefined,
|
|
34
|
+
onSubmit: () => {
|
|
35
|
+
submitted = true;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
props.onSubmit?.(zoraDefaultTheme);
|
|
39
|
+
expect(submitted).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('ZORA_COLOR_HARMONIES coverage for ThemeComposer', () => {
|
|
44
|
+
test('all harmony values are present for the Select options', () => {
|
|
45
|
+
const expected = [
|
|
46
|
+
'monochromatic',
|
|
47
|
+
'analogous',
|
|
48
|
+
'complementary',
|
|
49
|
+
'splitComplementary',
|
|
50
|
+
'triadic',
|
|
51
|
+
'tetradic',
|
|
52
|
+
] as const;
|
|
53
|
+
expect(ZORA_COLOR_HARMONIES).toEqual(expected);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe('ZORA_COLOR_TONES coverage for ThemeComposer', () => {
|
|
58
|
+
test('all color tones are present for the Select options', () => {
|
|
59
|
+
const expected = [
|
|
60
|
+
'neutral',
|
|
61
|
+
'pastel',
|
|
62
|
+
'earth',
|
|
63
|
+
'mineral',
|
|
64
|
+
'muted',
|
|
65
|
+
'jewel',
|
|
66
|
+
'fluorescent',
|
|
67
|
+
'obsidian',
|
|
68
|
+
'vaporwave',
|
|
69
|
+
'monochromeAccent',
|
|
70
|
+
] as const;
|
|
71
|
+
expect(ZORA_COLOR_TONES).toEqual(expected);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe('onChange propagation contract', () => {
|
|
76
|
+
test('onChange receives updated theme with new harmony', () => {
|
|
77
|
+
const received: unknown[] = [];
|
|
78
|
+
const props: ThemeComposerProps = {
|
|
79
|
+
value: zoraDefaultTheme,
|
|
80
|
+
onChange: (t) => received.push(t),
|
|
81
|
+
};
|
|
82
|
+
// Simulate what the component does internally
|
|
83
|
+
props.onChange({ ...zoraDefaultTheme, harmony: 'triadic' });
|
|
84
|
+
expect(received).toHaveLength(1);
|
|
85
|
+
expect((received[0] as typeof zoraDefaultTheme).harmony).toBe('triadic');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('onChange receives updated theme with new colorTone', () => {
|
|
89
|
+
const received: unknown[] = [];
|
|
90
|
+
const props: ThemeComposerProps = {
|
|
91
|
+
value: zoraDefaultTheme,
|
|
92
|
+
onChange: (t) => received.push(t),
|
|
93
|
+
};
|
|
94
|
+
props.onChange({ ...zoraDefaultTheme, colorTone: 'obsidian' });
|
|
95
|
+
expect((received[0] as typeof zoraDefaultTheme).colorTone).toBe('obsidian');
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { Box, Stack } from '@ankhorage/surface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import { Badge } from '../../components/badge';
|
|
5
|
+
import { Button } from '../../components/button';
|
|
6
|
+
import { Card } from '../../components/card';
|
|
7
|
+
import { Heading } from '../../components/heading';
|
|
8
|
+
import { Input } from '../../components/input';
|
|
9
|
+
import { Select } from '../../components/select';
|
|
10
|
+
import { Tabs } from '../../components/tabs';
|
|
11
|
+
import { Text } from '../../components/text';
|
|
12
|
+
import {
|
|
13
|
+
ZORA_COLOR_HARMONIES,
|
|
14
|
+
ZORA_COLOR_TONES,
|
|
15
|
+
type ZoraColorTone,
|
|
16
|
+
type ZoraTheme,
|
|
17
|
+
type ZoraThemeMode,
|
|
18
|
+
} from '../../theme/types';
|
|
19
|
+
import { useZoraTheme } from '../../theme/useZoraTheme';
|
|
20
|
+
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
21
|
+
import type { ThemeComposerProps } from './types';
|
|
22
|
+
|
|
23
|
+
const HEX_RE = /^#[0-9A-Fa-f]{6}$/;
|
|
24
|
+
|
|
25
|
+
function isValidHex(value: string): boolean {
|
|
26
|
+
return HEX_RE.test(value);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const HARMONY_OPTIONS = ZORA_COLOR_HARMONIES.map((h) => ({ value: h, label: h }));
|
|
30
|
+
|
|
31
|
+
const TONE_OPTIONS = ZORA_COLOR_TONES.map((t) => ({ value: t, label: t }));
|
|
32
|
+
|
|
33
|
+
const MODE_TABS = [
|
|
34
|
+
{ value: 'light' as ZoraThemeMode, label: 'Light' },
|
|
35
|
+
{ value: 'dark' as ZoraThemeMode, label: 'Dark' },
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const COLOR_TONE_BACKGROUND_TONE: Record<ZoraColorTone, string> = {
|
|
39
|
+
neutral: 'Neutral',
|
|
40
|
+
pastel: 'Pastel',
|
|
41
|
+
earth: 'Earth',
|
|
42
|
+
mineral: 'Mineral',
|
|
43
|
+
muted: 'Muted',
|
|
44
|
+
jewel: 'Neutral',
|
|
45
|
+
fluorescent: 'Obsidian',
|
|
46
|
+
obsidian: 'Obsidian',
|
|
47
|
+
vaporwave: 'Pastel',
|
|
48
|
+
monochromeAccent: 'Neutral',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const COLOR_TONE_FOREGROUND_TONE: Record<ZoraColorTone, string> = {
|
|
52
|
+
neutral: 'Jewel',
|
|
53
|
+
pastel: 'Jewel',
|
|
54
|
+
earth: 'Mineral',
|
|
55
|
+
mineral: 'Jewel',
|
|
56
|
+
muted: 'Jewel',
|
|
57
|
+
jewel: 'Jewel',
|
|
58
|
+
fluorescent: 'Fluorescent',
|
|
59
|
+
obsidian: 'Fluorescent',
|
|
60
|
+
vaporwave: 'Fluorescent',
|
|
61
|
+
monochromeAccent: 'Jewel',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
function ThemeComposerInner({
|
|
65
|
+
themeId: _themeId,
|
|
66
|
+
value,
|
|
67
|
+
onChange,
|
|
68
|
+
mode,
|
|
69
|
+
onModeChange,
|
|
70
|
+
onSubmit,
|
|
71
|
+
testID,
|
|
72
|
+
}: ThemeComposerProps) {
|
|
73
|
+
const { theme } = useZoraTheme();
|
|
74
|
+
|
|
75
|
+
const [hexInput, setHexInput] = React.useState<string>(value.primaryColor);
|
|
76
|
+
const [hexError, setHexError] = React.useState<string | undefined>(undefined);
|
|
77
|
+
|
|
78
|
+
// Keep local hex input in sync when value.primaryColor changes externally
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
setHexInput(value.primaryColor);
|
|
81
|
+
setHexError(undefined);
|
|
82
|
+
}, [value.primaryColor]);
|
|
83
|
+
|
|
84
|
+
function handleHexChange(text: string) {
|
|
85
|
+
// Ensure leading hash
|
|
86
|
+
const normalized = text.startsWith('#') ? text : `#${text}`;
|
|
87
|
+
setHexInput(normalized);
|
|
88
|
+
|
|
89
|
+
if (isValidHex(normalized)) {
|
|
90
|
+
setHexError(undefined);
|
|
91
|
+
onChange({ ...value, primaryColor: normalized as ZoraTheme['primaryColor'] });
|
|
92
|
+
} else {
|
|
93
|
+
setHexError('Enter a valid 6-digit hex color (e.g. #0f766e).');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const activeMode = mode ?? 'light';
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Stack gap="l" testID={testID}>
|
|
101
|
+
{/* Section: Primary Color */}
|
|
102
|
+
<Card title="Primary color" description="Set the seed color for your theme palette.">
|
|
103
|
+
<Stack gap="m">
|
|
104
|
+
<Stack direction="row" gap="m" align="center">
|
|
105
|
+
<Box flex={1}>
|
|
106
|
+
<Input
|
|
107
|
+
value={hexInput}
|
|
108
|
+
onChangeText={handleHexChange}
|
|
109
|
+
placeholder="#0f766e"
|
|
110
|
+
autoCapitalize="none"
|
|
111
|
+
autoCorrect={false}
|
|
112
|
+
maxLength={7}
|
|
113
|
+
invalid={hexError !== undefined}
|
|
114
|
+
testID={testID ? `${testID}-hex-input` : undefined}
|
|
115
|
+
/>
|
|
116
|
+
</Box>
|
|
117
|
+
{/* Color preview chip */}
|
|
118
|
+
<Box
|
|
119
|
+
width={36}
|
|
120
|
+
height={36}
|
|
121
|
+
radius="m"
|
|
122
|
+
style={{
|
|
123
|
+
backgroundColor: isValidHex(hexInput) ? hexInput : theme.colors.border,
|
|
124
|
+
borderWidth: 1,
|
|
125
|
+
borderColor: theme.colors.border,
|
|
126
|
+
}}
|
|
127
|
+
/>
|
|
128
|
+
</Stack>
|
|
129
|
+
{hexError ? (
|
|
130
|
+
<Text tone="danger" variant="bodySmall">
|
|
131
|
+
{hexError}
|
|
132
|
+
</Text>
|
|
133
|
+
) : null}
|
|
134
|
+
</Stack>
|
|
135
|
+
</Card>
|
|
136
|
+
|
|
137
|
+
{/* Section: Harmony */}
|
|
138
|
+
<Card
|
|
139
|
+
title="Harmony"
|
|
140
|
+
description="Choose how accent hues are generated from your primary color."
|
|
141
|
+
>
|
|
142
|
+
<Select
|
|
143
|
+
value={value.harmony}
|
|
144
|
+
options={HARMONY_OPTIONS}
|
|
145
|
+
onValueChange={(h) => onChange({ ...value, harmony: h })}
|
|
146
|
+
testID={testID ? `${testID}-harmony-select` : undefined}
|
|
147
|
+
/>
|
|
148
|
+
</Card>
|
|
149
|
+
|
|
150
|
+
{/* Section: Color tone */}
|
|
151
|
+
<Card
|
|
152
|
+
title="Color tone"
|
|
153
|
+
description="Controls the vibrancy and saturation style of the palette."
|
|
154
|
+
>
|
|
155
|
+
<Stack gap="s">
|
|
156
|
+
<Select
|
|
157
|
+
value={value.colorTone}
|
|
158
|
+
options={TONE_OPTIONS}
|
|
159
|
+
onValueChange={(t) => onChange({ ...value, colorTone: t })}
|
|
160
|
+
testID={testID ? `${testID}-tone-select` : undefined}
|
|
161
|
+
/>
|
|
162
|
+
<Stack direction="row" gap="s" align="center">
|
|
163
|
+
<Text tone="muted" variant="caption">
|
|
164
|
+
Background:
|
|
165
|
+
</Text>
|
|
166
|
+
<Badge tone="neutral" emphasis="soft">
|
|
167
|
+
{COLOR_TONE_BACKGROUND_TONE[value.colorTone]}
|
|
168
|
+
</Badge>
|
|
169
|
+
<Text tone="muted" variant="caption">
|
|
170
|
+
Foreground:
|
|
171
|
+
</Text>
|
|
172
|
+
<Badge tone="neutral" emphasis="soft">
|
|
173
|
+
{COLOR_TONE_FOREGROUND_TONE[value.colorTone]}
|
|
174
|
+
</Badge>
|
|
175
|
+
</Stack>
|
|
176
|
+
</Stack>
|
|
177
|
+
</Card>
|
|
178
|
+
|
|
179
|
+
{/* Section: Mode */}
|
|
180
|
+
<Card title="Mode" description="Switch between light and dark presentation.">
|
|
181
|
+
<Tabs
|
|
182
|
+
value={activeMode}
|
|
183
|
+
items={MODE_TABS}
|
|
184
|
+
onValueChange={(m) => onModeChange?.(m)}
|
|
185
|
+
variant="segmented"
|
|
186
|
+
testID={testID ? `${testID}-mode-tabs` : undefined}
|
|
187
|
+
/>
|
|
188
|
+
</Card>
|
|
189
|
+
|
|
190
|
+
{/* Section: Preview */}
|
|
191
|
+
<Card title="Preview" description="A quick look at how your theme renders common controls.">
|
|
192
|
+
<Stack gap="m">
|
|
193
|
+
<Heading level={4}>Heading</Heading>
|
|
194
|
+
<Text>Body text — this shows default text color and weight.</Text>
|
|
195
|
+
<Text tone="muted" variant="bodySmall">
|
|
196
|
+
Muted caption text.
|
|
197
|
+
</Text>
|
|
198
|
+
<Stack direction="row" gap="s" align="center">
|
|
199
|
+
<Button tone="primary" emphasis="solid" size="m">
|
|
200
|
+
Primary
|
|
201
|
+
</Button>
|
|
202
|
+
<Button tone="neutral" emphasis="soft" size="m">
|
|
203
|
+
Neutral
|
|
204
|
+
</Button>
|
|
205
|
+
<Button tone="danger" emphasis="ghost" size="m">
|
|
206
|
+
Danger
|
|
207
|
+
</Button>
|
|
208
|
+
</Stack>
|
|
209
|
+
<Stack direction="row" gap="s" align="center">
|
|
210
|
+
<Badge tone="primary">Primary</Badge>
|
|
211
|
+
<Badge tone="success" emphasis="soft">
|
|
212
|
+
Success
|
|
213
|
+
</Badge>
|
|
214
|
+
<Badge tone="warning" emphasis="soft">
|
|
215
|
+
Warning
|
|
216
|
+
</Badge>
|
|
217
|
+
<Badge tone="danger" emphasis="soft">
|
|
218
|
+
Danger
|
|
219
|
+
</Badge>
|
|
220
|
+
</Stack>
|
|
221
|
+
<Card
|
|
222
|
+
tone="subtle"
|
|
223
|
+
title="Nested card"
|
|
224
|
+
description="Subtle tone inside the preview."
|
|
225
|
+
compact
|
|
226
|
+
/>
|
|
227
|
+
</Stack>
|
|
228
|
+
</Card>
|
|
229
|
+
|
|
230
|
+
{/* Submit */}
|
|
231
|
+
{onSubmit ? (
|
|
232
|
+
<Button
|
|
233
|
+
tone="primary"
|
|
234
|
+
emphasis="solid"
|
|
235
|
+
onPress={() => onSubmit(value)}
|
|
236
|
+
testID={testID ? `${testID}-submit` : undefined}
|
|
237
|
+
>
|
|
238
|
+
Apply theme
|
|
239
|
+
</Button>
|
|
240
|
+
) : null}
|
|
241
|
+
</Stack>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export const ThemeComposer = withZoraThemeScope(ThemeComposerInner);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ZoraTheme, ZoraThemeMode } from '../../theme/types';
|
|
2
|
+
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
3
|
+
|
|
4
|
+
export interface ThemeComposerProps extends ZoraBaseProps {
|
|
5
|
+
value: ZoraTheme;
|
|
6
|
+
onChange: (theme: ZoraTheme) => void;
|
|
7
|
+
mode?: ZoraThemeMode;
|
|
8
|
+
onModeChange?: (mode: ZoraThemeMode) => void;
|
|
9
|
+
onSubmit?: (theme: ZoraTheme) => void;
|
|
10
|
+
}
|