@cerberus-design/react 0.2.0-next-ec538ca → 0.2.0-next-87c3df1

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 (32) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.ts +31 -0
  2. package/build/legacy/chunk-6DXQW4WK.js +109 -0
  3. package/build/legacy/chunk-6DXQW4WK.js.map +1 -0
  4. package/build/legacy/{chunk-NWDAYAVH.js → chunk-BVILNJ6M.js} +5 -2
  5. package/build/{modern/chunk-NWDAYAVH.js.map → legacy/chunk-BVILNJ6M.js.map} +1 -1
  6. package/build/legacy/{chunk-XVDQL4L6.js → chunk-UI7OR6PG.js} +1 -1
  7. package/build/legacy/chunk-UI7OR6PG.js.map +1 -0
  8. package/build/legacy/components/Tab.js +1 -1
  9. package/build/legacy/components/TabList.js +1 -1
  10. package/build/legacy/components/TabPanel.js +1 -1
  11. package/build/legacy/index.js +3 -3
  12. package/build/modern/_tsup-dts-rollup.d.ts +31 -0
  13. package/build/modern/chunk-AMFL3PZV.js +108 -0
  14. package/build/modern/chunk-AMFL3PZV.js.map +1 -0
  15. package/build/modern/{chunk-NWDAYAVH.js → chunk-BVILNJ6M.js} +5 -2
  16. package/build/{legacy/chunk-NWDAYAVH.js.map → modern/chunk-BVILNJ6M.js.map} +1 -1
  17. package/build/modern/{chunk-XVDQL4L6.js → chunk-UI7OR6PG.js} +1 -1
  18. package/build/modern/chunk-UI7OR6PG.js.map +1 -0
  19. package/build/modern/components/Tab.js +1 -1
  20. package/build/modern/components/TabList.js +1 -1
  21. package/build/modern/components/TabPanel.js +1 -1
  22. package/build/modern/index.js +3 -3
  23. package/package.json +1 -1
  24. package/src/components/Tab.tsx +90 -1
  25. package/src/components/TabList.tsx +3 -0
  26. package/src/components/TabPanel.tsx +17 -0
  27. package/build/legacy/chunk-NVA4SWUI.js +0 -36
  28. package/build/legacy/chunk-NVA4SWUI.js.map +0 -1
  29. package/build/legacy/chunk-XVDQL4L6.js.map +0 -1
  30. package/build/modern/chunk-X5PQA2JN.js +0 -35
  31. package/build/modern/chunk-X5PQA2JN.js.map +0 -1
  32. package/build/modern/chunk-XVDQL4L6.js.map +0 -1
@@ -277,6 +277,20 @@ declare interface ShowProps {
277
277
  export { ShowProps }
278
278
  export { ShowProps as ShowProps_alias_1 }
279
279
 
280
+ /**
281
+ * The Tab component provides a tab element to be used in a TabList.
282
+ * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)
283
+ * @definition [Tab docs](https://cerberus.digitalu.design/react/tabs)
284
+ * @param id - the id of the tab (used for aria-labelledby in the panel)
285
+ * @param controls - the id of the tab panel that the tab controls
286
+ * @param value - the id of the tab that will be tracked as the active tab
287
+ * @example
288
+ * ```tsx
289
+ * <Tab controls="panel:overview" value="overview">
290
+ * Overview
291
+ * </Tab>
292
+ * ```
293
+ */
280
294
  declare function Tab(props: TabProps): JSX_2.Element;
281
295
  export { Tab }
282
296
  export { Tab as Tab_alias_1 }
@@ -306,11 +320,27 @@ declare interface TabListProps extends HTMLAttributes<HTMLDivElement> {
306
320
  export { TabListProps }
307
321
  export { TabListProps as TabListProps_alias_1 }
308
322
 
323
+ /**
324
+ * The TabPanel component provides a panel element to be used in a Tabs provider.
325
+ * @param id - the id of the tab panel which is used for the Tab's control prop
326
+ * @param tab - the id of the tab that will be tracked as the active tab
327
+ * @example
328
+ * ```tsx
329
+ * <TabPanel id="panel:overview" tab="overview">
330
+ * Overview content
331
+ * </TabPanel>
332
+ * ```
333
+ */
309
334
  declare function TabPanel(props: TabPanelProps): JSX_2.Element;
310
335
  export { TabPanel }
311
336
  export { TabPanel as TabPanel_alias_1 }
312
337
 
338
+ /**
339
+ * This module provides a TabPanel component.
340
+ * @module
341
+ */
313
342
  declare interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
343
+ id: string;
314
344
  tab: string;
315
345
  }
316
346
  export { TabPanelProps }
@@ -321,6 +351,7 @@ export { TabPanelProps as TabPanelProps_alias_1 }
321
351
  * @module
322
352
  */
323
353
  declare interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {
354
+ id: string;
324
355
  controls: string;
325
356
  value: string;
326
357
  }
@@ -0,0 +1,109 @@
1
+ import {
2
+ useTabsContext
3
+ } from "./chunk-24B4KIPX.js";
4
+
5
+ // src/components/Tab.tsx
6
+ import { useMemo } from "react";
7
+ import { css, cx } from "@cerberus/styled-system/css";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function Tab(props) {
10
+ const { controls, value, ...nativeProps } = props;
11
+ const { active, onTabUpdate } = useTabsContext();
12
+ const isActive = useMemo(() => active === value, [active, value]);
13
+ function handleClick(e) {
14
+ var _a;
15
+ (_a = props.onClick) == null ? void 0 : _a.call(props, e);
16
+ onTabUpdate(e.currentTarget.value);
17
+ }
18
+ return /* @__PURE__ */ jsx(
19
+ "button",
20
+ {
21
+ ...nativeProps,
22
+ ...!isActive && { tabIndex: -1 },
23
+ "aria-controls": controls,
24
+ "aria-selected": isActive,
25
+ className: cx(nativeProps.className, btnStyles),
26
+ onClick: handleClick,
27
+ role: "tab",
28
+ value
29
+ }
30
+ );
31
+ }
32
+ var btnStyles = css({
33
+ fontSize: "sm",
34
+ fontWeight: "600",
35
+ h: "2.75rem",
36
+ position: "relative",
37
+ pxi: "4",
38
+ zIndex: "base",
39
+ _motionSafe: {
40
+ transition: "all 200ms ease-in-out",
41
+ _before: {
42
+ transitionProperty: "height",
43
+ transitionDuration: "200ms",
44
+ transitionTimingFunction: "ease-in-out"
45
+ },
46
+ _after: {
47
+ transitionProperty: "height",
48
+ transitionDuration: "200ms",
49
+ transitionTimingFunction: "ease-in-out"
50
+ }
51
+ },
52
+ _before: {
53
+ bgColor: "action.border.initial",
54
+ bottom: "0",
55
+ content: '""',
56
+ h: "0",
57
+ position: "absolute",
58
+ left: "0",
59
+ right: "0",
60
+ w: "full",
61
+ willChange: "height",
62
+ zIndex: "decorator"
63
+ },
64
+ _after: {
65
+ borderTopLeftRadius: "md",
66
+ borderTopRightRadius: "md",
67
+ bottom: "0",
68
+ bgColor: "neutral.surface.100",
69
+ content: '""',
70
+ left: "0",
71
+ position: "absolute",
72
+ right: "0",
73
+ h: "0",
74
+ w: "full",
75
+ willChange: "height",
76
+ zIndex: "-1"
77
+ },
78
+ _hover: {
79
+ _after: {
80
+ h: "full"
81
+ }
82
+ },
83
+ _focusVisible: {
84
+ boxShadow: "none",
85
+ outline: "3px solid",
86
+ outlineColor: "action.border.focus",
87
+ outlineOffset: "2px"
88
+ },
89
+ _disabled: {
90
+ cursor: "not-allowed",
91
+ opacity: "0.5"
92
+ },
93
+ _selected: {
94
+ color: "action.text.200",
95
+ _before: {
96
+ h: "3px"
97
+ },
98
+ _hover: {
99
+ _after: {
100
+ h: "0"
101
+ }
102
+ }
103
+ }
104
+ });
105
+
106
+ export {
107
+ Tab
108
+ };
109
+ //# sourceMappingURL=chunk-6DXQW4WK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Tab.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type ButtonHTMLAttributes, type MouseEvent } from 'react'\nimport { useTabsContext } from '../context/tabs'\nimport { css, cx } from '@cerberus/styled-system/css'\n\n/**\n * This module provides a Tab component.\n * @module\n */\n\nexport interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n id: string\n controls: string\n value: string\n}\n\n/**\n * The Tab component provides a tab element to be used in a TabList.\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [Tab docs](https://cerberus.digitalu.design/react/tabs)\n * @param id - the id of the tab (used for aria-labelledby in the panel)\n * @param controls - the id of the tab panel that the tab controls\n * @param value - the id of the tab that will be tracked as the active tab\n * @example\n * ```tsx\n * <Tab controls=\"panel:overview\" value=\"overview\">\n * Overview\n * </Tab>\n * ```\n */\nexport function Tab(props: TabProps) {\n const { controls, value, ...nativeProps } = props\n const { active, onTabUpdate } = useTabsContext()\n const isActive = useMemo(() => active === value, [active, value])\n\n function handleClick(e: MouseEvent<HTMLButtonElement>) {\n props.onClick?.(e)\n onTabUpdate(e.currentTarget.value)\n }\n\n return (\n <button\n {...nativeProps}\n {...(!isActive && { tabIndex: -1 })}\n aria-controls={controls}\n aria-selected={isActive}\n className={cx(nativeProps.className, btnStyles)}\n onClick={handleClick}\n role=\"tab\"\n value={value}\n />\n )\n}\n\nconst btnStyles = css({\n fontSize: 'sm',\n fontWeight: '600',\n h: '2.75rem',\n position: 'relative',\n pxi: '4',\n zIndex: 'base',\n _motionSafe: {\n transition: 'all 200ms ease-in-out',\n _before: {\n transitionProperty: 'height',\n transitionDuration: '200ms',\n transitionTimingFunction: 'ease-in-out',\n },\n _after: {\n transitionProperty: 'height',\n transitionDuration: '200ms',\n transitionTimingFunction: 'ease-in-out',\n },\n },\n _before: {\n bgColor: 'action.border.initial',\n bottom: '0',\n content: '\"\"',\n h: '0',\n position: 'absolute',\n left: '0',\n right: '0',\n w: 'full',\n willChange: 'height',\n zIndex: 'decorator',\n },\n _after: {\n borderTopLeftRadius: 'md',\n borderTopRightRadius: 'md',\n bottom: '0',\n bgColor: 'neutral.surface.100',\n content: '\"\"',\n left: '0',\n position: 'absolute',\n right: '0',\n h: '0',\n w: 'full',\n willChange: 'height',\n zIndex: '-1',\n },\n _hover: {\n _after: {\n h: 'full',\n },\n },\n _focusVisible: {\n boxShadow: 'none',\n outline: '3px solid',\n outlineColor: 'action.border.focus',\n outlineOffset: '2px',\n },\n _disabled: {\n cursor: 'not-allowed',\n opacity: '0.5',\n },\n _selected: {\n color: 'action.text.200',\n _before: {\n h: '3px',\n },\n _hover: {\n _after: {\n h: '0',\n },\n },\n },\n})\n"],"mappings":";;;;;AAEA,SAAS,eAA2D;AAEpE,SAAS,KAAK,UAAU;AAsCpB;AAXG,SAAS,IAAI,OAAiB;AACnC,QAAM,EAAE,UAAU,OAAO,GAAG,YAAY,IAAI;AAC5C,QAAM,EAAE,QAAQ,YAAY,IAAI,eAAe;AAC/C,QAAM,WAAW,QAAQ,MAAM,WAAW,OAAO,CAAC,QAAQ,KAAK,CAAC;AAEhE,WAAS,YAAY,GAAkC;AApCzD;AAqCI,gBAAM,YAAN,+BAAgB;AAChB,gBAAY,EAAE,cAAc,KAAK;AAAA,EACnC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,CAAC,YAAY,EAAE,UAAU,GAAG;AAAA,MACjC,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,WAAW,GAAG,YAAY,WAAW,SAAS;AAAA,MAC9C,SAAS;AAAA,MACT,MAAK;AAAA,MACL;AAAA;AAAA,EACF;AAEJ;AAEA,IAAM,YAAY,IAAI;AAAA,EACpB,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,GAAG;AAAA,EACH,UAAU;AAAA,EACV,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,aAAa;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,MACP,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB,0BAA0B;AAAA,IAC5B;AAAA,IACA,QAAQ;AAAA,MACN,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB,0BAA0B;AAAA,IAC5B;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,GAAG;AAAA,IACH,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,GAAG;AAAA,IACH,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AAAA,EACA,QAAQ;AAAA,IACN,qBAAqB;AAAA,IACrB,sBAAsB;AAAA,IACtB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,GAAG;AAAA,IACH,GAAG;AAAA,IACH,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AAAA,EACA,QAAQ;AAAA,IACN,QAAQ;AAAA,MACN,GAAG;AAAA,IACL;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,WAAW;AAAA,IACX,SAAS;AAAA,IACT,cAAc;AAAA,IACd,eAAe;AAAA,EACjB;AAAA,EACA,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,WAAW;AAAA,IACT,OAAO;AAAA,IACP,SAAS;AAAA,MACP,GAAG;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,MACN,QAAQ;AAAA,QACN,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -12,7 +12,10 @@ function TabList(props) {
12
12
  className: cx(
13
13
  nativeProps.className,
14
14
  hstack({
15
- gap: "0"
15
+ borderBottom: "1px solid",
16
+ borderBottomColor: "action.border.100",
17
+ gap: "0",
18
+ w: "full"
16
19
  })
17
20
  )
18
21
  }
@@ -22,4 +25,4 @@ function TabList(props) {
22
25
  export {
23
26
  TabList
24
27
  };
25
- //# sourceMappingURL=chunk-NWDAYAVH.js.map
28
+ //# sourceMappingURL=chunk-BVILNJ6M.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/TabList.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\n/**\n * This module provides a TabList component.\n * @module\n */\n\nexport interface TabListProps extends HTMLAttributes<HTMLDivElement> {\n description?: string\n}\n\n/**\n * The TabList component provides a container for tab elements.\n * @param description - a description of what the tab list contains\n * @example\n * ```tsx\n * <TabList description=\"Button details\">\n * <Tab id=\"overview\">Overview</Tab>\n * <Tab id=\"guidelines\">Guidelines</Tab>\n * </TabList>\n * ```\n */\nexport function TabList(props: PropsWithChildren<TabListProps>) {\n const { description, ...nativeProps } = props\n return (\n <div\n {...nativeProps}\n aria-describedby={description}\n className={cx(\n nativeProps.className,\n hstack({\n gap: '0',\n }),\n )}\n />\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,cAAc;AA0BnB;AAHG,SAAS,QAAQ,OAAwC;AAC9D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,oBAAkB;AAAA,MAClB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL,KAAK;AAAA,QACP,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/TabList.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\n/**\n * This module provides a TabList component.\n * @module\n */\n\nexport interface TabListProps extends HTMLAttributes<HTMLDivElement> {\n description?: string\n}\n\n/**\n * The TabList component provides a container for tab elements.\n * @param description - a description of what the tab list contains\n * @example\n * ```tsx\n * <TabList description=\"Button details\">\n * <Tab id=\"overview\">Overview</Tab>\n * <Tab id=\"guidelines\">Guidelines</Tab>\n * </TabList>\n * ```\n */\nexport function TabList(props: PropsWithChildren<TabListProps>) {\n const { description, ...nativeProps } = props\n return (\n <div\n {...nativeProps}\n aria-describedby={description}\n className={cx(\n nativeProps.className,\n hstack({\n borderBottom: '1px solid',\n borderBottomColor: 'action.border.100',\n gap: '0',\n w: 'full',\n }),\n )}\n />\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,cAAc;AA0BnB;AAHG,SAAS,QAAQ,OAAwC;AAC9D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,oBAAkB;AAAA,MAClB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL,cAAc;AAAA,UACd,mBAAmB;AAAA,UACnB,KAAK;AAAA,UACL,GAAG;AAAA,QACL,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -28,4 +28,4 @@ function TabPanel(props) {
28
28
  export {
29
29
  TabPanel
30
30
  };
31
- //# sourceMappingURL=chunk-XVDQL4L6.js.map
31
+ //# sourceMappingURL=chunk-UI7OR6PG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/TabPanel.tsx"],"sourcesContent":["'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { useMemo, type HTMLAttributes } from 'react'\nimport { useTabsContext } from '../context/tabs'\nimport { Show } from './Show'\n\n/**\n * This module provides a TabPanel component.\n * @module\n */\n\nexport interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {\n id: string\n tab: string\n}\n\n/**\n * The TabPanel component provides a panel element to be used in a Tabs provider.\n * @param id - the id of the tab panel which is used for the Tab's control prop\n * @param tab - the id of the tab that will be tracked as the active tab\n * @example\n * ```tsx\n * <TabPanel id=\"panel:overview\" tab=\"overview\">\n * Overview content\n * </TabPanel>\n * ```\n */\nexport function TabPanel(props: TabPanelProps) {\n const { tab, ...nativeProps } = props\n const { active } = useTabsContext()\n const isActive = useMemo(() => active === tab, [active, tab])\n\n return (\n <Show when={isActive}>\n <div\n {...nativeProps}\n {...(isActive && { tabIndex: 0 })}\n aria-labelledby={tab}\n className={cx(nativeProps.className, css())}\n role=\"tabpanel\"\n />\n </Show>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,KAAK,UAAU;AACxB,SAAS,eAAoC;AAgCvC;AAPC,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,KAAK,GAAG,YAAY,IAAI;AAChC,QAAM,EAAE,OAAO,IAAI,eAAe;AAClC,QAAM,WAAW,QAAQ,MAAM,WAAW,KAAK,CAAC,QAAQ,GAAG,CAAC;AAE5D,SACE,oBAAC,QAAK,MAAM,UACV;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,YAAY,EAAE,UAAU,EAAE;AAAA,MAC/B,mBAAiB;AAAA,MACjB,WAAW,GAAG,YAAY,WAAW,IAAI,CAAC;AAAA,MAC1C,MAAK;AAAA;AAAA,EACP,GACF;AAEJ;","names":[]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Tab
4
- } from "../chunk-NVA4SWUI.js";
4
+ } from "../chunk-6DXQW4WK.js";
5
5
  import "../chunk-24B4KIPX.js";
6
6
  export {
7
7
  Tab
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TabList
3
- } from "../chunk-NWDAYAVH.js";
3
+ } from "../chunk-BVILNJ6M.js";
4
4
  export {
5
5
  TabList
6
6
  };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  TabPanel
4
- } from "../chunk-XVDQL4L6.js";
4
+ } from "../chunk-UI7OR6PG.js";
5
5
  import "../chunk-24B4KIPX.js";
6
6
  import "../chunk-R4H3352X.js";
7
7
  export {
@@ -17,13 +17,13 @@ import {
17
17
  } from "./chunk-KJUCHZHV.js";
18
18
  import {
19
19
  Tab
20
- } from "./chunk-NVA4SWUI.js";
20
+ } from "./chunk-6DXQW4WK.js";
21
21
  import {
22
22
  TabList
23
- } from "./chunk-NWDAYAVH.js";
23
+ } from "./chunk-BVILNJ6M.js";
24
24
  import {
25
25
  TabPanel
26
- } from "./chunk-XVDQL4L6.js";
26
+ } from "./chunk-UI7OR6PG.js";
27
27
  import {
28
28
  Tabs,
29
29
  useTabsContext
@@ -277,6 +277,20 @@ declare interface ShowProps {
277
277
  export { ShowProps }
278
278
  export { ShowProps as ShowProps_alias_1 }
279
279
 
280
+ /**
281
+ * The Tab component provides a tab element to be used in a TabList.
282
+ * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)
283
+ * @definition [Tab docs](https://cerberus.digitalu.design/react/tabs)
284
+ * @param id - the id of the tab (used for aria-labelledby in the panel)
285
+ * @param controls - the id of the tab panel that the tab controls
286
+ * @param value - the id of the tab that will be tracked as the active tab
287
+ * @example
288
+ * ```tsx
289
+ * <Tab controls="panel:overview" value="overview">
290
+ * Overview
291
+ * </Tab>
292
+ * ```
293
+ */
280
294
  declare function Tab(props: TabProps): JSX_2.Element;
281
295
  export { Tab }
282
296
  export { Tab as Tab_alias_1 }
@@ -306,11 +320,27 @@ declare interface TabListProps extends HTMLAttributes<HTMLDivElement> {
306
320
  export { TabListProps }
307
321
  export { TabListProps as TabListProps_alias_1 }
308
322
 
323
+ /**
324
+ * The TabPanel component provides a panel element to be used in a Tabs provider.
325
+ * @param id - the id of the tab panel which is used for the Tab's control prop
326
+ * @param tab - the id of the tab that will be tracked as the active tab
327
+ * @example
328
+ * ```tsx
329
+ * <TabPanel id="panel:overview" tab="overview">
330
+ * Overview content
331
+ * </TabPanel>
332
+ * ```
333
+ */
309
334
  declare function TabPanel(props: TabPanelProps): JSX_2.Element;
310
335
  export { TabPanel }
311
336
  export { TabPanel as TabPanel_alias_1 }
312
337
 
338
+ /**
339
+ * This module provides a TabPanel component.
340
+ * @module
341
+ */
313
342
  declare interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
343
+ id: string;
314
344
  tab: string;
315
345
  }
316
346
  export { TabPanelProps }
@@ -321,6 +351,7 @@ export { TabPanelProps as TabPanelProps_alias_1 }
321
351
  * @module
322
352
  */
323
353
  declare interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {
354
+ id: string;
324
355
  controls: string;
325
356
  value: string;
326
357
  }
@@ -0,0 +1,108 @@
1
+ import {
2
+ useTabsContext
3
+ } from "./chunk-24B4KIPX.js";
4
+
5
+ // src/components/Tab.tsx
6
+ import { useMemo } from "react";
7
+ import { css, cx } from "@cerberus/styled-system/css";
8
+ import { jsx } from "react/jsx-runtime";
9
+ function Tab(props) {
10
+ const { controls, value, ...nativeProps } = props;
11
+ const { active, onTabUpdate } = useTabsContext();
12
+ const isActive = useMemo(() => active === value, [active, value]);
13
+ function handleClick(e) {
14
+ props.onClick?.(e);
15
+ onTabUpdate(e.currentTarget.value);
16
+ }
17
+ return /* @__PURE__ */ jsx(
18
+ "button",
19
+ {
20
+ ...nativeProps,
21
+ ...!isActive && { tabIndex: -1 },
22
+ "aria-controls": controls,
23
+ "aria-selected": isActive,
24
+ className: cx(nativeProps.className, btnStyles),
25
+ onClick: handleClick,
26
+ role: "tab",
27
+ value
28
+ }
29
+ );
30
+ }
31
+ var btnStyles = css({
32
+ fontSize: "sm",
33
+ fontWeight: "600",
34
+ h: "2.75rem",
35
+ position: "relative",
36
+ pxi: "4",
37
+ zIndex: "base",
38
+ _motionSafe: {
39
+ transition: "all 200ms ease-in-out",
40
+ _before: {
41
+ transitionProperty: "height",
42
+ transitionDuration: "200ms",
43
+ transitionTimingFunction: "ease-in-out"
44
+ },
45
+ _after: {
46
+ transitionProperty: "height",
47
+ transitionDuration: "200ms",
48
+ transitionTimingFunction: "ease-in-out"
49
+ }
50
+ },
51
+ _before: {
52
+ bgColor: "action.border.initial",
53
+ bottom: "0",
54
+ content: '""',
55
+ h: "0",
56
+ position: "absolute",
57
+ left: "0",
58
+ right: "0",
59
+ w: "full",
60
+ willChange: "height",
61
+ zIndex: "decorator"
62
+ },
63
+ _after: {
64
+ borderTopLeftRadius: "md",
65
+ borderTopRightRadius: "md",
66
+ bottom: "0",
67
+ bgColor: "neutral.surface.100",
68
+ content: '""',
69
+ left: "0",
70
+ position: "absolute",
71
+ right: "0",
72
+ h: "0",
73
+ w: "full",
74
+ willChange: "height",
75
+ zIndex: "-1"
76
+ },
77
+ _hover: {
78
+ _after: {
79
+ h: "full"
80
+ }
81
+ },
82
+ _focusVisible: {
83
+ boxShadow: "none",
84
+ outline: "3px solid",
85
+ outlineColor: "action.border.focus",
86
+ outlineOffset: "2px"
87
+ },
88
+ _disabled: {
89
+ cursor: "not-allowed",
90
+ opacity: "0.5"
91
+ },
92
+ _selected: {
93
+ color: "action.text.200",
94
+ _before: {
95
+ h: "3px"
96
+ },
97
+ _hover: {
98
+ _after: {
99
+ h: "0"
100
+ }
101
+ }
102
+ }
103
+ });
104
+
105
+ export {
106
+ Tab
107
+ };
108
+ //# sourceMappingURL=chunk-AMFL3PZV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/Tab.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type ButtonHTMLAttributes, type MouseEvent } from 'react'\nimport { useTabsContext } from '../context/tabs'\nimport { css, cx } from '@cerberus/styled-system/css'\n\n/**\n * This module provides a Tab component.\n * @module\n */\n\nexport interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n id: string\n controls: string\n value: string\n}\n\n/**\n * The Tab component provides a tab element to be used in a TabList.\n * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)\n * @definition [Tab docs](https://cerberus.digitalu.design/react/tabs)\n * @param id - the id of the tab (used for aria-labelledby in the panel)\n * @param controls - the id of the tab panel that the tab controls\n * @param value - the id of the tab that will be tracked as the active tab\n * @example\n * ```tsx\n * <Tab controls=\"panel:overview\" value=\"overview\">\n * Overview\n * </Tab>\n * ```\n */\nexport function Tab(props: TabProps) {\n const { controls, value, ...nativeProps } = props\n const { active, onTabUpdate } = useTabsContext()\n const isActive = useMemo(() => active === value, [active, value])\n\n function handleClick(e: MouseEvent<HTMLButtonElement>) {\n props.onClick?.(e)\n onTabUpdate(e.currentTarget.value)\n }\n\n return (\n <button\n {...nativeProps}\n {...(!isActive && { tabIndex: -1 })}\n aria-controls={controls}\n aria-selected={isActive}\n className={cx(nativeProps.className, btnStyles)}\n onClick={handleClick}\n role=\"tab\"\n value={value}\n />\n )\n}\n\nconst btnStyles = css({\n fontSize: 'sm',\n fontWeight: '600',\n h: '2.75rem',\n position: 'relative',\n pxi: '4',\n zIndex: 'base',\n _motionSafe: {\n transition: 'all 200ms ease-in-out',\n _before: {\n transitionProperty: 'height',\n transitionDuration: '200ms',\n transitionTimingFunction: 'ease-in-out',\n },\n _after: {\n transitionProperty: 'height',\n transitionDuration: '200ms',\n transitionTimingFunction: 'ease-in-out',\n },\n },\n _before: {\n bgColor: 'action.border.initial',\n bottom: '0',\n content: '\"\"',\n h: '0',\n position: 'absolute',\n left: '0',\n right: '0',\n w: 'full',\n willChange: 'height',\n zIndex: 'decorator',\n },\n _after: {\n borderTopLeftRadius: 'md',\n borderTopRightRadius: 'md',\n bottom: '0',\n bgColor: 'neutral.surface.100',\n content: '\"\"',\n left: '0',\n position: 'absolute',\n right: '0',\n h: '0',\n w: 'full',\n willChange: 'height',\n zIndex: '-1',\n },\n _hover: {\n _after: {\n h: 'full',\n },\n },\n _focusVisible: {\n boxShadow: 'none',\n outline: '3px solid',\n outlineColor: 'action.border.focus',\n outlineOffset: '2px',\n },\n _disabled: {\n cursor: 'not-allowed',\n opacity: '0.5',\n },\n _selected: {\n color: 'action.text.200',\n _before: {\n h: '3px',\n },\n _hover: {\n _after: {\n h: '0',\n },\n },\n },\n})\n"],"mappings":";;;;;AAEA,SAAS,eAA2D;AAEpE,SAAS,KAAK,UAAU;AAsCpB;AAXG,SAAS,IAAI,OAAiB;AACnC,QAAM,EAAE,UAAU,OAAO,GAAG,YAAY,IAAI;AAC5C,QAAM,EAAE,QAAQ,YAAY,IAAI,eAAe;AAC/C,QAAM,WAAW,QAAQ,MAAM,WAAW,OAAO,CAAC,QAAQ,KAAK,CAAC;AAEhE,WAAS,YAAY,GAAkC;AACrD,UAAM,UAAU,CAAC;AACjB,gBAAY,EAAE,cAAc,KAAK;AAAA,EACnC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,CAAC,YAAY,EAAE,UAAU,GAAG;AAAA,MACjC,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,WAAW,GAAG,YAAY,WAAW,SAAS;AAAA,MAC9C,SAAS;AAAA,MACT,MAAK;AAAA,MACL;AAAA;AAAA,EACF;AAEJ;AAEA,IAAM,YAAY,IAAI;AAAA,EACpB,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,GAAG;AAAA,EACH,UAAU;AAAA,EACV,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,aAAa;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,MACP,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB,0BAA0B;AAAA,IAC5B;AAAA,IACA,QAAQ;AAAA,MACN,oBAAoB;AAAA,MACpB,oBAAoB;AAAA,MACpB,0BAA0B;AAAA,IAC5B;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,GAAG;AAAA,IACH,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,GAAG;AAAA,IACH,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AAAA,EACA,QAAQ;AAAA,IACN,qBAAqB;AAAA,IACrB,sBAAsB;AAAA,IACtB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,GAAG;AAAA,IACH,GAAG;AAAA,IACH,YAAY;AAAA,IACZ,QAAQ;AAAA,EACV;AAAA,EACA,QAAQ;AAAA,IACN,QAAQ;AAAA,MACN,GAAG;AAAA,IACL;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,WAAW;AAAA,IACX,SAAS;AAAA,IACT,cAAc;AAAA,IACd,eAAe;AAAA,EACjB;AAAA,EACA,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,EACX;AAAA,EACA,WAAW;AAAA,IACT,OAAO;AAAA,IACP,SAAS;AAAA,MACP,GAAG;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,MACN,QAAQ;AAAA,QACN,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACF,CAAC;","names":[]}
@@ -12,7 +12,10 @@ function TabList(props) {
12
12
  className: cx(
13
13
  nativeProps.className,
14
14
  hstack({
15
- gap: "0"
15
+ borderBottom: "1px solid",
16
+ borderBottomColor: "action.border.100",
17
+ gap: "0",
18
+ w: "full"
16
19
  })
17
20
  )
18
21
  }
@@ -22,4 +25,4 @@ function TabList(props) {
22
25
  export {
23
26
  TabList
24
27
  };
25
- //# sourceMappingURL=chunk-NWDAYAVH.js.map
28
+ //# sourceMappingURL=chunk-BVILNJ6M.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/TabList.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\n/**\n * This module provides a TabList component.\n * @module\n */\n\nexport interface TabListProps extends HTMLAttributes<HTMLDivElement> {\n description?: string\n}\n\n/**\n * The TabList component provides a container for tab elements.\n * @param description - a description of what the tab list contains\n * @example\n * ```tsx\n * <TabList description=\"Button details\">\n * <Tab id=\"overview\">Overview</Tab>\n * <Tab id=\"guidelines\">Guidelines</Tab>\n * </TabList>\n * ```\n */\nexport function TabList(props: PropsWithChildren<TabListProps>) {\n const { description, ...nativeProps } = props\n return (\n <div\n {...nativeProps}\n aria-describedby={description}\n className={cx(\n nativeProps.className,\n hstack({\n gap: '0',\n }),\n )}\n />\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,cAAc;AA0BnB;AAHG,SAAS,QAAQ,OAAwC;AAC9D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,oBAAkB;AAAA,MAClB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL,KAAK;AAAA,QACP,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/TabList.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\n/**\n * This module provides a TabList component.\n * @module\n */\n\nexport interface TabListProps extends HTMLAttributes<HTMLDivElement> {\n description?: string\n}\n\n/**\n * The TabList component provides a container for tab elements.\n * @param description - a description of what the tab list contains\n * @example\n * ```tsx\n * <TabList description=\"Button details\">\n * <Tab id=\"overview\">Overview</Tab>\n * <Tab id=\"guidelines\">Guidelines</Tab>\n * </TabList>\n * ```\n */\nexport function TabList(props: PropsWithChildren<TabListProps>) {\n const { description, ...nativeProps } = props\n return (\n <div\n {...nativeProps}\n aria-describedby={description}\n className={cx(\n nativeProps.className,\n hstack({\n borderBottom: '1px solid',\n borderBottomColor: 'action.border.100',\n gap: '0',\n w: 'full',\n }),\n )}\n />\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,cAAc;AA0BnB;AAHG,SAAS,QAAQ,OAAwC;AAC9D,QAAM,EAAE,aAAa,GAAG,YAAY,IAAI;AACxC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,oBAAkB;AAAA,MAClB,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL,cAAc;AAAA,UACd,mBAAmB;AAAA,UACnB,KAAK;AAAA,UACL,GAAG;AAAA,QACL,CAAC;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -28,4 +28,4 @@ function TabPanel(props) {
28
28
  export {
29
29
  TabPanel
30
30
  };
31
- //# sourceMappingURL=chunk-XVDQL4L6.js.map
31
+ //# sourceMappingURL=chunk-UI7OR6PG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/TabPanel.tsx"],"sourcesContent":["'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { useMemo, type HTMLAttributes } from 'react'\nimport { useTabsContext } from '../context/tabs'\nimport { Show } from './Show'\n\n/**\n * This module provides a TabPanel component.\n * @module\n */\n\nexport interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {\n id: string\n tab: string\n}\n\n/**\n * The TabPanel component provides a panel element to be used in a Tabs provider.\n * @param id - the id of the tab panel which is used for the Tab's control prop\n * @param tab - the id of the tab that will be tracked as the active tab\n * @example\n * ```tsx\n * <TabPanel id=\"panel:overview\" tab=\"overview\">\n * Overview content\n * </TabPanel>\n * ```\n */\nexport function TabPanel(props: TabPanelProps) {\n const { tab, ...nativeProps } = props\n const { active } = useTabsContext()\n const isActive = useMemo(() => active === tab, [active, tab])\n\n return (\n <Show when={isActive}>\n <div\n {...nativeProps}\n {...(isActive && { tabIndex: 0 })}\n aria-labelledby={tab}\n className={cx(nativeProps.className, css())}\n role=\"tabpanel\"\n />\n </Show>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,KAAK,UAAU;AACxB,SAAS,eAAoC;AAgCvC;AAPC,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,KAAK,GAAG,YAAY,IAAI;AAChC,QAAM,EAAE,OAAO,IAAI,eAAe;AAClC,QAAM,WAAW,QAAQ,MAAM,WAAW,KAAK,CAAC,QAAQ,GAAG,CAAC;AAE5D,SACE,oBAAC,QAAK,MAAM,UACV;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,YAAY,EAAE,UAAU,EAAE;AAAA,MAC/B,mBAAiB;AAAA,MACjB,WAAW,GAAG,YAAY,WAAW,IAAI,CAAC;AAAA,MAC1C,MAAK;AAAA;AAAA,EACP,GACF;AAEJ;","names":[]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Tab
4
- } from "../chunk-X5PQA2JN.js";
4
+ } from "../chunk-AMFL3PZV.js";
5
5
  import "../chunk-24B4KIPX.js";
6
6
  export {
7
7
  Tab
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TabList
3
- } from "../chunk-NWDAYAVH.js";
3
+ } from "../chunk-BVILNJ6M.js";
4
4
  export {
5
5
  TabList
6
6
  };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  TabPanel
4
- } from "../chunk-XVDQL4L6.js";
4
+ } from "../chunk-UI7OR6PG.js";
5
5
  import "../chunk-24B4KIPX.js";
6
6
  import "../chunk-R4H3352X.js";
7
7
  export {
@@ -17,13 +17,13 @@ import {
17
17
  } from "./chunk-KJUCHZHV.js";
18
18
  import {
19
19
  Tab
20
- } from "./chunk-X5PQA2JN.js";
20
+ } from "./chunk-AMFL3PZV.js";
21
21
  import {
22
22
  TabList
23
- } from "./chunk-NWDAYAVH.js";
23
+ } from "./chunk-BVILNJ6M.js";
24
24
  import {
25
25
  TabPanel
26
- } from "./chunk-XVDQL4L6.js";
26
+ } from "./chunk-UI7OR6PG.js";
27
27
  import {
28
28
  Tabs,
29
29
  useTabsContext
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.2.0-next-ec538ca",
3
+ "version": "0.2.0-next-87c3df1",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -10,10 +10,25 @@ import { css, cx } from '@cerberus/styled-system/css'
10
10
  */
11
11
 
12
12
  export interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {
13
+ id: string
13
14
  controls: string
14
15
  value: string
15
16
  }
16
17
 
18
+ /**
19
+ * The Tab component provides a tab element to be used in a TabList.
20
+ * @definition [ARIA Target Size](https://www.w3.org/WAI/WCAG21/Understanding/target-size.html#:~:text=Understanding%20SC%202.5.,%3ATarget%20Size%20(Level%20AAA)&text=The%20size%20of%20the%20target,Equivalent)
21
+ * @definition [Tab docs](https://cerberus.digitalu.design/react/tabs)
22
+ * @param id - the id of the tab (used for aria-labelledby in the panel)
23
+ * @param controls - the id of the tab panel that the tab controls
24
+ * @param value - the id of the tab that will be tracked as the active tab
25
+ * @example
26
+ * ```tsx
27
+ * <Tab controls="panel:overview" value="overview">
28
+ * Overview
29
+ * </Tab>
30
+ * ```
31
+ */
17
32
  export function Tab(props: TabProps) {
18
33
  const { controls, value, ...nativeProps } = props
19
34
  const { active, onTabUpdate } = useTabsContext()
@@ -30,10 +45,84 @@ export function Tab(props: TabProps) {
30
45
  {...(!isActive && { tabIndex: -1 })}
31
46
  aria-controls={controls}
32
47
  aria-selected={isActive}
33
- className={cx(nativeProps.className, css())}
48
+ className={cx(nativeProps.className, btnStyles)}
34
49
  onClick={handleClick}
35
50
  role="tab"
36
51
  value={value}
37
52
  />
38
53
  )
39
54
  }
55
+
56
+ const btnStyles = css({
57
+ fontSize: 'sm',
58
+ fontWeight: '600',
59
+ h: '2.75rem',
60
+ position: 'relative',
61
+ pxi: '4',
62
+ zIndex: 'base',
63
+ _motionSafe: {
64
+ transition: 'all 200ms ease-in-out',
65
+ _before: {
66
+ transitionProperty: 'height',
67
+ transitionDuration: '200ms',
68
+ transitionTimingFunction: 'ease-in-out',
69
+ },
70
+ _after: {
71
+ transitionProperty: 'height',
72
+ transitionDuration: '200ms',
73
+ transitionTimingFunction: 'ease-in-out',
74
+ },
75
+ },
76
+ _before: {
77
+ bgColor: 'action.border.initial',
78
+ bottom: '0',
79
+ content: '""',
80
+ h: '0',
81
+ position: 'absolute',
82
+ left: '0',
83
+ right: '0',
84
+ w: 'full',
85
+ willChange: 'height',
86
+ zIndex: 'decorator',
87
+ },
88
+ _after: {
89
+ borderTopLeftRadius: 'md',
90
+ borderTopRightRadius: 'md',
91
+ bottom: '0',
92
+ bgColor: 'neutral.surface.100',
93
+ content: '""',
94
+ left: '0',
95
+ position: 'absolute',
96
+ right: '0',
97
+ h: '0',
98
+ w: 'full',
99
+ willChange: 'height',
100
+ zIndex: '-1',
101
+ },
102
+ _hover: {
103
+ _after: {
104
+ h: 'full',
105
+ },
106
+ },
107
+ _focusVisible: {
108
+ boxShadow: 'none',
109
+ outline: '3px solid',
110
+ outlineColor: 'action.border.focus',
111
+ outlineOffset: '2px',
112
+ },
113
+ _disabled: {
114
+ cursor: 'not-allowed',
115
+ opacity: '0.5',
116
+ },
117
+ _selected: {
118
+ color: 'action.text.200',
119
+ _before: {
120
+ h: '3px',
121
+ },
122
+ _hover: {
123
+ _after: {
124
+ h: '0',
125
+ },
126
+ },
127
+ },
128
+ })
@@ -31,7 +31,10 @@ export function TabList(props: PropsWithChildren<TabListProps>) {
31
31
  className={cx(
32
32
  nativeProps.className,
33
33
  hstack({
34
+ borderBottom: '1px solid',
35
+ borderBottomColor: 'action.border.100',
34
36
  gap: '0',
37
+ w: 'full',
35
38
  }),
36
39
  )}
37
40
  />
@@ -5,10 +5,27 @@ import { useMemo, type HTMLAttributes } from 'react'
5
5
  import { useTabsContext } from '../context/tabs'
6
6
  import { Show } from './Show'
7
7
 
8
+ /**
9
+ * This module provides a TabPanel component.
10
+ * @module
11
+ */
12
+
8
13
  export interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
14
+ id: string
9
15
  tab: string
10
16
  }
11
17
 
18
+ /**
19
+ * The TabPanel component provides a panel element to be used in a Tabs provider.
20
+ * @param id - the id of the tab panel which is used for the Tab's control prop
21
+ * @param tab - the id of the tab that will be tracked as the active tab
22
+ * @example
23
+ * ```tsx
24
+ * <TabPanel id="panel:overview" tab="overview">
25
+ * Overview content
26
+ * </TabPanel>
27
+ * ```
28
+ */
12
29
  export function TabPanel(props: TabPanelProps) {
13
30
  const { tab, ...nativeProps } = props
14
31
  const { active } = useTabsContext()
@@ -1,36 +0,0 @@
1
- import {
2
- useTabsContext
3
- } from "./chunk-24B4KIPX.js";
4
-
5
- // src/components/Tab.tsx
6
- import { useMemo } from "react";
7
- import { css, cx } from "@cerberus/styled-system/css";
8
- import { jsx } from "react/jsx-runtime";
9
- function Tab(props) {
10
- const { controls, value, ...nativeProps } = props;
11
- const { active, onTabUpdate } = useTabsContext();
12
- const isActive = useMemo(() => active === value, [active, value]);
13
- function handleClick(e) {
14
- var _a;
15
- (_a = props.onClick) == null ? void 0 : _a.call(props, e);
16
- onTabUpdate(e.currentTarget.value);
17
- }
18
- return /* @__PURE__ */ jsx(
19
- "button",
20
- {
21
- ...nativeProps,
22
- ...!isActive && { tabIndex: -1 },
23
- "aria-controls": controls,
24
- "aria-selected": isActive,
25
- className: cx(nativeProps.className, css()),
26
- onClick: handleClick,
27
- role: "tab",
28
- value
29
- }
30
- );
31
- }
32
-
33
- export {
34
- Tab
35
- };
36
- //# sourceMappingURL=chunk-NVA4SWUI.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Tab.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type ButtonHTMLAttributes, type MouseEvent } from 'react'\nimport { useTabsContext } from '../context/tabs'\nimport { css, cx } from '@cerberus/styled-system/css'\n\n/**\n * This module provides a Tab component.\n * @module\n */\n\nexport interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n controls: string\n value: string\n}\n\nexport function Tab(props: TabProps) {\n const { controls, value, ...nativeProps } = props\n const { active, onTabUpdate } = useTabsContext()\n const isActive = useMemo(() => active === value, [active, value])\n\n function handleClick(e: MouseEvent<HTMLButtonElement>) {\n props.onClick?.(e)\n onTabUpdate(e.currentTarget.value)\n }\n\n return (\n <button\n {...nativeProps}\n {...(!isActive && { tabIndex: -1 })}\n aria-controls={controls}\n aria-selected={isActive}\n className={cx(nativeProps.className, css())}\n onClick={handleClick}\n role=\"tab\"\n value={value}\n />\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,eAA2D;AAEpE,SAAS,KAAK,UAAU;AAuBpB;AAXG,SAAS,IAAI,OAAiB;AACnC,QAAM,EAAE,UAAU,OAAO,GAAG,YAAY,IAAI;AAC5C,QAAM,EAAE,QAAQ,YAAY,IAAI,eAAe;AAC/C,QAAM,WAAW,QAAQ,MAAM,WAAW,OAAO,CAAC,QAAQ,KAAK,CAAC;AAEhE,WAAS,YAAY,GAAkC;AArBzD;AAsBI,gBAAM,YAAN,+BAAgB;AAChB,gBAAY,EAAE,cAAc,KAAK;AAAA,EACnC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,CAAC,YAAY,EAAE,UAAU,GAAG;AAAA,MACjC,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,WAAW,GAAG,YAAY,WAAW,IAAI,CAAC;AAAA,MAC1C,SAAS;AAAA,MACT,MAAK;AAAA,MACL;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/TabPanel.tsx"],"sourcesContent":["'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { useMemo, type HTMLAttributes } from 'react'\nimport { useTabsContext } from '../context/tabs'\nimport { Show } from './Show'\n\nexport interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {\n tab: string\n}\n\nexport function TabPanel(props: TabPanelProps) {\n const { tab, ...nativeProps } = props\n const { active } = useTabsContext()\n const isActive = useMemo(() => active === tab, [active, tab])\n\n return (\n <Show when={isActive}>\n <div\n {...nativeProps}\n {...(isActive && { tabIndex: 0 })}\n aria-labelledby={tab}\n className={cx(nativeProps.className, css())}\n role=\"tabpanel\"\n />\n </Show>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,KAAK,UAAU;AACxB,SAAS,eAAoC;AAevC;AAPC,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,KAAK,GAAG,YAAY,IAAI;AAChC,QAAM,EAAE,OAAO,IAAI,eAAe;AAClC,QAAM,WAAW,QAAQ,MAAM,WAAW,KAAK,CAAC,QAAQ,GAAG,CAAC;AAE5D,SACE,oBAAC,QAAK,MAAM,UACV;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,YAAY,EAAE,UAAU,EAAE;AAAA,MAC/B,mBAAiB;AAAA,MACjB,WAAW,GAAG,YAAY,WAAW,IAAI,CAAC;AAAA,MAC1C,MAAK;AAAA;AAAA,EACP,GACF;AAEJ;","names":[]}
@@ -1,35 +0,0 @@
1
- import {
2
- useTabsContext
3
- } from "./chunk-24B4KIPX.js";
4
-
5
- // src/components/Tab.tsx
6
- import { useMemo } from "react";
7
- import { css, cx } from "@cerberus/styled-system/css";
8
- import { jsx } from "react/jsx-runtime";
9
- function Tab(props) {
10
- const { controls, value, ...nativeProps } = props;
11
- const { active, onTabUpdate } = useTabsContext();
12
- const isActive = useMemo(() => active === value, [active, value]);
13
- function handleClick(e) {
14
- props.onClick?.(e);
15
- onTabUpdate(e.currentTarget.value);
16
- }
17
- return /* @__PURE__ */ jsx(
18
- "button",
19
- {
20
- ...nativeProps,
21
- ...!isActive && { tabIndex: -1 },
22
- "aria-controls": controls,
23
- "aria-selected": isActive,
24
- className: cx(nativeProps.className, css()),
25
- onClick: handleClick,
26
- role: "tab",
27
- value
28
- }
29
- );
30
- }
31
-
32
- export {
33
- Tab
34
- };
35
- //# sourceMappingURL=chunk-X5PQA2JN.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Tab.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, type ButtonHTMLAttributes, type MouseEvent } from 'react'\nimport { useTabsContext } from '../context/tabs'\nimport { css, cx } from '@cerberus/styled-system/css'\n\n/**\n * This module provides a Tab component.\n * @module\n */\n\nexport interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n controls: string\n value: string\n}\n\nexport function Tab(props: TabProps) {\n const { controls, value, ...nativeProps } = props\n const { active, onTabUpdate } = useTabsContext()\n const isActive = useMemo(() => active === value, [active, value])\n\n function handleClick(e: MouseEvent<HTMLButtonElement>) {\n props.onClick?.(e)\n onTabUpdate(e.currentTarget.value)\n }\n\n return (\n <button\n {...nativeProps}\n {...(!isActive && { tabIndex: -1 })}\n aria-controls={controls}\n aria-selected={isActive}\n className={cx(nativeProps.className, css())}\n onClick={handleClick}\n role=\"tab\"\n value={value}\n />\n )\n}\n"],"mappings":";;;;;AAEA,SAAS,eAA2D;AAEpE,SAAS,KAAK,UAAU;AAuBpB;AAXG,SAAS,IAAI,OAAiB;AACnC,QAAM,EAAE,UAAU,OAAO,GAAG,YAAY,IAAI;AAC5C,QAAM,EAAE,QAAQ,YAAY,IAAI,eAAe;AAC/C,QAAM,WAAW,QAAQ,MAAM,WAAW,OAAO,CAAC,QAAQ,KAAK,CAAC;AAEhE,WAAS,YAAY,GAAkC;AACrD,UAAM,UAAU,CAAC;AACjB,gBAAY,EAAE,cAAc,KAAK;AAAA,EACnC;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,CAAC,YAAY,EAAE,UAAU,GAAG;AAAA,MACjC,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,WAAW,GAAG,YAAY,WAAW,IAAI,CAAC;AAAA,MAC1C,SAAS;AAAA,MACT,MAAK;AAAA,MACL;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/TabPanel.tsx"],"sourcesContent":["'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { useMemo, type HTMLAttributes } from 'react'\nimport { useTabsContext } from '../context/tabs'\nimport { Show } from './Show'\n\nexport interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {\n tab: string\n}\n\nexport function TabPanel(props: TabPanelProps) {\n const { tab, ...nativeProps } = props\n const { active } = useTabsContext()\n const isActive = useMemo(() => active === tab, [active, tab])\n\n return (\n <Show when={isActive}>\n <div\n {...nativeProps}\n {...(isActive && { tabIndex: 0 })}\n aria-labelledby={tab}\n className={cx(nativeProps.className, css())}\n role=\"tabpanel\"\n />\n </Show>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,KAAK,UAAU;AACxB,SAAS,eAAoC;AAevC;AAPC,SAAS,SAAS,OAAsB;AAC7C,QAAM,EAAE,KAAK,GAAG,YAAY,IAAI;AAChC,QAAM,EAAE,OAAO,IAAI,eAAe;AAClC,QAAM,WAAW,QAAQ,MAAM,WAAW,KAAK,CAAC,QAAQ,GAAG,CAAC;AAE5D,SACE,oBAAC,QAAK,MAAM,UACV;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAI,YAAY,EAAE,UAAU,EAAE;AAAA,MAC/B,mBAAiB;AAAA,MACjB,WAAW,GAAG,YAAY,WAAW,IAAI,CAAC;AAAA,MAC1C,MAAK;AAAA;AAAA,EACP,GACF;AAEJ;","names":[]}