@clubmed/trident-ui 1.0.0-beta.14 → 1.0.0-beta.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/fonts/Actions/tui-actions.css +6 -6
  3. package/fonts/Actions/tui-actions.eot +0 -0
  4. package/fonts/Actions/tui-actions.less +6 -6
  5. package/fonts/Actions/tui-actions.module.less +6 -6
  6. package/fonts/Actions/tui-actions.scss +6 -6
  7. package/fonts/Actions/tui-actions.styl +6 -6
  8. package/fonts/Actions/tui-actions.ttf +0 -0
  9. package/fonts/Actions/tui-actions.woff +0 -0
  10. package/fonts/Actions/tui-actions.woff2 +0 -0
  11. package/fonts/Activities/tui-activities.css +6 -6
  12. package/fonts/Activities/tui-activities.eot +0 -0
  13. package/fonts/Activities/tui-activities.less +6 -6
  14. package/fonts/Activities/tui-activities.module.less +6 -6
  15. package/fonts/Activities/tui-activities.scss +6 -6
  16. package/fonts/Activities/tui-activities.styl +6 -6
  17. package/fonts/Activities/tui-activities.ttf +0 -0
  18. package/fonts/Activities/tui-activities.woff +0 -0
  19. package/fonts/Activities/tui-activities.woff2 +0 -0
  20. package/fonts/Brand/tui-brand.css +6 -6
  21. package/fonts/Brand/tui-brand.eot +0 -0
  22. package/fonts/Brand/tui-brand.less +6 -6
  23. package/fonts/Brand/tui-brand.module.less +6 -6
  24. package/fonts/Brand/tui-brand.scss +6 -6
  25. package/fonts/Brand/tui-brand.styl +6 -6
  26. package/fonts/Brand/tui-brand.ttf +0 -0
  27. package/fonts/Brand/tui-brand.woff +0 -0
  28. package/fonts/Brand/tui-brand.woff2 +0 -0
  29. package/fonts/Covid/tui-covid.css +6 -6
  30. package/fonts/Covid/tui-covid.eot +0 -0
  31. package/fonts/Covid/tui-covid.less +6 -6
  32. package/fonts/Covid/tui-covid.module.less +6 -6
  33. package/fonts/Covid/tui-covid.scss +6 -6
  34. package/fonts/Covid/tui-covid.styl +6 -6
  35. package/fonts/Covid/tui-covid.ttf +0 -0
  36. package/fonts/Covid/tui-covid.woff +0 -0
  37. package/fonts/Covid/tui-covid.woff2 +0 -0
  38. package/fonts/Food/tui-food.css +6 -6
  39. package/fonts/Food/tui-food.eot +0 -0
  40. package/fonts/Food/tui-food.less +6 -6
  41. package/fonts/Food/tui-food.module.less +6 -6
  42. package/fonts/Food/tui-food.scss +6 -6
  43. package/fonts/Food/tui-food.styl +6 -6
  44. package/fonts/Food/tui-food.ttf +0 -0
  45. package/fonts/Food/tui-food.woff +0 -0
  46. package/fonts/Food/tui-food.woff2 +0 -0
  47. package/fonts/HappyToCare/tui-happy-to-care.css +6 -6
  48. package/fonts/HappyToCare/tui-happy-to-care.eot +0 -0
  49. package/fonts/HappyToCare/tui-happy-to-care.less +6 -6
  50. package/fonts/HappyToCare/tui-happy-to-care.module.less +6 -6
  51. package/fonts/HappyToCare/tui-happy-to-care.scss +6 -6
  52. package/fonts/HappyToCare/tui-happy-to-care.styl +6 -6
  53. package/fonts/HappyToCare/tui-happy-to-care.ttf +0 -0
  54. package/fonts/HappyToCare/tui-happy-to-care.woff +0 -0
  55. package/fonts/HappyToCare/tui-happy-to-care.woff2 +0 -0
  56. package/fonts/Places/tui-places.css +6 -6
  57. package/fonts/Places/tui-places.eot +0 -0
  58. package/fonts/Places/tui-places.less +6 -6
  59. package/fonts/Places/tui-places.module.less +6 -6
  60. package/fonts/Places/tui-places.scss +6 -6
  61. package/fonts/Places/tui-places.styl +6 -6
  62. package/fonts/Places/tui-places.ttf +0 -0
  63. package/fonts/Places/tui-places.woff +0 -0
  64. package/fonts/Places/tui-places.woff2 +0 -0
  65. package/fonts/Room/tui-room.css +6 -6
  66. package/fonts/Room/tui-room.eot +0 -0
  67. package/fonts/Room/tui-room.less +6 -6
  68. package/fonts/Room/tui-room.module.less +6 -6
  69. package/fonts/Room/tui-room.scss +6 -6
  70. package/fonts/Room/tui-room.styl +6 -6
  71. package/fonts/Room/tui-room.ttf +0 -0
  72. package/fonts/Room/tui-room.woff +0 -0
  73. package/fonts/Room/tui-room.woff2 +0 -0
  74. package/fonts/Services/tui-services.css +6 -6
  75. package/fonts/Services/tui-services.eot +0 -0
  76. package/fonts/Services/tui-services.less +6 -6
  77. package/fonts/Services/tui-services.module.less +6 -6
  78. package/fonts/Services/tui-services.scss +6 -6
  79. package/fonts/Services/tui-services.styl +6 -6
  80. package/fonts/Services/tui-services.ttf +0 -0
  81. package/fonts/Services/tui-services.woff +0 -0
  82. package/fonts/Services/tui-services.woff2 +0 -0
  83. package/fonts/Socials/tui-socials.css +6 -6
  84. package/fonts/Socials/tui-socials.eot +0 -0
  85. package/fonts/Socials/tui-socials.less +6 -6
  86. package/fonts/Socials/tui-socials.module.less +6 -6
  87. package/fonts/Socials/tui-socials.scss +6 -6
  88. package/fonts/Socials/tui-socials.styl +6 -6
  89. package/fonts/Socials/tui-socials.ttf +0 -0
  90. package/fonts/Socials/tui-socials.woff +0 -0
  91. package/fonts/Socials/tui-socials.woff2 +0 -0
  92. package/fonts/Transports/tui-transports.css +6 -6
  93. package/fonts/Transports/tui-transports.eot +0 -0
  94. package/fonts/Transports/tui-transports.less +6 -6
  95. package/fonts/Transports/tui-transports.module.less +6 -6
  96. package/fonts/Transports/tui-transports.scss +6 -6
  97. package/fonts/Transports/tui-transports.styl +6 -6
  98. package/fonts/Transports/tui-transports.ttf +0 -0
  99. package/fonts/Transports/tui-transports.woff +0 -0
  100. package/fonts/Transports/tui-transports.woff2 +0 -0
  101. package/fonts/Utilities/tui-utilities.css +6 -6
  102. package/fonts/Utilities/tui-utilities.eot +0 -0
  103. package/fonts/Utilities/tui-utilities.less +6 -6
  104. package/fonts/Utilities/tui-utilities.module.less +6 -6
  105. package/fonts/Utilities/tui-utilities.scss +6 -6
  106. package/fonts/Utilities/tui-utilities.styl +6 -6
  107. package/fonts/Utilities/tui-utilities.ttf +0 -0
  108. package/fonts/Utilities/tui-utilities.woff +0 -0
  109. package/fonts/Utilities/tui-utilities.woff2 +0 -0
  110. package/hooks/useKeyboardControls.d.ts +1 -1
  111. package/hooks/useKeyboardControls.js +31 -27
  112. package/molecules/Forms/Checkboxes/Checkbox.d.ts +2 -11
  113. package/molecules/Forms/Checkboxes/Checkbox.js +90 -65
  114. package/molecules/Tabs/TabsHeading.js +73 -74
  115. package/molecules/Tabs/context/TabControl.js +21 -21
  116. package/package.json +6 -6
  117. package/styles/globals.css +4 -0
@@ -1,11 +1,11 @@
1
1
  @font-face {
2
2
  font-family: "tui-utilities";
3
- src: url('tui-utilities.eot?t=1718979636652'); /* IE9*/
4
- src: url('tui-utilities.eot?t=1718979636652#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
- url("tui-utilities.woff2?t=1718979636652") format("woff2"),
6
- url("tui-utilities.woff?t=1718979636652") format("woff"),
7
- url('tui-utilities.ttf?t=1718979636652') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
8
- url('tui-utilities.svg?t=1718979636652#tui-utilities') format('svg'); /* iOS 4.1- */
3
+ src: url('tui-utilities.eot?t=1720177565741'); /* IE9*/
4
+ src: url('tui-utilities.eot?t=1720177565741#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
+ url("tui-utilities.woff2?t=1720177565741") format("woff2"),
6
+ url("tui-utilities.woff?t=1720177565741") format("woff"),
7
+ url('tui-utilities.ttf?t=1720177565741') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
8
+ url('tui-utilities.svg?t=1720177565741#tui-utilities') format('svg'); /* iOS 4.1- */
9
9
  }
10
10
 
11
11
  [class^="tui-utilities-"], [class*=" tui-utilities-"] {
Binary file
@@ -1,10 +1,10 @@
1
1
  @font-face {font-family: "tui-utilities";
2
- src: url('tui-utilities.eot?t=1718979636652'); /* IE9*/
3
- src: url('tui-utilities.eot?t=1718979636652#iefix') format('embedded-opentype'), /* IE6-IE8 */
4
- url("tui-utilities.woff2?t=1718979636652") format("woff2"),
5
- url("tui-utilities.woff?t=1718979636652") format("woff"),
6
- url('tui-utilities.ttf?t=1718979636652') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
7
- url('tui-utilities.svg?t=1718979636652#tui-utilities') format('svg'); /* iOS 4.1- */
2
+ src: url('tui-utilities.eot?t=1720177565741'); /* IE9*/
3
+ src: url('tui-utilities.eot?t=1720177565741#iefix') format('embedded-opentype'), /* IE6-IE8 */
4
+ url("tui-utilities.woff2?t=1720177565741") format("woff2"),
5
+ url("tui-utilities.woff?t=1720177565741") format("woff"),
6
+ url('tui-utilities.ttf?t=1720177565741') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
7
+ url('tui-utilities.svg?t=1720177565741#tui-utilities') format('svg'); /* iOS 4.1- */
8
8
  }
9
9
 
10
10
  [class^="tui-utilities-"], [class*=" tui-utilities-"] {
@@ -1,10 +1,10 @@
1
1
  @font-face {font-family: "tui-utilities";
2
- src: url('tui-utilities.eot?t=1718979636652'); /* IE9*/
3
- src: url('tui-utilities.eot?t=1718979636652#iefix') format('embedded-opentype'), /* IE6-IE8 */
4
- url("tui-utilities.woff2?t=1718979636652") format("woff2"),
5
- url("tui-utilities.woff?t=1718979636652") format("woff"),
6
- url('tui-utilities.ttf?t=1718979636652') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
7
- url('tui-utilities.svg?t=1718979636652#tui-utilities') format('svg'); /* iOS 4.1- */
2
+ src: url('tui-utilities.eot?t=1720177565741'); /* IE9*/
3
+ src: url('tui-utilities.eot?t=1720177565741#iefix') format('embedded-opentype'), /* IE6-IE8 */
4
+ url("tui-utilities.woff2?t=1720177565741") format("woff2"),
5
+ url("tui-utilities.woff?t=1720177565741") format("woff"),
6
+ url('tui-utilities.ttf?t=1720177565741') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
7
+ url('tui-utilities.svg?t=1720177565741#tui-utilities') format('svg'); /* iOS 4.1- */
8
8
  }
9
9
 
10
10
  [class^="tui-utilities-"], [class*=" tui-utilities-"] {
@@ -1,10 +1,10 @@
1
1
  @font-face {font-family: "tui-utilities";
2
- src: url('tui-utilities.eot?t=1718979636652'); /* IE9*/
3
- src: url('tui-utilities.eot?t=1718979636652#iefix') format('embedded-opentype'), /* IE6-IE8 */
4
- url("tui-utilities.woff2?t=1718979636652") format("woff2"),
5
- url("tui-utilities.woff?t=1718979636652") format("woff"),
6
- url('tui-utilities.ttf?t=1718979636652') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
7
- url('tui-utilities.svg?t=1718979636652#tui-utilities') format('svg'); /* iOS 4.1- */
2
+ src: url('tui-utilities.eot?t=1720177565741'); /* IE9*/
3
+ src: url('tui-utilities.eot?t=1720177565741#iefix') format('embedded-opentype'), /* IE6-IE8 */
4
+ url("tui-utilities.woff2?t=1720177565741") format("woff2"),
5
+ url("tui-utilities.woff?t=1720177565741") format("woff"),
6
+ url('tui-utilities.ttf?t=1720177565741') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
7
+ url('tui-utilities.svg?t=1720177565741#tui-utilities') format('svg'); /* iOS 4.1- */
8
8
  }
9
9
 
10
10
  [class^="tui-utilities-"], [class*=" tui-utilities-"] {
@@ -1,10 +1,10 @@
1
1
  @font-face {font-family: "tui-utilities";
2
- src: url('tui-utilities.eot?t=1718979636652'); /* IE9*/
3
- src: url('tui-utilities.eot?t=1718979636652#iefix') format('embedded-opentype'), /* IE6-IE8 */
4
- url("tui-utilities.woff2?t=1718979636652") format("woff2"),
5
- url("tui-utilities.woff?t=1718979636652") format("woff"),
6
- url('tui-utilities.ttf?t=1718979636652') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
7
- url('tui-utilities.svg?t=1718979636652#tui-utilities') format('svg'); /* iOS 4.1- */
2
+ src: url('tui-utilities.eot?t=1720177565741'); /* IE9*/
3
+ src: url('tui-utilities.eot?t=1720177565741#iefix') format('embedded-opentype'), /* IE6-IE8 */
4
+ url("tui-utilities.woff2?t=1720177565741") format("woff2"),
5
+ url("tui-utilities.woff?t=1720177565741") format("woff"),
6
+ url('tui-utilities.ttf?t=1720177565741') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
7
+ url('tui-utilities.svg?t=1720177565741#tui-utilities') format('svg'); /* iOS 4.1- */
8
8
  }
9
9
 
10
10
  [class^="tui-utilities-"], [class*=" tui-utilities-"] {
Binary file
Binary file
Binary file
@@ -1,4 +1,4 @@
1
- import type { KeyboardEvent } from 'react';
1
+ import { type KeyboardEvent } from 'react';
2
2
  interface Options {
3
3
  up?: VoidFunction;
4
4
  down?: VoidFunction;
@@ -1,30 +1,34 @@
1
1
  "use client";
2
- import { CODE as o, KEY as t } from "./keyboard.constants.js";
3
- const D = (e) => e.key === t.ENTER || e.key === t.SPACE || e.key === t.SPACEBAR || e.code === o.ENTER || e.code === o.SPACE, u = () => {
4
- }, n = ({
5
- up: e = u,
6
- down: c = u,
7
- left: f = u,
8
- right: d = u,
9
- start: i = u,
10
- end: E = u,
11
- activate: R = u
12
- }) => (r) => {
13
- if (D(r))
14
- return R();
15
- if (r.code === o.HOME)
16
- return r.preventDefault(), i();
17
- if (r.code === o.END)
18
- return r.preventDefault(), E();
19
- if (r.code === o.ARROW_UP)
20
- return r.preventDefault(), e();
21
- if (r.code === o.ARROW_DOWN)
22
- return r.preventDefault(), c();
23
- if (r.code === o.ARROW_RIGHT)
24
- return r.preventDefault(), d();
25
- if (r.code === o.ARROW_LEFT)
26
- return r.preventDefault(), f();
27
- };
2
+ import { useCallback as d } from "react";
3
+ import { CODE as u, KEY as c } from "./keyboard.constants.js";
4
+ const t = (o) => o.key === c.ENTER || o.key === c.SPACE || o.key === c.SPACEBAR || o.code === u.ENTER || o.code === u.SPACE, e = () => {
5
+ }, p = ({
6
+ up: o = e,
7
+ down: f = e,
8
+ left: E = e,
9
+ right: R = e,
10
+ start: i = e,
11
+ end: l = e,
12
+ activate: D = e
13
+ }) => d(
14
+ (r) => {
15
+ if (t(r))
16
+ return D();
17
+ if (r.code === u.HOME)
18
+ return r.preventDefault(), i();
19
+ if (r.code === u.END)
20
+ return r.preventDefault(), l();
21
+ if (r.code === u.ARROW_UP)
22
+ return r.preventDefault(), o();
23
+ if (r.code === u.ARROW_DOWN)
24
+ return r.preventDefault(), f();
25
+ if (r.code === u.ARROW_RIGHT)
26
+ return r.preventDefault(), R();
27
+ if (r.code === u.ARROW_LEFT)
28
+ return r.preventDefault(), E();
29
+ },
30
+ [D, f, l, E, R, i, o]
31
+ );
28
32
  export {
29
- n as useKeyboardControls
33
+ p as useKeyboardControls
30
34
  };
@@ -1,14 +1,5 @@
1
- import { InputHTMLAttributes } from 'react';
2
- import '../controls.css';
3
- export interface CheckboxProps<Value = string> extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
4
- /**
5
- * The data-testid to apply to the button.
6
- * This is used for testing purposes.
7
- * */
8
- dataTestId?: string;
9
- /**
10
- * The width of the checkbox.
11
- * */
1
+ import { FormControlProps } from '../FormControl';
2
+ export interface CheckboxProps<Value = string> extends FormControlProps<Value> {
12
3
  size?: number;
13
4
  onChange?: (name: string, value: Value | null) => void;
14
5
  }
@@ -1,72 +1,97 @@
1
- import { jsxs as n, jsx as i } from "react/jsx-runtime";
2
- import { c as g } from "../../../index-Cu0xwYjD.js";
3
- import { useId as C } from "react";
4
- import { Icon as I } from "../../../atoms/Icons/Icon.js";
1
+ import { jsxs as t, jsx as a } from "react/jsx-runtime";
2
+ import { c as p } from "../../../index-Cu0xwYjD.js";
3
+ import { useId as w } from "react";
4
+ import { Icon as u } from "../../../atoms/Icons/Icon.js";
5
5
  import "../../../atoms/Icons/contexts/IconsContext.js";
6
- import { useValue as y } from "../../../hooks/useValue.js";
6
+ import { useValue as S } from "../../../hooks/useValue.js";
7
7
  import "../../../controls-l0sNRNKZ.js";
8
- function $(c) {
9
- const d = C(), {
10
- id: m = d,
11
- name: l = m,
12
- className: p,
13
- dataTestId: h,
14
- disabled: e,
15
- checked: u = !1,
16
- value: a,
17
- size: t = 24,
18
- tabIndex: x = 0,
19
- children: f,
20
- onChange: s,
21
- ...b
22
- } = c, { value: o, setValue: k } = y({
23
- name: l,
24
- initialValue: u,
25
- onChange(v, r) {
26
- s == null || s(v, r ? a !== void 0 ? a : r : null);
8
+ import { useInternalStatus as V } from "../../../hooks/useInternalStatus.js";
9
+ function A(h) {
10
+ const x = w(), {
11
+ id: n = x,
12
+ name: o = n,
13
+ className: f,
14
+ dataTestId: b,
15
+ disabled: s = !1,
16
+ checked: k = !1,
17
+ value: r,
18
+ size: l = 24,
19
+ tabIndex: g = 0,
20
+ validationStatus: v = "default",
21
+ errorMessage: c,
22
+ children: N,
23
+ onChange: i,
24
+ ...I
25
+ } = h, { value: d, setValue: y } = S({
26
+ name: o,
27
+ initialValue: k,
28
+ onChange(C, m) {
29
+ i == null || i(C, m ? r !== void 0 ? r : m : null);
27
30
  }
31
+ }), e = V({
32
+ isDisabled: s,
33
+ validationStatus: v
28
34
  });
29
- return /* @__PURE__ */ n(
30
- "label",
31
- {
32
- className: g(p, "cursor-pointer relative flex gap-8", {
33
- "text-grey": e
34
- }),
35
- children: [
36
- /* @__PURE__ */ n("span", { className: "relative", children: [
37
- /* @__PURE__ */ i(
38
- "input",
39
- {
40
- ...b,
41
- name: l,
42
- "data-testid": h,
43
- type: "checkbox",
44
- tabIndex: x,
45
- onChange: () => {
46
- !e && k(!o);
47
- },
48
- checked: o,
49
- "data-name": "Checkbox",
50
- disabled: e,
51
- value: a
52
- }
53
- ),
54
- /* @__PURE__ */ i("span", { style: { height: t, width: t }, children: /* @__PURE__ */ i(
55
- I,
56
- {
57
- name: "CheckDefault",
58
- type: "svg",
59
- width: `${t}px`,
60
- color: "black",
61
- className: "absolute"
62
- }
63
- ) })
64
- ] }),
65
- f
66
- ]
67
- }
68
- );
35
+ return /* @__PURE__ */ t("div", { className: "flex flex-col gap-y-4", children: [
36
+ /* @__PURE__ */ t(
37
+ "label",
38
+ {
39
+ className: p(
40
+ f,
41
+ "cursor-pointer relative flex gap-8 text-b3 items-center",
42
+ {
43
+ "text-grey": e === "disabled",
44
+ "text-black": e !== "default"
45
+ }
46
+ ),
47
+ children: [
48
+ /* @__PURE__ */ t("span", { className: "relative", children: [
49
+ /* @__PURE__ */ a(
50
+ "input",
51
+ {
52
+ ...I,
53
+ name: o,
54
+ "data-testid": b,
55
+ type: "checkbox",
56
+ tabIndex: g,
57
+ onChange: () => {
58
+ !s && y(!d);
59
+ },
60
+ checked: d,
61
+ "data-name": "Checkbox",
62
+ disabled: s,
63
+ value: r
64
+ }
65
+ ),
66
+ /* @__PURE__ */ a(
67
+ "span",
68
+ {
69
+ style: { height: l, width: l },
70
+ className: p({ "!border-red": e === "error" }),
71
+ "data-testid": `check-container-${n}`,
72
+ children: /* @__PURE__ */ a(
73
+ u,
74
+ {
75
+ name: "CheckDefault",
76
+ type: "svg",
77
+ width: `${l}px`,
78
+ color: "black",
79
+ className: "absolute"
80
+ }
81
+ )
82
+ }
83
+ )
84
+ ] }),
85
+ N
86
+ ]
87
+ }
88
+ ),
89
+ e === "error" && c && /* @__PURE__ */ t("span", { className: "text-red text-b4 flex items-start gap-x-4 ps-20", role: "alert", children: [
90
+ /* @__PURE__ */ a(u, { name: "Error", width: "20px" }),
91
+ c
92
+ ] })
93
+ ] });
69
94
  }
70
95
  export {
71
- $ as Checkbox
96
+ A as Checkbox
72
97
  };
@@ -1,101 +1,100 @@
1
1
  "use client";
2
- import { jsx as a, jsxs as N } from "react/jsx-runtime";
3
- import { c } from "../../index-Cu0xwYjD.js";
4
- import { useRef as d, useEffect as L } from "react";
5
- import { b as R } from "../../react-spring_web.modern-BPtZcx1z.js";
6
- import { useActiveTab as k, useRegisterTabControl as E } from "./hooks/tabControl.js";
7
- import { getTheme as K } from "./theme.js";
8
- import { useSafeBoop as D } from "../../hooks/useSafeBoop.js";
9
- import { useKeyboardControls as j } from "../../hooks/useKeyboardControls.js";
10
- const m = "-z-1 rounded-pill absolute inset-0 duration-300", P = ({
11
- className: u,
12
- label: n,
13
- children: f,
14
- value: o,
15
- onSelect: r,
16
- as: b = "h2",
17
- theme: y = "yellow"
2
+ import { jsx as u, jsxs as B } from "react/jsx-runtime";
3
+ import { c as d } from "../../index-Cu0xwYjD.js";
4
+ import { useRef as m, useEffect as H, useCallback as r } from "react";
5
+ import { b as I } from "../../react-spring_web.modern-BPtZcx1z.js";
6
+ import { useActiveTab as _, useRegisterTabControl as z } from "./hooks/tabControl.js";
7
+ import { getTheme as G } from "./theme.js";
8
+ import { useSafeBoop as M } from "../../hooks/useSafeBoop.js";
9
+ import { useKeyboardControls as O } from "../../hooks/useKeyboardControls.js";
10
+ const f = "-z-1 rounded-pill absolute inset-0 duration-300", W = ({
11
+ className: b,
12
+ label: a,
13
+ children: y,
14
+ value: e,
15
+ onSelect: i,
16
+ as: g = "h2",
17
+ theme: h = "yellow"
18
18
  }) => {
19
- const p = d(!1), s = d(null), g = k(), e = E({ value: o, ref: s }), t = g === o, h = { "--tab-index": o }, { textColor: x, textColorActive: C, bgColor: T } = K(y), [w, l] = D({ scale: 1.02 });
20
- L(() => {
21
- if (!p.current) {
22
- p.current = !0;
23
- return;
24
- }
25
- t && (r == null || r({ value: o, label: n })), s.current && t && s.current.focus();
26
- }, [t, n, o, r]);
27
- const v = j({
28
- activate: () => {
29
- t && l();
30
- },
31
- start: () => {
32
- e({ type: "start" });
33
- },
34
- end: () => {
35
- e({ type: "end" });
36
- },
37
- up: () => {
38
- e({ type: "previous" });
39
- },
40
- down: () => {
41
- e({ type: "next" });
42
- },
43
- left: () => {
44
- const i = document.documentElement.dir === "rtl";
45
- e({ type: i ? "next" : "previous" });
46
- },
47
- right: () => {
48
- const i = document.documentElement.dir === "rtl";
49
- e({ type: i ? "previous" : "next" });
50
- }
51
- }), A = () => {
52
- e({ type: "update", payload: o }), t && l();
53
- };
54
- return /* @__PURE__ */ a(
55
- R.div,
19
+ const p = m(null), o = _(), t = z({ value: e, ref: p }), l = m(o), n = m(o === e);
20
+ n.current = o === e;
21
+ const x = { "--tab-index": e }, { textColor: C, textColorActive: T, bgColor: w } = G(h), [A, c] = M({ scale: 1.02 });
22
+ H(() => {
23
+ var s;
24
+ l.current !== o && e === o && ((s = p.current) == null || s.focus(), i == null || i({ value: e, label: a })), l.current !== o && (l.current = o);
25
+ }, [a, e, i, o]);
26
+ const v = r(() => {
27
+ n.current && c();
28
+ }, [c]), N = r(() => {
29
+ t({ type: "start" });
30
+ }, [t]), k = r(() => {
31
+ t({ type: "end" });
32
+ }, [t]), L = r(() => {
33
+ t({ type: "previous" });
34
+ }, [t]), R = r(() => {
35
+ t({ type: "next" });
36
+ }, [t]), E = r(() => {
37
+ const s = document.documentElement.dir === "rtl";
38
+ t({ type: s ? "next" : "previous" });
39
+ }, [t]), K = r(() => {
40
+ const s = document.documentElement.dir === "rtl";
41
+ t({ type: s ? "previous" : "next" });
42
+ }, [t]), D = O({
43
+ activate: v,
44
+ start: N,
45
+ end: k,
46
+ up: L,
47
+ down: R,
48
+ left: E,
49
+ right: K
50
+ }), j = r(() => {
51
+ t({ type: "update", payload: e }), n.current && c();
52
+ }, [c, t, e]);
53
+ return /* @__PURE__ */ u(
54
+ I.div,
56
55
  {
57
56
  "data-name": "TabsHeading",
58
- ref: s,
57
+ ref: p,
59
58
  role: "tab",
60
- "aria-selected": t,
61
- tabIndex: t ? 0 : -1,
62
- style: w,
63
- className: c(
59
+ "aria-selected": n.current,
60
+ tabIndex: n.current ? 0 : -1,
61
+ style: A,
62
+ className: d(
64
63
  "text-b3 group inline-block cursor-pointer overflow-hidden whitespace-nowrap bg-transparent pe-4 align-middle font-semibold outline-none",
65
- u,
64
+ b,
66
65
  {
67
- [x]: !t,
68
- [C]: t
66
+ [C]: !n.current,
67
+ [T]: n.current
69
68
  }
70
69
  ),
71
- onKeyDown: v,
72
- onClick: A,
73
- children: /* @__PURE__ */ N(b, { className: "relative inline-block px-20 py-12", children: [
74
- /* @__PURE__ */ a(
70
+ onKeyDown: D,
71
+ onClick: j,
72
+ children: /* @__PURE__ */ B(g, { className: "relative inline-block px-20 py-12", children: [
73
+ /* @__PURE__ */ u(
75
74
  "span",
76
75
  {
77
- className: c(
76
+ className: d(
78
77
  "group-hover:bg-pearl group-focus-within:bg-pearl transition-colors",
79
- m
78
+ f
80
79
  )
81
80
  }
82
81
  ),
83
- /* @__PURE__ */ a(
82
+ /* @__PURE__ */ u(
84
83
  "span",
85
84
  {
86
- className: c(
85
+ className: d(
87
86
  "tab-focus-pill ease transition-transform/colors",
88
- m,
89
- T
87
+ f,
88
+ w
90
89
  ),
91
- style: h
90
+ style: x
92
91
  }
93
92
  ),
94
- f ?? n
93
+ y ?? a
95
94
  ] })
96
95
  }
97
96
  );
98
97
  };
99
98
  export {
100
- P as TabsHeading
99
+ W as TabsHeading
101
100
  };
@@ -1,38 +1,38 @@
1
1
  "use client";
2
2
  import { jsx as l } from "react/jsx-runtime";
3
3
  import { createContext as c, useReducer as v, useMemo as u, useCallback as x } from "react";
4
- const C = (e) => {
5
- const t = Math.max(Math.min(e.min, e.max), 0), r = Math.max(Math.min(e.max, 1 / 0), t);
4
+ const C = (t) => {
5
+ const e = Math.max(Math.min(t.min, t.max), 0), r = Math.max(Math.min(t.max, 1 / 0), e);
6
6
  return {
7
- min: t,
7
+ min: e,
8
8
  max: r,
9
- clamp: (n) => Math.max(Math.min(n, r), t)
9
+ clamp: (n) => Math.max(Math.min(n, r), e)
10
10
  };
11
- }, g = (e) => {
12
- const { clamp: t } = C(e);
13
- return t(e.value);
14
- }, P = (e) => {
15
- const { min: t, max: r, clamp: n } = C(e);
11
+ }, g = (t) => {
12
+ const { clamp: e } = C(t);
13
+ return e(t.value);
14
+ }, P = (t) => {
15
+ const { min: e, max: r, clamp: n } = C(t);
16
16
  return (a, o) => {
17
17
  switch (o.type) {
18
18
  case "update":
19
19
  return n(o.payload);
20
20
  case "next":
21
- return a + 1 <= r ? a + 1 : t;
21
+ return a + 1 <= r ? a + 1 : e;
22
22
  case "previous":
23
- return a - 1 >= t ? a - 1 : r;
23
+ return a - 1 >= e ? a - 1 : r;
24
24
  case "start":
25
- return t;
25
+ return e;
26
26
  case "end":
27
27
  return r;
28
28
  }
29
29
  };
30
- }, R = (e, t) => {
31
- switch (t.type) {
30
+ }, R = (t, e) => {
31
+ switch (e.type) {
32
32
  case "register":
33
- return new Map(e.set(t.payload.value, t.payload.ref));
33
+ return new Map(t.set(e.payload.value, e.payload.ref));
34
34
  case "unregister":
35
- return e.delete(t.payload.value) ? new Map(e) : e;
35
+ return t.delete(e.payload.value), new Map(t);
36
36
  }
37
37
  }, h = c({ value: 0 });
38
38
  h.displayName = "ActiveTabContext";
@@ -53,14 +53,14 @@ const b = c({
53
53
  });
54
54
  b.displayName = "TabControlContext";
55
55
  const A = ({
56
- min: e = 0,
57
- max: t,
58
- selected: r = e,
56
+ min: t = 0,
57
+ max: e,
58
+ selected: r = t,
59
59
  children: n
60
60
  }) => {
61
61
  const [a, o] = v(
62
- P({ min: e, max: t }),
63
- { value: r, min: e, max: t },
62
+ P({ min: t, max: e }),
63
+ { value: r, min: t, max: e },
64
64
  g
65
65
  ), [i, d] = v(R, /* @__PURE__ */ new Map()), M = u(() => ({ value: a }), [a]), f = u(() => ({ refs: i }), [i]), p = x(
66
66
  (s, w) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clubmed/trident-ui",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.16",
4
4
  "type": "module",
5
5
  "description": "Shared ClubMed React UI components",
6
6
  "keywords": [
@@ -36,16 +36,16 @@
36
36
  "import": "./atoms/Icons/fonts/index.js",
37
37
  "default": "./atoms/Icons/fonts/index.js"
38
38
  },
39
- "./atoms/Icons/svg": {
40
- "types": "./atoms/Icons/svg/index.d.ts",
41
- "import": "./atoms/Icons/svg/index.js",
42
- "default": "./atoms/Icons/svg/index.js"
43
- },
44
39
  "./atoms/Icons/svg-use": {
45
40
  "types": "./atoms/Icons/svg-use/index.d.ts",
46
41
  "import": "./atoms/Icons/svg-use/index.js",
47
42
  "default": "./atoms/Icons/svg-use/index.js"
48
43
  },
44
+ "./atoms/Icons/svg": {
45
+ "types": "./atoms/Icons/svg/index.d.ts",
46
+ "import": "./atoms/Icons/svg/index.js",
47
+ "default": "./atoms/Icons/svg/index.js"
48
+ },
49
49
  "./molecules/Tabs": {
50
50
  "types": "./molecules/Tabs/index.d.ts",
51
51
  "import": "./molecules/Tabs/index.js",