@sats-group/ui-lib 74.2.0

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 (227) hide show
  1. package/.nvmrc +1 -0
  2. package/README.md +35 -0
  3. package/catalog-info.yaml +14 -0
  4. package/eslint.config.mjs +94 -0
  5. package/fonts/Inter-BoldItalic.woff +0 -0
  6. package/fonts/Inter-BoldItalic.woff2 +0 -0
  7. package/fonts/Inter-ExtraBold.woff +0 -0
  8. package/fonts/Inter-ExtraBold.woff2 +0 -0
  9. package/fonts/Inter-Italic.woff +0 -0
  10. package/fonts/Inter-Italic.woff2 +0 -0
  11. package/fonts/Inter-Regular.woff +0 -0
  12. package/fonts/Inter-Regular.woff2 +0 -0
  13. package/fonts/Inter-SemiBold.woff +0 -0
  14. package/fonts/Inter-SemiBold.woff2 +0 -0
  15. package/fonts/LICENSE.txt +92 -0
  16. package/fonts/SATSHeadline-Bold.woff +0 -0
  17. package/fonts/SATSHeadline-BoldItalic.woff +0 -0
  18. package/fonts/SATSHeadline-RegularItalic.woff +0 -0
  19. package/fonts/SATSHeadline-SemiBoldItalic.woff +0 -0
  20. package/logos/e-avatar.svg +3 -0
  21. package/logos/elixia-letter.svg +3 -0
  22. package/logos/elixia-small.svg +8 -0
  23. package/logos/elixia.svg +8 -0
  24. package/logos/s-avatar.svg +3 -0
  25. package/logos/sats-letter.svg +3 -0
  26. package/logos/sats-small.svg +3 -0
  27. package/logos/sats.svg +4 -0
  28. package/package.json +58 -0
  29. package/react/add-bem-modifiers.ts +51 -0
  30. package/react/badge/badge.scss +53 -0
  31. package/react/badge/badge.tsx +28 -0
  32. package/react/badge/badge.types.ts +34 -0
  33. package/react/badge/index.ts +2 -0
  34. package/react/banner/banner.scss +118 -0
  35. package/react/banner/banner.tsx +92 -0
  36. package/react/banner/banner.types.ts +10 -0
  37. package/react/banner/index.ts +2 -0
  38. package/react/bomb/bomb.scss +33 -0
  39. package/react/bomb/bomb.tsx +19 -0
  40. package/react/bomb/bomb.types.ts +1 -0
  41. package/react/bomb/index.ts +2 -0
  42. package/react/button/button.tsx +19 -0
  43. package/react/button/button.types.ts +3 -0
  44. package/react/button/index.ts +2 -0
  45. package/react/checkbox/checkbox.scss +218 -0
  46. package/react/checkbox/checkbox.tsx +176 -0
  47. package/react/checkbox/checkbox.types.ts +19 -0
  48. package/react/checkbox/index.ts +2 -0
  49. package/react/chip/chip.scss +46 -0
  50. package/react/chip/chip.tsx +37 -0
  51. package/react/chip/chip.types.ts +18 -0
  52. package/react/chip/index.ts +2 -0
  53. package/react/chip/remove.tsx +14 -0
  54. package/react/chip-selected/chip-selected.scss +47 -0
  55. package/react/chip-selected/chip-selected.tsx +102 -0
  56. package/react/chip-selected/chip-selected.types.ts +11 -0
  57. package/react/chip-selected/index.ts +2 -0
  58. package/react/confirmation/confirmation.scss +60 -0
  59. package/react/confirmation/confirmation.tsx +85 -0
  60. package/react/confirmation/confirmation.types.ts +24 -0
  61. package/react/confirmation/index.ts +2 -0
  62. package/react/context-menu/context-menu.scss +183 -0
  63. package/react/context-menu/context-menu.tsx +200 -0
  64. package/react/context-menu/context-menu.types.ts +71 -0
  65. package/react/context-menu/index.ts +2 -0
  66. package/react/cropped-image/cropped-image.scss +48 -0
  67. package/react/cropped-image/cropped-image.tsx +36 -0
  68. package/react/cropped-image/cropped-image.types.ts +26 -0
  69. package/react/cropped-image/index.ts +2 -0
  70. package/react/dropdown-list/dropdown-list.scss +170 -0
  71. package/react/dropdown-list/dropdown-list.tsx +116 -0
  72. package/react/dropdown-list/dropdown-list.types.ts +17 -0
  73. package/react/dropdown-list/index.ts +2 -0
  74. package/react/expander/expander.scss +115 -0
  75. package/react/expander/expander.tsx +167 -0
  76. package/react/expander/expander.types.ts +26 -0
  77. package/react/expander/index.ts +2 -0
  78. package/react/filter/filter.scss +94 -0
  79. package/react/filter/filter.tsx +99 -0
  80. package/react/filter/filter.types.ts +8 -0
  81. package/react/filter/index.ts +2 -0
  82. package/react/filter-wrapper/filter-wrapper.scss +46 -0
  83. package/react/filter-wrapper/filter-wrapper.tsx +24 -0
  84. package/react/filter-wrapper/filter-wrapper.types.ts +10 -0
  85. package/react/filter-wrapper/index.ts +2 -0
  86. package/react/flag/flag.scss +26 -0
  87. package/react/flag/flag.tsx +27 -0
  88. package/react/flag/flag.types.ts +17 -0
  89. package/react/flag/index.ts +2 -0
  90. package/react/form-content/checkbox-category.tsx +183 -0
  91. package/react/form-content/form-content.checkbox-list.tsx +126 -0
  92. package/react/form-content/form-content.checkbox-list.types.ts +36 -0
  93. package/react/form-content/form-content.radio-list.tsx +58 -0
  94. package/react/form-content/form-content.range.tsx +20 -0
  95. package/react/form-content/form-content.range.types.ts +14 -0
  96. package/react/form-content/form-content.scss +234 -0
  97. package/react/form-content/form-content.search.tsx +47 -0
  98. package/react/form-content/form-content.tsx +95 -0
  99. package/react/form-content/form-content.types.ts +55 -0
  100. package/react/form-content/index.ts +2 -0
  101. package/react/form-content/types/index.d.ts +1 -0
  102. package/react/hidden-input/hidden-input.tsx +9 -0
  103. package/react/hidden-input/hidden-input.types.ts +6 -0
  104. package/react/hidden-input/index.ts +2 -0
  105. package/react/hooks/focus-previous-element.ts +30 -0
  106. package/react/hooks/is-running-on-client.ts +1 -0
  107. package/react/hooks/use-click-outside.ts +23 -0
  108. package/react/hooks/use-escape.ts +18 -0
  109. package/react/hooks/use-event.ts +29 -0
  110. package/react/hooks/use-is-mounted.ts +11 -0
  111. package/react/hooks/use-toggle.ts +19 -0
  112. package/react/icons/16/close.tsx +12 -0
  113. package/react/icons/18/close.tsx +18 -0
  114. package/react/icons/24/arrow-down.tsx +14 -0
  115. package/react/icons/24/arrow-right.tsx +14 -0
  116. package/react/icons/24/arrow-up.tsx +14 -0
  117. package/react/icons/24/close.tsx +12 -0
  118. package/react/icons/24/remove.tsx +12 -0
  119. package/react/icons/24/search.tsx +10 -0
  120. package/react/icons/icons.md +3 -0
  121. package/react/indexed-access-type.ts +1 -0
  122. package/react/link/index.ts +2 -0
  123. package/react/link/link.scss +44 -0
  124. package/react/link/link.tsx +62 -0
  125. package/react/link/link.types.ts +37 -0
  126. package/react/link-button/index.ts +2 -0
  127. package/react/link-button/link-button.tsx +17 -0
  128. package/react/link-button/link-button.types.ts +5 -0
  129. package/react/link-card/index.ts +2 -0
  130. package/react/link-card/link-card.scss +37 -0
  131. package/react/link-card/link-card.tsx +24 -0
  132. package/react/link-card/link-card.types.ts +5 -0
  133. package/react/logos/e-avatar.tsx +12 -0
  134. package/react/logos/elixia-letter.tsx +12 -0
  135. package/react/logos/elixia-small.tsx +12 -0
  136. package/react/logos/elixia.tsx +12 -0
  137. package/react/logos/index.ts +8 -0
  138. package/react/logos/s-avatar.tsx +12 -0
  139. package/react/logos/sats-letter.tsx +12 -0
  140. package/react/logos/sats-small.tsx +12 -0
  141. package/react/logos/sats.tsx +12 -0
  142. package/react/message/hook/use-message.ts +22 -0
  143. package/react/message/index.ts +2 -0
  144. package/react/message/message.scss +92 -0
  145. package/react/message/message.tsx +60 -0
  146. package/react/message/message.types.ts +39 -0
  147. package/react/message/publish.ts +19 -0
  148. package/react/message-field/index.ts +2 -0
  149. package/react/message-field/message-field.scss +21 -0
  150. package/react/message-field/message-field.tsx +70 -0
  151. package/react/message-field/message-field.types.ts +24 -0
  152. package/react/modal/index.ts +2 -0
  153. package/react/modal/modal.scss +162 -0
  154. package/react/modal/modal.tsx +130 -0
  155. package/react/modal/modal.types.ts +36 -0
  156. package/react/modal/tab-trapper.tsx +68 -0
  157. package/react/progress-bar/index.ts +2 -0
  158. package/react/progress-bar/progress-bar.scss +71 -0
  159. package/react/progress-bar/progress-bar.tsx +81 -0
  160. package/react/progress-bar/progress-bar.types.ts +35 -0
  161. package/react/radio/index.ts +2 -0
  162. package/react/radio/radio.scss +142 -0
  163. package/react/radio/radio.tsx +87 -0
  164. package/react/radio/radio.types.ts +15 -0
  165. package/react/scale-bar/index.ts +2 -0
  166. package/react/scale-bar/scale-bar.scss +22 -0
  167. package/react/scale-bar/scale-bar.tsx +29 -0
  168. package/react/scale-bar/scale-bar.types.ts +4 -0
  169. package/react/search/index.ts +2 -0
  170. package/react/search/search.scss +207 -0
  171. package/react/search/search.tsx +255 -0
  172. package/react/search/search.types.ts +43 -0
  173. package/react/select/chevron-down.tsx +24 -0
  174. package/react/select/index.ts +2 -0
  175. package/react/select/select.scss +135 -0
  176. package/react/select/select.tsx +105 -0
  177. package/react/select/select.types.ts +19 -0
  178. package/react/select-option/README.md +3 -0
  179. package/react/select-option/index.ts +2 -0
  180. package/react/select-option/select-option.tsx +16 -0
  181. package/react/select-option/select-option.types.ts +8 -0
  182. package/react/tag/index.ts +2 -0
  183. package/react/tag/tag.scss +107 -0
  184. package/react/tag/tag.tsx +26 -0
  185. package/react/tag/tag.types.ts +30 -0
  186. package/react/text/index.ts +2 -0
  187. package/react/text/text.scss +109 -0
  188. package/react/text/text.tsx +40 -0
  189. package/react/text/text.types.ts +29 -0
  190. package/react/text-area/index.ts +2 -0
  191. package/react/text-area/text-area.scss +180 -0
  192. package/react/text-area/text-area.tsx +153 -0
  193. package/react/text-area/text-area.types.ts +24 -0
  194. package/react/text-input/index.ts +2 -0
  195. package/react/text-input/text-input.scss +233 -0
  196. package/react/text-input/text-input.tsx +106 -0
  197. package/react/text-input/text-input.types.ts +19 -0
  198. package/react/toggle/index.ts +2 -0
  199. package/react/toggle/toggle.scss +69 -0
  200. package/react/toggle/toggle.tsx +83 -0
  201. package/react/toggle/toggle.types.ts +11 -0
  202. package/react/toolbox/index.ts +2 -0
  203. package/react/toolbox/toolbox.scss +68 -0
  204. package/react/toolbox/toolbox.tsx +43 -0
  205. package/react/toolbox/toolbox.types.ts +39 -0
  206. package/react/ts/debounce.ts +12 -0
  207. package/react/types.ts +38 -0
  208. package/react/use-input-validation.ts +47 -0
  209. package/react/use-input-validation.types.ts +12 -0
  210. package/react/visually-button/index.ts +2 -0
  211. package/react/visually-button/visually-button.scss +470 -0
  212. package/react/visually-button/visually-button.tsx +130 -0
  213. package/react/visually-button/visually-button.types.ts +71 -0
  214. package/react/visually-hidden/index.ts +2 -0
  215. package/react/visually-hidden/visually-hidden.scss +6 -0
  216. package/react/visually-hidden/visually-hidden.tsx +10 -0
  217. package/tokens/corner-radius.scss +5 -0
  218. package/tokens/dark.scss +392 -0
  219. package/tokens/darkmode.scss +131 -0
  220. package/tokens/elevation.scss +57 -0
  221. package/tokens/font-faces.scss +62 -0
  222. package/tokens/font-names.scss +2 -0
  223. package/tokens/font-sizes.scss +95 -0
  224. package/tokens/light.scss +392 -0
  225. package/tokens/lightmode.scss +131 -0
  226. package/tokens/primitives.scss +137 -0
  227. package/tokens/spacing.scss +12 -0
@@ -0,0 +1,162 @@
1
+ @use 'sass:color';
2
+ @use '../../tokens/corner-radius';
3
+ @use '../../tokens/elevation';
4
+ @use '../../tokens/light';
5
+ @use '../../tokens/spacing';
6
+
7
+ .modal {
8
+ background: color.adjust(
9
+ light.$fixed-background-primary-default,
10
+ $alpha: -0.7
11
+ );
12
+ box-sizing: border-box;
13
+ display: grid;
14
+ height: 100vh;
15
+ height: 100dvh;
16
+ left: 0;
17
+ overflow: hidden;
18
+ overscroll-behavior: contain;
19
+ place-items: center;
20
+ position: fixed;
21
+ top: 0;
22
+ width: 100vw;
23
+ width: 100dvw;
24
+ z-index: 900;
25
+
26
+ @mixin break {
27
+ @media (min-width: 500px) {
28
+ @content;
29
+ }
30
+ }
31
+
32
+ $padding: spacing.$m;
33
+
34
+ @include break {
35
+ padding: $padding;
36
+ }
37
+
38
+ &__texts {
39
+ width: 100%;
40
+ display: flex;
41
+ flex-direction: column;
42
+ gap: spacing.$xs;
43
+ }
44
+
45
+ &__title {
46
+ color: light.$on-surface-primary-default;
47
+ max-width: 90%; // NOTE: Magic percent to keep clear of modal´s close-button.
48
+ }
49
+
50
+ &__explanation {
51
+ &--primary {
52
+ color: light.$on-surface-primary-alternate;
53
+ }
54
+
55
+ &--secondary {
56
+ color: light.$on-surface-secondary-alternate;
57
+ }
58
+ }
59
+
60
+ &__content {
61
+ position: relative;
62
+ height: 100vh;
63
+ height: 100dvh;
64
+ max-height: 100vh;
65
+ max-height: 100dvh;
66
+ max-width: 100vw;
67
+ max-width: 100dvw;
68
+ width: 100vw;
69
+ width: 100dvw;
70
+ overflow: auto;
71
+
72
+ &--primary {
73
+ background: light.$surface-primary-default;
74
+ }
75
+
76
+ &--secondary {
77
+ background: light.$surface-secondary-default;
78
+ }
79
+
80
+ @include break {
81
+ @include elevation.level(24);
82
+ border-radius: corner-radius.$s;
83
+ height: max-content;
84
+ max-height: calc(100vh - (spacing.$m * 2));
85
+ max-height: calc(100dvh - (spacing.$m * 2));
86
+ max-width: 640px;
87
+ width: 100%;
88
+ }
89
+ }
90
+
91
+ &__content-inner {
92
+ display: flex;
93
+ flex-direction: column;
94
+ height: 100%;
95
+
96
+ @include break {
97
+ max-height: calc(100vh - (spacing.$m * 2));
98
+ max-height: calc(100dvh - (spacing.$m * 2));
99
+ }
100
+ }
101
+
102
+ &__actions,
103
+ &__close-action-mobile {
104
+ background: light.$surface-primary-default;
105
+ border-top: 1px solid light.$ge-border-default;
106
+ display: flex;
107
+ justify-content: center;
108
+ gap: spacing.$s;
109
+ padding: spacing.$s spacing.$m;
110
+
111
+ @include break {
112
+ border-radius: 0 0 corner-radius.$s corner-radius.$s;
113
+ }
114
+ }
115
+
116
+ &__close-action-mobile {
117
+ @include break {
118
+ display: none;
119
+ }
120
+ }
121
+
122
+ &__close-action {
123
+ display: none;
124
+ position: absolute;
125
+ right: spacing.$s;
126
+ top: spacing.$s;
127
+
128
+ @include break {
129
+ display: block;
130
+ }
131
+
132
+ &--always-shown {
133
+ display: block;
134
+ }
135
+ }
136
+
137
+ &__nav {
138
+ align-items: flex-start;
139
+ display: flex;
140
+ gap: spacing.$m;
141
+ justify-content: space-between;
142
+ padding: spacing.$l spacing.$m 0 spacing.$m;
143
+
144
+ @include break {
145
+ margin-bottom: 0;
146
+ padding: spacing.$l spacing.$l 0 spacing.$l;
147
+ }
148
+ }
149
+
150
+ &__children {
151
+ flex: 1;
152
+ overflow-x: hidden;
153
+ overflow-y: auto;
154
+ overscroll-behavior: contain;
155
+ padding: spacing.$l spacing.$m;
156
+
157
+ @include break {
158
+ margin-bottom: 0;
159
+ padding: spacing.$l;
160
+ }
161
+ }
162
+ }
@@ -0,0 +1,130 @@
1
+ import classNames from 'classnames';
2
+ import * as React from 'react';
3
+ import * as ReactDOM from 'react-dom';
4
+
5
+ import Button from '../button';
6
+ import useEscape from '../hooks/use-escape';
7
+ import { useIsMounted } from '../hooks/use-is-mounted';
8
+ import Close from '../icons/18/close';
9
+ import Text from '../text';
10
+
11
+ import { ActionTypes, type Modal as Props, backgrounds } from './modal.types';
12
+ import TabTrapper from './tab-trapper';
13
+ import LinkButton from '../link-button';
14
+
15
+ const Modal: React.FC<React.PropsWithChildren<Props>> & {
16
+ backgrounds: typeof backgrounds;
17
+ } = ({
18
+ ariaLabel,
19
+ background = backgrounds.primary,
20
+ children,
21
+ closeLabel,
22
+ explanation,
23
+ id,
24
+ onClose = () => {},
25
+ title,
26
+ actions,
27
+ onClick = () => {},
28
+ }) => {
29
+ const modal = React.useRef<HTMLDivElement>(null);
30
+ const isMounted = useIsMounted();
31
+ useEscape(onClose);
32
+
33
+ if (!isMounted) {
34
+ return null;
35
+ }
36
+
37
+ const handleModalClick: React.MouseEventHandler = e => {
38
+ if (modal.current && modal.current === e.target) {
39
+ onClose();
40
+ }
41
+ };
42
+
43
+ return ReactDOM.createPortal(
44
+ <div
45
+ aria-label={ariaLabel}
46
+ className="modal"
47
+ id={id}
48
+ onClick={handleModalClick}
49
+ ref={modal}
50
+ role="dialog"
51
+ >
52
+ <div
53
+ className={classNames('modal__content', {
54
+ [`modal__content--${background}`]: background,
55
+ })}
56
+ >
57
+ <TabTrapper isActive={true} className="modal__content-inner">
58
+ <div
59
+ className={classNames('modal__close-action', {
60
+ 'modal__close-action--always-shown': actions && actions.length,
61
+ })}
62
+ >
63
+ <Button
64
+ ariaLabel={closeLabel}
65
+ leadingIcon={<Close />}
66
+ onClick={onClose}
67
+ size={Button.sizes.small}
68
+ variant={Button.variants.secondary}
69
+ />
70
+ </div>
71
+ {title || explanation ? (
72
+ <div className="modal__nav">
73
+ <div className="modal__texts">
74
+ {title ? (
75
+ <Text
76
+ className="modal__title"
77
+ size={Text.sizes.headline2}
78
+ theme={Text.themes.emphasis}
79
+ >
80
+ {title}
81
+ </Text>
82
+ ) : null}
83
+ {explanation ? (
84
+ <div
85
+ className={classNames('modal__explanation', {
86
+ [`modal__explanation--${background}`]: background,
87
+ })}
88
+ >
89
+ <Text size={Text.sizes.small}>{explanation}</Text>
90
+ </div>
91
+ ) : null}
92
+ </div>
93
+ </div>
94
+ ) : null}
95
+ <div className="modal__children">
96
+ <div>{children}</div>
97
+ </div>
98
+ {actions && actions.length ? (
99
+ <div className="modal__actions">
100
+ {actions.map(action =>
101
+ action.type === ActionTypes.LinkButton ? (
102
+ <LinkButton {...action.action} />
103
+ ) : action.type === ActionTypes.Button ? (
104
+ <Button
105
+ {...action.action}
106
+ onClick={e => onClick(action.buttonId, e)}
107
+ />
108
+ ) : null,
109
+ )}
110
+ </div>
111
+ ) : (
112
+ <div className="modal__close-action-mobile">
113
+ <Button
114
+ leadingIcon={<Close />}
115
+ onClick={onClose}
116
+ text={closeLabel}
117
+ variant={Button.variants.secondary}
118
+ />
119
+ </div>
120
+ )}
121
+ </TabTrapper>
122
+ </div>
123
+ </div>,
124
+ document.body,
125
+ );
126
+ };
127
+
128
+ Modal.backgrounds = backgrounds;
129
+
130
+ export default Modal;
@@ -0,0 +1,36 @@
1
+ import { Button } from '../button/button.types';
2
+ import { LinkButton } from '../link-button/link-button.types';
3
+ import { ObjectValues } from '../types';
4
+
5
+ export const backgrounds = {
6
+ primary: 'primary',
7
+ secondary: 'secondary',
8
+ } as const;
9
+
10
+ export enum ActionTypes {
11
+ LinkButton = 'LinkButton',
12
+ Button = 'Button',
13
+ }
14
+
15
+ type LinkAction = {
16
+ type: ActionTypes.LinkButton;
17
+ action: LinkButton;
18
+ };
19
+
20
+ type ButtonAction = {
21
+ type: ActionTypes.Button;
22
+ action: Button;
23
+ buttonId: string;
24
+ };
25
+
26
+ export type Modal = {
27
+ ariaLabel: string;
28
+ background?: ObjectValues<typeof backgrounds>;
29
+ closeLabel: string;
30
+ explanation?: string;
31
+ id: string;
32
+ onClose?: () => void;
33
+ title?: string;
34
+ actions?: (LinkAction | ButtonAction)[];
35
+ onClick?: (id: string, arg?: unknown) => void;
36
+ };
@@ -0,0 +1,68 @@
1
+ import * as React from 'react';
2
+
3
+ const focusRef = (ref: React.MutableRefObject<HTMLElement | null>): void => {
4
+ ref?.current?.focus();
5
+ };
6
+
7
+ /** Returns the value of `value` from the previous render.
8
+ ```js
9
+ const [value, setValue] = useState();
10
+ const previousValue = usePrevious(value);
11
+ ```
12
+ */
13
+ // eslint-disable-next-line
14
+ const usePrevious = <T extends unknown>(
15
+ value: T,
16
+ initialValue?: T,
17
+ ): React.RefObject<T>['current'] => {
18
+ const state = React.useRef<T | null>(
19
+ typeof initialValue === 'undefined' ? null : initialValue,
20
+ );
21
+
22
+ React.useEffect(() => {
23
+ state.current = value;
24
+ }, [value]);
25
+
26
+ return state.current;
27
+ };
28
+
29
+ const TabTrapper: React.FunctionComponent<
30
+ React.PropsWithChildren<{
31
+ isActive: boolean;
32
+ className?: string;
33
+ }>
34
+ > = ({ children, isActive, className }) => {
35
+ const wasActive = usePrevious(isActive);
36
+ const contentRef = React.useRef<HTMLDivElement>(null);
37
+ const previouslyFocusedElement = React.useRef<HTMLElement | null>(null);
38
+
39
+ const focusContent = () => focusRef(contentRef);
40
+
41
+ React.useEffect(() => {
42
+ if (!wasActive && isActive) {
43
+ // NOTE: Because document.activeElement is an Element by default, we need
44
+ // to cast this as a HTMLElement to be able to use HTMLElement functions
45
+ previouslyFocusedElement.current = document.activeElement as HTMLElement;
46
+ focusContent();
47
+ }
48
+
49
+ if (wasActive && !isActive) {
50
+ focusRef(previouslyFocusedElement);
51
+ }
52
+ }, [isActive]);
53
+
54
+ // NOTE: This happens on unmount only
55
+ React.useEffect(() => () => focusRef(previouslyFocusedElement), []);
56
+
57
+ return (
58
+ <React.Fragment>
59
+ {isActive ? <div onFocus={focusContent} tabIndex={0} /> : null}
60
+ <div ref={contentRef} tabIndex={-1} className={className}>
61
+ {children}
62
+ </div>
63
+ {isActive ? <div onFocus={focusContent} tabIndex={0} /> : null}
64
+ </React.Fragment>
65
+ );
66
+ };
67
+
68
+ export default TabTrapper;
@@ -0,0 +1,2 @@
1
+ import ProgressBar from './progress-bar';
2
+ export default ProgressBar;
@@ -0,0 +1,71 @@
1
+ @use '../../tokens/corner-radius';
2
+ @use '../../tokens/light';
3
+ @use '../../tokens/spacing';
4
+
5
+ .progress-bar {
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: spacing.$xxs;
9
+
10
+ &__progress {
11
+ display: flex;
12
+ height: 4px;
13
+ width: 100%;
14
+
15
+ background-color: light.$ge-progress-bar-background;
16
+ border-radius: corner-radius.$xs;
17
+
18
+ &--dark {
19
+ background-color: light.$ge-fixed-progress-bar-background;
20
+ }
21
+ }
22
+
23
+ &__bar {
24
+ background-color: light.$ge-progress-bar-indicator-alternate;
25
+ border-radius: corner-radius.$xs;
26
+
27
+ &--dark {
28
+ background-color: light.$ge-fixed-progress-bar-indicator-alternate;
29
+ }
30
+
31
+ &--cta {
32
+ background-color: light.$ge-progress-bar-indicator-default;
33
+ }
34
+ }
35
+
36
+ &__hidden {
37
+ display: none;
38
+ }
39
+
40
+ &--top-left {
41
+ flex-direction: column-reverse;
42
+ }
43
+
44
+ &--top-center {
45
+ flex-direction: column-reverse;
46
+ text-align: center;
47
+ }
48
+
49
+ &--top-right {
50
+ flex-direction: column-reverse;
51
+ text-align: right;
52
+ }
53
+
54
+ &--bottom-center {
55
+ text-align: center;
56
+ }
57
+
58
+ &--bottom-right {
59
+ text-align: right;
60
+ }
61
+
62
+ &__text {
63
+ > * + * {
64
+ margin-left: spacing.$xxs;
65
+ }
66
+
67
+ &--dark {
68
+ color: light.$on-fixed-background-primary-default;
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,81 @@
1
+ import classNames from 'classnames';
2
+ import React from 'react';
3
+
4
+ import Text from '../text';
5
+
6
+ import {
7
+ Progressbar as Props,
8
+ variants,
9
+ themes,
10
+ labelAlignments,
11
+ labelPositions,
12
+ } from './progress-bar.types';
13
+
14
+ const ProgressBar: React.FunctionComponent<Props> & {
15
+ variants: typeof variants;
16
+ themes: typeof themes;
17
+ labelAlignments: typeof labelAlignments;
18
+ labelPositions: typeof labelPositions;
19
+ } = ({
20
+ value,
21
+ max,
22
+ label,
23
+ labelAlignment = 'right',
24
+ labelPosition,
25
+ variant,
26
+ theme,
27
+ }) => (
28
+ <div
29
+ className={classNames('progress-bar', {
30
+ [`progress-bar--${labelPosition}`]: labelPosition,
31
+ })}
32
+ >
33
+ <progress className="progress-bar__hidden" value={value} max={max} />
34
+ <div
35
+ className={classNames('progress-bar__progress', {
36
+ [`progress-bar__progress--${theme}`]: theme,
37
+ })}
38
+ >
39
+ <div
40
+ className={classNames('progress-bar__bar', {
41
+ [`progress-bar__bar--${variant}`]: variant,
42
+ [`progress-bar__bar--${theme}`]: theme,
43
+ })}
44
+ style={{ width: `${Math.floor((value / max) * 100)}%` }}
45
+ />
46
+ </div>
47
+ {label ? (
48
+ <div
49
+ className={classNames('progress-bar__text', {
50
+ [`progress-bar__text--${theme}`]: theme,
51
+ })}
52
+ >
53
+ {labelAlignment === 'left' ? (
54
+ <Text elementName="span" size={Text.sizes.basic}>
55
+ {label.text}
56
+ </Text>
57
+ ) : null}
58
+ {label.boldText ? (
59
+ <Text
60
+ elementName="span"
61
+ size={Text.sizes.basic}
62
+ theme={Text.themes.emphasis}
63
+ >
64
+ {label.boldText}
65
+ </Text>
66
+ ) : undefined}
67
+ {labelAlignment === 'right' ? (
68
+ <Text elementName="span" size={Text.sizes.basic}>
69
+ {label.text}
70
+ </Text>
71
+ ) : null}
72
+ </div>
73
+ ) : undefined}
74
+ </div>
75
+ );
76
+
77
+ ProgressBar.variants = variants;
78
+ ProgressBar.themes = themes;
79
+ ProgressBar.labelAlignments = labelAlignments;
80
+ ProgressBar.labelPositions = labelPositions;
81
+ export default ProgressBar;
@@ -0,0 +1,35 @@
1
+ import { ObjectValues } from '../types';
2
+
3
+ export const variants = {
4
+ cta: 'cta',
5
+ } as const;
6
+
7
+ export const themes = {
8
+ dark: 'dark',
9
+ } as const;
10
+
11
+ export const labelAlignments = {
12
+ left: 'left',
13
+ right: 'right',
14
+ } as const;
15
+
16
+ export const labelPositions = {
17
+ topLeft: 'top-left',
18
+ topCenter: 'top-center',
19
+ topRight: 'top-right',
20
+ bottomCenter: 'bottom-center',
21
+ bottomRight: 'bottom-right',
22
+ } as const;
23
+
24
+ export type Progressbar = {
25
+ value: number;
26
+ max: number;
27
+ label?: {
28
+ boldText?: string;
29
+ text: string;
30
+ };
31
+ labelAlignment?: ObjectValues<typeof labelAlignments>;
32
+ labelPosition?: ObjectValues<typeof labelPositions>;
33
+ variant?: ObjectValues<typeof variants>;
34
+ theme?: ObjectValues<typeof themes>;
35
+ };
@@ -0,0 +1,2 @@
1
+ import Radio from './radio';
2
+ export default Radio;