@gridui/preferences 0.0.0-stage → 0.0.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 CHANGED
@@ -1,3 +1,23 @@
1
- # Temporary Holding Version
1
+ # @gridui/preferences
2
+
3
+ Layout family. Public API: `PreferenceLabels`, `PreferenceLanguage`, `PreferencesControls`, `PreferencesControlsProps`.
4
+
5
+ Import components from `@gridui/preferences` and load `@gridui/preferences/styles.css` after Theme.
6
+ Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
7
+
8
+ See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
9
+
10
+ ## Preferences
11
+
12
+ `PreferencesControls` is available from `@gridui/preferences` with dropdown
13
+ or inline presentations. Applications supply language links, localized labels,
14
+ the current theme, and its change callback. Dropdown icon buttons keep their
15
+ accessible names and use the shared `@gridui/tooltip` Tooltip for supplemental hints:
16
+ keyboard focus opens immediately, pointer hover uses the shared delay, and Escape
17
+ dismisses the hint. A hint stays closed while its corresponding menu is open.
18
+ Language links retain native navigation; inline theme buttons expose pressed state.
19
+
20
+ Local [FieldGrid and SearchForm arrangements](../../docs/component-ownership.md)
21
+ belong to `@gridui/form`. Layout uses those public APIs when a larger composition
22
+ coordinates form state with data or page regions.
2
23
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Preferences
4
+ * @namespace Root
5
+ * @description Index
6
+ */
7
+ export type { PreferenceLanguage } from "./preferences-controls/language";
8
+ export type { PreferencesControlsProps } from "./preferences-controls/preferences-controls";
9
+ export { PreferencesControls } from "./preferences-controls/preferences-controls";
10
+ export type { PreferenceLabels } from "./preferences-controls/types";
package/dist/index.js ADDED
@@ -0,0 +1,325 @@
1
+ // src/preferences-controls/menu.tsx
2
+ import { Button } from "@gridui/button";
3
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "@gridui/dropdown-menu";
4
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@gridui/tooltip";
5
+ import { useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ var PreferenceMenu = (props) => {
8
+ const { label, icon, children } = props;
9
+ const [
10
+ menuOpen,
11
+ setMenuOpen
12
+ ] = useState(false);
13
+ const [
14
+ hintOpen,
15
+ setHintOpen
16
+ ] = useState(false);
17
+ return /* @__PURE__ */ jsxs(
18
+ DropdownMenu,
19
+ {
20
+ open: menuOpen,
21
+ onOpenChange: (open) => {
22
+ setMenuOpen(open);
23
+ if (open) {
24
+ setHintOpen(false);
25
+ }
26
+ },
27
+ children: [
28
+ /* @__PURE__ */ jsxs(
29
+ Tooltip,
30
+ {
31
+ open: hintOpen && !menuOpen,
32
+ onOpenChange: setHintOpen,
33
+ children: [
34
+ /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(
35
+ DropdownMenuTrigger,
36
+ {
37
+ asChild: true,
38
+ children: /* @__PURE__ */ jsx(
39
+ Button,
40
+ {
41
+ variant: "quiet",
42
+ size: "small",
43
+ layout: "icon",
44
+ "aria-label": label,
45
+ children: icon
46
+ }
47
+ )
48
+ }
49
+ ) }),
50
+ /* @__PURE__ */ jsx(
51
+ TooltipContent,
52
+ {
53
+ align: "end",
54
+ children: label
55
+ }
56
+ )
57
+ ]
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsx(DropdownMenuContent, { children })
61
+ ]
62
+ }
63
+ );
64
+ };
65
+
66
+ // src/preferences-controls/style.ts
67
+ import { cn } from "@gridui/style-utils";
68
+ import { cva } from "class-variance-authority";
69
+ var preferencesStyles = cva(cn(
70
+ "gridui-preferences",
71
+ "flex flex-wrap gap-gridui-8"
72
+ ));
73
+ var preferencesInlineStyles = cva(cn(
74
+ "gridui-preferences-inline",
75
+ "grid gap-gridui-24"
76
+ ));
77
+ var preferencesLabelStyles = cva(cn(
78
+ "gridui-preferences-label",
79
+ "m-0 text-muted type-caption"
80
+ ));
81
+ var preferencesOptionsStyles = cva(cn(
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
+ "*:aria-[current=page]:text-foreground *:aria-[current=page]:bg-brand-tint",
86
+ "*:aria-pressed:text-foreground *:aria-pressed:bg-brand-tint"
87
+ ));
88
+ var preferenceIndicatorStyles = cva("gridui-dropdown-indicator w-4 shrink-0 text-foreground");
89
+
90
+ // src/preferences-controls/dropdown.tsx
91
+ import { DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem } from "@gridui/dropdown-menu";
92
+ import { cn as cn2 } from "@gridui/style-utils";
93
+ import { isTheme } from "@gridui/theme/preference";
94
+ import { THEME } from "@gridui/theme/theme";
95
+ import { TooltipProvider } from "@gridui/tooltip";
96
+ import { Globe, Laptop, Moon, Sun } from "lucide-react";
97
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
98
+ var DropdownPreferences = (props) => {
99
+ const { labels, theme, onThemeChange, languageLinks } = props;
100
+ const themeIcons = {
101
+ system: Laptop,
102
+ dark: Moon,
103
+ light: Sun
104
+ };
105
+ const ThemeIcon = themeIcons[theme];
106
+ return /* @__PURE__ */ jsx2(TooltipProvider, { children: /* @__PURE__ */ jsxs2(
107
+ "div",
108
+ {
109
+ className: cn2(preferencesStyles()),
110
+ children: [
111
+ /* @__PURE__ */ jsxs2(
112
+ PreferenceMenu,
113
+ {
114
+ label: labels.language,
115
+ icon: /* @__PURE__ */ jsx2(
116
+ Globe,
117
+ {
118
+ "aria-hidden": "true"
119
+ }
120
+ ),
121
+ children: [
122
+ /* @__PURE__ */ jsx2(DropdownMenuLabel, { children: labels.language }),
123
+ languageLinks.map((link) => {
124
+ return /* @__PURE__ */ jsx2(
125
+ DropdownMenuItem,
126
+ {
127
+ asChild: true,
128
+ children: link
129
+ },
130
+ link.key
131
+ );
132
+ })
133
+ ]
134
+ }
135
+ ),
136
+ /* @__PURE__ */ jsxs2(
137
+ PreferenceMenu,
138
+ {
139
+ label: labels.appearance,
140
+ icon: /* @__PURE__ */ jsx2(
141
+ ThemeIcon,
142
+ {
143
+ "aria-hidden": "true"
144
+ }
145
+ ),
146
+ children: [
147
+ /* @__PURE__ */ jsx2(DropdownMenuLabel, { children: labels.appearance }),
148
+ /* @__PURE__ */ jsxs2(
149
+ DropdownMenuRadioGroup,
150
+ {
151
+ value: theme,
152
+ onValueChange: (value) => {
153
+ if (isTheme(value)) {
154
+ onThemeChange(value);
155
+ }
156
+ },
157
+ children: [
158
+ /* @__PURE__ */ jsx2(
159
+ DropdownMenuRadioItem,
160
+ {
161
+ value: THEME.SYSTEM,
162
+ children: labels.system
163
+ }
164
+ ),
165
+ /* @__PURE__ */ jsx2(
166
+ DropdownMenuRadioItem,
167
+ {
168
+ value: THEME.LIGHT,
169
+ children: labels.light
170
+ }
171
+ ),
172
+ /* @__PURE__ */ jsx2(
173
+ DropdownMenuRadioItem,
174
+ {
175
+ value: THEME.DARK,
176
+ children: labels.dark
177
+ }
178
+ )
179
+ ]
180
+ }
181
+ )
182
+ ]
183
+ }
184
+ )
185
+ ]
186
+ }
187
+ ) });
188
+ };
189
+
190
+ // src/preferences-controls/inline.tsx
191
+ import { Button as Button2 } from "@gridui/button";
192
+ import { cn as cn3 } from "@gridui/style-utils";
193
+ import { THEME as THEME2 } from "@gridui/theme/theme";
194
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
195
+ var InlinePreferences = (props) => {
196
+ const { labels, theme, onThemeChange, languageLinks } = props;
197
+ return /* @__PURE__ */ jsxs3(
198
+ "div",
199
+ {
200
+ className: cn3(preferencesInlineStyles()),
201
+ children: [
202
+ /* @__PURE__ */ jsxs3(
203
+ "div",
204
+ {
205
+ role: "group",
206
+ "aria-label": labels.language,
207
+ children: [
208
+ /* @__PURE__ */ jsx3(
209
+ "p",
210
+ {
211
+ className: cn3(preferencesLabelStyles()),
212
+ children: labels.language
213
+ }
214
+ ),
215
+ /* @__PURE__ */ jsx3(
216
+ "div",
217
+ {
218
+ className: cn3(preferencesOptionsStyles()),
219
+ children: languageLinks
220
+ }
221
+ )
222
+ ]
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsxs3(
226
+ "div",
227
+ {
228
+ role: "group",
229
+ "aria-label": labels.appearance,
230
+ children: [
231
+ /* @__PURE__ */ jsx3(
232
+ "p",
233
+ {
234
+ className: cn3(preferencesLabelStyles()),
235
+ children: labels.appearance
236
+ }
237
+ ),
238
+ /* @__PURE__ */ jsx3(
239
+ "div",
240
+ {
241
+ className: cn3(preferencesOptionsStyles()),
242
+ children: [
243
+ THEME2.SYSTEM,
244
+ THEME2.LIGHT,
245
+ THEME2.DARK
246
+ ].map((value) => {
247
+ return /* @__PURE__ */ jsx3(
248
+ Button2,
249
+ {
250
+ size: "small",
251
+ variant: "quiet",
252
+ "aria-pressed": theme === value,
253
+ onClick: () => {
254
+ return void onThemeChange(value);
255
+ },
256
+ children: labels[value]
257
+ },
258
+ value
259
+ );
260
+ })
261
+ }
262
+ )
263
+ ]
264
+ }
265
+ )
266
+ ]
267
+ }
268
+ );
269
+ };
270
+
271
+ // src/preferences-controls/preferences-controls.tsx
272
+ import { Check } from "lucide-react";
273
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
274
+ var PreferencesControls = (props) => {
275
+ const { presentation = "dropdown", languages, ...options } = props;
276
+ const languageLinks = languages.map((language) => {
277
+ return /* @__PURE__ */ jsxs4(
278
+ "a",
279
+ {
280
+ href: language.href,
281
+ hrefLang: language.locale,
282
+ lang: language.locale,
283
+ "aria-current": language.current ? "page" : void 0,
284
+ onClick: language.onSelect,
285
+ children: [
286
+ /* @__PURE__ */ jsx4(
287
+ "span",
288
+ {
289
+ className: preferenceIndicatorStyles(),
290
+ "aria-hidden": "true",
291
+ children: language.current ? /* @__PURE__ */ jsx4(
292
+ Check,
293
+ {
294
+ size: 16
295
+ }
296
+ ) : null
297
+ }
298
+ ),
299
+ language.label
300
+ ]
301
+ },
302
+ language.locale
303
+ );
304
+ });
305
+ if (presentation === "inline") {
306
+ return /* @__PURE__ */ jsx4(
307
+ InlinePreferences,
308
+ {
309
+ ...options,
310
+ languageLinks
311
+ }
312
+ );
313
+ }
314
+ return /* @__PURE__ */ jsx4(
315
+ DropdownPreferences,
316
+ {
317
+ ...options,
318
+ languageLinks
319
+ }
320
+ );
321
+ };
322
+ export {
323
+ PreferencesControls
324
+ };
325
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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,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,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,0BAA0B;AAAA,cACrC,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
+ "names": ["cn", "jsx", "jsxs", "Button", "cn", "THEME", "jsx", "jsxs", "jsx", "jsxs"]
7
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Preferences
4
+ * @namespace PreferencesControls
5
+ * @description Dropdown
6
+ */
7
+ import type { PreferencesOptions } from "./types";
8
+ import type { FC, ReactElement } from "react";
9
+ export type DropdownPreferencesProps = PreferencesOptions & {
10
+ readonly languageLinks: readonly ReactElement[];
11
+ };
12
+ export declare const DropdownPreferences: FC<DropdownPreferencesProps>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Preferences
4
+ * @namespace PreferencesControls
5
+ * @description Inline
6
+ */
7
+ import type { PreferencesOptions } from "./types";
8
+ import type { FC, ReactElement } from "react";
9
+ export type InlinePreferencesProps = PreferencesOptions & {
10
+ readonly languageLinks: readonly ReactElement[];
11
+ };
12
+ export declare const InlinePreferences: FC<InlinePreferencesProps>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Preferences
4
+ * @namespace PreferencesControls
5
+ * @description Language
6
+ */
7
+ export type PreferenceLanguage = {
8
+ readonly locale: string;
9
+ readonly label: string;
10
+ readonly href: string;
11
+ readonly current: boolean;
12
+ readonly onSelect?: () => void;
13
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Preferences
4
+ * @namespace PreferencesControls
5
+ * @description Menu
6
+ */
7
+ import { type FC, type ReactNode } from "react";
8
+ export type PreferenceMenuProps = {
9
+ readonly label: string;
10
+ readonly icon: ReactNode;
11
+ readonly children: ReactNode;
12
+ };
13
+ export declare const PreferenceMenu: FC<PreferenceMenuProps>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Preferences
4
+ * @namespace PreferencesControls
5
+ * @description Preferences Controls
6
+ */
7
+ import type { PreferenceLanguage } from "./language";
8
+ import type { PreferencesOptions } from "./types";
9
+ import type { FC } from "react";
10
+ export type PreferencesControlsProps = PreferencesOptions & {
11
+ readonly presentation?: "dropdown" | "inline";
12
+ readonly languages: readonly PreferenceLanguage[];
13
+ };
14
+ export declare const PreferencesControls: FC<PreferencesControlsProps>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Preferences
4
+ * @namespace PreferencesControls
5
+ * @description Style
6
+ */
7
+ export declare const preferencesStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
8
+ export declare const preferencesInlineStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
9
+ export declare const preferencesLabelStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
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;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Preferences
4
+ * @namespace PreferencesControls
5
+ * @description Types
6
+ */
7
+ import type { THEME } from "@gridui/theme/theme";
8
+ export type PreferenceLabels = {
9
+ readonly language: string;
10
+ readonly appearance: string;
11
+ readonly system: string;
12
+ readonly light: string;
13
+ readonly dark: string;
14
+ };
15
+ export type PreferencesOptions = {
16
+ readonly labels: PreferenceLabels;
17
+ readonly theme: THEME;
18
+ readonly onThemeChange: (value: THEME) => void;
19
+ };
@@ -0,0 +1,127 @@
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
+ @layer theme, base, components, utilities;
4
+ @layer theme {
5
+ :root, :host {
6
+ --spacing: 0.25rem;
7
+ }
8
+ }
9
+ @layer utilities {
10
+ .m-0 {
11
+ margin: 0px;
12
+ }
13
+ .flex {
14
+ display: flex;
15
+ }
16
+ .grid {
17
+ display: grid;
18
+ }
19
+ .inline {
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 {
29
+ flex-wrap: wrap;
30
+ }
31
+ .gap-gridui-4 {
32
+ gap: var(--gridui-space-4);
33
+ }
34
+ .gap-gridui-8 {
35
+ gap: var(--gridui-space-8);
36
+ }
37
+ .gap-gridui-24 {
38
+ gap: var(--gridui-space-24);
39
+ }
40
+ .rounded-control {
41
+ border-radius: var(--gridui-control-radius);
42
+ }
43
+ .border {
44
+ border-style: var(--tw-border-style);
45
+ border-width: 1px;
46
+ }
47
+ .border-solid {
48
+ --tw-border-style: solid;
49
+ border-style: solid;
50
+ }
51
+ .border-border {
52
+ border-color: var(--gridui-border);
53
+ }
54
+ .p-gridui-4 {
55
+ padding: var(--gridui-space-4);
56
+ }
57
+ .type-caption {
58
+ font: var(--gridui-type-caption);
59
+ letter-spacing: normal;
60
+ }
61
+ .text-foreground {
62
+ color: var(--gridui-foreground);
63
+ }
64
+ .text-muted {
65
+ color: var(--gridui-muted);
66
+ }
67
+ :is(.\*\:aria-pressed\:bg-brand-tint > *)[aria-pressed="true"] {
68
+ background-color: var(--gridui-brand-tint);
69
+ }
70
+ :is(.\*\:aria-pressed\:text-foreground > *)[aria-pressed="true"] {
71
+ color: var(--gridui-foreground);
72
+ }
73
+ :is(.\*\:aria-\[current\=page\]\:bg-brand-tint > *)[aria-current="page"] {
74
+ background-color: var(--gridui-brand-tint);
75
+ }
76
+ :is(.\*\:aria-\[current\=page\]\:text-foreground > *)[aria-current="page"] {
77
+ color: var(--gridui-foreground);
78
+ }
79
+ .\[\&_\>_a\]\:inline-flex > a {
80
+ display: inline-flex;
81
+ }
82
+ .\[\&_\>_a\]\:min-h-9 > a {
83
+ min-height: calc(var(--spacing) * 9);
84
+ }
85
+ .\[\&_\>_a\]\:items-center > a {
86
+ align-items: center;
87
+ }
88
+ .\[\&_\>_a\]\:gap-gridui-4 > a {
89
+ gap: var(--gridui-space-4);
90
+ }
91
+ .\[\&_\>_a\]\:rounded-control > a {
92
+ border-radius: var(--gridui-control-radius);
93
+ }
94
+ .\[\&_\>_a\]\:px-gridui-8 > a {
95
+ padding-inline: var(--gridui-space-8);
96
+ }
97
+ .\[\&_\>_a\]\:py-gridui-4 > a {
98
+ padding-block: var(--gridui-space-4);
99
+ }
100
+ .\[\&_\>_a\]\:type-ui > a {
101
+ font: var(--gridui-type-ui);
102
+ letter-spacing: normal;
103
+ }
104
+ .\[\&_\>_a\]\:text-foreground > a {
105
+ color: var(--gridui-foreground);
106
+ }
107
+ .\[\&_\>_a\]\:no-underline > a {
108
+ text-decoration-line: none;
109
+ }
110
+ }
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
+ @property --tw-border-style {
117
+ syntax: "*";
118
+ inherits: false;
119
+ initial-value: solid;
120
+ }
121
+ @layer properties {
122
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
123
+ *, ::before, ::after, ::backdrop {
124
+ --tw-border-style: solid;
125
+ }
126
+ }
127
+ }
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "@gridui/preferences",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.0",
4
+ "description": "GridUI React preferences",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "sideEffects": [
12
+ "**/*.css"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./styles.css": "./dist/styles.css"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "peerDependencies": {
25
+ "react": "^19.2.0",
26
+ "react-dom": "^19.2.0"
27
+ },
28
+ "dependencies": {
29
+ "@gridui/button": "^2.1.1",
30
+ "@gridui/dropdown-menu": "^0.0.0",
31
+ "@gridui/style-utils": "^2.1.2",
32
+ "@gridui/theme": "^2.1.2",
33
+ "@gridui/tooltip": "^0.0.0",
34
+ "class-variance-authority": "0.7.1",
35
+ "lucide-react": "1.62.0"
36
+ },
37
+ "devDependencies": {
38
+ "@gridui-internal/configuration": "0.0.0",
39
+ "@jest/globals": "30.5.2",
40
+ "@types/jest": "30.0.0",
41
+ "@types/node": "26.6.5",
42
+ "@types/react": "19.3.0",
43
+ "@types/react-dom": "19.3.0",
44
+ "jest": "30.5.2",
45
+ "react": "19.3.1",
46
+ "react-dom": "19.3.1",
47
+ "typescript": "6.0.3"
48
+ },
49
+ "scripts": {
50
+ "build": "node ../../scripts/compilation/package.ts",
51
+ "compile": "tsc --project tsconfig.json",
52
+ "test": "jest",
53
+ "coverage": "jest --coverage"
54
+ }
6
55
  }