@gridui/preferences 1.0.10 → 1.2.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/README.md +10 -0
- package/dist/index.js +45 -13
- package/dist/index.js.map +3 -3
- package/dist/preferences-controls/language.d.ts +1 -0
- package/dist/preferences-controls/menu.d.ts +2 -1
- package/dist/preferences-controls/style.d.ts +3 -1
- package/dist/preferences-controls/types.d.ts +3 -0
- package/dist/styles.css +6 -4
- package/docs/catalog.json +1 -1
- package/docs/reference/preferences-controls.md +6 -0
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -29,9 +29,19 @@ keyboard focus opens immediately, pointer hover uses the shared delay, and Escap
|
|
|
29
29
|
dismisses the hint. A hint stays closed while its corresponding menu is open.
|
|
30
30
|
Language links retain native navigation; inline theme buttons expose pressed state.
|
|
31
31
|
|
|
32
|
+
`selectionAppearance="filled"` (default) gives both current-language links and
|
|
33
|
+
selected theme options a background and check. Set `selectionAppearance="indicator"`
|
|
34
|
+
to keep the checks without selected backgrounds. The same option controls both
|
|
35
|
+
language and theme choices in dropdown and inline presentations. Every option
|
|
36
|
+
reserves a trailing check slot so changing selection does not shift its label.
|
|
37
|
+
|
|
32
38
|
Local [FieldGrid and SearchForm arrangements](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md)
|
|
33
39
|
belong to `@gridui/form`. Layout uses those public APIs when a larger composition
|
|
34
40
|
coordinates form state with data or page regions.
|
|
35
41
|
|
|
36
42
|
|
|
37
43
|
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
|
44
|
+
|
|
45
|
+
Language links use each item's `locale` as native `lang` and `hrefLang`. Optional
|
|
46
|
+
`dir` accepts `ltr`, `rtl`, or `auto` (default). Labels remain caller-provided;
|
|
47
|
+
GridUI does not translate or infer font assets from a locale.
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@gridui/tooltip";
|
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
var PreferenceMenu = (props) => {
|
|
8
|
-
const { label, icon, children } = props;
|
|
8
|
+
const { label, icon, children, selectionAppearance } = props;
|
|
9
9
|
const [
|
|
10
10
|
menuOpen,
|
|
11
11
|
setMenuOpen
|
|
@@ -57,7 +57,13 @@ var PreferenceMenu = (props) => {
|
|
|
57
57
|
]
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
|
-
/* @__PURE__ */ jsx(
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
DropdownMenuContent,
|
|
62
|
+
{
|
|
63
|
+
selectionAppearance,
|
|
64
|
+
children
|
|
65
|
+
}
|
|
66
|
+
)
|
|
61
67
|
]
|
|
62
68
|
}
|
|
63
69
|
);
|
|
@@ -83,9 +89,18 @@ var preferencesOptionsStyles = cva(cn(
|
|
|
83
89
|
"gridui-u-preferences--flex gridui-u-preferences--flex-wrap gridui-u-preferences--items-stretch gridui-u-preferences--gap-px gridui-u-preferences--border gridui-u-preferences--border-solid gridui-u-preferences--border-border gridui-u-preferences--rounded-control gridui-u-preferences--bg-border",
|
|
84
90
|
"gridui-u-preferences--*:flex-[1_1_auto] gridui-u-preferences--*:min-w-0 gridui-u-preferences--*:max-w-full gridui-u-preferences--*:rounded-none gridui-u-preferences--*:border-0 gridui-u-preferences--*:bg-background gridui-u-preferences--*:whitespace-normal gridui-u-preferences--*:wrap-anywhere",
|
|
85
91
|
"gridui-u-preferences--[&_>_a]:inline-flex gridui-u-preferences--[&_>_a]:min-h-gridui-control-small gridui-u-preferences--[&_>_a]:items-center gridui-u-preferences--[&_>_a]:justify-center gridui-u-preferences--[&_>_a]:gap-gridui-4 gridui-u-preferences--[&_>_a]:py-gridui-4 gridui-u-preferences--[&_>_a]:px-gridui-8 gridui-u-preferences--[&_>_a]:text-foreground gridui-u-preferences--[&_>_a]:no-underline gridui-u-preferences--[&_>_a]:type-ui",
|
|
86
|
-
"gridui-u-preferences--*:aria-[current=page]:text-foreground gridui-u-preferences--*:aria-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
"gridui-u-preferences--*:aria-[current=page]:text-foreground gridui-u-preferences--*:aria-pressed:text-foreground"
|
|
93
|
+
), {
|
|
94
|
+
variants: {
|
|
95
|
+
selectionAppearance: {
|
|
96
|
+
filled: "gridui-u-preferences--*:aria-[current=page]:bg-selection-background gridui-u-preferences--*:aria-pressed:bg-selection-background",
|
|
97
|
+
indicator: ""
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
defaultVariants: {
|
|
101
|
+
selectionAppearance: "filled"
|
|
102
|
+
}
|
|
103
|
+
});
|
|
89
104
|
|
|
90
105
|
// src/preferences-controls/dropdown.tsx
|
|
91
106
|
import { DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem } from "@gridui/dropdown-menu";
|
|
@@ -96,7 +111,7 @@ import { TooltipProvider } from "@gridui/tooltip";
|
|
|
96
111
|
import { Globe, Laptop, Moon, Sun } from "lucide-react";
|
|
97
112
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
98
113
|
var DropdownPreferences = (props) => {
|
|
99
|
-
const { labels, theme, onThemeChange, languageLinks } = props;
|
|
114
|
+
const { labels, theme, onThemeChange, languageLinks, selectionAppearance } = props;
|
|
100
115
|
const themeIcons = {
|
|
101
116
|
system: Laptop,
|
|
102
117
|
dark: Moon,
|
|
@@ -111,6 +126,7 @@ var DropdownPreferences = (props) => {
|
|
|
111
126
|
/* @__PURE__ */ jsxs2(
|
|
112
127
|
PreferenceMenu,
|
|
113
128
|
{
|
|
129
|
+
selectionAppearance,
|
|
114
130
|
label: labels.language,
|
|
115
131
|
icon: /* @__PURE__ */ jsx2(
|
|
116
132
|
Globe,
|
|
@@ -136,6 +152,7 @@ var DropdownPreferences = (props) => {
|
|
|
136
152
|
/* @__PURE__ */ jsxs2(
|
|
137
153
|
PreferenceMenu,
|
|
138
154
|
{
|
|
155
|
+
selectionAppearance,
|
|
139
156
|
label: labels.appearance,
|
|
140
157
|
icon: /* @__PURE__ */ jsx2(
|
|
141
158
|
ThemeIcon,
|
|
@@ -189,11 +206,13 @@ var DropdownPreferences = (props) => {
|
|
|
189
206
|
|
|
190
207
|
// src/preferences-controls/inline.tsx
|
|
191
208
|
import { Button as Button2 } from "@gridui/button";
|
|
209
|
+
import { overlayListIndicatorStyles } from "@gridui/overlay";
|
|
192
210
|
import { cn as cn3 } from "@gridui/style-utils";
|
|
193
211
|
import { THEME as THEME2 } from "@gridui/theme/theme";
|
|
212
|
+
import { Check } from "lucide-react";
|
|
194
213
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
195
214
|
var InlinePreferences = (props) => {
|
|
196
|
-
const { labels, theme, onThemeChange, languageLinks } = props;
|
|
215
|
+
const { labels, theme, onThemeChange, languageLinks, selectionAppearance } = props;
|
|
197
216
|
return /* @__PURE__ */ jsxs3(
|
|
198
217
|
"div",
|
|
199
218
|
{
|
|
@@ -215,7 +234,7 @@ var InlinePreferences = (props) => {
|
|
|
215
234
|
/* @__PURE__ */ jsx3(
|
|
216
235
|
"div",
|
|
217
236
|
{
|
|
218
|
-
className: cn3(preferencesOptionsStyles()),
|
|
237
|
+
className: cn3(preferencesOptionsStyles({ selectionAppearance })),
|
|
219
238
|
children: languageLinks
|
|
220
239
|
}
|
|
221
240
|
)
|
|
@@ -238,7 +257,7 @@ var InlinePreferences = (props) => {
|
|
|
238
257
|
/* @__PURE__ */ jsx3(
|
|
239
258
|
"div",
|
|
240
259
|
{
|
|
241
|
-
className: cn3(preferencesOptionsStyles()),
|
|
260
|
+
className: cn3(preferencesOptionsStyles({ selectionAppearance })),
|
|
242
261
|
children: [
|
|
243
262
|
THEME2.SYSTEM,
|
|
244
263
|
THEME2.LIGHT,
|
|
@@ -250,6 +269,18 @@ var InlinePreferences = (props) => {
|
|
|
250
269
|
size: "small",
|
|
251
270
|
variant: "quiet",
|
|
252
271
|
"aria-pressed": theme === value,
|
|
272
|
+
endIcon: /* @__PURE__ */ jsx3(
|
|
273
|
+
"span",
|
|
274
|
+
{
|
|
275
|
+
className: overlayListIndicatorStyles(),
|
|
276
|
+
children: theme === value ? /* @__PURE__ */ jsx3(
|
|
277
|
+
Check,
|
|
278
|
+
{
|
|
279
|
+
size: 16
|
|
280
|
+
}
|
|
281
|
+
) : null
|
|
282
|
+
}
|
|
283
|
+
),
|
|
253
284
|
onClick: () => {
|
|
254
285
|
return void onThemeChange(value);
|
|
255
286
|
},
|
|
@@ -269,8 +300,8 @@ var InlinePreferences = (props) => {
|
|
|
269
300
|
};
|
|
270
301
|
|
|
271
302
|
// src/preferences-controls/preferences-controls.tsx
|
|
272
|
-
import { overlayListIndicatorStyles } from "@gridui/overlay";
|
|
273
|
-
import { Check } from "lucide-react";
|
|
303
|
+
import { overlayListIndicatorStyles as overlayListIndicatorStyles2 } from "@gridui/overlay";
|
|
304
|
+
import { Check as Check2 } from "lucide-react";
|
|
274
305
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
275
306
|
var PreferencesControls = (props) => {
|
|
276
307
|
const { presentation = "dropdown", languages, ...options } = props;
|
|
@@ -281,6 +312,7 @@ var PreferencesControls = (props) => {
|
|
|
281
312
|
href: language.href,
|
|
282
313
|
hrefLang: language.locale,
|
|
283
314
|
lang: language.locale,
|
|
315
|
+
dir: language.dir ?? "auto",
|
|
284
316
|
"aria-current": language.current ? "page" : void 0,
|
|
285
317
|
onClick: language.onSelect,
|
|
286
318
|
children: [
|
|
@@ -294,10 +326,10 @@ var PreferencesControls = (props) => {
|
|
|
294
326
|
/* @__PURE__ */ jsx4(
|
|
295
327
|
"span",
|
|
296
328
|
{
|
|
297
|
-
className:
|
|
329
|
+
className: overlayListIndicatorStyles2(),
|
|
298
330
|
"aria-hidden": "true",
|
|
299
331
|
children: language.current ? /* @__PURE__ */ jsx4(
|
|
300
|
-
|
|
332
|
+
Check2,
|
|
301
333
|
{
|
|
302
334
|
size: 16
|
|
303
335
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/preferences-controls/menu.tsx", "../src/preferences-controls/style.ts", "../src/preferences-controls/dropdown.tsx", "../src/preferences-controls/inline.tsx", "../src/preferences-controls/preferences-controls.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Menu\n */\n\nimport { Button } from \"@gridui/button\";\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from \"@gridui/dropdown-menu\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"@gridui/tooltip\";\nimport { type FC, type ReactNode, useState } from \"react\";\n\nexport type PreferenceMenuProps = {\n readonly label: string;\n readonly icon: ReactNode;\n readonly children: ReactNode;\n};\n\nexport const PreferenceMenu: FC<PreferenceMenuProps> = (props: PreferenceMenuProps) => {\n const { label, icon, children } = props;\n const [\n menuOpen,\n setMenuOpen,\n ] = useState(false);\n const [\n hintOpen,\n setHintOpen,\n ] = useState(false);\n return (<DropdownMenu\n open={menuOpen}\n onOpenChange={(open) => {\n setMenuOpen(open);\n if (open) {\n setHintOpen(false);\n }\n }}\n >\n <Tooltip\n open={hintOpen && !menuOpen}\n onOpenChange={setHintOpen}\n >\n <TooltipTrigger>\n <DropdownMenuTrigger\n asChild\n >\n <Button\n variant=\"quiet\"\n size=\"small\"\n layout=\"icon\"\n aria-label={label}\n >\n {icon}\n </Button>\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent\n align=\"end\"\n >\n {label}\n </TooltipContent>\n </Tooltip>\n <DropdownMenuContent>\n {children}\n </DropdownMenuContent>\n </DropdownMenu>);\n};\n", "/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const preferencesStyles = cva(cn(\n \"gridui-preferences\",\n \"gridui-u-preferences--flex gridui-u-preferences--flex-wrap gridui-u-preferences--gap-gridui-8\",\n));\n\nexport const preferencesInlineStyles = cva(cn(\n \"gridui-preferences-inline\",\n \"gridui-u-preferences--grid gridui-u-preferences--gap-gridui-24\",\n));\n\nexport const preferencesLabelStyles = cva(cn(\n \"gridui-preferences-label\",\n \"gridui-u-preferences--m-0 gridui-u-preferences--text-muted gridui-u-preferences--type-caption\",\n));\n\nexport const preferencesOptionsStyles = cva(cn(\n \"gridui-preferences-options\",\n \"gridui-u-preferences--flex gridui-u-preferences--flex-wrap gridui-u-preferences--items-stretch gridui-u-preferences--gap-px gridui-u-preferences--border gridui-u-preferences--border-solid gridui-u-preferences--border-border gridui-u-preferences--rounded-control gridui-u-preferences--bg-border\",\n \"gridui-u-preferences--*:flex-[1_1_auto] gridui-u-preferences--*:min-w-0 gridui-u-preferences--*:max-w-full gridui-u-preferences--*:rounded-none gridui-u-preferences--*:border-0 gridui-u-preferences--*:bg-background gridui-u-preferences--*:whitespace-normal gridui-u-preferences--*:wrap-anywhere\",\n \"gridui-u-preferences--[&_>_a]:inline-flex gridui-u-preferences--[&_>_a]:min-h-gridui-control-small gridui-u-preferences--[&_>_a]:items-center gridui-u-preferences--[&_>_a]:justify-center gridui-u-preferences--[&_>_a]:gap-gridui-4 gridui-u-preferences--[&_>_a]:py-gridui-4 gridui-u-preferences--[&_>_a]:px-gridui-8 gridui-u-preferences--[&_>_a]:text-foreground gridui-u-preferences--[&_>_a]:no-underline gridui-u-preferences--[&_>_a]:type-ui\",\n \"gridui-u-preferences--*:aria-[current=page]:text-foreground gridui-u-preferences--*:aria-[current=page]:bg-brand-tint\",\n \"gridui-u-preferences--*:aria-pressed:text-foreground gridui-u-preferences--*:aria-pressed:bg-brand-tint\",\n));\n", "/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Dropdown\n */\n\nimport { PreferenceMenu } from \"./menu\";\nimport { preferencesStyles } from \"./style\";\nimport type { PreferencesViewOptions } from \"./types\";\nimport { DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem } from \"@gridui/dropdown-menu\";\nimport { cn } from \"@gridui/style-utils\";\nimport { isTheme } from \"@gridui/theme/preference\";\nimport { THEME } from \"@gridui/theme/theme\";\nimport { TooltipProvider } from \"@gridui/tooltip\";\nimport { Globe, Laptop, Moon, Sun } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type DropdownPreferencesProps = PreferencesViewOptions;\n\nexport const DropdownPreferences: FC<DropdownPreferencesProps> = (props: DropdownPreferencesProps) => {\n const { labels, theme, onThemeChange, languageLinks } = props;\n const themeIcons = {\n system: Laptop,\n dark: Moon,\n light: Sun,\n };\n const ThemeIcon = themeIcons[theme];\n return (<TooltipProvider>\n <div\n className={cn(preferencesStyles())}\n >\n <PreferenceMenu\n label={labels.language}\n icon={(<Globe\n aria-hidden=\"true\"\n />)}\n >\n <DropdownMenuLabel>\n {labels.language}\n </DropdownMenuLabel>\n {languageLinks.map((link) => {\n return (<DropdownMenuItem\n key={link.key}\n asChild\n >\n {link}\n </DropdownMenuItem>);\n })}\n </PreferenceMenu>\n <PreferenceMenu\n label={labels.appearance}\n icon={(<ThemeIcon\n aria-hidden=\"true\"\n />)}\n >\n <DropdownMenuLabel>\n {labels.appearance}\n </DropdownMenuLabel>\n <DropdownMenuRadioGroup\n value={theme}\n onValueChange={(value) => {\n if (isTheme(value)) {\n onThemeChange(value);\n }\n }}\n >\n <DropdownMenuRadioItem\n value={THEME.SYSTEM}\n >\n {labels.system}\n </DropdownMenuRadioItem>\n <DropdownMenuRadioItem\n value={THEME.LIGHT}\n >\n {labels.light}\n </DropdownMenuRadioItem>\n <DropdownMenuRadioItem\n value={THEME.DARK}\n >\n {labels.dark}\n </DropdownMenuRadioItem>\n </DropdownMenuRadioGroup>\n </PreferenceMenu>\n </div>\n </TooltipProvider>);\n};\n", "/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Inline\n */\n\nimport { preferencesInlineStyles, preferencesLabelStyles, preferencesOptionsStyles } from \"./style\";\nimport type { PreferencesViewOptions } from \"./types\";\nimport { Button } from \"@gridui/button\";\nimport { cn } from \"@gridui/style-utils\";\nimport { THEME } from \"@gridui/theme/theme\";\nimport type { FC } from \"react\";\n\nexport type InlinePreferencesProps = PreferencesViewOptions;\n\nexport const InlinePreferences: FC<InlinePreferencesProps> = (props: InlinePreferencesProps) => {\n const { labels, theme, onThemeChange, languageLinks } = props;\n return (<div\n className={cn(preferencesInlineStyles())}\n >\n <div\n role=\"group\"\n aria-label={labels.language}\n >\n <p\n className={cn(preferencesLabelStyles())}\n >\n {labels.language}\n </p>\n <div\n className={cn(preferencesOptionsStyles())}\n >\n {languageLinks}\n </div>\n </div>\n <div\n role=\"group\"\n aria-label={labels.appearance}\n >\n <p\n className={cn(preferencesLabelStyles())}\n >\n {labels.appearance}\n </p>\n <div\n className={cn(preferencesOptionsStyles())}\n >\n {([\n THEME.SYSTEM,\n THEME.LIGHT,\n THEME.DARK,\n ] as const).map((value) => {\n return (<Button\n key={value}\n size=\"small\"\n variant=\"quiet\"\n aria-pressed={theme === value}\n onClick={() => {\n return void onThemeChange(value);\n }}\n >\n {labels[value]}\n </Button>);\n })}\n </div>\n </div>\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Preferences Controls\n */\n\nimport { DropdownPreferences } from \"./dropdown\";\nimport { InlinePreferences } from \"./inline\";\nimport type { PreferenceLanguage } from \"./language\";\nimport type { PreferencesOptions } from \"./types\";\nimport { overlayListIndicatorStyles } from \"@gridui/overlay\";\nimport { Check } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type PreferencesControlsProps = PreferencesOptions & {\n readonly presentation?: \"dropdown\" | \"inline\";\n readonly languages: readonly PreferenceLanguage[];\n};\n\nexport const PreferencesControls: FC<PreferencesControlsProps> = (props: PreferencesControlsProps) => {\n const { presentation = \"dropdown\", languages, ...options } = props;\n const languageLinks = languages.map((language) => {\n return (<a\n key={language.locale}\n href={language.href}\n hrefLang={language.locale}\n lang={language.locale}\n aria-current={language.current ? \"page\" : undefined}\n onClick={language.onSelect}\n >\n <span\n className=\"gridui-u-preferences--min-w-0 gridui-u-preferences--flex-1\"\n >\n {language.label}\n </span>\n <span\n className={overlayListIndicatorStyles()}\n aria-hidden=\"true\"\n >\n {language.current ? (<Check\n size={16}\n />) : null}\n </span>\n </a>);\n });\n\n if (presentation === \"inline\") {\n return (<InlinePreferences\n {...options}\n languageLinks={languageLinks}\n />);\n }\n return (<DropdownPreferences\n {...options}\n languageLinks={languageLinks}\n />);\n};\n"],
|
|
5
|
-
"mappings": ";AAOA,SAAS,cAAc;AACvB,SAAS,cAAc,
|
|
6
|
-
"names": ["cn", "jsx", "jsxs", "Button", "cn", "THEME", "jsx", "jsxs", "jsx", "jsxs"]
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Menu\n */\n\nimport { Button } from \"@gridui/button\";\nimport { DropdownMenu, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuTrigger } from \"@gridui/dropdown-menu\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"@gridui/tooltip\";\nimport { type FC, type ReactNode, useState } from \"react\";\n\nexport type PreferenceMenuProps = Pick<DropdownMenuContentProps, \"selectionAppearance\"> & {\n readonly label: string;\n readonly icon: ReactNode;\n readonly children: ReactNode;\n};\n\nexport const PreferenceMenu: FC<PreferenceMenuProps> = (props: PreferenceMenuProps) => {\n const { label, icon, children, selectionAppearance } = props;\n const [\n menuOpen,\n setMenuOpen,\n ] = useState(false);\n const [\n hintOpen,\n setHintOpen,\n ] = useState(false);\n return (<DropdownMenu\n open={menuOpen}\n onOpenChange={(open) => {\n setMenuOpen(open);\n if (open) {\n setHintOpen(false);\n }\n }}\n >\n <Tooltip\n open={hintOpen && !menuOpen}\n onOpenChange={setHintOpen}\n >\n <TooltipTrigger>\n <DropdownMenuTrigger\n asChild\n >\n <Button\n variant=\"quiet\"\n size=\"small\"\n layout=\"icon\"\n aria-label={label}\n >\n {icon}\n </Button>\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent\n align=\"end\"\n >\n {label}\n </TooltipContent>\n </Tooltip>\n <DropdownMenuContent\n selectionAppearance={selectionAppearance}\n >\n {children}\n </DropdownMenuContent>\n </DropdownMenu>);\n};\n", "/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const preferencesStyles = cva(cn(\n \"gridui-preferences\",\n \"gridui-u-preferences--flex gridui-u-preferences--flex-wrap gridui-u-preferences--gap-gridui-8\",\n));\n\nexport const preferencesInlineStyles = cva(cn(\n \"gridui-preferences-inline\",\n \"gridui-u-preferences--grid gridui-u-preferences--gap-gridui-24\",\n));\n\nexport const preferencesLabelStyles = cva(cn(\n \"gridui-preferences-label\",\n \"gridui-u-preferences--m-0 gridui-u-preferences--text-muted gridui-u-preferences--type-caption\",\n));\n\nexport const preferencesOptionsStyles = cva(cn(\n \"gridui-preferences-options\",\n \"gridui-u-preferences--flex gridui-u-preferences--flex-wrap gridui-u-preferences--items-stretch gridui-u-preferences--gap-px gridui-u-preferences--border gridui-u-preferences--border-solid gridui-u-preferences--border-border gridui-u-preferences--rounded-control gridui-u-preferences--bg-border\",\n \"gridui-u-preferences--*:flex-[1_1_auto] gridui-u-preferences--*:min-w-0 gridui-u-preferences--*:max-w-full gridui-u-preferences--*:rounded-none gridui-u-preferences--*:border-0 gridui-u-preferences--*:bg-background gridui-u-preferences--*:whitespace-normal gridui-u-preferences--*:wrap-anywhere\",\n \"gridui-u-preferences--[&_>_a]:inline-flex gridui-u-preferences--[&_>_a]:min-h-gridui-control-small gridui-u-preferences--[&_>_a]:items-center gridui-u-preferences--[&_>_a]:justify-center gridui-u-preferences--[&_>_a]:gap-gridui-4 gridui-u-preferences--[&_>_a]:py-gridui-4 gridui-u-preferences--[&_>_a]:px-gridui-8 gridui-u-preferences--[&_>_a]:text-foreground gridui-u-preferences--[&_>_a]:no-underline gridui-u-preferences--[&_>_a]:type-ui\",\n \"gridui-u-preferences--*:aria-[current=page]:text-foreground gridui-u-preferences--*:aria-pressed:text-foreground\",\n), {\n variants: {\n selectionAppearance: {\n filled: \"gridui-u-preferences--*:aria-[current=page]:bg-selection-background gridui-u-preferences--*:aria-pressed:bg-selection-background\",\n indicator: \"\",\n },\n },\n defaultVariants: {\n selectionAppearance: \"filled\",\n },\n});\n", "/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Dropdown\n */\n\nimport { PreferenceMenu } from \"./menu\";\nimport { preferencesStyles } from \"./style\";\nimport type { PreferencesViewOptions } from \"./types\";\nimport { DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem } from \"@gridui/dropdown-menu\";\nimport { cn } from \"@gridui/style-utils\";\nimport { isTheme } from \"@gridui/theme/preference\";\nimport { THEME } from \"@gridui/theme/theme\";\nimport { TooltipProvider } from \"@gridui/tooltip\";\nimport { Globe, Laptop, Moon, Sun } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type DropdownPreferencesProps = PreferencesViewOptions;\n\nexport const DropdownPreferences: FC<DropdownPreferencesProps> = (props: DropdownPreferencesProps) => {\n const { labels, theme, onThemeChange, languageLinks, selectionAppearance } = props;\n const themeIcons = {\n system: Laptop,\n dark: Moon,\n light: Sun,\n };\n const ThemeIcon = themeIcons[theme];\n return (<TooltipProvider>\n <div\n className={cn(preferencesStyles())}\n >\n <PreferenceMenu\n selectionAppearance={selectionAppearance}\n label={labels.language}\n icon={(<Globe\n aria-hidden=\"true\"\n />)}\n >\n <DropdownMenuLabel>\n {labels.language}\n </DropdownMenuLabel>\n {languageLinks.map((link) => {\n return (<DropdownMenuItem\n key={link.key}\n asChild\n >\n {link}\n </DropdownMenuItem>);\n })}\n </PreferenceMenu>\n <PreferenceMenu\n selectionAppearance={selectionAppearance}\n label={labels.appearance}\n icon={(<ThemeIcon\n aria-hidden=\"true\"\n />)}\n >\n <DropdownMenuLabel>\n {labels.appearance}\n </DropdownMenuLabel>\n <DropdownMenuRadioGroup\n value={theme}\n onValueChange={(value) => {\n if (isTheme(value)) {\n onThemeChange(value);\n }\n }}\n >\n <DropdownMenuRadioItem\n value={THEME.SYSTEM}\n >\n {labels.system}\n </DropdownMenuRadioItem>\n <DropdownMenuRadioItem\n value={THEME.LIGHT}\n >\n {labels.light}\n </DropdownMenuRadioItem>\n <DropdownMenuRadioItem\n value={THEME.DARK}\n >\n {labels.dark}\n </DropdownMenuRadioItem>\n </DropdownMenuRadioGroup>\n </PreferenceMenu>\n </div>\n </TooltipProvider>);\n};\n", "/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Inline\n */\n\nimport { preferencesInlineStyles, preferencesLabelStyles, preferencesOptionsStyles } from \"./style\";\nimport type { PreferencesViewOptions } from \"./types\";\nimport { Button } from \"@gridui/button\";\nimport { overlayListIndicatorStyles } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport { THEME } from \"@gridui/theme/theme\";\nimport { Check } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type InlinePreferencesProps = PreferencesViewOptions;\n\nexport const InlinePreferences: FC<InlinePreferencesProps> = (props: InlinePreferencesProps) => {\n const { labels, theme, onThemeChange, languageLinks, selectionAppearance } = props;\n return (<div\n className={cn(preferencesInlineStyles())}\n >\n <div\n role=\"group\"\n aria-label={labels.language}\n >\n <p\n className={cn(preferencesLabelStyles())}\n >\n {labels.language}\n </p>\n <div\n className={cn(preferencesOptionsStyles({ selectionAppearance }))}\n >\n {languageLinks}\n </div>\n </div>\n <div\n role=\"group\"\n aria-label={labels.appearance}\n >\n <p\n className={cn(preferencesLabelStyles())}\n >\n {labels.appearance}\n </p>\n <div\n className={cn(preferencesOptionsStyles({ selectionAppearance }))}\n >\n {([\n THEME.SYSTEM,\n THEME.LIGHT,\n THEME.DARK,\n ] as const).map((value) => {\n return (<Button\n key={value}\n size=\"small\"\n variant=\"quiet\"\n aria-pressed={theme === value}\n endIcon={(<span\n className={overlayListIndicatorStyles()}\n >\n {theme === value ? (<Check\n size={16}\n />) : null}\n </span>)}\n onClick={() => {\n return void onThemeChange(value);\n }}\n >\n {labels[value]}\n </Button>);\n })}\n </div>\n </div>\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package Preferences\n * @namespace PreferencesControls\n * @description Preferences Controls\n */\n\nimport { DropdownPreferences } from \"./dropdown\";\nimport { InlinePreferences } from \"./inline\";\nimport type { PreferenceLanguage } from \"./language\";\nimport type { PreferencesOptions } from \"./types\";\nimport { overlayListIndicatorStyles } from \"@gridui/overlay\";\nimport { Check } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type PreferencesControlsProps = PreferencesOptions & {\n readonly presentation?: \"dropdown\" | \"inline\";\n readonly languages: readonly PreferenceLanguage[];\n};\n\nexport const PreferencesControls: FC<PreferencesControlsProps> = (props: PreferencesControlsProps) => {\n const { presentation = \"dropdown\", languages, ...options } = props;\n const languageLinks = languages.map((language) => {\n return (<a\n key={language.locale}\n href={language.href}\n hrefLang={language.locale}\n lang={language.locale}\n dir={language.dir ?? \"auto\"}\n aria-current={language.current ? \"page\" : undefined}\n onClick={language.onSelect}\n >\n <span\n className=\"gridui-u-preferences--min-w-0 gridui-u-preferences--flex-1\"\n >\n {language.label}\n </span>\n <span\n className={overlayListIndicatorStyles()}\n aria-hidden=\"true\"\n >\n {language.current ? (<Check\n size={16}\n />) : null}\n </span>\n </a>);\n });\n\n if (presentation === \"inline\") {\n return (<InlinePreferences\n {...options}\n languageLinks={languageLinks}\n />);\n }\n return (<DropdownPreferences\n {...options}\n languageLinks={languageLinks}\n />);\n};\n"],
|
|
5
|
+
"mappings": ";AAOA,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EAAE,eAAe,YAAY,WAAW,GAAG,QAAQ,IAAI;AAC7D,QAAM,gBAAgB,UAAU,IAAI,CAAC,aAAa;AAC9C,WAAQ,gBAAAA;AAAA,MAAC;AAAA;AAAA,QAEL,MAAM,SAAS;AAAA,QACf,UAAU,SAAS;AAAA,QACnB,MAAM,SAAS;AAAA,QACf,KAAK,SAAS,OAAO;AAAA,QACrB,gBAAc,SAAS,UAAU,SAAS;AAAA,QAC1C,SAAS,SAAS;AAAA,QAElB;AAAA,0BAAAD;AAAA,YAAC;AAAA;AAAA,cACG,WAAU;AAAA,cAET,mBAAS;AAAA;AAAA,UACd;AAAA,UACA,gBAAAA;AAAA,YAAC;AAAA;AAAA,cACG,WAAWF,4BAA2B;AAAA,cACtC,eAAY;AAAA,cAEX,mBAAS,UAAW,gBAAAE;AAAA,gBAACD;AAAA,gBAAA;AAAA,kBAClB,MAAM;AAAA;AAAA,cACV,IAAM;AAAA;AAAA,UACV;AAAA;AAAA;AAAA,MApBK,SAAS;AAAA,IAqBlB;AAAA,EACJ,CAAC;AAED,MAAI,iBAAiB,UAAU;AAC3B,WAAQ,gBAAAC;AAAA,MAAC;AAAA;AAAA,QACJ,GAAG;AAAA,QACJ;AAAA;AAAA,IACJ;AAAA,EACJ;AACA,SAAQ,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ;AAAA;AAAA,EACJ;AACJ;",
|
|
6
|
+
"names": ["cn", "jsx", "jsxs", "Button", "cn", "THEME", "jsx", "jsxs", "overlayListIndicatorStyles", "Check", "jsx", "jsxs"]
|
|
7
7
|
}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* @namespace PreferencesControls
|
|
5
5
|
* @description Menu
|
|
6
6
|
*/
|
|
7
|
+
import { type DropdownMenuContentProps } from "@gridui/dropdown-menu";
|
|
7
8
|
import { type FC, type ReactNode } from "react";
|
|
8
|
-
export type PreferenceMenuProps = {
|
|
9
|
+
export type PreferenceMenuProps = Pick<DropdownMenuContentProps, "selectionAppearance"> & {
|
|
9
10
|
readonly label: string;
|
|
10
11
|
readonly icon: ReactNode;
|
|
11
12
|
readonly children: ReactNode;
|
|
@@ -7,4 +7,6 @@
|
|
|
7
7
|
export declare const preferencesStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
8
8
|
export declare const preferencesInlineStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
9
|
export declare const preferencesLabelStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
10
|
-
export declare const preferencesOptionsStyles: (props?:
|
|
10
|
+
export declare const preferencesOptionsStyles: (props?: ({
|
|
11
|
+
selectionAppearance?: "filled" | "indicator" | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @namespace PreferencesControls
|
|
5
5
|
* @description Types
|
|
6
6
|
*/
|
|
7
|
+
import type { DropdownMenuContentProps } from "@gridui/dropdown-menu";
|
|
7
8
|
import type { THEME } from "@gridui/theme/theme";
|
|
8
9
|
import type { ReactElement } from "react";
|
|
9
10
|
export type PreferenceLabels = {
|
|
@@ -14,6 +15,8 @@ export type PreferenceLabels = {
|
|
|
14
15
|
readonly dark: string;
|
|
15
16
|
};
|
|
16
17
|
export type PreferencesOptions = {
|
|
18
|
+
/** Selection presentation for language and theme options in both dropdown and inline layouts. */
|
|
19
|
+
readonly selectionAppearance?: DropdownMenuContentProps["selectionAppearance"];
|
|
17
20
|
readonly labels: PreferenceLabels;
|
|
18
21
|
readonly theme: THEME;
|
|
19
22
|
readonly onThemeChange: (value: THEME) => void;
|
package/dist/styles.css
CHANGED
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
.gridui-u-preferences--type-caption {
|
|
53
53
|
font: var(--gridui-type-caption);
|
|
54
|
+
font-family: var(--gridui-font-body);
|
|
54
55
|
letter-spacing: normal;
|
|
55
56
|
}
|
|
56
57
|
.gridui-u-preferences--text-muted {
|
|
@@ -81,14 +82,14 @@
|
|
|
81
82
|
:is(.gridui-u-preferences--\*\:whitespace-normal > *) {
|
|
82
83
|
white-space: normal;
|
|
83
84
|
}
|
|
84
|
-
:is(.gridui-u-preferences--\*\:aria-pressed\:bg-
|
|
85
|
-
background-color: var(--gridui-
|
|
85
|
+
:is(.gridui-u-preferences--\*\:aria-pressed\:bg-selection-background > *)[aria-pressed="true"] {
|
|
86
|
+
background-color: var(--gridui-selection-background);
|
|
86
87
|
}
|
|
87
88
|
:is(.gridui-u-preferences--\*\:aria-pressed\:text-foreground > *)[aria-pressed="true"] {
|
|
88
89
|
color: var(--gridui-foreground);
|
|
89
90
|
}
|
|
90
|
-
:is(.gridui-u-preferences--\*\:aria-\[current\=page\]\:bg-
|
|
91
|
-
background-color: var(--gridui-
|
|
91
|
+
:is(.gridui-u-preferences--\*\:aria-\[current\=page\]\:bg-selection-background > *)[aria-current="page"] {
|
|
92
|
+
background-color: var(--gridui-selection-background);
|
|
92
93
|
}
|
|
93
94
|
:is(.gridui-u-preferences--\*\:aria-\[current\=page\]\:text-foreground > *)[aria-current="page"] {
|
|
94
95
|
color: var(--gridui-foreground);
|
|
@@ -116,6 +117,7 @@
|
|
|
116
117
|
}
|
|
117
118
|
.gridui-u-preferences--\[\&_\>_a\]\:type-ui > a {
|
|
118
119
|
font: var(--gridui-type-ui);
|
|
120
|
+
font-family: var(--gridui-font-body);
|
|
119
121
|
letter-spacing: normal;
|
|
120
122
|
}
|
|
121
123
|
.gridui-u-preferences--\[\&_\>_a\]\:text-foreground > a {
|
package/docs/catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/preferences",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"category": "core",
|
|
6
6
|
"description": "GridUI React preferences",
|
|
7
7
|
"usage": "Overlay supplies the selection indicator used by both presentations. The dropdown presentation also composes DropdownMenu and Tooltip. Applications own routes, labels, state persistence, and branding.",
|
|
@@ -19,6 +19,12 @@ The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/
|
|
|
19
19
|
|
|
20
20
|
The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
|
|
21
21
|
|
|
22
|
+
### selectionAppearance
|
|
23
|
+
|
|
24
|
+
``SelectionAppearance | undefined`` · Optional
|
|
25
|
+
|
|
26
|
+
Selection presentation for language and theme options in both dropdown and inline layouts.
|
|
27
|
+
|
|
22
28
|
### labels
|
|
23
29
|
|
|
24
30
|
``PreferenceLabels`` · Required
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/preferences",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "GridUI React preferences",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -27,19 +27,19 @@
|
|
|
27
27
|
"react-dom": "^19.2.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@gridui/button": "^5.
|
|
31
|
-
"@gridui/dropdown-menu": "^
|
|
32
|
-
"@gridui/overlay": "^2.
|
|
30
|
+
"@gridui/button": "^5.1.0",
|
|
31
|
+
"@gridui/dropdown-menu": "^3.0.0",
|
|
32
|
+
"@gridui/overlay": "^2.3.0",
|
|
33
33
|
"@gridui/style-utils": "^4.0.0",
|
|
34
|
-
"@gridui/theme": "^
|
|
35
|
-
"@gridui/tooltip": "^1.0
|
|
34
|
+
"@gridui/theme": "^3.0.0",
|
|
35
|
+
"@gridui/tooltip": "^1.1.0",
|
|
36
36
|
"class-variance-authority": "0.7.1",
|
|
37
|
-
"lucide-react": "1.
|
|
37
|
+
"lucide-react": "1.72.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
41
41
|
"@jest/globals": "30.5.2",
|
|
42
|
-
"@storybook/react-vite": "10.6.
|
|
42
|
+
"@storybook/react-vite": "10.6.7",
|
|
43
43
|
"@types/jest": "30.0.0",
|
|
44
44
|
"@types/node": "26.6.6",
|
|
45
45
|
"@types/react": "19.3.0",
|