@gridui/preferences 1.0.0 → 1.0.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/README.md +2 -2
- package/dist/index.js +9 -9
- package/dist/index.js.map +2 -2
- package/dist/preferences-controls/style.d.ts +0 -1
- package/dist/styles.css +28 -45
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Layout family. Public API: `PreferenceLabels`, `PreferenceLanguage`, `Preference
|
|
|
5
5
|
Import components from `@gridui/preferences` and load `@gridui/preferences/styles.css` after Theme.
|
|
6
6
|
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
7
|
|
|
8
|
-
See [component ownership](
|
|
8
|
+
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-layout/preferences/.changeset/history).
|
|
9
9
|
|
|
10
10
|
## Preferences
|
|
11
11
|
|
|
@@ -17,7 +17,7 @@ keyboard focus opens immediately, pointer hover uses the shared delay, and Escap
|
|
|
17
17
|
dismisses the hint. A hint stays closed while its corresponding menu is open.
|
|
18
18
|
Language links retain native navigation; inline theme buttons expose pressed state.
|
|
19
19
|
|
|
20
|
-
Local [FieldGrid and SearchForm arrangements](
|
|
20
|
+
Local [FieldGrid and SearchForm arrangements](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md)
|
|
21
21
|
belong to `@gridui/form`. Layout uses those public APIs when a larger composition
|
|
22
22
|
coordinates form state with data or page regions.
|
|
23
23
|
|
package/dist/index.js
CHANGED
|
@@ -68,24 +68,23 @@ import { cn } from "@gridui/style-utils";
|
|
|
68
68
|
import { cva } from "class-variance-authority";
|
|
69
69
|
var preferencesStyles = cva(cn(
|
|
70
70
|
"gridui-preferences",
|
|
71
|
-
"flex flex-wrap gap-gridui-8"
|
|
71
|
+
"gridui-u-flex gridui-u-flex-wrap gridui-u-gap-gridui-8"
|
|
72
72
|
));
|
|
73
73
|
var preferencesInlineStyles = cva(cn(
|
|
74
74
|
"gridui-preferences-inline",
|
|
75
|
-
"grid gap-gridui-24"
|
|
75
|
+
"gridui-u-grid gridui-u-gap-gridui-24"
|
|
76
76
|
));
|
|
77
77
|
var preferencesLabelStyles = cva(cn(
|
|
78
78
|
"gridui-preferences-label",
|
|
79
|
-
"m-0 text-muted type-caption"
|
|
79
|
+
"gridui-u-m-0 gridui-u-text-muted gridui-u-type-caption"
|
|
80
80
|
));
|
|
81
81
|
var preferencesOptionsStyles = cva(cn(
|
|
82
82
|
"gridui-preferences-options",
|
|
83
|
-
"flex flex-wrap gap-gridui-4 p-gridui-4 border border-solid border-border rounded-control",
|
|
84
|
-
"[&_>_a]:inline-flex [&_>_a]:min-h-9 [&_>_a]:items-center [&_>_a]:gap-gridui-4 [&_>_a]:py-gridui-4 [&_>_a]:px-gridui-8 [&_>_a]:rounded-control [&_>_a]:text-foreground [&_>_a]:no-underline [&_>_a]:type-ui",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
83
|
+
"gridui-u-flex gridui-u-flex-wrap gridui-u-gap-gridui-4 gridui-u-p-gridui-4 gridui-u-border gridui-u-border-solid gridui-u-border-border gridui-u-rounded-control",
|
|
84
|
+
"gridui-u-[&_>_a]:inline-flex gridui-u-[&_>_a]:min-h-9 gridui-u-[&_>_a]:items-center gridui-u-[&_>_a]:gap-gridui-4 gridui-u-[&_>_a]:py-gridui-4 gridui-u-[&_>_a]:px-gridui-8 gridui-u-[&_>_a]:rounded-control gridui-u-[&_>_a]:text-foreground gridui-u-[&_>_a]:no-underline gridui-u-[&_>_a]:type-ui",
|
|
85
|
+
"gridui-u-*:aria-[current=page]:text-foreground gridui-u-*:aria-[current=page]:bg-brand-tint",
|
|
86
|
+
"gridui-u-*:aria-pressed:text-foreground gridui-u-*:aria-pressed:bg-brand-tint"
|
|
87
87
|
));
|
|
88
|
-
var preferenceIndicatorStyles = cva("gridui-dropdown-indicator w-4 shrink-0 text-foreground");
|
|
89
88
|
|
|
90
89
|
// src/preferences-controls/dropdown.tsx
|
|
91
90
|
import { DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem } from "@gridui/dropdown-menu";
|
|
@@ -269,6 +268,7 @@ var InlinePreferences = (props) => {
|
|
|
269
268
|
};
|
|
270
269
|
|
|
271
270
|
// src/preferences-controls/preferences-controls.tsx
|
|
271
|
+
import { dropdownIndicatorStyles } from "@gridui/dropdown-menu";
|
|
272
272
|
import { Check } from "lucide-react";
|
|
273
273
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
274
274
|
var PreferencesControls = (props) => {
|
|
@@ -286,7 +286,7 @@ var PreferencesControls = (props) => {
|
|
|
286
286
|
/* @__PURE__ */ jsx4(
|
|
287
287
|
"span",
|
|
288
288
|
{
|
|
289
|
-
className:
|
|
289
|
+
className: dropdownIndicatorStyles(),
|
|
290
290
|
"aria-hidden": "true",
|
|
291
291
|
children: language.current ? /* @__PURE__ */ jsx4(
|
|
292
292
|
Check,
|
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 \"flex flex-wrap gap-gridui-8\",\n));\n\nexport const preferencesInlineStyles = cva(cn(\n \"gridui-preferences-inline\",\n \"grid gap-gridui-24\",\n));\n\nexport const preferencesLabelStyles = cva(cn(\n \"gridui-preferences-label\",\n \"m-0 text-muted type-caption\",\n));\n\nexport const preferencesOptionsStyles = cva(cn(\n \"gridui-preferences-options\",\n \"flex flex-wrap gap-gridui-4 p-gridui-4 border border-solid border-border rounded-control\",\n \"[&_>_a]:inline-flex [&_>_a]:min-h-9 [&_>_a]:items-center [&_>_a]:gap-gridui-4 [&_>_a]:py-gridui-4 [&_>_a]:px-gridui-8 [&_>_a]:rounded-control [&_>_a]:text-foreground [&_>_a]:no-underline [&_>_a]:type-ui\",\n \"*:aria-[current=page]:text-foreground *:aria-[current=page]:bg-brand-tint\",\n \"*:aria-pressed:text-foreground *:aria-pressed:bg-brand-tint\",\n));\n\nexport const preferenceIndicatorStyles = cva(\"gridui-dropdown-indicator w-4 shrink-0 text-foreground\");\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 { PreferencesOptions } 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, ReactElement } from \"react\";\n\nexport type DropdownPreferencesProps = PreferencesOptions & {\n readonly languageLinks: readonly ReactElement[];\n};\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 { PreferencesOptions } from \"./types\";\nimport { Button } from \"@gridui/button\";\nimport { cn } from \"@gridui/style-utils\";\nimport { THEME } from \"@gridui/theme/theme\";\nimport type { FC, ReactElement } from \"react\";\n\nexport type InlinePreferencesProps = PreferencesOptions & {\n readonly languageLinks: readonly ReactElement[];\n};\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 { preferenceIndicatorStyles } from \"./style\";\nimport type { PreferencesOptions } from \"./types\";\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={preferenceIndicatorStyles()}\n aria-hidden=\"true\"\n >\n {language.current ? (<Check\n size={16}\n />) : null}\n </span>\n {language.label}\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,qBAAqB,2BAA2B;AACvE,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAkC,gBAAgB;AA2B1C,SAQY,KARZ;AAnBD,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM,EAAE,OAAO,MAAM,SAAS,IAAI;AAClC,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,KAAK;AAClB,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,KAAK;AAClB,SAAQ;AAAA,IAAC;AAAA;AAAA,MACL,MAAM;AAAA,MACN,cAAc,CAAC,SAAS;AACpB,oBAAY,IAAI;AAChB,YAAI,MAAM;AACN,sBAAY,KAAK;AAAA,QACrB;AAAA,MACJ;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACG,MAAM,YAAY,CAAC;AAAA,YACnB,cAAc;AAAA,YAEd;AAAA,kCAAC,kBACG;AAAA,gBAAC;AAAA;AAAA,kBACG,SAAO;AAAA,kBAEP;AAAA,oBAAC;AAAA;AAAA,sBACG,SAAQ;AAAA,sBACR,MAAK;AAAA,sBACL,QAAO;AAAA,sBACP,cAAY;AAAA,sBAEX;AAAA;AAAA,kBACL;AAAA;AAAA,cACJ,GACJ;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACG,OAAM;AAAA,kBAEL;AAAA;AAAA,cACL;AAAA;AAAA;AAAA,QACJ;AAAA,QACA,oBAAC,uBACI,UACL;AAAA;AAAA;AAAA,EACJ;AACJ;;;AC1DA,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,oBAAoB,IAAI;AAAA,EACjC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,0BAA0B,IAAI;AAAA,EACvC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,yBAAyB,IAAI;AAAA,EACtC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,2BAA2B,IAAI;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,CAAC
|
|
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-flex gridui-u-flex-wrap gridui-u-gap-gridui-8\",\n));\n\nexport const preferencesInlineStyles = cva(cn(\n \"gridui-preferences-inline\",\n \"gridui-u-grid gridui-u-gap-gridui-24\",\n));\n\nexport const preferencesLabelStyles = cva(cn(\n \"gridui-preferences-label\",\n \"gridui-u-m-0 gridui-u-text-muted gridui-u-type-caption\",\n));\n\nexport const preferencesOptionsStyles = cva(cn(\n \"gridui-preferences-options\",\n \"gridui-u-flex gridui-u-flex-wrap gridui-u-gap-gridui-4 gridui-u-p-gridui-4 gridui-u-border gridui-u-border-solid gridui-u-border-border gridui-u-rounded-control\",\n \"gridui-u-[&_>_a]:inline-flex gridui-u-[&_>_a]:min-h-9 gridui-u-[&_>_a]:items-center gridui-u-[&_>_a]:gap-gridui-4 gridui-u-[&_>_a]:py-gridui-4 gridui-u-[&_>_a]:px-gridui-8 gridui-u-[&_>_a]:rounded-control gridui-u-[&_>_a]:text-foreground gridui-u-[&_>_a]:no-underline gridui-u-[&_>_a]:type-ui\",\n \"gridui-u-*:aria-[current=page]:text-foreground gridui-u-*:aria-[current=page]:bg-brand-tint\",\n \"gridui-u-*:aria-pressed:text-foreground gridui-u-*: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 { PreferencesOptions } 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, ReactElement } from \"react\";\n\nexport type DropdownPreferencesProps = PreferencesOptions & {\n readonly languageLinks: readonly ReactElement[];\n};\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 { PreferencesOptions } from \"./types\";\nimport { Button } from \"@gridui/button\";\nimport { cn } from \"@gridui/style-utils\";\nimport { THEME } from \"@gridui/theme/theme\";\nimport type { FC, ReactElement } from \"react\";\n\nexport type InlinePreferencesProps = PreferencesOptions & {\n readonly languageLinks: readonly ReactElement[];\n};\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 { dropdownIndicatorStyles } from \"@gridui/dropdown-menu\";\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={dropdownIndicatorStyles()}\n aria-hidden=\"true\"\n >\n {language.current ? (<Check\n size={16}\n />) : null}\n </span>\n {language.label}\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,qBAAqB,2BAA2B;AACvE,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAkC,gBAAgB;AA2B1C,SAQY,KARZ;AAnBD,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM,EAAE,OAAO,MAAM,SAAS,IAAI;AAClC,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,KAAK;AAClB,QAAM;AAAA,IACF;AAAA,IACA;AAAA,EACJ,IAAI,SAAS,KAAK;AAClB,SAAQ;AAAA,IAAC;AAAA;AAAA,MACL,MAAM;AAAA,MACN,cAAc,CAAC,SAAS;AACpB,oBAAY,IAAI;AAChB,YAAI,MAAM;AACN,sBAAY,KAAK;AAAA,QACrB;AAAA,MACJ;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACG,MAAM,YAAY,CAAC;AAAA,YACnB,cAAc;AAAA,YAEd;AAAA,kCAAC,kBACG;AAAA,gBAAC;AAAA;AAAA,kBACG,SAAO;AAAA,kBAEP;AAAA,oBAAC;AAAA;AAAA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D,CAAC,UAAoC;AAClG,QAAM,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,gBAAc,SAAS,UAAU,SAAS;AAAA,QAC1C,SAAS,SAAS;AAAA,QAElB;AAAA,0BAAAD;AAAA,YAAC;AAAA;AAAA,cACG,WAAW,wBAAwB;AAAA,cACnC,eAAY;AAAA,cAEX,mBAAS,UAAW,gBAAAA;AAAA,gBAAC;AAAA;AAAA,kBAClB,MAAM;AAAA;AAAA,cACV,IAAM;AAAA;AAAA,UACV;AAAA,UACC,SAAS;AAAA;AAAA;AAAA,MAfL,SAAS;AAAA,IAgBlB;AAAA,EACJ,CAAC;AAED,MAAI,iBAAiB,UAAU;AAC3B,WAAQ,gBAAAA;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
6
|
"names": ["cn", "jsx", "jsxs", "Button", "cn", "THEME", "jsx", "jsxs", "jsx", "jsxs"]
|
|
7
7
|
}
|
|
@@ -8,4 +8,3 @@ export declare const preferencesStyles: (props?: import("class-variance-authorit
|
|
|
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
10
|
export declare const preferencesOptionsStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
11
|
-
export declare const preferenceIndicatorStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
package/dist/styles.css
CHANGED
|
@@ -7,112 +7,95 @@
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
@layer utilities {
|
|
10
|
-
.m-0 {
|
|
10
|
+
.gridui-u-m-0 {
|
|
11
11
|
margin: 0px;
|
|
12
12
|
}
|
|
13
|
-
.flex {
|
|
13
|
+
.gridui-u-flex {
|
|
14
14
|
display: flex;
|
|
15
15
|
}
|
|
16
|
-
.grid {
|
|
16
|
+
.gridui-u-grid {
|
|
17
17
|
display: grid;
|
|
18
18
|
}
|
|
19
|
-
.
|
|
20
|
-
display: inline;
|
|
21
|
-
}
|
|
22
|
-
.w-4 {
|
|
23
|
-
width: calc(var(--spacing) * 4);
|
|
24
|
-
}
|
|
25
|
-
.shrink-0 {
|
|
26
|
-
flex-shrink: 0;
|
|
27
|
-
}
|
|
28
|
-
.flex-wrap {
|
|
19
|
+
.gridui-u-flex-wrap {
|
|
29
20
|
flex-wrap: wrap;
|
|
30
21
|
}
|
|
31
|
-
.gap-gridui-4 {
|
|
22
|
+
.gridui-u-gap-gridui-4 {
|
|
32
23
|
gap: var(--gridui-space-4);
|
|
33
24
|
}
|
|
34
|
-
.gap-gridui-8 {
|
|
25
|
+
.gridui-u-gap-gridui-8 {
|
|
35
26
|
gap: var(--gridui-space-8);
|
|
36
27
|
}
|
|
37
|
-
.gap-gridui-24 {
|
|
28
|
+
.gridui-u-gap-gridui-24 {
|
|
38
29
|
gap: var(--gridui-space-24);
|
|
39
30
|
}
|
|
40
|
-
.rounded-control {
|
|
31
|
+
.gridui-u-rounded-control {
|
|
41
32
|
border-radius: var(--gridui-control-radius);
|
|
42
33
|
}
|
|
43
|
-
.border {
|
|
34
|
+
.gridui-u-border {
|
|
44
35
|
border-style: var(--tw-border-style);
|
|
45
36
|
border-width: 1px;
|
|
46
37
|
}
|
|
47
|
-
.border-solid {
|
|
38
|
+
.gridui-u-border-solid {
|
|
48
39
|
--tw-border-style: solid;
|
|
49
40
|
border-style: solid;
|
|
50
41
|
}
|
|
51
|
-
.border-border {
|
|
42
|
+
.gridui-u-border-border {
|
|
52
43
|
border-color: var(--gridui-border);
|
|
53
44
|
}
|
|
54
|
-
.p-gridui-4 {
|
|
45
|
+
.gridui-u-p-gridui-4 {
|
|
55
46
|
padding: var(--gridui-space-4);
|
|
56
47
|
}
|
|
57
|
-
.type-caption {
|
|
48
|
+
.gridui-u-type-caption {
|
|
58
49
|
font: var(--gridui-type-caption);
|
|
59
50
|
letter-spacing: normal;
|
|
60
51
|
}
|
|
61
|
-
.text-
|
|
62
|
-
color: var(--gridui-foreground);
|
|
63
|
-
}
|
|
64
|
-
.text-muted {
|
|
52
|
+
.gridui-u-text-muted {
|
|
65
53
|
color: var(--gridui-muted);
|
|
66
54
|
}
|
|
67
|
-
:is(
|
|
55
|
+
:is(.gridui-u-\*\:aria-pressed\:bg-brand-tint > *)[aria-pressed="true"] {
|
|
68
56
|
background-color: var(--gridui-brand-tint);
|
|
69
57
|
}
|
|
70
|
-
:is(
|
|
58
|
+
:is(.gridui-u-\*\:aria-pressed\:text-foreground > *)[aria-pressed="true"] {
|
|
71
59
|
color: var(--gridui-foreground);
|
|
72
60
|
}
|
|
73
|
-
:is(
|
|
61
|
+
:is(.gridui-u-\*\:aria-\[current\=page\]\:bg-brand-tint > *)[aria-current="page"] {
|
|
74
62
|
background-color: var(--gridui-brand-tint);
|
|
75
63
|
}
|
|
76
|
-
:is(
|
|
64
|
+
:is(.gridui-u-\*\:aria-\[current\=page\]\:text-foreground > *)[aria-current="page"] {
|
|
77
65
|
color: var(--gridui-foreground);
|
|
78
66
|
}
|
|
79
|
-
|
|
67
|
+
.gridui-u-\[\&_\>_a\]\:inline-flex > a {
|
|
80
68
|
display: inline-flex;
|
|
81
69
|
}
|
|
82
|
-
|
|
70
|
+
.gridui-u-\[\&_\>_a\]\:min-h-9 > a {
|
|
83
71
|
min-height: calc(var(--spacing) * 9);
|
|
84
72
|
}
|
|
85
|
-
|
|
73
|
+
.gridui-u-\[\&_\>_a\]\:items-center > a {
|
|
86
74
|
align-items: center;
|
|
87
75
|
}
|
|
88
|
-
|
|
76
|
+
.gridui-u-\[\&_\>_a\]\:gap-gridui-4 > a {
|
|
89
77
|
gap: var(--gridui-space-4);
|
|
90
78
|
}
|
|
91
|
-
|
|
79
|
+
.gridui-u-\[\&_\>_a\]\:rounded-control > a {
|
|
92
80
|
border-radius: var(--gridui-control-radius);
|
|
93
81
|
}
|
|
94
|
-
|
|
82
|
+
.gridui-u-\[\&_\>_a\]\:px-gridui-8 > a {
|
|
95
83
|
padding-inline: var(--gridui-space-8);
|
|
96
84
|
}
|
|
97
|
-
|
|
85
|
+
.gridui-u-\[\&_\>_a\]\:py-gridui-4 > a {
|
|
98
86
|
padding-block: var(--gridui-space-4);
|
|
99
87
|
}
|
|
100
|
-
|
|
88
|
+
.gridui-u-\[\&_\>_a\]\:type-ui > a {
|
|
101
89
|
font: var(--gridui-type-ui);
|
|
102
90
|
letter-spacing: normal;
|
|
103
91
|
}
|
|
104
|
-
|
|
92
|
+
.gridui-u-\[\&_\>_a\]\:text-foreground > a {
|
|
105
93
|
color: var(--gridui-foreground);
|
|
106
94
|
}
|
|
107
|
-
|
|
95
|
+
.gridui-u-\[\&_\>_a\]\:no-underline > a {
|
|
108
96
|
text-decoration-line: none;
|
|
109
97
|
}
|
|
110
98
|
}
|
|
111
|
-
@layer components {
|
|
112
|
-
.gridui-preference-hint {
|
|
113
|
-
transition: opacity var(--gridui-motion-duration-quick) var(--gridui-motion-ease-out), visibility 0s;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
99
|
@property --tw-border-style {
|
|
117
100
|
syntax: "*";
|
|
118
101
|
inherits: false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/preferences",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "GridUI React preferences",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -26,19 +26,20 @@
|
|
|
26
26
|
"react-dom": "^19.2.0"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@gridui/button": "^2.
|
|
30
|
-
"@gridui/dropdown-menu": "^1.
|
|
31
|
-
"@gridui/style-utils": "^2.1.
|
|
32
|
-
"@gridui/theme": "^2.
|
|
33
|
-
"@gridui/tooltip": "^1.0.
|
|
29
|
+
"@gridui/button": "^2.2.0",
|
|
30
|
+
"@gridui/dropdown-menu": "^1.1.2",
|
|
31
|
+
"@gridui/style-utils": "^2.1.4",
|
|
32
|
+
"@gridui/theme": "^2.3.2",
|
|
33
|
+
"@gridui/tooltip": "^1.0.3",
|
|
34
34
|
"class-variance-authority": "0.7.1",
|
|
35
|
-
"lucide-react": "1.
|
|
35
|
+
"lucide-react": "1.65.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@gridui-internal/configuration": "0.0.0",
|
|
38
|
+
"@gridui-internal/configuration": "0.0.0-internal",
|
|
39
39
|
"@jest/globals": "30.5.2",
|
|
40
|
+
"@storybook/react-vite": "10.6.5",
|
|
40
41
|
"@types/jest": "30.0.0",
|
|
41
|
-
"@types/node": "26.6.
|
|
42
|
+
"@types/node": "26.6.6",
|
|
42
43
|
"@types/react": "19.3.0",
|
|
43
44
|
"@types/react-dom": "19.3.0",
|
|
44
45
|
"jest": "30.5.2",
|