@trackunit/react-components 0.0.198 → 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.
- package/components/Search/Search.d.ts +60 -0
- package/components/Search/index.d.ts +1 -0
- package/components/index.d.ts +1 -0
- package/index.js +76 -12
- package/package.json +1 -1
|
@@ -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";
|
package/components/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -3617,6 +3617,81 @@ ${({
|
|
|
3617
3617
|
}) => $disabled && tws`tu-radioitem__description--disabled`}
|
|
3618
3618
|
`;
|
|
3619
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
|
+
|
|
3620
3695
|
/**
|
|
3621
3696
|
* The Spacer component is used for adding a bit of space in the ui.
|
|
3622
3697
|
*
|
|
@@ -4739,17 +4814,6 @@ const TextAreaField = React.forwardRef((_a, ref) => {
|
|
|
4739
4814
|
}));
|
|
4740
4815
|
});
|
|
4741
4816
|
|
|
4742
|
-
/**
|
|
4743
|
-
* A thin wrapper around the `BaseInput` component for text input fields.
|
|
4744
|
-
*
|
|
4745
|
-
* NOTE: If shown with a label, please use the `TextField` component instead.
|
|
4746
|
-
*/
|
|
4747
|
-
|
|
4748
|
-
const TextInput = forwardRef((props, ref) => jsx(BaseInput, Object.assign({
|
|
4749
|
-
ref: ref,
|
|
4750
|
-
type: "text"
|
|
4751
|
-
}, props)));
|
|
4752
|
-
|
|
4753
4817
|
/**
|
|
4754
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.
|
|
4755
4819
|
*
|
|
@@ -5492,4 +5556,4 @@ const Layout = tw.div`
|
|
|
5492
5556
|
tu-layout-TwoColumnLayout
|
|
5493
5557
|
`;
|
|
5494
5558
|
|
|
5495
|
-
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 };
|