@elliemae/ds-chip 3.57.0-next.9 → 3.60.0-next.1
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 +2 -2
- package/dist/cjs/DSChip.js.map +2 -2
- package/dist/cjs/config/useConfig.js +5 -4
- package/dist/cjs/config/useConfig.js.map +2 -2
- package/dist/cjs/{constants.js → constants/index.js} +18 -1
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/index.js +29 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/package.json +4 -1
- package/dist/cjs/react-desc-prop-types.js +6 -5
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/sharedTypes.js.map +1 -1
- package/dist/cjs/styles.js +9 -10
- package/dist/cjs/styles.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-chip-valid.js +91 -0
- package/dist/cjs/typescript-testing/typescript-chip-valid.js.map +7 -0
- package/dist/esm/DSChip.js +3 -3
- package/dist/esm/DSChip.js.map +2 -2
- package/dist/esm/config/useConfig.js +5 -4
- package/dist/esm/config/useConfig.js.map +2 -2
- package/dist/esm/{constants.js → constants/index.js} +18 -1
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/index.js +43 -3
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/package.json +4 -1
- package/dist/esm/react-desc-prop-types.js +9 -6
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/styles.js +15 -7
- package/dist/esm/styles.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-chip-valid.js +68 -0
- package/dist/esm/typescript-testing/typescript-chip-valid.js.map +7 -0
- package/dist/types/config/useConfig.d.ts +452 -12
- package/dist/types/{constants.d.ts → constants/index.d.ts} +29 -0
- package/dist/types/index.d.ts +4 -3
- package/dist/types/react-desc-prop-types.d.ts +9 -8
- package/dist/types/sharedTypes.d.ts +1 -1
- package/dist/types/tests/DSChip.data-testid.test.d.ts +1 -0
- package/dist/types/tests/DSChip.events.test.d.ts +1 -0
- package/dist/types/tests/DSChip.exports.test.d.ts +1 -0
- package/dist/types/tests/DSChip.keyboard.test.d.ts +1 -0
- package/dist/types/tests/DSChips.get-owner-props.test.d.ts +1 -0
- package/dist/types/typescript-testing/typescript-chip-valid.d.ts +1 -0
- package/package.json +25 -24
- package/dist/cjs/constants.js.map +0 -7
- package/dist/cjs/exported_related/data-test-ids.js +0 -38
- package/dist/cjs/exported_related/data-test-ids.js.map +0 -7
- package/dist/cjs/exported_related/index.js +0 -31
- package/dist/cjs/exported_related/index.js.map +0 -7
- package/dist/cjs/exported_related/theming.js +0 -44
- package/dist/cjs/exported_related/theming.js.map +0 -7
- package/dist/esm/constants.js.map +0 -7
- package/dist/esm/exported_related/data-test-ids.js +0 -8
- package/dist/esm/exported_related/data-test-ids.js.map +0 -7
- package/dist/esm/exported_related/index.js +0 -4
- package/dist/esm/exported_related/index.js.map +0 -7
- package/dist/esm/exported_related/theming.js +0 -14
- package/dist/esm/exported_related/theming.js.map +0 -7
- package/dist/types/exported_related/data-test-ids.d.ts +0 -7
- package/dist/types/exported_related/index.d.ts +0 -2
- package/dist/types/exported_related/theming.d.ts +0 -8
- /package/dist/types/tests/{DSChip.test.d.ts → DSChip.api.test.d.ts} +0 -0
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { slotObjectToDataTestIds } from "@elliemae/ds-system";
|
|
3
|
+
const DSChipName = "DSChip";
|
|
4
|
+
const CHIP_SLOTS = {
|
|
5
|
+
ROOT: "root",
|
|
6
|
+
BUTTON: "button",
|
|
7
|
+
LABEL: "label",
|
|
8
|
+
ROUND_SHAPE: "round-shape",
|
|
9
|
+
ELLIPSIS: "ellipsis"
|
|
10
|
+
};
|
|
11
|
+
const CHIP_DATA_TESTID = slotObjectToDataTestIds(DSChipName, CHIP_SLOTS);
|
|
12
|
+
const DSChipSlots = CHIP_SLOTS;
|
|
13
|
+
const DSChipDataTestIds = CHIP_DATA_TESTID;
|
|
2
14
|
const CHIP_SHAPES = {
|
|
3
15
|
DEFAULT: "default",
|
|
4
16
|
ROUND: "round"
|
|
@@ -36,17 +48,22 @@ const ChipSizesValuesString = JSON.stringify(ChipSizesValuesArray);
|
|
|
36
48
|
const ChipShapesValuesString = JSON.stringify(ChipShapesValuesArray);
|
|
37
49
|
const ChipInteractionStatesValuesString = JSON.stringify(ChipInteractionStates);
|
|
38
50
|
export {
|
|
51
|
+
CHIP_DATA_TESTID,
|
|
39
52
|
CHIP_SHAPES,
|
|
40
53
|
CHIP_SIZES,
|
|
54
|
+
CHIP_SLOTS,
|
|
41
55
|
ChipInteractionStates,
|
|
42
56
|
ChipInteractionStatesValuesString,
|
|
43
57
|
ChipShapesValuesArray,
|
|
44
58
|
ChipShapesValuesString,
|
|
45
59
|
ChipSizesValuesArray,
|
|
46
60
|
ChipSizesValuesString,
|
|
61
|
+
DSChipDataTestIds,
|
|
62
|
+
DSChipName,
|
|
63
|
+
DSChipSlots,
|
|
47
64
|
basicSizes,
|
|
48
65
|
roundShapeLarge,
|
|
49
66
|
roundShapeSmall,
|
|
50
67
|
shapeSizes
|
|
51
68
|
};
|
|
52
|
-
//# sourceMappingURL=
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSChipName = 'DSChip';\n\nexport const CHIP_SLOTS = {\n ROOT: 'root',\n BUTTON: 'button',\n LABEL: 'label',\n ROUND_SHAPE: 'round-shape',\n ELLIPSIS: 'ellipsis',\n} as const;\n\nexport const CHIP_DATA_TESTID = slotObjectToDataTestIds(DSChipName, CHIP_SLOTS);\n\nexport const DSChipSlots = CHIP_SLOTS;\nexport const DSChipDataTestIds = CHIP_DATA_TESTID;\n\nexport const CHIP_SHAPES = {\n DEFAULT: 'default' as const,\n ROUND: 'round' as const,\n};\n\nexport const CHIP_SIZES = {\n S: 's' as const,\n L: 'l' as const,\n};\n\nexport const roundShapeLarge = '4.308rem';\nexport const roundShapeSmall = '3.077rem';\n\nexport const basicSizes = {\n s: {\n width: '5.538rem',\n height: '5.154rem',\n } as const,\n l: {\n width: '7.077rem',\n height: '5.154rem',\n } as const,\n};\n\nexport const shapeSizes = {\n s: {\n width: '5.538rem',\n height: '5.923rem',\n } as const,\n l: {\n width: '7.077rem',\n height: '6.538rem',\n } as const,\n};\n\nexport const ChipSizesValuesArray = Object.values(CHIP_SIZES);\nexport const ChipShapesValuesArray = Object.values(CHIP_SHAPES);\nexport const ChipInteractionStates = ['hover', 'focus', 'active'];\n\nexport const ChipSizesValuesString = JSON.stringify(ChipSizesValuesArray);\nexport const ChipShapesValuesString = JSON.stringify(ChipShapesValuesArray);\nexport const ChipInteractionStatesValuesString = JSON.stringify(ChipInteractionStates);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,aAAa;AAEnB,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AAAA,EACb,UAAU;AACZ;AAEO,MAAM,mBAAmB,wBAAwB,YAAY,UAAU;AAEvE,MAAM,cAAc;AACpB,MAAM,oBAAoB;AAE1B,MAAM,cAAc;AAAA,EACzB,SAAS;AAAA,EACT,OAAO;AACT;AAEO,MAAM,aAAa;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAEO,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AAExB,MAAM,aAAa;AAAA,EACxB,GAAG;AAAA,IACD,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EACA,GAAG;AAAA,IACD,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,aAAa;AAAA,EACxB,GAAG;AAAA,IACD,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EACA,GAAG;AAAA,IACD,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AACF;AAEO,MAAM,uBAAuB,OAAO,OAAO,UAAU;AACrD,MAAM,wBAAwB,OAAO,OAAO,WAAW;AACvD,MAAM,wBAAwB,CAAC,SAAS,SAAS,QAAQ;AAEzD,MAAM,wBAAwB,KAAK,UAAU,oBAAoB;AACjE,MAAM,yBAAyB,KAAK,UAAU,qBAAqB;AACnE,MAAM,oCAAoC,KAAK,UAAU,qBAAqB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { DSChip, DSChipWithSchema } from "./DSChip.js";
|
|
3
|
+
import { DSChipPropTypes } from "./react-desc-prop-types.js";
|
|
4
|
+
import {
|
|
5
|
+
CHIP_SLOTS,
|
|
6
|
+
CHIP_DATA_TESTID,
|
|
7
|
+
DSChipName,
|
|
8
|
+
CHIP_SHAPES,
|
|
9
|
+
CHIP_SIZES,
|
|
10
|
+
ChipInteractionStates,
|
|
11
|
+
ChipInteractionStatesValuesString,
|
|
12
|
+
ChipShapesValuesArray,
|
|
13
|
+
ChipShapesValuesString,
|
|
14
|
+
ChipSizesValuesArray,
|
|
15
|
+
ChipSizesValuesString,
|
|
16
|
+
DSChipDataTestIds,
|
|
17
|
+
DSChipSlots,
|
|
18
|
+
basicSizes,
|
|
19
|
+
roundShapeLarge,
|
|
20
|
+
roundShapeSmall,
|
|
21
|
+
shapeSizes
|
|
22
|
+
} from "./constants/index.js";
|
|
23
|
+
export {
|
|
24
|
+
CHIP_DATA_TESTID,
|
|
25
|
+
CHIP_SHAPES,
|
|
26
|
+
CHIP_SIZES,
|
|
27
|
+
CHIP_SLOTS,
|
|
28
|
+
ChipInteractionStates,
|
|
29
|
+
ChipInteractionStatesValuesString,
|
|
30
|
+
ChipShapesValuesArray,
|
|
31
|
+
ChipShapesValuesString,
|
|
32
|
+
ChipSizesValuesArray,
|
|
33
|
+
ChipSizesValuesString,
|
|
34
|
+
DSChip,
|
|
35
|
+
DSChipDataTestIds,
|
|
36
|
+
DSChipName,
|
|
37
|
+
DSChipPropTypes,
|
|
38
|
+
DSChipSlots,
|
|
39
|
+
DSChipWithSchema,
|
|
40
|
+
basicSizes,
|
|
41
|
+
roundShapeLarge,
|
|
42
|
+
roundShapeSmall,
|
|
43
|
+
shapeSizes
|
|
44
|
+
};
|
|
5
45
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSChip, DSChipWithSchema } from './DSChip.js';\nexport { type DSChipT, DSChipPropTypes } from './react-desc-prop-types.js';\nexport {\n CHIP_SLOTS,\n CHIP_DATA_TESTID,\n DSChipName,\n // below are \"unusual\" exports that we keep for retrocompatibility but that are usually\n // not exported in other components\n CHIP_SHAPES,\n CHIP_SIZES,\n ChipInteractionStates,\n ChipInteractionStatesValuesString,\n ChipShapesValuesArray,\n ChipShapesValuesString,\n ChipSizesValuesArray,\n ChipSizesValuesString,\n DSChipDataTestIds, // legacy test id constant name, same values as new one by default\n DSChipSlots,\n basicSizes,\n roundShapeLarge,\n roundShapeSmall,\n shapeSizes,\n} from './constants/index.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,wBAAwB;AACzC,SAAuB,uBAAuB;AAC9C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/package.json
CHANGED
|
@@ -11,16 +11,17 @@ import {
|
|
|
11
11
|
ChipSizesValuesArray,
|
|
12
12
|
ChipSizesValuesString,
|
|
13
13
|
ChipShapesValuesArray,
|
|
14
|
-
ChipShapesValuesString
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
ChipShapesValuesString,
|
|
15
|
+
DSChipName,
|
|
16
|
+
CHIP_SLOTS
|
|
17
|
+
} from "./constants/index.js";
|
|
18
|
+
const DSChipDefaultProps = {
|
|
18
19
|
size: CHIP_SIZES.L,
|
|
19
20
|
shape: CHIP_SHAPES.DEFAULT,
|
|
20
21
|
applyAriaDisabled: false
|
|
21
22
|
};
|
|
22
23
|
const DSChipPropTypes = {
|
|
23
|
-
...getPropsPerSlotPropTypes(DSChipName,
|
|
24
|
+
...getPropsPerSlotPropTypes(DSChipName, CHIP_SLOTS),
|
|
24
25
|
...globalAttributesPropTypes,
|
|
25
26
|
...xstyledPropTypes,
|
|
26
27
|
icon: PropTypes.func.isRequired.description("Chip Icon").defaultValue(() => {
|
|
@@ -34,8 +35,10 @@ const DSChipPropTypes = {
|
|
|
34
35
|
).defaultValue(false),
|
|
35
36
|
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description("Inner ref to button component.")
|
|
36
37
|
};
|
|
38
|
+
const DSChipPropTypesSchema = DSChipPropTypes;
|
|
37
39
|
export {
|
|
40
|
+
DSChipDefaultProps,
|
|
38
41
|
DSChipPropTypes,
|
|
39
|
-
|
|
42
|
+
DSChipPropTypesSchema
|
|
40
43
|
};
|
|
41
44
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport type { GlobalAttributesT, XstyledProps, ValidationMap } from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n getPropsPerSlotPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport {\n CHIP_SIZES,\n CHIP_SHAPES,\n ChipSizesValuesArray,\n ChipSizesValuesString,\n ChipShapesValuesArray,\n ChipShapesValuesString,\n} from './constants.js';\nimport type { ChipSizesT, ChipShapesT } from './sharedTypes.js';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACGvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport type { GlobalAttributesT, XstyledProps, ValidationMap, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n getPropsPerSlotPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport {\n CHIP_SIZES,\n CHIP_SHAPES,\n ChipSizesValuesArray,\n ChipSizesValuesString,\n ChipShapesValuesArray,\n ChipShapesValuesString,\n DSChipName,\n CHIP_SLOTS,\n} from './constants/index.js';\nimport type { ChipSizesT, ChipShapesT } from './sharedTypes.js';\n\nexport const DSChipDefaultProps: DSChipT.DefaultProps = {\n size: CHIP_SIZES.L,\n shape: CHIP_SHAPES.DEFAULT,\n applyAriaDisabled: false,\n};\n\nexport declare namespace DSChipT {\n export interface DefaultProps {\n size: ChipSizesT;\n shape: ChipShapesT;\n applyAriaDisabled: boolean;\n }\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSChipName, typeof CHIP_SLOTS> {\n selected?: boolean;\n innerRef?: React.RefObject<HTMLButtonElement> | ((_ref: HTMLButtonElement) => void);\n }\n\n export interface RequiredProps {\n label: string;\n icon: React.ComponentType<Record<string, never>>;\n }\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLElement>,\n keyof DefaultProps | keyof XstyledProps | keyof RequiredProps | keyof OptionalProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLElement>,\n keyof DefaultProps | keyof XstyledProps | keyof RequiredProps | keyof OptionalProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const DSChipPropTypes: DSPropTypesSchema<DSChipT.Props> = {\n ...getPropsPerSlotPropTypes(DSChipName, CHIP_SLOTS),\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 applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Inner ref to button component.'),\n};\n\nexport const DSChipPropTypesSchema = DSChipPropTypes as unknown as ValidationMap<DSChipT.Props>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,MAAM,qBAA2C;AAAA,EACtD,MAAM,WAAW;AAAA,EACjB,OAAO,YAAY;AAAA,EACnB,mBAAmB;AACrB;AAuCO,MAAM,kBAAoD;AAAA,EAC/D,GAAG,yBAAyB,YAAY,UAAU;AAAA,EAClD,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,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,IAAI,CAAC,EAAE,YAAY,gCAAgC;AAChH;AAEO,MAAM,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/styles.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { styled, css, xStyledCommonProps } from "@elliemae/ds-system";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
basicSizes,
|
|
5
|
+
shapeSizes,
|
|
6
|
+
CHIP_SHAPES,
|
|
7
|
+
CHIP_SIZES,
|
|
8
|
+
roundShapeLarge,
|
|
9
|
+
roundShapeSmall,
|
|
10
|
+
DSChipName,
|
|
11
|
+
CHIP_SLOTS
|
|
12
|
+
} from "./constants/index.js";
|
|
5
13
|
const getChipSize = (shape) => shape === CHIP_SHAPES.ROUND ? shapeSizes : basicSizes;
|
|
6
|
-
const StyledChipLabel = styled("div", { name: DSChipName, slot:
|
|
14
|
+
const StyledChipLabel = styled("div", { name: DSChipName, slot: CHIP_SLOTS.LABEL })`
|
|
7
15
|
font-size: ${({ theme }) => theme.fontSizes.label[200]};
|
|
8
16
|
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
9
17
|
word-wrap: break-word;
|
|
@@ -18,7 +26,7 @@ const StyledChipLabel = styled("div", { name: DSChipName, slot: DSChipSlots.LABE
|
|
|
18
26
|
`;
|
|
19
27
|
const StyledSpanWithEllipsis = styled("span", {
|
|
20
28
|
name: DSChipName,
|
|
21
|
-
slot:
|
|
29
|
+
slot: CHIP_SLOTS.ELLIPSIS
|
|
22
30
|
})`
|
|
23
31
|
white-space: nowrap;
|
|
24
32
|
overflow: hidden;
|
|
@@ -27,7 +35,7 @@ const StyledSpanWithEllipsis = styled("span", {
|
|
|
27
35
|
`;
|
|
28
36
|
const StyledWrapper = styled("div", {
|
|
29
37
|
name: DSChipName,
|
|
30
|
-
slot:
|
|
38
|
+
slot: CHIP_SLOTS.ROOT
|
|
31
39
|
})`
|
|
32
40
|
display: flex;
|
|
33
41
|
height: ${({ buttonSize, buttonShape }) => getChipSize(buttonShape)[buttonSize].height};
|
|
@@ -43,7 +51,7 @@ const disabledRoundShape = css`
|
|
|
43
51
|
`;
|
|
44
52
|
const StyledRoundShape = styled("div", {
|
|
45
53
|
name: DSChipName,
|
|
46
|
-
slot:
|
|
54
|
+
slot: CHIP_SLOTS.ROUND_SHAPE
|
|
47
55
|
})`
|
|
48
56
|
background-color: ${({ theme }) => theme.colors.brand[600]};
|
|
49
57
|
width: ${({ size }) => size === CHIP_SIZES.L ? roundShapeLarge : roundShapeSmall};
|
|
@@ -76,7 +84,7 @@ const styledChipSelectedCss = css`
|
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
`;
|
|
79
|
-
const StyledChip = styled("button", { name: DSChipName, slot:
|
|
87
|
+
const StyledChip = styled("button", { name: DSChipName, slot: CHIP_SLOTS.BUTTON })`
|
|
80
88
|
position: relative;
|
|
81
89
|
display: flex;
|
|
82
90
|
flex-direction: column;
|
package/dist/esm/styles.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { styled, css, xStyledCommonProps } from '@elliemae/ds-system';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,QAAQ,KAAK,0BAA0B;AAChD,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport { styled, css, xStyledCommonProps } from '@elliemae/ds-system';\nimport {\n basicSizes,\n shapeSizes,\n CHIP_SHAPES,\n CHIP_SIZES,\n roundShapeLarge,\n roundShapeSmall,\n DSChipName,\n CHIP_SLOTS,\n} from './constants/index.js';\nimport type { ChipShapesT, ChipSizesT } from './sharedTypes.js';\n\nexport interface StyledChipPropsT {\n buttonSize: ChipSizesT;\n buttonShape: ChipShapesT;\n selected?: boolean;\n}\n\nexport interface StyledRoundShapePropsT {\n size: ChipSizesT;\n disabled?: boolean;\n}\n\nconst getChipSize = (shape: ChipShapesT) => (shape === CHIP_SHAPES.ROUND ? shapeSizes : basicSizes);\n\nexport const StyledChipLabel = styled('div', { name: DSChipName, slot: CHIP_SLOTS.LABEL })<{ size: ChipSizesT }>`\n font-size: ${({ theme }) => theme.fontSizes.label[200]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n word-wrap: break-word;\n text-align: center;\n padding: ${({ size }) => (size === CHIP_SIZES.L ? '2px' : '4px')} 6px 6px 6px;\n z-index: 0;\n line-height: 1.27;\n width: inherit;\n display: flex;\n align-items: center;\n justify-content: center;\n`;\n\nexport const StyledSpanWithEllipsis = styled('span', {\n name: DSChipName,\n slot: CHIP_SLOTS.ELLIPSIS,\n})`\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n`;\n\nexport const StyledWrapper = styled('div', {\n name: DSChipName,\n slot: CHIP_SLOTS.ROOT,\n})<StyledChipPropsT>`\n display: flex;\n height: ${({ buttonSize, buttonShape }) => getChipSize(buttonShape)[buttonSize].height};\n width: ${({ buttonSize, buttonShape }) => getChipSize(buttonShape)[buttonSize].width};\n ${xStyledCommonProps}\n`;\n\nconst disabledRoundShape = css`\n background-color: ${({ theme }) => theme.colors.neutral[200]};\n\n & .DSIcon-root .DSIcon-svg {\n fill: ${({ theme }) => theme.colors.neutral[500]};\n }\n`;\n\nexport const StyledRoundShape = styled('div', {\n name: DSChipName,\n slot: CHIP_SLOTS.ROUND_SHAPE,\n})<StyledRoundShapePropsT>`\n background-color: ${({ theme }) => theme.colors.brand[600]};\n width: ${({ size }) => (size === CHIP_SIZES.L ? roundShapeLarge : roundShapeSmall)};\n height: ${({ size }) => (size === CHIP_SIZES.L ? roundShapeLarge : roundShapeSmall)};\n border-radius: 50px;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-top: ${({ size }) => (size === CHIP_SIZES.L ? '5px' : '10px')};\n`;\n\nconst styledChipSelectedCss = css`\n // TODO: wrap css processor to process new HOC wrapping styled components\n ${StyledRoundShape.toString()} {\n background-color: ${({ theme }) => theme.colors.brand[800]};\n }\n color: ${({ theme }) => theme.colors.brand[800]};\n background-color: ${({ theme }) => theme.colors.brand[200]};\n\n .DSIcon-root .DSIcon-svg {\n fill: ${({ theme }) => theme.colors.brand[800]};\n }\n\n &:before {\n border: 1px solid ${({ theme }) => theme.colors.brand[600]};\n }\n\n &:focus {\n &:before {\n border: 2px solid ${({ theme }) => theme.colors.brand[800]};\n }\n }\n`;\n\nexport const StyledChip = styled('button', { name: DSChipName, slot: CHIP_SLOTS.BUTTON })<\n Pick<StyledChipPropsT, 'selected' | 'buttonShape'>\n>`\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 0;\n padding-top: ${(props) => (props.buttonShape === CHIP_SHAPES.ROUND ? '0' : '10px')};\n border: none;\n min-height: 100%;\n height: fit-content;\n width: 100%;\n background-color: #fff;\n color: ${({ theme }) => theme.colors.brand[600]};\n border-radius: 4px;\n cursor: pointer;\n outline: none;\n\n ${StyledRoundShape} {\n & .DSIcon-root .DSIcon-svg {\n fill: #fff;\n height: 1.85rem;\n width: 1.85rem;\n @media (max-width: ${({ theme }) => theme.breakpoints.small}) {\n height: 1.5rem;\n width: 1.5rem;\n }\n }\n ${({ disabled }) => disabled && disabledRoundShape}\n }\n &:before {\n content: '';\n position: absolute;\n z-index: 20;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border-radius: 4px;\n border: 2px solid transparent;\n pointer-events: none;\n }\n & .DSIcon-root .DSIcon-svg {\n fill: ${({ theme }) => theme.colors.brand[600]};\n height: 1.85rem;\n width: 1.85rem;\n @media (max-width: ${({ theme }) => theme.breakpoints.small}) {\n height: 1.5rem;\n width: 1.5rem;\n }\n }\n & .DSIcon-root {\n height: 1.85rem;\n width: 1.85rem;\n @media (max-width: ${({ theme }) => theme.breakpoints.small}) {\n height: 1.5rem;\n width: 1.5rem;\n }\n }\n\n &:hover,\n &:focus {\n z-index: 10;\n\n ${StyledChipLabel} {\n text-align: left;\n }\n\n ${StyledSpanWithEllipsis} {\n overflow-wrap: break-word;\n white-space: pre-wrap;\n overflow: visible;\n }\n }\n\n &:hover {\n ${StyledRoundShape} {\n background-color: ${({ theme }) => theme.colors.brand[800]};\n }\n color: ${({ theme }) => theme.colors.brand[800]};\n background-color: ${({ theme }) => theme.colors.brand[200]};\n .DSIcon-svg {\n fill: ${({ theme }) => theme.colors.brand[800]};\n }\n }\n\n &:focus {\n &:before {\n border-color: ${({ theme }) => theme.colors.brand[800]};\n }\n }\n\n &:disabled {\n color: ${({ theme }) => theme.colors.neutral[500]};\n cursor: not-allowed;\n\n .DSIcon-svg {\n fill: ${({ theme }) => theme.colors.neutral[500]};\n }\n\n &:focus,\n &:hover {\n ${StyledRoundShape} {\n background-color: ${({ theme }) => theme.colors.neutral[200]};\n }\n background-color: #fff;\n cursor: not-allowed;\n &:before {\n border-color: transparent;\n }\n\n ${StyledChipLabel} {\n color: ${({ theme }) => theme.colors.neutral[500]};\n }\n }\n\n &:hover .DSIcon-svg {\n fill: ${({ theme }) => theme.colors.neutral[500]};\n }\n }\n\n &[aria-disabled='true'] {\n color: ${({ theme }) => theme.colors.neutral[500]};\n cursor: not-allowed;\n\n .DSIcon-svg {\n fill: ${({ theme }) => theme.colors.neutral[500]};\n }\n\n ${StyledRoundShape} {\n ${disabledRoundShape}\n }\n\n &:focus,\n &:hover {\n ${StyledRoundShape} {\n background-color: ${({ theme }) => theme.colors.neutral[200]};\n }\n background-color: #fff;\n cursor: not-allowed;\n\n ${StyledChipLabel} {\n color: ${({ theme }) => theme.colors.neutral[500]};\n }\n }\n\n &:hover {\n &:not(:focus) {\n &:before {\n border-color: transparent;\n }\n }\n }\n\n &:hover .DSIcon-svg {\n fill: ${({ theme }) => theme.colors.neutral[500]};\n }\n }\n\n ${({ selected }) => (!selected ? '' : styledChipSelectedCss)}\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,QAAQ,KAAK,0BAA0B;AAChD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAc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C,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,aAKzC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA,cAIvC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA,MAGhD,gBAAgB;AAAA,QACd,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,QAKlB,gBAAgB;AAAA,4BACI,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,QAK5D,eAAe;AAAA,iBACN,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAa3C,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA,IAIlD,CAAC,EAAE,SAAS,MAAO,CAAC,WAAW,KAAK,qBAAsB;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React2 from "react";
|
|
4
|
+
import { DSChip } from "../index.js";
|
|
5
|
+
const Icon = () => /* @__PURE__ */ jsx("div", { "data-testid": "icon-test" });
|
|
6
|
+
const testRequiredProps = {
|
|
7
|
+
label: "Label",
|
|
8
|
+
icon: Icon
|
|
9
|
+
};
|
|
10
|
+
const testOptionalPropsEmpty = {};
|
|
11
|
+
const testOptionalProps = {
|
|
12
|
+
selected: true,
|
|
13
|
+
innerRef: React2.createRef()
|
|
14
|
+
};
|
|
15
|
+
const testPartialDefaults = {
|
|
16
|
+
applyAriaDisabled: true
|
|
17
|
+
};
|
|
18
|
+
const testProps = {
|
|
19
|
+
...testRequiredProps,
|
|
20
|
+
...testPartialDefaults
|
|
21
|
+
};
|
|
22
|
+
const testPropsAsSyntax = {
|
|
23
|
+
...testRequiredProps,
|
|
24
|
+
...testPartialDefaults
|
|
25
|
+
};
|
|
26
|
+
const testCompleteDefaults = {
|
|
27
|
+
size: "l",
|
|
28
|
+
shape: "default",
|
|
29
|
+
applyAriaDisabled: false
|
|
30
|
+
};
|
|
31
|
+
const testInternalProps = {
|
|
32
|
+
...testRequiredProps,
|
|
33
|
+
...testOptionalProps,
|
|
34
|
+
...testCompleteDefaults
|
|
35
|
+
};
|
|
36
|
+
const testInternalPropsAsSyntax = {
|
|
37
|
+
...testRequiredProps,
|
|
38
|
+
...testOptionalProps,
|
|
39
|
+
...testCompleteDefaults
|
|
40
|
+
};
|
|
41
|
+
const testExplicitDefinition = {
|
|
42
|
+
label: "Label",
|
|
43
|
+
icon: Icon,
|
|
44
|
+
size: "l",
|
|
45
|
+
shape: "default",
|
|
46
|
+
applyAriaDisabled: false
|
|
47
|
+
};
|
|
48
|
+
const testInferedTypeCompatibility = {
|
|
49
|
+
label: "Label",
|
|
50
|
+
icon: Icon,
|
|
51
|
+
size: "l",
|
|
52
|
+
shape: "default",
|
|
53
|
+
applyAriaDisabled: false
|
|
54
|
+
};
|
|
55
|
+
const testDefinitionAsConst = {
|
|
56
|
+
label: "Label",
|
|
57
|
+
icon: Icon,
|
|
58
|
+
size: "l",
|
|
59
|
+
shape: "default",
|
|
60
|
+
applyAriaDisabled: false
|
|
61
|
+
};
|
|
62
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
63
|
+
/* @__PURE__ */ jsx(DSChip, { ...testExplicitDefinition }),
|
|
64
|
+
/* @__PURE__ */ jsx(DSChip, { ...testInferedTypeCompatibility }),
|
|
65
|
+
/* @__PURE__ */ jsx(DSChip, { ...testDefinitionAsConst }),
|
|
66
|
+
/* @__PURE__ */ jsx(DSChip, { label: "Label", icon: Icon })
|
|
67
|
+
] });
|
|
68
|
+
//# sourceMappingURL=typescript-chip-valid.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-chip-valid.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport React from 'react';\nimport { DSChip } from '../index.js';\nimport type { DSChipT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSChipT.Props;\ntype ComponentPropsInternals = DSChipT.InternalProps;\ntype ComponentPropsDefaultProps = DSChipT.DefaultProps;\ntype ComponentPropsOptionalProps = DSChipT.OptionalProps;\ntype ComponentPropsRequiredProps = DSChipT.RequiredProps;\n\nconst Icon = () => <div data-testid=\"icon-test\" />;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n label: 'Label',\n icon: Icon,\n};\n\nconst testOptionalPropsEmpty: ComponentPropsOptionalProps = {};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n selected: true,\n innerRef: React.createRef<HTMLButtonElement>(),\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n applyAriaDisabled: true,\n};\n\n// ComponentPropsForApp only needs required props, default and optional are not mandatory\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n size: 'l',\n shape: 'default',\n applyAriaDisabled: false,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\n\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n label: 'Label',\n icon: Icon,\n size: 'l',\n shape: 'default',\n applyAriaDisabled: false,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n label: 'Label',\n icon: Icon,\n size: 'l',\n shape: 'default',\n applyAriaDisabled: false,\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n label: 'Label',\n icon: Icon,\n size: 'l',\n shape: 'default',\n applyAriaDisabled: false,\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSChip {...testExplicitDefinition} />\n <DSChip {...testInferedTypeCompatibility} />\n <DSChip {...testDefinitionAsConst} />\n {/* works with inline values */}\n <DSChip label=\"Label\" icon={Icon} />\n </>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACYJ,SA6EjB,UA7EiB,KA6EjB,YA7EiB;AAXnB,OAAOA,YAAW;AAClB,SAAS,cAAc;AAUvB,MAAM,OAAO,MAAM,oBAAC,SAAI,eAAY,aAAY;AAEhD,MAAM,oBAAiD;AAAA,EACrD,OAAO;AAAA,EACP,MAAM;AACR;AAEA,MAAM,yBAAsD,CAAC;AAE7D,MAAM,oBAAiD;AAAA,EACrD,UAAU;AAAA,EACV,UAAUA,OAAM,UAA6B;AAC/C;AAIA,MAAM,sBAA2D;AAAA,EAC/D,mBAAmB;AACrB;AAGA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,MAAM;AAA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