@admin-layout/tailwind-ui 12.2.4-alpha.27 → 12.2.4-alpha.32

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.
@@ -197,4 +197,4 @@ import React__default,{useRef,useEffect}from'react';import {useActor}from'@xstat
197
197
  className: "px-2 py-0.5 text-xs text-blue-600 hover:bg-blue-50 transition-colors",
198
198
  onClick: () => handleDateSelect(new Date())
199
199
  }, "Today"))));
200
- };export{DatePicker,DatePicker as default};//# sourceMappingURL=DatePicker.js.map
200
+ };export{DatePicker};//# sourceMappingURL=DatePicker.js.map
@@ -422,4 +422,4 @@ function InputToolBar({
422
422
  micSendButton: micSendButton,
423
423
  classNames: classNames
424
424
  }))))));
425
- }export{InputToolBar,InputToolBar as default};//# sourceMappingURL=InputToolBar.js.map
425
+ }export{InputToolBar};//# sourceMappingURL=InputToolBar.js.map
@@ -1,4 +1,4 @@
1
- import*as React from'react';import {ChevronDown,Search}from'lucide-react';import {cn}from'../../utils/util.js';const SelectContext = React.createContext(undefined);
1
+ import*as React from'react';import {Search,ChevronDown}from'lucide-react';import {cn}from'../../utils/util.js';const SelectContext = React.createContext(undefined);
2
2
  const SelectProvider = ({
3
3
  children,
4
4
  value,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ThemeContextType, Theme } from './types';
2
+ import { Theme, ThemeContextType } from './types';
3
3
  export declare const themes: {
4
4
  value: Theme;
5
5
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeProvider/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGlD,eAAO,MAAM,MAAM;WACO,KAAK;;;GAK9B,CAAC;AAEF,eAAO,MAAM,YAAY,iCASvB,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC;IACzC,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,GAAG,CAAC;CACjB,CA8FA,CAAC"}
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeProvider/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAE3E,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAElD,eAAO,MAAM,MAAM;WACO,KAAK;;;GAK9B,CAAC;AAEF,eAAO,MAAM,YAAY,iCASvB,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC;IACzC,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,GAAG,CAAC;CACjB,CA4GA,CAAC"}
@@ -49,11 +49,10 @@ const TailwindThemeProvider = ({
49
49
  const currentRoute = routePattern || location?.pathname || '/';
50
50
  const deviceType = isMobile ? 'mobile' : 'desktop';
51
51
  const [applyToAllRoutes, setApplyToAllRoutes] = useState(false);
52
- // Toggle mode
53
- const toggleMode = () => {
52
+ function toggleMode(applyToAllRoutesOverride) {
54
53
  const newNavTheme = navTheme === 'dark' ? 'light' : 'dark';
55
- handleSettingChange('navTheme', newNavTheme);
56
- };
54
+ handleSettingChange('navTheme', newNavTheme, applyToAllRoutesOverride);
55
+ }
57
56
  function parseSettingPath(path, value) {
58
57
  const keys = path.split('.');
59
58
  // Base case: no nesting
@@ -72,17 +71,29 @@ const TailwindThemeProvider = ({
72
71
  current[keys[keys.length - 1]] = value;
73
72
  return result;
74
73
  }
75
- const handleSettingChange = (key, value) => {
76
- const bracketKey = applyToAllRoutes ? `[${deviceType}]` : `[${currentRoute}][${deviceType}]`;
74
+ function buildSettingUpdate(key, value, applyToAllRoutesOverride) {
75
+ const useGlobal = applyToAllRoutesOverride ?? applyToAllRoutes;
77
76
  const settingObject = parseSettingPath(key, value);
78
- const nestedValue = {
79
- [bracketKey]: settingObject
77
+ if (useGlobal) {
78
+ return {
79
+ [`[${deviceType}]`]: settingObject,
80
+ [`[${currentRoute}][${deviceType}]`]: settingObject
81
+ };
82
+ }
83
+ return {
84
+ [`[${currentRoute}][${deviceType}]`]: settingObject
80
85
  };
86
+ }
87
+ function handleSettingChange(key, value, applyToAllRoutesOverride) {
88
+ if (!actor) {
89
+ return;
90
+ }
91
+ const nestedValue = buildSettingUpdate(key, value, applyToAllRoutesOverride);
81
92
  actor.send({
82
93
  type: 'UISETTING_UPDATE',
83
94
  value: nestedValue
84
95
  });
85
- };
96
+ }
86
97
  // Toggle dark mode class on document
87
98
  useEffect(() => {
88
99
  if (typeof window === 'undefined') return;
@@ -108,11 +119,11 @@ const TailwindThemeProvider = ({
108
119
  theme: theme,
109
120
  mode: navTheme,
110
121
  toggleMode,
111
- setTheme: theme => {
112
- handleSettingChange('theme', theme);
122
+ setTheme: (theme, applyToAllRoutesOverride) => {
123
+ handleSettingChange('theme', theme, applyToAllRoutesOverride);
113
124
  },
114
- setMode: mode => {
115
- handleSettingChange('navTheme', mode);
125
+ setMode: (mode, applyToAllRoutesOverride) => {
126
+ handleSettingChange('navTheme', mode, applyToAllRoutesOverride);
116
127
  },
117
128
  themes: themes,
118
129
  routePattern: routePattern,
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.js","sources":["../../../src/components/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":[null],"names":[],"mappings":"qKAIA,MAAA,SAAa,CAAA;kBACkB;;;GAK9B;AAED,EAAA,KAAA,EAAA,QAAO;AAWP,EAAA,KAAA,EAAA;aACY;AACR,CAAA,EAAA;OACA,EAAK,OAAM;OACX,EAAA,OAAY;aACJ;AACX,CAAA,EA8FC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ThemeProvider.js","sources":["../../../src/components/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":[null],"names":[],"mappings":"qKAIA,MAAA,SAAa,CAAA;kBACkB;;;GAK9B;AAED,EAAA,KAAA,EAAA,QAAO;AAWP,EAAA,KAAA,EAAA;aACY;AACR,CAAA,EAAA;OACA,EAAK,OAAM;OACX,EAAA,OAAY;aACJ;AACX,CAAA,EA4GC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -6,7 +6,7 @@ import React__default from'react';import {useTheme}from'../../hooks/useTheme.js'
6
6
  toggleMode
7
7
  } = useTheme();
8
8
  return React__default.createElement("button", {
9
- onClick: toggleMode,
9
+ onClick: () => toggleMode(),
10
10
  className: `rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition-colors ${className}`,
11
11
  "aria-label": "Toggle dark mode"
12
12
  }, mode === 'dark' ? React__default.createElement(SunIcon, {
@@ -3,9 +3,9 @@ export type ThemeMode = 'light' | 'dark' | 'realDark';
3
3
  export interface ThemeContextType {
4
4
  theme: Theme;
5
5
  mode: ThemeMode;
6
- setTheme: (theme: Theme) => void;
7
- setMode: (mode: ThemeMode) => void;
8
- toggleMode: () => void;
6
+ setTheme: (theme: Theme, applyToAllRoutes?: boolean) => void;
7
+ setMode: (mode: ThemeMode, applyToAllRoutes?: boolean) => void;
8
+ toggleMode: (applyToAllRoutes?: boolean) => void;
9
9
  themes: {
10
10
  value: Theme;
11
11
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeProvider/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC1E,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACnC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,GAAG,CAAC;CACjB;AACD,MAAM,WAAW,WAAW;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ThemeProvider/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC1E,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/D,UAAU,EAAE,CAAC,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,GAAG,CAAC;CACjB;AACD,MAAM,WAAW,WAAW;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admin-layout/tailwind-ui",
3
- "version": "12.2.4-alpha.27",
3
+ "version": "12.2.4-alpha.32",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -29,7 +29,7 @@
29
29
  "watch": "npm run build:lib:watch"
30
30
  },
31
31
  "dependencies": {
32
- "@admin-layout/client": "12.2.4-alpha.27",
32
+ "@admin-layout/client": "12.2.4-alpha.32",
33
33
  "@radix-ui/react-accordion": "^1.2.0",
34
34
  "@radix-ui/react-alert-dialog": "^1.1.1",
35
35
  "@radix-ui/react-aspect-ratio": "^1.1.0",
@@ -90,5 +90,5 @@
90
90
  "typescript": {
91
91
  "definition": "lib/index.d.ts"
92
92
  },
93
- "gitHead": "bdd205421b62f7f86f5706925da28c7ee0c47f61"
93
+ "gitHead": "b8a9fdff9ee70791978e203246c875d39527c742"
94
94
  }