@veeqo/ui 9.6.5 → 9.7.1

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.
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var index = require('../../theme/index.cjs');
5
+ var utils = require('./utils.cjs');
6
+
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
+
9
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
10
+
11
+ const ThemeInjector = React__default.default.memo(({ theme = index.theme }) => {
12
+ const themeStyle = utils.buildThemeVariables(theme);
13
+ return (React__default.default.createElement("style", null, `:root {${Object.entries(themeStyle)
14
+ .map(([key, value]) => `${key}: ${value};`)
15
+ .join('')}}`));
16
+ });
17
+
18
+ exports.ThemeInjector = ThemeInjector;
19
+ //# sourceMappingURL=ThemeInjector.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeInjector.cjs","sources":["../../../src/components/ThemeInjector/ThemeInjector.tsx"],"sourcesContent":["import React from 'react';\n\nimport { theme as VeeqoTheme } from 'Theme';\nimport { buildThemeVariables } from './utils';\n\n/**\n * Component that injects a theme into the DOM as CSS variables. Only one instance per page is necessary\n *\n * The theme variables are mapped from dot-notation with camelCase property names, into kebab-case CSS variables.\n *\n * For example, `theme.text.headingLarge.fontSize` can be accessed as `var(--text-heading-large-font-size)`.\n */\ntype ThemeInjectorProps = {\n theme?: typeof VeeqoTheme;\n};\n\nexport const ThemeInjector = React.memo(({ theme = VeeqoTheme }: ThemeInjectorProps) => {\n const themeStyle = buildThemeVariables(theme);\n\n return (\n <style>\n {`:root {${Object.entries(themeStyle)\n .map(([key, value]) => `${key}: ${value};`)\n .join('')}}`}\n </style>\n );\n});\n"],"names":["React","VeeqoTheme","buildThemeVariables"],"mappings":";;;;;;;;;;AAgBO,MAAM,aAAa,GAAGA,sBAAK,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,GAAGC,WAAU,EAAsB,KAAI;AACrF,IAAA,MAAM,UAAU,GAAGC,yBAAmB,CAAC,KAAK,CAAC;IAE7C,QACEF,oDACG,CAAU,OAAA,EAAA,MAAM,CAAC,OAAO,CAAC,UAAU;AACjC,SAAA,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAG,EAAA,GAAG,CAAK,EAAA,EAAA,KAAK,GAAG;AACzC,SAAA,IAAI,CAAC,EAAE,CAAC,CAAG,CAAA,CAAA,CACR;AAEZ,CAAC;;;;"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { theme as VeeqoTheme } from 'Theme';
3
+ /**
4
+ * Component that injects a theme into the DOM as CSS variables. Only one instance per page is necessary
5
+ *
6
+ * The theme variables are mapped from dot-notation with camelCase property names, into kebab-case CSS variables.
7
+ *
8
+ * For example, `theme.text.headingLarge.fontSize` can be accessed as `var(--text-heading-large-font-size)`.
9
+ */
10
+ type ThemeInjectorProps = {
11
+ theme?: typeof VeeqoTheme;
12
+ };
13
+ export declare const ThemeInjector: React.MemoExoticComponent<({ theme }: ThemeInjectorProps) => React.JSX.Element>;
14
+ export {};
@@ -0,0 +1,13 @@
1
+ import React__default from 'react';
2
+ import { theme } from '../../theme/index.js';
3
+ import { buildThemeVariables } from './utils.js';
4
+
5
+ const ThemeInjector = React__default.memo(({ theme: theme$1 = theme }) => {
6
+ const themeStyle = buildThemeVariables(theme$1);
7
+ return (React__default.createElement("style", null, `:root {${Object.entries(themeStyle)
8
+ .map(([key, value]) => `${key}: ${value};`)
9
+ .join('')}}`));
10
+ });
11
+
12
+ export { ThemeInjector };
13
+ //# sourceMappingURL=ThemeInjector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeInjector.js","sources":["../../../src/components/ThemeInjector/ThemeInjector.tsx"],"sourcesContent":["import React from 'react';\n\nimport { theme as VeeqoTheme } from 'Theme';\nimport { buildThemeVariables } from './utils';\n\n/**\n * Component that injects a theme into the DOM as CSS variables. Only one instance per page is necessary\n *\n * The theme variables are mapped from dot-notation with camelCase property names, into kebab-case CSS variables.\n *\n * For example, `theme.text.headingLarge.fontSize` can be accessed as `var(--text-heading-large-font-size)`.\n */\ntype ThemeInjectorProps = {\n theme?: typeof VeeqoTheme;\n};\n\nexport const ThemeInjector = React.memo(({ theme = VeeqoTheme }: ThemeInjectorProps) => {\n const themeStyle = buildThemeVariables(theme);\n\n return (\n <style>\n {`:root {${Object.entries(themeStyle)\n .map(([key, value]) => `${key}: ${value};`)\n .join('')}}`}\n </style>\n );\n});\n"],"names":["React","theme","VeeqoTheme"],"mappings":";;;;AAgBO,MAAM,aAAa,GAAGA,cAAK,CAAC,IAAI,CAAC,CAAC,SAAEC,OAAK,GAAGC,KAAU,EAAsB,KAAI;AACrF,IAAA,MAAM,UAAU,GAAG,mBAAmB,CAACD,OAAK,CAAC;IAE7C,QACED,4CACG,CAAU,OAAA,EAAA,MAAM,CAAC,OAAO,CAAC,UAAU;AACjC,SAAA,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAG,EAAA,GAAG,CAAK,EAAA,EAAA,KAAK,GAAG;AACzC,SAAA,IAAI,CAAC,EAAE,CAAC,CAAG,CAAA,CAAA,CACR;AAEZ,CAAC;;;;"}
@@ -0,0 +1 @@
1
+ export { ThemeInjector } from './ThemeInjector';
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Converts a camelCase string into kebab-case.
5
+ */
6
+ const camelToKebab = (str) => {
7
+ return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
8
+ };
9
+ /**
10
+ * Builds CSS variables by traversing the theme object. Variable names are built by taken the path to the value, and joining it with '-' characters.
11
+ * @param themeObj The theme object to convert to CSS variables.
12
+ * @param prefix The current prefix.
13
+ * @returns A record, mapping from variable name to value.
14
+ */
15
+ const buildThemeVariables = (themeObj, prefix = '') => {
16
+ return Object.entries(themeObj).reduce((acc, [key, value]) => {
17
+ const kebabKey = camelToKebab(key);
18
+ const varPrefix = prefix === '' ? '' : `${prefix}-`;
19
+ if (typeof value === 'object') {
20
+ return { ...acc, ...buildThemeVariables(value, `${varPrefix}${kebabKey}`) };
21
+ }
22
+ return {
23
+ ...acc,
24
+ [`--${varPrefix}${kebabKey}`]: value,
25
+ };
26
+ }, {});
27
+ };
28
+
29
+ exports.buildThemeVariables = buildThemeVariables;
30
+ exports.camelToKebab = camelToKebab;
31
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","sources":["../../../src/components/ThemeInjector/utils.ts"],"sourcesContent":["/**\n * Converts a camelCase string into kebab-case.\n */\nexport const camelToKebab = (str: string) => {\n return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n};\n\n/**\n * Builds CSS variables by traversing the theme object. Variable names are built by taken the path to the value, and joining it with '-' characters.\n * @param themeObj The theme object to convert to CSS variables.\n * @param prefix The current prefix.\n * @returns A record, mapping from variable name to value.\n */\nexport const buildThemeVariables = (themeObj: Object, prefix: string = '') => {\n return Object.entries(themeObj).reduce((acc, [key, value]): any => {\n const kebabKey = camelToKebab(key);\n const varPrefix = prefix === '' ? '' : `${prefix}-`;\n\n if (typeof value === 'object') {\n return { ...acc, ...buildThemeVariables(value, `${varPrefix}${kebabKey}`) };\n }\n\n return {\n ...acc,\n [`--${varPrefix}${kebabKey}`]: value,\n };\n }, {});\n};\n"],"names":[],"mappings":";;AAAA;;AAEG;AACU,MAAA,YAAY,GAAG,CAAC,GAAW,KAAI;IAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE;AACjE;AAEA;;;;;AAKG;AACU,MAAA,mBAAmB,GAAG,CAAC,QAAgB,EAAE,MAAA,GAAiB,EAAE,KAAI;AAC3E,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,KAAS;AAChE,QAAA,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC;AAClC,QAAA,MAAM,SAAS,GAAG,MAAM,KAAK,EAAE,GAAG,EAAE,GAAG,CAAG,EAAA,MAAM,GAAG;AAEnD,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,YAAA,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,mBAAmB,CAAC,KAAK,EAAE,CAAA,EAAG,SAAS,CAAG,EAAA,QAAQ,CAAE,CAAA,CAAC,EAAE;AAC5E;QAED,OAAO;AACL,YAAA,GAAG,GAAG;AACN,YAAA,CAAC,KAAK,SAAS,CAAA,EAAG,QAAQ,CAAE,CAAA,GAAG,KAAK;SACrC;KACF,EAAE,EAAE,CAAC;AACR;;;;;"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Converts a camelCase string into kebab-case.
3
+ */
4
+ export declare const camelToKebab: (str: string) => string;
5
+ /**
6
+ * Builds CSS variables by traversing the theme object. Variable names are built by taken the path to the value, and joining it with '-' characters.
7
+ * @param themeObj The theme object to convert to CSS variables.
8
+ * @param prefix The current prefix.
9
+ * @returns A record, mapping from variable name to value.
10
+ */
11
+ export declare const buildThemeVariables: (themeObj: Object, prefix?: string) => {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Converts a camelCase string into kebab-case.
3
+ */
4
+ const camelToKebab = (str) => {
5
+ return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
6
+ };
7
+ /**
8
+ * Builds CSS variables by traversing the theme object. Variable names are built by taken the path to the value, and joining it with '-' characters.
9
+ * @param themeObj The theme object to convert to CSS variables.
10
+ * @param prefix The current prefix.
11
+ * @returns A record, mapping from variable name to value.
12
+ */
13
+ const buildThemeVariables = (themeObj, prefix = '') => {
14
+ return Object.entries(themeObj).reduce((acc, [key, value]) => {
15
+ const kebabKey = camelToKebab(key);
16
+ const varPrefix = prefix === '' ? '' : `${prefix}-`;
17
+ if (typeof value === 'object') {
18
+ return { ...acc, ...buildThemeVariables(value, `${varPrefix}${kebabKey}`) };
19
+ }
20
+ return {
21
+ ...acc,
22
+ [`--${varPrefix}${kebabKey}`]: value,
23
+ };
24
+ }, {});
25
+ };
26
+
27
+ export { buildThemeVariables, camelToKebab };
28
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../src/components/ThemeInjector/utils.ts"],"sourcesContent":["/**\n * Converts a camelCase string into kebab-case.\n */\nexport const camelToKebab = (str: string) => {\n return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();\n};\n\n/**\n * Builds CSS variables by traversing the theme object. Variable names are built by taken the path to the value, and joining it with '-' characters.\n * @param themeObj The theme object to convert to CSS variables.\n * @param prefix The current prefix.\n * @returns A record, mapping from variable name to value.\n */\nexport const buildThemeVariables = (themeObj: Object, prefix: string = '') => {\n return Object.entries(themeObj).reduce((acc, [key, value]): any => {\n const kebabKey = camelToKebab(key);\n const varPrefix = prefix === '' ? '' : `${prefix}-`;\n\n if (typeof value === 'object') {\n return { ...acc, ...buildThemeVariables(value, `${varPrefix}${kebabKey}`) };\n }\n\n return {\n ...acc,\n [`--${varPrefix}${kebabKey}`]: value,\n };\n }, {});\n};\n"],"names":[],"mappings":"AAAA;;AAEG;AACU,MAAA,YAAY,GAAG,CAAC,GAAW,KAAI;IAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE;AACjE;AAEA;;;;;AAKG;AACU,MAAA,mBAAmB,GAAG,CAAC,QAAgB,EAAE,MAAA,GAAiB,EAAE,KAAI;AAC3E,IAAA,OAAO,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,KAAS;AAChE,QAAA,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC;AAClC,QAAA,MAAM,SAAS,GAAG,MAAM,KAAK,EAAE,GAAG,EAAE,GAAG,CAAG,EAAA,MAAM,GAAG;AAEnD,QAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,YAAA,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,mBAAmB,CAAC,KAAK,EAAE,CAAA,EAAG,SAAS,CAAG,EAAA,QAAQ,CAAE,CAAA,CAAC,EAAE;AAC5E;QAED,OAAO;AACL,YAAA,GAAG,GAAG;AACN,YAAA,CAAC,KAAK,SAAS,CAAA,EAAG,QAAQ,CAAE,CAAA,GAAG,KAAK;SACrC;KACF,EAAE,EAAE,CAAC;AACR;;;;"}
@@ -63,3 +63,4 @@ export { ViewsContainer } from './ViewsContainer';
63
63
  export { WeightInput } from './WeightInput';
64
64
  export { Indicator } from './Indicator';
65
65
  export { SelectDropdown } from './SelectDropdown';
66
+ export { ThemeInjector } from './ThemeInjector';
package/dist/index.cjs CHANGED
@@ -76,6 +76,7 @@ var ViewsContainer = require('./components/ViewsContainer/ViewsContainer.cjs');
76
76
  var index$5 = require('./components/WeightInput/index.cjs');
77
77
  var Indicator = require('./components/Indicator/Indicator.cjs');
78
78
  var index$6 = require('./components/SelectDropdown/index.cjs');
79
+ var ThemeInjector = require('./components/ThemeInjector/ThemeInjector.cjs');
79
80
  var useClickOutside = require('./hooks/useClickOutside.cjs');
80
81
  var useDebounce = require('./hooks/useDebounce.cjs');
81
82
  var useDropdown = require('./hooks/useDropdown.cjs');
@@ -222,6 +223,7 @@ exports.ViewsContainer = ViewsContainer.ViewsContainer;
222
223
  exports.WeightInput = index$5.WeightInput;
223
224
  exports.Indicator = Indicator.Indicator;
224
225
  exports.SelectDropdown = index$6.SelectDropdown;
226
+ exports.ThemeInjector = ThemeInjector.ThemeInjector;
225
227
  exports.useClickOutside = useClickOutside.useClickOutside;
226
228
  exports.useDebounce = useDebounce.useDebounce;
227
229
  exports.useDropdown = useDropdown.useDropdown;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -74,6 +74,7 @@ export { ViewsContainer } from './components/ViewsContainer/ViewsContainer.js';
74
74
  export { WeightInput } from './components/WeightInput/index.js';
75
75
  export { Indicator } from './components/Indicator/Indicator.js';
76
76
  export { SelectDropdown } from './components/SelectDropdown/index.js';
77
+ export { ThemeInjector } from './components/ThemeInjector/ThemeInjector.js';
77
78
  export { useClickOutside } from './hooks/useClickOutside.js';
78
79
  export { useDebounce } from './hooks/useDebounce.js';
79
80
  export { useDropdown } from './hooks/useDropdown.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veeqo/ui",
3
- "version": "9.6.5",
3
+ "version": "9.7.1",
4
4
  "description": "New optimised component library for Veeqo.",
5
5
  "author": "Robert Wealthall",
6
6
  "license": "ISC",
@@ -77,6 +77,7 @@
77
77
  "@typescript-eslint/eslint-plugin": "^6.7.3",
78
78
  "@typescript-eslint/parser": "^6.7.3",
79
79
  "auto-changelog": "^2.4.0",
80
+ "cssnano": "^7.0.6",
80
81
  "eslint": "^8.44.0",
81
82
  "eslint-config-airbnb": "^19.0.4",
82
83
  "eslint-config-airbnb-typescript": "^17.1.0",
@@ -89,6 +90,7 @@
89
90
  "eslint-plugin-react-hooks": "^4.6.0",
90
91
  "eslint-plugin-storybook": "^0.8.0",
91
92
  "framer-motion": "^6.5.1",
93
+ "identity-obj-proxy": "^3.0.0",
92
94
  "jest": "~29.0.3",
93
95
  "jest-axe": "~6.0.0",
94
96
  "jest-cli": "~29.0.3",
@@ -96,6 +98,8 @@
96
98
  "jest-styled-components": "~7.1.1",
97
99
  "lodash.throttle": "^4.1.1",
98
100
  "playroom": "^0.39.1",
101
+ "postcss": "^8.5.3",
102
+ "postcss-modules": "^6.0.1",
99
103
  "prettier": "^3.0.3",
100
104
  "react": "^17.0.2",
101
105
  "react-dom": "^17.0.2",