@trackunit/react-components 0.0.126 → 0.0.129

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.
@@ -11,17 +11,13 @@ export interface CheckboxProps extends CommonProps, React.InputHTMLAttributes<HT
11
11
  disabled?: boolean;
12
12
  /**
13
13
  * An boolean flag to set invalid mode
14
- * can be used for handling errors
14
+ * can be used for indicating errors
15
15
  */
16
16
  isInvalid?: boolean;
17
17
  /**
18
18
  * An boolean flag to set checkbox to readonly mode
19
19
  */
20
20
  readOnly?: boolean;
21
- /**
22
- * An string element to be used as input name
23
- */
24
- name?: string;
25
21
  /**
26
22
  * An boolean flag to set checkbox to intermediate state
27
23
  */
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
+ import "./Label.css";
3
4
  export interface LabelProps extends CommonProps {
4
5
  /**
5
6
  * ID of the label.
@@ -13,6 +14,15 @@ export interface LabelProps extends CommonProps {
13
14
  * The label value.
14
15
  */
15
16
  children?: React.ReactNode;
17
+ /**
18
+ * Whether the label is disabled or not.
19
+ */
20
+ disabled?: boolean;
21
+ /**
22
+ * A boolean flag to set invalid mode
23
+ * can be used for indicating errors
24
+ */
25
+ isInvalid?: boolean;
16
26
  }
17
27
  /**
18
28
  * The Label component is used for labels for input fields.
@@ -21,4 +31,4 @@ export interface LabelProps extends CommonProps {
21
31
  * @param {LabelProps} props - The props for the Label component
22
32
  * @returns {JSX.Element} Label component
23
33
  */
24
- export declare const Label: ({ id, htmlFor, children, className, dataTestId }: LabelProps) => JSX.Element;
34
+ export declare const Label: ({ id, htmlFor, children, className, dataTestId, disabled, isInvalid, }: LabelProps) => JSX.Element;
@@ -2,6 +2,7 @@
2
2
  interface IMobileButton {
3
3
  onClick: () => void;
4
4
  className?: string;
5
+ dataTestId?: string;
5
6
  }
6
7
  /**
7
8
  * The MenuButton component.
@@ -9,5 +10,5 @@ interface IMobileButton {
9
10
  * @param {IMobileButton} props - The props for the MenuButton component
10
11
  * @returns {JSX.Element} MenuButton component
11
12
  */
12
- export declare const MenuButton: ({ onClick, className }: IMobileButton) => JSX.Element;
13
+ export declare const MenuButton: ({ onClick, className, dataTestId }: IMobileButton) => JSX.Element;
13
14
  export {};
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
+ import "./RadioGroup.css";
3
4
  export interface RadioGroupProps extends CommonProps, React.InputHTMLAttributes<HTMLInputElement> {
4
5
  /**
5
6
  */
@@ -33,8 +34,8 @@ export interface RadioGroupProps extends CommonProps, React.InputHTMLAttributes<
33
34
  */
34
35
  disabled?: boolean;
35
36
  /**
36
- * An boolean flag to set invalid mode
37
- * can be used for handling errors
37
+ * A boolean flag to set invalid mode
38
+ * can be used for indicating errors
38
39
  */
39
40
  isInvalid?: boolean;
40
41
  }
@@ -38,7 +38,7 @@ export interface SingleSelectMenuItemProps extends SelectMenuItemProps {
38
38
  * @param {SelectMenuItemProps} props - The props for the SingleSelectMenuItem
39
39
  * @returns {JSX.Element} SingleSelectMenuItem
40
40
  */
41
- export declare const SingleSelectMenuItem: ({ label, icon, onClick, selected, dataTestId, focused, }: SingleSelectMenuItemProps) => JSX.Element;
41
+ export declare const SingleSelectMenuItem: ({ label, icon, onClick, selected, dataTestId, focused, disabled, }: SingleSelectMenuItemProps) => JSX.Element;
42
42
  /**
43
43
  * A multi select menu item is a basic wrapper around Menu item designed to be used as a multi value render in Select list
44
44
  *
package/index.css CHANGED
@@ -163,6 +163,148 @@
163
163
  }
164
164
  }
165
165
 
166
+ /* CSS related to the LAbel component */
167
+
168
+ .tu-label {
169
+ @apply leading-none
170
+ text-base
171
+ text-slate-700
172
+ whitespace-nowrap
173
+ text-ellipsis
174
+ items-center
175
+ grid
176
+ gap-2
177
+ hover:text-slate-800
178
+ group-hover:text-slate-800
179
+ active:text-slate-800
180
+ group-active:text-slate-800;
181
+
182
+ &--invalid {
183
+ @apply text-red-600
184
+ hover:text-red-700
185
+ group-hover:text-red-700
186
+ active:text-red-700
187
+ group-active:text-red-700;
188
+ }
189
+
190
+ &--disabled {
191
+ @apply text-slate-400
192
+ hover:text-slate-400
193
+ group-hover:text-slate-400;
194
+ }
195
+ }
196
+
197
+ /* CSS related to the RadioGroup component */
198
+ .tu-radiogroup {
199
+ @apply flex
200
+ gap-2
201
+ w-fit
202
+ flex-col
203
+ items-start;
204
+
205
+ &--inline {
206
+ @apply flex
207
+ gap-3
208
+ flex-row
209
+ items-center;
210
+ }
211
+ }
212
+
213
+ .tu-radioitem {
214
+ @apply w-4
215
+ h-4
216
+ appearance-none
217
+ rounded-3xl
218
+ bg-white
219
+ border-solid
220
+ border
221
+ border-slate-300
222
+ shadow-sm
223
+ shrink-0
224
+ transition
225
+ box-border
226
+ hover:cursor-pointer
227
+ hover:bg-slate-100
228
+ focus:ring-2
229
+ focus:ring-offset-2
230
+ focus:ring-blue-700;
231
+
232
+ &__wrapper {
233
+ @apply flex
234
+ gap-2;
235
+ }
236
+
237
+ &--checked {
238
+ @apply border-solid
239
+ border-4
240
+ border-blue-600
241
+ bg-white
242
+ hover:bg-slate-100
243
+ hover:cursor-pointer
244
+ outline-0
245
+ active:bg-slate-200
246
+ active:ring-2
247
+ active:ring-offset-2
248
+ active:ring-blue-700
249
+ focus:bg-slate-200
250
+ focus:ring-2
251
+ focus:ring-offset-2
252
+ focus:ring-blue-700
253
+ group-active:ring-2
254
+ group-active:ring-offset-2
255
+ group-active:ring-blue-700;
256
+ }
257
+
258
+ &--invalid {
259
+ @apply border-red-600
260
+ active:ring-red-700
261
+ focus:ring-red-700
262
+ group-focus:ring-2
263
+ group-focus:ring-offset-2;
264
+ }
265
+
266
+ &--disabled {
267
+ @apply bg-slate-400
268
+ border-slate-300
269
+ cursor-not-allowed
270
+ group-hover:bg-slate-400
271
+ group-focus:bg-slate-400
272
+ hover:bg-slate-400
273
+ focus:bg-slate-400
274
+ active:bg-slate-400
275
+ focus:ring-0
276
+ focus:ring-offset-0
277
+ group-active:ring-0
278
+ group-active:ring-offset-0;
279
+ }
280
+
281
+ &--disabled.tu-radioitem--checked {
282
+ @apply bg-white;
283
+ }
284
+
285
+
286
+ &__label-container {
287
+ @apply gap-y-1
288
+ grid;
289
+ }
290
+
291
+ &__description {
292
+ @apply text-sm
293
+ font-normal
294
+ text-slate-500
295
+ text-left
296
+ whitespace-nowrap
297
+ text-ellipsis
298
+ overflow-hidden;
299
+
300
+ &--disabled {
301
+ @apply text-slate-400
302
+ hover:text-slate-400
303
+ group-hover:text-slate-400;
304
+ }
305
+ }
306
+ }
307
+
166
308
  .tu-textarea {
167
309
  @apply tu-input-base
168
310
  block
@@ -199,15 +341,13 @@
199
341
 
200
342
  &__wrapper {
201
343
  @apply flex
202
- items-center
203
- p-0.5;
344
+ gap-2;
204
345
  }
205
346
 
206
- &__container {
207
- @apply inline-block
208
- items-center
347
+ &__input-container {
348
+ @apply flex
349
+ self-start
209
350
  w-fit
210
- mr-2
211
351
  active:shadow
212
352
  rounded-full
213
353
  cursor-pointer
@@ -216,8 +356,10 @@
216
356
  focus-within:ring-blue-700;
217
357
  }
218
358
 
219
- &--align-bottom {
220
- @apply mb-7;
359
+ &__input {
360
+ @apply absolute
361
+ opacity-0
362
+ -z-10;
221
363
  }
222
364
 
223
365
  &__switch-container {
@@ -288,47 +430,24 @@
288
430
  @apply bg-slate-400;
289
431
  }
290
432
 
291
- &__input {
292
- @apply absolute
293
- opacity-0
294
- -z-10;
295
- }
296
-
297
- &__label {
298
- @apply hover:cursor-pointer
299
- text-base
300
- text-slate-900
301
- max-w-[250px]
302
- whitespace-nowrap
303
- overflow-hidden
304
- text-ellipsis;
305
-
306
- &--disabled {
307
- @apply text-slate-400
308
- group-hover:text-slate-400
309
- group-active:text-slate-400;
310
- }
311
- }
312
-
313
- &--align-label {
314
- @apply inline-block;
433
+ &__label-container {
434
+ @apply gap-y-1
435
+ grid;
315
436
  }
316
437
 
317
438
  &__description {
318
439
  @apply text-sm
319
440
  font-normal
320
- font-sans
321
441
  text-slate-500
322
- inline-block
323
- max-w-[150px]
442
+ text-left
324
443
  whitespace-nowrap
325
- overflow-hidden
326
- text-ellipsis;
444
+ text-ellipsis
445
+ overflow-hidden;
327
446
 
328
447
  &--disabled {
329
448
  @apply text-slate-400
330
- group-hover:text-slate-400
331
- group-active:text-slate-400;
449
+ hover:text-slate-400
450
+ group-hover:text-slate-400;
332
451
  }
333
452
  }
334
453
  }
package/index.js CHANGED
@@ -115,7 +115,7 @@ const Spinner = ({
115
115
  containerClassName,
116
116
  dataTestId
117
117
  }) => {
118
- return jsx(Container$a, Object.assign({
118
+ return jsx(Container$9, Object.assign({
119
119
  "$mode": mode,
120
120
  "$centered": centered,
121
121
  className: containerClassName
@@ -151,7 +151,7 @@ const StyledSpinner$1 = tw.span`
151
151
  ${p => p.$mode === "dark" ? tws`tu-spinner--dark` : null}
152
152
  ${getSpinnerStyles()}
153
153
  `;
154
- const Container$a = tw.div`
154
+ const Container$9 = tw.div`
155
155
  tu-spinner--container
156
156
  ${p => p.$centered ? tws`tu-spinner--container-centered` : null}
157
157
  `;
@@ -683,7 +683,7 @@ const Alert = ({
683
683
  ref && ref.current && ref.current.scrollIntoView && ref.current.scrollIntoView();
684
684
  }
685
685
  }, [ref, autoScroll]);
686
- return jsxs(Container$9, Object.assign({
686
+ return jsxs(Container$8, Object.assign({
687
687
  "$intent": intent,
688
688
  className: className,
689
689
  "data-testid": dataTestId,
@@ -771,7 +771,7 @@ const getBackgroundColor = () => ({
771
771
  return colors[$intent];
772
772
  };
773
773
 
774
- const Container$9 = tw.div`
774
+ const Container$8 = tw.div`
775
775
  tu-alert
776
776
  ${p => p.$inline ? tws`tu-alert--inline` : null}
777
777
  ${getBackgroundColor()}
@@ -900,7 +900,7 @@ const BaseInput = React.forwardRef((_a, ref) => {
900
900
  } = _a,
901
901
  rest = __rest(_a, ["className", "isInvalid", "dataTestId", "prefix", "suffix", "addonBefore", "addonAfter", "actions", "fieldSize"]);
902
902
 
903
- return jsxs(InputContainer, Object.assign({
903
+ return jsxs(InputContainer$1, Object.assign({
904
904
  "$fieldSize": fieldSize,
905
905
  "$invalid": isInvalid,
906
906
  "$disabled": rest.disabled || rest.readOnly,
@@ -942,7 +942,7 @@ const AddonBefore = tw.div`
942
942
  const AddonAfter = tw.div`
943
943
  tu-input__addon-after
944
944
  `;
945
- const InputContainer = tw.div`
945
+ const InputContainer$1 = tw.div`
946
946
  tu-input
947
947
  ${({
948
948
  $invalid
@@ -1259,7 +1259,7 @@ const CardHeader = ({
1259
1259
  className: className,
1260
1260
  "$density": density
1261
1261
  }, {
1262
- children: jsxs(Container$8, {
1262
+ children: jsxs(Container$7, {
1263
1263
  children: [jsxs("div", {
1264
1264
  children: [jsxs(HeadingContainer, {
1265
1265
  children: [jsx(Heading, Object.assign({
@@ -1289,7 +1289,7 @@ const CardHeader = ({
1289
1289
  const BottomBorderedDensityContainer = tw(DensityContainer)`
1290
1290
  tu-card__header-density-container
1291
1291
  `;
1292
- const Container$8 = tw.div`
1292
+ const Container$7 = tw.div`
1293
1293
  tu-card__header
1294
1294
  `;
1295
1295
  const HeadingContainer = tw.div`
@@ -1404,6 +1404,44 @@ const ChartContainer = tw.div`
1404
1404
  tu-chart-container
1405
1405
  `;
1406
1406
 
1407
+ /**
1408
+ * The Label component is used for labels for input fields.
1409
+ * This component is **not used directly**, but is part of the FormGroup and Field components.
1410
+ *
1411
+ * @param {LabelProps} props - The props for the Label component
1412
+ * @returns {JSX.Element} Label component
1413
+ */
1414
+
1415
+ const Label$3 = ({
1416
+ id,
1417
+ htmlFor,
1418
+ children,
1419
+ className,
1420
+ dataTestId,
1421
+ disabled,
1422
+ isInvalid
1423
+ }) => {
1424
+ return jsx(Root$2, Object.assign({
1425
+ id: id || "",
1426
+ htmlFor: htmlFor || "",
1427
+ className: className,
1428
+ "data-testid": dataTestId,
1429
+ "$disabled": disabled,
1430
+ "$isInvalid": isInvalid
1431
+ }, {
1432
+ children: children
1433
+ }));
1434
+ };
1435
+ const Root$2 = tw.label`
1436
+ tu-label
1437
+ ${({
1438
+ $disabled
1439
+ }) => $disabled && tws`tu-label--disabled`}
1440
+ ${({
1441
+ $isInvalid
1442
+ }) => $isInvalid && tws`tu-label--invalid`}
1443
+ `;
1444
+
1407
1445
  /**
1408
1446
  * The CheckIcon component is used by the checkbox to display the checked state.
1409
1447
  *
@@ -1518,35 +1556,31 @@ const Checkbox = React.forwardRef((_a, ref) => {
1518
1556
  }, rest, {
1519
1557
  ref: ref
1520
1558
  })), jsx(CheckboxWrapper, Object.assign({
1559
+ id: uuid,
1521
1560
  "$disabled": isReadonly,
1522
1561
  "$checked": checked,
1523
1562
  "$indeterminate": indeterminate,
1524
1563
  "$isInvalid": isReadonly ? false : isInvalid,
1525
- className: className,
1526
1564
  tabIndex: isReadonly ? -1 : tabIndex,
1527
1565
  onKeyPress: onKeyPress
1528
1566
  }, {
1529
1567
  children: icon
1530
- })), label && jsx(Label$6, Object.assign({
1531
- ref: internalRef,
1568
+ })), label && jsx(Label$3, Object.assign({
1532
1569
  htmlFor: uuid,
1533
- "$disabled": isReadonly,
1534
- "$isInvalid": isReadonly ? false : isInvalid,
1535
- "data-testid": dataTestId ? `${dataTestId}Label` : ""
1570
+ disabled: isReadonly,
1571
+ isInvalid: isReadonly ? false : isInvalid,
1572
+ dataTestId: `${dataTestId}-Label`
1536
1573
  }, {
1537
1574
  children: label
1538
1575
  })), children]
1539
1576
  }));
1540
1577
  });
1541
- const StyledCheckIcon = tw(CheckIcon)`
1542
- tu-checkbox--icon
1543
- `;
1544
- const StyledIndeterminateIcon = tw(IndeterminateIcon)`
1545
- tu-checkbox--icon
1546
- `;
1578
+ const StyledCheckIcon = tw(CheckIcon)`tu-checkbox--icon`;
1579
+ const StyledIndeterminateIcon = tw(IndeterminateIcon)`tu-checkbox--icon`;
1580
+ const CheckboxContainer = tw.label`tu-checkbox--container group`;
1581
+ const HiddenInput$1 = tw.input`tu-checkbox--input`;
1547
1582
  const CheckboxWrapper = tw.span`
1548
1583
  tu-checkbox
1549
- transition
1550
1584
  ${({
1551
1585
  $checked,
1552
1586
  $disabled,
@@ -1561,28 +1595,7 @@ const CheckboxWrapper = tw.span`
1561
1595
 
1562
1596
  ${({
1563
1597
  $isInvalid
1564
- }) => {
1565
- if ($isInvalid) {
1566
- return tws`tu-checkbox--invalid`;
1567
- }
1568
-
1569
- return tws``;
1570
- }}
1571
- `;
1572
- const HiddenInput$1 = tw.input`
1573
- tu-checkbox--input
1574
- `;
1575
- const CheckboxContainer = tw.label`
1576
- tu-checkbox--container group
1577
- `;
1578
- const Label$6 = tw.label`
1579
- tu-checkbox__label
1580
- ${({
1581
- $disabled
1582
- }) => $disabled ? tws`tu-checkbox-item--disabled` : null}
1583
- ${({
1584
- $isInvalid
1585
- }) => $isInvalid ? tws`tu-checkbox--invalid` : null}
1598
+ }) => $isInvalid && tws`tu-checkbox--invalid`}
1586
1599
  `;
1587
1600
 
1588
1601
  /**
@@ -1619,7 +1632,7 @@ const Collapse = ({
1619
1632
  "aria-controls": id,
1620
1633
  onClick: handleClick
1621
1634
  }, {
1622
- children: jsxs(LabelContainer, {
1635
+ children: jsxs(LabelContainer$2, {
1623
1636
  children: [jsx(Text, Object.assign({
1624
1637
  weight: "bold"
1625
1638
  }, {
@@ -1653,7 +1666,7 @@ const StyledCollapse = tw.div`
1653
1666
  const CollapseLabel = tw.div`
1654
1667
  tu-collapse__label
1655
1668
  `;
1656
- const LabelContainer = tw.div`
1669
+ const LabelContainer$2 = tw.div`
1657
1670
  tu-collapse__label__container
1658
1671
  `;
1659
1672
 
@@ -2087,34 +2100,6 @@ const RemoveValueContainer = tw.div`
2087
2100
  tu-date__remove
2088
2101
  `;
2089
2102
 
2090
- /**
2091
- * The Label component is used for labels for input fields.
2092
- * This component is **not used directly**, but is part of the FormGroup and Field components.
2093
- *
2094
- * @param {LabelProps} props - The props for the Label component
2095
- * @returns {JSX.Element} Label component
2096
- */
2097
-
2098
- const Label$5 = ({
2099
- id,
2100
- htmlFor,
2101
- children,
2102
- className,
2103
- dataTestId
2104
- }) => {
2105
- return jsx(Root$2, Object.assign({
2106
- className: className,
2107
- id: id,
2108
- "data-testid": dataTestId,
2109
- htmlFor: htmlFor
2110
- }, {
2111
- children: children
2112
- }));
2113
- };
2114
- const Root$2 = tw.label`
2115
- tu-label
2116
- `;
2117
-
2118
2103
  /**
2119
2104
  * The PopoverListItem component.
2120
2105
  *
@@ -2191,7 +2176,7 @@ const PopoverTitle = ({
2191
2176
  className,
2192
2177
  dataTestId
2193
2178
  }) => {
2194
- return jsxs(Container$7, Object.assign({
2179
+ return jsxs(Container$6, Object.assign({
2195
2180
  "$divider": divider,
2196
2181
  className: className,
2197
2182
  "data-testid": dataTestId
@@ -2207,7 +2192,7 @@ const PopoverTitle = ({
2207
2192
  })), action]
2208
2193
  }));
2209
2194
  };
2210
- const Container$7 = tw.div`
2195
+ const Container$6 = tw.div`
2211
2196
  tu-popover-title-container
2212
2197
  ${p => p.$divider && `tu-popover-title-container--divider`}
2213
2198
  `;
@@ -2256,7 +2241,7 @@ const Tooltip = ({
2256
2241
  "data-testid": dataTestId && `${dataTestId}-parent`
2257
2242
  }, {
2258
2243
  children: children
2259
- })), !disabled && jsx(Container$6, Object.assign({
2244
+ })), !disabled && jsx(Container$5, Object.assign({
2260
2245
  ref: popoverRef,
2261
2246
  onRequestClose: onHide,
2262
2247
  enterDelay: 450
@@ -2280,7 +2265,7 @@ const Tooltip = ({
2280
2265
  const Flex$1 = tw.div`
2281
2266
  inline-flex
2282
2267
  `;
2283
- const Container$6 = tw(AnimatedPopover)`
2268
+ const Container$5 = tw(AnimatedPopover)`
2284
2269
  tu-tooltip__container
2285
2270
  `;
2286
2271
  const Content = tw.div`
@@ -2350,7 +2335,7 @@ const FormGroup = ({
2350
2335
  "data-testid": dataTestId
2351
2336
  }, {
2352
2337
  children: [jsxs(ContainerBefore, {
2353
- children: [jsx(Label$5, Object.assign({
2338
+ children: [jsx(Label$3, Object.assign({
2354
2339
  "data-testid": `${dataTestId}-label`
2355
2340
  }, {
2356
2341
  children: label
@@ -2566,7 +2551,7 @@ const Indicator$1 = _a => {
2566
2551
  } = _a,
2567
2552
  rest = __rest(_a, ["dataTestId", "icon", "label", "color", "withBackground"]);
2568
2553
 
2569
- return jsxs(Container$5, Object.assign({
2554
+ return jsxs(Container$4, Object.assign({
2570
2555
  "$color": color,
2571
2556
  "data-testid": dataTestId
2572
2557
  }, rest, {
@@ -2575,14 +2560,14 @@ const Indicator$1 = _a => {
2575
2560
  "$withBackground": withBackground
2576
2561
  }, {
2577
2562
  children: icon
2578
- })), label !== undefined && jsx(Label$4, Object.assign({
2563
+ })), label !== undefined && jsx(Label$2, Object.assign({
2579
2564
  "data-testid": dataTestId ? `${dataTestId}-label` : "indicator-label"
2580
2565
  }, {
2581
2566
  children: label
2582
2567
  }))]
2583
2568
  }));
2584
2569
  };
2585
- const Container$5 = tw.div`
2570
+ const Container$4 = tw.div`
2586
2571
  tu-indicator
2587
2572
  ${({
2588
2573
  $color
@@ -2644,7 +2629,7 @@ const IconBackground = tw.div`
2644
2629
  return $withBackground ? "" : "tu-indicator__icon-background--none";
2645
2630
  }}
2646
2631
  `;
2647
- const Label$4 = tw.div`
2632
+ const Label$2 = tw.div`
2648
2633
  tu-indicator__label
2649
2634
  `;
2650
2635
 
@@ -2676,7 +2661,7 @@ const LegendItem = ({
2676
2661
  style: {
2677
2662
  backgroundColor: color
2678
2663
  }
2679
- }), jsx(Label$3, {
2664
+ }), jsx(Label$1, {
2680
2665
  children: label
2681
2666
  })]
2682
2667
  }));
@@ -2699,7 +2684,7 @@ const Indicator = tw.span`
2699
2684
  rounded-[50%]
2700
2685
  mr-2
2701
2686
  `;
2702
- const Label$3 = tw.span`
2687
+ const Label$1 = tw.span`
2703
2688
  text-sm
2704
2689
  `;
2705
2690
 
@@ -2712,7 +2697,8 @@ const Label$3 = tw.span`
2712
2697
 
2713
2698
  const MenuButton = ({
2714
2699
  onClick,
2715
- className
2700
+ className,
2701
+ dataTestId
2716
2702
  }) => {
2717
2703
  return jsx(MobileIconButton, {
2718
2704
  icon: jsx(Icon$1, {
@@ -2722,7 +2708,8 @@ const MenuButton = ({
2722
2708
  size: "small",
2723
2709
  circular: true,
2724
2710
  onClick: onClick,
2725
- className: className
2711
+ className: className,
2712
+ "data-testid": dataTestId
2726
2713
  });
2727
2714
  };
2728
2715
  const MobileIconButton = tw(IconButton)`
@@ -2759,7 +2746,7 @@ const MenuItem = ({
2759
2746
  className,
2760
2747
  dataTestId
2761
2748
  });
2762
- return jsxs(Container$4, Object.assign({}, containerProps, {
2749
+ return jsxs(Container$3, Object.assign({}, containerProps, {
2763
2750
  onClick: e => {
2764
2751
  e.stopPropagation();
2765
2752
  onClick && onClick(e);
@@ -2770,21 +2757,23 @@ const MenuItem = ({
2770
2757
  "$disabled": disabled
2771
2758
  }, {
2772
2759
  children: [prefix && jsx(Prefix, Object.assign({
2773
- "$selected": selected
2760
+ "$selected": selected,
2761
+ "data-testid": `${dataTestId}-prefix`
2774
2762
  }, {
2775
2763
  children: prefix
2776
- })), jsx(Label$2, Object.assign({
2777
- "data-testid": dataTestId + "-label"
2764
+ })), jsx(Label, Object.assign({
2765
+ "data-testid": `${dataTestId}-label`
2778
2766
  }, {
2779
2767
  children: label
2780
2768
  })), icon && jsx(Icon, Object.assign({
2781
- "$selected": selected
2769
+ "$selected": selected,
2770
+ "data-testid": `${dataTestId}-icon`
2782
2771
  }, {
2783
2772
  children: icon
2784
2773
  }))]
2785
2774
  }));
2786
2775
  };
2787
- const Container$4 = tw.div`
2776
+ const Container$3 = tw.div`
2788
2777
  group tu-menu-item
2789
2778
  ${({
2790
2779
  $selected
@@ -2809,7 +2798,7 @@ const Prefix = tw.div`
2809
2798
  $selected
2810
2799
  }) => $selected ? tws`tu-menu-item__prefix--selected ` : ""}
2811
2800
  `;
2812
- const Label$2 = tw.div`
2801
+ const Label = tw.div`
2813
2802
  tu-menu-item__label
2814
2803
  `;
2815
2804
 
@@ -2835,7 +2824,7 @@ const MenuList = _a => {
2835
2824
  dataTestId
2836
2825
  }, args));
2837
2826
  return jsx(Wrapper, {
2838
- children: jsx(Container$3, Object.assign({}, containerProps, {
2827
+ children: jsx(Container$2, Object.assign({}, containerProps, {
2839
2828
  style: width ? {
2840
2829
  width
2841
2830
  } : undefined,
@@ -2857,7 +2846,7 @@ const MenuList = _a => {
2857
2846
  const Wrapper = tw.div`
2858
2847
  tu-menu-list__wrapper
2859
2848
  `;
2860
- const Container$3 = tw.div`
2849
+ const Container$2 = tw.div`
2861
2850
  tu-menu-list
2862
2851
  `;
2863
2852
  const Divider = tw.div`
@@ -3420,65 +3409,58 @@ const RadioItem = ({
3420
3409
  const groupCtx = React.useContext(RadioGroupContext);
3421
3410
  const isChecked = (groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.value) === value;
3422
3411
  const uuid = v4();
3423
- return jsxs(CustomFlex, Object.assign({
3424
- className: className
3412
+ return jsxs(InputWrapper, Object.assign({
3413
+ className: className,
3414
+ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id} ${uuid}`,
3415
+ "data-testid": `${dataTestId}-Wrapper`
3425
3416
  }, {
3426
- children: [jsxs(InputWrapper, {
3427
- children: [jsx(Input, {
3428
- id: uuid,
3429
- type: "radio",
3430
- value: value,
3431
- checked: isChecked,
3432
- "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
3433
- "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid,
3434
- onChange: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.onChange,
3435
- "data-testid": dataTestId,
3436
- "$checked": isChecked
3437
- }), jsx(Label$1, Object.assign({
3438
- htmlFor: uuid,
3439
- "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
3440
- "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid
3417
+ children: [jsx(Input, {
3418
+ id: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id} ${uuid}`,
3419
+ type: "radio",
3420
+ value: value,
3421
+ checked: isChecked,
3422
+ "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
3423
+ "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid,
3424
+ onChange: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.onChange,
3425
+ "data-testid": dataTestId,
3426
+ "$checked": isChecked
3427
+ }), jsxs(LabelContainer$1, {
3428
+ children: [jsx(Label$3, Object.assign({
3429
+ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id} ${uuid}`,
3430
+ dataTestId: `${dataTestId}-Label`,
3431
+ disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
3432
+ isInvalid: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid
3441
3433
  }, {
3442
3434
  children: label
3435
+ })), description && jsx(Description$1, Object.assign({
3436
+ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id} ${uuid}`,
3437
+ "data-testid": `${dataTestId}-Description`,
3438
+ "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled
3439
+ }, {
3440
+ children: description
3443
3441
  }))]
3444
- }), description && jsx(Description$1, Object.assign({
3445
- htmlFor: uuid,
3446
- "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled,
3447
- "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid
3448
- }, {
3449
- children: description
3450
- }))]
3442
+ })]
3451
3443
  }));
3452
3444
  };
3453
- const CustomFlex = tw.div`
3454
- tu-radioitem__custom-flex
3455
- `;
3456
- const InputWrapper = tw.div`
3457
- tu-radioitem__wrapper
3458
- `;
3445
+ const InputWrapper = tw.label`tu-radioitem__wrapper`;
3459
3446
  const Input = tw.input`
3460
3447
  tu-radioitem
3461
3448
  ${({
3462
3449
  $checked
3463
- }) => $checked ? tws`tu-radioitem--checked` : tws``}
3450
+ }) => $checked && tws`tu-radioitem--checked`}
3464
3451
  ${({
3465
3452
  $disabled
3466
- }) => $disabled ? tws`tu-radioitem--disabled` : tws``}
3453
+ }) => $disabled && tws`tu-radioitem--disabled`}
3467
3454
  ${({
3468
3455
  $isInvalid
3469
- }) => $isInvalid ? tws`tu-radioitem--invalid` : tws``}
3470
- `;
3471
- const Label$1 = tw.label`
3472
- tu-radioitem__label
3473
- ${({
3474
- $isInvalid
3475
- }) => $isInvalid ? tws`tu-radioitem__label--invalid` : tws``}
3476
- ${({
3477
- $disabled
3478
- }) => $disabled ? tws`tu-radioitem__label--disabled` : tws``}
3456
+ }) => $isInvalid && tws`tu-radioitem--invalid`}
3479
3457
  `;
3458
+ const LabelContainer$1 = tw.div`tu-radioitem__label-container`;
3480
3459
  const Description$1 = tw.label`
3481
3460
  tu-radioitem__description
3461
+ ${({
3462
+ $disabled
3463
+ }) => $disabled && tws`tu-radioitem__description--disabled`}
3482
3464
  `;
3483
3465
 
3484
3466
  /**
@@ -3500,12 +3482,12 @@ const SelectContainer$1 = ({
3500
3482
  dataTestId,
3501
3483
  isDisabled
3502
3484
  }) => {
3503
- return jsxs(Container$2, Object.assign({
3485
+ return jsxs(Container$1, Object.assign({
3504
3486
  "data-testid": dataTestId,
3505
3487
  "$hasError": hasError,
3506
3488
  "$isDisabled": isDisabled
3507
3489
  }, {
3508
- children: [label && !hideLabel && jsx(Label$5, Object.assign({
3490
+ children: [label && !hideLabel && jsx(Label$3, Object.assign({
3509
3491
  htmlFor: id
3510
3492
  }, {
3511
3493
  children: label
@@ -3517,7 +3499,7 @@ const SelectContainer$1 = ({
3517
3499
  }))]
3518
3500
  }));
3519
3501
  };
3520
- const Container$2 = tw.label`
3502
+ const Container$1 = tw.label`
3521
3503
  tu-select__container
3522
3504
  tu-select
3523
3505
  ${({
@@ -3597,7 +3579,8 @@ const SingleSelectMenuItem = ({
3597
3579
  onClick,
3598
3580
  selected,
3599
3581
  dataTestId,
3600
- focused
3582
+ focused,
3583
+ disabled
3601
3584
  }) => {
3602
3585
  return jsx(MenuItem, {
3603
3586
  dataTestId: dataTestId,
@@ -3605,6 +3588,7 @@ const SingleSelectMenuItem = ({
3605
3588
  prefix: icon,
3606
3589
  onClick: onClick,
3607
3590
  selected: selected,
3591
+ disabled: disabled,
3608
3592
  focused: focused,
3609
3593
  icon: selected ? jsx(Icon$1, {
3610
3594
  name: "CheckIcon",
@@ -3775,7 +3759,7 @@ const TagsContainer = ({
3775
3759
 
3776
3760
  return null;
3777
3761
  }).filter(element => element !== null);
3778
- return jsxs(Container$1, Object.assign({
3762
+ return jsxs(Container, Object.assign({
3779
3763
  style: {
3780
3764
  width: `${width}`
3781
3765
  },
@@ -3785,7 +3769,7 @@ const TagsContainer = ({
3785
3769
  children: [renderedElements, postFix]
3786
3770
  }));
3787
3771
  };
3788
- const Container$1 = tw.div`
3772
+ const Container = tw.div`
3789
3773
  tu-select__dynamic-tag--container
3790
3774
  ${({
3791
3775
  $ready
@@ -3886,7 +3870,7 @@ const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIs
3886
3870
  });
3887
3871
  },
3888
3872
  DropdownIndicator: props => {
3889
- return jsx(components.DropdownIndicator, Object.assign({}, props, {
3873
+ return props.selectProps.isLoading ? null : jsx(components.DropdownIndicator, Object.assign({}, props, {
3890
3874
  children: jsx(StyledIcon, {
3891
3875
  children: dropdownIcon ? dropdownIcon : menuIsClosing ? jsx(Icon$1, {
3892
3876
  name: "ChevronDownIcon",
@@ -3937,15 +3921,6 @@ const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIs
3937
3921
  className: menuIsClosing ? tws`tu-menu-list animate-fade-out-fast` : tws`tu-menu-list animate-fade-in-fast`
3938
3922
  }));
3939
3923
  },
3940
- MenuList: props => {
3941
- return jsx(components.MenuList, Object.assign({}, props, {
3942
- children: jsx(Container, Object.assign({
3943
- "$disabled": disabled
3944
- }, {
3945
- children: props.children
3946
- }))
3947
- }));
3948
- },
3949
3924
  Option: props => {
3950
3925
  const componentProps = {
3951
3926
  label: props.label,
@@ -3962,6 +3937,7 @@ const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIs
3962
3937
  disabled: disabled,
3963
3938
  dataTestId: props.label
3964
3939
  })) : jsx(SingleSelectMenuItem, Object.assign({}, componentProps, {
3940
+ disabled: disabled,
3965
3941
  dataTestId: props.label
3966
3942
  }))
3967
3943
  }));
@@ -3971,14 +3947,6 @@ const useCustomComponents = (componentsProps, disabled, menuIsClosing, refMenuIs
3971
3947
 
3972
3948
  return customComponents;
3973
3949
  };
3974
- const Container = tw.div`
3975
- tu-select__menu
3976
- ${({
3977
- $disabled
3978
- }) => {
3979
- return $disabled ? tws`pointer-events-none` : "";
3980
- }}
3981
- `;
3982
3950
  const StyledIcon = tw.div`
3983
3951
  tu-select--icon
3984
3952
  `;
@@ -4042,6 +4010,10 @@ const useCustomStyles = (refContainer, refPrefix, maxSelectedDisplayCount, style
4042
4010
  }),
4043
4011
  menuList: base => {
4044
4012
  return Object.assign(Object.assign({}, base), {
4013
+ position: "relative",
4014
+ padding: "var(--spacing-1)",
4015
+ display: "grid",
4016
+ gap: "var(--spacing-1)",
4045
4017
  width: "100%",
4046
4018
  borderRadius: "0px",
4047
4019
  boxShadow: "none",
@@ -4720,9 +4692,8 @@ const Toggle = React.forwardRef(({
4720
4692
  description = ""
4721
4693
  }, ref) => {
4722
4694
  return jsxs(ToggleWrapper, {
4723
- children: [jsxs(ToggleContainer, Object.assign({
4724
- htmlFor: id,
4725
- "$description": description
4695
+ children: [jsxs(InputContainer, Object.assign({
4696
+ htmlFor: id
4726
4697
  }, {
4727
4698
  children: [jsx(HiddenInput, {
4728
4699
  name: name,
@@ -4745,8 +4716,7 @@ const Toggle = React.forwardRef(({
4745
4716
  "$toggled": toggled,
4746
4717
  htmlFor: id,
4747
4718
  "$disabled": disabled,
4748
- "$size": size,
4749
- className: className
4719
+ "$size": size
4750
4720
  }, {
4751
4721
  children: jsx(Switch, {
4752
4722
  "$toggled": toggled,
@@ -4754,19 +4724,17 @@ const Toggle = React.forwardRef(({
4754
4724
  "data-testid": `${dataTestId}-Switch`
4755
4725
  })
4756
4726
  }))]
4757
- })), jsxs("div", {
4758
- children: [jsx(Label, Object.assign({
4759
- "$disabled": disabled,
4760
- title: name,
4761
- "$description": description,
4727
+ })), jsxs(LabelContainer, {
4728
+ children: [jsx(Label$3, Object.assign({
4762
4729
  htmlFor: id,
4763
- "data-testid": `${dataTestId}-Label`
4730
+ dataTestId: `${dataTestId}-Label`,
4731
+ disabled: disabled
4764
4732
  }, {
4765
4733
  children: name
4766
- })), jsx("br", {}), description && jsx(Description, Object.assign({
4767
- "$disabled": disabled,
4768
- title: description,
4769
- "data-testid": `${dataTestId}-Description`
4734
+ })), description && jsx(Description, Object.assign({
4735
+ htmlFor: id,
4736
+ "data-testid": `${dataTestId}-Description`,
4737
+ "$disabled": disabled
4770
4738
  }, {
4771
4739
  children: description
4772
4740
  }))]
@@ -4775,11 +4743,7 @@ const Toggle = React.forwardRef(({
4775
4743
  });
4776
4744
  Toggle.displayName = "Toggle";
4777
4745
  const ToggleWrapper = tw.div`tu-toggle__wrapper`;
4778
- const ToggleContainer = tw.label`
4779
- tu-toggle__container
4780
- ${({
4781
- $description
4782
- }) => $description && tws`tu-toggle--align-bottom`}`;
4746
+ const InputContainer = tw.label`tu-toggle__input-container `;
4783
4747
  const HiddenInput = tw.input`tu-toggle__input`;
4784
4748
  const Switch = tw.label`
4785
4749
  ${({
@@ -4796,14 +4760,7 @@ tu-toggle__switch-container
4796
4760
  ${({
4797
4761
  $toggled
4798
4762
  }) => $toggled && tws`tu-toggle--toggled`}`;
4799
- const Label = tw.label`
4800
- tu-toggle__label
4801
- ${({
4802
- $disabled
4803
- }) => $disabled && tws`tu-toggle__label--disabled`}
4804
- ${({
4805
- $description
4806
- }) => $description && tws`tu-toggle--align-label`}`;
4763
+ const LabelContainer = tw.div`tu-toggle__label-container`;
4807
4764
  const Description = tw.label`
4808
4765
  tu-toggle__description
4809
4766
  ${({
@@ -5174,4 +5131,4 @@ const Layout = tw.div`
5174
5131
  tu-layout-TwoColumnLayout
5175
5132
  `;
5176
5133
 
5177
- export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$5 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiSelectMenuItem, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, getOrderedOptions, intentColors, isMultiValue, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
5134
+ export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$3 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiSelectMenuItem, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, getOrderedOptions, intentColors, isMultiValue, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.126",
3
+ "version": "0.0.129",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {