@dalexto/lexsys-registry 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -3
- package/package.json +2 -2
- package/templates/blocks/AuthForm/AuthForm.tsx +9 -5
- package/templates/blocks/AuthForm/AuthForm.types.ts +3 -3
- package/templates/blocks/AuthForm/AuthForm.variants.ts +8 -2
- package/templates/blocks/CommandPalette/CommandPalette.tsx +15 -12
- package/templates/blocks/CommandPalette/CommandPalette.types.ts +2 -2
- package/templates/blocks/CommandPalette/CommandPalette.variants.ts +6 -6
- package/templates/blocks/DataTable/DataTable.tsx +2 -2
- package/templates/blocks/DataTable/DataTable.types.ts +2 -2
- package/templates/blocks/DataTable/DataTable.variants.ts +5 -4
- package/templates/blocks/FilterToolbar/FilterToolbar.tsx +12 -5
- package/templates/blocks/FilterToolbar/FilterToolbar.types.ts +4 -4
- package/templates/blocks/FilterToolbar/FilterToolbar.variants.ts +11 -5
- package/templates/blocks/FormField/FormField.tsx +1 -1
- package/templates/blocks/FormField/FormField.types.ts +1 -1
- package/templates/blocks/FormField/FormField.variants.ts +1 -1
- package/templates/blocks/PageHeader/PageHeader.tsx +2 -2
- package/templates/blocks/PageHeader/PageHeader.types.ts +2 -2
- package/templates/blocks/PageHeader/PageHeader.variants.ts +6 -5
- package/templates/blocks/SettingsPanel/SettingsPanel.tsx +1 -1
- package/templates/blocks/SettingsPanel/SettingsPanel.types.ts +1 -1
- package/templates/blocks/Sidebar/Sidebar.tsx +1048 -22
- package/templates/blocks/Sidebar/Sidebar.types.ts +185 -1
- package/templates/blocks/Sidebar/Sidebar.utils.ts +34 -0
- package/templates/blocks/Sidebar/Sidebar.variants.ts +445 -25
- package/templates/blocks/StatsCard/StatsCard.tsx +1 -1
- package/templates/blocks/StatsCard/StatsCard.types.ts +1 -1
- package/templates/blocks/StatsCard/StatsCard.variants.ts +7 -6
- package/templates/primitives/DatePicker/DatePicker.tsx +11 -1
- package/templates/primitives/DatePicker/DatePicker.types.ts +4 -1
- package/templates/primitives/DatePicker/DatePicker.variants.ts +11 -2
- package/templates/primitives/Toolbar/Toolbar.variants.ts +4 -2
- package/templates/styles/theme.css +14 -1
- package/templates/styles/tokens.css +147 -29
- package/templates/templates/DashboardShell/DashboardShell.variants.ts +19 -4
- package/templates/templates/SettingsPageLayout/SettingsPageLayout.tsx +2 -2
- package/templates/templates/SettingsPageLayout/SettingsPageLayout.types.ts +2 -2
- package/templates/templates/SettingsPageLayout/SettingsPageLayout.variants.ts +16 -7
|
@@ -12,12 +12,49 @@ import type {
|
|
|
12
12
|
ReactNode,
|
|
13
13
|
Ref,
|
|
14
14
|
} from "react"
|
|
15
|
-
import type {
|
|
15
|
+
import type { Collapsible as BaseCollapsible } from "@base-ui/react/collapsible"
|
|
16
|
+
import type { BadgeProps } from "@/components/primitives/Badge/Badge.types"
|
|
17
|
+
import type { ButtonProps } from "@/components/primitives/Button/Button.types"
|
|
18
|
+
import type {
|
|
19
|
+
CollapsiblePanelProps,
|
|
20
|
+
CollapsibleProps,
|
|
21
|
+
} from "@/components/primitives/Collapsible/Collapsible.types"
|
|
22
|
+
import type { InputProps } from "@/components/primitives/Input/Input.types"
|
|
23
|
+
import type { SeparatorProps } from "@/components/primitives/Separator/Separator.types"
|
|
24
|
+
|
|
25
|
+
export type SidebarCollapsible = "none" | "icon" | "offcanvas"
|
|
26
|
+
export type SidebarSide = "left" | "right"
|
|
27
|
+
|
|
28
|
+
export interface SidebarProviderProps {
|
|
29
|
+
children?: ReactNode
|
|
30
|
+
defaultOpen?: boolean
|
|
31
|
+
open?: boolean
|
|
32
|
+
onOpenChange?: (open: boolean) => void
|
|
33
|
+
defaultCollapsed?: boolean
|
|
34
|
+
collapsed?: boolean
|
|
35
|
+
onCollapsedChange?: (collapsed: boolean) => void
|
|
36
|
+
collapsible?: SidebarCollapsible
|
|
37
|
+
side?: SidebarSide
|
|
38
|
+
persistKey?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface SidebarContextValue {
|
|
42
|
+
open: boolean
|
|
43
|
+
setOpen: (open: boolean) => void
|
|
44
|
+
collapsed: boolean
|
|
45
|
+
setCollapsed: (collapsed: boolean) => void
|
|
46
|
+
toggleSidebar: () => void
|
|
47
|
+
isMobile: boolean
|
|
48
|
+
collapsible: SidebarCollapsible
|
|
49
|
+
side: SidebarSide
|
|
50
|
+
}
|
|
16
51
|
|
|
17
52
|
export interface SidebarProps extends HTMLAttributes<HTMLElement> {
|
|
18
53
|
ref?: Ref<HTMLElement>
|
|
19
54
|
className?: string
|
|
20
55
|
children?: ReactNode
|
|
56
|
+
collapsible?: SidebarCollapsible
|
|
57
|
+
side?: SidebarSide
|
|
21
58
|
}
|
|
22
59
|
|
|
23
60
|
export interface SidebarHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -56,6 +93,22 @@ export interface SidebarGroupContentProps extends HTMLAttributes<HTMLDivElement>
|
|
|
56
93
|
children?: ReactNode
|
|
57
94
|
}
|
|
58
95
|
|
|
96
|
+
export type SidebarGroupCollapsibleProps = Omit<CollapsibleProps, "variant">
|
|
97
|
+
|
|
98
|
+
export interface SidebarGroupCollapsibleTriggerProps extends Omit<
|
|
99
|
+
BaseCollapsible.Trigger.Props,
|
|
100
|
+
"className"
|
|
101
|
+
> {
|
|
102
|
+
ref?: Ref<HTMLButtonElement>
|
|
103
|
+
className?: string
|
|
104
|
+
children?: ReactNode
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface SidebarGroupCollapsiblePanelProps extends CollapsiblePanelProps {
|
|
108
|
+
ref?: Ref<HTMLDivElement>
|
|
109
|
+
className?: string
|
|
110
|
+
}
|
|
111
|
+
|
|
59
112
|
export interface SidebarListProps extends HTMLAttributes<HTMLUListElement> {
|
|
60
113
|
ref?: Ref<HTMLUListElement>
|
|
61
114
|
className?: string
|
|
@@ -66,11 +119,24 @@ export interface SidebarItemProps extends LiHTMLAttributes<HTMLLIElement> {
|
|
|
66
119
|
ref?: Ref<HTMLLIElement>
|
|
67
120
|
className?: string
|
|
68
121
|
children?: ReactNode
|
|
122
|
+
/** Disables row interaction; inherited by child nav item parts unless overridden. */
|
|
123
|
+
disabled?: boolean
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface SidebarNavActiveOptions {
|
|
127
|
+
/** When true, only an exact pathname match is active. Defaults to `true`. */
|
|
128
|
+
end?: boolean
|
|
69
129
|
}
|
|
70
130
|
|
|
71
131
|
export interface SidebarItemLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
72
132
|
ref?: Ref<HTMLAnchorElement>
|
|
73
133
|
active?: boolean
|
|
134
|
+
disabled?: boolean
|
|
135
|
+
/**
|
|
136
|
+
* Background chrome owner. `disclosureLead` defers hover/active fill to
|
|
137
|
+
* `SidebarItemRow variant="disclosure"`.
|
|
138
|
+
*/
|
|
139
|
+
chrome?: "default" | "disclosureLead"
|
|
74
140
|
className?: string
|
|
75
141
|
children?: ReactNode
|
|
76
142
|
}
|
|
@@ -78,17 +144,135 @@ export interface SidebarItemLinkProps extends AnchorHTMLAttributes<HTMLAnchorEle
|
|
|
78
144
|
export interface SidebarItemButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
79
145
|
ref?: Ref<HTMLButtonElement>
|
|
80
146
|
active?: boolean
|
|
147
|
+
disabled?: boolean
|
|
81
148
|
className?: string
|
|
82
149
|
children?: ReactNode
|
|
83
150
|
}
|
|
84
151
|
|
|
152
|
+
export type SidebarInputProps = InputProps
|
|
153
|
+
|
|
154
|
+
export type SidebarSeparatorProps = SeparatorProps
|
|
155
|
+
|
|
156
|
+
export interface SidebarItemSkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
157
|
+
ref?: Ref<HTMLDivElement>
|
|
158
|
+
className?: string
|
|
159
|
+
/** Renders an icon-sized pulse block. Defaults to `true`. */
|
|
160
|
+
showIcon?: boolean
|
|
161
|
+
/** Indented skeleton for nested `SidebarSubList` rows. */
|
|
162
|
+
indent?: boolean
|
|
163
|
+
}
|
|
164
|
+
|
|
85
165
|
export interface SidebarTriggerProps extends Omit<ButtonProps, "type"> {
|
|
86
166
|
ref?: Ref<HTMLButtonElement>
|
|
87
167
|
children?: ReactNode
|
|
88
168
|
}
|
|
89
169
|
|
|
170
|
+
export interface SidebarCollapseTriggerProps extends Omit<ButtonProps, "type"> {
|
|
171
|
+
ref?: Ref<HTMLButtonElement>
|
|
172
|
+
children?: ReactNode
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface SidebarRailProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
176
|
+
ref?: Ref<HTMLButtonElement>
|
|
177
|
+
className?: string
|
|
178
|
+
}
|
|
179
|
+
|
|
90
180
|
export interface SidebarMobileHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
|
91
181
|
ref?: Ref<HTMLDivElement>
|
|
92
182
|
className?: string
|
|
93
183
|
children?: ReactNode
|
|
94
184
|
}
|
|
185
|
+
|
|
186
|
+
export interface SidebarExpandableProps extends HTMLAttributes<HTMLSpanElement> {
|
|
187
|
+
ref?: Ref<HTMLSpanElement>
|
|
188
|
+
className?: string
|
|
189
|
+
children?: ReactNode
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface SidebarItemBadgeProps extends BadgeProps {
|
|
193
|
+
/**
|
|
194
|
+
* Force dot indicator instead of the count badge.
|
|
195
|
+
* Defaults to dot when the sidebar is icon-collapsed on desktop.
|
|
196
|
+
*/
|
|
197
|
+
dot?: boolean
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface SidebarItemRowProps extends HTMLAttributes<HTMLDivElement> {
|
|
201
|
+
ref?: Ref<HTMLDivElement>
|
|
202
|
+
/** `disclosure` paints one shared row shell for link lead + expand trigger. */
|
|
203
|
+
variant?: "default" | "disclosure"
|
|
204
|
+
className?: string
|
|
205
|
+
children?: ReactNode
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface SidebarItemTrailingProps extends HTMLAttributes<HTMLDivElement> {
|
|
209
|
+
ref?: Ref<HTMLDivElement>
|
|
210
|
+
className?: string
|
|
211
|
+
children?: ReactNode
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** @deprecated Place `SidebarItemTrailing` inside `SidebarItemLink` / `SidebarItemButton`. */
|
|
215
|
+
export type SidebarItemAdornmentsProps = SidebarItemTrailingProps
|
|
216
|
+
|
|
217
|
+
export interface SidebarItemExpandTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
218
|
+
ref?: Ref<HTMLButtonElement>
|
|
219
|
+
/** `disclosure` suppresses per-cell hover fill — row shell owns chrome. */
|
|
220
|
+
variant?: "default" | "disclosure"
|
|
221
|
+
className?: string
|
|
222
|
+
open?: boolean
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface SidebarItemIconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
226
|
+
ref?: Ref<HTMLSpanElement>
|
|
227
|
+
className?: string
|
|
228
|
+
children?: ReactNode
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface SidebarItemActionProps extends Omit<
|
|
232
|
+
ButtonProps,
|
|
233
|
+
"type" | "variant" | "size"
|
|
234
|
+
> {
|
|
235
|
+
ref?: Ref<HTMLButtonElement>
|
|
236
|
+
showOnHover?: boolean
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export interface SidebarItemShortcutProps extends HTMLAttributes<HTMLElement> {
|
|
240
|
+
ref?: Ref<HTMLElement>
|
|
241
|
+
className?: string
|
|
242
|
+
children?: ReactNode
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface SidebarGroupActionProps extends Omit<
|
|
246
|
+
ButtonProps,
|
|
247
|
+
"type" | "variant" | "size"
|
|
248
|
+
> {
|
|
249
|
+
ref?: Ref<HTMLButtonElement>
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface SidebarSubListProps extends HTMLAttributes<HTMLUListElement> {
|
|
253
|
+
ref?: Ref<HTMLUListElement>
|
|
254
|
+
className?: string
|
|
255
|
+
children?: ReactNode
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface SidebarSubItemLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
259
|
+
ref?: Ref<HTMLAnchorElement>
|
|
260
|
+
active?: boolean
|
|
261
|
+
disabled?: boolean
|
|
262
|
+
className?: string
|
|
263
|
+
children?: ReactNode
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export interface SidebarSubItemButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
267
|
+
ref?: Ref<HTMLButtonElement>
|
|
268
|
+
active?: boolean
|
|
269
|
+
disabled?: boolean
|
|
270
|
+
className?: string
|
|
271
|
+
children?: ReactNode
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface SidebarShellOptions {
|
|
275
|
+
collapsed?: boolean
|
|
276
|
+
collapsible?: SidebarCollapsible
|
|
277
|
+
side?: SidebarSide
|
|
278
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SidebarNavActiveOptions } from "./Sidebar.types.js"
|
|
2
|
+
|
|
3
|
+
const stripSidebarNavPath = (value: string): string => {
|
|
4
|
+
const withoutQuery = value.split(/[?#]/u)[0] ?? value
|
|
5
|
+
const withLeadingSlash = withoutQuery.startsWith("/")
|
|
6
|
+
? withoutQuery
|
|
7
|
+
: `/${withoutQuery}`
|
|
8
|
+
|
|
9
|
+
if (withLeadingSlash.length > 1 && withLeadingSlash.endsWith("/")) {
|
|
10
|
+
return withLeadingSlash.slice(0, -1)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return withLeadingSlash
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Router-agnostic matcher for Sidebar `active` props.
|
|
18
|
+
* Mirrors React Router `NavLink` `end` semantics without a router dependency.
|
|
19
|
+
*/
|
|
20
|
+
export const isSidebarNavActive = (
|
|
21
|
+
pathname: string,
|
|
22
|
+
href: string,
|
|
23
|
+
options: SidebarNavActiveOptions = {},
|
|
24
|
+
): boolean => {
|
|
25
|
+
const path = stripSidebarNavPath(pathname)
|
|
26
|
+
const target = stripSidebarNavPath(href)
|
|
27
|
+
const end = options.end ?? true
|
|
28
|
+
|
|
29
|
+
if (end) {
|
|
30
|
+
return path === target
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return path === target || path.startsWith(`${target}/`)
|
|
34
|
+
}
|