@telia/teddy 0.0.15 → 0.0.16

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 (116) hide show
  1. package/dist/components/accordion/accordion.d.ts +2 -1
  2. package/dist/components/accordion/accordion.js +90 -24
  3. package/dist/components/accordion/index.js +2 -2
  4. package/dist/components/badge/badge.js +40 -24
  5. package/dist/components/badge/index.js +2 -2
  6. package/dist/components/box/box.js +14 -10
  7. package/dist/components/box/index.js +2 -2
  8. package/dist/components/button/button.js +60 -52
  9. package/dist/components/button/index.js +2 -2
  10. package/dist/components/card/card.d.ts +29 -3
  11. package/dist/components/card/card.js +202 -25
  12. package/dist/components/card/index.js +2 -2
  13. package/dist/components/field-error-text/field-error-text.js +21 -19
  14. package/dist/components/field-error-text/index.js +2 -2
  15. package/dist/components/flex/flex.js +15 -12
  16. package/dist/components/flex/index.js +2 -2
  17. package/dist/components/grid/grid.js +15 -12
  18. package/dist/components/grid/index.js +2 -2
  19. package/dist/components/heading/heading.js +22 -19
  20. package/dist/components/heading/index.js +2 -2
  21. package/dist/components/helper-text/helper-text.js +14 -13
  22. package/dist/components/helper-text/index.js +2 -2
  23. package/dist/components/icon/icon.js +16 -14
  24. package/dist/components/icon/index.js +4 -4
  25. package/dist/components/index.js +51 -46
  26. package/dist/components/input/index.js +3 -3
  27. package/dist/components/input/input.js +79 -66
  28. package/dist/components/label/index.js +2 -2
  29. package/dist/components/label/label.js +17 -23
  30. package/dist/components/link/index.js +2 -2
  31. package/dist/components/link/link.js +20 -19
  32. package/dist/components/modal/index.js +2 -2
  33. package/dist/components/modal/modal.js +173 -14
  34. package/dist/components/navigation-menu/index.js +2 -2
  35. package/dist/components/navigation-menu/navigation-menu.js +391 -8
  36. package/dist/components/notification/index.js +2 -2
  37. package/dist/components/notification/notification.d.ts +8 -7
  38. package/dist/components/notification/notification.js +96 -24
  39. package/dist/components/radio-group/index.js +2 -2
  40. package/dist/components/radio-group/radio-group.js +91 -8
  41. package/dist/components/spinner/index.js +2 -2
  42. package/dist/components/spinner/spinner.js +36 -29
  43. package/dist/components/text/index.js +2 -2
  44. package/dist/components/text/text.js +18 -17
  45. package/dist/components/text-field/index.js +2 -2
  46. package/dist/components/text-field/text-field.js +110 -90
  47. package/dist/components/text-spacing/index.js +2 -2
  48. package/dist/components/text-spacing/text-spacing.js +14 -12
  49. package/dist/components/toggle/index.js +2 -2
  50. package/dist/components/toggle/toggle.d.ts +1 -1
  51. package/dist/components/toggle/toggle.js +84 -23
  52. package/dist/components/visually-hidden/index.js +2 -2
  53. package/dist/components/visually-hidden/visually-hidden.js +17 -15
  54. package/dist/icons/category.js +2 -2
  55. package/dist/icons/name.js +2 -2
  56. package/dist/main.js +359 -61
  57. package/dist/style.css +3402 -0
  58. package/dist/tokens/border/variables.js +18 -10
  59. package/dist/tokens/breakpoint/variables.js +8 -5
  60. package/dist/tokens/color/variables.js +452 -227
  61. package/dist/tokens/index.d.ts +7 -7
  62. package/dist/tokens/index.js +308 -14
  63. package/dist/tokens/motion/variables.js +22 -12
  64. package/dist/tokens/shadow/variables.js +8 -5
  65. package/dist/tokens/spacing/variables.js +46 -24
  66. package/dist/tokens/typography/variables.js +48 -25
  67. package/dist/utils/action.js +10 -7
  68. package/dist/utils/composeEventHandlers.js +7 -5
  69. package/dist/utils/composeRefs.js +13 -9
  70. package/dist/utils/layout/align.js +5 -4
  71. package/dist/utils/layout/flex.js +25 -18
  72. package/dist/utils/layout/gap.js +7 -6
  73. package/dist/utils/layout/grid.js +31 -24
  74. package/dist/utils/layout/height.js +12 -11
  75. package/dist/utils/layout/index.js +76 -59
  76. package/dist/utils/layout/inset.js +10 -9
  77. package/dist/utils/layout/justify.js +6 -5
  78. package/dist/utils/layout/margin.js +10 -9
  79. package/dist/utils/layout/padding.js +10 -9
  80. package/dist/utils/layout/position.js +6 -5
  81. package/dist/utils/layout/util.js +7 -6
  82. package/dist/utils/layout/width.js +8 -7
  83. package/package.json +21 -14
  84. package/dist/assets/badge.css +0 -1
  85. package/dist/assets/button.css +0 -1
  86. package/dist/assets/field-error-text.css +0 -1
  87. package/dist/assets/flex.css +0 -1
  88. package/dist/assets/grid.css +0 -1
  89. package/dist/assets/heading.css +0 -1
  90. package/dist/assets/helper-text.css +0 -1
  91. package/dist/assets/icon.css +0 -1
  92. package/dist/assets/input.css +0 -1
  93. package/dist/assets/label.css +0 -1
  94. package/dist/assets/link.css +0 -1
  95. package/dist/assets/main.css +0 -1
  96. package/dist/assets/navigation-menu.css +0 -1
  97. package/dist/assets/radio-group.css +0 -1
  98. package/dist/assets/spinner.css +0 -1
  99. package/dist/assets/text-field.css +0 -1
  100. package/dist/assets/text-spacing.css +0 -1
  101. package/dist/assets/text.css +0 -1
  102. package/dist/assets/visually-hidden.css +0 -1
  103. package/dist/badge-Cnug5TzH.js +0 -1855
  104. package/dist/clsx-DB4S2d7J.js +0 -22
  105. package/dist/index-DM5e-Whg.js +0 -43
  106. package/dist/index-DpfSJps6.js +0 -75
  107. package/dist/index-FPIZOCcD.js +0 -305
  108. package/dist/navigation-menu-DKuyW8zE.js +0 -1036
  109. package/dist/radio-group-B--zT3OL.js +0 -440
  110. package/dist/variables-BKiPmtHY.js +0 -458
  111. package/dist/variables-BkY5b0io.js +0 -14
  112. package/dist/variables-Bq0YUbLS.js +0 -14
  113. package/dist/variables-CDK515QX.js +0 -52
  114. package/dist/variables-CMRTN8qo.js +0 -28
  115. package/dist/variables-Dmoh9YtD.js +0 -54
  116. package/dist/variables-IczXZ5CN.js +0 -24
@@ -1,22 +0,0 @@
1
- function a(r) {
2
- var f, n, t = "";
3
- if (typeof r == "string" || typeof r == "number")
4
- t += r;
5
- else if (typeof r == "object")
6
- if (Array.isArray(r)) {
7
- var o = r.length;
8
- for (f = 0; f < o; f++)
9
- r[f] && (n = a(r[f])) && (t && (t += " "), t += n);
10
- } else
11
- for (n in r)
12
- r[n] && (t && (t += " "), t += n);
13
- return t;
14
- }
15
- function i() {
16
- for (var r, f, n = 0, t = "", o = arguments.length; n < o; n++)
17
- (r = arguments[n]) && (f = a(r)) && (t && (t += " "), t += f);
18
- return t;
19
- }
20
- export {
21
- i as c
22
- };
@@ -1,43 +0,0 @@
1
- import { _ as s, $ as n } from "./index-DpfSJps6.js";
2
- import { forwardRef as d, useEffect as p, createElement as $ } from "react";
3
- import { flushSync as m } from "react-dom";
4
- const l = [
5
- "a",
6
- "button",
7
- "div",
8
- "form",
9
- "h2",
10
- "h3",
11
- "img",
12
- "input",
13
- "label",
14
- "li",
15
- "nav",
16
- "ol",
17
- "p",
18
- "span",
19
- "svg",
20
- "ul"
21
- ], x = l.reduce((f, e) => {
22
- const r = /* @__PURE__ */ d((c, t) => {
23
- const { asChild: o, ...a } = c, i = o ? n : e;
24
- return p(() => {
25
- window[Symbol.for("radix-ui")] = !0;
26
- }, []), /* @__PURE__ */ $(i, s({}, a, {
27
- ref: t
28
- }));
29
- });
30
- return r.displayName = `Primitive.${e}`, {
31
- ...f,
32
- [e]: r
33
- };
34
- }, {});
35
- function b(f, e) {
36
- f && m(
37
- () => f.dispatchEvent(e)
38
- );
39
- }
40
- export {
41
- x as $,
42
- b as a
43
- };
@@ -1,75 +0,0 @@
1
- import { useCallback as h, forwardRef as $, Children as s, isValidElement as a, createElement as u, cloneElement as m, Fragment as y } from "react";
2
- function f() {
3
- return f = Object.assign ? Object.assign.bind() : function(e) {
4
- for (var t = 1; t < arguments.length; t++) {
5
- var n = arguments[t];
6
- for (var r in n)
7
- Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
8
- }
9
- return e;
10
- }, f.apply(this, arguments);
11
- }
12
- function v(e, t) {
13
- typeof e == "function" ? e(t) : e != null && (e.current = t);
14
- }
15
- function b(...e) {
16
- return (t) => e.forEach(
17
- (n) => v(n, t)
18
- );
19
- }
20
- function N(...e) {
21
- return h(b(...e), e);
22
- }
23
- const g = /* @__PURE__ */ $((e, t) => {
24
- const { children: n, ...r } = e, c = s.toArray(n), o = c.find(C);
25
- if (o) {
26
- const l = o.props.children, i = c.map((p) => p === o ? s.count(l) > 1 ? s.only(null) : /* @__PURE__ */ a(l) ? l.props.children : null : p);
27
- return /* @__PURE__ */ u(d, f({}, r, {
28
- ref: t
29
- }), /* @__PURE__ */ a(l) ? /* @__PURE__ */ m(l, void 0, i) : null);
30
- }
31
- return /* @__PURE__ */ u(d, f({}, r, {
32
- ref: t
33
- }), n);
34
- });
35
- g.displayName = "Slot";
36
- const d = /* @__PURE__ */ $((e, t) => {
37
- const { children: n, ...r } = e;
38
- return /* @__PURE__ */ a(n) ? /* @__PURE__ */ m(n, {
39
- ...E(r, n.props),
40
- ref: t ? b(t, n.ref) : n.ref
41
- }) : s.count(n) > 1 ? s.only(null) : null;
42
- });
43
- d.displayName = "SlotClone";
44
- const x = ({ children: e }) => /* @__PURE__ */ u(y, null, e);
45
- function C(e) {
46
- return /* @__PURE__ */ a(e) && e.type === x;
47
- }
48
- function E(e, t) {
49
- const n = {
50
- ...t
51
- };
52
- for (const r in t) {
53
- const c = e[r], o = t[r];
54
- /^on[A-Z]/.test(r) ? c && o ? n[r] = (...i) => {
55
- o(...i), c(...i);
56
- } : c && (n[r] = c) : r === "style" ? n[r] = {
57
- ...c,
58
- ...o
59
- } : r === "className" && (n[r] = [
60
- c,
61
- o
62
- ].filter(Boolean).join(" "));
63
- }
64
- return {
65
- ...e,
66
- ...n
67
- };
68
- }
69
- export {
70
- g as $,
71
- f as _,
72
- x as a,
73
- N as b,
74
- b as c
75
- };
@@ -1,305 +0,0 @@
1
- import * as I from "react";
2
- import v, { createContext as M, useMemo as x, createElement as D, useContext as O, useLayoutEffect as w, useRef as h, useEffect as T, useCallback as _, useState as y, Children as k, cloneElement as B, useReducer as j } from "react";
3
- import { flushSync as q } from "react-dom";
4
- import { b as P, $ as g } from "./index-DpfSJps6.js";
5
- function ee(e, n, { checkForDefaultPrevented: o = !0 } = {}) {
6
- return function(c) {
7
- if (e == null || e(c), o === !1 || !c.defaultPrevented)
8
- return n == null ? void 0 : n(c);
9
- };
10
- }
11
- function F(e, n = []) {
12
- let o = [];
13
- function t(s, a) {
14
- const u = /* @__PURE__ */ M(a), i = o.length;
15
- o = [
16
- ...o,
17
- a
18
- ];
19
- function r(d) {
20
- const { scope: $, children: f, ...l } = d, b = ($ == null ? void 0 : $[e][i]) || u, p = x(
21
- () => l,
22
- Object.values(l)
23
- );
24
- return /* @__PURE__ */ D(b.Provider, {
25
- value: p
26
- }, f);
27
- }
28
- function m(d, $) {
29
- const f = ($ == null ? void 0 : $[e][i]) || u, l = O(f);
30
- if (l)
31
- return l;
32
- if (a !== void 0)
33
- return a;
34
- throw new Error(`\`${d}\` must be used within \`${s}\``);
35
- }
36
- return r.displayName = s + "Provider", [
37
- r,
38
- m
39
- ];
40
- }
41
- const c = () => {
42
- const s = o.map((a) => /* @__PURE__ */ M(a));
43
- return function(u) {
44
- const i = (u == null ? void 0 : u[e]) || s;
45
- return x(
46
- () => ({
47
- [`__scope${e}`]: {
48
- ...u,
49
- [e]: i
50
- }
51
- }),
52
- [
53
- u,
54
- i
55
- ]
56
- );
57
- };
58
- };
59
- return c.scopeName = e, [
60
- t,
61
- z(c, ...n)
62
- ];
63
- }
64
- function z(...e) {
65
- const n = e[0];
66
- if (e.length === 1)
67
- return n;
68
- const o = () => {
69
- const t = e.map(
70
- (c) => ({
71
- useScope: c(),
72
- scopeName: c.scopeName
73
- })
74
- );
75
- return function(s) {
76
- const a = t.reduce((u, { useScope: i, scopeName: r }) => {
77
- const d = i(s)[`__scope${r}`];
78
- return {
79
- ...u,
80
- ...d
81
- };
82
- }, {});
83
- return x(
84
- () => ({
85
- [`__scope${n.scopeName}`]: a
86
- }),
87
- [
88
- a
89
- ]
90
- );
91
- };
92
- };
93
- return o.scopeName = n.scopeName, o;
94
- }
95
- const R = globalThis != null && globalThis.document ? w : () => {
96
- }, G = I.useId || (() => {
97
- });
98
- let J = 0;
99
- function ne(e) {
100
- const [n, o] = I.useState(G());
101
- return R(() => {
102
- e || o(
103
- (t) => t ?? String(J++)
104
- );
105
- }, [
106
- e
107
- ]), e || (n ? `radix-${n}` : "");
108
- }
109
- function U(e) {
110
- const n = h(e);
111
- return T(() => {
112
- n.current = e;
113
- }), x(
114
- () => (...o) => {
115
- var t;
116
- return (t = n.current) === null || t === void 0 ? void 0 : t.call(n, ...o);
117
- },
118
- []
119
- );
120
- }
121
- function te({ prop: e, defaultProp: n, onChange: o = () => {
122
- } }) {
123
- const [t, c] = K({
124
- defaultProp: n,
125
- onChange: o
126
- }), s = e !== void 0, a = s ? e : t, u = U(o), i = _((r) => {
127
- if (s) {
128
- const d = typeof r == "function" ? r(e) : r;
129
- d !== e && u(d);
130
- } else
131
- c(r);
132
- }, [
133
- s,
134
- e,
135
- c,
136
- u
137
- ]);
138
- return [
139
- a,
140
- i
141
- ];
142
- }
143
- function K({ defaultProp: e, onChange: n }) {
144
- const o = y(e), [t] = o, c = h(t), s = U(n);
145
- return T(() => {
146
- c.current !== t && (s(t), c.current = t);
147
- }, [
148
- t,
149
- c,
150
- s
151
- ]), o;
152
- }
153
- function Q(e, n) {
154
- return j((o, t) => {
155
- const c = n[o][t];
156
- return c ?? o;
157
- }, e);
158
- }
159
- const V = (e) => {
160
- const { present: n, children: o } = e, t = W(n), c = typeof o == "function" ? o({
161
- present: t.isPresent
162
- }) : k.only(o), s = P(t.ref, c.ref);
163
- return typeof o == "function" || t.isPresent ? /* @__PURE__ */ B(c, {
164
- ref: s
165
- }) : null;
166
- };
167
- V.displayName = "Presence";
168
- function W(e) {
169
- const [n, o] = y(), t = h({}), c = h(e), s = h("none"), a = e ? "mounted" : "unmounted", [u, i] = Q(a, {
170
- mounted: {
171
- UNMOUNT: "unmounted",
172
- ANIMATION_OUT: "unmountSuspended"
173
- },
174
- unmountSuspended: {
175
- MOUNT: "mounted",
176
- ANIMATION_END: "unmounted"
177
- },
178
- unmounted: {
179
- MOUNT: "mounted"
180
- }
181
- });
182
- return T(() => {
183
- const r = A(t.current);
184
- s.current = u === "mounted" ? r : "none";
185
- }, [
186
- u
187
- ]), R(() => {
188
- const r = t.current, m = c.current;
189
- if (m !== e) {
190
- const $ = s.current, f = A(r);
191
- e ? i("MOUNT") : f === "none" || (r == null ? void 0 : r.display) === "none" ? i("UNMOUNT") : i(m && $ !== f ? "ANIMATION_OUT" : "UNMOUNT"), c.current = e;
192
- }
193
- }, [
194
- e,
195
- i
196
- ]), R(() => {
197
- if (n) {
198
- const r = (d) => {
199
- const f = A(t.current).includes(d.animationName);
200
- d.target === n && f && q(
201
- () => i("ANIMATION_END")
202
- );
203
- }, m = (d) => {
204
- d.target === n && (s.current = A(t.current));
205
- };
206
- return n.addEventListener("animationstart", m), n.addEventListener("animationcancel", r), n.addEventListener("animationend", r), () => {
207
- n.removeEventListener("animationstart", m), n.removeEventListener("animationcancel", r), n.removeEventListener("animationend", r);
208
- };
209
- } else
210
- i("ANIMATION_END");
211
- }, [
212
- n,
213
- i
214
- ]), {
215
- isPresent: [
216
- "mounted",
217
- "unmountSuspended"
218
- ].includes(u),
219
- ref: _((r) => {
220
- r && (t.current = getComputedStyle(r)), o(r);
221
- }, [])
222
- };
223
- }
224
- function A(e) {
225
- return (e == null ? void 0 : e.animationName) || "none";
226
- }
227
- function oe(e) {
228
- const n = e + "CollectionProvider", [o, t] = F(n), [c, s] = o(n, {
229
- collectionRef: {
230
- current: null
231
- },
232
- itemMap: /* @__PURE__ */ new Map()
233
- }), a = (f) => {
234
- const { scope: l, children: b } = f, p = v.useRef(null), N = v.useRef(/* @__PURE__ */ new Map()).current;
235
- return /* @__PURE__ */ v.createElement(c, {
236
- scope: l,
237
- itemMap: N,
238
- collectionRef: p
239
- }, b);
240
- }, u = e + "CollectionSlot", i = /* @__PURE__ */ v.forwardRef((f, l) => {
241
- const { scope: b, children: p } = f, N = s(u, b), C = P(l, N.collectionRef);
242
- return /* @__PURE__ */ v.createElement(g, {
243
- ref: C
244
- }, p);
245
- }), r = e + "CollectionItemSlot", m = "data-radix-collection-item", d = /* @__PURE__ */ v.forwardRef((f, l) => {
246
- const { scope: b, children: p, ...N } = f, C = v.useRef(null), E = P(l, C), S = s(r, b);
247
- return v.useEffect(() => (S.itemMap.set(C, {
248
- ref: C,
249
- ...N
250
- }), () => void S.itemMap.delete(C))), /* @__PURE__ */ v.createElement(g, {
251
- [m]: "",
252
- ref: E
253
- }, p);
254
- });
255
- function $(f) {
256
- const l = s(e + "CollectionConsumer", f);
257
- return v.useCallback(() => {
258
- const p = l.collectionRef.current;
259
- if (!p)
260
- return [];
261
- const N = Array.from(p.querySelectorAll(`[${m}]`));
262
- return Array.from(l.itemMap.values()).sort(
263
- (S, L) => N.indexOf(S.ref.current) - N.indexOf(L.ref.current)
264
- );
265
- }, [
266
- l.collectionRef,
267
- l.itemMap
268
- ]);
269
- }
270
- return [
271
- {
272
- Provider: a,
273
- Slot: i,
274
- ItemSlot: d
275
- },
276
- $,
277
- t
278
- ];
279
- }
280
- const X = /* @__PURE__ */ M(void 0);
281
- function ce(e) {
282
- const n = O(X);
283
- return e || n || "ltr";
284
- }
285
- function re(e) {
286
- const n = h({
287
- value: e,
288
- previous: e
289
- });
290
- return x(() => (n.current.value !== e && (n.current.previous = n.current.value, n.current.value = e), n.current.previous), [
291
- e
292
- ]);
293
- }
294
- export {
295
- oe as $,
296
- F as a,
297
- ce as b,
298
- te as c,
299
- U as d,
300
- ee as e,
301
- ne as f,
302
- R as g,
303
- V as h,
304
- re as i
305
- };