@elliemae/ds-pills 2.4.2 → 2.4.3-rc.10
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/cjs/components/styled.js +6 -4
- package/cjs/components/types/InputPill.js +6 -3
- package/cjs/props.js +5 -1
- package/esm/components/styled.js +6 -4
- package/esm/components/types/InputPill.js +6 -3
- package/esm/props.js +5 -1
- package/package.json +15 -15
- package/types/components/styled.d.ts +7 -4
- package/types/props.d.ts +10 -0
package/cjs/components/styled.js
CHANGED
|
@@ -13,9 +13,10 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
13
13
|
var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
|
|
14
14
|
|
|
15
15
|
/* eslint-disable max-lines */
|
|
16
|
+
|
|
17
|
+
// =============================================================================
|
|
16
18
|
// Common CSS
|
|
17
19
|
// =============================================================================
|
|
18
|
-
|
|
19
20
|
const borderOutside = function (color) {
|
|
20
21
|
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
21
22
|
let zIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
|
|
@@ -103,10 +104,11 @@ const StyledInputPillWrapper = /*#__PURE__*/styled__default["default"](Grid__def
|
|
|
103
104
|
componentId: "sc-j0tlch-2"
|
|
104
105
|
})(["", " background:", ";padding:0;", ":focus-within{", "}:active{", "}& .em-ds-input{outline:none !important;border:none !important;box-shadow:none !important;border-radius:0 !important;height:100%;background:transparent;width:", ";padding:0;margin:0 0 0 8px;}& .em-ds-input__tooltip-ref{height:100%;}"], commonPillWrapperCss, props => props.theme.colors.neutral['000'], _ref6 => {
|
|
105
106
|
let {
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
theme,
|
|
108
|
+
hasError
|
|
108
109
|
} = _ref6;
|
|
109
|
-
return borderOutside(
|
|
110
|
+
if (hasError) return borderOutside(theme.colors.danger[900]);
|
|
111
|
+
return borderOutside(theme.colors.brand[500]);
|
|
110
112
|
}, props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[700], 2) : '', props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[500]) : '', props => `${props.inputWidth + (props.value === '' ? 24 : 0)}px`);
|
|
111
113
|
const StyledDropdownPillWrapper = /*#__PURE__*/styled__default["default"](Grid__default["default"]).withConfig({
|
|
112
114
|
componentId: "sc-j0tlch-3"
|
|
@@ -24,11 +24,13 @@ const InputPill = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
24
24
|
inputRender,
|
|
25
25
|
onInputChange,
|
|
26
26
|
onInputClear,
|
|
27
|
-
innerRef
|
|
27
|
+
innerRef,
|
|
28
|
+
hasError,
|
|
29
|
+
inputId
|
|
28
30
|
} = _ref;
|
|
29
31
|
const ref = React.useRef(null);
|
|
30
32
|
const InputComponent = React.useMemo(() => inputRender, [inputRender]);
|
|
31
|
-
const pillUid = React.useMemo(() => `ds-pill-${uid.uid()}`, []);
|
|
33
|
+
const pillUid = React.useMemo(() => inputId ?? `ds-pill-${uid.uid()}`, []);
|
|
32
34
|
const onCloseIconClick = React.useCallback(e => {
|
|
33
35
|
if ([undefined, 'Enter', 'Space'].includes(e.code)) {
|
|
34
36
|
e.preventDefault();
|
|
@@ -44,7 +46,8 @@ const InputPill = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
44
46
|
cols: label === '' ? ['auto'] : ['auto', '24px'],
|
|
45
47
|
inputWidth: inputWidth,
|
|
46
48
|
value: label,
|
|
47
|
-
inputHasFocus: inputHasFocus
|
|
49
|
+
inputHasFocus: inputHasFocus,
|
|
50
|
+
hasError: hasError
|
|
48
51
|
}, void 0, /*#__PURE__*/_jsx__default["default"](InputComponent, {
|
|
49
52
|
id: pillUid,
|
|
50
53
|
className: "ds-pill-focus-point",
|
package/cjs/props.js
CHANGED
|
@@ -22,8 +22,11 @@ const DSPillV2PropTypes = {
|
|
|
22
22
|
onInputChange: reactDesc.PropTypes.func.description('Callback triggered when user provides input to the input pill').defaultValue(() => null),
|
|
23
23
|
onInputClear: reactDesc.PropTypes.func.description('Callback triggered when the user clears an input pill').defaultValue(() => null),
|
|
24
24
|
inputWidth: reactDesc.PropTypes.number.description('Width in pixels for the input tag in the input pill').defaultValue(150),
|
|
25
|
+
inputId: reactDesc.PropTypes.string.description('ID for the input pill').defaultValue(undefined),
|
|
25
26
|
dropdownProps: reactDesc.PropTypes.object.description('Properties that will be used for the dropdown-menu').defaultValue({}),
|
|
26
|
-
onDropdownClick: reactDesc.PropTypes.func.description('Callback when dropdown button is clicked or pressed').defaultValue(() => null)
|
|
27
|
+
onDropdownClick: reactDesc.PropTypes.func.description('Callback when dropdown button is clicked or pressed').defaultValue(() => null),
|
|
28
|
+
disabled: reactDesc.PropTypes.bool.description('Whether the pill should be disabled. Only for value and removable pill').defaultValue(false),
|
|
29
|
+
hasError: reactDesc.PropTypes.bool.description('Whether the pill should be in an error state. Only for input pill').defaultValue(false)
|
|
27
30
|
};
|
|
28
31
|
const DSPillButtonPropTypes = {
|
|
29
32
|
type: reactDesc.PropTypes.oneOf(['only', 'left', 'right']).description('The position in which this button will be placed. Only used for css styling internally').defaultValue('right'),
|
|
@@ -37,6 +40,7 @@ const DSPillGroupPropTypes = {
|
|
|
37
40
|
const DSPillV2DefaultProps = {
|
|
38
41
|
innerRef: () => null,
|
|
39
42
|
disabled: false,
|
|
43
|
+
hasError: false,
|
|
40
44
|
ariaLabel: '',
|
|
41
45
|
size: 'm',
|
|
42
46
|
labelTruncated: true,
|
package/esm/components/styled.js
CHANGED
|
@@ -4,9 +4,10 @@ import Grid from '@elliemae/ds-grid';
|
|
|
4
4
|
import { DSButtonV2 } from '@elliemae/ds-button';
|
|
5
5
|
|
|
6
6
|
/* eslint-disable max-lines */
|
|
7
|
+
|
|
8
|
+
// =============================================================================
|
|
7
9
|
// Common CSS
|
|
8
10
|
// =============================================================================
|
|
9
|
-
|
|
10
11
|
const borderOutside = function (color) {
|
|
11
12
|
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
12
13
|
let zIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
|
|
@@ -94,10 +95,11 @@ const StyledInputPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
94
95
|
componentId: "sc-j0tlch-2"
|
|
95
96
|
})(["", " background:", ";padding:0;", ":focus-within{", "}:active{", "}& .em-ds-input{outline:none !important;border:none !important;box-shadow:none !important;border-radius:0 !important;height:100%;background:transparent;width:", ";padding:0;margin:0 0 0 8px;}& .em-ds-input__tooltip-ref{height:100%;}"], commonPillWrapperCss, props => props.theme.colors.neutral['000'], _ref6 => {
|
|
96
97
|
let {
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
theme,
|
|
99
|
+
hasError
|
|
99
100
|
} = _ref6;
|
|
100
|
-
return borderOutside(
|
|
101
|
+
if (hasError) return borderOutside(theme.colors.danger[900]);
|
|
102
|
+
return borderOutside(theme.colors.brand[500]);
|
|
101
103
|
}, props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[700], 2) : '', props => props.inputHasFocus ? borderOutside(props.theme.colors.brand[500]) : '', props => `${props.inputWidth + (props.value === '' ? 24 : 0)}px`);
|
|
102
104
|
const StyledDropdownPillWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
103
105
|
componentId: "sc-j0tlch-3"
|
|
@@ -15,11 +15,13 @@ const InputPill = /*#__PURE__*/React.memo(_ref => {
|
|
|
15
15
|
inputRender,
|
|
16
16
|
onInputChange,
|
|
17
17
|
onInputClear,
|
|
18
|
-
innerRef
|
|
18
|
+
innerRef,
|
|
19
|
+
hasError,
|
|
20
|
+
inputId
|
|
19
21
|
} = _ref;
|
|
20
22
|
const ref = useRef(null);
|
|
21
23
|
const InputComponent = useMemo(() => inputRender, [inputRender]);
|
|
22
|
-
const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
|
|
24
|
+
const pillUid = useMemo(() => inputId ?? `ds-pill-${uid()}`, []);
|
|
23
25
|
const onCloseIconClick = useCallback(e => {
|
|
24
26
|
if ([undefined, 'Enter', 'Space'].includes(e.code)) {
|
|
25
27
|
e.preventDefault();
|
|
@@ -35,7 +37,8 @@ const InputPill = /*#__PURE__*/React.memo(_ref => {
|
|
|
35
37
|
cols: label === '' ? ['auto'] : ['auto', '24px'],
|
|
36
38
|
inputWidth: inputWidth,
|
|
37
39
|
value: label,
|
|
38
|
-
inputHasFocus: inputHasFocus
|
|
40
|
+
inputHasFocus: inputHasFocus,
|
|
41
|
+
hasError: hasError
|
|
39
42
|
}, void 0, /*#__PURE__*/_jsx(InputComponent, {
|
|
40
43
|
id: pillUid,
|
|
41
44
|
className: "ds-pill-focus-point",
|
package/esm/props.js
CHANGED
|
@@ -18,8 +18,11 @@ const DSPillV2PropTypes = {
|
|
|
18
18
|
onInputChange: PropTypes.func.description('Callback triggered when user provides input to the input pill').defaultValue(() => null),
|
|
19
19
|
onInputClear: PropTypes.func.description('Callback triggered when the user clears an input pill').defaultValue(() => null),
|
|
20
20
|
inputWidth: PropTypes.number.description('Width in pixels for the input tag in the input pill').defaultValue(150),
|
|
21
|
+
inputId: PropTypes.string.description('ID for the input pill').defaultValue(undefined),
|
|
21
22
|
dropdownProps: PropTypes.object.description('Properties that will be used for the dropdown-menu').defaultValue({}),
|
|
22
|
-
onDropdownClick: PropTypes.func.description('Callback when dropdown button is clicked or pressed').defaultValue(() => null)
|
|
23
|
+
onDropdownClick: PropTypes.func.description('Callback when dropdown button is clicked or pressed').defaultValue(() => null),
|
|
24
|
+
disabled: PropTypes.bool.description('Whether the pill should be disabled. Only for value and removable pill').defaultValue(false),
|
|
25
|
+
hasError: PropTypes.bool.description('Whether the pill should be in an error state. Only for input pill').defaultValue(false)
|
|
23
26
|
};
|
|
24
27
|
const DSPillButtonPropTypes = {
|
|
25
28
|
type: PropTypes.oneOf(['only', 'left', 'right']).description('The position in which this button will be placed. Only used for css styling internally').defaultValue('right'),
|
|
@@ -33,6 +36,7 @@ const DSPillGroupPropTypes = {
|
|
|
33
36
|
const DSPillV2DefaultProps = {
|
|
34
37
|
innerRef: () => null,
|
|
35
38
|
disabled: false,
|
|
39
|
+
hasError: false,
|
|
36
40
|
ariaLabel: '',
|
|
37
41
|
size: 'm',
|
|
38
42
|
labelTruncated: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-pills",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3-rc.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Pills",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -144,20 +144,20 @@
|
|
|
144
144
|
"build": "node ../../scripts/build/build.js"
|
|
145
145
|
},
|
|
146
146
|
"dependencies": {
|
|
147
|
-
"@elliemae/ds-button": "2.4.
|
|
148
|
-
"@elliemae/ds-classnames": "2.4.
|
|
149
|
-
"@elliemae/ds-dropdownmenu": "2.4.
|
|
150
|
-
"@elliemae/ds-form": "2.4.
|
|
151
|
-
"@elliemae/ds-grid": "2.4.
|
|
152
|
-
"@elliemae/ds-icons": "2.4.
|
|
153
|
-
"@elliemae/ds-modal": "2.4.
|
|
154
|
-
"@elliemae/ds-popover": "2.4.
|
|
155
|
-
"@elliemae/ds-props-helpers": "2.4.
|
|
156
|
-
"@elliemae/ds-shared": "2.4.
|
|
157
|
-
"@elliemae/ds-system": "2.4.
|
|
158
|
-
"@elliemae/ds-tooltip": "2.4.
|
|
159
|
-
"@elliemae/ds-truncated-tooltip-text": "2.4.
|
|
160
|
-
"@elliemae/ds-utilities": "2.4.
|
|
147
|
+
"@elliemae/ds-button": "2.4.3-rc.10",
|
|
148
|
+
"@elliemae/ds-classnames": "2.4.3-rc.10",
|
|
149
|
+
"@elliemae/ds-dropdownmenu": "2.4.3-rc.10",
|
|
150
|
+
"@elliemae/ds-form": "2.4.3-rc.10",
|
|
151
|
+
"@elliemae/ds-grid": "2.4.3-rc.10",
|
|
152
|
+
"@elliemae/ds-icons": "2.4.3-rc.10",
|
|
153
|
+
"@elliemae/ds-modal": "2.4.3-rc.10",
|
|
154
|
+
"@elliemae/ds-popover": "2.4.3-rc.10",
|
|
155
|
+
"@elliemae/ds-props-helpers": "2.4.3-rc.10",
|
|
156
|
+
"@elliemae/ds-shared": "2.4.3-rc.10",
|
|
157
|
+
"@elliemae/ds-system": "2.4.3-rc.10",
|
|
158
|
+
"@elliemae/ds-tooltip": "2.4.3-rc.10",
|
|
159
|
+
"@elliemae/ds-truncated-tooltip-text": "2.4.3-rc.10",
|
|
160
|
+
"@elliemae/ds-utilities": "2.4.3-rc.10",
|
|
161
161
|
"prop-types": "~15.7.2",
|
|
162
162
|
"react-desc": "~4.1.3",
|
|
163
163
|
"uid": "~2.0.0"
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
export declare const StyledValuePillWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/react-desc-prop-types").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
-
export declare const StyledInputPillWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/react-desc-prop-types").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {
|
|
2
|
+
interface InputPillWrapperProps {
|
|
5
3
|
value: string;
|
|
6
4
|
inputWidth: number;
|
|
7
5
|
inputHasFocus: boolean;
|
|
8
|
-
|
|
6
|
+
hasError: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const StyledLabelPillWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/react-desc-prop-types").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
+
export declare const StyledValuePillWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/react-desc-prop-types").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
+
export declare const StyledInputPillWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/react-desc-prop-types").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, InputPillWrapperProps, never>;
|
|
9
11
|
export declare const StyledDropdownPillWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/react-desc-prop-types").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
|
|
10
12
|
export declare const StyledReadonlyPillWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid/types/react-desc-prop-types").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {
|
|
11
13
|
hasIconRight: boolean;
|
|
@@ -18,3 +20,4 @@ export declare const StyledPillButton: import("styled-components").StyledCompone
|
|
|
18
20
|
width: string;
|
|
19
21
|
height: string;
|
|
20
22
|
}, never>;
|
|
23
|
+
export {};
|
package/types/props.d.ts
CHANGED
|
@@ -38,12 +38,21 @@ export declare const DSPillV2PropTypes: {
|
|
|
38
38
|
inputWidth: {
|
|
39
39
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
40
40
|
};
|
|
41
|
+
inputId: {
|
|
42
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
43
|
+
};
|
|
41
44
|
dropdownProps: {
|
|
42
45
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
43
46
|
};
|
|
44
47
|
onDropdownClick: {
|
|
45
48
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
46
49
|
};
|
|
50
|
+
disabled: {
|
|
51
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
52
|
+
};
|
|
53
|
+
hasError: {
|
|
54
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
55
|
+
};
|
|
47
56
|
};
|
|
48
57
|
export declare const DSPillButtonPropTypes: {
|
|
49
58
|
type: {
|
|
@@ -67,6 +76,7 @@ export declare const DSPillGroupPropTypes: {
|
|
|
67
76
|
export declare const DSPillV2DefaultProps: {
|
|
68
77
|
innerRef: () => null;
|
|
69
78
|
disabled: boolean;
|
|
79
|
+
hasError: boolean;
|
|
70
80
|
ariaLabel: string;
|
|
71
81
|
size: string;
|
|
72
82
|
labelTruncated: boolean;
|