@telia/teddy 0.0.9 → 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 (73) hide show
  1. package/dist/assets/badge.css +1 -1
  2. package/dist/assets/heading.css +1 -1
  3. package/dist/assets/main.css +1 -1
  4. package/dist/assets/navigation-menu.css +1 -1
  5. package/dist/assets/radio-group.css +1 -1
  6. package/dist/badge-DscsRVHR.js +1825 -0
  7. package/dist/components/accordion/accordion.d.ts +1 -1
  8. package/dist/components/accordion/accordion.js +3 -3
  9. package/dist/components/accordion/index.js +1 -1
  10. package/dist/components/badge/badge.js +3 -3
  11. package/dist/components/badge/index.js +1 -1
  12. package/dist/components/box/box.js +8 -8
  13. package/dist/components/button/button.d.ts +2 -1
  14. package/dist/components/button/button.js +59 -60
  15. package/dist/components/card/card.js +3 -3
  16. package/dist/components/card/index.js +1 -1
  17. package/dist/components/flex/flex.js +1 -1
  18. package/dist/components/grid/grid.js +6 -6
  19. package/dist/components/heading/heading.d.ts +9 -36
  20. package/dist/components/heading/heading.js +36 -37
  21. package/dist/components/index.d.ts +2 -0
  22. package/dist/components/index.js +35 -33
  23. package/dist/components/modal/index.d.ts +2 -0
  24. package/dist/components/modal/index.js +4 -0
  25. package/dist/components/modal/modal.d.ts +76 -0
  26. package/dist/components/modal/modal.js +28 -0
  27. package/dist/components/navigation-menu/index.js +1 -1
  28. package/dist/components/navigation-menu/navigation-menu.d.ts +2 -0
  29. package/dist/components/navigation-menu/navigation-menu.js +8 -1032
  30. package/dist/components/notification/index.d.ts +2 -0
  31. package/dist/components/notification/index.js +4 -0
  32. package/dist/components/notification/notification.d.ts +59 -0
  33. package/dist/components/notification/notification.js +27 -0
  34. package/dist/components/radio-group/index.js +1 -1
  35. package/dist/components/radio-group/radio-group.js +1 -1
  36. package/dist/components/text-field/text-field.js +15 -15
  37. package/dist/components/toggle/index.js +1 -1
  38. package/dist/components/toggle/toggle.d.ts +1 -1
  39. package/dist/components/toggle/toggle.js +3 -3
  40. package/dist/{index-0Eg2mucA.js → index-FPIZOCcD.js} +80 -80
  41. package/dist/main.js +51 -49
  42. package/dist/navigation-menu-DKuyW8zE.js +1036 -0
  43. package/dist/{radio-group-BR5SMJXJ.js → radio-group-B--zT3OL.js} +8 -8
  44. package/dist/tokens/breakpoint/variables.json.d.ts +11 -0
  45. package/dist/utils/component-props-as.d.ts +5 -0
  46. package/dist/utils/component-props-as.js +1 -0
  47. package/dist/utils/layout/align.d.ts +46 -0
  48. package/dist/utils/layout/align.js +31 -0
  49. package/dist/utils/layout/flex.d.ts +294 -0
  50. package/dist/utils/layout/flex.js +60 -0
  51. package/dist/utils/layout/gap.d.ts +340 -0
  52. package/dist/utils/layout/gap.js +21 -0
  53. package/dist/utils/layout/grid.d.ts +313 -0
  54. package/dist/utils/layout/grid.js +116 -0
  55. package/dist/utils/layout/height.d.ts +118 -0
  56. package/dist/utils/layout/height.js +50 -0
  57. package/dist/utils/layout/index.d.ts +70 -0
  58. package/dist/utils/layout/index.js +71 -0
  59. package/dist/utils/layout/justify.d.ts +39 -0
  60. package/dist/utils/layout/justify.js +16 -0
  61. package/dist/utils/layout/margin.d.ts +478 -0
  62. package/dist/utils/layout/margin.js +32 -0
  63. package/dist/utils/layout/padding.d.ts +478 -0
  64. package/dist/utils/layout/padding.js +32 -0
  65. package/dist/utils/layout/util.d.ts +82 -0
  66. package/dist/utils/layout/util.js +32 -0
  67. package/dist/utils/layout/width.d.ts +69 -0
  68. package/dist/utils/layout/width.js +25 -0
  69. package/package.json +5 -1
  70. package/dist/badge-9vHb0-Jo.js +0 -721
  71. package/dist/tokens/spacing/variables.json.d.ts +0 -34
  72. package/dist/utils/layout.d.ts +0 -150
  73. package/dist/utils/layout.js +0 -221
@@ -1,34 +0,0 @@
1
- declare const _default: {
2
- "spacing": {
3
- "0": "0rem",
4
- "10": "0.0625rem",
5
- "25": "0.125rem",
6
- "50": "0.25rem",
7
- "100": "0.5rem",
8
- "150": "0.75rem",
9
- "200": "1rem",
10
- "250": "1.25rem",
11
- "300": "1.5rem",
12
- "400": "2rem",
13
- "600": "3rem",
14
- "800": "4rem",
15
- "1000": "5rem",
16
- "1200": "6rem",
17
- "1600": "8rem",
18
- "gutter": {
19
- "sm": "1rem",
20
- "md": "1.5rem",
21
- "lg": "1.5rem",
22
- "xl": "1.5rem"
23
- },
24
- "page-padding": {
25
- "sm": "1rem",
26
- "md": "1.5rem",
27
- "lg": "3rem",
28
- "xl": "3rem"
29
- }
30
- }
31
- }
32
- ;
33
-
34
- export default _default;
@@ -1,150 +0,0 @@
1
- import { breakpoint } from '../tokens/breakpoint/variables.json';
2
-
3
- type Breakpoint = keyof typeof breakpoint;
4
- export type Responsive<T> = {
5
- [key in Breakpoint]?: T;
6
- } | T;
7
- export declare const displayGridValues: readonly ["none", "inline-grid", "grid"];
8
- export declare const displayFlexValues: readonly ["none", "inline-flex", "flex"];
9
- export declare const displayValues: readonly ["none", "inline-flex", "flex", "none", "inline-grid", "grid"];
10
- export declare const marginValues: readonly [...("0" | "10" | "25" | "50" | "100" | "150" | "200" | "250" | "300" | "400" | "600" | "800" | "1000" | "1200" | "1600")[], "auto"];
11
- export declare const alignValues: readonly ["start", "center", "end", "baseline", "stretch"];
12
- export declare const justifyValues: readonly ["start", "center", "end", "between"];
13
- export declare const gapValues: ("0" | "10" | "25" | "50" | "100" | "150" | "200" | "250" | "300" | "400" | "600" | "800" | "1000" | "1200" | "1600")[];
14
- export declare const gridColumnsValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "none"];
15
- export declare const gridRowsValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "none"];
16
- export declare const gridFlowValues: readonly ["row", "column", "dense", "row-dense", "column-dense"];
17
- export declare const gridColumnStartValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
18
- export declare const gridColumnEndValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
19
- 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"];
20
- export declare const gridRowStartValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
21
- export declare const gridRowEndValues: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
22
- export declare const flexDirectionValues: readonly ["row", "column", "row-reverse", "column-reverse"];
23
- export declare const flexWrapValues: readonly ["nowrap", "wrap", "wrap-reverse"];
24
- export declare const flexGrowValues: readonly ["0", "1"];
25
- export declare const flexShrinkValues: readonly ["0", "1"];
26
- export declare const flexBasisValues: readonly [...("0" | "10" | "25" | "50" | "100" | "150" | "200" | "250" | "300" | "400" | "600" | "800" | "1000" | "1200" | "1600")[], "auto", "100%", "50%"];
27
- export type CommonChildrenLayoutProps = {
28
- /**
29
- * The margin of the element.
30
- */
31
- m?: Responsive<(typeof marginValues)[number]>;
32
- /**
33
- * The margin-top of the element.
34
- */
35
- mt?: Responsive<(typeof marginValues)[number]>;
36
- /**
37
- * The margin-bottom of the element.
38
- */
39
- mb?: Responsive<(typeof marginValues)[number]>;
40
- /**
41
- * The margin-right of the element.
42
- */
43
- mr?: Responsive<(typeof marginValues)[number]>;
44
- /**
45
- * The margin-left of the element.
46
- */
47
- ml?: Responsive<(typeof marginValues)[number]>;
48
- };
49
- export type FlexChildProps = {
50
- flexBasis?: Responsive<(typeof flexBasisValues)[number]>;
51
- flexGrow?: Responsive<(typeof flexGrowValues)[number]>;
52
- flexShrink?: Responsive<(typeof flexShrinkValues)[number]>;
53
- };
54
- export type GridChildProps = {
55
- gridColumnStart?: Responsive<(typeof gridColumnStartValues)[number]>;
56
- gridColumnEnd?: Responsive<(typeof gridColumnEndValues)[number]>;
57
- gridRowStart?: Responsive<(typeof gridRowStartValues)[number]>;
58
- gridRowEnd?: Responsive<(typeof gridRowEndValues)[number]>;
59
- gridColumn?: Responsive<(typeof gridColumnValues)[number]>;
60
- };
61
- export type ChildrenLayoutProps = FlexChildProps & GridChildProps & CommonChildrenLayoutProps;
62
- export type CommonFlexGridLayoutProps = ChildrenLayoutProps & {
63
- /**
64
- * The alignment of the grid items. It can be 'start', 'center', 'end', 'baseline', 'stretch' or a responsive value.
65
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
66
- * @example align={{ sm: 'start', md: 'center' }}
67
- * @default 'stretch'
68
- */
69
- align?: Responsive<(typeof alignValues)[number]>;
70
- /**
71
- * The alignment of the grid items. It can be or a responsive value.
72
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
73
- * @example align={{ sm: 'start', md: 'center' }}
74
- * @default 'start'
75
- */
76
- justify?: Responsive<(typeof justifyValues)[number]>;
77
- /**
78
- * The gap between items in horizontal and vertical directions. It can be a number, 'none' or a responsive value.
79
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
80
- * @example gap={{ sm: '100', md: '200' }}
81
- * @default '100'
82
- */
83
- gap?: Responsive<(typeof gapValues)[number]>;
84
- /**
85
- * The gap between grid items in horizontal direction. It can be a number, 'none' or a responsive value.
86
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
87
- * @example gap={{ sm: '100', md: '200' }}
88
- * @default '100'
89
- */
90
- gapX?: Responsive<(typeof gapValues)[number]>;
91
- /**
92
- * The gap between grid items in vertical direction. 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 gap={{ sm: '100', md: '200' }}
95
- * @default '100'
96
- */
97
- gapY?: Responsive<(typeof gapValues)[number]>;
98
- };
99
- export type LayoutFlexProps = CommonFlexGridLayoutProps & {
100
- /**
101
- * The display of the flex. It can be 'none', 'inline-flex', 'flex' or a responsive value.
102
- * @default 'flex'
103
- */
104
- display?: (typeof displayFlexValues)[number];
105
- /**
106
- * The direction of the flex items. It can be 'row', 'column', 'row-reverse', 'column-reverse' or a responsive value.
107
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
108
- * @example direction={{ sm: 'row', md: 'column' }}
109
- */
110
- direction?: Responsive<(typeof flexDirectionValues)[number]>;
111
- /**
112
- *
113
- */
114
- wrap?: Responsive<(typeof flexWrapValues)[number]>;
115
- };
116
- export type LayoutGridProps = CommonFlexGridLayoutProps & {
117
- /**
118
- * The display of the grid. It can be 'none', 'inline-grid', 'grid' or a responsive value.
119
- * @default 'grid'
120
- */
121
- display?: (typeof displayGridValues)[number];
122
- /**
123
- * The number of columns in the grid. It can be a number, 'none' or a responsive value.
124
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
125
- * @example columns={{ sm: '3', md: '5' }}
126
- */
127
- columns?: Responsive<(typeof gridColumnsValues)[number]> | 'string';
128
- /**
129
- * The number of rows in the grid. It can be a number, 'none' or a responsive value.
130
- * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
131
- * @example rows={{ sm: '3', md: '5' }}
132
- */
133
- rows?: Responsive<(typeof gridRowsValues)[number]> | 'string';
134
- /**
135
- * The flow direction of the grid. It can be 'row', 'column', 'dense', 'row-dense' or 'column-dense'.
136
- * @example flow='row'
137
- */
138
- flow?: Responsive<(typeof gridFlowValues)[number]>;
139
- };
140
- export type LayoutProps = Omit<LayoutGridProps, 'display'> & Omit<LayoutFlexProps, 'display'> & {
141
- display?: (typeof displayValues)[number];
142
- };
143
- 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 CommonChildrenLayoutProps> & {
144
- className: string;
145
- };
146
- export declare function extractResponsiveClassName<T>({ responsiveValue, rootClassName, }: {
147
- responsiveValue: Responsive<T>;
148
- rootClassName: string;
149
- }): string[] | string[][];
150
- export {};
@@ -1,221 +0,0 @@
1
- import { c as g } from "../clsx-DB4S2d7J.js";
2
- const p = {
3
- 0: "0rem",
4
- 10: "0.0625rem",
5
- 25: "0.125rem",
6
- 50: "0.25rem",
7
- 100: "0.5rem",
8
- 150: "0.75rem",
9
- 200: "1rem",
10
- 250: "1.25rem",
11
- 300: "1.5rem",
12
- 400: "2rem",
13
- 600: "3rem",
14
- 800: "4rem",
15
- 1e3: "5rem",
16
- 1200: "6rem",
17
- 1600: "8rem",
18
- gutter: {
19
- sm: "1rem",
20
- md: "1.5rem",
21
- lg: "1.5rem",
22
- xl: "1.5rem"
23
- },
24
- "page-padding": {
25
- sm: "1rem",
26
- md: "1.5rem",
27
- lg: "3rem",
28
- xl: "3rem"
29
- }
30
- }, d = Object.keys(p), t = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], f = ["none", "inline-grid", "grid"], N = ["none", "inline-flex", "flex"], k = [...N, ...f], r = [...d, "auto"], v = ["start", "center", "end", "baseline", "stretch"], w = ["start", "center", "end", "between"], m = d, V = [...t, "none"], x = [...t, "none"], b = ["row", "column", "dense", "row-dense", "column-dense"], C = t, $ = t, j = [
31
- ...t,
32
- "span-2",
33
- "span-3",
34
- "span-4",
35
- "span-5",
36
- "span-6",
37
- "span-7",
38
- "span-8",
39
- "span-9",
40
- "span-10",
41
- "span-11",
42
- "span-12"
43
- ], R = t, S = t, h = ["row", "column", "row-reverse", "column-reverse"], E = ["nowrap", "wrap", "wrap-reverse"], G = ["0", "1"], O = ["0", "1"], P = [...d, "auto", "100%", "50%"], A = [
44
- {
45
- key: "display",
46
- className: "teddy-display",
47
- values: k
48
- },
49
- {
50
- key: "m",
51
- className: "teddy-m",
52
- values: r
53
- },
54
- {
55
- key: "mt",
56
- className: "teddy-mt",
57
- values: r
58
- },
59
- {
60
- key: "mb",
61
- className: "teddy-mb",
62
- values: r
63
- },
64
- {
65
- key: "ml",
66
- className: "teddy-ml",
67
- values: r
68
- },
69
- {
70
- key: "mr",
71
- className: "teddy-mr",
72
- values: r
73
- },
74
- {
75
- key: "columns",
76
- className: "teddy-gtc",
77
- values: V
78
- },
79
- {
80
- key: "rows",
81
- className: "teddy-gtr",
82
- values: x
83
- },
84
- {
85
- key: "flow",
86
- className: "teddy-gaf",
87
- values: b
88
- },
89
- {
90
- key: "align",
91
- className: "teddy-ai",
92
- values: v
93
- },
94
- {
95
- key: "justify",
96
- className: "teddy-jc",
97
- values: w
98
- },
99
- {
100
- key: "gap",
101
- className: "teddy-gap",
102
- values: m
103
- },
104
- {
105
- key: "gapX",
106
- className: "teddy-cg",
107
- values: m
108
- },
109
- {
110
- key: "gapY",
111
- className: "teddy-rg",
112
- values: m
113
- },
114
- {
115
- key: "wrap",
116
- className: "teddy-fw",
117
- values: E
118
- },
119
- {
120
- key: "direction",
121
- className: "teddy-fd",
122
- values: h
123
- },
124
- {
125
- key: "flexGrow",
126
- className: "teddy-fg",
127
- values: G
128
- },
129
- {
130
- key: "flexShrink",
131
- className: "teddy-fs",
132
- values: O
133
- },
134
- {
135
- key: "flexBasis",
136
- className: "teddy-fb",
137
- values: P
138
- },
139
- {
140
- key: "gridColumnStart",
141
- className: "teddy-gcs",
142
- values: C
143
- },
144
- {
145
- key: "gridColumnEnd",
146
- className: "teddy-gce",
147
- values: $
148
- },
149
- {
150
- key: "gridRowStart",
151
- className: "teddy-grs",
152
- values: R
153
- },
154
- {
155
- key: "gridRowEnd",
156
- className: "teddy-gre",
157
- values: S
158
- },
159
- {
160
- key: "gridColumn",
161
- className: "teddy-gc",
162
- values: j
163
- }
164
- ];
165
- function W(e) {
166
- const n = { className: "" };
167
- return Object.entries(e).map(([a, s]) => {
168
- const l = A.find((c) => c.key === a);
169
- return s !== null && l ? [
170
- "className",
171
- B({
172
- responsiveValue: s,
173
- rootClassName: `${l.className}`
174
- })
175
- ] : [a, s];
176
- }).reduce(
177
- (a, [s, l]) => typeof s != "string" ? a : s === "className" ? { ...a, [s]: g(a.className, l) } : { ...a, [s]: l },
178
- n
179
- );
180
- }
181
- function B({
182
- responsiveValue: e,
183
- rootClassName: n
184
- }) {
185
- if (!e)
186
- return [];
187
- if (typeof e == "object" && e !== null)
188
- return Object.entries(e).map(([c, u]) => {
189
- const i = `${n}`, y = `${c}:${n}--${o(u)}`;
190
- return [i, y];
191
- });
192
- const a = `${n}`, s = `${n}--${o(e)}`;
193
- return [a, s];
194
- }
195
- function o(e) {
196
- return typeof e == "string" && e.endsWith("%") ? e.replace("%", "p") : e;
197
- }
198
- export {
199
- v as alignValues,
200
- N as displayFlexValues,
201
- f as displayGridValues,
202
- k as displayValues,
203
- W as extractPropsResponsiveLayout,
204
- B as extractResponsiveClassName,
205
- P as flexBasisValues,
206
- h as flexDirectionValues,
207
- G as flexGrowValues,
208
- O as flexShrinkValues,
209
- E as flexWrapValues,
210
- m as gapValues,
211
- $ as gridColumnEndValues,
212
- C as gridColumnStartValues,
213
- j as gridColumnValues,
214
- V as gridColumnsValues,
215
- b as gridFlowValues,
216
- S as gridRowEndValues,
217
- R as gridRowStartValues,
218
- x as gridRowsValues,
219
- w as justifyValues,
220
- r as marginValues
221
- };