@simplysm/solid 13.0.85 → 13.0.88

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.
Files changed (116) hide show
  1. package/README.md +143 -28
  2. package/dist/components/data/list/ListItem.d.ts.map +1 -1
  3. package/dist/components/data/list/ListItem.js +11 -4
  4. package/dist/components/data/list/ListItem.js.map +2 -2
  5. package/dist/components/data/list/ListItem.styles.d.ts +2 -0
  6. package/dist/components/data/list/ListItem.styles.d.ts.map +1 -1
  7. package/dist/components/data/list/ListItem.styles.js +11 -1
  8. package/dist/components/data/list/ListItem.styles.js.map +1 -1
  9. package/dist/components/features/crud-sheet/CrudSheet.d.ts.map +1 -1
  10. package/dist/components/features/crud-sheet/CrudSheet.js +7 -0
  11. package/dist/components/features/crud-sheet/CrudSheet.js.map +2 -2
  12. package/dist/components/features/data-select-button/DataSelectButton.d.ts.map +1 -1
  13. package/dist/components/features/data-select-button/DataSelectButton.js +30 -26
  14. package/dist/components/features/data-select-button/DataSelectButton.js.map +2 -2
  15. package/dist/components/features/permission-table/PermissionTable.js +5 -1
  16. package/dist/components/features/permission-table/PermissionTable.js.map +2 -2
  17. package/dist/components/form-control/DropdownTrigger.styles.js +1 -1
  18. package/dist/components/form-control/combobox/Combobox.d.ts +19 -5
  19. package/dist/components/form-control/combobox/Combobox.d.ts.map +1 -1
  20. package/dist/components/form-control/combobox/Combobox.js +2 -4
  21. package/dist/components/form-control/combobox/Combobox.js.map +1 -1
  22. package/dist/components/form-control/date-range-picker/DateRangePicker.d.ts +2 -2
  23. package/dist/components/form-control/date-range-picker/DateRangePicker.d.ts.map +1 -1
  24. package/dist/components/form-control/date-range-picker/DateRangePicker.js +10 -1
  25. package/dist/components/form-control/date-range-picker/DateRangePicker.js.map +2 -2
  26. package/dist/components/form-control/editor/RichTextEditor.d.ts +2 -2
  27. package/dist/components/form-control/editor/RichTextEditor.d.ts.map +1 -1
  28. package/dist/components/form-control/editor/RichTextEditor.js +2 -2
  29. package/dist/components/form-control/editor/RichTextEditor.js.map +1 -1
  30. package/dist/components/form-control/field/DatePicker.d.ts +2 -2
  31. package/dist/components/form-control/field/DatePicker.d.ts.map +1 -1
  32. package/dist/components/form-control/field/DatePicker.js.map +1 -1
  33. package/dist/components/form-control/field/DateTimePicker.d.ts +2 -2
  34. package/dist/components/form-control/field/DateTimePicker.d.ts.map +1 -1
  35. package/dist/components/form-control/field/DateTimePicker.js.map +1 -1
  36. package/dist/components/form-control/field/Field.styles.d.ts +6 -7
  37. package/dist/components/form-control/field/Field.styles.d.ts.map +1 -1
  38. package/dist/components/form-control/field/Field.styles.js.map +1 -1
  39. package/dist/components/form-control/field/NumberInput.d.ts +2 -2
  40. package/dist/components/form-control/field/NumberInput.d.ts.map +1 -1
  41. package/dist/components/form-control/field/NumberInput.js.map +1 -1
  42. package/dist/components/form-control/field/TextInput.d.ts +2 -2
  43. package/dist/components/form-control/field/TextInput.d.ts.map +1 -1
  44. package/dist/components/form-control/field/TextInput.js.map +1 -1
  45. package/dist/components/form-control/field/Textarea.d.ts +2 -2
  46. package/dist/components/form-control/field/Textarea.d.ts.map +1 -1
  47. package/dist/components/form-control/field/Textarea.js.map +1 -1
  48. package/dist/components/form-control/field/TimePicker.d.ts +2 -2
  49. package/dist/components/form-control/field/TimePicker.d.ts.map +1 -1
  50. package/dist/components/form-control/field/TimePicker.js.map +1 -1
  51. package/dist/components/form-control/numpad/Numpad.d.ts.map +1 -1
  52. package/dist/components/form-control/numpad/Numpad.js +4 -17
  53. package/dist/components/form-control/numpad/Numpad.js.map +2 -2
  54. package/dist/components/form-control/select/Select.d.ts.map +1 -1
  55. package/dist/components/form-control/select/Select.js +19 -6
  56. package/dist/components/form-control/select/Select.js.map +2 -2
  57. package/dist/components/form-control/state-preset/StatePreset.d.ts +1 -3
  58. package/dist/components/form-control/state-preset/StatePreset.d.ts.map +1 -1
  59. package/dist/components/form-control/state-preset/StatePreset.js +69 -91
  60. package/dist/components/form-control/state-preset/StatePreset.js.map +2 -2
  61. package/dist/components/layout/FormGroup.js +1 -1
  62. package/dist/components/layout/FormGroup.js.map +1 -1
  63. package/dist/components/layout/FormTable.js +3 -3
  64. package/dist/components/layout/FormTable.js.map +1 -1
  65. package/dist/components/layout/sidebar/Sidebar.d.ts.map +1 -1
  66. package/dist/components/layout/sidebar/Sidebar.js +3 -6
  67. package/dist/components/layout/sidebar/Sidebar.js.map +2 -2
  68. package/dist/providers/i18n/locales/en.d.ts +2 -3
  69. package/dist/providers/i18n/locales/en.d.ts.map +1 -1
  70. package/dist/providers/i18n/locales/en.js +3 -4
  71. package/dist/providers/i18n/locales/en.js.map +1 -1
  72. package/dist/providers/i18n/locales/ko.d.ts +2 -3
  73. package/dist/providers/i18n/locales/ko.d.ts.map +1 -1
  74. package/dist/providers/i18n/locales/ko.js +3 -4
  75. package/dist/providers/i18n/locales/ko.js.map +1 -1
  76. package/docs/display-feedback.md +279 -0
  77. package/docs/features.md +357 -213
  78. package/docs/form-controls.md +261 -403
  79. package/docs/layout-data.md +386 -0
  80. package/docs/providers-hooks.md +411 -0
  81. package/package.json +5 -5
  82. package/src/components/data/list/ListItem.styles.ts +14 -2
  83. package/src/components/data/list/ListItem.tsx +13 -4
  84. package/src/components/features/crud-sheet/CrudSheet.tsx +8 -0
  85. package/src/components/features/data-select-button/DataSelectButton.tsx +39 -32
  86. package/src/components/features/permission-table/PermissionTable.tsx +1 -1
  87. package/src/components/form-control/DropdownTrigger.styles.ts +1 -1
  88. package/src/components/form-control/combobox/Combobox.tsx +42 -16
  89. package/src/components/form-control/date-range-picker/DateRangePicker.tsx +6 -4
  90. package/src/components/form-control/editor/RichTextEditor.tsx +5 -6
  91. package/src/components/form-control/field/DatePicker.tsx +3 -2
  92. package/src/components/form-control/field/DateTimePicker.tsx +3 -2
  93. package/src/components/form-control/field/Field.styles.ts +6 -8
  94. package/src/components/form-control/field/NumberInput.tsx +3 -2
  95. package/src/components/form-control/field/TextInput.tsx +3 -2
  96. package/src/components/form-control/field/Textarea.tsx +3 -2
  97. package/src/components/form-control/field/TimePicker.tsx +3 -2
  98. package/src/components/form-control/numpad/Numpad.tsx +16 -18
  99. package/src/components/form-control/select/Select.tsx +19 -5
  100. package/src/components/form-control/state-preset/StatePreset.tsx +32 -57
  101. package/src/components/layout/FormGroup.tsx +1 -1
  102. package/src/components/layout/FormTable.tsx +3 -3
  103. package/src/components/layout/sidebar/Sidebar.tsx +2 -3
  104. package/src/providers/i18n/locales/en.ts +2 -3
  105. package/src/providers/i18n/locales/ko.ts +2 -3
  106. package/tests/components/features/data-select-button/DataSelectButton.spec.tsx +62 -7
  107. package/tests/components/form-control/combobox/Combobox.spec.tsx +3 -3
  108. package/tests/components/form-control/date-range-picker/DateRangePicker.spec.tsx +56 -0
  109. package/docs/data.md +0 -204
  110. package/docs/disclosure.md +0 -146
  111. package/docs/display.md +0 -125
  112. package/docs/feedback.md +0 -156
  113. package/docs/helpers.md +0 -173
  114. package/docs/hooks.md +0 -146
  115. package/docs/layout.md +0 -94
  116. package/docs/providers.md +0 -180
@@ -1,146 +0,0 @@
1
- # Disclosure
2
-
3
- ## Collapse
4
-
5
- ```typescript
6
- interface CollapseProps extends JSX.HTMLAttributes<HTMLDivElement> {
7
- open?: boolean;
8
- }
9
- ```
10
-
11
- Collapsible content panel with CSS transition. Content is hidden when `open` is `false`.
12
-
13
- ---
14
-
15
- ## Dropdown
16
-
17
- ```typescript
18
- interface DropdownProps {
19
- position?: { x: number; y: number };
20
- open?: boolean;
21
- onOpenChange?: (open: boolean) => void;
22
- maxHeight?: number;
23
- disabled?: boolean;
24
- keyboardNav?: boolean;
25
- class?: string;
26
- style?: JSX.CSSProperties;
27
- children: JSX.Element;
28
- }
29
- ```
30
-
31
- Dropdown popup anchored to a trigger element. When `position` is provided instead of a trigger, the popup appears at the given absolute coordinates (useful for context menus). `keyboardNav` enables ArrowUp/Down navigation. Default `maxHeight` is 300px.
32
-
33
- **Sub-components:**
34
- - `Dropdown.Trigger` -- the element that opens the dropdown on click
35
- - `Dropdown.Content` -- the popup content
36
-
37
- ---
38
-
39
- ## Dialog
40
-
41
- ```typescript
42
- interface DialogProps {
43
- open?: boolean;
44
- onOpenChange?: (open: boolean) => void;
45
- withCloseButton?: boolean;
46
- closeOnInteractOutside?: boolean;
47
- closeOnEscape?: boolean;
48
- resizable?: boolean;
49
- draggable?: boolean;
50
- mode?: "float" | "fill";
51
- width?: number;
52
- height?: number;
53
- minWidth?: number;
54
- minHeight?: number;
55
- position?: "bottom-right" | "top-right";
56
- headerStyle?: JSX.CSSProperties | string;
57
- beforeClose?: () => boolean;
58
- onCloseComplete?: () => void;
59
- class?: string;
60
- }
61
- ```
62
-
63
- Modal dialog with overlay. Supports both declarative (template) and programmatic usage.
64
-
65
- - `mode="float"` -- centered floating dialog (default)
66
- - `mode="fill"` -- full-screen dialog
67
- - `beforeClose` -- return `false` to prevent closing
68
- - `resizable` / `draggable` -- enable resize handles / drag-to-move (draggable defaults to `true`)
69
- - `withCloseButton` -- show close button (defaults to `true`)
70
- - `closeOnEscape` -- close on Escape key (defaults to `true`)
71
-
72
- **Sub-components:**
73
- - `Dialog.Header` -- dialog title bar
74
- - `Dialog.Action` -- dialog action buttons area
75
-
76
- ### Programmatic API
77
-
78
- ```typescript
79
- interface DialogContextValue {
80
- show<P>(
81
- component: Component<P>,
82
- props: Omit<P, "close">,
83
- options?: DialogShowOptions,
84
- ): Promise<ExtractCloseResult<P> | undefined>;
85
- }
86
-
87
- interface DialogProviderProps {
88
- closeOnEscape?: boolean;
89
- closeOnInteractOutside?: boolean;
90
- }
91
- ```
92
-
93
- Use `DialogProvider` and `useDialog()` for programmatic dialog management. The shown component receives a `close(result?)` prop to close the dialog and return a value. `DialogProvider` accepts default options for `closeOnEscape` and `closeOnInteractOutside`.
94
-
95
- ```typescript
96
- const dialog = useDialog();
97
- const result = await dialog.show(MyDialogContent, { data }, {
98
- width: 600,
99
- withCloseButton: true,
100
- });
101
- ```
102
-
103
- ---
104
-
105
- ## Tabs
106
-
107
- ```typescript
108
- interface TabsProps {
109
- value?: string;
110
- onValueChange?: (value: string) => void;
111
- size?: "xs" | "sm" | "md" | "lg" | "xl";
112
- class?: string;
113
- style?: JSX.CSSProperties;
114
- children?: JSX.Element;
115
- }
116
- ```
117
-
118
- Tab navigation. Content rendering is managed externally based on the selected `value`.
119
-
120
- **Sub-component:** `Tabs.Tab` -- `{ value: string; disabled?: boolean; class?: string; children?: JSX.Element }`
121
-
122
- ---
123
-
124
- ## Usage Examples
125
-
126
- ```typescript
127
- import { Dialog, Dropdown, Tabs, Collapse } from "@simplysm/solid";
128
-
129
- // Declarative dialog
130
- <Dialog open={isOpen()} onOpenChange={setIsOpen} width={500} withCloseButton>
131
- <Dialog.Header>Edit User</Dialog.Header>
132
- <form>...</form>
133
- <Dialog.Action>
134
- <Button onClick={() => setIsOpen(false)}>Cancel</Button>
135
- <Button theme="primary" onClick={save}>Save</Button>
136
- </Dialog.Action>
137
- </Dialog>
138
-
139
- // Tabs
140
- <Tabs value={tab()} onValueChange={setTab}>
141
- <Tabs.Tab value="general">General</Tabs.Tab>
142
- <Tabs.Tab value="settings">Settings</Tabs.Tab>
143
- </Tabs>
144
- <Show when={tab() === "general"}>General content</Show>
145
- <Show when={tab() === "settings"}>Settings content</Show>
146
- ```
package/docs/display.md DELETED
@@ -1,125 +0,0 @@
1
- # Display
2
-
3
- ## Card
4
-
5
- ```typescript
6
- interface CardProps extends JSX.HTMLAttributes<HTMLDivElement> {}
7
- ```
8
-
9
- Simple card container with default border and background styling.
10
-
11
- ---
12
-
13
- ## Icon
14
-
15
- ```typescript
16
- interface IconProps extends Omit<TablerIconProps, "size"> {
17
- icon: Component<TablerIconProps>;
18
- size?: string | number;
19
- }
20
- ```
21
-
22
- Renders a Tabler icon. Pass the icon component via the `icon` prop.
23
-
24
- ```typescript
25
- import { Icon } from "@simplysm/solid";
26
- import { IconUser } from "@tabler/icons-solidjs";
27
-
28
- <Icon icon={IconUser} size={24} />
29
- ```
30
-
31
- ---
32
-
33
- ## Tag
34
-
35
- ```typescript
36
- interface TagProps extends JSX.HTMLAttributes<HTMLSpanElement> {
37
- theme?: "base" | "primary" | "info" | "success" | "warning" | "danger";
38
- }
39
- ```
40
-
41
- Inline badge/tag with semantic theming.
42
-
43
- ---
44
-
45
- ## Link
46
-
47
- ```typescript
48
- interface LinkProps extends JSX.AnchorHTMLAttributes<HTMLAnchorElement> {
49
- theme?: "base" | "primary" | "info" | "success" | "warning" | "danger";
50
- disabled?: boolean;
51
- }
52
- ```
53
-
54
- Styled anchor link with theme and disabled state.
55
-
56
- ---
57
-
58
- ## Alert
59
-
60
- ```typescript
61
- interface AlertProps extends JSX.HTMLAttributes<HTMLDivElement> {
62
- theme?: "base" | "primary" | "info" | "success" | "warning" | "danger";
63
- }
64
- ```
65
-
66
- Alert banner with semantic theming.
67
-
68
- ---
69
-
70
- ## Barcode
71
-
72
- ```typescript
73
- interface BarcodeProps extends JSX.HTMLAttributes<HTMLDivElement> {
74
- type: BarcodeType;
75
- value?: string;
76
- }
77
- ```
78
-
79
- Renders barcodes and QR codes using bwip-js. `type` supports 111+ barcode formats including `"qrcode"`, `"code128"`, `"ean13"`, `"datamatrix"`, etc.
80
-
81
- ---
82
-
83
- ## Echarts
84
-
85
- ```typescript
86
- interface EchartsProps extends JSX.HTMLAttributes<HTMLDivElement> {
87
- option: echarts.EChartsOption;
88
- busy?: boolean;
89
- }
90
- ```
91
-
92
- Apache ECharts wrapper. Requires `echarts` as a peer dependency. Set `busy` to show a loading overlay.
93
-
94
- ---
95
-
96
- ## Progress
97
-
98
- ```typescript
99
- interface ProgressProps extends JSX.HTMLAttributes<HTMLDivElement> {
100
- value: number;
101
- theme?: "base" | "primary" | "info" | "success" | "warning" | "danger";
102
- size?: "xs" | "sm" | "md" | "lg" | "xl";
103
- inset?: boolean;
104
- }
105
- ```
106
-
107
- Progress bar. `value` is in the range 0--100 (0 = 0%, 100 = 100%). Pass `children` to display custom content instead of the default percentage text.
108
-
109
- ---
110
-
111
- ## Usage Examples
112
-
113
- ```typescript
114
- import { Card, Tag, Alert, Progress, Icon } from "@simplysm/solid";
115
- import { IconCheck } from "@tabler/icons-solidjs";
116
-
117
- <Card>
118
- <Tag theme="success">Active</Tag>
119
- <Progress value={75} theme="primary" />
120
- </Card>
121
-
122
- <Alert theme="warning">
123
- <Icon icon={IconCheck} /> Operation completed with warnings.
124
- </Alert>
125
- ```
package/docs/feedback.md DELETED
@@ -1,156 +0,0 @@
1
- # Feedback
2
-
3
- ## Notification System
4
-
5
- ### NotificationProvider / useNotification
6
-
7
- ```typescript
8
- type NotificationTheme = "info" | "success" | "warning" | "danger";
9
-
10
- interface NotificationAction {
11
- label: string;
12
- onClick: () => void;
13
- }
14
-
15
- interface NotificationOptions {
16
- action?: NotificationAction;
17
- }
18
-
19
- interface NotificationUpdateOptions {
20
- renotify?: boolean;
21
- }
22
-
23
- interface NotificationContextValue {
24
- items: Accessor<NotificationItem[]>;
25
- unreadCount: Accessor<number>;
26
- latestUnread: Accessor<NotificationItem | undefined>;
27
-
28
- info(title: string, message?: string, options?: NotificationOptions): string;
29
- success(title: string, message?: string, options?: NotificationOptions): string;
30
- warning(title: string, message?: string, options?: NotificationOptions): string;
31
- danger(title: string, message?: string, options?: NotificationOptions): string;
32
- error(err?: any, header?: string): void;
33
-
34
- update(id: string, updates: Partial<NotificationItem>, options?: NotificationUpdateOptions): void;
35
- remove(id: string): void;
36
- markAsRead(id: string): void;
37
- markAllAsRead(): void;
38
- dismissBanner(): void;
39
- clear(): void;
40
- }
41
- ```
42
-
43
- Centralized notification management. Each `info`/`success`/`warning`/`danger` call creates a notification and returns its `id`. Use `error(err)` to display an error object as a danger notification. Maintains up to 50 notifications; older items are removed when exceeded.
44
-
45
- Notifications can include an `action` button via the `options` parameter.
46
-
47
- ### NotificationBell
48
-
49
- ```typescript
50
- interface NotificationBellProps {
51
- showBanner?: boolean;
52
- }
53
- ```
54
-
55
- Bell icon button showing unread notification count. Set `showBanner` to display the latest notification as a banner.
56
-
57
- ### NotificationBanner
58
-
59
- Displays the latest unread notification as a dismissible banner. No props.
60
-
61
- ---
62
-
63
- ## Busy Overlay
64
-
65
- ### BusyProvider / useBusy
66
-
67
- ```typescript
68
- type BusyVariant = "spinner" | "bar";
69
-
70
- interface BusyContextValue {
71
- variant: Accessor<BusyVariant>;
72
- show(message?: string): void;
73
- hide(): void;
74
- setProgress(percent: number | undefined): void;
75
- }
76
-
77
- interface BusyProviderProps {
78
- variant?: BusyVariant;
79
- }
80
- ```
81
-
82
- Full-screen loading overlay with nestable `show`/`hide` calls (managed with an internal counter). Each `show` must have a matching `hide`.
83
-
84
- - `variant="spinner"` -- centered spinner (default)
85
- - `variant="bar"` -- top progress bar animation
86
- - `setProgress(percent)` -- display a determinate progress bar (0--100, `undefined` for indeterminate)
87
-
88
- ### BusyContainer
89
-
90
- ```typescript
91
- interface BusyContainerProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "children"> {
92
- busy?: boolean;
93
- ready?: boolean;
94
- variant?: BusyVariant;
95
- message?: string;
96
- progressPercent?: number;
97
- children?: JSX.Element;
98
- }
99
- ```
100
-
101
- Local loading overlay for a specific container. Two modes:
102
- - `busy` -- shows overlay while preserving children
103
- - `ready={false}` -- hides children entirely until data is loaded
104
-
105
- ---
106
-
107
- ## Print System
108
-
109
- ### PrintProvider / usePrint
110
-
111
- ```typescript
112
- interface PrintContextValue {
113
- toPrinter(factory: () => JSX.Element, options?: PrintOptions): Promise<void>;
114
- toPdf(factory: () => JSX.Element, options?: PrintOptions): Promise<Uint8Array>;
115
- }
116
-
117
- interface PrintOptions {
118
- size?: string;
119
- margin?: string;
120
- }
121
- ```
122
-
123
- Print and PDF generation. `toPrinter` opens the browser print dialog. `toPdf` generates a PDF as a byte array.
124
-
125
- ### Print
126
-
127
- Component used inside the print factory to signal readiness via `usePrintInstance().ready()`.
128
-
129
- ---
130
-
131
- ## Usage Examples
132
-
133
- ```typescript
134
- import { useNotification, useBusy, BusyContainer } from "@simplysm/solid";
135
-
136
- // Notifications
137
- const notification = useNotification();
138
- notification.success("Saved", "Record updated successfully");
139
- notification.error(new Error("Connection failed"));
140
-
141
- // Notification with action button
142
- notification.info("Update available", "A new version is ready", {
143
- action: { label: "Refresh", onClick: () => location.reload() },
144
- });
145
-
146
- // Global loading
147
- const busy = useBusy();
148
- busy.show("Loading data...");
149
- try { await fetchData(); }
150
- finally { busy.hide(); }
151
-
152
- // Local loading container
153
- <BusyContainer busy={isLoading()} variant="spinner">
154
- <DataContent />
155
- </BusyContainer>
156
- ```
package/docs/helpers.md DELETED
@@ -1,173 +0,0 @@
1
- # Helpers
2
-
3
- ## mergeStyles
4
-
5
- ```typescript
6
- function mergeStyles(
7
- ...styles: (JSX.CSSProperties | string | undefined)[]
8
- ): JSX.CSSProperties;
9
- ```
10
-
11
- Merges multiple style objects or CSS strings into a single `JSX.CSSProperties` object. Handles `undefined` values gracefully.
12
-
13
- ---
14
-
15
- ## createAppStructure
16
-
17
- ```typescript
18
- function createAppStructure<TModule, const TItems extends AppStructureItem<TModule>[]>(
19
- getOpts: () => {
20
- items: TItems;
21
- usableModules?: Accessor<TModule[] | undefined>;
22
- permRecord?: Accessor<Record<string, boolean> | undefined>;
23
- },
24
- ): {
25
- AppStructureProvider: ParentComponent;
26
- useAppStructure(): AppStructure<TModule>;
27
- };
28
- ```
29
-
30
- Creates an application navigation/permission structure from a declarative item tree. Returns a provider and a hook.
31
-
32
- ### AppStructure types
33
-
34
- ```typescript
35
- interface AppStructureGroupItem<TModule> {
36
- code: string;
37
- title: string;
38
- icon?: Component<IconProps>;
39
- modules?: TModule[];
40
- requiredModules?: TModule[];
41
- children: AppStructureItem<TModule>[];
42
- }
43
-
44
- interface AppStructureLeafItem<TModule> {
45
- code: string;
46
- title: string;
47
- icon?: Component<IconProps>;
48
- modules?: TModule[];
49
- requiredModules?: TModule[];
50
- component?: Component;
51
- perms?: ("use" | "edit")[];
52
- subPerms?: AppStructureSubPerm<TModule>[];
53
- isNotMenu?: boolean;
54
- }
55
-
56
- interface AppMenu {
57
- title: string;
58
- href?: string;
59
- icon?: Component<IconProps>;
60
- children?: AppMenu[];
61
- }
62
-
63
- interface AppStructure<TModule> {
64
- items: AppStructureItem<TModule>[];
65
- usableRoutes: Accessor<AppRoute[]>;
66
- usableMenus: Accessor<AppMenu[]>;
67
- usableFlatMenus: Accessor<AppFlatMenu[]>;
68
- usablePerms: Accessor<AppPerm<TModule>[]>;
69
- allFlatPerms: AppFlatPerm<TModule>[];
70
- getTitleChainByHref(href: string): string[];
71
- }
72
- ```
73
-
74
- The structure automatically derives routes, menus, and permissions from the item tree, filtering by `usableModules` and `permRecord`.
75
-
76
- ---
77
-
78
- ## createSlot
79
-
80
- ```typescript
81
- function createSlot<TProps extends { children: JSX.Element }>():
82
- [Component<TProps>, () => [Accessor<TProps | undefined>, ParentComponent]];
83
- ```
84
-
85
- Creates a slot pattern for compound components. Returns a slot component and a hook to access the slot content.
86
-
87
- ---
88
-
89
- ## createSlots
90
-
91
- ```typescript
92
- interface SlotRegistrar<TItem> {
93
- add(item: TItem): void;
94
- remove(item: TItem): void;
95
- }
96
-
97
- function createSlots<TItem>():
98
- [Component, () => [Accessor<TItem[]>, ParentComponent]];
99
- ```
100
-
101
- Like `createSlot` but for multiple items. Items are collected from all rendered slot components.
102
-
103
- ---
104
-
105
- ## ripple (Directive)
106
-
107
- ```typescript
108
- function ripple(el: HTMLElement, accessor: Accessor<boolean>): void;
109
- ```
110
-
111
- SolidJS directive that adds a Material-style ripple effect on click.
112
-
113
- ```typescript
114
- import { ripple } from "@simplysm/solid";
115
-
116
- // Register the directive (required for TypeScript)
117
- void ripple;
118
-
119
- <div use:ripple={true}>Click me</div>
120
- ```
121
-
122
- ---
123
-
124
- ## Style Constants
125
-
126
- ### base.styles
127
-
128
- Background, border, and text color utilities mapped to the theme system:
129
-
130
- - `bg.surface`, `bg.muted`, `bg.subtle` -- background colors
131
- - `border.default`, `border.subtle` -- border colors
132
- - `text.default`, `text.muted`, `text.placeholder` -- text colors
133
-
134
- ### control.styles
135
-
136
- Component sizing and state utilities:
137
-
138
- - `pad.xs`, `pad.sm`, `pad.md`, `pad.lg`, `pad.xl` -- padding by size
139
- - `gap.xs` ... `gap.xl` -- gap by size
140
- - `state.disabled` -- disabled state styling
141
- - `ComponentSize` -- `"xs" | "sm" | "md" | "lg" | "xl"`
142
-
143
- ### theme.styles
144
-
145
- Semantic theme tokens:
146
-
147
- - `SemanticTheme` -- `"base" | "primary" | "info" | "success" | "warning" | "danger"`
148
- - `themeTokens` -- maps each theme to `{ solid, solidHover, light, text, hoverBg, border }` Tailwind class sets
149
-
150
- ---
151
-
152
- ## Usage Examples
153
-
154
- ```typescript
155
- import { createAppStructure, mergeStyles } from "@simplysm/solid";
156
-
157
- // App structure
158
- const { AppStructureProvider, useAppStructure } = createAppStructure(() => ({
159
- items: [
160
- { code: "home", title: "Home", component: HomePage },
161
- {
162
- code: "admin", title: "Admin", children: [
163
- { code: "users", title: "Users", component: UsersPage, perms: ["use", "edit"] },
164
- ],
165
- },
166
- ],
167
- usableModules: () => currentModules(),
168
- permRecord: () => userPerms(),
169
- }));
170
-
171
- // Merge styles
172
- const style = mergeStyles(props.style, { padding: "8px" }, "color: red");
173
- ```