@telia/teddy 0.0.10 → 0.0.11

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.
Files changed (67) hide show
  1. package/dist/assets/badge.css +1 -1
  2. package/dist/assets/main.css +1 -1
  3. package/dist/assets/radio-group.css +1 -1
  4. package/dist/badge-DscsRVHR.js +1825 -0
  5. package/dist/components/accordion/accordion.js +3 -3
  6. package/dist/components/accordion/index.js +1 -1
  7. package/dist/components/badge/badge.js +3 -3
  8. package/dist/components/badge/index.js +1 -1
  9. package/dist/components/box/box.js +8 -8
  10. package/dist/components/button/button.d.ts +2 -1
  11. package/dist/components/button/button.js +59 -60
  12. package/dist/components/card/card.js +3 -3
  13. package/dist/components/card/index.js +1 -1
  14. package/dist/components/flex/flex.js +1 -1
  15. package/dist/components/grid/grid.js +6 -6
  16. package/dist/components/heading/heading.d.ts +3 -2
  17. package/dist/components/heading/heading.js +20 -21
  18. package/dist/components/index.d.ts +1 -0
  19. package/dist/components/index.js +26 -25
  20. package/dist/components/modal/index.d.ts +2 -0
  21. package/dist/components/modal/index.js +4 -0
  22. package/dist/components/modal/modal.d.ts +76 -0
  23. package/dist/components/modal/modal.js +28 -0
  24. package/dist/components/navigation-menu/index.js +1 -1
  25. package/dist/components/navigation-menu/navigation-menu.d.ts +2 -0
  26. package/dist/components/navigation-menu/navigation-menu.js +8 -1032
  27. package/dist/components/notification/index.js +1 -1
  28. package/dist/components/notification/notification.d.ts +3 -3
  29. package/dist/components/notification/notification.js +4 -4
  30. package/dist/components/radio-group/index.js +1 -1
  31. package/dist/components/radio-group/radio-group.js +1 -1
  32. package/dist/components/text-field/text-field.js +15 -15
  33. package/dist/components/toggle/index.js +1 -1
  34. package/dist/components/toggle/toggle.d.ts +2 -2
  35. package/dist/components/toggle/toggle.js +3 -3
  36. package/dist/{index-DPFZO9xk.js → index-FPIZOCcD.js} +27 -28
  37. package/dist/main.js +41 -40
  38. package/dist/navigation-menu-DKuyW8zE.js +1036 -0
  39. package/dist/{radio-group-DN1IYZdr.js → radio-group-B--zT3OL.js} +8 -8
  40. package/dist/tokens/breakpoint/variables.json.d.ts +11 -0
  41. package/dist/utils/component-props-as.d.ts +5 -0
  42. package/dist/utils/component-props-as.js +1 -0
  43. package/dist/utils/layout/align.d.ts +46 -0
  44. package/dist/utils/layout/align.js +31 -0
  45. package/dist/utils/layout/flex.d.ts +281 -10
  46. package/dist/utils/layout/flex.js +44 -8
  47. package/dist/utils/layout/gap.d.ts +340 -0
  48. package/dist/utils/layout/gap.js +21 -0
  49. package/dist/utils/layout/grid.d.ts +313 -0
  50. package/dist/utils/layout/grid.js +116 -0
  51. package/dist/utils/layout/height.d.ts +118 -0
  52. package/dist/utils/layout/height.js +50 -0
  53. package/dist/utils/layout/index.d.ts +63 -111
  54. package/dist/utils/layout/index.js +62 -147
  55. package/dist/utils/layout/justify.d.ts +39 -0
  56. package/dist/utils/layout/justify.js +16 -0
  57. package/dist/utils/layout/margin.d.ts +443 -11
  58. package/dist/utils/layout/margin.js +1 -1
  59. package/dist/utils/layout/padding.d.ts +478 -0
  60. package/dist/utils/layout/padding.js +32 -0
  61. package/dist/utils/layout/util.d.ts +78 -4
  62. package/dist/utils/layout/util.js +30 -31
  63. package/dist/utils/layout/width.d.ts +43 -7
  64. package/dist/utils/layout/width.js +6 -2
  65. package/package.json +2 -1
  66. package/dist/badge-cOFoFJw0.js +0 -798
  67. package/dist/tokens/spacing/variables.json.d.ts +0 -34
@@ -0,0 +1,116 @@
1
+ import { numberIterator as e } from "./util.js";
2
+ const l = [...e, { key: "none", value: "none" }], n = [
3
+ ...e.map((a) => ({ key: a.key, value: `repeat(${a.value}, minmax(0, 1fr))` })),
4
+ { key: "none", value: "none" }
5
+ ], s = [
6
+ ...e,
7
+ {
8
+ key: "span-2",
9
+ value: "span 2"
10
+ },
11
+ {
12
+ key: "span-3",
13
+ value: "span 3"
14
+ },
15
+ {
16
+ key: "span-4",
17
+ value: "span 4"
18
+ },
19
+ {
20
+ key: "span-5",
21
+ value: "span 5"
22
+ },
23
+ {
24
+ key: "span-6",
25
+ value: "span 6"
26
+ },
27
+ {
28
+ key: "span-7",
29
+ value: "span 7"
30
+ },
31
+ {
32
+ key: "span-8",
33
+ value: "span 8"
34
+ },
35
+ {
36
+ key: "span-9",
37
+ value: "span 9"
38
+ },
39
+ {
40
+ key: "span-10",
41
+ value: "span 10"
42
+ },
43
+ {
44
+ key: "span-11",
45
+ value: "span 11"
46
+ },
47
+ {
48
+ key: "span-12",
49
+ value: "span 12"
50
+ }
51
+ ], u = s, d = [
52
+ { key: "none", value: "none" },
53
+ { key: "grid", value: "grid" },
54
+ { key: "inline-grid", value: "inline-grid" }
55
+ ], y = [
56
+ { key: "row", value: "row" },
57
+ { key: "column", value: "column" },
58
+ { key: "dense", value: "dense" },
59
+ { key: "row-dense", value: "row-dense" },
60
+ { key: "column-dense", value: "column-dense" }
61
+ ], r = [
62
+ { key: "display", className: "teddy-display", values: d },
63
+ {
64
+ key: "rows",
65
+ className: "teddy-gtr",
66
+ values: l
67
+ },
68
+ {
69
+ key: "columns",
70
+ className: "teddy-gtc",
71
+ values: n
72
+ },
73
+ {
74
+ key: "flow",
75
+ className: "teddy-gaf",
76
+ values: y
77
+ }
78
+ ], k = [
79
+ {
80
+ key: "gridColumnStart",
81
+ className: "teddy-gcs",
82
+ values: e
83
+ },
84
+ {
85
+ key: "gridColumnEnd",
86
+ className: "teddy-gce",
87
+ values: e
88
+ },
89
+ {
90
+ key: "gridRowStart",
91
+ className: "teddy-grs",
92
+ values: e
93
+ },
94
+ {
95
+ key: "gridRowEnd",
96
+ className: "teddy-gre",
97
+ values: e
98
+ },
99
+ {
100
+ key: "gridColumn",
101
+ className: "teddy-gc",
102
+ values: s
103
+ },
104
+ {
105
+ key: "gridRow",
106
+ className: "teddy-gr",
107
+ values: u
108
+ }
109
+ ];
110
+ export {
111
+ d as displayGridValues,
112
+ k as gridChildren,
113
+ r as gridLayout,
114
+ n as gridTemplateColumnsValues,
115
+ l as gridTemplateRowsValues
116
+ };
@@ -0,0 +1,118 @@
1
+ import { Responsive } from './util';
2
+
3
+ declare const heightValues: readonly [{
4
+ readonly key: "bp-sm";
5
+ readonly value: "0px";
6
+ }, {
7
+ readonly key: "bp-md";
8
+ readonly value: "600px";
9
+ }, {
10
+ readonly key: "bp-lg";
11
+ readonly value: "1024px";
12
+ }, {
13
+ readonly key: "bp-xl";
14
+ readonly value: "1440px";
15
+ }, {
16
+ readonly key: "auto";
17
+ readonly value: "auto";
18
+ }, {
19
+ readonly key: "100%";
20
+ readonly value: "100%";
21
+ }, {
22
+ readonly key: "50%";
23
+ readonly value: "50%";
24
+ }];
25
+ export type HeightProps = {
26
+ /**
27
+ * Static height.
28
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/height
29
+ */
30
+ height?: Responsive<(typeof heightValues)[number]['key']>;
31
+ /**
32
+ * Min height.
33
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/min-height
34
+ */
35
+ minHeight?: Responsive<(typeof heightValues)[number]['key']>;
36
+ /**
37
+ * Max height.
38
+ * @see https://developer.mozilla.org/en-US/docs/Web/CSS/max-height
39
+ */
40
+ maxHeight?: Responsive<(typeof heightValues)[number]['key']>;
41
+ };
42
+ export declare const heights: readonly [{
43
+ readonly key: "height";
44
+ readonly className: "teddy-h";
45
+ readonly values: readonly [{
46
+ readonly key: "bp-sm";
47
+ readonly value: "0px";
48
+ }, {
49
+ readonly key: "bp-md";
50
+ readonly value: "600px";
51
+ }, {
52
+ readonly key: "bp-lg";
53
+ readonly value: "1024px";
54
+ }, {
55
+ readonly key: "bp-xl";
56
+ readonly value: "1440px";
57
+ }, {
58
+ readonly key: "auto";
59
+ readonly value: "auto";
60
+ }, {
61
+ readonly key: "100%";
62
+ readonly value: "100%";
63
+ }, {
64
+ readonly key: "50%";
65
+ readonly value: "50%";
66
+ }];
67
+ }, {
68
+ readonly key: "minHeight";
69
+ readonly className: "teddy-min-h";
70
+ readonly values: readonly [{
71
+ readonly key: "bp-sm";
72
+ readonly value: "0px";
73
+ }, {
74
+ readonly key: "bp-md";
75
+ readonly value: "600px";
76
+ }, {
77
+ readonly key: "bp-lg";
78
+ readonly value: "1024px";
79
+ }, {
80
+ readonly key: "bp-xl";
81
+ readonly value: "1440px";
82
+ }, {
83
+ readonly key: "auto";
84
+ readonly value: "auto";
85
+ }, {
86
+ readonly key: "100%";
87
+ readonly value: "100%";
88
+ }, {
89
+ readonly key: "50%";
90
+ readonly value: "50%";
91
+ }];
92
+ }, {
93
+ readonly key: "maxHeight";
94
+ readonly className: "teddy-max-h";
95
+ readonly values: readonly [{
96
+ readonly key: "bp-sm";
97
+ readonly value: "0px";
98
+ }, {
99
+ readonly key: "bp-md";
100
+ readonly value: "600px";
101
+ }, {
102
+ readonly key: "bp-lg";
103
+ readonly value: "1024px";
104
+ }, {
105
+ readonly key: "bp-xl";
106
+ readonly value: "1440px";
107
+ }, {
108
+ readonly key: "auto";
109
+ readonly value: "auto";
110
+ }, {
111
+ readonly key: "100%";
112
+ readonly value: "100%";
113
+ }, {
114
+ readonly key: "50%";
115
+ readonly value: "50%";
116
+ }];
117
+ }];
118
+ export {};
@@ -0,0 +1,50 @@
1
+ import { t as a, a as t, b as s, c as l } from "../../variables-BkY5b0io.js";
2
+ const e = [
3
+ {
4
+ key: "bp-sm",
5
+ value: a
6
+ },
7
+ {
8
+ key: "bp-md",
9
+ value: t
10
+ },
11
+ {
12
+ key: "bp-lg",
13
+ value: s
14
+ },
15
+ {
16
+ key: "bp-xl",
17
+ value: l
18
+ },
19
+ {
20
+ key: "auto",
21
+ value: "auto"
22
+ },
23
+ {
24
+ key: "100%",
25
+ value: "100%"
26
+ },
27
+ {
28
+ key: "50%",
29
+ value: "50%"
30
+ }
31
+ ], d = [
32
+ {
33
+ key: "height",
34
+ className: "teddy-h",
35
+ values: e
36
+ },
37
+ {
38
+ key: "minHeight",
39
+ className: "teddy-min-h",
40
+ values: e
41
+ },
42
+ {
43
+ key: "maxHeight",
44
+ className: "teddy-max-h",
45
+ values: e
46
+ }
47
+ ];
48
+ export {
49
+ d as heights
50
+ };
@@ -1,118 +1,70 @@
1
+ import { PaddingProps } from './padding';
2
+ import { Justify } from './justify';
3
+ import { GridLayout, GridChildren } from './grid';
4
+ import { GapProps } from './gap';
5
+ import { Align } from './align';
6
+ import { HTMLAttributes } from 'react';
7
+ import { HeightProps } from './height';
1
8
  import { WidthProps } from './width';
2
- import { FlexChildProps } from './flex';
9
+ import { FlexChildren, FlexLayout } from './flex';
3
10
  import { MarginProps } from './margin';
4
11
  import { Responsive } from './util';
5
12
 
6
- export declare const displayGridValues: readonly ["none", "inline-grid", "grid"];
7
- export declare const displayFlexValues: readonly ["none", "inline-flex", "flex"];
8
- export declare const displayValues: readonly ["none", "inline-flex", "flex", "none", "inline-grid", "grid"];
9
- export declare const alignValues: readonly ["start", "center", "end", "baseline", "stretch"];
10
- export declare const justifyValues: readonly ["start", "center", "end", "between"];
11
- export declare const gapValues: ("0" | "10" | "25" | "50" | "100" | "150" | "200" | "250" | "300" | "400" | "600" | "800" | "1000" | "1200" | "1600")[];
12
- export declare const gridColumnsValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "none"];
13
- export declare const gridRowsValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "none"];
14
- export declare const gridFlowValues: readonly ["row", "column", "dense", "row-dense", "column-dense"];
15
- export declare const gridColumnStartValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
16
- export declare const gridColumnEndValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
17
- export declare const gridColumnValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "span-2", "span-3", "span-4", "span-5", "span-6", "span-7", "span-8", "span-9", "span-10", "span-11", "span-12"];
18
- export declare const gridRowStartValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
19
- export declare const gridRowEndValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
20
- export declare const flexDirectionValues: readonly ["row", "column", "row-reverse", "column-reverse"];
21
- export declare const flexWrapValues: readonly ["nowrap", "wrap", "wrap-reverse"];
22
- export type CommonChildrenLayoutProps = MarginProps & WidthProps;
23
- export type GridChildProps = {
24
- gridColumnStart?: Responsive<(typeof gridColumnStartValues)[number]>;
25
- gridColumnEnd?: Responsive<(typeof gridColumnEndValues)[number]>;
26
- gridRowStart?: Responsive<(typeof gridRowStartValues)[number]>;
27
- gridRowEnd?: Responsive<(typeof gridRowEndValues)[number]>;
28
- gridColumn?: Responsive<(typeof gridColumnValues)[number]>;
29
- };
30
- export type ChildrenLayoutProps = FlexChildProps & GridChildProps & CommonChildrenLayoutProps;
31
- export type CommonFlexGridLayoutProps = ChildrenLayoutProps & {
32
- /**
33
- * The alignment of the grid items. It can be 'start', 'center', 'end', 'baseline', 'stretch' or a responsive value.
34
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
35
- * @example align={{ sm: 'start', md: 'center' }}
36
- * @default 'stretch'
37
- */
38
- align?: Responsive<(typeof alignValues)[number]>;
39
- /**
40
- * The alignment of the grid items. It can be or a responsive value.
41
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
42
- * @example align={{ sm: 'start', md: 'center' }}
43
- * @default 'start'
44
- */
45
- justify?: Responsive<(typeof justifyValues)[number]>;
46
- /**
47
- * The gap between items in horizontal and vertical directions. It can be a number, 'none' or a responsive value.
48
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
49
- * @example gap={{ sm: '100', md: '200' }}
50
- * @default '100'
51
- */
52
- gap?: Responsive<(typeof gapValues)[number]>;
53
- /**
54
- * The gap between grid items in horizontal direction. It can be a number, 'none' or a responsive value.
55
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
56
- * @example gap={{ sm: '100', md: '200' }}
57
- * @default '100'
58
- */
59
- gapX?: Responsive<(typeof gapValues)[number]>;
60
- /**
61
- * The gap between grid items in vertical direction. It can be a number, 'none' or a responsive value.
62
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
63
- * @example gap={{ sm: '100', md: '200' }}
64
- * @default '100'
65
- */
66
- gapY?: Responsive<(typeof gapValues)[number]>;
67
- };
68
- export type LayoutFlexProps = CommonFlexGridLayoutProps & {
69
- /**
70
- * The display of the flex. It can be 'none', 'inline-flex', 'flex' or a responsive value.
71
- * @default 'flex'
72
- */
73
- display?: (typeof displayFlexValues)[number];
74
- /**
75
- * The direction of the flex items. It can be 'row', 'column', 'row-reverse', 'column-reverse' or a responsive value.
76
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
77
- * @example direction={{ sm: 'row', md: 'column' }}
78
- */
79
- direction?: Responsive<(typeof flexDirectionValues)[number]>;
80
- /**
81
- *
82
- */
83
- wrap?: Responsive<(typeof flexWrapValues)[number]>;
84
- };
85
- export type LayoutGridProps = CommonFlexGridLayoutProps & {
86
- /**
87
- * The display of the grid. It can be 'none', 'inline-grid', 'grid' or a responsive value.
88
- * @default 'grid'
89
- */
90
- display?: (typeof displayGridValues)[number];
91
- /**
92
- * The number of columns in the grid. It can be a number, 'none' or a responsive value.
93
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
94
- * @example columns={{ sm: '3', md: '5' }}
95
- */
96
- columns?: Responsive<(typeof gridColumnsValues)[number]> | 'string';
97
- /**
98
- * The number of rows in the grid. It can be a number, 'none' or a responsive value.
99
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
100
- * @example rows={{ sm: '3', md: '5' }}
101
- */
102
- rows?: Responsive<(typeof gridRowsValues)[number]> | 'string';
103
- /**
104
- * The flow direction of the grid. It can be 'row', 'column', 'dense', 'row-dense' or 'column-dense'.
105
- * @example flow='row'
106
- */
107
- flow?: Responsive<(typeof gridFlowValues)[number]>;
13
+ export declare const displayValues: readonly [{
14
+ readonly key: "none";
15
+ readonly value: "none";
16
+ }, {
17
+ readonly key: "inline-flex";
18
+ readonly value: "inline-flex";
19
+ }, {
20
+ readonly key: "flex";
21
+ readonly value: "flex";
22
+ }, {
23
+ readonly key: "none";
24
+ readonly value: "none";
25
+ }, {
26
+ readonly key: "grid";
27
+ readonly value: "grid";
28
+ }, {
29
+ readonly key: "inline-grid";
30
+ readonly value: "inline-grid";
31
+ }];
32
+ export declare const displayLayout: readonly [{
33
+ readonly key: "display";
34
+ readonly className: "teddy-display";
35
+ readonly values: readonly [{
36
+ readonly key: "none";
37
+ readonly value: "none";
38
+ }, {
39
+ readonly key: "inline-flex";
40
+ readonly value: "inline-flex";
41
+ }, {
42
+ readonly key: "flex";
43
+ readonly value: "flex";
44
+ }, {
45
+ readonly key: "none";
46
+ readonly value: "none";
47
+ }, {
48
+ readonly key: "grid";
49
+ readonly value: "grid";
50
+ }, {
51
+ readonly key: "inline-grid";
52
+ readonly value: "inline-grid";
53
+ }];
54
+ }];
55
+ export type DisplayLayout = Responsive<(typeof displayValues)[number]['key']>;
56
+ export type CommonChildrenLayoutProps = MarginProps & PaddingProps & WidthProps & HeightProps;
57
+ export type ChildrenLayoutProps = FlexChildren & GridChildren & CommonChildrenLayoutProps;
58
+ export type CommonFlexGridLayoutProps = ChildrenLayoutProps & GapProps & {
59
+ align?: Align;
60
+ justify?: Justify;
108
61
  };
62
+ export type LayoutFlexProps = CommonFlexGridLayoutProps & FlexLayout;
63
+ export type LayoutGridProps = CommonFlexGridLayoutProps & GridLayout;
109
64
  export type LayoutProps = Omit<LayoutGridProps, 'display'> & Omit<LayoutFlexProps, 'display'> & {
110
- display?: (typeof displayValues)[number];
111
- };
112
- export declare function extractPropsResponsiveLayout<T extends LayoutProps>(args: T): Omit<T, "direction" | "display" | "align" | "rows" | "wrap" | "columns" | "flow" | "justify" | "gap" | "gapX" | "gapY" | keyof FlexChildProps | keyof GridChildProps | keyof MarginProps | keyof WidthProps> & {
113
- className: string;
65
+ display?: DisplayLayout;
114
66
  };
115
- export declare function extractResponsiveClassName<T>({ responsiveValue, rootClassName, }: {
116
- responsiveValue: Responsive<T>;
117
- rootClassName: string;
118
- }): string[] | string[][];
67
+ type InlineStyle = React.CSSProperties | Record<string, string | number | null | undefined> | undefined;
68
+ export declare function mergeStyles(...styles: Array<InlineStyle>): InlineStyle;
69
+ export declare function extractProps<T extends LayoutProps & HTMLAttributes<HTMLElement>>(props: T): Omit<T, keyof LayoutProps>;
70
+ export {};