@elliemae/ds-chip 3.3.0-next.2 → 3.3.0-next.5
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/dist/cjs/DSChip.js +6 -30
- package/dist/cjs/DSChip.js.map +1 -1
- package/dist/cjs/config/useConfig.js +1 -18
- package/dist/cjs/config/useConfig.js.map +1 -1
- package/dist/cjs/react-desc-prop-types.js +4 -19
- package/dist/cjs/react-desc-prop-types.js.map +1 -1
- package/dist/esm/DSChip.js +6 -32
- package/dist/esm/DSChip.js.map +1 -1
- package/dist/esm/config/useConfig.js +1 -20
- package/dist/esm/config/useConfig.js.map +1 -1
- package/dist/esm/react-desc-prop-types.js +4 -21
- package/dist/esm/react-desc-prop-types.js.map +1 -1
- package/package.json +5 -5
package/dist/cjs/DSChip.js
CHANGED
|
@@ -3,34 +3,8 @@ var __create = Object.create;
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __objRest = (source, exclude) => {
|
|
23
|
-
var target = {};
|
|
24
|
-
for (var prop in source)
|
|
25
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
if (source != null && __getOwnPropSymbols)
|
|
28
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
-
target[prop] = source[prop];
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
};
|
|
34
8
|
var __export = (target, all) => {
|
|
35
9
|
for (var name in all)
|
|
36
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -62,7 +36,7 @@ var import_react_desc_prop_types = require("./react-desc-prop-types");
|
|
|
62
36
|
const EmptyComp = (props) => /* @__PURE__ */ import_react.default.createElement(import_styles.StyledChildrenWrapper, null, props.children);
|
|
63
37
|
const DSChip = (props) => {
|
|
64
38
|
const { size, shape, selected, innerRef, icon: Icon, globalAttrs, xStyledAttrs } = (0, import_useConfig.useConfig)(props);
|
|
65
|
-
const
|
|
39
|
+
const { shape: shapeGlobal, label, type, disabled, ...restGlobals } = globalAttrs;
|
|
66
40
|
const { setElement, isShowingEllipsis } = (0, import_ds_utilities.useIsShowingEllipsis)();
|
|
67
41
|
const ConditionalTooltip = (0, import_react.useMemo)(() => isShowingEllipsis ? import_ds_tooltip.DSTooltipV3 : EmptyComp, [isShowingEllipsis]);
|
|
68
42
|
const stopPropagation = (e) => {
|
|
@@ -75,13 +49,15 @@ const DSChip = (props) => {
|
|
|
75
49
|
text: label,
|
|
76
50
|
onMouseDown: stopPropagation,
|
|
77
51
|
onTouchStart: stopPropagation
|
|
78
|
-
}, /* @__PURE__ */ import_react.default.createElement(import_styles.StyledChip,
|
|
52
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_styles.StyledChip, {
|
|
79
53
|
"aria-disabled": disabled,
|
|
80
54
|
disabled,
|
|
81
55
|
ref: innerRef,
|
|
82
56
|
selected,
|
|
83
|
-
role: "button"
|
|
84
|
-
|
|
57
|
+
role: "button",
|
|
58
|
+
...restGlobals,
|
|
59
|
+
...xStyledAttrs
|
|
60
|
+
}, shape === import_constants.CHIP_SHAPES.ROUND ? /* @__PURE__ */ import_react.default.createElement(import_styles.StyledRoundShape, {
|
|
85
61
|
disabled,
|
|
86
62
|
size
|
|
87
63
|
}, /* @__PURE__ */ import_react.default.createElement(Icon, null)) : /* @__PURE__ */ import_react.default.createElement(Icon, null), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledChipLabel, null, /* @__PURE__ */ import_react.default.createElement(import_styles.StyledSpanWithEllipsis, {
|
package/dist/cjs/DSChip.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSChip.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useMemo } from 'react';\nimport { describe, useIsShowingEllipsis } from '@elliemae/ds-utilities';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { useConfig } from './config/useConfig';\nimport {\n StyledChip,\n StyledChipLabel,\n StyledChildrenWrapper,\n StyledWrapper,\n StyledRoundShape,\n StyledSpanWithEllipsis,\n} from './styles';\nimport { CHIP_SHAPES } from './constants';\nimport { DSChipT, DSChipPropTypes } from './react-desc-prop-types';\n\nconst EmptyComp: typeof DSTooltipV3 = (props) => <StyledChildrenWrapper>{props.children}</StyledChildrenWrapper>;\n\nconst DSChip: React.ComponentType<DSChipT.Props> = (props) => {\n const { size, shape, selected, innerRef, icon: Icon, globalAttrs, xStyledAttrs } = useConfig(props);\n\n const { shape: shapeGlobal, label, type, disabled, ...restGlobals } = globalAttrs;\n\n const { setElement, isShowingEllipsis } = useIsShowingEllipsis();\n\n const ConditionalTooltip = useMemo(() => (isShowingEllipsis ? DSTooltipV3 : EmptyComp), [isShowingEllipsis]);\n\n const stopPropagation = (e: React.MouseEvent) => {\n e.stopPropagation();\n };\n\n return (\n <StyledWrapper buttonShape={shape} buttonSize={size}>\n <ConditionalTooltip text={label} onMouseDown={stopPropagation} onTouchStart={stopPropagation}>\n <StyledChip\n aria-disabled={disabled}\n disabled={disabled}\n ref={innerRef}\n selected={selected}\n role=\"button\"\n {...restGlobals}\n {...xStyledAttrs}\n >\n {shape === CHIP_SHAPES.ROUND ? (\n <StyledRoundShape disabled={disabled} size={size}>\n <Icon />\n </StyledRoundShape>\n ) : (\n <Icon />\n )}\n <StyledChipLabel>\n <StyledSpanWithEllipsis ref={setElement}>{label}</StyledSpanWithEllipsis>\n </StyledChipLabel>\n </StyledChip>\n </ConditionalTooltip>\n </StyledWrapper>\n );\n};\n\nDSChip.propTypes = DSChipPropTypes;\nDSChip.displayName = 'DSChip';\nconst DSChipWithSchema = describe(DSChip);\nDSChipWithSchema.propTypes = DSChipPropTypes;\n\nexport { DSChip, DSChipWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA+B;AAC/B,0BAA+C;AAC/C,wBAA4B;AAC5B,uBAA0B;AAC1B,oBAOO;AACP,uBAA4B;AAC5B,mCAAyC;AAEzC,MAAM,YAAgC,CAAC,UAAU,mDAAC,2CAAuB,MAAM,QAAS;AAExF,MAAM,SAA6C,CAAC,UAAU;AAC5D,QAAM,EAAE,MAAM,OAAO,UAAU,UAAU,MAAM,MAAM,aAAa,iBAAiB,gCAAU,KAAK;AAElG,QAAM,EAAE,OAAO,aAAa,OAAO,MAAM,aAAa,gBAAgB;AAEtE,QAAM,EAAE,YAAY,sBAAsB,8CAAqB;AAE/D,QAAM,qBAAqB,0BAAQ,MAAO,oBAAoB,gCAAc,WAAY,CAAC,iBAAiB,CAAC;AAE3G,QAAM,kBAAkB,CAAC,MAAwB;AAC/C,MAAE,gBAAgB;AAAA,EACpB;AAEA,SACE,mDAAC;AAAA,IAAc,aAAa;AAAA,IAAO,YAAY;AAAA,KAC7C,mDAAC;AAAA,IAAmB,MAAM;AAAA,IAAO,aAAa;AAAA,IAAiB,cAAc;AAAA,KAC3E,mDAAC;AAAA,IACC,iBAAe;AAAA,IACf;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACA,MAAK;AAAA,IACJ,GAAG;AAAA,IACH,GAAG;AAAA,KAEH,UAAU,6BAAY,QACrB,mDAAC;AAAA,IAAiB;AAAA,IAAoB;AAAA,KACpC,mDAAC,UAAK,CACR,IAEA,mDAAC,UAAK,GAER,mDAAC,qCACC,mDAAC;AAAA,IAAuB,KAAK;AAAA,KAAa,KAAM,CAClD,CACF,CACF,CACF;AAEJ;AAEA,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,MAAM,mBAAmB,kCAAS,MAAM;AACxC,iBAAiB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -49,6 +32,6 @@ const useConfig = (props) => {
|
|
|
49
32
|
(0, import_ds_utilities.useValidateTypescriptPropTypes)(propsWithDefault, import_react_desc_prop_types.DSChipPropTypes);
|
|
50
33
|
const globalAttrs = (0, import_ds_utilities.useGetGlobalAttributes)(propsWithDefault);
|
|
51
34
|
const xStyledAttrs = (0, import_ds_utilities.useGetXstyledProps)(propsWithDefault);
|
|
52
|
-
return
|
|
35
|
+
return { ...propsWithDefault, globalAttrs, xStyledAttrs };
|
|
53
36
|
};
|
|
54
37
|
//# sourceMappingURL=useConfig.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useConfig.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import {\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useValidateTypescriptPropTypes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { DSChipT, defaultProps, DSChipPropTypes } from '../react-desc-prop-types';\n\nexport const useConfig = (props: DSChipT.Props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n\n useValidateTypescriptPropTypes(propsWithDefault, DSChipPropTypes);\n const globalAttrs = useGetGlobalAttributes(propsWithDefault);\n const xStyledAttrs = useGetXstyledProps(propsWithDefault);\n\n return { ...propsWithDefault, globalAttrs, xStyledAttrs };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAKO;AACP,mCAAuD;AAEhD,MAAM,YAAY,CAAC,UAAyB;AACjD,QAAM,mBAAmB,sDAA6B,OAAO,yCAAY;AAEzE,0DAA+B,kBAAkB,4CAAe;AAChE,QAAM,cAAc,gDAAuB,gBAAgB;AAC3D,QAAM,eAAe,4CAAmB,gBAAgB;AAExD,SAAO,EAAE,GAAG,kBAAkB,aAAa,aAAa;AAC1D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
8
|
var __export = (target, all) => {
|
|
26
9
|
for (var name in all)
|
|
27
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -49,7 +32,9 @@ const defaultProps = {
|
|
|
49
32
|
size: import_constants.CHIP_SIZES.L,
|
|
50
33
|
shape: import_constants.CHIP_SHAPES.DEFAULT
|
|
51
34
|
};
|
|
52
|
-
const DSChipPropTypes =
|
|
35
|
+
const DSChipPropTypes = {
|
|
36
|
+
...import_ds_utilities.globalAttributesPropTypes,
|
|
37
|
+
...import_ds_utilities.xstyledPropTypes,
|
|
53
38
|
icon: import_ds_utilities.PropTypes.func.isRequired.description("Chip Icon").defaultValue(() => {
|
|
54
39
|
}),
|
|
55
40
|
label: import_ds_utilities.PropTypes.string.isRequired.description("Chip Label").defaultValue(""),
|
|
@@ -57,5 +42,5 @@ const DSChipPropTypes = __spreadProps(__spreadValues(__spreadValues({}, import_d
|
|
|
57
42
|
shape: import_ds_utilities.PropTypes.oneOf(import_constants.ChipShapesValuesArray).description(import_constants.ChipShapesValuesString).defaultValue(import_constants.CHIP_SHAPES.DEFAULT),
|
|
58
43
|
size: import_ds_utilities.PropTypes.oneOf(import_constants.ChipSizesValuesArray).description(import_constants.ChipSizesValuesString).defaultValue(import_constants.CHIP_SIZES.L),
|
|
59
44
|
innerRef: import_ds_utilities.PropTypes.oneOfType([import_ds_utilities.PropTypes.object, import_ds_utilities.PropTypes.func]).description("Inner ref to button component.")
|
|
60
|
-
}
|
|
45
|
+
};
|
|
61
46
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { WeakValidationMap } from 'react';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes, XstyledProps } from '@elliemae/ds-utilities';\nimport {\n CHIP_SIZES,\n CHIP_SHAPES,\n ChipSizesValuesArray,\n ChipSizesValuesString,\n ChipShapesValuesArray,\n ChipShapesValuesString,\n} from './constants';\nimport type { ChipSizesT, ChipShapesT } from './sharedTypes';\n\nexport const defaultProps: DSChipT.DefaultProps = {\n size: CHIP_SIZES.L,\n shape: CHIP_SHAPES.DEFAULT,\n};\n\nexport declare namespace DSChipT {\n interface DefaultProps {\n size: ChipSizesT;\n shape: ChipShapesT;\n }\n interface OptionalProps {\n selected?: boolean;\n innerRef?: React.RefObject<HTMLButtonElement> | ((_ref: HTMLButtonElement) => void);\n }\n\n interface RequiredProps {\n label: string;\n icon: () => JSX.Element;\n }\n export interface Props extends OptionalProps, Partial<DefaultProps>, RequiredProps, XstyledProps {}\n}\n\nexport const DSChipPropTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n icon: PropTypes.func.isRequired.description('Chip Icon').defaultValue(() => {}),\n label: PropTypes.string.isRequired.description('Chip Label').defaultValue(''),\n selected: PropTypes.bool.description('Whether chip is selected').defaultValue(''),\n shape: PropTypes.oneOf(ChipShapesValuesArray).description(ChipShapesValuesString).defaultValue(CHIP_SHAPES.DEFAULT),\n size: PropTypes.oneOf(ChipSizesValuesArray).description(ChipSizesValuesString).defaultValue(CHIP_SIZES.L),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.'),\n} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAAqF;AACrF,uBAOO;AAGA,MAAM,eAAqC;AAAA,EAChD,MAAM,4BAAW;AAAA,EACjB,OAAO,6BAAY;AACrB;AAmBO,MAAM,kBAAkB;AAAA,EAC7B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,8BAAU,KAAK,WAAW,YAAY,WAAW,EAAE,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EAC9E,OAAO,8BAAU,OAAO,WAAW,YAAY,YAAY,EAAE,aAAa,EAAE;AAAA,EAC5E,UAAU,8BAAU,KAAK,YAAY,0BAA0B,EAAE,aAAa,EAAE;AAAA,EAChF,OAAO,8BAAU,MAAM,sCAAqB,EAAE,YAAY,uCAAsB,EAAE,aAAa,6BAAY,OAAO;AAAA,EAClH,MAAM,8BAAU,MAAM,qCAAoB,EAAE,YAAY,sCAAqB,EAAE,aAAa,4BAAW,CAAC;AAAA,EACxG,UAAU,8BAAU,UAAU,CAAC,8BAAU,QAAQ,8BAAU,IAAI,CAAC,EAAE,YAAY,gCAAgC;AAChH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/DSChip.js
CHANGED
|
@@ -1,32 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
|
-
var __objRest = (source, exclude) => {
|
|
19
|
-
var target = {};
|
|
20
|
-
for (var prop in source)
|
|
21
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
22
|
-
target[prop] = source[prop];
|
|
23
|
-
if (source != null && __getOwnPropSymbols)
|
|
24
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
25
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
}
|
|
28
|
-
return target;
|
|
29
|
-
};
|
|
30
2
|
import * as React from "react";
|
|
31
3
|
import React2, { useMemo } from "react";
|
|
32
4
|
import { describe, useIsShowingEllipsis } from "@elliemae/ds-utilities";
|
|
@@ -45,7 +17,7 @@ import { DSChipPropTypes } from "./react-desc-prop-types";
|
|
|
45
17
|
const EmptyComp = (props) => /* @__PURE__ */ React2.createElement(StyledChildrenWrapper, null, props.children);
|
|
46
18
|
const DSChip = (props) => {
|
|
47
19
|
const { size, shape, selected, innerRef, icon: Icon, globalAttrs, xStyledAttrs } = useConfig(props);
|
|
48
|
-
const
|
|
20
|
+
const { shape: shapeGlobal, label, type, disabled, ...restGlobals } = globalAttrs;
|
|
49
21
|
const { setElement, isShowingEllipsis } = useIsShowingEllipsis();
|
|
50
22
|
const ConditionalTooltip = useMemo(() => isShowingEllipsis ? DSTooltipV3 : EmptyComp, [isShowingEllipsis]);
|
|
51
23
|
const stopPropagation = (e) => {
|
|
@@ -58,13 +30,15 @@ const DSChip = (props) => {
|
|
|
58
30
|
text: label,
|
|
59
31
|
onMouseDown: stopPropagation,
|
|
60
32
|
onTouchStart: stopPropagation
|
|
61
|
-
}, /* @__PURE__ */ React2.createElement(StyledChip,
|
|
33
|
+
}, /* @__PURE__ */ React2.createElement(StyledChip, {
|
|
62
34
|
"aria-disabled": disabled,
|
|
63
35
|
disabled,
|
|
64
36
|
ref: innerRef,
|
|
65
37
|
selected,
|
|
66
|
-
role: "button"
|
|
67
|
-
|
|
38
|
+
role: "button",
|
|
39
|
+
...restGlobals,
|
|
40
|
+
...xStyledAttrs
|
|
41
|
+
}, shape === CHIP_SHAPES.ROUND ? /* @__PURE__ */ React2.createElement(StyledRoundShape, {
|
|
68
42
|
disabled,
|
|
69
43
|
size
|
|
70
44
|
}, /* @__PURE__ */ React2.createElement(Icon, null)) : /* @__PURE__ */ React2.createElement(Icon, null), /* @__PURE__ */ React2.createElement(StyledChipLabel, null, /* @__PURE__ */ React2.createElement(StyledSpanWithEllipsis, {
|
package/dist/esm/DSChip.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSChip.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport { describe, useIsShowingEllipsis } from '@elliemae/ds-utilities';\nimport { DSTooltipV3 } from '@elliemae/ds-tooltip';\nimport { useConfig } from './config/useConfig';\nimport {\n StyledChip,\n StyledChipLabel,\n StyledChildrenWrapper,\n StyledWrapper,\n StyledRoundShape,\n StyledSpanWithEllipsis,\n} from './styles';\nimport { CHIP_SHAPES } from './constants';\nimport { DSChipT, DSChipPropTypes } from './react-desc-prop-types';\n\nconst EmptyComp: typeof DSTooltipV3 = (props) => <StyledChildrenWrapper>{props.children}</StyledChildrenWrapper>;\n\nconst DSChip: React.ComponentType<DSChipT.Props> = (props) => {\n const { size, shape, selected, innerRef, icon: Icon, globalAttrs, xStyledAttrs } = useConfig(props);\n\n const { shape: shapeGlobal, label, type, disabled, ...restGlobals } = globalAttrs;\n\n const { setElement, isShowingEllipsis } = useIsShowingEllipsis();\n\n const ConditionalTooltip = useMemo(() => (isShowingEllipsis ? DSTooltipV3 : EmptyComp), [isShowingEllipsis]);\n\n const stopPropagation = (e: React.MouseEvent) => {\n e.stopPropagation();\n };\n\n return (\n <StyledWrapper buttonShape={shape} buttonSize={size}>\n <ConditionalTooltip text={label} onMouseDown={stopPropagation} onTouchStart={stopPropagation}>\n <StyledChip\n aria-disabled={disabled}\n disabled={disabled}\n ref={innerRef}\n selected={selected}\n role=\"button\"\n {...restGlobals}\n {...xStyledAttrs}\n >\n {shape === CHIP_SHAPES.ROUND ? (\n <StyledRoundShape disabled={disabled} size={size}>\n <Icon />\n </StyledRoundShape>\n ) : (\n <Icon />\n )}\n <StyledChipLabel>\n <StyledSpanWithEllipsis ref={setElement}>{label}</StyledSpanWithEllipsis>\n </StyledChipLabel>\n </StyledChip>\n </ConditionalTooltip>\n </StyledWrapper>\n );\n};\n\nDSChip.propTypes = DSChipPropTypes;\nDSChip.displayName = 'DSChip';\nconst DSChipWithSchema = describe(DSChip);\nDSChipWithSchema.propTypes = DSChipPropTypes;\n\nexport { DSChip, DSChipWithSchema };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;AAEA,MAAM,YAAgC,CAAC,UAAU,qCAAC,6BAAuB,MAAM,QAAS;AAExF,MAAM,SAA6C,CAAC,UAAU;AAC5D,QAAM,EAAE,MAAM,OAAO,UAAU,UAAU,MAAM,MAAM,aAAa,iBAAiB,UAAU,KAAK;AAElG,QAAM,EAAE,OAAO,aAAa,OAAO,MAAM,aAAa,gBAAgB;AAEtE,QAAM,EAAE,YAAY,sBAAsB,qBAAqB;AAE/D,QAAM,qBAAqB,QAAQ,MAAO,oBAAoB,cAAc,WAAY,CAAC,iBAAiB,CAAC;AAE3G,QAAM,kBAAkB,CAAC,MAAwB;AAC/C,MAAE,gBAAgB;AAAA,EACpB;AAEA,SACE,qCAAC;AAAA,IAAc,aAAa;AAAA,IAAO,YAAY;AAAA,KAC7C,qCAAC;AAAA,IAAmB,MAAM;AAAA,IAAO,aAAa;AAAA,IAAiB,cAAc;AAAA,KAC3E,qCAAC;AAAA,IACC,iBAAe;AAAA,IACf;AAAA,IACA,KAAK;AAAA,IACL;AAAA,IACA,MAAK;AAAA,IACJ,GAAG;AAAA,IACH,GAAG;AAAA,KAEH,UAAU,YAAY,QACrB,qCAAC;AAAA,IAAiB;AAAA,IAAoB;AAAA,KACpC,qCAAC,UAAK,CACR,IAEA,qCAAC,UAAK,GAER,qCAAC,uBACC,qCAAC;AAAA,IAAuB,KAAK;AAAA,KAAa,KAAM,CAClD,CACF,CACF,CACF;AAEJ;AAEA,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,MAAM,mBAAmB,SAAS,MAAM;AACxC,iBAAiB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import {
|
|
23
4
|
useMemoMergePropsWithDefault,
|
|
@@ -31,7 +12,7 @@ const useConfig = (props) => {
|
|
|
31
12
|
useValidateTypescriptPropTypes(propsWithDefault, DSChipPropTypes);
|
|
32
13
|
const globalAttrs = useGetGlobalAttributes(propsWithDefault);
|
|
33
14
|
const xStyledAttrs = useGetXstyledProps(propsWithDefault);
|
|
34
|
-
return
|
|
15
|
+
return { ...propsWithDefault, globalAttrs, xStyledAttrs };
|
|
35
16
|
};
|
|
36
17
|
export {
|
|
37
18
|
useConfig
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useConfig.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {\n useMemoMergePropsWithDefault,\n useGetGlobalAttributes,\n useValidateTypescriptPropTypes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { DSChipT, defaultProps, DSChipPropTypes } from '../react-desc-prop-types';\n\nexport const useConfig = (props: DSChipT.Props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n\n useValidateTypescriptPropTypes(propsWithDefault, DSChipPropTypes);\n const globalAttrs = useGetGlobalAttributes(propsWithDefault);\n const xStyledAttrs = useGetXstyledProps(propsWithDefault);\n\n return { ...propsWithDefault, globalAttrs, xStyledAttrs };\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AAEO,MAAM,YAAY,CAAC,UAAyB;AACjD,QAAM,mBAAmB,6BAA6B,OAAO,YAAY;AAEzE,iCAA+B,kBAAkB,eAAe;AAChE,QAAM,cAAc,uBAAuB,gBAAgB;AAC3D,QAAM,eAAe,mBAAmB,gBAAgB;AAExD,SAAO,EAAE,GAAG,kBAAkB,aAAa,aAAa;AAC1D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from "@elliemae/ds-utilities";
|
|
23
4
|
import {
|
|
@@ -32,7 +13,9 @@ const defaultProps = {
|
|
|
32
13
|
size: CHIP_SIZES.L,
|
|
33
14
|
shape: CHIP_SHAPES.DEFAULT
|
|
34
15
|
};
|
|
35
|
-
const DSChipPropTypes =
|
|
16
|
+
const DSChipPropTypes = {
|
|
17
|
+
...globalAttributesPropTypes,
|
|
18
|
+
...xstyledPropTypes,
|
|
36
19
|
icon: PropTypes.func.isRequired.description("Chip Icon").defaultValue(() => {
|
|
37
20
|
}),
|
|
38
21
|
label: PropTypes.string.isRequired.description("Chip Label").defaultValue(""),
|
|
@@ -40,7 +23,7 @@ const DSChipPropTypes = __spreadProps(__spreadValues(__spreadValues({}, globalAt
|
|
|
40
23
|
shape: PropTypes.oneOf(ChipShapesValuesArray).description(ChipShapesValuesString).defaultValue(CHIP_SHAPES.DEFAULT),
|
|
41
24
|
size: PropTypes.oneOf(ChipSizesValuesArray).description(ChipSizesValuesString).defaultValue(CHIP_SIZES.L),
|
|
42
25
|
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description("Inner ref to button component.")
|
|
43
|
-
}
|
|
26
|
+
};
|
|
44
27
|
export {
|
|
45
28
|
DSChipPropTypes,
|
|
46
29
|
defaultProps
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { WeakValidationMap } from 'react';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes, XstyledProps } from '@elliemae/ds-utilities';\nimport {\n CHIP_SIZES,\n CHIP_SHAPES,\n ChipSizesValuesArray,\n ChipSizesValuesString,\n ChipShapesValuesArray,\n ChipShapesValuesString,\n} from './constants';\nimport type { ChipSizesT, ChipShapesT } from './sharedTypes';\n\nexport const defaultProps: DSChipT.DefaultProps = {\n size: CHIP_SIZES.L,\n shape: CHIP_SHAPES.DEFAULT,\n};\n\nexport declare namespace DSChipT {\n interface DefaultProps {\n size: ChipSizesT;\n shape: ChipShapesT;\n }\n interface OptionalProps {\n selected?: boolean;\n innerRef?: React.RefObject<HTMLButtonElement> | ((_ref: HTMLButtonElement) => void);\n }\n\n interface RequiredProps {\n label: string;\n icon: () => JSX.Element;\n }\n export interface Props extends OptionalProps, Partial<DefaultProps>, RequiredProps, XstyledProps {}\n}\n\nexport const DSChipPropTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n icon: PropTypes.func.isRequired.description('Chip Icon').defaultValue(() => {}),\n label: PropTypes.string.isRequired.description('Chip Label').defaultValue(''),\n selected: PropTypes.bool.description('Whether chip is selected').defaultValue(''),\n shape: PropTypes.oneOf(ChipShapesValuesArray).description(ChipShapesValuesString).defaultValue(CHIP_SHAPES.DEFAULT),\n size: PropTypes.oneOf(ChipSizesValuesArray).description(ChipSizesValuesString).defaultValue(CHIP_SIZES.L),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.'),\n} as WeakValidationMap<unknown>;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUO,MAAM,eAAqC;AAAA,EAChD,MAAM,WAAW;AAAA,EACjB,OAAO,YAAY;AACrB;AAmBO,MAAM,kBAAkB;AAAA,EAC7B,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,UAAU,KAAK,WAAW,YAAY,WAAW,EAAE,aAAa,MAAM;AAAA,EAAC,CAAC;AAAA,EAC9E,OAAO,UAAU,OAAO,WAAW,YAAY,YAAY,EAAE,aAAa,EAAE;AAAA,EAC5E,UAAU,UAAU,KAAK,YAAY,0BAA0B,EAAE,aAAa,EAAE;AAAA,EAChF,OAAO,UAAU,MAAM,qBAAqB,EAAE,YAAY,sBAAsB,EAAE,aAAa,YAAY,OAAO;AAAA,EAClH,MAAM,UAAU,MAAM,oBAAoB,EAAE,YAAY,qBAAqB,EAAE,aAAa,WAAW,CAAC;AAAA,EACxG,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,YAAY,gCAAgC;AAChH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-chip",
|
|
3
|
-
"version": "3.3.0-next.
|
|
3
|
+
"version": "3.3.0-next.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Chip",
|
|
6
6
|
"files": [
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
"indent": 4
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@elliemae/ds-system": "3.3.0-next.
|
|
67
|
-
"@elliemae/ds-tooltip": "3.3.0-next.
|
|
68
|
-
"@elliemae/ds-utilities": "3.3.0-next.
|
|
66
|
+
"@elliemae/ds-system": "3.3.0-next.5",
|
|
67
|
+
"@elliemae/ds-tooltip": "3.3.0-next.5",
|
|
68
|
+
"@elliemae/ds-utilities": "3.3.0-next.5"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@elliemae/ds-icons": "3.3.0-next.
|
|
71
|
+
"@elliemae/ds-icons": "3.3.0-next.5",
|
|
72
72
|
"@testing-library/jest-dom": "~5.16.4",
|
|
73
73
|
"@testing-library/react": "~12.1.3",
|
|
74
74
|
"styled-components": "~5.3.5"
|