@x-plat/design-system 0.13.0 → 0.14.1

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 (43) hide show
  1. package/dist/{breakpoints-DsXkJgdl.d.cts → breakpoints-CKkNxA-y.d.cts} +1 -1
  2. package/dist/{breakpoints-DsXkJgdl.d.ts → breakpoints-CKkNxA-y.d.ts} +1 -1
  3. package/dist/components/Badge/index.d.cts +1 -1
  4. package/dist/components/Badge/index.d.ts +1 -1
  5. package/dist/components/Dropdown/index.cjs +5 -15
  6. package/dist/components/Dropdown/index.css +0 -3
  7. package/dist/components/Dropdown/index.js +5 -15
  8. package/dist/components/PopOver/index.cjs +3 -14
  9. package/dist/components/PopOver/index.css +0 -3
  10. package/dist/components/PopOver/index.js +3 -14
  11. package/dist/components/Select/index.cjs +4 -14
  12. package/dist/components/Select/index.css +0 -3
  13. package/dist/components/Select/index.js +4 -14
  14. package/dist/components/TimePicker/index.cjs +4 -14
  15. package/dist/components/TimePicker/index.css +0 -3
  16. package/dist/components/TimePicker/index.js +4 -14
  17. package/dist/components/ToggleChip/index.cjs +69 -0
  18. package/dist/components/ToggleChip/index.css +102 -0
  19. package/dist/components/ToggleChip/index.d.cts +37 -0
  20. package/dist/components/ToggleChip/index.d.ts +37 -0
  21. package/dist/components/ToggleChip/index.js +42 -0
  22. package/dist/components/index.cjs +69 -54
  23. package/dist/components/index.css +37 -12
  24. package/dist/components/index.d.cts +2 -1
  25. package/dist/components/index.d.ts +2 -1
  26. package/dist/components/index.js +59 -45
  27. package/dist/index.cjs +88 -73
  28. package/dist/index.css +37 -12
  29. package/dist/index.d.cts +4 -3
  30. package/dist/index.d.ts +4 -3
  31. package/dist/index.js +76 -62
  32. package/dist/layout/Grid/Item/index.d.cts +1 -1
  33. package/dist/layout/Grid/Item/index.d.ts +1 -1
  34. package/dist/layout/Grid/index.d.cts +1 -1
  35. package/dist/layout/Grid/index.d.ts +1 -1
  36. package/dist/layout/index.d.cts +1 -1
  37. package/dist/layout/index.d.ts +1 -1
  38. package/dist/tokens/index.d.cts +1 -1
  39. package/dist/tokens/index.d.ts +1 -1
  40. package/guidelines/Guidelines.md +1 -1
  41. package/guidelines/MIGRATION.md +51 -0
  42. package/guidelines/components/chip-tag.md +80 -2
  43. package/package.json +1 -1
@@ -32,4 +32,4 @@ type GridColumnConfig = {
32
32
  [K in BreakpointKey]?: GridSpanFor<K>;
33
33
  };
34
34
 
35
- export { BREAKPOINT_KEYS_ORDERED as B, type GridSpanFor as G, type BreakpointKey as a, type GridColumnConfig as b, breakpoints as c, gridColumns as g };
35
+ export { BREAKPOINT_KEYS_ORDERED as B, type GridColumnConfig as G, type BreakpointKey as a, type GridSpanFor as b, breakpoints as c, gridColumns as g };
@@ -32,4 +32,4 @@ type GridColumnConfig = {
32
32
  [K in BreakpointKey]?: GridSpanFor<K>;
33
33
  };
34
34
 
35
- export { BREAKPOINT_KEYS_ORDERED as B, type GridSpanFor as G, type BreakpointKey as a, type GridColumnConfig as b, breakpoints as c, gridColumns as g };
35
+ export { BREAKPOINT_KEYS_ORDERED as B, type GridColumnConfig as G, type BreakpointKey as a, type GridSpanFor as b, breakpoints as c, gridColumns as g };
@@ -1,4 +1,4 @@
1
- export { NotificationBadge as Badge, NotificationBadge, NotificationBadge as default } from '../NotificationBadge/index.cjs';
1
+ export { Badge, Badge as NotificationBadge, Badge as default } from '../NotificationBadge/index.cjs';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '../../status-njWqQWFV.cjs';
@@ -1,4 +1,4 @@
1
- export { NotificationBadge as Badge, NotificationBadge, NotificationBadge as default } from '../NotificationBadge/index.js';
1
+ export { Badge, Badge as NotificationBadge, Badge as default } from '../NotificationBadge/index.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '../../status-njWqQWFV.js';
@@ -51,10 +51,8 @@ var import_react = __toESM(require("react"), 1);
51
51
  var useAutoPosition = (triggerRef, popRef, enabled = true) => {
52
52
  const [position, setPosition] = import_react.default.useState({
53
53
  position: {},
54
- direction: "bottom",
55
- repositioning: false
54
+ direction: "bottom"
56
55
  });
57
- const placedRef = import_react.default.useRef(false);
58
56
  const calculatePosition = import_react.default.useCallback(() => {
59
57
  if (!triggerRef.current || !popRef.current) return;
60
58
  const triggerRect = triggerRef.current.getBoundingClientRect();
@@ -77,18 +75,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
77
75
  left = triggerRect.right - popW;
78
76
  }
79
77
  if (left < 8) left = 8;
80
- setPosition({
81
- position: { top, left },
82
- direction,
83
- repositioning: placedRef.current
84
- });
85
- placedRef.current = true;
78
+ setPosition({ position: { top, left }, direction });
86
79
  }, [triggerRef, popRef]);
87
80
  import_react.default.useLayoutEffect(() => {
88
- if (!enabled) {
89
- placedRef.current = false;
90
- return;
91
- }
81
+ if (!enabled) return;
92
82
  calculatePosition();
93
83
  const raf = requestAnimationFrame(calculatePosition);
94
84
  return () => cancelAnimationFrame(raf);
@@ -194,7 +184,7 @@ var Dropdown = (props) => {
194
184
  const [visible, setVisible] = import_react4.default.useState(false);
195
185
  const triggerRef = import_react4.default.useRef(null);
196
186
  const menuRef = import_react4.default.useRef(null);
197
- const { position, direction, repositioning } = useAutoPosition_default(triggerRef, menuRef, mounted);
187
+ const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
198
188
  useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
199
189
  useEscapeKey(isOpen, () => {
200
190
  setIsOpen(false);
@@ -229,7 +219,7 @@ var Dropdown = (props) => {
229
219
  "div",
230
220
  {
231
221
  ref: menuRef,
232
- className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }, repositioning && "repositioning"),
222
+ className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
233
223
  style: { top: position.top, left: position.left },
234
224
  role: "menu",
235
225
  children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -57,6 +57,3 @@
57
57
  color: var(--semantic-text-disabled);
58
58
  cursor: not-allowed;
59
59
  }
60
- .lib-xplat-dropdown-menu.repositioning {
61
- transition: none;
62
- }
@@ -15,10 +15,8 @@ import React from "react";
15
15
  var useAutoPosition = (triggerRef, popRef, enabled = true) => {
16
16
  const [position, setPosition] = React.useState({
17
17
  position: {},
18
- direction: "bottom",
19
- repositioning: false
18
+ direction: "bottom"
20
19
  });
21
- const placedRef = React.useRef(false);
22
20
  const calculatePosition = React.useCallback(() => {
23
21
  if (!triggerRef.current || !popRef.current) return;
24
22
  const triggerRect = triggerRef.current.getBoundingClientRect();
@@ -41,18 +39,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
41
39
  left = triggerRect.right - popW;
42
40
  }
43
41
  if (left < 8) left = 8;
44
- setPosition({
45
- position: { top, left },
46
- direction,
47
- repositioning: placedRef.current
48
- });
49
- placedRef.current = true;
42
+ setPosition({ position: { top, left }, direction });
50
43
  }, [triggerRef, popRef]);
51
44
  React.useLayoutEffect(() => {
52
- if (!enabled) {
53
- placedRef.current = false;
54
- return;
55
- }
45
+ if (!enabled) return;
56
46
  calculatePosition();
57
47
  const raf = requestAnimationFrame(calculatePosition);
58
48
  return () => cancelAnimationFrame(raf);
@@ -158,7 +148,7 @@ var Dropdown = (props) => {
158
148
  const [visible, setVisible] = React4.useState(false);
159
149
  const triggerRef = React4.useRef(null);
160
150
  const menuRef = React4.useRef(null);
161
- const { position, direction, repositioning } = useAutoPosition_default(triggerRef, menuRef, mounted);
151
+ const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
162
152
  useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
163
153
  useEscapeKey(isOpen, () => {
164
154
  setIsOpen(false);
@@ -193,7 +183,7 @@ var Dropdown = (props) => {
193
183
  "div",
194
184
  {
195
185
  ref: menuRef,
196
- className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }, repositioning && "repositioning"),
186
+ className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
197
187
  style: { top: position.top, left: position.left },
198
188
  role: "menu",
199
189
  children: items.map((item) => /* @__PURE__ */ jsx(
@@ -51,10 +51,8 @@ var import_react = __toESM(require("react"), 1);
51
51
  var useAutoPosition = (triggerRef, popRef, enabled = true) => {
52
52
  const [position, setPosition] = import_react.default.useState({
53
53
  position: {},
54
- direction: "bottom",
55
- repositioning: false
54
+ direction: "bottom"
56
55
  });
57
- const placedRef = import_react.default.useRef(false);
58
56
  const calculatePosition = import_react.default.useCallback(() => {
59
57
  if (!triggerRef.current || !popRef.current) return;
60
58
  const triggerRect = triggerRef.current.getBoundingClientRect();
@@ -77,18 +75,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
77
75
  left = triggerRect.right - popW;
78
76
  }
79
77
  if (left < 8) left = 8;
80
- setPosition({
81
- position: { top, left },
82
- direction,
83
- repositioning: placedRef.current
84
- });
85
- placedRef.current = true;
78
+ setPosition({ position: { top, left }, direction });
86
79
  }, [triggerRef, popRef]);
87
80
  import_react.default.useLayoutEffect(() => {
88
- if (!enabled) {
89
- placedRef.current = false;
90
- return;
91
- }
81
+ if (!enabled) return;
92
82
  calculatePosition();
93
83
  const raf = requestAnimationFrame(calculatePosition);
94
84
  return () => cancelAnimationFrame(raf);
@@ -228,7 +218,6 @@ var PopOver = (props) => {
228
218
  className: clsx_default(
229
219
  "lib-xplat-pop-over-content",
230
220
  position.direction,
231
- position.repositioning && "repositioning",
232
221
  eventTrigger && "visible"
233
222
  ),
234
223
  ref: popRef,
@@ -27,6 +27,3 @@
27
27
  opacity: 1;
28
28
  transform: scale(1);
29
29
  }
30
- .lib-xplat-pop-over-content.repositioning {
31
- transition: none;
32
- }
@@ -15,10 +15,8 @@ import React from "react";
15
15
  var useAutoPosition = (triggerRef, popRef, enabled = true) => {
16
16
  const [position, setPosition] = React.useState({
17
17
  position: {},
18
- direction: "bottom",
19
- repositioning: false
18
+ direction: "bottom"
20
19
  });
21
- const placedRef = React.useRef(false);
22
20
  const calculatePosition = React.useCallback(() => {
23
21
  if (!triggerRef.current || !popRef.current) return;
24
22
  const triggerRect = triggerRef.current.getBoundingClientRect();
@@ -41,18 +39,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
41
39
  left = triggerRect.right - popW;
42
40
  }
43
41
  if (left < 8) left = 8;
44
- setPosition({
45
- position: { top, left },
46
- direction,
47
- repositioning: placedRef.current
48
- });
49
- placedRef.current = true;
42
+ setPosition({ position: { top, left }, direction });
50
43
  }, [triggerRef, popRef]);
51
44
  React.useLayoutEffect(() => {
52
- if (!enabled) {
53
- placedRef.current = false;
54
- return;
55
- }
45
+ if (!enabled) return;
56
46
  calculatePosition();
57
47
  const raf = requestAnimationFrame(calculatePosition);
58
48
  return () => cancelAnimationFrame(raf);
@@ -192,7 +182,6 @@ var PopOver = (props) => {
192
182
  className: clsx_default(
193
183
  "lib-xplat-pop-over-content",
194
184
  position.direction,
195
- position.repositioning && "repositioning",
196
185
  eventTrigger && "visible"
197
186
  ),
198
187
  ref: popRef,
@@ -52,10 +52,8 @@ var import_react = __toESM(require("react"), 1);
52
52
  var useAutoPosition = (triggerRef, popRef, enabled = true) => {
53
53
  const [position, setPosition] = import_react.default.useState({
54
54
  position: {},
55
- direction: "bottom",
56
- repositioning: false
55
+ direction: "bottom"
57
56
  });
58
- const placedRef = import_react.default.useRef(false);
59
57
  const calculatePosition = import_react.default.useCallback(() => {
60
58
  if (!triggerRef.current || !popRef.current) return;
61
59
  const triggerRect = triggerRef.current.getBoundingClientRect();
@@ -78,18 +76,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
78
76
  left = triggerRect.right - popW;
79
77
  }
80
78
  if (left < 8) left = 8;
81
- setPosition({
82
- position: { top, left },
83
- direction,
84
- repositioning: placedRef.current
85
- });
86
- placedRef.current = true;
79
+ setPosition({ position: { top, left }, direction });
87
80
  }, [triggerRef, popRef]);
88
81
  import_react.default.useLayoutEffect(() => {
89
- if (!enabled) {
90
- placedRef.current = false;
91
- return;
92
- }
82
+ if (!enabled) return;
93
83
  calculatePosition();
94
84
  const raf = requestAnimationFrame(calculatePosition);
95
85
  return () => cancelAnimationFrame(raf);
@@ -1422,7 +1412,7 @@ var SelectRoot = (props) => {
1422
1412
  mounted && /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime297.jsxs)(
1423
1413
  "div",
1424
1414
  {
1425
- className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass, position.repositioning && "repositioning"),
1415
+ className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
1426
1416
  ref: contentRef,
1427
1417
  style: { ...position.position, width: triggerRef.current?.offsetWidth },
1428
1418
  role: "listbox",
@@ -273,6 +273,3 @@
273
273
  cursor: not-allowed;
274
274
  color: var(--semantic-text-disabled);
275
275
  }
276
- .lib-xplat-select-content.repositioning {
277
- transition: none;
278
- }
@@ -15,10 +15,8 @@ import React from "react";
15
15
  var useAutoPosition = (triggerRef, popRef, enabled = true) => {
16
16
  const [position, setPosition] = React.useState({
17
17
  position: {},
18
- direction: "bottom",
19
- repositioning: false
18
+ direction: "bottom"
20
19
  });
21
- const placedRef = React.useRef(false);
22
20
  const calculatePosition = React.useCallback(() => {
23
21
  if (!triggerRef.current || !popRef.current) return;
24
22
  const triggerRect = triggerRef.current.getBoundingClientRect();
@@ -41,18 +39,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
41
39
  left = triggerRect.right - popW;
42
40
  }
43
41
  if (left < 8) left = 8;
44
- setPosition({
45
- position: { top, left },
46
- direction,
47
- repositioning: placedRef.current
48
- });
49
- placedRef.current = true;
42
+ setPosition({ position: { top, left }, direction });
50
43
  }, [triggerRef, popRef]);
51
44
  React.useLayoutEffect(() => {
52
- if (!enabled) {
53
- placedRef.current = false;
54
- return;
55
- }
45
+ if (!enabled) return;
56
46
  calculatePosition();
57
47
  const raf = requestAnimationFrame(calculatePosition);
58
48
  return () => cancelAnimationFrame(raf);
@@ -1385,7 +1375,7 @@ var SelectRoot = (props) => {
1385
1375
  mounted && /* @__PURE__ */ jsx297(Portal_default, { children: /* @__PURE__ */ jsxs190(
1386
1376
  "div",
1387
1377
  {
1388
- className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass, position.repositioning && "repositioning"),
1378
+ className: clsx_default("lib-xplat-select-content", size, position.direction, stateClass),
1389
1379
  ref: contentRef,
1390
1380
  style: { ...position.position, width: triggerRef.current?.offsetWidth },
1391
1381
  role: "listbox",
@@ -51,10 +51,8 @@ var import_react = __toESM(require("react"), 1);
51
51
  var useAutoPosition = (triggerRef, popRef, enabled = true) => {
52
52
  const [position, setPosition] = import_react.default.useState({
53
53
  position: {},
54
- direction: "bottom",
55
- repositioning: false
54
+ direction: "bottom"
56
55
  });
57
- const placedRef = import_react.default.useRef(false);
58
56
  const calculatePosition = import_react.default.useCallback(() => {
59
57
  if (!triggerRef.current || !popRef.current) return;
60
58
  const triggerRect = triggerRef.current.getBoundingClientRect();
@@ -77,18 +75,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
77
75
  left = triggerRect.right - popW;
78
76
  }
79
77
  if (left < 8) left = 8;
80
- setPosition({
81
- position: { top, left },
82
- direction,
83
- repositioning: placedRef.current
84
- });
85
- placedRef.current = true;
78
+ setPosition({ position: { top, left }, direction });
86
79
  }, [triggerRef, popRef]);
87
80
  import_react.default.useLayoutEffect(() => {
88
- if (!enabled) {
89
- placedRef.current = false;
90
- return;
91
- }
81
+ if (!enabled) return;
92
82
  calculatePosition();
93
83
  const raf = requestAnimationFrame(calculatePosition);
94
84
  return () => cancelAnimationFrame(raf);
@@ -427,7 +417,7 @@ var TimePicker = (props) => {
427
417
  "div",
428
418
  {
429
419
  ref: contentRef,
430
- className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit", position.repositioning && "repositioning"),
420
+ className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
431
421
  style: { ...position.position, width: triggerRef.current?.offsetWidth },
432
422
  role: "listbox",
433
423
  children: options.map((t) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -170,6 +170,3 @@
170
170
  font-weight: var(--semantic-typo-label-1-m-weight);
171
171
  letter-spacing: var(--semantic-typo-label-1-m-ls);
172
172
  }
173
- .lib-xplat-time-picker-content.repositioning {
174
- transition: none;
175
- }
@@ -15,10 +15,8 @@ import React from "react";
15
15
  var useAutoPosition = (triggerRef, popRef, enabled = true) => {
16
16
  const [position, setPosition] = React.useState({
17
17
  position: {},
18
- direction: "bottom",
19
- repositioning: false
18
+ direction: "bottom"
20
19
  });
21
- const placedRef = React.useRef(false);
22
20
  const calculatePosition = React.useCallback(() => {
23
21
  if (!triggerRef.current || !popRef.current) return;
24
22
  const triggerRect = triggerRef.current.getBoundingClientRect();
@@ -41,18 +39,10 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
41
39
  left = triggerRect.right - popW;
42
40
  }
43
41
  if (left < 8) left = 8;
44
- setPosition({
45
- position: { top, left },
46
- direction,
47
- repositioning: placedRef.current
48
- });
49
- placedRef.current = true;
42
+ setPosition({ position: { top, left }, direction });
50
43
  }, [triggerRef, popRef]);
51
44
  React.useLayoutEffect(() => {
52
- if (!enabled) {
53
- placedRef.current = false;
54
- return;
55
- }
45
+ if (!enabled) return;
56
46
  calculatePosition();
57
47
  const raf = requestAnimationFrame(calculatePosition);
58
48
  return () => cancelAnimationFrame(raf);
@@ -391,7 +381,7 @@ var TimePicker = (props) => {
391
381
  "div",
392
382
  {
393
383
  ref: contentRef,
394
- className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit", position.repositioning && "repositioning"),
384
+ className: clsx_default("lib-xplat-time-picker-content", size, visible ? "enter" : "exit"),
395
385
  style: { ...position.position, width: triggerRef.current?.offsetWidth },
396
386
  role: "listbox",
397
387
  children: options.map((t) => /* @__PURE__ */ jsx5(
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/ToggleChip/index.ts
21
+ var ToggleChip_exports = {};
22
+ __export(ToggleChip_exports, {
23
+ ToggleChip: () => ToggleChip_default
24
+ });
25
+ module.exports = __toCommonJS(ToggleChip_exports);
26
+
27
+ // ../../node_modules/clsx/dist/clsx.mjs
28
+ function r(e) {
29
+ var t, f, n = "";
30
+ if ("string" == typeof e || "number" == typeof e) n += e;
31
+ else if ("object" == typeof e) if (Array.isArray(e)) {
32
+ var o = e.length;
33
+ for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
34
+ } else for (f in e) e[f] && (n && (n += " "), n += f);
35
+ return n;
36
+ }
37
+ function clsx() {
38
+ for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
39
+ return n;
40
+ }
41
+ var clsx_default = clsx;
42
+
43
+ // src/components/ToggleChip/ToggleChip.tsx
44
+ var import_jsx_runtime = require("react/jsx-runtime");
45
+ var ToggleChip = (props) => {
46
+ const { children, selected = false, onClick, disabled = false, size = "md" } = props;
47
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48
+ "button",
49
+ {
50
+ type: "button",
51
+ className: clsx_default(
52
+ "lib-xplat-chip",
53
+ "lib-xplat-toggle-chip",
54
+ size,
55
+ selected ? "selected" : "unselected"
56
+ ),
57
+ "aria-pressed": selected,
58
+ disabled,
59
+ onClick,
60
+ children
61
+ }
62
+ );
63
+ };
64
+ ToggleChip.displayName = "ToggleChip";
65
+ var ToggleChip_default = ToggleChip;
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ ToggleChip
69
+ });
@@ -0,0 +1,102 @@
1
+ @charset "UTF-8";
2
+
3
+ /* src/components/Chip/chip.scss */
4
+ .lib-xplat-chip {
5
+ border-radius: var(--spacing-radius-full);
6
+ display: inline-flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ user-select: none;
10
+ transition: background-color 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
11
+ }
12
+ .lib-xplat-chip.sm {
13
+ padding: 1px var(--spacing-space-2);
14
+ font-family: var(--semantic-typo-caption-2-r-font);
15
+ font-size: var(--semantic-typo-caption-2-r-size);
16
+ line-height: var(--semantic-typo-caption-2-r-lh);
17
+ font-weight: var(--semantic-typo-caption-2-r-weight);
18
+ letter-spacing: var(--semantic-typo-caption-2-r-ls);
19
+ }
20
+ .lib-xplat-chip.md {
21
+ padding: 2px var(--spacing-space-3);
22
+ font-family: var(--semantic-typo-caption-1-r-font);
23
+ font-size: var(--semantic-typo-caption-1-r-size);
24
+ line-height: var(--semantic-typo-caption-1-r-lh);
25
+ font-weight: var(--semantic-typo-caption-1-r-weight);
26
+ letter-spacing: var(--semantic-typo-caption-1-r-ls);
27
+ }
28
+ .lib-xplat-chip.lg {
29
+ padding: var(--spacing-space-1) var(--spacing-space-4);
30
+ font-family: var(--semantic-typo-label-2-m-font);
31
+ font-size: var(--semantic-typo-label-2-m-size);
32
+ line-height: var(--semantic-typo-label-2-m-lh);
33
+ font-weight: var(--semantic-typo-label-2-m-weight);
34
+ letter-spacing: var(--semantic-typo-label-2-m-ls);
35
+ }
36
+ .lib-xplat-chip.primary {
37
+ color: var(--semantic-text-inverse);
38
+ background-color: var(--semantic-surface-brand-default);
39
+ }
40
+ .lib-xplat-chip.secondary {
41
+ color: var(--semantic-surface-brand-default);
42
+ background-color: var(--semantic-surface-neutral-primary);
43
+ border: 1px solid var(--semantic-border-primary);
44
+ }
45
+ .lib-xplat-chip.neutral {
46
+ color: var(--semantic-text-secondary);
47
+ background-color: var(--semantic-surface-neutral-secondary);
48
+ border: 1px solid var(--semantic-border-primary);
49
+ }
50
+ .lib-xplat-chip.success {
51
+ color: var(--semantic-text-success);
52
+ background-color: var(--semantic-surface-success-subtle);
53
+ }
54
+ .lib-xplat-chip.error {
55
+ color: var(--semantic-text-error);
56
+ background-color: var(--semantic-surface-error-subtle);
57
+ }
58
+ .lib-xplat-chip.warning {
59
+ color: var(--semantic-text-warning);
60
+ background-color: var(--semantic-surface-warning-subtle);
61
+ }
62
+ .lib-xplat-chip.info {
63
+ color: var(--semantic-text-info);
64
+ background-color: var(--semantic-surface-info-subtle);
65
+ }
66
+
67
+ /* src/components/ToggleChip/togglechip.scss */
68
+ .lib-xplat-toggle-chip {
69
+ cursor: pointer;
70
+ font-family: inherit;
71
+ transition:
72
+ background-color 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94),
73
+ border-color 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94),
74
+ color 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
75
+ }
76
+ .lib-xplat-toggle-chip.unselected {
77
+ color: var(--semantic-text-secondary);
78
+ background-color: var(--semantic-surface-neutral-primary);
79
+ border: 1px solid var(--semantic-border-primary);
80
+ }
81
+ .lib-xplat-toggle-chip.unselected:hover:not(:disabled) {
82
+ color: var(--semantic-text-primary);
83
+ background-color: var(--semantic-surface-neutral-secondary);
84
+ }
85
+ .lib-xplat-toggle-chip {
86
+ }
87
+ .lib-xplat-toggle-chip.selected {
88
+ color: var(--semantic-text-brand-primary);
89
+ background-color: var(--semantic-surface-brand-subtle);
90
+ border: 1px solid var(--semantic-border-brand-primary);
91
+ }
92
+ .lib-xplat-toggle-chip.selected:hover:not(:disabled) {
93
+ background-color: var(--semantic-surface-brand-secondary);
94
+ }
95
+ .lib-xplat-toggle-chip:focus-visible {
96
+ outline: 2px solid var(--semantic-interaction-focus-ring);
97
+ outline-offset: 2px;
98
+ }
99
+ .lib-xplat-toggle-chip:disabled {
100
+ cursor: not-allowed;
101
+ opacity: 0.4;
102
+ }
@@ -0,0 +1,37 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+
4
+ type ToggleChipSize = "sm" | "md" | "lg";
5
+ interface ToggleChipProps {
6
+ children: React.ReactNode;
7
+ /** 켜진 상태인가. 색과 `aria-pressed` 가 함께 바뀐다 */
8
+ selected?: boolean;
9
+ /** 누를 때. 켜고 끄는 판단은 쓰는 쪽이 한다 */
10
+ onClick?: () => void;
11
+ /** 흐리게 하고 못 누르게 한다 */
12
+ disabled?: boolean;
13
+ /** 칩 크기. `Chip` 과 같은 눈금이다 */
14
+ size?: ToggleChipSize;
15
+ }
16
+ /**
17
+ * 눌러서 고르는 칩.
18
+ *
19
+ * `Chip` 은 표시 전용이고 `Tag` 의 클릭은 **삭제**다. 이것만이 **켜짐/꺼짐**을
20
+ * 다룬다. 여러 개 고르기와 한 개 고르기 양쪽에 쓴다 — 몇 개까지 켤 수 있는지,
21
+ * 마지막 하나를 뗄 수 있는지 같은 규칙은 쓰는 쪽 사정이라 여기서 정하지 않는다.
22
+ *
23
+ * 모양은 `.lib-xplat-chip` 을 그대로 쓴다. 알약 반지름·크기 눈금·글자 크기가
24
+ * `Chip` 과 **한 곳에서** 정의되므로 둘이 따로 놀 수 없다. 같은 화면에 나란히
25
+ * 놓이는 일이 많아서 이게 중요하다.
26
+ *
27
+ * @example
28
+ * <ToggleChip selected={picked.has("ko")} onClick={() => toggle("ko")}>
29
+ * 한국어
30
+ * </ToggleChip>
31
+ */
32
+ declare const ToggleChip: {
33
+ (props: ToggleChipProps): react_jsx_runtime.JSX.Element;
34
+ displayName: string;
35
+ };
36
+
37
+ export { ToggleChip };
@@ -0,0 +1,37 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+
4
+ type ToggleChipSize = "sm" | "md" | "lg";
5
+ interface ToggleChipProps {
6
+ children: React.ReactNode;
7
+ /** 켜진 상태인가. 색과 `aria-pressed` 가 함께 바뀐다 */
8
+ selected?: boolean;
9
+ /** 누를 때. 켜고 끄는 판단은 쓰는 쪽이 한다 */
10
+ onClick?: () => void;
11
+ /** 흐리게 하고 못 누르게 한다 */
12
+ disabled?: boolean;
13
+ /** 칩 크기. `Chip` 과 같은 눈금이다 */
14
+ size?: ToggleChipSize;
15
+ }
16
+ /**
17
+ * 눌러서 고르는 칩.
18
+ *
19
+ * `Chip` 은 표시 전용이고 `Tag` 의 클릭은 **삭제**다. 이것만이 **켜짐/꺼짐**을
20
+ * 다룬다. 여러 개 고르기와 한 개 고르기 양쪽에 쓴다 — 몇 개까지 켤 수 있는지,
21
+ * 마지막 하나를 뗄 수 있는지 같은 규칙은 쓰는 쪽 사정이라 여기서 정하지 않는다.
22
+ *
23
+ * 모양은 `.lib-xplat-chip` 을 그대로 쓴다. 알약 반지름·크기 눈금·글자 크기가
24
+ * `Chip` 과 **한 곳에서** 정의되므로 둘이 따로 놀 수 없다. 같은 화면에 나란히
25
+ * 놓이는 일이 많아서 이게 중요하다.
26
+ *
27
+ * @example
28
+ * <ToggleChip selected={picked.has("ko")} onClick={() => toggle("ko")}>
29
+ * 한국어
30
+ * </ToggleChip>
31
+ */
32
+ declare const ToggleChip: {
33
+ (props: ToggleChipProps): react_jsx_runtime.JSX.Element;
34
+ displayName: string;
35
+ };
36
+
37
+ export { ToggleChip };