@trackunit/react-components 0.0.196 → 0.0.199

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.
@@ -0,0 +1,60 @@
1
+ import * as React from "react";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ export interface SearchProps extends CommonProps {
4
+ /**
5
+ * The name for the HTML element.
6
+ */
7
+ name?: string;
8
+ /**
9
+ * Placeholder string to be shown in the search box.
10
+ */
11
+ placeholder?: string;
12
+ /**
13
+ * Whether the search box should widen to take up full width while in focus or not.
14
+ * If disabled, the search box takes up full width when not in focus.
15
+ */
16
+ widenInputOnFocus?: boolean;
17
+ /**
18
+ * Whether the border for the search box should be displayed while the search box is not in focus.
19
+ */
20
+ showBorderWhenNotInFocus?: boolean;
21
+ /**
22
+ * Value rendered in the search box.
23
+ */
24
+ value?: string;
25
+ /**
26
+ * Whether the search box is disabled or not.
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * Specify what if any permission the user agent has to provide automated assistance in filling out search values.
31
+ */
32
+ autoComplete?: string;
33
+ /**
34
+ * Event that occurs when the user releases a key.
35
+ */
36
+ onKeyUp?: (evt: React.KeyboardEvent<HTMLInputElement>) => void;
37
+ /**
38
+ * Event that occurs when there is a change.
39
+ */
40
+ onChange?: (evt: React.ChangeEvent<HTMLInputElement>) => void;
41
+ /**
42
+ * Event that occurs when the search box is on focus.
43
+ */
44
+ onFocus?: (evt: React.FocusEvent<HTMLInputElement>) => void;
45
+ /**
46
+ * Event that occurs when search box is blurred.
47
+ */
48
+ onBlur?: (evt: React.FocusEvent<HTMLInputElement>) => void;
49
+ /**
50
+ * Event that search box is cleared.
51
+ */
52
+ onClear?: () => void;
53
+ }
54
+ /**
55
+ * The Search component is used to render a search input field.
56
+ *
57
+ * @param {SearchProps} props - The props for the Search component
58
+ * @returns {JSX.Element} Search component
59
+ */
60
+ export declare const Search: ({ className, placeholder, value, widenInputOnFocus, showBorderWhenNotInFocus, disabled, onKeyUp, onChange, onFocus, onBlur, name, onClear, dataTestId, autoComplete, }: SearchProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export * from "./Search";
@@ -2,7 +2,6 @@ import * as React from "react";
2
2
  import { CommonProps } from "../../common";
3
3
  import { FormGroupProps } from "../FormGroup/FormGroup";
4
4
  import { TextAreaProps } from "../TextArea/TextArea";
5
- import "../TextArea/TextArea.css";
6
5
  declare type FormGroupExposedProps = Pick<FormGroupProps, "label" | "tip" | "helpText" | "helpAddon">;
7
6
  export interface TextAreaFieldProps extends TextAreaProps, FormGroupExposedProps, CommonProps {
8
7
  /**
@@ -27,6 +27,7 @@ export * from "./Popover";
27
27
  export * from "./Popover/Popover";
28
28
  export * from "./Prompt";
29
29
  export * from "./RadioGroup";
30
+ export * from "./Search";
30
31
  export * from "./SectionHeader";
31
32
  export * from "./Select";
32
33
  export * from "./SkeletonLines";
package/index.css CHANGED
@@ -354,31 +354,6 @@
354
354
  }
355
355
  }
356
356
 
357
- .tu-textarea {
358
- @apply tu-input-base
359
- block
360
- overflow-auto
361
- appearance-none
362
- px-3
363
- py-2
364
- bg-transparent
365
- text-base
366
- text-slate-900
367
- placeholder-slate-400
368
- focus-visible:outline-none
369
- w-full
370
- h-20
371
- transition;
372
-
373
- &--invalid {
374
- @apply tu-input--invalid;
375
- }
376
-
377
- &--disabled {
378
- @apply tu-input--disabled;
379
- }
380
- }
381
-
382
357
  /* CSS related to the toggle component */
383
358
  .tu-toggle {
384
359
  @apply rounded-full
package/index.js CHANGED
@@ -422,6 +422,9 @@ const Root$6 = tw.span`
422
422
  case "unknown":
423
423
  return tws`tu-icon--unknown`;
424
424
 
425
+ case "white":
426
+ return tws`text-white`;
427
+
425
428
  default:
426
429
  return "tu-icon--default";
427
430
  }
@@ -3614,6 +3617,81 @@ ${({
3614
3617
  }) => $disabled && tws`tu-radioitem__description--disabled`}
3615
3618
  `;
3616
3619
 
3620
+ /**
3621
+ * A thin wrapper around the `BaseInput` component for text input fields.
3622
+ *
3623
+ * NOTE: If shown with a label, please use the `TextField` component instead.
3624
+ */
3625
+
3626
+ const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
3627
+ ref: ref,
3628
+ type: "text"
3629
+ }, props)));
3630
+
3631
+ /**
3632
+ * The Search component is used to render a search input field.
3633
+ *
3634
+ * @param {SearchProps} props - The props for the Search component
3635
+ * @returns {JSX.Element} Search component
3636
+ */
3637
+
3638
+ const Search = ({
3639
+ className,
3640
+ placeholder = "Search",
3641
+ value,
3642
+ widenInputOnFocus,
3643
+ showBorderWhenNotInFocus = false,
3644
+ disabled,
3645
+ onKeyUp,
3646
+ onChange,
3647
+ onFocus,
3648
+ onBlur,
3649
+ name,
3650
+ onClear,
3651
+ dataTestId,
3652
+ autoComplete = "on"
3653
+ }) => {
3654
+ return jsx(StyledTextInput, {
3655
+ dataTestId: dataTestId,
3656
+ name: name,
3657
+ className: className,
3658
+ "$widenOnFocus": widenInputOnFocus,
3659
+ "$showBorderWhenNotInFocus": showBorderWhenNotInFocus,
3660
+ placeholder: placeholder,
3661
+ prefix: jsx(Icon$1, {
3662
+ name: "SearchIcon",
3663
+ size: "medium"
3664
+ }),
3665
+ suffix: onClear ? jsx("button", Object.assign({
3666
+ "data-testid": `${dataTestId}_suffix_component`,
3667
+ onClick: () => {
3668
+ onClear();
3669
+ }
3670
+ }, {
3671
+ children: jsx(Icon$1, {
3672
+ name: "XIcon",
3673
+ size: "small"
3674
+ })
3675
+ })) : undefined,
3676
+ value: value,
3677
+ disabled: disabled,
3678
+ onChange: onChange,
3679
+ onKeyUp: onKeyUp,
3680
+ onFocus: onFocus,
3681
+ onBlur: onBlur,
3682
+ autoComplete: autoComplete
3683
+ });
3684
+ };
3685
+ const StyledTextInput = twx(TextInput)`
3686
+ tu-search
3687
+ ${({
3688
+ $showBorderWhenNotInFocus
3689
+ }) => $showBorderWhenNotInFocus && tws`tu-search--border`}
3690
+ ${({
3691
+ $widenOnFocus
3692
+ }) => $widenOnFocus && tws`tu-search--widen-on-focus`}
3693
+ `;
3694
+
3617
3695
  /**
3618
3696
  * The Spacer component is used for adding a bit of space in the ui.
3619
3697
  *
@@ -4736,17 +4814,6 @@ const TextAreaField = React.forwardRef((_a, ref) => {
4736
4814
  }));
4737
4815
  });
4738
4816
 
4739
- /**
4740
- * A thin wrapper around the `BaseInput` component for text input fields.
4741
- *
4742
- * NOTE: If shown with a label, please use the `TextField` component instead.
4743
- */
4744
-
4745
- const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
4746
- ref: ref,
4747
- type: "text"
4748
- }, props)));
4749
-
4750
4817
  /**
4751
4818
  * Text fields enable the user to interact with and input content and data. This component can be used for long and short form entries. Allow the size of the text input box to reflect the length of the content you expect the user to enter.
4752
4819
  *
@@ -5489,4 +5556,4 @@ const Layout = tw.div`
5489
5556
  tu-layout-TwoColumnLayout
5490
5557
  `;
5491
5558
 
5492
- export { ActionButton, Alert, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, DotsDirection, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuItem, MenuList, MenuPlacement, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, MultiSelectMenuItem, NumberField, NumberInput, PageHeader, Pagination, Popover, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, SectionHeader, Select, SelectPrefix, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, ValueBar, docs, getOrderedOptions, getValueBarColorByValue, isMultiValue, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePrompt, useTimeout };
5559
+ export { ActionButton, Alert, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, DotsDirection, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuItem, MenuList, MenuPlacement, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, MultiSelectMenuItem, NumberField, NumberInput, PageHeader, Pagination, Popover, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Search, SectionHeader, Select, SelectPrefix, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, ValueBar, docs, getOrderedOptions, getValueBarColorByValue, isMultiValue, useContainerProps, useCustomComponents, useDebounce, useLocalStorage, useModal, usePrompt, useTimeout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.196",
3
+ "version": "0.0.199",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {