@udixio/ui-react 1.2.0 → 1.4.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/CHANGELOG.md +40 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +450 -417
- package/dist/lib/effects/ThemeProvider.d.ts +5 -0
- package/dist/lib/effects/ThemeProvider.d.ts.map +1 -0
- package/dist/lib/effects/index.d.ts +1 -0
- package/dist/lib/effects/index.d.ts.map +1 -1
- package/dist/lib/interfaces/navigation-rail-item.interface.d.ts +1 -2
- package/dist/lib/interfaces/navigation-rail-item.interface.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/lib/components/NavigationRailItem.tsx +1 -1
- package/src/lib/effects/ThemeProvider.tsx +58 -0
- package/src/lib/effects/index.ts +1 -0
- package/src/lib/interfaces/navigation-rail-item.interface.ts +1 -2
- package/src/udixio.css +2 -2
- package/vite.config.ts +11 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/effects/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,eAAe,CAAC;AAS7D,eAAO,MAAM,aAAa,GAAI,YAAY;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,mDAgDpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/effects/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/effects/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ActionOrLink } from '../utils';
|
|
2
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
2
|
import { Dispatch, RefObject, SetStateAction } from 'react';
|
|
4
3
|
import { Transition } from 'motion';
|
|
5
4
|
import { Icon } from '../icon';
|
|
@@ -9,7 +8,7 @@ export type NavProps = {
|
|
|
9
8
|
label?: string;
|
|
10
9
|
children?: string;
|
|
11
10
|
icon: Icon;
|
|
12
|
-
iconSelected:
|
|
11
|
+
iconSelected: Icon;
|
|
13
12
|
selectedItem?: number | null;
|
|
14
13
|
setSelectedItem?: Dispatch<SetStateAction<number | null>>;
|
|
15
14
|
onItemSelected?: (args: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-rail-item.interface.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/navigation-rail-item.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"navigation-rail-item.interface.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/navigation-rail-item.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,IAAI,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D,cAAc,CAAC,EAAE,CACf,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,GAAG;QACzD,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;KACrB,KACA,IAAI,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,oBAAoB;IACpB,YAAY;IACZ,MAAM;IACN,OAAO;IACP,WAAW;CACZ,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG;IACjE,MAAM,EAAE;QACN,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@udixio/ui-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"throttle-debounce": "^5.0.2",
|
|
24
|
-
"clsx": "^
|
|
24
|
+
"clsx": "^1.1.1",
|
|
25
25
|
"react-textarea-autosize": "^8.5.9",
|
|
26
26
|
"motion": "^12.23.0",
|
|
27
27
|
"tailwind-merge": "^3.3.1",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"react": "^19.1.1",
|
|
37
37
|
"react-dom": "^19.1.1",
|
|
38
|
-
"@udixio/theme": "1.
|
|
39
|
-
"@udixio/tailwind": "1.
|
|
38
|
+
"@udixio/theme": "1.2.0",
|
|
39
|
+
"@udixio/tailwind": "1.4.0"
|
|
40
40
|
},
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ConfigInterface, loader } from '@udixio/theme';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { TailwindPlugin } from '@udixio/tailwind';
|
|
4
|
+
|
|
5
|
+
function isValidHexColor(hexColorString: string) {
|
|
6
|
+
const regex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
7
|
+
return regex.test(hexColorString);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ThemeProvider = ({ config }: { config: ConfigInterface }) => {
|
|
11
|
+
const [error, setError] = useState<string | null>(null);
|
|
12
|
+
|
|
13
|
+
const [outputCss, setOutputCss] = useState<null | string>(null);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!isValidHexColor(config.sourceColor)) {
|
|
17
|
+
setError('Invalid hex color');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const initTheme = async () => {
|
|
22
|
+
try {
|
|
23
|
+
const api = await loader(config);
|
|
24
|
+
|
|
25
|
+
api.themes.update({
|
|
26
|
+
sourceColorHex: config.sourceColor,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
await api.load();
|
|
30
|
+
|
|
31
|
+
setOutputCss(
|
|
32
|
+
api.plugins.getPlugin(TailwindPlugin).getInstance().outputCss,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
console.log('Theme loaded');
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.error('Theme loading failed:', err);
|
|
38
|
+
setError(err instanceof Error ? err.message : 'Theme loading failed');
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
initTheme();
|
|
43
|
+
}, [config.sourceColor]);
|
|
44
|
+
if (error) {
|
|
45
|
+
console.error('ThemeProvider error:', error);
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!outputCss) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return (
|
|
53
|
+
<style
|
|
54
|
+
type="text/tailwindcss"
|
|
55
|
+
dangerouslySetInnerHTML={{ __html: outputCss }}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
};
|
package/src/lib/effects/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ActionOrLink } from '../utils';
|
|
2
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
3
2
|
import { Dispatch, RefObject, SetStateAction } from 'react';
|
|
4
3
|
import { Transition } from 'motion';
|
|
5
4
|
import { Icon } from '../icon';
|
|
@@ -10,7 +9,7 @@ export type NavProps = {
|
|
|
10
9
|
label?: string;
|
|
11
10
|
children?: string;
|
|
12
11
|
icon: Icon;
|
|
13
|
-
iconSelected:
|
|
12
|
+
iconSelected: Icon;
|
|
14
13
|
selectedItem?: number | null;
|
|
15
14
|
setSelectedItem?: Dispatch<SetStateAction<number | null>>;
|
|
16
15
|
onItemSelected?: (
|
package/src/udixio.css
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
@plugin "@udixio/tailwind" {
|
|
3
2
|
colorKeys: surface, surface-dim, surface-bright, surface-container-lowest, surface-container-low, surface-container, surface-container-high, surface-container-highest, on-surface, on-surface-variant, outline, outline-variant, inverse-surface, inverse-on-surface, primary, primary-dim, on-primary, primary-container, on-primary-container, primary-fixed, primary-fixed-dim, on-primary-fixed, on-primary-fixed-variant, inverse-primary, secondary, secondary-dim, on-secondary, secondary-container, on-secondary-container, secondary-fixed, secondary-fixed-dim, on-secondary-fixed, on-secondary-fixed-variant, tertiary, tertiary-dim, on-tertiary, tertiary-container, on-tertiary-container, tertiary-fixed, tertiary-fixed-dim, on-tertiary-fixed, on-tertiary-fixed-variant, error, error-dim, on-error, error-container, on-error-container, surface-variant, surface-tint, background, on-background;
|
|
4
3
|
fontStyles: display-large fontWeight[400] fontSize[3.5625] lineHeight[4] letterSpacing[-0.015625] fontFamily[expressive], display-medium fontWeight[400] fontSize[2.8125] lineHeight[3.25] fontFamily[expressive], display-small fontWeight[400] fontSize[2.25] lineHeight[2.75] fontFamily[expressive], headline-large fontWeight[400] fontSize[2] lineHeight[2.5] fontFamily[expressive], headline-medium fontWeight[400] fontSize[1.75] lineHeight[2.25] fontFamily[expressive], headline-small fontWeight[400] fontSize[1.5] lineHeight[2] fontFamily[expressive], title-large fontWeight[400] fontSize[1.375] lineHeight[1.75] fontFamily[neutral], title-medium fontWeight[500] fontSize[1] lineHeight[1.5] fontFamily[neutral] letterSpacing[0.009375], title-small fontWeight[500] fontSize[0.875] lineHeight[1.25] fontFamily[neutral] letterSpacing[0.00625], label-large fontWeight[500] fontSize[0.875] lineHeight[1.25] fontFamily[neutral] letterSpacing[0.00625], label-medium fontWeight[500] fontSize[0.75] lineHeight[1] fontFamily[neutral] letterSpacing[0.03125], label-small fontWeight[500] fontSize[0.6875] lineHeight[1] fontFamily[neutral] letterSpacing[0.03125], body-large fontWeight[400] fontSize[1] lineHeight[1.5625] fontFamily[neutral] letterSpacing[0.03125], body-medium fontWeight[400] fontSize[0.875] lineHeight[1.25] fontFamily[neutral] letterSpacing[0.015625], body-small fontWeight[400] fontSize[0.75] lineHeight[1] fontFamily[neutral] letterSpacing[0.025];
|
|
@@ -114,7 +113,8 @@
|
|
|
114
113
|
--color-on-background: #eae3ef;
|
|
115
114
|
}
|
|
116
115
|
}
|
|
116
|
+
|
|
117
117
|
@theme {
|
|
118
118
|
--font-expressive: "Roboto", "sans-serif";
|
|
119
119
|
--font-neutral: "Roboto", "sans-serif";
|
|
120
|
-
}
|
|
120
|
+
}
|
package/vite.config.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { defineConfig } from 'vite';
|
|
|
3
3
|
import react from '@vitejs/plugin-react';
|
|
4
4
|
import dts from 'vite-plugin-dts';
|
|
5
5
|
import * as path from 'path';
|
|
6
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
6
7
|
|
|
7
8
|
const getUdixioVite = async () => {
|
|
8
9
|
// @ts-expect-error - NX_GRAPH_CREATION is a global variable set by Nx
|
|
@@ -10,7 +11,7 @@ const getUdixioVite = async () => {
|
|
|
10
11
|
return;
|
|
11
12
|
} else {
|
|
12
13
|
const dynamicPath = '@udixio/theme';
|
|
13
|
-
return (await import(dynamicPath)).
|
|
14
|
+
return (await import(dynamicPath)).vitePlugin;
|
|
14
15
|
}
|
|
15
16
|
};
|
|
16
17
|
|
|
@@ -24,6 +25,12 @@ export default defineConfig(async () => ({
|
|
|
24
25
|
entryRoot: 'src',
|
|
25
26
|
tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'),
|
|
26
27
|
}),
|
|
28
|
+
visualizer({
|
|
29
|
+
filename: '../../stats/ui-react.html',
|
|
30
|
+
open: false,
|
|
31
|
+
gzipSize: true,
|
|
32
|
+
brotliSize: true,
|
|
33
|
+
}),
|
|
27
34
|
],
|
|
28
35
|
// Uncomment this if you are using workers.
|
|
29
36
|
// worker: {
|
|
@@ -39,6 +46,7 @@ export default defineConfig(async () => ({
|
|
|
39
46
|
transformMixedEsModules: true,
|
|
40
47
|
},
|
|
41
48
|
lib: {
|
|
49
|
+
ssr: true,
|
|
42
50
|
// Could also be a dictionary or array of multiple entry points.
|
|
43
51
|
entry: 'src/index.ts',
|
|
44
52
|
name: '@udixio/ui-react',
|
|
@@ -58,8 +66,9 @@ export default defineConfig(async () => ({
|
|
|
58
66
|
'react-textarea-autosize',
|
|
59
67
|
'tailwind-merge',
|
|
60
68
|
'motion',
|
|
61
|
-
'motion/react',
|
|
62
69
|
'@udixio/theme',
|
|
70
|
+
'@udixio/tailwind',
|
|
71
|
+
'motion/react',
|
|
63
72
|
],
|
|
64
73
|
},
|
|
65
74
|
},
|