@cerberus-design/react 0.9.2-next-f877bc3 → 0.9.2-next-5604236

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 (52) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +51 -0
  2. package/build/legacy/components/CircularProgress.cjs +180 -0
  3. package/build/legacy/components/CircularProgress.cjs.map +1 -0
  4. package/build/legacy/components/FileStatus.cjs +1 -1
  5. package/build/legacy/components/FileStatus.cjs.map +1 -1
  6. package/build/legacy/components/ProgressBar.cjs +1 -1
  7. package/build/legacy/components/ProgressBar.cjs.map +1 -1
  8. package/build/legacy/components/Spinner.cjs.map +1 -1
  9. package/build/legacy/index.cjs +450 -297
  10. package/build/legacy/index.cjs.map +1 -1
  11. package/build/modern/_tsup-dts-rollup.d.ts +51 -0
  12. package/build/modern/chunk-A6CLBPFE.js +155 -0
  13. package/build/modern/chunk-A6CLBPFE.js.map +1 -0
  14. package/build/modern/{chunk-WFHZDHJB.js → chunk-AEDGCR25.js} +4 -4
  15. package/build/modern/{chunk-RSFFVJSM.js → chunk-CMKBUSGN.js} +7 -7
  16. package/build/modern/{chunk-TYTEREKZ.js → chunk-G6O7KRQ6.js} +2 -2
  17. package/build/modern/{chunk-TYTEREKZ.js.map → chunk-G6O7KRQ6.js.map} +1 -1
  18. package/build/modern/{chunk-ZCIJRM2X.js → chunk-GABTVDSB.js} +4 -4
  19. package/build/modern/{chunk-RN6HSKIG.js → chunk-IXOJLCNO.js} +1 -1
  20. package/build/modern/{chunk-RN6HSKIG.js.map → chunk-IXOJLCNO.js.map} +1 -1
  21. package/build/modern/{chunk-XGIACYC3.js → chunk-LAOQSNMN.js} +5 -5
  22. package/build/modern/{chunk-2FK7NR7Y.js → chunk-RQPDRHRP.js} +4 -4
  23. package/build/modern/{chunk-FMFKM2AB.js → chunk-SSY3KX3F.js} +4 -4
  24. package/build/modern/{chunk-VRPAW76S.js → chunk-XPVDT4VF.js} +4 -4
  25. package/build/modern/{chunk-V4Y7DU4B.js → chunk-ZBEHDXFT.js} +12 -12
  26. package/build/modern/components/Checkbox.js +2 -2
  27. package/build/modern/components/CircularProgress.js +8 -0
  28. package/build/modern/components/CircularProgress.js.map +1 -0
  29. package/build/modern/components/FileStatus.js +4 -4
  30. package/build/modern/components/Input.js +2 -2
  31. package/build/modern/components/Label.js +2 -2
  32. package/build/modern/components/ProgressBar.js +1 -1
  33. package/build/modern/components/Select.js +2 -2
  34. package/build/modern/components/Spinner.js +1 -1
  35. package/build/modern/context/confirm-modal.js +3 -3
  36. package/build/modern/context/notification-center.js +2 -2
  37. package/build/modern/context/prompt-modal.js +6 -6
  38. package/build/modern/index.js +34 -30
  39. package/build/modern/index.js.map +1 -1
  40. package/package.json +2 -2
  41. package/src/components/CircularProgress.tsx +170 -0
  42. package/src/components/ProgressBar.tsx +1 -1
  43. package/src/components/Spinner.tsx +15 -0
  44. package/src/index.ts +1 -0
  45. /package/build/modern/{chunk-WFHZDHJB.js.map → chunk-AEDGCR25.js.map} +0 -0
  46. /package/build/modern/{chunk-RSFFVJSM.js.map → chunk-CMKBUSGN.js.map} +0 -0
  47. /package/build/modern/{chunk-ZCIJRM2X.js.map → chunk-GABTVDSB.js.map} +0 -0
  48. /package/build/modern/{chunk-XGIACYC3.js.map → chunk-LAOQSNMN.js.map} +0 -0
  49. /package/build/modern/{chunk-2FK7NR7Y.js.map → chunk-RQPDRHRP.js.map} +0 -0
  50. /package/build/modern/{chunk-FMFKM2AB.js.map → chunk-SSY3KX3F.js.map} +0 -0
  51. /package/build/modern/{chunk-VRPAW76S.js.map → chunk-XPVDT4VF.js.map} +0 -0
  52. /package/build/modern/{chunk-V4Y7DU4B.js.map → chunk-ZBEHDXFT.js.map} +0 -0
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  PromptModal,
4
4
  usePromptModal
5
- } from "../chunk-V4Y7DU4B.js";
6
- import "../chunk-JB7IQ2BM.js";
5
+ } from "../chunk-ZBEHDXFT.js";
7
6
  import "../chunk-4CAT3FHV.js";
8
- import "../chunk-FMFKM2AB.js";
9
- import "../chunk-2FK7NR7Y.js";
7
+ import "../chunk-QU7UV5DB.js";
8
+ import "../chunk-JB7IQ2BM.js";
9
+ import "../chunk-SSY3KX3F.js";
10
+ import "../chunk-RQPDRHRP.js";
10
11
  import "../chunk-2UFNQM55.js";
11
12
  import "../chunk-4M4LCQ43.js";
12
- import "../chunk-QU7UV5DB.js";
13
13
  import "../chunk-UN3OAW56.js";
14
14
  import "../chunk-6F34A7NZ.js";
15
- import "../chunk-4O4QFF4S.js";
16
15
  import "../chunk-ZAU4JVLL.js";
16
+ import "../chunk-4O4QFF4S.js";
17
17
  import "../chunk-JIZQFTW6.js";
18
18
  import "../chunk-NBG2OSYI.js";
19
19
  import "../chunk-BDCFYW34.js";
@@ -1,19 +1,25 @@
1
+ import {
2
+ ThemeProvider,
3
+ useThemeContext
4
+ } from "./chunk-S3MTABYX.js";
5
+ import {
6
+ Toggle
7
+ } from "./chunk-4YJOK7JJ.js";
1
8
  import {
2
9
  ConfirmModal,
3
10
  useConfirmModal
4
- } from "./chunk-RSFFVJSM.js";
11
+ } from "./chunk-CMKBUSGN.js";
5
12
  import {
6
13
  NotificationCenter,
7
14
  useNotificationCenter
8
- } from "./chunk-WFHZDHJB.js";
15
+ } from "./chunk-AEDGCR25.js";
9
16
  import {
10
17
  PromptModal,
11
18
  usePromptModal
12
- } from "./chunk-V4Y7DU4B.js";
19
+ } from "./chunk-ZBEHDXFT.js";
13
20
  import {
14
- ThemeProvider,
15
- useThemeContext
16
- } from "./chunk-S3MTABYX.js";
21
+ TabPanel
22
+ } from "./chunk-U72VPIZA.js";
17
23
  import {
18
24
  Table,
19
25
  Tr
@@ -37,18 +43,18 @@ import {
37
43
  Thead
38
44
  } from "./chunk-N3FUF4TB.js";
39
45
  import {
40
- Toggle
41
- } from "./chunk-4YJOK7JJ.js";
46
+ Portal
47
+ } from "./chunk-4CAT3FHV.js";
42
48
  import {
43
49
  Radio
44
50
  } from "./chunk-PH64POOB.js";
45
51
  import {
46
52
  Option,
47
53
  Select
48
- } from "./chunk-VRPAW76S.js";
54
+ } from "./chunk-XPVDT4VF.js";
49
55
  import {
50
56
  Spinner
51
- } from "./chunk-RN6HSKIG.js";
57
+ } from "./chunk-IXOJLCNO.js";
52
58
  import {
53
59
  Tab
54
60
  } from "./chunk-SONHHNYQ.js";
@@ -56,8 +62,8 @@ import {
56
62
  TabList
57
63
  } from "./chunk-ISPTI4GC.js";
58
64
  import {
59
- TabPanel
60
- } from "./chunk-U72VPIZA.js";
65
+ ModalHeader
66
+ } from "./chunk-QU7UV5DB.js";
61
67
  import {
62
68
  ModalHeading
63
69
  } from "./chunk-JB7IQ2BM.js";
@@ -84,16 +90,16 @@ import {
84
90
  import {
85
91
  NotificationHeading
86
92
  } from "./chunk-3C2DJSEE.js";
87
- import {
88
- Portal
89
- } from "./chunk-4CAT3FHV.js";
90
93
  import {
91
94
  FileStatus,
92
95
  processStatus
93
- } from "./chunk-XGIACYC3.js";
96
+ } from "./chunk-LAOQSNMN.js";
94
97
  import {
95
98
  ProgressBar
96
- } from "./chunk-TYTEREKZ.js";
99
+ } from "./chunk-G6O7KRQ6.js";
100
+ import {
101
+ FieldMessage
102
+ } from "./chunk-VGHVH2T3.js";
97
103
  import {
98
104
  FileUploader
99
105
  } from "./chunk-BTEEBIVN.js";
@@ -102,19 +108,16 @@ import {
102
108
  } from "./chunk-SLHX5K6I.js";
103
109
  import {
104
110
  Input
105
- } from "./chunk-FMFKM2AB.js";
111
+ } from "./chunk-SSY3KX3F.js";
106
112
  import {
107
113
  Label
108
- } from "./chunk-2FK7NR7Y.js";
114
+ } from "./chunk-RQPDRHRP.js";
109
115
  import {
110
116
  Modal
111
117
  } from "./chunk-2UFNQM55.js";
112
118
  import {
113
119
  ModalDescription
114
120
  } from "./chunk-4M4LCQ43.js";
115
- import {
116
- ModalHeader
117
- } from "./chunk-QU7UV5DB.js";
118
121
  import {
119
122
  MODE_KEY,
120
123
  THEME_KEY,
@@ -131,7 +134,14 @@ import {
131
134
  } from "./chunk-6F34A7NZ.js";
132
135
  import {
133
136
  Checkbox
134
- } from "./chunk-ZCIJRM2X.js";
137
+ } from "./chunk-GABTVDSB.js";
138
+ import {
139
+ Field,
140
+ useFieldContext
141
+ } from "./chunk-ZAU4JVLL.js";
142
+ import {
143
+ CircularProgress
144
+ } from "./chunk-A6CLBPFE.js";
135
145
  import {
136
146
  Droppable
137
147
  } from "./chunk-7VJOPJVX.js";
@@ -145,13 +155,6 @@ import {
145
155
  import {
146
156
  Show
147
157
  } from "./chunk-4O4QFF4S.js";
148
- import {
149
- FieldMessage
150
- } from "./chunk-VGHVH2T3.js";
151
- import {
152
- Field,
153
- useFieldContext
154
- } from "./chunk-ZAU4JVLL.js";
155
158
  import "./chunk-55J6XMHW.js";
156
159
  import {
157
160
  createNavTriggerProps
@@ -184,6 +187,7 @@ export {
184
187
  Avatar,
185
188
  Button,
186
189
  Checkbox,
190
+ CircularProgress,
187
191
  ConfirmModal,
188
192
  Droppable,
189
193
  FeatureFlag,
@@ -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/Avatar'\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileStatus'\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/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/Spinner'\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,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/Avatar'\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/CircularProgress'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileStatus'\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/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/Spinner'\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/react",
3
- "version": "0.9.2-next-f877bc3",
3
+ "version": "0.9.2-next-5604236",
4
4
  "description": "The Cerberus Design React component library.",
5
5
  "browserslist": "> 0.25%, not dead",
6
6
  "sideEffects": false,
@@ -26,7 +26,7 @@
26
26
  "react-dom": "^18",
27
27
  "tsup": "^8.1.0",
28
28
  "@cerberus-design/configs": "0.0.0",
29
- "@cerberus-design/styled-system": "0.9.2-next-f877bc3"
29
+ "@cerberus-design/styled-system": "0.9.2-next-5604236"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
@@ -0,0 +1,170 @@
1
+ 'use client'
2
+
3
+ import { cq } from '@cerberus/styled-system/patterns'
4
+ import { css } from '@cerberus/styled-system/css'
5
+ import type { SVGProps } from 'react'
6
+
7
+ /**
8
+ * This module contains the CircularProgress component.
9
+ * @module
10
+ */
11
+
12
+ export interface CircularProgressProps extends SVGProps<SVGSVGElement> {
13
+ /**
14
+ * The current value of the CircularProgress
15
+ */
16
+ now: number
17
+ /**
18
+ * The title of the CircularProgress for a11y
19
+ */
20
+ title: string
21
+ /**
22
+ * What is shown below the now value (default: 'Done')
23
+ */
24
+ label?: string
25
+ }
26
+
27
+ /**
28
+ * The CircularProgress component is used to display a loading indicator.
29
+ * @param props - SVG element attributes
30
+ * @param props.now - The current value of the CircularProgress
31
+ * @param props.title - The title of the CircularProgress for a11y
32
+ * @param props.label - What is shown below the now value (default: 'Done')
33
+ * @description [CircularProgress Docs](https://cerberus.digitalu.design/react/progress/)
34
+ * @example
35
+ * ```tsx
36
+ * <CircularProgress now={24} title="Course completion" label="done" />
37
+ * ```
38
+ */
39
+ export function CircularProgress(props: CircularProgressProps) {
40
+ const strokeW: number = 14
41
+ const radius = `calc(50% * (1 - ${strokeW}/100))`
42
+ const status: string = props.label ?? 'Done'
43
+ const now: number = props.now >= 100 ? 100 : props.now
44
+
45
+ return (
46
+ <div
47
+ aria-valuemin={0}
48
+ aria-valuemax={100}
49
+ aria-valuenow={now}
50
+ className={cq({
51
+ alignSelf: 'stretch',
52
+ flex: 1,
53
+ m: '4px',
54
+ position: 'relative',
55
+ })}
56
+ role="progressbar"
57
+ >
58
+ <svg
59
+ data-complete={now === 100}
60
+ className={css({
61
+ display: 'block',
62
+ rounded: 'full',
63
+ transition: 'all 0.5s ease',
64
+ })}
65
+ fill="none"
66
+ strokeLinecap="round"
67
+ strokeWidth={strokeW}
68
+ viewBox="0 0 100 100"
69
+ xmlns="http://www.w3.org/2000/svg"
70
+ >
71
+ <title>{props.title}</title>
72
+ <desc>{`${now}% ${status}`}</desc>
73
+ <mask id="progMask">
74
+ <rect fill="white" width="100%" height="100%" />
75
+ <circle
76
+ className={css({
77
+ stroke: 'page.bg.100',
78
+ })}
79
+ cx="50%"
80
+ cy="50%"
81
+ r={radius}
82
+ pathLength="100"
83
+ />
84
+ <circle
85
+ className={css({
86
+ transition: 'stroke-dashoffset 0.5s ease',
87
+ })}
88
+ cx="50%"
89
+ cy="50%"
90
+ r={radius}
91
+ pathLength="100"
92
+ stroke="black"
93
+ strokeDasharray="100"
94
+ strokeDashoffset={100 - now}
95
+ transform="rotate(-90 50 50)"
96
+ />
97
+ </mask>
98
+
99
+ {/* <circle
100
+ fill="var(--cerberus-colors-page-surface-initial)"
101
+ cx="50%"
102
+ cy="50%"
103
+ r={`calc(50% * (1.15 - ${strokeW}/100))`}
104
+ pathLength="100"
105
+ mask="url(#progMask)"
106
+ /> */}
107
+
108
+ <circle
109
+ className={css({
110
+ fill: 'page.surface.initial',
111
+ })}
112
+ cx="50%"
113
+ cy="50%"
114
+ r={`calc(50% * (1 - ${strokeW}/100))`}
115
+ pathLength="100"
116
+ />
117
+ <circle
118
+ className={css({
119
+ stroke: 'page.bg.100',
120
+ })}
121
+ cx="50%"
122
+ cy="50%"
123
+ r={radius}
124
+ pathLength="100"
125
+ />
126
+ <circle
127
+ data-complete={now === 100}
128
+ className={css({
129
+ stroke: 'action.bg.initial',
130
+ transition: 'stroke-dashoffset 0.5s ease',
131
+ '&:is([data-complete=true])': {
132
+ stroke: 'success.bg.initial',
133
+ },
134
+ })}
135
+ cx="50%"
136
+ cy="50%"
137
+ r={radius}
138
+ pathLength="100"
139
+ strokeDasharray="100"
140
+ strokeDashoffset={100 - now}
141
+ transform="rotate(-90 50 50)"
142
+ />
143
+
144
+ <g>
145
+ <text
146
+ className={css({
147
+ fill: 'page.text.initial',
148
+ fontFamily: 'mono',
149
+ textStyle: '1.25rem',
150
+ })}
151
+ x="35%"
152
+ y="50%"
153
+ >
154
+ {now}%
155
+ </text>
156
+ <text
157
+ className={css({
158
+ fill: 'page.text.100',
159
+ fontSize: '0.5rem',
160
+ })}
161
+ x="39%"
162
+ y="60%"
163
+ >
164
+ {status}
165
+ </text>
166
+ </g>
167
+ </svg>
168
+ </div>
169
+ )
170
+ }
@@ -48,7 +48,7 @@ export function ProgressBar(props: ProgressBarProps) {
48
48
  aria-valuemax={100}
49
49
  aria-valuenow={indeterminate ? 0 : nowClamped}
50
50
  className={cx(nativeProps.className, styles.root)}
51
- role="meter"
51
+ role="progressbar"
52
52
  >
53
53
  <div
54
54
  {...(indeterminate && { 'data-indeterminate': true })}
@@ -1,9 +1,24 @@
1
1
  import type { SVGProps } from 'react'
2
2
 
3
+ /**
4
+ * This module contains the Spinner component.
5
+ * @module
6
+ */
7
+
3
8
  export type SpinnerProps = SVGProps<SVGSVGElement> & {
4
9
  size?: number | string
5
10
  }
6
11
 
12
+ /**
13
+ * The Spinner component is used to display a loading indicator.
14
+ * @param props - SVG element attributes
15
+ * @param props.size - The size of the spinner
16
+ * @description [Spinner Docs](https://cerberus.digitalu.design/react/loading-states/)
17
+ * @example
18
+ * ```tsx
19
+ * <Spinner size={24} />
20
+ * ```
21
+ */
7
22
  export function Spinner(props: SpinnerProps) {
8
23
  return (
9
24
  <svg
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  export * from './components/Avatar'
9
9
  export * from './components/Button'
10
10
  export * from './components/Checkbox'
11
+ export * from './components/CircularProgress'
11
12
  export * from './components/Droppable'
12
13
  export * from './components/FieldMessage'
13
14
  export * from './components/FeatureFlag'