@trackunit/react-components 0.0.83-alpha-9c24ee877.0 → 0.0.89
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.
- package/common/LegacyComponentStory.d.ts +7 -0
- package/components/Badge/Badge.d.ts +14 -16
- package/components/Heading/Heading.d.ts +1 -1
- package/components/PageHeading/PageHeading.d.ts +2 -2
- package/components/Select/Select/TagWithWidth.d.ts +17 -0
- package/components/SkeletonLines/SkeletonLines.d.ts +4 -5
- package/components/Spacer/Spacer.d.ts +1 -1
- package/components/Tag/Tag.d.ts +7 -17
- package/components/Toggle/Toggle.d.ts +15 -0
- package/index.css +145 -0
- package/index.js +228 -202
- package/package.json +5 -5
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
import { Colors } from "../../constants/colors";
|
|
4
4
|
export declare type BadgeSize = "default" | "large";
|
|
5
|
-
declare type BadgeVariant = "badge" | "pill";
|
|
6
5
|
interface BaseBadgeProps extends CommonProps {
|
|
7
6
|
/**
|
|
8
7
|
* The color of the badge.
|
|
@@ -13,12 +12,6 @@ interface BaseBadgeProps extends CommonProps {
|
|
|
13
12
|
* Subtle badges have a light background color wither a darker text color.
|
|
14
13
|
*/
|
|
15
14
|
subtle?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Whether badge should be displayed as a pill or badge.
|
|
18
|
-
* For the pill variant, numeric values above 99 will be displayed as 99+.
|
|
19
|
-
* Badge is subtle by default.
|
|
20
|
-
*/
|
|
21
|
-
variant?: BadgeVariant;
|
|
22
15
|
/**
|
|
23
16
|
* Custom classNames can be added to make adjustments where needed.
|
|
24
17
|
* Example: Set a maximum width of the badge by adding the className "max-w-[your-max-width]" or similar tailwind max-w class.
|
|
@@ -26,9 +19,18 @@ interface BaseBadgeProps extends CommonProps {
|
|
|
26
19
|
*/
|
|
27
20
|
className?: string;
|
|
28
21
|
/**
|
|
29
|
-
*
|
|
22
|
+
* The count to be displayed on the badge.
|
|
23
|
+
*/
|
|
24
|
+
count?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The max value to be displayed in the badge.
|
|
27
|
+
* Any value above this will be appended with a +.
|
|
30
28
|
*/
|
|
31
|
-
|
|
29
|
+
max?: number;
|
|
30
|
+
/**
|
|
31
|
+
* If enabled the badge is shown even if the count is 0.
|
|
32
|
+
*/
|
|
33
|
+
hideZero?: boolean;
|
|
32
34
|
/**
|
|
33
35
|
* Size of the badge.
|
|
34
36
|
*/
|
|
@@ -36,14 +38,10 @@ interface BaseBadgeProps extends CommonProps {
|
|
|
36
38
|
}
|
|
37
39
|
export declare type BadgeProps = BaseBadgeProps;
|
|
38
40
|
/**
|
|
39
|
-
* The Badge component
|
|
40
|
-
*
|
|
41
|
-
* _**Do use** badges to show highlighted text based on the state._
|
|
42
|
-
*
|
|
43
|
-
* _**Do not use** badges for regular text in places where it makes no sense to use highlighted text._
|
|
41
|
+
* The Badge component is used to display a notification badge with an optional number value.
|
|
44
42
|
*
|
|
45
43
|
* @param {BadgeProps} props - The props for the Badge component
|
|
46
44
|
* @returns {JSX.Element} Badge component
|
|
47
45
|
*/
|
|
48
|
-
export declare const Badge: ({ color, subtle, className,
|
|
46
|
+
export declare const Badge: ({ color, subtle, className, count, max, hideZero, dataTestId, size, ...rest }: BadgeProps) => JSX.Element | null;
|
|
49
47
|
export {};
|
|
@@ -20,7 +20,7 @@ export interface HeadingProps extends CommonProps {
|
|
|
20
20
|
subtle?: boolean;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* The Heading
|
|
23
|
+
* The Heading is used for a heading of a section (h1,h2,h3,h4).
|
|
24
24
|
*
|
|
25
25
|
* @param {HeadingProps} props - The props for the Heading component
|
|
26
26
|
* @returns {JSX.Element} Heading component
|
|
@@ -12,7 +12,7 @@ interface PageHeadingProps {
|
|
|
12
12
|
* Test id to be used for the component.
|
|
13
13
|
*/
|
|
14
14
|
dataTestId?: string;
|
|
15
|
-
|
|
15
|
+
tag?: string;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* The PageHeading component used on pages.
|
|
@@ -20,5 +20,5 @@ interface PageHeadingProps {
|
|
|
20
20
|
* @param {PageHeadingProps} props - The props for the PageHeading component
|
|
21
21
|
* @returns {JSX.Element} PageHeading component
|
|
22
22
|
*/
|
|
23
|
-
export declare const PageHeading: ({ title, subtitle, dataTestId,
|
|
23
|
+
export declare const PageHeading: ({ title, subtitle, dataTestId, tag }: PageHeadingProps) => JSX.Element;
|
|
24
24
|
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TagProps } from "../../Tag";
|
|
3
|
+
declare type TagsPropsNoRef = Omit<TagProps, "ref">;
|
|
4
|
+
interface TagWithWidthProps extends TagsPropsNoRef {
|
|
5
|
+
onWidthKnown?: ({ width }: {
|
|
6
|
+
width: number;
|
|
7
|
+
}) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Extended Tag component with information about its own width.
|
|
11
|
+
* Used in the select component.
|
|
12
|
+
*
|
|
13
|
+
* @param {TagProps} props - The props for the tag component
|
|
14
|
+
* @returns {JSX.Element} TagWithWidth component
|
|
15
|
+
*/
|
|
16
|
+
export declare const TagWithWidth: ({ onWidthKnown, children, ...rest }: TagWithWidthProps) => JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -10,17 +10,16 @@ export interface SkeletonLinesProps extends CommonProps {
|
|
|
10
10
|
*/
|
|
11
11
|
height?: number | number[] | string;
|
|
12
12
|
/**
|
|
13
|
-
* The width of each
|
|
13
|
+
* The width of each line. Can be a number or an array of numbers or string.
|
|
14
14
|
*/
|
|
15
15
|
width?: number | number[] | string;
|
|
16
16
|
/**
|
|
17
17
|
* Margin of lines.
|
|
18
18
|
*/
|
|
19
19
|
margin?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Additional CSS classes.
|
|
22
|
-
*/
|
|
23
|
-
className?: string;
|
|
24
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Display placeholder lines before the data gets loaded to reduce load-time frustration.
|
|
23
|
+
*/
|
|
25
24
|
export declare const SkeletonLines: import("react").MemoExoticComponent<({ margin, lines, height, width, className, dataTestId }: SkeletonLinesProps) => JSX.Element>;
|
|
26
25
|
export default SkeletonLines;
|
|
@@ -3,7 +3,7 @@ import { CommonProps } from "../../common";
|
|
|
3
3
|
interface SpacerProps extends CommonProps {
|
|
4
4
|
/**
|
|
5
5
|
* The minimum height of the spacer. Defaults to 1px.
|
|
6
|
-
* Possible values are "normal"(8px), and "large" (32px).
|
|
6
|
+
* Possible values are "normal"(8px), and "large" (32px).
|
|
7
7
|
*/
|
|
8
8
|
minHeight?: string;
|
|
9
9
|
/**
|
package/components/Tag/Tag.d.ts
CHANGED
|
@@ -2,25 +2,18 @@ import * as React from "react";
|
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
3
|
import { Colors } from "../../constants/colors";
|
|
4
4
|
export declare type TagSize = "default" | "small";
|
|
5
|
-
interface TagProps extends CommonProps {
|
|
5
|
+
export interface TagProps extends CommonProps {
|
|
6
6
|
/**
|
|
7
|
-
* The color of the tag
|
|
7
|
+
* The color of the tag.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
color?: Colors;
|
|
11
11
|
/**
|
|
12
|
-
* A handler for a click event triggered on
|
|
13
|
-
*
|
|
12
|
+
* A handler for a click event triggered on X icon.
|
|
13
|
+
* If not passed then x icon won't be visible.
|
|
14
14
|
*
|
|
15
15
|
*/
|
|
16
16
|
onClose?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Custom classNames can be added to make adjustments where needed.
|
|
19
|
-
* Example: Set a maximum width of the badge by adding the className "max-w-[your-max-width]" or similar tailwind max-w class.
|
|
20
|
-
* This will make the badge truncate the text if it is too long.
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
className?: string;
|
|
24
17
|
/**
|
|
25
18
|
* Child nodes of the tag.
|
|
26
19
|
*
|
|
@@ -28,20 +21,17 @@ interface TagProps extends CommonProps {
|
|
|
28
21
|
children?: React.ReactNode;
|
|
29
22
|
/**
|
|
30
23
|
* Size of the tag.
|
|
31
|
-
*
|
|
32
24
|
*/
|
|
33
25
|
size?: TagSize;
|
|
34
|
-
onWidthKnown?: ({ width }: {
|
|
35
|
-
width: number;
|
|
36
|
-
}) => void;
|
|
37
26
|
}
|
|
38
27
|
/**
|
|
39
28
|
* Tags allow users to enter information and filter content.
|
|
29
|
+
*
|
|
40
30
|
* Multiple or single tags can be used to categorise items.
|
|
31
|
+
*
|
|
41
32
|
* Use short labels for easy scanning. Use two words only if necessary to describe the status and differentiate it from other tags.
|
|
42
33
|
*
|
|
43
34
|
* @param {TagProps} props - The props for the tag component
|
|
44
35
|
* @returns {JSX.Element} tag component
|
|
45
36
|
*/
|
|
46
|
-
export declare const Tag:
|
|
47
|
-
export {};
|
|
37
|
+
export declare const Tag: React.ForwardRefExoticComponent<TagProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
import "./Toggle.css";
|
|
3
4
|
export declare type ToggleSize = "small" | "default";
|
|
4
5
|
export interface ToggleProps extends CommonProps {
|
|
5
6
|
/**
|
|
@@ -34,9 +35,23 @@ export interface ToggleProps extends CommonProps {
|
|
|
34
35
|
* Name of the toggle.
|
|
35
36
|
*/
|
|
36
37
|
name?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The description of the toggle.
|
|
40
|
+
*/
|
|
41
|
+
description?: string;
|
|
37
42
|
/**
|
|
38
43
|
* onBlur event handler.
|
|
39
44
|
*/
|
|
40
45
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
41
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Use Toggle when you have to only enable/disable a feature.
|
|
49
|
+
*
|
|
50
|
+
* _**Do use** Toggle in forms or settings._
|
|
51
|
+
*
|
|
52
|
+
* _**Do not use** Toggle if a user can select many option from a list, use checkboxes instead of toggle._
|
|
53
|
+
*
|
|
54
|
+
* @param {ToggleProps} props - The props for the Toggle component
|
|
55
|
+
* @returns {JSX.Element} Toggle component
|
|
56
|
+
*/
|
|
42
57
|
export declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLInputElement>>;
|
package/index.css
CHANGED
|
@@ -162,3 +162,148 @@
|
|
|
162
162
|
disabled:hover:bg-transparent;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
|
|
166
|
+
/* CSS related to the toggle component */
|
|
167
|
+
.tu-toggle {
|
|
168
|
+
@apply rounded-full
|
|
169
|
+
bg-white
|
|
170
|
+
h-full
|
|
171
|
+
aspect-square
|
|
172
|
+
translate-x-0
|
|
173
|
+
transition-all;
|
|
174
|
+
|
|
175
|
+
&__wrapper {
|
|
176
|
+
@apply flex
|
|
177
|
+
items-center
|
|
178
|
+
p-0.5;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&__container {
|
|
182
|
+
@apply inline-block
|
|
183
|
+
items-center
|
|
184
|
+
w-fit
|
|
185
|
+
mr-2
|
|
186
|
+
active:shadow
|
|
187
|
+
rounded-full
|
|
188
|
+
cursor-pointer
|
|
189
|
+
focus-within:ring
|
|
190
|
+
focus-within:ring-offset-2
|
|
191
|
+
focus-within:ring-blue-700;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&--align-bottom {
|
|
195
|
+
@apply mb-7;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&__switch-container {
|
|
199
|
+
@apply flex
|
|
200
|
+
items-center
|
|
201
|
+
p-1
|
|
202
|
+
cursor-pointer
|
|
203
|
+
rounded-full
|
|
204
|
+
bg-slate-300
|
|
205
|
+
focus:bg-slate-400
|
|
206
|
+
hover:bg-slate-400
|
|
207
|
+
active:bg-slate-500;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&__switch {
|
|
211
|
+
@apply bg-white
|
|
212
|
+
rounded-full
|
|
213
|
+
h-full
|
|
214
|
+
w-5/12
|
|
215
|
+
aspect-square
|
|
216
|
+
translate-x-4
|
|
217
|
+
transition-all;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
&--default {
|
|
221
|
+
@apply flex
|
|
222
|
+
items-center
|
|
223
|
+
p-1
|
|
224
|
+
cursor-pointer
|
|
225
|
+
w-9
|
|
226
|
+
h-5;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
&--small {
|
|
230
|
+
@apply flex
|
|
231
|
+
items-center
|
|
232
|
+
p-1
|
|
233
|
+
cursor-pointer
|
|
234
|
+
w-8
|
|
235
|
+
h-4;
|
|
236
|
+
|
|
237
|
+
.tu-toggle__switch {
|
|
238
|
+
@apply w-4/12;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
&--toggled {
|
|
243
|
+
@apply flex
|
|
244
|
+
items-center
|
|
245
|
+
p-1
|
|
246
|
+
cursor-pointer
|
|
247
|
+
bg-blue-600
|
|
248
|
+
focus:bg-blue-700
|
|
249
|
+
hover:bg-blue-700
|
|
250
|
+
active:bg-blue-800;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
&--disabled {
|
|
254
|
+
@apply flex
|
|
255
|
+
items-center
|
|
256
|
+
p-1
|
|
257
|
+
cursor-not-allowed
|
|
258
|
+
pointer-events-none
|
|
259
|
+
bg-slate-200;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
&--disabled.tu-toggle--toggled {
|
|
263
|
+
@apply bg-slate-400;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
&__input {
|
|
267
|
+
@apply absolute
|
|
268
|
+
opacity-0
|
|
269
|
+
-z-10;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
&__label {
|
|
273
|
+
@apply hover:cursor-pointer
|
|
274
|
+
text-base
|
|
275
|
+
text-slate-900
|
|
276
|
+
max-w-[250px]
|
|
277
|
+
whitespace-nowrap
|
|
278
|
+
overflow-hidden
|
|
279
|
+
text-ellipsis;
|
|
280
|
+
|
|
281
|
+
&--disabled {
|
|
282
|
+
@apply text-slate-400
|
|
283
|
+
group-hover:text-slate-400
|
|
284
|
+
group-active:text-slate-400;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
&--align-label {
|
|
289
|
+
@apply inline-block;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
&__description {
|
|
293
|
+
@apply text-sm
|
|
294
|
+
font-normal
|
|
295
|
+
font-sans
|
|
296
|
+
text-slate-500
|
|
297
|
+
inline-block
|
|
298
|
+
max-w-[150px]
|
|
299
|
+
whitespace-nowrap
|
|
300
|
+
overflow-hidden
|
|
301
|
+
text-ellipsis;
|
|
302
|
+
|
|
303
|
+
&--disabled {
|
|
304
|
+
@apply text-slate-400
|
|
305
|
+
group-hover:text-slate-400
|
|
306
|
+
group-active:text-slate-400;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
package/index.js
CHANGED
|
@@ -650,7 +650,7 @@ const Alert = ({
|
|
|
650
650
|
weight: "bold"
|
|
651
651
|
}, {
|
|
652
652
|
children: title !== null && title !== void 0 ? title : children
|
|
653
|
-
})), children && jsx(Description$
|
|
653
|
+
})), children && jsx(Description$3, Object.assign({
|
|
654
654
|
weight: !title ? "bold" : "default",
|
|
655
655
|
"$hasTitle": !!title
|
|
656
656
|
}, {
|
|
@@ -661,7 +661,7 @@ const Alert = ({
|
|
|
661
661
|
weight: "bold"
|
|
662
662
|
}, {
|
|
663
663
|
children: title !== null && title !== void 0 ? title : children
|
|
664
|
-
})), children && jsx(Description$
|
|
664
|
+
})), children && jsx(Description$3, Object.assign({
|
|
665
665
|
weight: !title ? "bold" : "default",
|
|
666
666
|
"$hasTitle": !!title
|
|
667
667
|
}, {
|
|
@@ -750,7 +750,7 @@ const Container$7 = tw.div`
|
|
|
750
750
|
const Content$1 = tw.div`
|
|
751
751
|
${p => p.$inline ? tws`tu-alert__content--inline` : tws`tu-alert__content`}
|
|
752
752
|
`;
|
|
753
|
-
const Description$
|
|
753
|
+
const Description$3 = tw(Text)`
|
|
754
754
|
${p => p.$hasTitle ? tws`tu-alert__description` : null}
|
|
755
755
|
`;
|
|
756
756
|
const RightAligned = tw.div`
|
|
@@ -763,11 +763,7 @@ const IconContainer$1 = tw.div`
|
|
|
763
763
|
`;
|
|
764
764
|
|
|
765
765
|
/**
|
|
766
|
-
* The Badge component
|
|
767
|
-
*
|
|
768
|
-
* _**Do use** badges to show highlighted text based on the state._
|
|
769
|
-
*
|
|
770
|
-
* _**Do not use** badges for regular text in places where it makes no sense to use highlighted text._
|
|
766
|
+
* The Badge component is used to display a notification badge with an optional number value.
|
|
771
767
|
*
|
|
772
768
|
* @param {BadgeProps} props - The props for the Badge component
|
|
773
769
|
* @returns {JSX.Element} Badge component
|
|
@@ -778,30 +774,34 @@ const Badge = _a => {
|
|
|
778
774
|
color = "neutral",
|
|
779
775
|
subtle = false,
|
|
780
776
|
className,
|
|
781
|
-
|
|
777
|
+
count,
|
|
778
|
+
max,
|
|
779
|
+
hideZero = false,
|
|
782
780
|
dataTestId,
|
|
783
|
-
children,
|
|
784
781
|
size = "default"
|
|
785
782
|
} = _a;
|
|
786
|
-
__rest(_a, ["color", "subtle", "className", "
|
|
783
|
+
__rest(_a, ["color", "subtle", "className", "count", "max", "hideZero", "dataTestId", "size"]);
|
|
787
784
|
|
|
788
|
-
|
|
785
|
+
if (hideZero && count === 0) {
|
|
786
|
+
return null;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
const displayedCount = count && max ? count > max ? `${max}+` : count : count;
|
|
789
790
|
return jsx(StyledText$3, Object.assign({
|
|
790
|
-
"$variant": variant,
|
|
791
791
|
className: className,
|
|
792
792
|
"$color": color,
|
|
793
793
|
"$size": size,
|
|
794
|
-
"$subtle": subtle
|
|
794
|
+
"$subtle": subtle,
|
|
795
|
+
"$count": count,
|
|
795
796
|
"data-testid": dataTestId,
|
|
796
797
|
"$as": "span"
|
|
797
798
|
}, {
|
|
798
|
-
children:
|
|
799
|
+
children: displayedCount
|
|
799
800
|
}));
|
|
800
801
|
};
|
|
801
802
|
|
|
802
803
|
const getSizeModifierClass$1 = () => ({
|
|
803
|
-
$size
|
|
804
|
-
$variant
|
|
804
|
+
$size
|
|
805
805
|
}) => {
|
|
806
806
|
const sizeModifierClass = {
|
|
807
807
|
large: tws`tu-badge--large`,
|
|
@@ -821,7 +821,7 @@ const getBadgeModifierClass = () => ({
|
|
|
821
821
|
danger: $subtle ? tws`tu-badge--danger-subtle` : tws`tu-badge--danger`,
|
|
822
822
|
warning: $subtle ? tws`tu-badge--warning-subtle` : tws`tu-badge--warning`,
|
|
823
823
|
info: $subtle ? tws`tu-badge--info-subtle` : tws`tu-badge--info`,
|
|
824
|
-
neutral: $subtle ? tws`tu-badge--neutral-subtle` : tws`badge--neutral`,
|
|
824
|
+
neutral: $subtle ? tws`tu-badge--neutral-subtle` : tws`tu-badge--neutral`,
|
|
825
825
|
good: $subtle ? tws`tu-badge--good-subtle` : tws`tu-badge--good`,
|
|
826
826
|
low: $subtle ? tws`tu-badge--low-subtle` : tws`tu-badge--low`,
|
|
827
827
|
critical: $subtle ? tws`tu-badge--critical-subtle` : tws`tu-badge--critical`,
|
|
@@ -834,18 +834,10 @@ const getBadgeModifierClass = () => ({
|
|
|
834
834
|
};
|
|
835
835
|
|
|
836
836
|
const StyledText$3 = tw.text`
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
case "pill":
|
|
843
|
-
return tws`tu-badge--pill`;
|
|
844
|
-
|
|
845
|
-
default:
|
|
846
|
-
return tws`tu-badge`;
|
|
847
|
-
}
|
|
848
|
-
}}
|
|
837
|
+
tu-badge
|
|
838
|
+
${({
|
|
839
|
+
$count
|
|
840
|
+
}) => ($count === null || $count === undefined) && tws`tu-badge--square`}
|
|
849
841
|
${getBadgeModifierClass()}
|
|
850
842
|
${getSizeModifierClass$1()}
|
|
851
843
|
`;
|
|
@@ -1154,7 +1146,7 @@ justify-end
|
|
|
1154
1146
|
`;
|
|
1155
1147
|
|
|
1156
1148
|
/**
|
|
1157
|
-
* The Heading
|
|
1149
|
+
* The Heading is used for a heading of a section (h1,h2,h3,h4).
|
|
1158
1150
|
*
|
|
1159
1151
|
* @param {HeadingProps} props - The props for the Heading component
|
|
1160
1152
|
* @returns {JSX.Element} Heading component
|
|
@@ -1503,7 +1495,7 @@ const Checkbox = React.forwardRef((_a, ref) => {
|
|
|
1503
1495
|
onKeyPress: onKeyPress
|
|
1504
1496
|
}, {
|
|
1505
1497
|
children: icon
|
|
1506
|
-
})), label && jsx(Label$
|
|
1498
|
+
})), label && jsx(Label$6, Object.assign({
|
|
1507
1499
|
ref: internalRef,
|
|
1508
1500
|
htmlFor: uuid,
|
|
1509
1501
|
"$disabled": isReadonly,
|
|
@@ -1551,7 +1543,7 @@ const HiddenInput$1 = tw.input`
|
|
|
1551
1543
|
const CheckboxContainer = tw.label`
|
|
1552
1544
|
tu-checkbox--container group
|
|
1553
1545
|
`;
|
|
1554
|
-
const Label$
|
|
1546
|
+
const Label$6 = tw.label`
|
|
1555
1547
|
tu-checkbox__label
|
|
1556
1548
|
${({
|
|
1557
1549
|
$disabled
|
|
@@ -2122,7 +2114,7 @@ const StyledText$2 = tw(Text)`
|
|
|
2122
2114
|
`;
|
|
2123
2115
|
const ListItem = tw.li`
|
|
2124
2116
|
group
|
|
2125
|
-
cursor-pointer
|
|
2117
|
+
${p => !p.disabled ? "cursor-pointer" : "cursor-not-allowed"}
|
|
2126
2118
|
whitespace-nowrap
|
|
2127
2119
|
py-1
|
|
2128
2120
|
px-2
|
|
@@ -2506,7 +2498,7 @@ const Indicator$1 = _a => {
|
|
|
2506
2498
|
"$withBackground": withBackground
|
|
2507
2499
|
}, {
|
|
2508
2500
|
children: icon
|
|
2509
|
-
})), label !== undefined && jsx(Label$
|
|
2501
|
+
})), label !== undefined && jsx(Label$5, Object.assign({
|
|
2510
2502
|
"data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label"
|
|
2511
2503
|
}, {
|
|
2512
2504
|
children: label
|
|
@@ -2575,7 +2567,7 @@ const IconBackground = tw.div`
|
|
|
2575
2567
|
return $withBackground ? "" : "tu-indicator__icon-background--none";
|
|
2576
2568
|
}}
|
|
2577
2569
|
`;
|
|
2578
|
-
const Label$
|
|
2570
|
+
const Label$5 = tw.div`
|
|
2579
2571
|
tu-indicator__label
|
|
2580
2572
|
`;
|
|
2581
2573
|
|
|
@@ -2588,7 +2580,7 @@ const Label$4 = tw.div`
|
|
|
2588
2580
|
* @returns {JSX.Element} Label component
|
|
2589
2581
|
*/
|
|
2590
2582
|
|
|
2591
|
-
const Label$
|
|
2583
|
+
const Label$4 = ({
|
|
2592
2584
|
id,
|
|
2593
2585
|
htmlFor,
|
|
2594
2586
|
label,
|
|
@@ -2610,14 +2602,14 @@ const Label$3 = ({
|
|
|
2610
2602
|
htmlFor: htmlFor
|
|
2611
2603
|
}, {
|
|
2612
2604
|
children: labelElement
|
|
2613
|
-
})), jsx(Description$
|
|
2605
|
+
})), jsx(Description$2, Object.assign({
|
|
2614
2606
|
subtle: true
|
|
2615
2607
|
}, {
|
|
2616
2608
|
children: description
|
|
2617
2609
|
}))]
|
|
2618
2610
|
});
|
|
2619
2611
|
};
|
|
2620
|
-
const Description$
|
|
2612
|
+
const Description$2 = tw(Text)`
|
|
2621
2613
|
tu-label
|
|
2622
2614
|
`;
|
|
2623
2615
|
|
|
@@ -2649,7 +2641,7 @@ const LegendItem = ({
|
|
|
2649
2641
|
style: {
|
|
2650
2642
|
backgroundColor: color
|
|
2651
2643
|
}
|
|
2652
|
-
}), jsx(Label$
|
|
2644
|
+
}), jsx(Label$3, {
|
|
2653
2645
|
children: label
|
|
2654
2646
|
})]
|
|
2655
2647
|
}));
|
|
@@ -2672,7 +2664,7 @@ const Indicator = tw.span`
|
|
|
2672
2664
|
rounded-[50%]
|
|
2673
2665
|
mr-2
|
|
2674
2666
|
`;
|
|
2675
|
-
const Label$
|
|
2667
|
+
const Label$3 = tw.span`
|
|
2676
2668
|
text-sm
|
|
2677
2669
|
`;
|
|
2678
2670
|
|
|
@@ -2746,7 +2738,7 @@ const MenuItem = ({
|
|
|
2746
2738
|
"$selected": selected
|
|
2747
2739
|
}, {
|
|
2748
2740
|
children: prefix
|
|
2749
|
-
})), jsx(Label$
|
|
2741
|
+
})), jsx(Label$2, {
|
|
2750
2742
|
children: label
|
|
2751
2743
|
}), icon && jsx(Icon, Object.assign({
|
|
2752
2744
|
"$selected": selected
|
|
@@ -2780,7 +2772,7 @@ const Prefix = tw.div`
|
|
|
2780
2772
|
$selected
|
|
2781
2773
|
}) => $selected ? tws`tu-menu-item__prefix--selected ` : ""}
|
|
2782
2774
|
`;
|
|
2783
|
-
const Label$
|
|
2775
|
+
const Label$2 = tw.div`
|
|
2784
2776
|
tu-menu-item__label
|
|
2785
2777
|
`;
|
|
2786
2778
|
|
|
@@ -3387,6 +3379,96 @@ ${p => `${p.border ? `tu-spacer--border` : null}`}
|
|
|
3387
3379
|
${GetSpacerHeight()}
|
|
3388
3380
|
`;
|
|
3389
3381
|
|
|
3382
|
+
/**
|
|
3383
|
+
* Tags allow users to enter information and filter content.
|
|
3384
|
+
*
|
|
3385
|
+
* Multiple or single tags can be used to categorise items.
|
|
3386
|
+
*
|
|
3387
|
+
* Use short labels for easy scanning. Use two words only if necessary to describe the status and differentiate it from other tags.
|
|
3388
|
+
*
|
|
3389
|
+
* @param {TagProps} props - The props for the tag component
|
|
3390
|
+
* @returns {JSX.Element} tag component
|
|
3391
|
+
*/
|
|
3392
|
+
|
|
3393
|
+
const Tag = React.forwardRef((_a, ref) => {
|
|
3394
|
+
var {
|
|
3395
|
+
className,
|
|
3396
|
+
dataTestId,
|
|
3397
|
+
children,
|
|
3398
|
+
size = "default",
|
|
3399
|
+
onClose,
|
|
3400
|
+
color = "primary"
|
|
3401
|
+
} = _a;
|
|
3402
|
+
__rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color"]);
|
|
3403
|
+
|
|
3404
|
+
return jsxs(StyledText, Object.assign({
|
|
3405
|
+
className: className,
|
|
3406
|
+
"$size": size,
|
|
3407
|
+
"data-testid": dataTestId,
|
|
3408
|
+
"$as": "span",
|
|
3409
|
+
"$color": color,
|
|
3410
|
+
"$withXIcon": !!onClose,
|
|
3411
|
+
ref: ref
|
|
3412
|
+
}, {
|
|
3413
|
+
children: [children, onClose && // a fix for multiselect deselecting tags working together with fade out animation
|
|
3414
|
+
jsx(IconContainer, Object.assign({
|
|
3415
|
+
onMouseDown: onClose
|
|
3416
|
+
}, {
|
|
3417
|
+
children: jsx(Icon$1, {
|
|
3418
|
+
name: "XCircleIcon",
|
|
3419
|
+
dataTestId: dataTestId + "Icon",
|
|
3420
|
+
type: "solid",
|
|
3421
|
+
style: {
|
|
3422
|
+
"-webkit-transition": "-webkit-transform 0.150s"
|
|
3423
|
+
},
|
|
3424
|
+
className: size === "default" ? tws`tu-tag__icon` : tws`tu-tag__icon tu-tag__icon--small`
|
|
3425
|
+
})
|
|
3426
|
+
}))]
|
|
3427
|
+
}));
|
|
3428
|
+
});
|
|
3429
|
+
|
|
3430
|
+
const getSizeModifierClass = () => ({
|
|
3431
|
+
$size,
|
|
3432
|
+
$withXIcon
|
|
3433
|
+
}) => {
|
|
3434
|
+
const tagSizeModifierClass = {
|
|
3435
|
+
default: $withXIcon ? tws`tu-tag--with-icon ` : tws` `,
|
|
3436
|
+
small: $withXIcon ? tws`tu-tag--small tu-tag--with-icon` : tws`tu-tag--small`
|
|
3437
|
+
};
|
|
3438
|
+
return tagSizeModifierClass[$size];
|
|
3439
|
+
};
|
|
3440
|
+
|
|
3441
|
+
const getColorModifierClass = () => ({
|
|
3442
|
+
$color
|
|
3443
|
+
}) => {
|
|
3444
|
+
const colorClasses = {
|
|
3445
|
+
primary: tws`tu-tag--primary`,
|
|
3446
|
+
accent: tws`tu-tag--accent`,
|
|
3447
|
+
success: tws`tu-tag--success`,
|
|
3448
|
+
danger: tws`tu-tag--danger`,
|
|
3449
|
+
warning: tws`tu-tag--warning`,
|
|
3450
|
+
info: tws`tu-tag--info`,
|
|
3451
|
+
neutral: tws`tu-tag--neutral`,
|
|
3452
|
+
good: tws`tu-tag--good`,
|
|
3453
|
+
low: tws`tu-tag--low`,
|
|
3454
|
+
critical: tws`tu-tag--critical`,
|
|
3455
|
+
working: tws`tu-tag--working`,
|
|
3456
|
+
idle: tws`tu-tag--idle`,
|
|
3457
|
+
stopped: tws`tu-tag--stopped`,
|
|
3458
|
+
unknown: tws`tu-tag--unknown`
|
|
3459
|
+
};
|
|
3460
|
+
return colorClasses[$color];
|
|
3461
|
+
};
|
|
3462
|
+
|
|
3463
|
+
const StyledText = tw.text`
|
|
3464
|
+
tu-tag
|
|
3465
|
+
${getSizeModifierClass()}
|
|
3466
|
+
${getColorModifierClass()}
|
|
3467
|
+
`;
|
|
3468
|
+
const IconContainer = tw.div`
|
|
3469
|
+
tu-tag__icon-container
|
|
3470
|
+
`;
|
|
3471
|
+
|
|
3390
3472
|
/**
|
|
3391
3473
|
* The PageHeading component used on pages.
|
|
3392
3474
|
*
|
|
@@ -3398,7 +3480,7 @@ const PageHeading = ({
|
|
|
3398
3480
|
title,
|
|
3399
3481
|
subtitle,
|
|
3400
3482
|
dataTestId,
|
|
3401
|
-
|
|
3483
|
+
tag
|
|
3402
3484
|
}) => {
|
|
3403
3485
|
return jsxs("div", Object.assign({
|
|
3404
3486
|
className: "w-full"
|
|
@@ -3411,10 +3493,10 @@ const PageHeading = ({
|
|
|
3411
3493
|
dataTestId: dataTestId
|
|
3412
3494
|
}, {
|
|
3413
3495
|
children: title
|
|
3414
|
-
})),
|
|
3496
|
+
})), tag && jsx(Tag, Object.assign({
|
|
3415
3497
|
color: "primary"
|
|
3416
3498
|
}, {
|
|
3417
|
-
children:
|
|
3499
|
+
children: tag
|
|
3418
3500
|
}))]
|
|
3419
3501
|
}), subtitle && jsx(Heading, Object.assign({
|
|
3420
3502
|
variant: "subtitle",
|
|
@@ -3590,14 +3672,14 @@ const RadioItem = ({
|
|
|
3590
3672
|
onChange: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.onChange,
|
|
3591
3673
|
"data-testid": dataTestId,
|
|
3592
3674
|
"$checked": isChecked
|
|
3593
|
-
}), jsx(Label, Object.assign({
|
|
3675
|
+
}), jsx(Label$1, Object.assign({
|
|
3594
3676
|
htmlFor: uuid,
|
|
3595
3677
|
"$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
|
|
3596
3678
|
"$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid
|
|
3597
3679
|
}, {
|
|
3598
3680
|
children: label
|
|
3599
3681
|
}))]
|
|
3600
|
-
}), description && jsx(Description, Object.assign({
|
|
3682
|
+
}), description && jsx(Description$1, Object.assign({
|
|
3601
3683
|
htmlFor: uuid,
|
|
3602
3684
|
"$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
|
|
3603
3685
|
"$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid
|
|
@@ -3624,7 +3706,7 @@ ${({
|
|
|
3624
3706
|
$isInvalid
|
|
3625
3707
|
}) => $isInvalid ? tws`tu-radioitem--invalid` : tws``}
|
|
3626
3708
|
`;
|
|
3627
|
-
const Label = tw.label`
|
|
3709
|
+
const Label$1 = tw.label`
|
|
3628
3710
|
tu-radioitem__label
|
|
3629
3711
|
${({
|
|
3630
3712
|
$isInvalid
|
|
@@ -3633,7 +3715,7 @@ ${({
|
|
|
3633
3715
|
$disabled
|
|
3634
3716
|
}) => $disabled ? tws`tu-radioitem__label--disabled` : tws``}
|
|
3635
3717
|
`;
|
|
3636
|
-
const Description = tw.label`
|
|
3718
|
+
const Description$1 = tw.label`
|
|
3637
3719
|
tu-radioitem__description
|
|
3638
3720
|
`;
|
|
3639
3721
|
|
|
@@ -3658,7 +3740,7 @@ const SelectContainer = ({
|
|
|
3658
3740
|
return jsxs(Container, Object.assign({
|
|
3659
3741
|
"data-testid": dataTestId
|
|
3660
3742
|
}, {
|
|
3661
|
-
children: [label && !hideLabel && jsx(Label$
|
|
3743
|
+
children: [label && !hideLabel && jsx(Label$4, {
|
|
3662
3744
|
label: label,
|
|
3663
3745
|
htmlFor: id !== null && id !== void 0 ? id : false,
|
|
3664
3746
|
description: description
|
|
@@ -3898,6 +3980,10 @@ const Select = _a => {
|
|
|
3898
3980
|
}));
|
|
3899
3981
|
};
|
|
3900
3982
|
|
|
3983
|
+
/**
|
|
3984
|
+
* Display placeholder lines before the data gets loaded to reduce load-time frustration.
|
|
3985
|
+
*/
|
|
3986
|
+
|
|
3901
3987
|
const SkeletonLines = memo(({
|
|
3902
3988
|
margin = "10px 0",
|
|
3903
3989
|
lines = 1,
|
|
@@ -3948,104 +4034,6 @@ const SkeletonLine = tw.div`
|
|
|
3948
4034
|
tu-skeleton-line
|
|
3949
4035
|
`;
|
|
3950
4036
|
|
|
3951
|
-
/**
|
|
3952
|
-
* Tags allow users to enter information and filter content.
|
|
3953
|
-
* Multiple or single tags can be used to categorise items.
|
|
3954
|
-
* Use short labels for easy scanning. Use two words only if necessary to describe the status and differentiate it from other tags.
|
|
3955
|
-
*
|
|
3956
|
-
* @param {TagProps} props - The props for the tag component
|
|
3957
|
-
* @returns {JSX.Element} tag component
|
|
3958
|
-
*/
|
|
3959
|
-
|
|
3960
|
-
const Tag = _a => {
|
|
3961
|
-
var {
|
|
3962
|
-
className,
|
|
3963
|
-
dataTestId,
|
|
3964
|
-
children,
|
|
3965
|
-
size = "default",
|
|
3966
|
-
onClose,
|
|
3967
|
-
color = "primary",
|
|
3968
|
-
onWidthKnown
|
|
3969
|
-
} = _a;
|
|
3970
|
-
__rest(_a, ["className", "dataTestId", "children", "size", "onClose", "color", "onWidthKnown"]);
|
|
3971
|
-
|
|
3972
|
-
const ref = React.useRef(null);
|
|
3973
|
-
React.useLayoutEffect(() => {
|
|
3974
|
-
var _a;
|
|
3975
|
-
|
|
3976
|
-
onWidthKnown && onWidthKnown({
|
|
3977
|
-
width: ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0
|
|
3978
|
-
});
|
|
3979
|
-
}, [ref, onWidthKnown]);
|
|
3980
|
-
return jsxs(StyledText, Object.assign({
|
|
3981
|
-
className: className,
|
|
3982
|
-
"$size": size,
|
|
3983
|
-
"data-testid": dataTestId,
|
|
3984
|
-
"$as": "span",
|
|
3985
|
-
"$color": color,
|
|
3986
|
-
"$withXIcon": !!onClose,
|
|
3987
|
-
ref: ref
|
|
3988
|
-
}, {
|
|
3989
|
-
children: [children, onClose && // a fix for multiselect deselecting tags working together with fade out animation
|
|
3990
|
-
jsx(IconContainer, Object.assign({
|
|
3991
|
-
onMouseDown: onClose
|
|
3992
|
-
}, {
|
|
3993
|
-
children: jsx(Icon$1, {
|
|
3994
|
-
name: "XCircleIcon",
|
|
3995
|
-
dataTestId: dataTestId + "Icon",
|
|
3996
|
-
type: "solid",
|
|
3997
|
-
style: {
|
|
3998
|
-
"-webkit-transition": "-webkit-transform 0.150s"
|
|
3999
|
-
},
|
|
4000
|
-
className: size === "default" ? tws`tu-tag__icon` : tws`tu-tag__icon tu-tag__icon--small`
|
|
4001
|
-
})
|
|
4002
|
-
}))]
|
|
4003
|
-
}));
|
|
4004
|
-
};
|
|
4005
|
-
|
|
4006
|
-
const getSizeModifierClass = () => ({
|
|
4007
|
-
$size,
|
|
4008
|
-
$withXIcon
|
|
4009
|
-
}) => {
|
|
4010
|
-
const tagSizeModifierClass = {
|
|
4011
|
-
default: $withXIcon ? tws`tu-tag--with-icon ` : tws` `,
|
|
4012
|
-
small: $withXIcon ? tws`tu-tag--small tu-tag--with-icon` : tws`tu-tag--small`
|
|
4013
|
-
};
|
|
4014
|
-
return tagSizeModifierClass[$size];
|
|
4015
|
-
};
|
|
4016
|
-
|
|
4017
|
-
const getColorModifierClass = () => ({
|
|
4018
|
-
$color
|
|
4019
|
-
}) => {
|
|
4020
|
-
const colorClasses = {
|
|
4021
|
-
primary: tws`tu-tag--primary`,
|
|
4022
|
-
accent: tws`tu-tag--accent`,
|
|
4023
|
-
success: tws`tu-tag--success`,
|
|
4024
|
-
danger: tws`tu-tag--danger`,
|
|
4025
|
-
warning: tws`tu-tag--warning`,
|
|
4026
|
-
info: tws`tu-tag--info`,
|
|
4027
|
-
neutral: tws`tu-tag--neutral`,
|
|
4028
|
-
good: tws`tu-tag--good`,
|
|
4029
|
-
low: tws`tu-tag--low`,
|
|
4030
|
-
critical: tws`tu-tag--critical`,
|
|
4031
|
-
working: tws`tu-tag--working`,
|
|
4032
|
-
idle: tws`tu-tag--idle`,
|
|
4033
|
-
stopped: tws`tu-tag--stopped`,
|
|
4034
|
-
unknown: tws`tu-tag--unknown`
|
|
4035
|
-
};
|
|
4036
|
-
return colorClasses[$color];
|
|
4037
|
-
};
|
|
4038
|
-
|
|
4039
|
-
const StyledText = tw.text`
|
|
4040
|
-
tu-tag
|
|
4041
|
-
${getSizeModifierClass()}
|
|
4042
|
-
${getColorModifierClass()}
|
|
4043
|
-
`;
|
|
4044
|
-
const IconContainer = tw.div`
|
|
4045
|
-
flex
|
|
4046
|
-
self-center
|
|
4047
|
-
`;
|
|
4048
|
-
|
|
4049
4037
|
const TextArea = React.forwardRef(({
|
|
4050
4038
|
id,
|
|
4051
4039
|
name,
|
|
@@ -4074,7 +4062,7 @@ const TextArea = React.forwardRef(({
|
|
|
4074
4062
|
className: className,
|
|
4075
4063
|
"data-testid": dataTestId
|
|
4076
4064
|
}, {
|
|
4077
|
-
children: [jsx(Label$
|
|
4065
|
+
children: [jsx(Label$4, {
|
|
4078
4066
|
htmlFor: id !== null && id !== void 0 ? id : false,
|
|
4079
4067
|
id: id,
|
|
4080
4068
|
label: label,
|
|
@@ -4314,6 +4302,17 @@ const TimelineElement = ({
|
|
|
4314
4302
|
}));
|
|
4315
4303
|
};
|
|
4316
4304
|
|
|
4305
|
+
/**
|
|
4306
|
+
* Use Toggle when you have to only enable/disable a feature.
|
|
4307
|
+
*
|
|
4308
|
+
* _**Do use** Toggle in forms or settings._
|
|
4309
|
+
*
|
|
4310
|
+
* _**Do not use** Toggle if a user can select many option from a list, use checkboxes instead of toggle._
|
|
4311
|
+
*
|
|
4312
|
+
* @param {ToggleProps} props - The props for the Toggle component
|
|
4313
|
+
* @returns {JSX.Element} Toggle component
|
|
4314
|
+
*/
|
|
4315
|
+
|
|
4317
4316
|
const Toggle = React.forwardRef(({
|
|
4318
4317
|
toggled = false,
|
|
4319
4318
|
onChange,
|
|
@@ -4325,72 +4324,99 @@ const Toggle = React.forwardRef(({
|
|
|
4325
4324
|
className,
|
|
4326
4325
|
dataTestId,
|
|
4327
4326
|
onBlur,
|
|
4328
|
-
name
|
|
4327
|
+
name,
|
|
4328
|
+
description = ""
|
|
4329
4329
|
}, ref) => {
|
|
4330
|
-
return jsxs(
|
|
4331
|
-
children: [
|
|
4332
|
-
name: name,
|
|
4333
|
-
type: "checkbox",
|
|
4334
|
-
checked: toggled,
|
|
4335
|
-
disabled: disabled,
|
|
4336
|
-
onChange: e => {
|
|
4337
|
-
e.stopPropagation();
|
|
4338
|
-
onChange(!toggled, e);
|
|
4339
|
-
},
|
|
4340
|
-
id: id,
|
|
4341
|
-
"aria-checked": toggled,
|
|
4342
|
-
role: "checkbox",
|
|
4343
|
-
tabIndex: tabIndex,
|
|
4344
|
-
required: required,
|
|
4345
|
-
ref: ref,
|
|
4346
|
-
"data-testid": dataTestId,
|
|
4347
|
-
onBlur: onBlur
|
|
4348
|
-
}), jsx(SwitchContainer, Object.assign({
|
|
4349
|
-
"$toggled": toggled,
|
|
4330
|
+
return jsxs(ToggleWrapper, {
|
|
4331
|
+
children: [jsxs(ToggleContainer, Object.assign({
|
|
4350
4332
|
htmlFor: id,
|
|
4351
|
-
"$
|
|
4352
|
-
"$size": size,
|
|
4353
|
-
className: className
|
|
4333
|
+
"$description": description
|
|
4354
4334
|
}, {
|
|
4355
|
-
children: jsx(
|
|
4335
|
+
children: [jsx(HiddenInput, {
|
|
4336
|
+
name: name,
|
|
4337
|
+
type: "checkbox",
|
|
4338
|
+
checked: toggled,
|
|
4339
|
+
disabled: disabled,
|
|
4340
|
+
onChange: e => {
|
|
4341
|
+
e.stopPropagation();
|
|
4342
|
+
onChange(!toggled, e);
|
|
4343
|
+
},
|
|
4344
|
+
id: id,
|
|
4345
|
+
"aria-checked": toggled,
|
|
4346
|
+
role: "checkbox",
|
|
4347
|
+
tabIndex: tabIndex,
|
|
4348
|
+
required: required,
|
|
4349
|
+
ref: ref,
|
|
4350
|
+
"data-testid": `${dataTestId}-Input`,
|
|
4351
|
+
onBlur: onBlur
|
|
4352
|
+
}), jsx(SwitchContainer, Object.assign({
|
|
4356
4353
|
"$toggled": toggled,
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4354
|
+
htmlFor: id,
|
|
4355
|
+
"$disabled": disabled,
|
|
4356
|
+
"$size": size,
|
|
4357
|
+
className: className
|
|
4358
|
+
}, {
|
|
4359
|
+
children: jsx(Switch, {
|
|
4360
|
+
"$toggled": toggled,
|
|
4361
|
+
htmlFor: id,
|
|
4362
|
+
"data-testid": `${dataTestId}-Switch`
|
|
4363
|
+
})
|
|
4364
|
+
}))]
|
|
4365
|
+
})), jsxs("div", {
|
|
4366
|
+
children: [jsx(Label, Object.assign({
|
|
4367
|
+
"$disabled": disabled,
|
|
4368
|
+
title: name,
|
|
4369
|
+
"$description": description,
|
|
4370
|
+
htmlFor: id,
|
|
4371
|
+
"data-testid": `${dataTestId}-Label`
|
|
4372
|
+
}, {
|
|
4373
|
+
children: name
|
|
4374
|
+
})), jsx("br", {}), description && jsx(Description, Object.assign({
|
|
4375
|
+
"$disabled": disabled,
|
|
4376
|
+
title: description,
|
|
4377
|
+
"data-testid": `${dataTestId}-Description`
|
|
4378
|
+
}, {
|
|
4379
|
+
children: description
|
|
4380
|
+
}))]
|
|
4381
|
+
})]
|
|
4360
4382
|
});
|
|
4361
4383
|
});
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4384
|
+
Toggle.displayName = "Toggle";
|
|
4385
|
+
const ToggleWrapper = tw.div`tu-toggle__wrapper`;
|
|
4386
|
+
const ToggleContainer = tw.label`
|
|
4387
|
+
tu-toggle__container
|
|
4388
|
+
${({
|
|
4389
|
+
$description
|
|
4390
|
+
}) => $description && tws`tu-toggle--align-bottom`}`;
|
|
4391
|
+
const HiddenInput = tw.input`tu-toggle__input`;
|
|
4392
|
+
const Switch = tw.label`
|
|
4367
4393
|
${({
|
|
4368
4394
|
$toggled
|
|
4369
|
-
}) => $toggled ? tws`
|
|
4370
|
-
transition-all
|
|
4371
|
-
`;
|
|
4395
|
+
}) => $toggled ? tws`tu-toggle__switch` : tws`tu-toggle`}`;
|
|
4372
4396
|
const SwitchContainer = tw.label`
|
|
4373
|
-
|
|
4374
|
-
items-center
|
|
4375
|
-
rounded-full
|
|
4376
|
-
p-1
|
|
4397
|
+
tu-toggle__switch-container
|
|
4377
4398
|
${({
|
|
4378
4399
|
$disabled
|
|
4379
|
-
}) => $disabled
|
|
4400
|
+
}) => $disabled && tws`tu-toggle--disabled`};
|
|
4380
4401
|
${({
|
|
4381
4402
|
$size
|
|
4382
|
-
}) => $size === "small" ? tws`
|
|
4403
|
+
}) => $size === "small" ? tws`tu-toggle--small` : tws`tu-toggle--default`};
|
|
4383
4404
|
${({
|
|
4384
|
-
$toggled
|
|
4405
|
+
$toggled
|
|
4406
|
+
}) => $toggled && tws`tu-toggle--toggled`}`;
|
|
4407
|
+
const Label = tw.label`
|
|
4408
|
+
tu-toggle__label
|
|
4409
|
+
${({
|
|
4385
4410
|
$disabled
|
|
4386
|
-
}) => $disabled
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
`;
|
|
4390
|
-
const
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4411
|
+
}) => $disabled && tws`tu-toggle__label--disabled`}
|
|
4412
|
+
${({
|
|
4413
|
+
$description
|
|
4414
|
+
}) => $description && tws`tu-toggle--align-label`}`;
|
|
4415
|
+
const Description = tw.label`
|
|
4416
|
+
tu-toggle__description
|
|
4417
|
+
${({
|
|
4418
|
+
$disabled
|
|
4419
|
+
}) => $disabled && tws`tu-toggle__description--disabled`}
|
|
4394
4420
|
`;
|
|
4395
4421
|
|
|
4396
4422
|
/**
|
|
@@ -4514,4 +4540,4 @@ const useTimeout = ({
|
|
|
4514
4540
|
};
|
|
4515
4541
|
};
|
|
4516
4542
|
|
|
4517
|
-
export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$
|
|
4543
|
+
export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$4 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiRowTableCell, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, TextArea, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, intentColors, useContainerProps, useCustomComponents, useCustomStyles, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.89",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@trackunit/css-core": "0.0.
|
|
8
|
-
"@trackunit/tailwind-styled-components": "0.0.
|
|
7
|
+
"@trackunit/css-core": "0.0.46",
|
|
8
|
+
"@trackunit/tailwind-styled-components": "0.0.40",
|
|
9
9
|
"react": "17.0.1",
|
|
10
|
-
"@trackunit/ui-design-tokens": "0.0.
|
|
10
|
+
"@trackunit/ui-design-tokens": "0.0.39",
|
|
11
11
|
"echarts-for-react": "^3.0.2",
|
|
12
12
|
"uuid": "^8.3.2",
|
|
13
13
|
"@react-spring/web": "^9.4.5",
|
|
14
14
|
"react-use": "^17.3.2",
|
|
15
15
|
"react-day-picker": "^8.0.3",
|
|
16
16
|
"date-fns": "^2.28.0",
|
|
17
|
-
"@trackunit/ui-icons": "0.0.
|
|
17
|
+
"@trackunit/ui-icons": "0.0.41",
|
|
18
18
|
"react-useportal": "^1.0.16",
|
|
19
19
|
"react-helmet": "^6.1.0",
|
|
20
20
|
"@popperjs/core": "^2.11.4",
|