@agility/plenum-ui 1.1.2 → 1.1.3
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/lib/components/Combobox/Combobox.d.ts +9 -9
- package/lib/components/Combobox/Combobox.stories.d.ts +9 -6
- package/lib/components/TreeView/TreeItem/TreeItem.d.ts +2 -11
- package/lib/components/TreeView/TreeItem/TreeItem.stories.d.ts +1 -4
- package/lib/components/TreeView/context.d.ts +8 -5
- package/lib/components/TreeView/sampleData.d.ts +5 -5
- package/lib/index.esm.js +6 -6
- package/lib/index.js +6 -6
- package/package.json +1 -1
- package/coverage/Forms/TextInputSelect/InputSelect/InputSelect.tsx.html +0 -204
- package/coverage/Forms/TextInputSelect/InputSelect/index.html +0 -155
- package/coverage/Select/Select.tsx.html +0 -264
- package/coverage/Select/index.html +0 -153
- package/coverage/Select.tsx.html +0 -261
- package/coverage/agility-component-lib-react/index.html +0 -116
- package/coverage/agility-component-lib-react/src/components/Button/Button.tsx.html +0 -343
- package/coverage/agility-component-lib-react/src/components/Button/index.html +0 -116
- package/coverage/agility-component-lib-react/src/components/Checkbox/Checkbox.tsx.html +0 -235
- package/coverage/agility-component-lib-react/src/components/Checkbox/index.html +0 -156
- package/coverage/agility-component-lib-react/src/components/Forms/BaseField/BaseField.tsx.html +0 -406
- package/coverage/agility-component-lib-react/src/components/Forms/BaseField/index.html +0 -116
- package/coverage/agility-component-lib-react/src/components/Forms/Checkbox/Checkbox.tsx.html +0 -283
- package/coverage/agility-component-lib-react/src/components/Forms/Checkbox/index.html +0 -116
- package/coverage/agility-component-lib-react/src/components/Forms/InputCounter/InputCounter.tsx.html +0 -139
- package/coverage/agility-component-lib-react/src/components/Forms/InputCounter/index.html +0 -116
- package/coverage/agility-component-lib-react/src/components/Forms/InputLabel/InputLabel.tsx.html +0 -211
- package/coverage/agility-component-lib-react/src/components/Forms/InputLabel/index.html +0 -131
- package/coverage/agility-component-lib-react/src/components/Forms/InputLabel/index.ts.html +0 -94
- package/coverage/agility-component-lib-react/src/components/Forms/Radio/Radio.tsx.html +0 -271
- package/coverage/agility-component-lib-react/src/components/Forms/Radio/index.html +0 -116
- package/coverage/agility-component-lib-react/src/components/Forms/Select/Select.tsx.html +0 -337
- package/coverage/agility-component-lib-react/src/components/Forms/Select/index.html +0 -116
- package/coverage/agility-component-lib-react/src/components/Forms/TextInputAddon/InputCta/InputCta.tsx.html +0 -271
- package/coverage/agility-component-lib-react/src/components/Forms/TextInputAddon/InputCta/index.html +0 -116
- package/coverage/agility-component-lib-react/src/components/Forms/TextInputSelect/InputSelect/InputSelect.tsx.html +0 -217
- package/coverage/agility-component-lib-react/src/components/Forms/TextInputSelect/InputSelect/index.html +0 -116
- package/coverage/agility-component-lib-react/src/components/Radio/Radio.tsx.html +0 -243
- package/coverage/agility-component-lib-react/src/components/Radio/index.html +0 -156
- package/coverage/agility-component-lib-react/src/components/Switch/Switch.tsx.html +0 -214
- package/coverage/agility-component-lib-react/src/components/Switch/index.html +0 -116
- package/coverage/agility-component-lib-react/src/util/DynamicIcons.tsx.html +0 -151
- package/coverage/agility-component-lib-react/src/util/Loader.tsx.html +0 -139
- package/coverage/agility-component-lib-react/src/util/index.html +0 -131
- package/coverage/agility-component-lib-react/styleMock.js.html +0 -91
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -145
- package/coverage/coverage-final.json +0 -5
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -146
- package/coverage/lcov-report/agility-component-lib-react/index.html +0 -153
- package/coverage/lcov-report/agility-component-lib-react/src/components/Button/Button.tsx.html +0 -255
- package/coverage/lcov-report/agility-component-lib-react/src/components/Button/index.html +0 -156
- package/coverage/lcov-report/agility-component-lib-react/src/components/Checkbox/Checkbox.tsx.html +0 -235
- package/coverage/lcov-report/agility-component-lib-react/src/components/Checkbox/index.html +0 -156
- package/coverage/lcov-report/agility-component-lib-react/src/components/Forms/BaseField/BaseField.tsx.html +0 -330
- package/coverage/lcov-report/agility-component-lib-react/src/components/Forms/BaseField/index.html +0 -158
- package/coverage/lcov-report/agility-component-lib-react/src/components/Forms/InputCounter/InputCounter.tsx.html +0 -147
- package/coverage/lcov-report/agility-component-lib-react/src/components/Forms/InputCounter/index.html +0 -158
- package/coverage/lcov-report/agility-component-lib-react/src/components/Forms/TextInputAddon/InputCta/InputCta.tsx.html +0 -258
- package/coverage/lcov-report/agility-component-lib-react/src/components/Forms/TextInputAddon/InputCta/index.html +0 -159
- package/coverage/lcov-report/agility-component-lib-react/src/components/Forms/TextInputSelect/InputSelect/InputSelect.tsx.html +0 -210
- package/coverage/lcov-report/agility-component-lib-react/src/components/Forms/TextInputSelect/InputSelect/index.html +0 -159
- package/coverage/lcov-report/agility-component-lib-react/src/components/Radio/Radio.tsx.html +0 -243
- package/coverage/lcov-report/agility-component-lib-react/src/components/Radio/index.html +0 -156
- package/coverage/lcov-report/agility-component-lib-react/src/components/Switch/Switch.tsx.html +0 -225
- package/coverage/lcov-report/agility-component-lib-react/src/components/Switch/index.html +0 -156
- package/coverage/lcov-report/agility-component-lib-react/src/util/DynamicIcons.tsx.html +0 -137
- package/coverage/lcov-report/agility-component-lib-react/src/util/index.html +0 -155
- package/coverage/lcov-report/agility-component-lib-react/styleMock.js.html +0 -90
- package/coverage/lcov-report/base.css +0 -354
- package/coverage/lcov-report/block-navigation.js +0 -82
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -385
- package/coverage/lcov-report/prettify.css +0 -101
- package/coverage/lcov-report/prettify.js +0 -955
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -189
- package/coverage/lcov.info +0 -267
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/lib/components/Checkbox/Checkbox.d.ts +0 -19
- package/lib/components/Checkbox/Checkbox.stories.d.ts +0 -12
- package/lib/components/Checkbox/Checkbox.test.d.ts +0 -1
- package/lib/components/Checkbox/index.d.ts +0 -1
- package/lib/components/DatePicker/DatePicker.d.ts +0 -7
- package/lib/components/DatePicker/DatePicker.stories.d.ts +0 -6
- package/lib/components/DatePicker/DatePicker.test.d.ts +0 -1
- package/lib/components/DatePicker/index.d.ts +0 -1
- package/lib/components/Forms/InputCta/InputCta.d.ts +0 -16
- package/lib/components/Forms/InputCta/InputCta.stories.d.ts +0 -6
- package/lib/components/Forms/InputCta/InputCta.test.d.ts +0 -1
- package/lib/components/Forms/InputCta/index.d.ts +0 -1
- package/lib/components/InputCounter/InputCounter.d.ts +0 -16
- package/lib/components/InputCounter/InputCounter.stories.d.ts +0 -6
- package/lib/components/InputCounter/InputCounter.test.d.ts +0 -1
- package/lib/components/InputCounter/index.d.ts +0 -1
- package/lib/components/Radio/Radio.d.ts +0 -21
- package/lib/components/Radio/Radio.stories.d.ts +0 -12
- package/lib/components/Radio/Radio.test.d.ts +0 -1
- package/lib/components/Radio/index.d.ts +0 -1
- package/lib/components/Select/Select.d.ts +0 -25
- package/lib/components/Select/Select.stories.d.ts +0 -11
- package/lib/components/Select/Select.test.d.ts +0 -1
- package/lib/components/Select/index.d.ts +0 -1
- package/lib/components/TextInput/TextInput.d.ts +0 -46
- package/lib/components/TextInput/TextInput.stories.d.ts +0 -10
- package/lib/components/TextInput/index.d.ts +0 -1
- package/lib/components/TextInputAddon/TextInputAddon.d.ts +0 -51
- package/lib/components/TextInputAddon/TextInputAddon.stories.d.ts +0 -6
- package/lib/components/TextInputAddon/index.d.ts +0 -1
- package/lib/components/TreeView/types/tree.types.d.ts +0 -21
- package/yarn-error.log +0 -12463
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
value: string;
|
|
4
|
-
};
|
|
5
|
-
export interface ComboboxProps {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ComboboxProps<T extends Record<string, unknown>> {
|
|
6
3
|
/** Label */
|
|
7
4
|
label?: string;
|
|
8
5
|
/** ID */
|
|
9
6
|
id: string;
|
|
10
7
|
/** Array of items to display */
|
|
11
|
-
items:
|
|
8
|
+
items: T[];
|
|
9
|
+
/** the item property to use as the key */
|
|
10
|
+
keyProperty: string;
|
|
11
|
+
/** the item property to use as the display */
|
|
12
|
+
displayProperty: string;
|
|
12
13
|
/** Placeholder */
|
|
13
14
|
placeholder?: string;
|
|
14
15
|
/** Callback to trigger on change */
|
|
15
|
-
onChange?(value:
|
|
16
|
+
onChange?(value: T): void;
|
|
16
17
|
/** Select disabled state */
|
|
17
18
|
isDisabled?: boolean;
|
|
18
19
|
/** Select error state */
|
|
@@ -20,5 +21,4 @@ export interface ComboboxProps {
|
|
|
20
21
|
/** Select required state */
|
|
21
22
|
isRequired?: boolean;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
export declare const Combobox: FC<ComboboxProps>;
|
|
24
|
+
export declare const Combobox: <T extends Record<string, unknown>>({ label, items, displayProperty, keyProperty, onChange, placeholder, isDisabled, isError, isRequired, id }: ComboboxProps<T>) => JSX.Element;
|
|
@@ -3,9 +3,12 @@ import { Story } from '@storybook/react';
|
|
|
3
3
|
import { ComboboxProps } from './Combobox';
|
|
4
4
|
declare const _default: Meta<import("@storybook/react").Args>;
|
|
5
5
|
export default _default;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
6
|
+
interface ComboItem {
|
|
7
|
+
[value: string]: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const AllVariations: Story<ComboboxProps<ComboItem>>;
|
|
10
|
+
export declare const Default: Story<ComboboxProps<ComboItem>>;
|
|
11
|
+
export declare const Label: Story<ComboboxProps<ComboItem>>;
|
|
12
|
+
export declare const Disabled: Story<ComboboxProps<ComboItem>>;
|
|
13
|
+
export declare const Required: Story<ComboboxProps<ComboItem>>;
|
|
14
|
+
export declare const Error: Story<ComboboxProps<ComboItem>>;
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { TreeItemChildrenProps } from '../types/tree.types';
|
|
3
2
|
export interface TreeItemProps {
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
/** title of the tree item */
|
|
7
|
-
title?: string;
|
|
8
|
-
/** If tree item is expanded */
|
|
9
|
-
isExpanded?: boolean;
|
|
10
|
-
/** inner nodes within the tree item */
|
|
11
|
-
childNodes?: Partial<TreeItemChildrenProps[] | null>;
|
|
12
|
-
/** A Check to know if item is a root value */
|
|
13
|
-
isRoot?: boolean;
|
|
3
|
+
/** Prop comment */
|
|
4
|
+
prop: string;
|
|
14
5
|
}
|
|
15
6
|
/** Comment */
|
|
16
7
|
export declare const TreeItem: FC<TreeItemProps>;
|
|
@@ -3,7 +3,4 @@ import { Story } from '@storybook/react';
|
|
|
3
3
|
import { TreeItemProps } from './TreeItem';
|
|
4
4
|
declare const _default: Meta<import("@storybook/react").Args>;
|
|
5
5
|
export default _default;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const Active: Story<TreeItemProps>;
|
|
8
|
-
export declare const Expanded: Story<TreeItemProps>;
|
|
9
|
-
export declare const WithChildren: Story<TreeItemProps>;
|
|
6
|
+
export declare const TreeItemComponent: Story<TreeItemProps>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export interface TreeViewContextProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
5
|
+
}
|
|
3
6
|
export interface TreeViewProviderProps {
|
|
4
|
-
children?: JSX.Element | HTMLDivElement
|
|
7
|
+
children?: JSX.Element | HTMLDivElement;
|
|
5
8
|
}
|
|
6
|
-
declare const TreeViewContext: React.Context<TreeViewContextProps | null
|
|
9
|
+
declare const TreeViewContext: React.Context<Partial<TreeViewContextProps | null>>;
|
|
7
10
|
declare const TreeViewProvider: ({ children }: TreeViewProviderProps) => JSX.Element;
|
|
8
|
-
export declare const useTreeViewContext: () => TreeViewContextProps | null
|
|
11
|
+
export declare const useTreeViewContext: () => Partial<TreeViewContextProps | null>;
|
|
9
12
|
export { TreeViewContext, TreeViewProvider };
|
|
@@ -11,7 +11,7 @@ export declare const data: ({
|
|
|
11
11
|
galleryFolderID: number;
|
|
12
12
|
assetID: number;
|
|
13
13
|
folderID: number;
|
|
14
|
-
|
|
14
|
+
children: null;
|
|
15
15
|
} | {
|
|
16
16
|
key: string;
|
|
17
17
|
type: string;
|
|
@@ -25,7 +25,7 @@ export declare const data: ({
|
|
|
25
25
|
galleryFolderID: number;
|
|
26
26
|
assetID: number;
|
|
27
27
|
folderID: number;
|
|
28
|
-
|
|
28
|
+
children: ({
|
|
29
29
|
key: string;
|
|
30
30
|
type: string;
|
|
31
31
|
title: string;
|
|
@@ -38,7 +38,7 @@ export declare const data: ({
|
|
|
38
38
|
galleryFolderID: number;
|
|
39
39
|
assetID: number;
|
|
40
40
|
folderID: number;
|
|
41
|
-
|
|
41
|
+
children: {
|
|
42
42
|
key: string;
|
|
43
43
|
type: string;
|
|
44
44
|
title: string;
|
|
@@ -51,7 +51,7 @@ export declare const data: ({
|
|
|
51
51
|
galleryFolderID: number;
|
|
52
52
|
assetID: number;
|
|
53
53
|
folderID: number;
|
|
54
|
-
|
|
54
|
+
children: null;
|
|
55
55
|
}[];
|
|
56
56
|
} | {
|
|
57
57
|
key: string;
|
|
@@ -66,6 +66,6 @@ export declare const data: ({
|
|
|
66
66
|
galleryFolderID: number;
|
|
67
67
|
assetID: number;
|
|
68
68
|
folderID: number;
|
|
69
|
-
|
|
69
|
+
children: null;
|
|
70
70
|
})[];
|
|
71
71
|
})[];
|
package/lib/index.esm.js
CHANGED
|
@@ -7089,9 +7089,9 @@ function classNames() {
|
|
|
7089
7089
|
}
|
|
7090
7090
|
return classes.filter(Boolean).join(' ');
|
|
7091
7091
|
}
|
|
7092
|
-
|
|
7092
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
7093
7093
|
var Combobox = function (_a) {
|
|
7094
|
-
var label = _a.label, items = _a.items, onChange = _a.onChange, placeholder = _a.placeholder, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired, id = _a.id;
|
|
7094
|
+
var label = _a.label, items = _a.items, displayProperty = _a.displayProperty, keyProperty = _a.keyProperty, onChange = _a.onChange, placeholder = _a.placeholder, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired, id = _a.id;
|
|
7095
7095
|
var _b = useState(''), query = _b[0], setQuery = _b[1];
|
|
7096
7096
|
var _c = useState(), selectedItem = _c[0], setSelectedItem = _c[1];
|
|
7097
7097
|
useEffect(function () {
|
|
@@ -7100,7 +7100,7 @@ var Combobox = function (_a) {
|
|
|
7100
7100
|
var filteredItems = query === ''
|
|
7101
7101
|
? items
|
|
7102
7102
|
: items.filter(function (item) {
|
|
7103
|
-
return item.
|
|
7103
|
+
return "".concat(item[displayProperty]).toLowerCase().includes(query.toLowerCase());
|
|
7104
7104
|
});
|
|
7105
7105
|
var inputStyles = cn$1('w-full rounded-md border bg-white py-2 pl-3 pr-10 shadow-sm sm:text-sm', 'focus:border-purple-500 focus:outline-none focus:ring-1 focus:ring-purple-500', { 'border-red-500': isError }, { 'border-gray-300': !isError });
|
|
7106
7106
|
var labelStyles = cn$1('block text-sm font-medium text-gray-700');
|
|
@@ -7110,16 +7110,16 @@ var Combobox = function (_a) {
|
|
|
7110
7110
|
label && (React__default.createElement(Na.Label, { className: labelStyles },
|
|
7111
7111
|
React__default.createElement(InputLabel, { isPlaceholder: true, isActive: true, label: label, isRequired: isRequired, id: id, isError: isError, isDisabled: isDisabled }))),
|
|
7112
7112
|
React__default.createElement("div", { className: "relative" },
|
|
7113
|
-
React__default.createElement(Na.Input, { className: inputStyles, onChange: function (event) { return setQuery(event.target.value); }, displayValue: function (item) { return item
|
|
7113
|
+
React__default.createElement(Na.Input, { className: inputStyles, onChange: function (event) { return setQuery(event.target.value); }, displayValue: function (item) { return "".concat(item[displayProperty]); }, placeholder: placeholder }),
|
|
7114
7114
|
React__default.createElement(Na.Button, { className: buttonStyles },
|
|
7115
7115
|
React__default.createElement(DynamicIcons, { icon: "SelectorIcon", className: "h-5 w-5 text-gray-400", "aria-hidden": "true" })),
|
|
7116
|
-
filteredItems.length > 0 && (React__default.createElement(Na.Options, { className: optionStyles }, filteredItems.map(function (item, index) { return (React__default.createElement(Na.Option, { key: index, value: item, className: function (_a) {
|
|
7116
|
+
filteredItems.length > 0 && (React__default.createElement(Na.Options, { className: optionStyles }, filteredItems.map(function (item, index) { return (React__default.createElement(Na.Option, { key: "".concat(item[keyProperty], "-").concat(index), value: item, className: function (_a) {
|
|
7117
7117
|
var active = _a.active;
|
|
7118
7118
|
return classNames('relative cursor-default select-none py-2 pl-3 pr-9', active ? 'bg-purple-600 text-white' : 'text-gray-900');
|
|
7119
7119
|
} }, function (_a) {
|
|
7120
7120
|
var active = _a.active, selected = _a.selected;
|
|
7121
7121
|
return (React__default.createElement(React__default.Fragment, null,
|
|
7122
|
-
React__default.createElement("span", { className: classNames('block truncate', selected ? 'font-semibold' : '') }, item
|
|
7122
|
+
React__default.createElement("span", { className: classNames('block truncate', selected ? 'font-semibold' : '') }, "".concat(item[displayProperty])),
|
|
7123
7123
|
selected && (React__default.createElement("span", { className: classNames('absolute inset-y-0 right-0 flex items-center pr-4', active ? 'text-white' : 'text-purple-600') },
|
|
7124
7124
|
React__default.createElement(DynamicIcons, { icon: "CheckIcon", className: "h-5 w-5", "aria-hidden": "true" })))));
|
|
7125
7125
|
})); }))))));
|
package/lib/index.js
CHANGED
|
@@ -7115,9 +7115,9 @@ function classNames() {
|
|
|
7115
7115
|
}
|
|
7116
7116
|
return classes.filter(Boolean).join(' ');
|
|
7117
7117
|
}
|
|
7118
|
-
|
|
7118
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
7119
7119
|
var Combobox = function (_a) {
|
|
7120
|
-
var label = _a.label, items = _a.items, onChange = _a.onChange, placeholder = _a.placeholder, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired, id = _a.id;
|
|
7120
|
+
var label = _a.label, items = _a.items, displayProperty = _a.displayProperty, keyProperty = _a.keyProperty, onChange = _a.onChange, placeholder = _a.placeholder, isDisabled = _a.isDisabled, isError = _a.isError, isRequired = _a.isRequired, id = _a.id;
|
|
7121
7121
|
var _b = React.useState(''), query = _b[0], setQuery = _b[1];
|
|
7122
7122
|
var _c = React.useState(), selectedItem = _c[0], setSelectedItem = _c[1];
|
|
7123
7123
|
React.useEffect(function () {
|
|
@@ -7126,7 +7126,7 @@ var Combobox = function (_a) {
|
|
|
7126
7126
|
var filteredItems = query === ''
|
|
7127
7127
|
? items
|
|
7128
7128
|
: items.filter(function (item) {
|
|
7129
|
-
return item.
|
|
7129
|
+
return "".concat(item[displayProperty]).toLowerCase().includes(query.toLowerCase());
|
|
7130
7130
|
});
|
|
7131
7131
|
var inputStyles = cn$1('w-full rounded-md border bg-white py-2 pl-3 pr-10 shadow-sm sm:text-sm', 'focus:border-purple-500 focus:outline-none focus:ring-1 focus:ring-purple-500', { 'border-red-500': isError }, { 'border-gray-300': !isError });
|
|
7132
7132
|
var labelStyles = cn$1('block text-sm font-medium text-gray-700');
|
|
@@ -7136,16 +7136,16 @@ var Combobox = function (_a) {
|
|
|
7136
7136
|
label && (React__default["default"].createElement(Na.Label, { className: labelStyles },
|
|
7137
7137
|
React__default["default"].createElement(InputLabel, { isPlaceholder: true, isActive: true, label: label, isRequired: isRequired, id: id, isError: isError, isDisabled: isDisabled }))),
|
|
7138
7138
|
React__default["default"].createElement("div", { className: "relative" },
|
|
7139
|
-
React__default["default"].createElement(Na.Input, { className: inputStyles, onChange: function (event) { return setQuery(event.target.value); }, displayValue: function (item) { return item
|
|
7139
|
+
React__default["default"].createElement(Na.Input, { className: inputStyles, onChange: function (event) { return setQuery(event.target.value); }, displayValue: function (item) { return "".concat(item[displayProperty]); }, placeholder: placeholder }),
|
|
7140
7140
|
React__default["default"].createElement(Na.Button, { className: buttonStyles },
|
|
7141
7141
|
React__default["default"].createElement(DynamicIcons, { icon: "SelectorIcon", className: "h-5 w-5 text-gray-400", "aria-hidden": "true" })),
|
|
7142
|
-
filteredItems.length > 0 && (React__default["default"].createElement(Na.Options, { className: optionStyles }, filteredItems.map(function (item, index) { return (React__default["default"].createElement(Na.Option, { key: index, value: item, className: function (_a) {
|
|
7142
|
+
filteredItems.length > 0 && (React__default["default"].createElement(Na.Options, { className: optionStyles }, filteredItems.map(function (item, index) { return (React__default["default"].createElement(Na.Option, { key: "".concat(item[keyProperty], "-").concat(index), value: item, className: function (_a) {
|
|
7143
7143
|
var active = _a.active;
|
|
7144
7144
|
return classNames('relative cursor-default select-none py-2 pl-3 pr-9', active ? 'bg-purple-600 text-white' : 'text-gray-900');
|
|
7145
7145
|
} }, function (_a) {
|
|
7146
7146
|
var active = _a.active, selected = _a.selected;
|
|
7147
7147
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
7148
|
-
React__default["default"].createElement("span", { className: classNames('block truncate', selected ? 'font-semibold' : '') }, item
|
|
7148
|
+
React__default["default"].createElement("span", { className: classNames('block truncate', selected ? 'font-semibold' : '') }, "".concat(item[displayProperty])),
|
|
7149
7149
|
selected && (React__default["default"].createElement("span", { className: classNames('absolute inset-y-0 right-0 flex items-center pr-4', active ? 'text-white' : 'text-purple-600') },
|
|
7150
7150
|
React__default["default"].createElement(DynamicIcons, { icon: "CheckIcon", className: "h-5 w-5", "aria-hidden": "true" })))));
|
|
7151
7151
|
})); }))))));
|
package/package.json
CHANGED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<title>Code coverage report for Forms/TextInputSelect/InputSelect/InputSelect.tsx</title>
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<link rel="stylesheet" href="../../../prettify.css" />
|
|
7
|
-
<link rel="stylesheet" href="../../../base.css" />
|
|
8
|
-
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.png" />
|
|
9
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10
|
-
<style type="text/css">
|
|
11
|
-
.coverage-summary .sorter {
|
|
12
|
-
background-image: url(../../../sort-arrow-sprite.png);
|
|
13
|
-
}
|
|
14
|
-
</style>
|
|
15
|
-
</head>
|
|
16
|
-
|
|
17
|
-
<body>
|
|
18
|
-
<div class="wrapper">
|
|
19
|
-
<div class="pad1">
|
|
20
|
-
<h1>
|
|
21
|
-
<a href="../../../index.html">All files</a> /
|
|
22
|
-
<a href="index.html">Forms/TextInputSelect/InputSelect</a> InputSelect.tsx
|
|
23
|
-
</h1>
|
|
24
|
-
<div class="clearfix">
|
|
25
|
-
<div class="fl pad1y space-right2">
|
|
26
|
-
<span class="strong">95% </span>
|
|
27
|
-
<span class="quiet">Statements</span>
|
|
28
|
-
<span class="fraction">19/20</span>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<div class="fl pad1y space-right2">
|
|
32
|
-
<span class="strong">66.66% </span>
|
|
33
|
-
<span class="quiet">Branches</span>
|
|
34
|
-
<span class="fraction">6/9</span>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
<div class="fl pad1y space-right2">
|
|
38
|
-
<span class="strong">100% </span>
|
|
39
|
-
<span class="quiet">Functions</span>
|
|
40
|
-
<span class="fraction">3/3</span>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div class="fl pad1y space-right2">
|
|
44
|
-
<span class="strong">100% </span>
|
|
45
|
-
<span class="quiet">Lines</span>
|
|
46
|
-
<span class="fraction">12/12</span>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
<p class="quiet">
|
|
50
|
-
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>,
|
|
51
|
-
<em>p</em> or <em>k</em> for the previous block.
|
|
52
|
-
</p>
|
|
53
|
-
<template id="filterTemplate">
|
|
54
|
-
<div class="quiet">
|
|
55
|
-
Filter:
|
|
56
|
-
<input oninput="onInput()" type="search" id="fileSearch" />
|
|
57
|
-
</div>
|
|
58
|
-
</template>
|
|
59
|
-
</div>
|
|
60
|
-
<div class="status-line high"></div>
|
|
61
|
-
<pre><table class="coverage">
|
|
62
|
-
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
63
|
-
<a name='L2'></a><a href='#L2'>2</a>
|
|
64
|
-
<a name='L3'></a><a href='#L3'>3</a>
|
|
65
|
-
<a name='L4'></a><a href='#L4'>4</a>
|
|
66
|
-
<a name='L5'></a><a href='#L5'>5</a>
|
|
67
|
-
<a name='L6'></a><a href='#L6'>6</a>
|
|
68
|
-
<a name='L7'></a><a href='#L7'>7</a>
|
|
69
|
-
<a name='L8'></a><a href='#L8'>8</a>
|
|
70
|
-
<a name='L9'></a><a href='#L9'>9</a>
|
|
71
|
-
<a name='L10'></a><a href='#L10'>10</a>
|
|
72
|
-
<a name='L11'></a><a href='#L11'>11</a>
|
|
73
|
-
<a name='L12'></a><a href='#L12'>12</a>
|
|
74
|
-
<a name='L13'></a><a href='#L13'>13</a>
|
|
75
|
-
<a name='L14'></a><a href='#L14'>14</a>
|
|
76
|
-
<a name='L15'></a><a href='#L15'>15</a>
|
|
77
|
-
<a name='L16'></a><a href='#L16'>16</a>
|
|
78
|
-
<a name='L17'></a><a href='#L17'>17</a>
|
|
79
|
-
<a name='L18'></a><a href='#L18'>18</a>
|
|
80
|
-
<a name='L19'></a><a href='#L19'>19</a>
|
|
81
|
-
<a name='L20'></a><a href='#L20'>20</a>
|
|
82
|
-
<a name='L21'></a><a href='#L21'>21</a>
|
|
83
|
-
<a name='L22'></a><a href='#L22'>22</a>
|
|
84
|
-
<a name='L23'></a><a href='#L23'>23</a>
|
|
85
|
-
<a name='L24'></a><a href='#L24'>24</a>
|
|
86
|
-
<a name='L25'></a><a href='#L25'>25</a>
|
|
87
|
-
<a name='L26'></a><a href='#L26'>26</a>
|
|
88
|
-
<a name='L27'></a><a href='#L27'>27</a>
|
|
89
|
-
<a name='L28'></a><a href='#L28'>28</a>
|
|
90
|
-
<a name='L29'></a><a href='#L29'>29</a>
|
|
91
|
-
<a name='L30'></a><a href='#L30'>30</a>
|
|
92
|
-
<a name='L31'></a><a href='#L31'>31</a>
|
|
93
|
-
<a name='L32'></a><a href='#L32'>32</a>
|
|
94
|
-
<a name='L33'></a><a href='#L33'>33</a>
|
|
95
|
-
<a name='L34'></a><a href='#L34'>34</a>
|
|
96
|
-
<a name='L35'></a><a href='#L35'>35</a>
|
|
97
|
-
<a name='L36'></a><a href='#L36'>36</a>
|
|
98
|
-
<a name='L37'></a><a href='#L37'>37</a>
|
|
99
|
-
<a name='L38'></a><a href='#L38'>38</a>
|
|
100
|
-
<a name='L39'></a><a href='#L39'>39</a>
|
|
101
|
-
<a name='L40'></a><a href='#L40'>40</a>
|
|
102
|
-
<a name='L41'></a><a href='#L41'>41</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
103
|
-
<span class="cline-any cline-yes">1x</span>
|
|
104
|
-
<span class="cline-any cline-neutral"> </span>
|
|
105
|
-
<span class="cline-any cline-neutral"> </span>
|
|
106
|
-
<span class="cline-any cline-neutral"> </span>
|
|
107
|
-
<span class="cline-any cline-neutral"> </span>
|
|
108
|
-
<span class="cline-any cline-neutral"> </span>
|
|
109
|
-
<span class="cline-any cline-neutral"> </span>
|
|
110
|
-
<span class="cline-any cline-neutral"> </span>
|
|
111
|
-
<span class="cline-any cline-neutral"> </span>
|
|
112
|
-
<span class="cline-any cline-neutral"> </span>
|
|
113
|
-
<span class="cline-any cline-neutral"> </span>
|
|
114
|
-
<span class="cline-any cline-neutral"> </span>
|
|
115
|
-
<span class="cline-any cline-yes">4x</span>
|
|
116
|
-
<span class="cline-any cline-yes">4x</span>
|
|
117
|
-
<span class="cline-any cline-yes">4x</span>
|
|
118
|
-
<span class="cline-any cline-yes">1x</span>
|
|
119
|
-
<span class="cline-any cline-yes">1x</span>
|
|
120
|
-
<span class="cline-any cline-yes">1x</span>
|
|
121
|
-
<span class="cline-any cline-neutral"> </span>
|
|
122
|
-
<span class="cline-any cline-yes">4x</span>
|
|
123
|
-
<span class="cline-any cline-neutral"> </span>
|
|
124
|
-
<span class="cline-any cline-neutral"> </span>
|
|
125
|
-
<span class="cline-any cline-neutral"> </span>
|
|
126
|
-
<span class="cline-any cline-neutral"> </span>
|
|
127
|
-
<span class="cline-any cline-neutral"> </span>
|
|
128
|
-
<span class="cline-any cline-neutral"> </span>
|
|
129
|
-
<span class="cline-any cline-neutral"> </span>
|
|
130
|
-
<span class="cline-any cline-neutral"> </span>
|
|
131
|
-
<span class="cline-any cline-yes">4x</span>
|
|
132
|
-
<span class="cline-any cline-yes">4x</span>
|
|
133
|
-
<span class="cline-any cline-neutral"> </span>
|
|
134
|
-
<span class="cline-any cline-yes">4x</span>
|
|
135
|
-
<span class="cline-any cline-neutral"> </span>
|
|
136
|
-
<span class="cline-any cline-neutral"> </span>
|
|
137
|
-
<span class="cline-any cline-neutral"> </span>
|
|
138
|
-
<span class="cline-any cline-neutral"> </span>
|
|
139
|
-
<span class="cline-any cline-neutral"> </span>
|
|
140
|
-
<span class="cline-any cline-neutral"> </span>
|
|
141
|
-
<span class="cline-any cline-neutral"> </span>
|
|
142
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { FC, useState } from 'react';
|
|
143
|
-
import { default as cn } from 'classnames';
|
|
144
|
-
import { SelectOptions } from '..';
|
|
145
|
-
|
|
146
|
-
export interface InputSelectProps {
|
|
147
|
-
align: 'left' | 'right';
|
|
148
|
-
/** Show the CTA without Background color and a border seperator */
|
|
149
|
-
inputOptions: SelectOptions[];
|
|
150
|
-
/** Onclick callback */
|
|
151
|
-
onSelectOption?(value: string): void;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/** Comment */
|
|
155
|
-
export const InputSelect: FC<InputSelectProps> = ({ inputOptions, onSelectOption, align = <span class="branch-0 cbranch-no" title="branch not covered" >'right' </span>}: InputSelectProps): JSX.Element | null => {
|
|
156
|
-
const [selectedOption, setSelectedOption] = useState<string>(inputOptions[0].value);
|
|
157
|
-
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
|
158
|
-
const targetValue = e.target.value;
|
|
159
|
-
onSelectOption && onSelectOption(targetValue);
|
|
160
|
-
setSelectedOption(targetValue);
|
|
161
|
-
};
|
|
162
|
-
const selectStyle = cn(
|
|
163
|
-
'relative z-10 inline-flex items-center space-x-2 bg-white px-4 py-2 pr-7 border border-gray-300 text-sm font-medium focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500',
|
|
164
|
-
{ 'rounded-r-md text-gray-700 -ml-px': align === 'right' },
|
|
165
|
-
{ 'rounded-l-md text-gray-500 -mr-px focus-within:z-10': align === 'left' },
|
|
166
|
-
{ 'cursor-default': !onSelectOption },
|
|
167
|
-
{ 'border-l-white': align === 'right' },
|
|
168
|
-
{ 'border-r-white': align === 'left' }
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
<span class="missing-if-branch" title="if path not taken" >I</span>if (!inputOptions<span class="branch-0 cbranch-no" title="branch not covered" >?.l</span>ength) <span class="cstat-no" title="statement not covered" >return null;</span>
|
|
172
|
-
return (
|
|
173
|
-
<select className={selectStyle} onChange={handleChange} value={selectedOption}>
|
|
174
|
-
{inputOptions.map((option) => (
|
|
175
|
-
<option key={option.value} value={option.value}>
|
|
176
|
-
{option.label}
|
|
177
|
-
</option>
|
|
178
|
-
))}
|
|
179
|
-
</select>
|
|
180
|
-
);
|
|
181
|
-
};
|
|
182
|
-
</pre></td></tr></table></pre>
|
|
183
|
-
|
|
184
|
-
<div class="push"></div>
|
|
185
|
-
<!-- for sticky footer -->
|
|
186
|
-
</div>
|
|
187
|
-
<!-- /wrapper -->
|
|
188
|
-
<div class="footer quiet pad2 space-top1 center small">
|
|
189
|
-
Code coverage generated by
|
|
190
|
-
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer"
|
|
191
|
-
>istanbul</a
|
|
192
|
-
>
|
|
193
|
-
at Wed Feb 23 2022 16:23:07 GMT-0500 (Eastern Standard Time)
|
|
194
|
-
</div>
|
|
195
|
-
<script src="../../../prettify.js"></script>
|
|
196
|
-
<script>
|
|
197
|
-
window.onload = function () {
|
|
198
|
-
prettyPrint();
|
|
199
|
-
};
|
|
200
|
-
</script>
|
|
201
|
-
<script src="../../../sorter.js"></script>
|
|
202
|
-
<script src="../../../block-navigation.js"></script>
|
|
203
|
-
</body>
|
|
204
|
-
</html>
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<title>Code coverage report for Forms/TextInputSelect/InputSelect</title>
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<link rel="stylesheet" href="../../../prettify.css" />
|
|
7
|
-
<link rel="stylesheet" href="../../../base.css" />
|
|
8
|
-
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.png" />
|
|
9
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10
|
-
<style type="text/css">
|
|
11
|
-
.coverage-summary .sorter {
|
|
12
|
-
background-image: url(../../../sort-arrow-sprite.png);
|
|
13
|
-
}
|
|
14
|
-
</style>
|
|
15
|
-
</head>
|
|
16
|
-
|
|
17
|
-
<body>
|
|
18
|
-
<div class="wrapper">
|
|
19
|
-
<div class="pad1">
|
|
20
|
-
<h1>
|
|
21
|
-
<a href="../../../index.html">All files</a> Forms/TextInputSelect/InputSelect
|
|
22
|
-
</h1>
|
|
23
|
-
<div class="clearfix">
|
|
24
|
-
<div class="fl pad1y space-right2">
|
|
25
|
-
<span class="strong">95% </span>
|
|
26
|
-
<span class="quiet">Statements</span>
|
|
27
|
-
<span class="fraction">19/20</span>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<div class="fl pad1y space-right2">
|
|
31
|
-
<span class="strong">66.66% </span>
|
|
32
|
-
<span class="quiet">Branches</span>
|
|
33
|
-
<span class="fraction">6/9</span>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<div class="fl pad1y space-right2">
|
|
37
|
-
<span class="strong">100% </span>
|
|
38
|
-
<span class="quiet">Functions</span>
|
|
39
|
-
<span class="fraction">3/3</span>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div class="fl pad1y space-right2">
|
|
43
|
-
<span class="strong">100% </span>
|
|
44
|
-
<span class="quiet">Lines</span>
|
|
45
|
-
<span class="fraction">12/12</span>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
<p class="quiet">
|
|
49
|
-
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>,
|
|
50
|
-
<em>p</em> or <em>k</em> for the previous block.
|
|
51
|
-
</p>
|
|
52
|
-
<template id="filterTemplate">
|
|
53
|
-
<div class="quiet">
|
|
54
|
-
Filter:
|
|
55
|
-
<input oninput="onInput()" type="search" id="fileSearch" />
|
|
56
|
-
</div>
|
|
57
|
-
</template>
|
|
58
|
-
</div>
|
|
59
|
-
<div class="status-line high"></div>
|
|
60
|
-
<div class="pad1">
|
|
61
|
-
<table class="coverage-summary">
|
|
62
|
-
<thead>
|
|
63
|
-
<tr>
|
|
64
|
-
<th data-col="file" data-fmt="html" data-html="true" class="file">
|
|
65
|
-
File
|
|
66
|
-
</th>
|
|
67
|
-
<th
|
|
68
|
-
data-col="pic"
|
|
69
|
-
data-type="number"
|
|
70
|
-
data-fmt="html"
|
|
71
|
-
data-html="true"
|
|
72
|
-
class="pic"
|
|
73
|
-
></th>
|
|
74
|
-
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">
|
|
75
|
-
Statements
|
|
76
|
-
</th>
|
|
77
|
-
<th
|
|
78
|
-
data-col="statements_raw"
|
|
79
|
-
data-type="number"
|
|
80
|
-
data-fmt="html"
|
|
81
|
-
class="abs"
|
|
82
|
-
></th>
|
|
83
|
-
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">
|
|
84
|
-
Branches
|
|
85
|
-
</th>
|
|
86
|
-
<th
|
|
87
|
-
data-col="branches_raw"
|
|
88
|
-
data-type="number"
|
|
89
|
-
data-fmt="html"
|
|
90
|
-
class="abs"
|
|
91
|
-
></th>
|
|
92
|
-
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">
|
|
93
|
-
Functions
|
|
94
|
-
</th>
|
|
95
|
-
<th
|
|
96
|
-
data-col="functions_raw"
|
|
97
|
-
data-type="number"
|
|
98
|
-
data-fmt="html"
|
|
99
|
-
class="abs"
|
|
100
|
-
></th>
|
|
101
|
-
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">
|
|
102
|
-
Lines
|
|
103
|
-
</th>
|
|
104
|
-
<th
|
|
105
|
-
data-col="lines_raw"
|
|
106
|
-
data-type="number"
|
|
107
|
-
data-fmt="html"
|
|
108
|
-
class="abs"
|
|
109
|
-
></th>
|
|
110
|
-
</tr>
|
|
111
|
-
</thead>
|
|
112
|
-
<tbody>
|
|
113
|
-
<tr>
|
|
114
|
-
<td class="file high" data-value="InputSelect.tsx">
|
|
115
|
-
<a href="InputSelect.tsx.html">InputSelect.tsx</a>
|
|
116
|
-
</td>
|
|
117
|
-
<td data-value="95" class="pic high">
|
|
118
|
-
<div class="chart">
|
|
119
|
-
<div class="cover-fill" style="width: 95%"></div>
|
|
120
|
-
<div class="cover-empty" style="width: 5%"></div>
|
|
121
|
-
</div>
|
|
122
|
-
</td>
|
|
123
|
-
<td data-value="95" class="pct high">95%</td>
|
|
124
|
-
<td data-value="20" class="abs high">19/20</td>
|
|
125
|
-
<td data-value="66.66" class="pct medium">66.66%</td>
|
|
126
|
-
<td data-value="9" class="abs medium">6/9</td>
|
|
127
|
-
<td data-value="100" class="pct high">100%</td>
|
|
128
|
-
<td data-value="3" class="abs high">3/3</td>
|
|
129
|
-
<td data-value="100" class="pct high">100%</td>
|
|
130
|
-
<td data-value="12" class="abs high">12/12</td>
|
|
131
|
-
</tr>
|
|
132
|
-
</tbody>
|
|
133
|
-
</table>
|
|
134
|
-
</div>
|
|
135
|
-
<div class="push"></div>
|
|
136
|
-
<!-- for sticky footer -->
|
|
137
|
-
</div>
|
|
138
|
-
<!-- /wrapper -->
|
|
139
|
-
<div class="footer quiet pad2 space-top1 center small">
|
|
140
|
-
Code coverage generated by
|
|
141
|
-
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer"
|
|
142
|
-
>istanbul</a
|
|
143
|
-
>
|
|
144
|
-
at Wed Feb 23 2022 16:23:07 GMT-0500 (Eastern Standard Time)
|
|
145
|
-
</div>
|
|
146
|
-
<script src="../../../prettify.js"></script>
|
|
147
|
-
<script>
|
|
148
|
-
window.onload = function () {
|
|
149
|
-
prettyPrint();
|
|
150
|
-
};
|
|
151
|
-
</script>
|
|
152
|
-
<script src="../../../sorter.js"></script>
|
|
153
|
-
<script src="../../../block-navigation.js"></script>
|
|
154
|
-
</body>
|
|
155
|
-
</html>
|