@loomhq/lens 11.30.1 → 11.30.2

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/dist/cjs/index.js CHANGED
@@ -419,7 +419,7 @@ var getColorValue = (color) => {
419
419
  }
420
420
  };
421
421
 
422
- // src/utilities/size.js
422
+ // src/utilities/size.ts
423
423
  var u = (amount) => amount && `calc(${amount} * var(--lns-unit, ${unit}px))`;
424
424
  var getSizeValue = (size) => {
425
425
  if (size in spaces) {
@@ -473,7 +473,7 @@ function useMedia(queries, values, defaultValue) {
473
473
  return value;
474
474
  }
475
475
 
476
- // src/utilities/responsive.js
476
+ // src/utilities/responsive.ts
477
477
  var getMediaCss = (widthType, breakpoint, declaration) => `@media(${widthType}: ${breakpoint}){${declaration}}`;
478
478
  var arrayToBreakpoints = (values) => {
479
479
  const smallestBreakpoint = Object.values(breakpoints)[0];
@@ -555,11 +555,11 @@ var transformColumns = (columns) => {
555
555
  var getResponsiveColumns = (columns) => {
556
556
  if (columns) {
557
557
  if (typeof columns === "object" && !Array.isArray(columns)) {
558
- const columnsValesObject = {};
558
+ const columnsValuesObject = {};
559
559
  Object.entries(columns).forEach(
560
- ([key, value]) => columnsValesObject[key] = transformColumns(value)
560
+ ([key, value]) => columnsValuesObject[key] = transformColumns(value)
561
561
  );
562
- return objectToBreakpoints("grid-template-columns", columnsValesObject);
562
+ return objectToBreakpoints("grid-template-columns", columnsValuesObject);
563
563
  }
564
564
  return `grid-template-columns: ${transformColumns(columns)};`;
565
565
  }
@@ -622,7 +622,7 @@ var pascalCaseToKebabCase = (string) => {
622
622
  return string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
623
623
  };
624
624
 
625
- // src/variables.js
625
+ // src/variables.ts
626
626
  var unit = 8;
627
627
  var textSizes = {
628
628
  small: {
package/dist/esm/index.js CHANGED
@@ -200,7 +200,7 @@ var getColorValue = (color) => {
200
200
  }
201
201
  };
202
202
 
203
- // src/utilities/size.js
203
+ // src/utilities/size.ts
204
204
  var u = (amount) => amount && `calc(${amount} * var(--lns-unit, ${unit}px))`;
205
205
  var getSizeValue = (size) => {
206
206
  if (size in spaces) {
@@ -254,7 +254,7 @@ function useMedia(queries, values, defaultValue) {
254
254
  return value;
255
255
  }
256
256
 
257
- // src/utilities/responsive.js
257
+ // src/utilities/responsive.ts
258
258
  var getMediaCss = (widthType, breakpoint, declaration) => `@media(${widthType}: ${breakpoint}){${declaration}}`;
259
259
  var arrayToBreakpoints = (values) => {
260
260
  const smallestBreakpoint = Object.values(breakpoints)[0];
@@ -336,11 +336,11 @@ var transformColumns = (columns) => {
336
336
  var getResponsiveColumns = (columns) => {
337
337
  if (columns) {
338
338
  if (typeof columns === "object" && !Array.isArray(columns)) {
339
- const columnsValesObject = {};
339
+ const columnsValuesObject = {};
340
340
  Object.entries(columns).forEach(
341
- ([key, value]) => columnsValesObject[key] = transformColumns(value)
341
+ ([key, value]) => columnsValuesObject[key] = transformColumns(value)
342
342
  );
343
- return objectToBreakpoints("grid-template-columns", columnsValesObject);
343
+ return objectToBreakpoints("grid-template-columns", columnsValuesObject);
344
344
  }
345
345
  return `grid-template-columns: ${transformColumns(columns)};`;
346
346
  }
@@ -403,7 +403,7 @@ var pascalCaseToKebabCase = (string) => {
403
403
  return string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
404
404
  };
405
405
 
406
- // src/variables.js
406
+ // src/variables.ts
407
407
  var unit = 8;
408
408
  var textSizes = {
409
409
  small: {
@@ -11,11 +11,17 @@ interface ButtonProps {
11
11
  icon?: React.ReactNode;
12
12
  iconPosition?: 'left' | 'right';
13
13
  logoSrc?: string;
14
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
14
15
  hasLoader?: boolean;
15
16
  htmlTag?: 'button' | 'a';
16
17
  href?: string;
17
18
  target?: string;
19
+ type?: string;
18
20
  refHandler?: (ref: HTMLButtonElement) => void;
21
+ /** @deprecated Usage of className results in non-standard components */
22
+ className?: string;
23
+ /** @deprecated Usage of style results in non-standard components */
24
+ style?: any;
19
25
  }
20
26
  interface ButtonWrapperProps {
21
27
  hasNoPaddingRight?: boolean;
@@ -4,7 +4,7 @@ declare const ColorPicker: ({ defaultColor, confirmButton, swatches, onChange, .
4
4
  type ColorPickerProps = {
5
5
  defaultColor?: string;
6
6
  confirmButton?: React.ReactNode;
7
- swatches?: [];
8
- onChange?: () => void;
7
+ swatches?: string[];
8
+ onChange?: (selectedColor: string) => void;
9
9
  };
10
10
  export default ColorPicker;
@@ -8,6 +8,10 @@ export declare const availableHtmlTags: string[];
8
8
  interface SharedProps {
9
9
  backgroundColor?: string;
10
10
  backgroundImage?: string;
11
+ /**
12
+ * @deprecated Usage of className results in non-standard components
13
+ */
14
+ className?: string;
11
15
  contentColor?: string;
12
16
  borderColor?: string;
13
17
  radius?: 'medium' | 'large' | 'xlarge' | 'full';
@@ -43,6 +47,8 @@ interface SharedProps {
43
47
  zIndex?: number;
44
48
  borderWidth?: string | number;
45
49
  refHandler?: (ref: HTMLElement | HTMLDivElement | HTMLSpanElement) => void;
50
+ /** @deprecated Usage of style results in non-standard components */
51
+ style?: any;
46
52
  }
47
53
  interface ContainerProps extends SharedProps {
48
54
  htmlTag?: 'div' | 'header' | 'article' | 'section' | 'nav' | 'aside' | 'footer' | 'main' | 'span';
@@ -5,18 +5,19 @@ declare const Distribute: ({ children, gap, direction, alignment, isSpread, html
5
5
  export declare const availableDirections: string[];
6
6
  export declare const availableAlignments: string[];
7
7
  export declare const availableHtmlTags: string[];
8
+ type Alignment = 'start' | 'center' | 'end' | 'stretch';
8
9
  type DistributeProps = {
9
10
  children: React.ReactNode;
10
11
  direction?: ResponsiveType<'row' | 'column'>;
11
- alignment?: ResponsiveType<'start' | 'center' | 'end' | 'stretch'>;
12
+ alignment?: Alignment | Alignment[];
12
13
  isSpread?: ResponsiveType<true | false>;
13
14
  htmlTag?: 'div' | 'header' | 'article' | 'section' | 'nav' | 'aside' | 'footer' | 'main';
14
15
  gap?: string | number;
15
16
  };
16
17
  type DistributeWrapperProps = {
17
18
  flexDirection?: ResponsiveType<'row' | 'column'>;
18
- flexAlign?: ResponsiveType<'start' | 'center' | 'end' | 'stretch'>;
19
- isSpread?: ResponsiveType<true | false>;
19
+ flexAlign?: Alignment | Alignment[];
20
+ isSpread?: boolean | boolean[];
20
21
  gap?: string | number;
21
22
  as?: string;
22
23
  };
@@ -10,8 +10,9 @@ declare class Layout extends Component<LayoutProps> {
10
10
  }) => React.JSX.Element;
11
11
  render(): React.JSX.Element;
12
12
  }
13
+ type Alignments = 'start' | 'center' | 'end' | 'stretch';
13
14
  type LayoutProps = {
14
- alignment?: ResponsiveType<'start' | 'center' | 'end' | 'stretch'>;
15
+ alignment?: Alignments | Alignments[];
15
16
  gap?: ResponsiveType<string | number>;
16
17
  children?: React.ReactNode;
17
18
  };
@@ -4,11 +4,20 @@ declare const Link: ({ children, href, variant, htmlTag, isDisabled, ...props }:
4
4
  export declare const availableVariants: string[];
5
5
  type LinkProps = {
6
6
  children?: React.ReactNode;
7
+ /**
8
+ * @deprecated Usage of className results in non-standard components
9
+ */
10
+ className?: string;
7
11
  href?: string;
8
12
  variant?: 'neutral' | 'primary';
9
13
  htmlTag?: 'button' | 'a';
10
14
  isDisabled?: boolean;
11
15
  onClick?: React.ReactEventHandler;
16
+ /**
17
+ * @deprecated Usage of style results in non-standard components
18
+ */
19
+ style?: any;
20
+ target?: string;
12
21
  };
13
22
  type LinkWrapperProps = {
14
23
  children?: React.ReactNode;
@@ -16,5 +25,6 @@ type LinkWrapperProps = {
16
25
  disabled?: boolean;
17
26
  variant?: 'neutral' | 'primary';
18
27
  as?: string;
28
+ target?: string;
19
29
  };
20
30
  export default Link;
@@ -29,6 +29,8 @@ interface TextProps {
29
29
  htmlTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'span' | 'div';
30
30
  children?: React.ReactNode;
31
31
  sizeMinMax?: string[];
32
+ /** @deprecated Usage of className results in non-standard components */
33
+ className?: string;
32
34
  }
33
35
  interface TextWrapperProps extends TextProps {
34
36
  as?: string;
@@ -12,6 +12,7 @@ type TextButtonProps = {
12
12
  offsetSide?: 'left' | 'right';
13
13
  href?: string;
14
14
  target?: string;
15
+ type?: string;
15
16
  };
16
17
  type TextButtonWrapperProps = {
17
18
  icon?: React.ReactNode;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Size } from '../../utilities';
2
3
  type DelaySpeed = 'immediate' | 'long';
3
4
  declare const TooltipBoxWrapper: import("@emotion/styled").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TooltipBoxProps, object>;
4
5
  declare const ShortcutWrapper: import("@emotion/styled").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, keyof React.HTMLAttributes<HTMLDivElement>>, object>;
@@ -8,7 +9,7 @@ declare const Tooltip: ({ ariaLive, children, content, shortcut, placement, keep
8
9
  export declare const availablePlacements: string[];
9
10
  type TooltipBoxProps = {
10
11
  children?: React.ReactNode;
11
- maxWidth?: number | string | [];
12
+ maxWidth?: Size | [];
12
13
  onMouseEnter?: React.ReactEventHandler;
13
14
  onMouseLeave?: React.ReactEventHandler;
14
15
  layerProps?: any;
@@ -23,7 +24,7 @@ type TooltipProps = {
23
24
  isDisabled?: boolean;
24
25
  isInline?: boolean;
25
26
  keepOpen?: boolean;
26
- maxWidth?: number | string | [];
27
+ maxWidth?: Size | [];
27
28
  placement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'leftTop' | 'leftCenter' | 'leftBottom' | 'rightTop' | 'rightCenter' | 'rightBottom';
28
29
  triggerOffset?: number;
29
30
  verticalAlign?: string;
@@ -1,15 +1,22 @@
1
- export function getMediaCss(widthType: any, breakpoint: any, declaration: any): string;
2
- export function arrayToBreakpoints(values: any): string;
3
- export function objectToBreakpoints(property: any, obj: any): string;
4
- export function getResponsiveOneOf(property: any, valueArray: any): string;
5
- export function getAlignmentStyles(prop: any, alignments: any): string;
6
- export function getResponsiveBoolean(property: any, valueArray: any, booleanValue: any): string;
7
- export function getResponsiveNumber(property: any, number: any): string;
8
- export function getResponsiveColumns(columns: any): string;
9
- export function getResponsiveGridSections(gridSections: any, sectionType: any): string;
10
- export function Media({ children, queries, values, defaultValue }: {
1
+ import { Breakpoint } from '../variables';
2
+ import { Size } from './size';
3
+ import { ResponsiveGridSections, ResponsiveType } from '../types';
4
+ export declare const getMediaCss: (widthType: string, breakpoint: string, declaration: string) => string;
5
+ export declare const arrayToBreakpoints: (values: string[]) => string;
6
+ export type BreakpointProperties = Breakpoint | 'default';
7
+ export type BreakpointObject = Partial<Record<BreakpointProperties, string>>;
8
+ export declare const objectToBreakpoints: (property: string, obj: BreakpointObject) => string;
9
+ export declare const getResponsiveOneOf: (property: string, valueArray: ResponsiveType<string>) => string;
10
+ export declare const getAlignmentStyles: (prop: string | string[], alignments: Record<string, string>) => string;
11
+ export declare const getResponsiveBoolean: (property: string, valueArray: string[], booleanValue: boolean | boolean[]) => string;
12
+ export declare const getResponsiveNumber: (property: string, number: ResponsiveType<number | string>) => string;
13
+ type SizeParam = Size | Size[];
14
+ export declare const getResponsiveColumns: (columns: Record<Breakpoint, SizeParam>) => string;
15
+ export declare const getResponsiveGridSections: (gridSections: ResponsiveGridSections, sectionType: string) => string;
16
+ export declare const Media: ({ children, queries, values, defaultValue }: {
11
17
  children: any;
12
18
  queries: any;
13
19
  values: any;
14
20
  defaultValue: any;
15
- }): any;
21
+ }) => any;
22
+ export {};
@@ -1,3 +1,9 @@
1
- export function u(amount: any): string;
2
- export function getSizeValue(size: any): string;
3
- export function getSize(property: any, size: any): string;
1
+ import { Breakpoint, Space } from '../variables';
2
+ export declare const u: (amount: number) => string;
3
+ /**
4
+ * @example
5
+ * Sample values: "large", 42, "80px"
6
+ */
7
+ export type Size = Space | number | string;
8
+ export declare const getSizeValue: (size: Size) => string;
9
+ export declare const getSize: (property: string, size: Size | Size[] | Partial<Record<Breakpoint, Size>>) => string;
@@ -1,5 +1,5 @@
1
- export const unit: 8;
2
- export const textSizes: {
1
+ export declare const unit = 8;
2
+ export declare const textSizes: {
3
3
  small: {
4
4
  fontSize: number;
5
5
  lineHeight: number;
@@ -49,46 +49,38 @@ export const textSizes: {
49
49
  lineHeight: number;
50
50
  };
51
51
  };
52
- export namespace fontWeights {
53
- const book: number;
54
- const bold: number;
55
- }
56
- export namespace radii {
57
- const medium: string;
58
- const large: string;
59
- const xlarge: string;
60
- const full: string;
61
- }
62
- export namespace shadows {
63
- export const small: string;
64
- const medium_1: string;
65
- export { medium_1 as medium };
66
- const large_1: string;
67
- export { large_1 as large };
68
- }
69
- export namespace spaces {
70
- export const xsmall: number;
71
- const small_1: number;
72
- export { small_1 as small };
73
- const medium_2: number;
74
- export { medium_2 as medium };
75
- const large_2: number;
76
- export { large_2 as large };
77
- const xlarge_1: number;
78
- export { xlarge_1 as xlarge };
79
- export const xxlarge: number;
80
- }
81
- export namespace breakpoints {
82
- const xsmall_1: string;
83
- export { xsmall_1 as xsmall };
84
- const small_2: string;
85
- export { small_2 as small };
86
- const medium_3: string;
87
- export { medium_3 as medium };
88
- const large_3: string;
89
- export { large_3 as large };
90
- }
91
- export const gradients: {
52
+ export declare const fontWeights: {
53
+ book: number;
54
+ bold: number;
55
+ };
56
+ export declare const radii: {
57
+ medium: string;
58
+ large: string;
59
+ xlarge: string;
60
+ full: string;
61
+ };
62
+ export declare const shadows: {
63
+ small: string;
64
+ medium: string;
65
+ large: string;
66
+ };
67
+ export declare const spaces: {
68
+ xsmall: number;
69
+ small: number;
70
+ medium: number;
71
+ large: number;
72
+ xlarge: number;
73
+ xxlarge: number;
74
+ };
75
+ export type Space = keyof typeof spaces;
76
+ export declare const breakpoints: {
77
+ xsmall: string;
78
+ small: string;
79
+ medium: string;
80
+ large: string;
81
+ };
82
+ export type Breakpoint = keyof typeof breakpoints;
83
+ export declare const gradients: {
92
84
  'ai-primary': string;
93
85
  'ai-secondary': string;
94
86
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomhq/lens",
3
- "version": "11.30.1",
3
+ "version": "11.30.2",
4
4
  "packageManager": "pnpm@9.8.0",
5
5
  "scripts": {
6
6
  "preinstall": "npx only-allow pnpm",