@telia/teddy 0.0.10 → 0.0.12

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
@@ -1,156 +1,71 @@
1
- import { c as m } from "../../clsx-DB4S2d7J.js";
2
- import { spacingValues as y, numberIterator as n } from "./util.js";
3
- import { margins as p } from "./margin.js";
4
- import { flexLayout as g } from "./flex.js";
5
- import { widths as f } from "./width.js";
6
- const N = ["none", "inline-grid", "grid"], w = ["none", "inline-flex", "flex"], v = [...w, ...N], V = ["start", "center", "end", "baseline", "stretch"], k = ["start", "center", "end", "between"], o = y, x = [...n, "none"], C = [...n, "none"], $ = ["row", "column", "dense", "row-dense", "column-dense"], R = n, b = n, j = [
7
- ...n,
8
- "span-2",
9
- "span-3",
10
- "span-4",
11
- "span-5",
12
- "span-6",
13
- "span-7",
14
- "span-8",
15
- "span-9",
16
- "span-10",
17
- "span-11",
18
- "span-12"
19
- ], E = n, S = n, h = ["row", "column", "row-reverse", "column-reverse"], P = ["nowrap", "wrap", "wrap-reverse"], A = [
1
+ import { margins as k } from "./margin.js";
2
+ import { displayFlexValues as N, flexChildren as b, flexLayout as h } from "./flex.js";
3
+ import { widths as j } from "./width.js";
4
+ import { heights as v } from "./height.js";
5
+ import { c as y } from "../../clsx-DB4S2d7J.js";
6
+ import { align as $ } from "./align.js";
7
+ import { gap as L } from "./gap.js";
8
+ import { displayGridValues as O, gridLayout as V, gridChildren as C } from "./grid.js";
9
+ import { justify as P } from "./justify.js";
10
+ import { paddings as w } from "./padding.js";
11
+ const E = {
12
+ sm: "0px",
13
+ md: "600px",
14
+ lg: "1024px",
15
+ xl: "1440px"
16
+ }, F = ["initial", ...Object.keys(E)], G = [...N, ...O], K = [
20
17
  {
21
18
  key: "display",
22
19
  className: "teddy-display",
23
- values: v
24
- },
25
- {
26
- key: "columns",
27
- className: "teddy-gtc",
28
- values: x
29
- },
30
- {
31
- key: "rows",
32
- className: "teddy-gtr",
33
- values: C
34
- },
35
- {
36
- key: "flow",
37
- className: "teddy-gaf",
38
- values: $
39
- },
40
- {
41
- key: "align",
42
- className: "teddy-ai",
43
- values: V
44
- },
45
- {
46
- key: "justify",
47
- className: "teddy-jc",
48
- values: k
49
- },
50
- {
51
- key: "gap",
52
- className: "teddy-gap",
53
- values: o
54
- },
55
- {
56
- key: "gapX",
57
- className: "teddy-cg",
58
- values: o
59
- },
60
- {
61
- key: "gapY",
62
- className: "teddy-rg",
63
- values: o
64
- },
65
- {
66
- key: "wrap",
67
- className: "teddy-fw",
68
- values: P
69
- },
70
- {
71
- key: "direction",
72
- className: "teddy-fd",
73
- values: h
74
- },
75
- {
76
- key: "gridColumnStart",
77
- className: "teddy-gcs",
78
- values: R
79
- },
80
- {
81
- key: "gridColumnEnd",
82
- className: "teddy-gce",
83
- values: b
84
- },
85
- {
86
- key: "gridRowStart",
87
- className: "teddy-grs",
88
- values: E
89
- },
90
- {
91
- key: "gridRowEnd",
92
- className: "teddy-gre",
93
- values: S
94
- },
95
- {
96
- key: "gridColumn",
97
- className: "teddy-gc",
98
- values: j
99
- },
100
- ...p,
101
- ...g,
102
- ...f
20
+ values: G
21
+ }
22
+ ], f = [
23
+ ...k,
24
+ ...w,
25
+ ...j,
26
+ ...v,
27
+ ...L,
28
+ ...$,
29
+ ...P,
30
+ ...K,
31
+ ...b,
32
+ ...h,
33
+ ...V,
34
+ ...C
103
35
  ];
104
- function I(e) {
105
- const t = { className: "" };
106
- return Object.entries(e).map(([a, s]) => {
107
- const r = A.find((l) => l.key === a);
108
- return s !== null && r ? [
109
- "className",
110
- F({
111
- responsiveValue: s,
112
- rootClassName: `${r.className}`
113
- })
114
- ] : [a, s];
115
- }).reduce(
116
- (a, [s, r]) => typeof s != "string" ? a : s === "className" ? { ...a, [s]: m(a.className, r) } : { ...a, [s]: r },
117
- t
118
- );
36
+ function R(o) {
37
+ return typeof o == "object" && Object.keys(o).some((e) => F.includes(e));
119
38
  }
120
- function F({
121
- responsiveValue: e,
122
- rootClassName: t
123
- }) {
124
- if (!e)
125
- return [];
126
- if (typeof e == "object" && e !== null)
127
- return Object.entries(e).map(([l, d]) => {
128
- const i = `${t}`, u = `${l}:${t}--${c(d)}`;
129
- return [i, u];
130
- });
131
- const a = `${t}`, s = `${t}--${c(e)}`;
132
- return [a, s];
39
+ function u(...o) {
40
+ let e = {};
41
+ for (const s of o)
42
+ s && (e = { ...e, ...s });
43
+ return Object.keys(e).length ? e : void 0;
133
44
  }
134
- function c(e) {
135
- return typeof e == "string" && e.endsWith("%") ? e.replace("%", "p") : e;
45
+ function Q(o) {
46
+ var m;
47
+ const e = { ...o };
48
+ let s = e.style, r = e.className;
49
+ for (const d in f) {
50
+ const t = f[d], n = t.key, a = e[n];
51
+ if (a && (R(a) && Object.entries(a).forEach(([i, l]) => {
52
+ var p;
53
+ const c = ((p = t.values.find((g) => g.key === l)) == null ? void 0 : p.value) ?? l;
54
+ s = u(s, { [`--${t.className}-${i}`]: c });
55
+ const x = `${i}:${t.className}`;
56
+ r = y(r, x), delete e[n];
57
+ }), typeof a == "string")) {
58
+ const i = ((m = t.values.find((c) => c.key === a)) == null ? void 0 : m.value) ?? a;
59
+ s = u(s, { [`--${t.className}`]: i });
60
+ const l = `${t.className}`;
61
+ r = y(r, l), delete e[n];
62
+ }
63
+ }
64
+ return { ...e, className: r, style: s };
136
65
  }
137
66
  export {
138
- V as alignValues,
139
- w as displayFlexValues,
140
- N as displayGridValues,
141
- v as displayValues,
142
- I as extractPropsResponsiveLayout,
143
- F as extractResponsiveClassName,
144
- h as flexDirectionValues,
145
- P as flexWrapValues,
146
- o as gapValues,
147
- b as gridColumnEndValues,
148
- R as gridColumnStartValues,
149
- j as gridColumnValues,
150
- x as gridColumnsValues,
151
- $ as gridFlowValues,
152
- S as gridRowEndValues,
153
- E as gridRowStartValues,
154
- C as gridRowsValues,
155
- k as justifyValues
67
+ K as displayLayout,
68
+ G as displayValues,
69
+ Q as extractProps,
70
+ u as mergeStyles
156
71
  };
@@ -0,0 +1,39 @@
1
+ import { Responsive } from './util';
2
+
3
+ export declare const justifyValues: readonly [{
4
+ readonly key: "start";
5
+ readonly value: "flex-start";
6
+ }, {
7
+ readonly key: "center";
8
+ readonly value: "center";
9
+ }, {
10
+ readonly key: "end";
11
+ readonly value: "flex-end";
12
+ }, {
13
+ readonly key: "between";
14
+ readonly value: "space-between";
15
+ }];
16
+ export declare const justify: readonly [{
17
+ readonly key: "justify";
18
+ readonly className: "teddy-jc";
19
+ readonly values: readonly [{
20
+ readonly key: "start";
21
+ readonly value: "flex-start";
22
+ }, {
23
+ readonly key: "center";
24
+ readonly value: "center";
25
+ }, {
26
+ readonly key: "end";
27
+ readonly value: "flex-end";
28
+ }, {
29
+ readonly key: "between";
30
+ readonly value: "space-between";
31
+ }];
32
+ }];
33
+ /**
34
+ * The alignment of the grid items. It can be or a responsive value.
35
+ * A responsive value is an object with the keys 'sm', 'md', 'lg', 'xl' and a value for the corresponding breakpoint.
36
+ * @example align={{ sm: 'start', md: 'center' }}
37
+ * @default 'start'
38
+ */
39
+ export type Justify = Responsive<(typeof justifyValues)[number]['key']>;
@@ -0,0 +1,16 @@
1
+ const e = [
2
+ { key: "start", value: "flex-start" },
3
+ { key: "center", value: "center" },
4
+ { key: "end", value: "flex-end" },
5
+ { key: "between", value: "space-between" }
6
+ ], t = [
7
+ {
8
+ key: "justify",
9
+ className: "teddy-jc",
10
+ values: e
11
+ }
12
+ ];
13
+ export {
14
+ t as justify,
15
+ e as justifyValues
16
+ };