@cerberus-design/react 0.8.0-next-7efbb36 → 0.8.0-next-29d0773

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.
@@ -91,6 +91,7 @@ import { PointerSensorOptions } from '@dnd-kit/core';
91
91
  import { PointerSensorProps } from '@dnd-kit/core';
92
92
  import { pointerWithin } from '@dnd-kit/core';
93
93
  import type { Pretty } from '@cerberus/styled-system/types';
94
+ import { ProgressBarVariantProps } from '@cerberus/styled-system/recipes';
94
95
  import { PropsWithChildren } from 'react';
95
96
  import { radio } from '@cerberus/styled-system/recipes';
96
97
  import { ReactNode } from 'react';
@@ -509,6 +510,13 @@ export { IconButtonRecipeProps as IconButtonRecipeProps_alias_1 }
509
510
 
510
511
  export declare type IconType = CarbonIconType | ElementType;
511
512
 
513
+ declare type IndeterminateProgressBarProps = {
514
+ indeterminate: true;
515
+ now?: never;
516
+ };
517
+ export { IndeterminateProgressBarProps }
518
+ export { IndeterminateProgressBarProps as IndeterminateProgressBarProps_alias_1 }
519
+
512
520
  declare function Input(props: InputProps): JSX_2.Element;
513
521
  export { Input }
514
522
  export { Input as Input_alias_1 }
@@ -785,6 +793,13 @@ declare type NavTriggerRef = RefObject<HTMLButtonElement>;
785
793
  export { NavTriggerRef }
786
794
  export { NavTriggerRef as NavTriggerRef_alias_1 }
787
795
 
796
+ declare type NonIndeterminateProgressBarProps = {
797
+ indeterminate?: never;
798
+ now: number;
799
+ };
800
+ export { NonIndeterminateProgressBarProps }
801
+ export { NonIndeterminateProgressBarProps as NonIndeterminateProgressBarProps_alias_1 }
802
+
788
803
  /**
789
804
  * The info notification component.
790
805
  * @param props - The component props.
@@ -942,6 +957,33 @@ declare type Positions = 'top' | 'right' | 'bottom' | 'left';
942
957
  export { Positions }
943
958
  export { Positions as Positions_alias_1 }
944
959
 
960
+ /**
961
+ * The ProgressBar component is used to display the progress of a task.
962
+ * @param props - HTML div element attributes
963
+ * @param props.now - The current value of the progress bar
964
+ * @param props.indeterminate - Whether the progress bar is indeterminate
965
+ * @example
966
+ * ```tsx
967
+ * <ProgressBar value={75} />
968
+ * ```
969
+ */
970
+ declare function ProgressBar(props: ProgressBarProps): JSX_2.Element;
971
+ export { ProgressBar }
972
+ export { ProgressBar as ProgressBar_alias_1 }
973
+
974
+ /**
975
+ * This module contains the ProgressBar component.
976
+ * @module
977
+ */
978
+ declare interface ProgressBarBaseProps extends HTMLAttributes<HTMLDivElement> {
979
+ }
980
+ export { ProgressBarBaseProps }
981
+ export { ProgressBarBaseProps as ProgressBarBaseProps_alias_1 }
982
+
983
+ declare type ProgressBarProps = ProgressBarBaseProps & ProgressBarVariantProps & (NonIndeterminateProgressBarProps | IndeterminateProgressBarProps);
984
+ export { ProgressBarProps }
985
+ export { ProgressBarProps as ProgressBarProps_alias_1 }
986
+
945
987
  /**
946
988
  * Provides a prompt modal to the app.
947
989
  * @example
@@ -0,0 +1,39 @@
1
+ // src/components/ProgressBar.tsx
2
+ import { cx } from "@cerberus/styled-system/css";
3
+ import {
4
+ progressBar
5
+ } from "@cerberus/styled-system/recipes";
6
+ import { jsx } from "react/jsx-runtime";
7
+ function ProgressBar(props) {
8
+ const { indeterminate, size, usage, now, ...nativeProps } = props;
9
+ const styles = progressBar({ size, usage });
10
+ const nowClamped = Math.min(100, Math.max(0, now || 0));
11
+ const width = {
12
+ width: indeterminate ? "50%" : `${nowClamped}%`
13
+ };
14
+ return /* @__PURE__ */ jsx(
15
+ "div",
16
+ {
17
+ ...nativeProps,
18
+ "aria-valuemin": 0,
19
+ "aria-valuemax": 100,
20
+ "aria-valuenow": indeterminate ? 0 : nowClamped,
21
+ className: cx(nativeProps.className, styles.root),
22
+ role: "meter",
23
+ children: /* @__PURE__ */ jsx(
24
+ "div",
25
+ {
26
+ ...indeterminate && { "data-indeterminate": true },
27
+ "data-complete": nowClamped === 100,
28
+ className: styles.bar,
29
+ style: width
30
+ }
31
+ )
32
+ }
33
+ );
34
+ }
35
+
36
+ export {
37
+ ProgressBar
38
+ };
39
+ //# sourceMappingURL=chunk-TYTEREKZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/ProgressBar.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport {\n progressBar,\n type ProgressBarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ProgressBar component.\n * @module\n */\n\nexport interface ProgressBarBaseProps extends HTMLAttributes<HTMLDivElement> {}\nexport type NonIndeterminateProgressBarProps = {\n indeterminate?: never\n now: number\n}\nexport type IndeterminateProgressBarProps = {\n indeterminate: true\n now?: never\n}\nexport type ProgressBarProps = ProgressBarBaseProps &\n ProgressBarVariantProps &\n (NonIndeterminateProgressBarProps | IndeterminateProgressBarProps)\n\n/**\n * The ProgressBar component is used to display the progress of a task.\n * @param props - HTML div element attributes\n * @param props.now - The current value of the progress bar\n * @param props.indeterminate - Whether the progress bar is indeterminate\n * @example\n * ```tsx\n * <ProgressBar value={75} />\n * ```\n */\nexport function ProgressBar(props: ProgressBarProps) {\n const { indeterminate, size, usage, now, ...nativeProps } = props\n const styles = progressBar({ size, usage })\n const nowClamped = Math.min(100, Math.max(0, now || 0))\n const width = {\n width: indeterminate ? '50%' : `${nowClamped}%`,\n }\n\n return (\n <div\n {...nativeProps}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={indeterminate ? 0 : nowClamped}\n className={cx(nativeProps.className, styles.root)}\n role=\"meter\"\n >\n <div\n {...(indeterminate && { 'data-indeterminate': true })}\n data-complete={nowClamped === 100}\n className={styles.bar}\n style={width}\n />\n </div>\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAgDD;AAjBC,SAAS,YAAY,OAAyB;AACnD,QAAM,EAAE,eAAe,MAAM,OAAO,KAAK,GAAG,YAAY,IAAI;AAC5D,QAAM,SAAS,YAAY,EAAE,MAAM,MAAM,CAAC;AAC1C,QAAM,aAAa,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC;AACtD,QAAM,QAAQ;AAAA,IACZ,OAAO,gBAAgB,QAAQ,GAAG,UAAU;AAAA,EAC9C;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,iBAAe,gBAAgB,IAAI;AAAA,MACnC,WAAW,GAAG,YAAY,WAAW,OAAO,IAAI;AAAA,MAChD,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACE,GAAI,iBAAiB,EAAE,sBAAsB,KAAK;AAAA,UACnD,iBAAe,eAAe;AAAA,UAC9B,WAAW,OAAO;AAAA,UAClB,OAAO;AAAA;AAAA,MACT;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ ProgressBar
3
+ } from "../chunk-TYTEREKZ.js";
4
+ export {
5
+ ProgressBar
6
+ };
7
+ //# sourceMappingURL=ProgressBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -6,6 +6,9 @@ import {
6
6
  PromptModal,
7
7
  usePromptModal
8
8
  } from "./chunk-6CNSWNE2.js";
9
+ import {
10
+ Td
11
+ } from "./chunk-XREC5IJE.js";
9
12
  import {
10
13
  Textarea
11
14
  } from "./chunk-TCO46FK7.js";
@@ -22,6 +25,10 @@ import {
22
25
  ConfirmModal,
23
26
  useConfirmModal
24
27
  } from "./chunk-ITND4I7J.js";
28
+ import {
29
+ Option,
30
+ Select
31
+ } from "./chunk-MINQJYGV.js";
25
32
  import {
26
33
  Tab
27
34
  } from "./chunk-NE5NHILF.js";
@@ -41,9 +48,6 @@ import {
41
48
  import {
42
49
  Tbody
43
50
  } from "./chunk-PJ3744I6.js";
44
- import {
45
- Td
46
- } from "./chunk-XREC5IJE.js";
47
51
  import {
48
52
  NavMenuList,
49
53
  getPosition
@@ -67,13 +71,12 @@ import {
67
71
  import {
68
72
  Portal
69
73
  } from "./chunk-4CAT3FHV.js";
74
+ import {
75
+ ProgressBar
76
+ } from "./chunk-TYTEREKZ.js";
70
77
  import {
71
78
  Radio
72
79
  } from "./chunk-PH64POOB.js";
73
- import {
74
- Option,
75
- Select
76
- } from "./chunk-MINQJYGV.js";
77
80
  import {
78
81
  Input
79
82
  } from "./chunk-URKYD3YB.js";
@@ -192,6 +195,7 @@ export {
192
195
  NotificationHeading,
193
196
  Option,
194
197
  Portal,
198
+ ProgressBar,
195
199
  PromptModal,
196
200
  Radio,
197
201
  Select,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Button'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Button'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,cAAc;","names":[]}
@@ -91,6 +91,7 @@ import { PointerSensorOptions } from '@dnd-kit/core';
91
91
  import { PointerSensorProps } from '@dnd-kit/core';
92
92
  import { pointerWithin } from '@dnd-kit/core';
93
93
  import type { Pretty } from '@cerberus/styled-system/types';
94
+ import { ProgressBarVariantProps } from '@cerberus/styled-system/recipes';
94
95
  import { PropsWithChildren } from 'react';
95
96
  import { radio } from '@cerberus/styled-system/recipes';
96
97
  import { ReactNode } from 'react';
@@ -509,6 +510,13 @@ export { IconButtonRecipeProps as IconButtonRecipeProps_alias_1 }
509
510
 
510
511
  export declare type IconType = CarbonIconType | ElementType;
511
512
 
513
+ declare type IndeterminateProgressBarProps = {
514
+ indeterminate: true;
515
+ now?: never;
516
+ };
517
+ export { IndeterminateProgressBarProps }
518
+ export { IndeterminateProgressBarProps as IndeterminateProgressBarProps_alias_1 }
519
+
512
520
  declare function Input(props: InputProps): JSX_2.Element;
513
521
  export { Input }
514
522
  export { Input as Input_alias_1 }
@@ -785,6 +793,13 @@ declare type NavTriggerRef = RefObject<HTMLButtonElement>;
785
793
  export { NavTriggerRef }
786
794
  export { NavTriggerRef as NavTriggerRef_alias_1 }
787
795
 
796
+ declare type NonIndeterminateProgressBarProps = {
797
+ indeterminate?: never;
798
+ now: number;
799
+ };
800
+ export { NonIndeterminateProgressBarProps }
801
+ export { NonIndeterminateProgressBarProps as NonIndeterminateProgressBarProps_alias_1 }
802
+
788
803
  /**
789
804
  * The info notification component.
790
805
  * @param props - The component props.
@@ -942,6 +957,33 @@ declare type Positions = 'top' | 'right' | 'bottom' | 'left';
942
957
  export { Positions }
943
958
  export { Positions as Positions_alias_1 }
944
959
 
960
+ /**
961
+ * The ProgressBar component is used to display the progress of a task.
962
+ * @param props - HTML div element attributes
963
+ * @param props.now - The current value of the progress bar
964
+ * @param props.indeterminate - Whether the progress bar is indeterminate
965
+ * @example
966
+ * ```tsx
967
+ * <ProgressBar value={75} />
968
+ * ```
969
+ */
970
+ declare function ProgressBar(props: ProgressBarProps): JSX_2.Element;
971
+ export { ProgressBar }
972
+ export { ProgressBar as ProgressBar_alias_1 }
973
+
974
+ /**
975
+ * This module contains the ProgressBar component.
976
+ * @module
977
+ */
978
+ declare interface ProgressBarBaseProps extends HTMLAttributes<HTMLDivElement> {
979
+ }
980
+ export { ProgressBarBaseProps }
981
+ export { ProgressBarBaseProps as ProgressBarBaseProps_alias_1 }
982
+
983
+ declare type ProgressBarProps = ProgressBarBaseProps & ProgressBarVariantProps & (NonIndeterminateProgressBarProps | IndeterminateProgressBarProps);
984
+ export { ProgressBarProps }
985
+ export { ProgressBarProps as ProgressBarProps_alias_1 }
986
+
945
987
  /**
946
988
  * Provides a prompt modal to the app.
947
989
  * @example
@@ -0,0 +1,39 @@
1
+ // src/components/ProgressBar.tsx
2
+ import { cx } from "@cerberus/styled-system/css";
3
+ import {
4
+ progressBar
5
+ } from "@cerberus/styled-system/recipes";
6
+ import { jsx } from "react/jsx-runtime";
7
+ function ProgressBar(props) {
8
+ const { indeterminate, size, usage, now, ...nativeProps } = props;
9
+ const styles = progressBar({ size, usage });
10
+ const nowClamped = Math.min(100, Math.max(0, now || 0));
11
+ const width = {
12
+ width: indeterminate ? "50%" : `${nowClamped}%`
13
+ };
14
+ return /* @__PURE__ */ jsx(
15
+ "div",
16
+ {
17
+ ...nativeProps,
18
+ "aria-valuemin": 0,
19
+ "aria-valuemax": 100,
20
+ "aria-valuenow": indeterminate ? 0 : nowClamped,
21
+ className: cx(nativeProps.className, styles.root),
22
+ role: "meter",
23
+ children: /* @__PURE__ */ jsx(
24
+ "div",
25
+ {
26
+ ...indeterminate && { "data-indeterminate": true },
27
+ "data-complete": nowClamped === 100,
28
+ className: styles.bar,
29
+ style: width
30
+ }
31
+ )
32
+ }
33
+ );
34
+ }
35
+
36
+ export {
37
+ ProgressBar
38
+ };
39
+ //# sourceMappingURL=chunk-TYTEREKZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/ProgressBar.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport {\n progressBar,\n type ProgressBarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes } from 'react'\n\n/**\n * This module contains the ProgressBar component.\n * @module\n */\n\nexport interface ProgressBarBaseProps extends HTMLAttributes<HTMLDivElement> {}\nexport type NonIndeterminateProgressBarProps = {\n indeterminate?: never\n now: number\n}\nexport type IndeterminateProgressBarProps = {\n indeterminate: true\n now?: never\n}\nexport type ProgressBarProps = ProgressBarBaseProps &\n ProgressBarVariantProps &\n (NonIndeterminateProgressBarProps | IndeterminateProgressBarProps)\n\n/**\n * The ProgressBar component is used to display the progress of a task.\n * @param props - HTML div element attributes\n * @param props.now - The current value of the progress bar\n * @param props.indeterminate - Whether the progress bar is indeterminate\n * @example\n * ```tsx\n * <ProgressBar value={75} />\n * ```\n */\nexport function ProgressBar(props: ProgressBarProps) {\n const { indeterminate, size, usage, now, ...nativeProps } = props\n const styles = progressBar({ size, usage })\n const nowClamped = Math.min(100, Math.max(0, now || 0))\n const width = {\n width: indeterminate ? '50%' : `${nowClamped}%`,\n }\n\n return (\n <div\n {...nativeProps}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={indeterminate ? 0 : nowClamped}\n className={cx(nativeProps.className, styles.root)}\n role=\"meter\"\n >\n <div\n {...(indeterminate && { 'data-indeterminate': true })}\n data-complete={nowClamped === 100}\n className={styles.bar}\n style={width}\n />\n </div>\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,OAEK;AAgDD;AAjBC,SAAS,YAAY,OAAyB;AACnD,QAAM,EAAE,eAAe,MAAM,OAAO,KAAK,GAAG,YAAY,IAAI;AAC5D,QAAM,SAAS,YAAY,EAAE,MAAM,MAAM,CAAC;AAC1C,QAAM,aAAa,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC,CAAC;AACtD,QAAM,QAAQ;AAAA,IACZ,OAAO,gBAAgB,QAAQ,GAAG,UAAU;AAAA,EAC9C;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,iBAAe,gBAAgB,IAAI;AAAA,MACnC,WAAW,GAAG,YAAY,WAAW,OAAO,IAAI;AAAA,MAChD,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACE,GAAI,iBAAiB,EAAE,sBAAsB,KAAK;AAAA,UACnD,iBAAe,eAAe;AAAA,UAC9B,WAAW,OAAO;AAAA,UAClB,OAAO;AAAA;AAAA,MACT;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ ProgressBar
3
+ } from "../chunk-TYTEREKZ.js";
4
+ export {
5
+ ProgressBar
6
+ };
7
+ //# sourceMappingURL=ProgressBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -6,6 +6,9 @@ import {
6
6
  PromptModal,
7
7
  usePromptModal
8
8
  } from "./chunk-QRTCZO2W.js";
9
+ import {
10
+ Td
11
+ } from "./chunk-XREC5IJE.js";
9
12
  import {
10
13
  Textarea
11
14
  } from "./chunk-TCO46FK7.js";
@@ -22,6 +25,10 @@ import {
22
25
  ConfirmModal,
23
26
  useConfirmModal
24
27
  } from "./chunk-GM3AUVXL.js";
28
+ import {
29
+ Option,
30
+ Select
31
+ } from "./chunk-MINQJYGV.js";
25
32
  import {
26
33
  Tab
27
34
  } from "./chunk-SONHHNYQ.js";
@@ -41,9 +48,6 @@ import {
41
48
  import {
42
49
  Tbody
43
50
  } from "./chunk-PJ3744I6.js";
44
- import {
45
- Td
46
- } from "./chunk-XREC5IJE.js";
47
51
  import {
48
52
  NavMenuList,
49
53
  getPosition
@@ -67,13 +71,12 @@ import {
67
71
  import {
68
72
  Portal
69
73
  } from "./chunk-4CAT3FHV.js";
74
+ import {
75
+ ProgressBar
76
+ } from "./chunk-TYTEREKZ.js";
70
77
  import {
71
78
  Radio
72
79
  } from "./chunk-PH64POOB.js";
73
- import {
74
- Option,
75
- Select
76
- } from "./chunk-MINQJYGV.js";
77
80
  import {
78
81
  Input
79
82
  } from "./chunk-URKYD3YB.js";
@@ -192,6 +195,7 @@ export {
192
195
  NotificationHeading,
193
196
  Option,
194
197
  Portal,
198
+ ProgressBar,
195
199
  PromptModal,
196
200
  Radio,
197
201
  Select,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Button'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2EA,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Button'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.8.0-next-7efbb36",
3
+ "version": "0.8.0-next-29d0773",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -25,7 +25,7 @@
25
25
  "react": "^18",
26
26
  "react-dom": "^18",
27
27
  "tsup": "^8.1.0",
28
- "@cerberus-design/styled-system": "0.8.0-next-7efbb36",
28
+ "@cerberus-design/styled-system": "0.8.0-next-29d0773",
29
29
  "@cerberus-design/configs": "0.0.0"
30
30
  },
31
31
  "publishConfig": {
@@ -0,0 +1,61 @@
1
+ import { cx } from '@cerberus/styled-system/css'
2
+ import {
3
+ progressBar,
4
+ type ProgressBarVariantProps,
5
+ } from '@cerberus/styled-system/recipes'
6
+ import type { HTMLAttributes } from 'react'
7
+
8
+ /**
9
+ * This module contains the ProgressBar component.
10
+ * @module
11
+ */
12
+
13
+ export interface ProgressBarBaseProps extends HTMLAttributes<HTMLDivElement> {}
14
+ export type NonIndeterminateProgressBarProps = {
15
+ indeterminate?: never
16
+ now: number
17
+ }
18
+ export type IndeterminateProgressBarProps = {
19
+ indeterminate: true
20
+ now?: never
21
+ }
22
+ export type ProgressBarProps = ProgressBarBaseProps &
23
+ ProgressBarVariantProps &
24
+ (NonIndeterminateProgressBarProps | IndeterminateProgressBarProps)
25
+
26
+ /**
27
+ * The ProgressBar component is used to display the progress of a task.
28
+ * @param props - HTML div element attributes
29
+ * @param props.now - The current value of the progress bar
30
+ * @param props.indeterminate - Whether the progress bar is indeterminate
31
+ * @example
32
+ * ```tsx
33
+ * <ProgressBar value={75} />
34
+ * ```
35
+ */
36
+ export function ProgressBar(props: ProgressBarProps) {
37
+ const { indeterminate, size, usage, now, ...nativeProps } = props
38
+ const styles = progressBar({ size, usage })
39
+ const nowClamped = Math.min(100, Math.max(0, now || 0))
40
+ const width = {
41
+ width: indeterminate ? '50%' : `${nowClamped}%`,
42
+ }
43
+
44
+ return (
45
+ <div
46
+ {...nativeProps}
47
+ aria-valuemin={0}
48
+ aria-valuemax={100}
49
+ aria-valuenow={indeterminate ? 0 : nowClamped}
50
+ className={cx(nativeProps.className, styles.root)}
51
+ role="meter"
52
+ >
53
+ <div
54
+ {...(indeterminate && { 'data-indeterminate': true })}
55
+ data-complete={nowClamped === 100}
56
+ className={styles.bar}
57
+ style={width}
58
+ />
59
+ </div>
60
+ )
61
+ }
package/src/index.ts CHANGED
@@ -25,6 +25,7 @@ export * from './components/Notification'
25
25
  export * from './components/NotificationHeading'
26
26
  export * from './components/NotificationDescription'
27
27
  export * from './components/Portal'
28
+ export * from './components/ProgressBar'
28
29
  export * from './components/Radio'
29
30
  export * from './components/Select'
30
31
  export * from './components/Tab'