@veracity/vui 2.8.0-rc.3 → 2.8.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.
@@ -25,7 +25,7 @@ const context_1 = require("./context");
25
25
  exports.MenuList = (0, core_1.vui)((props, ref) => {
26
26
  const { className, contentProps, contentRef } = props, rest = __rest(props, ["className", "contentProps", "contentRef"]);
27
27
  const styles = (0, core_1.useStyleConfig)('Menu', (0, context_1.useMenuContext)());
28
- return (react_1.default.createElement(popover_1.PopoverContent, Object.assign({ borderRadius: "1px", ref: contentRef }, contentProps),
28
+ return (react_1.default.createElement(popover_1.PopoverContent, Object.assign({ borderRadius: 0, ref: contentRef }, contentProps),
29
29
  react_1.default.createElement(list_1.default, Object.assign({ className: (0, utils_1.cs)('vui-menuList', className), py: 1, ref: ref, w: "100%" }, styles.list, rest))));
30
30
  });
31
31
  exports.MenuList.Divider = list_1.default.Divider;
@@ -7,6 +7,8 @@ export declare function parseHSL(color: string): {
7
7
  s: number;
8
8
  l: number;
9
9
  };
10
+ /** Builds RGBA string. */
11
+ export declare const buildRGBA: (r: number, g: number, b: number, alpha?: number) => string;
10
12
  /** Converts hex color value to rgb with optional alpha property. */
11
13
  export declare function hexToRGBA(hex: string, alpha?: number): string;
12
14
  export declare function vuiColorToRGBA(color: string, alpha?: number): string;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIlC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,6BAA6B;AAC7B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;EAIrC;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAgBpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAS3D;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UA0CxE;AAED,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIlC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,6BAA6B;AAC7B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;EAIrC;AAED,0BAA0B;AAC1B,eAAO,MAAM,SAAS,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,UAAU,MAAM,WACW,CAAA;AAEpF,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAgBpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAS3D;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UA0CxE;AAED,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA"}
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ellipsisOverflow = exports.HSLToRGBA = exports.vuiColorToRGBA = exports.hexToRGBA = exports.parseHSL = exports.cs = void 0;
7
- const colors_1 = __importDefault(require("../theme/foundations/colors"));
3
+ exports.ellipsisOverflow = exports.HSLToRGBA = exports.vuiColorToRGBA = exports.hexToRGBA = exports.buildRGBA = exports.parseHSL = exports.cs = void 0;
4
+ const theme_1 = require("../theme");
8
5
  /** Concatenates individual className arguments and returns a single string. */
9
6
  function cs(...classNames) {
10
7
  return classNames.filter(Boolean).join(' ');
@@ -18,6 +15,9 @@ function parseHSL(color) {
18
15
  return { h: Number(res === null || res === void 0 ? void 0 : res[0]) || 0, s: Number(res === null || res === void 0 ? void 0 : res[1]) || 0, l: Number(res === null || res === void 0 ? void 0 : res[2]) || 0 };
19
16
  }
20
17
  exports.parseHSL = parseHSL;
18
+ /** Builds RGBA string. */
19
+ const buildRGBA = (r, g, b, alpha) => alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
20
+ exports.buildRGBA = buildRGBA;
21
21
  /** Converts hex color value to rgb with optional alpha property. */
22
22
  function hexToRGBA(hex, alpha) {
23
23
  let hexStr = hex;
@@ -31,7 +31,7 @@ function hexToRGBA(hex, alpha) {
31
31
  const r = parseInt(hexStr.slice(0, 2), 16);
32
32
  const g = parseInt(hexStr.slice(2, 4), 16);
33
33
  const b = parseInt(hexStr.slice(4, 6), 16);
34
- return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
34
+ return (0, exports.buildRGBA)(r, g, b, alpha);
35
35
  }
36
36
  exports.hexToRGBA = hexToRGBA;
37
37
  function vuiColorToRGBA(color, alpha) {
@@ -40,7 +40,7 @@ function vuiColorToRGBA(color, alpha) {
40
40
  const [colorName, shade] = color.split('.');
41
41
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
42
42
  // @ts-ignore
43
- const x = parseHSL(colors_1.default[colorName][shade]);
43
+ const x = parseHSL(theme_1.colors[colorName][shade]);
44
44
  return HSLToRGBA(x.h, x.s, x.l, alpha || shade === 'main' ? 1 : parseInt(shade));
45
45
  }
46
46
  exports.vuiColorToRGBA = vuiColorToRGBA;
@@ -83,7 +83,7 @@ function HSLToRGBA(h, s, l, alpha) {
83
83
  r = Math.round((r + m) * 255);
84
84
  g = Math.round((g + m) * 255);
85
85
  b = Math.round((b + m) * 255);
86
- return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
86
+ return (0, exports.buildRGBA)(r, g, b, alpha);
87
87
  }
88
88
  exports.HSLToRGBA = HSLToRGBA;
89
89
  /** Styling to add ellipsis for long texts. */
@@ -8,7 +8,7 @@ import { useMenuContext } from './context';
8
8
  export const MenuList = vui((props, ref) => {
9
9
  const { className, contentProps, contentRef, ...rest } = props;
10
10
  const styles = useStyleConfig('Menu', useMenuContext());
11
- return (React.createElement(PopoverContent, { borderRadius: "1px", ref: contentRef, ...contentProps },
11
+ return (React.createElement(PopoverContent, { borderRadius: 0, ref: contentRef, ...contentProps },
12
12
  React.createElement(List, { className: cs('vui-menuList', className), py: 1, ref: ref, w: "100%", ...styles.list, ...rest })));
13
13
  });
14
14
  MenuList.Divider = List.Divider;
@@ -7,6 +7,8 @@ export declare function parseHSL(color: string): {
7
7
  s: number;
8
8
  l: number;
9
9
  };
10
+ /** Builds RGBA string. */
11
+ export declare const buildRGBA: (r: number, g: number, b: number, alpha?: number) => string;
10
12
  /** Converts hex color value to rgb with optional alpha property. */
11
13
  export declare function hexToRGBA(hex: string, alpha?: number): string;
12
14
  export declare function vuiColorToRGBA(color: string, alpha?: number): string;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIlC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,6BAA6B;AAC7B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;EAIrC;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAgBpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAS3D;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UA0CxE;AAED,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAIlC,+EAA+E;AAC/E,wBAAgB,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,UAEtC;AAED,6BAA6B;AAC7B,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;EAIrC;AAED,0BAA0B;AAC1B,eAAO,MAAM,SAAS,MAAO,MAAM,KAAK,MAAM,KAAK,MAAM,UAAU,MAAM,WACW,CAAA;AAEpF,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAgBpD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAS3D;AAED,oEAAoE;AACpE,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UA0CxE;AAED,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAA"}
@@ -1,4 +1,4 @@
1
- import colors from '../theme/foundations/colors';
1
+ import { colors } from '../theme';
2
2
  /** Concatenates individual className arguments and returns a single string. */
3
3
  export function cs(...classNames) {
4
4
  return classNames.filter(Boolean).join(' ');
@@ -9,6 +9,8 @@ export function parseHSL(color) {
9
9
  const res = regexp?.exec?.(color)?.slice?.(1);
10
10
  return { h: Number(res?.[0]) || 0, s: Number(res?.[1]) || 0, l: Number(res?.[2]) || 0 };
11
11
  }
12
+ /** Builds RGBA string. */
13
+ export const buildRGBA = (r, g, b, alpha) => alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
12
14
  /** Converts hex color value to rgb with optional alpha property. */
13
15
  export function hexToRGBA(hex, alpha) {
14
16
  let hexStr = hex;
@@ -22,7 +24,7 @@ export function hexToRGBA(hex, alpha) {
22
24
  const r = parseInt(hexStr.slice(0, 2), 16);
23
25
  const g = parseInt(hexStr.slice(2, 4), 16);
24
26
  const b = parseInt(hexStr.slice(4, 6), 16);
25
- return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
27
+ return buildRGBA(r, g, b, alpha);
26
28
  }
27
29
  export function vuiColorToRGBA(color, alpha) {
28
30
  if (!color.includes('.'))
@@ -72,7 +74,7 @@ export function HSLToRGBA(h, s, l, alpha) {
72
74
  r = Math.round((r + m) * 255);
73
75
  g = Math.round((g + m) * 255);
74
76
  b = Math.round((b + m) * 255);
75
- return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`;
77
+ return buildRGBA(r, g, b, alpha);
76
78
  }
77
79
  /** Styling to add ellipsis for long texts. */
78
80
  export const ellipsisOverflow = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veracity/vui",
3
- "version": "2.8.0-rc.3",
3
+ "version": "2.8.0",
4
4
  "description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
5
5
  "module": "./dist/esm/index.js",
6
6
  "main": "./dist/cjs/index.js",
package/src/core/vui.ts CHANGED
@@ -13,7 +13,7 @@ export function vui<C extends React.ElementType, Props = {}>(
13
13
  const { memoCompare, isMemo = true } = config ?? {}
14
14
 
15
15
  if (isMemo) {
16
- return React.memo(React.forwardRef(component), memoCompare) as unknown as VuiComponent<C, Props>
16
+ return React.memo(React.forwardRef(component), memoCompare as unknown as any) as unknown as VuiComponent<C, Props>
17
17
  }
18
18
 
19
19
  return React.forwardRef(component) as unknown as VuiComponent<C, Props>
@@ -13,7 +13,7 @@ export const MenuList = vui<'ul', MenuListProps>((props, ref) => {
13
13
  const styles = useStyleConfig('Menu', useMenuContext())
14
14
 
15
15
  return (
16
- <PopoverContent borderRadius="1px" ref={contentRef} {...contentProps}>
16
+ <PopoverContent borderRadius={0} ref={contentRef} {...contentProps}>
17
17
  <List className={cs('vui-menuList', className)} py={1} ref={ref} w="100%" {...styles.list} {...rest} />
18
18
  </PopoverContent>
19
19
  )
@@ -1,6 +1,6 @@
1
1
  import { Property } from 'csstype'
2
2
 
3
- import colors from '../theme/foundations/colors'
3
+ import { colors } from '../theme'
4
4
 
5
5
  /** Concatenates individual className arguments and returns a single string. */
6
6
  export function cs(...classNames: any[]) {
@@ -14,6 +14,10 @@ export function parseHSL(color: string) {
14
14
  return { h: Number(res?.[0]) || 0, s: Number(res?.[1]) || 0, l: Number(res?.[2]) || 0 }
15
15
  }
16
16
 
17
+ /** Builds RGBA string. */
18
+ export const buildRGBA = (r: number, g: number, b: number, alpha?: number) =>
19
+ alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`
20
+
17
21
  /** Converts hex color value to rgb with optional alpha property. */
18
22
  export function hexToRGBA(hex: string, alpha?: number) {
19
23
  let hexStr = hex
@@ -30,7 +34,7 @@ export function hexToRGBA(hex: string, alpha?: number) {
30
34
  const g = parseInt(hexStr.slice(2, 4), 16)
31
35
  const b = parseInt(hexStr.slice(4, 6), 16)
32
36
 
33
- return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`
37
+ return buildRGBA(r, g, b, alpha)
34
38
  }
35
39
 
36
40
  export function vuiColorToRGBA(color: string, alpha?: number) {
@@ -86,7 +90,7 @@ export function HSLToRGBA(h: number, s: number, l: number, alpha?: number) {
86
90
  g = Math.round((g + m) * 255)
87
91
  b = Math.round((b + m) * 255)
88
92
 
89
- return alpha !== undefined ? `rgba(${r}, ${g}, ${b}, ${alpha})` : `rgb(${r}, ${g}, ${b})`
93
+ return buildRGBA(r, g, b, alpha)
90
94
  }
91
95
 
92
96
  /** Styling to add ellipsis for long texts. */