@elliemae/ds-form-native-select 3.70.0-next.14 → 3.70.0-next.16
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/NativeSelect.js +53 -26
- package/dist/cjs/NativeSelect.js.map +2 -2
- package/dist/cjs/{NativeSelectDefinitions.js → constants/index.js} +9 -6
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/index.js +13 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +60 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/styled.js +26 -10
- package/dist/cjs/styled.js.map +2 -2
- package/dist/esm/NativeSelect.js +56 -31
- package/dist/esm/NativeSelect.js.map +2 -2
- package/dist/esm/constants/index.js +15 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/index.js +9 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +35 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/styled.js +23 -7
- package/dist/esm/styled.js.map +2 -2
- package/dist/types/NativeSelect.d.ts +3 -7
- package/dist/types/constants/index.d.ts +11 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/react-desc-prop-types.d.ts +34 -0
- package/dist/types/styled.d.ts +2 -0
- package/dist/types/tests/DSNativeSelect.api.test.d.ts +1 -0
- package/dist/types/tests/DSNativeSelect.data-testid.test.d.ts +1 -0
- package/dist/types/tests/DSNativeSelect.events.test.d.ts +1 -0
- package/dist/types/tests/DSNativeSelect.exports.test.d.ts +1 -0
- package/dist/types/tests/DSNativeSelect.get-owner-props-arguments-slots.test.d.ts +1 -0
- package/dist/types/tests/DSNativeSelect.keyboard.test.d.ts +1 -0
- package/dist/types/tests/DSNativeSelect.proptype-schema.test.d.ts +1 -0
- package/dist/types/tests/DSNativeSelect.pui-14614.test.d.ts +1 -0
- package/package.json +7 -6
- package/dist/cjs/NativeSelectDefinitions.js.map +0 -7
- package/dist/esm/NativeSelectDefinitions.js +0 -12
- package/dist/esm/NativeSelectDefinitions.js.map +0 -7
- package/dist/types/NativeSelectDefinitions.d.ts +0 -6
package/dist/cjs/NativeSelect.js
CHANGED
|
@@ -38,38 +38,65 @@ var import_react = require("react");
|
|
|
38
38
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
39
39
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
40
40
|
var import_styled = require("./styled.js");
|
|
41
|
-
|
|
42
|
-
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
43
|
-
...import_ds_props_helpers.xstyledPropTypes,
|
|
44
|
-
hasError: import_ds_props_helpers.PropTypes.bool.description("whether the input has an error").defaultValue(false),
|
|
45
|
-
disabled: import_ds_props_helpers.PropTypes.bool.description("whether the input is disabled").defaultValue(false),
|
|
46
|
-
children: import_ds_props_helpers.PropTypes.node.description("options to be rendered in the select")
|
|
47
|
-
};
|
|
41
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
48
42
|
const DSNativeSelect = (props) => {
|
|
49
|
-
const { hasError, disabled, children } = props;
|
|
43
|
+
const { hasError, disabled, applyAriaDisabled, readOnly, children } = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
44
|
+
const isLocked = applyAriaDisabled || readOnly;
|
|
45
|
+
const userOnChangeRef = (0, import_react.useRef)(props.onChange);
|
|
46
|
+
userOnChangeRef.current = props.onChange;
|
|
47
|
+
const handleOnChange = (0, import_react.useCallback)(
|
|
48
|
+
(e) => {
|
|
49
|
+
if (isLocked) return;
|
|
50
|
+
userOnChangeRef.current?.(e);
|
|
51
|
+
},
|
|
52
|
+
[isLocked]
|
|
53
|
+
);
|
|
50
54
|
const getOwnerProps = (0, import_react.useCallback)(() => props, [props]);
|
|
51
55
|
const getOwnerPropsArguments = (0, import_react.useCallback)(() => ({}), []);
|
|
52
56
|
const xStyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(props);
|
|
53
|
-
const { id, required, size, ...globalAttributes } = (0, import_ds_props_helpers.useGetGlobalAttributes)(
|
|
54
|
-
|
|
57
|
+
const { id, required, size, ...globalAttributes } = (0, import_ds_props_helpers.useGetGlobalAttributes)(props);
|
|
58
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
59
|
+
import_styled.StyledControlsWrapper,
|
|
60
|
+
{
|
|
61
|
+
disabled,
|
|
62
|
+
hasError,
|
|
63
|
+
applyAriaDisabled,
|
|
64
|
+
readOnly,
|
|
65
|
+
...xStyledProps,
|
|
66
|
+
...globalAttributes,
|
|
67
|
+
onChange: handleOnChange,
|
|
68
|
+
getOwnerProps,
|
|
69
|
+
getOwnerPropsArguments,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
72
|
+
import_styled.StyledSelect,
|
|
73
|
+
{
|
|
74
|
+
id,
|
|
75
|
+
disabled,
|
|
76
|
+
required,
|
|
77
|
+
size,
|
|
78
|
+
"aria-invalid": hasError,
|
|
79
|
+
"aria-disabled": isLocked,
|
|
80
|
+
getOwnerProps,
|
|
81
|
+
getOwnerPropsArguments,
|
|
82
|
+
children
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
import_styled.StyledDropDownButton,
|
|
87
|
+
{
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
getOwnerProps,
|
|
91
|
+
getOwnerPropsArguments,
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronSmallDown, {})
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
]
|
|
96
|
+
}
|
|
55
97
|
);
|
|
56
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.StyledControlsWrapper, { disabled, hasError, ...xStyledProps, ...globalAttributes, children: [
|
|
57
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
58
|
-
import_styled.StyledSelect,
|
|
59
|
-
{
|
|
60
|
-
id,
|
|
61
|
-
disabled,
|
|
62
|
-
required,
|
|
63
|
-
size,
|
|
64
|
-
getOwnerProps,
|
|
65
|
-
getOwnerPropsArguments,
|
|
66
|
-
children
|
|
67
|
-
}
|
|
68
|
-
),
|
|
69
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledDropDownButton, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronSmallDown, {}) })
|
|
70
|
-
] });
|
|
71
98
|
};
|
|
72
99
|
DSNativeSelect.displayName = "DSNativeSelect";
|
|
73
100
|
const DSNativeSelectWithSchema = (0, import_ds_props_helpers.describe)(DSNativeSelect);
|
|
74
|
-
DSNativeSelectWithSchema.propTypes =
|
|
101
|
+
DSNativeSelectWithSchema.propTypes = import_react_desc_prop_types.DSNativeSelectPropTypesSchema;
|
|
75
102
|
//# sourceMappingURL=NativeSelect.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/NativeSelect.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useRef } from 'react';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport {\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n describe,\n} from '@elliemae/ds-props-helpers';\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport { StyledControlsWrapper, StyledDropDownButton, StyledSelect } from './styled.js';\nimport { type DSNativeSelectT, DSNativeSelectPropTypesSchema, defaultProps } from './react-desc-prop-types.js';\n\nconst DSNativeSelect: React.ComponentType<DSNativeSelectT.Props> = (props) => {\n const { hasError, disabled, applyAriaDisabled, readOnly, children } =\n useMemoMergePropsWithDefault<DSNativeSelectT.InternalProps>(props, defaultProps);\n\n const isLocked = applyAriaDisabled || readOnly;\n\n // Ref pattern mirrors ds-form-input-text/src/config/useInputText.ts:\n // gate the consumer onChange while locked, but always invoke the latest\n // user handler without recreating the wrapper when the consumer's handler is unmemoised.\n const userOnChangeRef = useRef(props.onChange);\n userOnChangeRef.current = props.onChange;\n const handleOnChange = useCallback(\n (e: React.FormEvent<HTMLDivElement>) => {\n if (isLocked) return;\n userOnChangeRef.current?.(e);\n },\n [isLocked],\n );\n\n const getOwnerProps = useCallback(() => props, [props]);\n const getOwnerPropsArguments = useCallback(() => ({}), []);\n\n const xStyledProps = useGetXstyledProps(props);\n const { id, required, size, ...globalAttributes } = useGetGlobalAttributes<\n DSNativeSelectT.Props,\n HTMLDivElement,\n DSGridT.Props\n >(props);\n return (\n <StyledControlsWrapper\n disabled={disabled}\n hasError={hasError}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n {...xStyledProps}\n {...globalAttributes}\n onChange={handleOnChange}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledSelect\n id={id}\n disabled={disabled}\n required={required}\n size={size}\n aria-invalid={hasError}\n aria-disabled={isLocked}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {children}\n </StyledSelect>\n <StyledDropDownButton\n justifyContent=\"center\"\n alignItems=\"center\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <ChevronSmallDown />\n </StyledDropDownButton>\n </StyledControlsWrapper>\n );\n};\n\nDSNativeSelect.displayName = 'DSNativeSelect';\nconst DSNativeSelectWithSchema = describe(DSNativeSelect);\nDSNativeSelectWithSchema.propTypes = DSNativeSelectPropTypesSchema;\n\nexport { DSNativeSelect, DSNativeSelectWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADyCnB;AAzCJ,mBAA2C;AAC3C,sBAAiC;AACjC,8BAKO;AAEP,oBAA0E;AAC1E,mCAAkF;AAElF,MAAM,iBAA6D,CAAC,UAAU;AAC5E,QAAM,EAAE,UAAU,UAAU,mBAAmB,UAAU,SAAS,QAChE,sDAA4D,OAAO,yCAAY;AAEjF,QAAM,WAAW,qBAAqB;AAKtC,QAAM,sBAAkB,qBAAO,MAAM,QAAQ;AAC7C,kBAAgB,UAAU,MAAM;AAChC,QAAM,qBAAiB;AAAA,IACrB,CAAC,MAAuC;AACtC,UAAI,SAAU;AACd,sBAAgB,UAAU,CAAC;AAAA,IAC7B;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,oBAAgB,0BAAY,MAAM,OAAO,CAAC,KAAK,CAAC;AACtD,QAAM,6BAAyB,0BAAY,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzD,QAAM,mBAAe,4CAAmB,KAAK;AAC7C,QAAM,EAAE,IAAI,UAAU,MAAM,GAAG,iBAAiB,QAAI,gDAIlD,KAAK;AACP,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,gBAAc;AAAA,YACd,iBAAe;AAAA,YACf;AAAA,YACA;AAAA,YAEC;AAAA;AAAA,QACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,gBAAe;AAAA,YACf,YAAW;AAAA,YACX;AAAA,YACA;AAAA,YAEA,sDAAC,oCAAiB;AAAA;AAAA,QACpB;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,eAAe,cAAc;AAC7B,MAAM,+BAA2B,kCAAS,cAAc;AACxD,yBAAyB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -26,17 +26,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var constants_exports = {};
|
|
30
|
+
__export(constants_exports, {
|
|
31
31
|
DSNativeSelectName: () => DSNativeSelectName,
|
|
32
|
-
|
|
32
|
+
NATIVE_SELECT_DATA_TESTID: () => NATIVE_SELECT_DATA_TESTID,
|
|
33
|
+
NATIVE_SELECT_SLOTS: () => NATIVE_SELECT_SLOTS
|
|
33
34
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
35
|
+
module.exports = __toCommonJS(constants_exports);
|
|
35
36
|
var React = __toESM(require("react"));
|
|
37
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
36
38
|
const DSNativeSelectName = "DSNativeselect";
|
|
37
|
-
const
|
|
39
|
+
const NATIVE_SELECT_SLOTS = {
|
|
38
40
|
CONTAINER: "root",
|
|
39
41
|
INPUT: "input",
|
|
40
42
|
DROP_INDICATOR: "drop-indicator"
|
|
41
43
|
};
|
|
42
|
-
|
|
44
|
+
const NATIVE_SELECT_DATA_TESTID = (0, import_ds_system.slotObjectToDataTestIds)(DSNativeSelectName, NATIVE_SELECT_SLOTS);
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSNativeSelectName = 'DSNativeselect';\n\n// using ${component_name}_SLOTS convention to namespace & avoid errors on duplicate exports in aggregators\nexport const NATIVE_SELECT_SLOTS = {\n CONTAINER: 'root',\n INPUT: 'input',\n DROP_INDICATOR: 'drop-indicator',\n} as const;\n\n// using ${component_name}_DATA_TESTID convention to namespace & avoid errors on duplicate exports in aggregators\nexport const NATIVE_SELECT_DATA_TESTID = slotObjectToDataTestIds(DSNativeSelectName, NATIVE_SELECT_SLOTS);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAAA,EACjC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,gBAAgB;AAClB;AAGO,MAAM,gCAA4B,0CAAwB,oBAAoB,mBAAmB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -5,6 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
8
12
|
var __copyProps = (to, from, except, desc) => {
|
|
9
13
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
14
|
for (let key of __getOwnPropNames(from))
|
|
@@ -13,7 +17,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
17
|
}
|
|
14
18
|
return to;
|
|
15
19
|
};
|
|
16
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -24,7 +27,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
27
|
));
|
|
25
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
29
|
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
|
+
DSNativeSelect: () => import_NativeSelect.DSNativeSelect,
|
|
32
|
+
DSNativeSelectName: () => import_constants.DSNativeSelectName,
|
|
33
|
+
DSNativeSelectWithSchema: () => import_NativeSelect.DSNativeSelectWithSchema,
|
|
34
|
+
NATIVE_SELECT_DATA_TESTID: () => import_constants.NATIVE_SELECT_DATA_TESTID,
|
|
35
|
+
NATIVE_SELECT_SLOTS: () => import_constants.NATIVE_SELECT_SLOTS
|
|
36
|
+
});
|
|
27
37
|
module.exports = __toCommonJS(index_exports);
|
|
28
38
|
var React = __toESM(require("react"));
|
|
29
|
-
|
|
39
|
+
var import_NativeSelect = require("./NativeSelect.js");
|
|
40
|
+
var import_constants = require("./constants/index.js");
|
|
30
41
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export { DSNativeSelect, DSNativeSelectWithSchema } from './NativeSelect.js';\nexport { type DSNativeSelectT } from './react-desc-prop-types.js';\nexport { NATIVE_SELECT_SLOTS, NATIVE_SELECT_DATA_TESTID, DSNativeSelectName } from './constants/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAAyD;AAEzD,uBAAmF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var react_desc_prop_types_exports = {};
|
|
30
|
+
__export(react_desc_prop_types_exports, {
|
|
31
|
+
DSNativeSelectPropTypes: () => DSNativeSelectPropTypes,
|
|
32
|
+
DSNativeSelectPropTypesSchema: () => DSNativeSelectPropTypesSchema,
|
|
33
|
+
defaultProps: () => defaultProps
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
|
+
var import_constants = require("./constants/index.js");
|
|
39
|
+
const defaultProps = {
|
|
40
|
+
hasError: false,
|
|
41
|
+
disabled: false,
|
|
42
|
+
applyAriaDisabled: false,
|
|
43
|
+
readOnly: false
|
|
44
|
+
};
|
|
45
|
+
const DSNativeSelectPropTypes = {
|
|
46
|
+
...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSNativeSelectName, import_constants.NATIVE_SELECT_SLOTS),
|
|
47
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
48
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
49
|
+
hasError: import_ds_props_helpers.PropTypes.bool.description("whether the input has an error").defaultValue(false),
|
|
50
|
+
disabled: import_ds_props_helpers.PropTypes.bool.description("whether the input is disabled").defaultValue(false),
|
|
51
|
+
applyAriaDisabled: import_ds_props_helpers.PropTypes.bool.description(
|
|
52
|
+
"Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION"
|
|
53
|
+
).defaultValue(false),
|
|
54
|
+
readOnly: import_ds_props_helpers.PropTypes.bool.description(
|
|
55
|
+
"Renders the select as aria-disabled (readonly is not a valid HTML attribute on <select>): focusable, blocks onChange, shows the two-tone locked border. Does not set the HTML readonly attribute."
|
|
56
|
+
).defaultValue(false),
|
|
57
|
+
children: import_ds_props_helpers.PropTypes.node.description("options to be rendered in the select")
|
|
58
|
+
};
|
|
59
|
+
const DSNativeSelectPropTypesSchema = DSNativeSelectPropTypes;
|
|
60
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type React from 'react';\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n PropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSNativeSelectName, NATIVE_SELECT_SLOTS } from './constants/index.js';\n\nexport declare namespace DSNativeSelectT {\n /**\n * Explicit function-form slot prop types \u2014 one entry per slot.\n * NOTE: SlotFunctionArguments is a known cross-cutting gap across the forms group\n * (see TODO_ENTROPY_REVIEW.md). This package acts as the reference implementation.\n */\n export type SlotFunctionArguments = {\n dsNativeselectRoot: () => object;\n dsNativeselectInput: () => object;\n dsNativeselectDropIndicator: () => object;\n };\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n hasError: boolean;\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n }\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSNativeSelectName, typeof NATIVE_SELECT_SLOTS> {\n children?: React.ReactNode;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSNativeSelectT.DefaultProps = {\n hasError: false,\n disabled: false,\n applyAriaDisabled: false,\n readOnly: false,\n};\n\nexport const DSNativeSelectPropTypes: DSPropTypesSchema<DSNativeSelectT.Props> = {\n ...getPropsPerSlotPropTypes(DSNativeSelectName, NATIVE_SELECT_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n hasError: PropTypes.bool.description('whether the input has an error').defaultValue(false),\n disabled: PropTypes.bool.description('whether the input is disabled').defaultValue(false),\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 readOnly: PropTypes.bool\n .description(\n 'Renders the select as aria-disabled (readonly is not a valid HTML attribute on <select>): focusable, blocks onChange, shows the two-tone locked border. Does not set the HTML readonly attribute.',\n )\n .defaultValue(false),\n children: PropTypes.node.description('options to be rendered in the select'),\n};\n\nexport const DSNativeSelectPropTypesSchema = DSNativeSelectPropTypes as unknown as ValidationMap<DSNativeSelectT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAKO;AAEP,uBAAwD;AA2CjD,MAAM,eAA6C;AAAA,EACxD,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,UAAU;AACZ;AAEO,MAAM,0BAAoE;AAAA,EAC/E,OAAG,kDAAyB,qCAAoB,oCAAmB;AAAA,EACnE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,kCAAU,KAAK,YAAY,gCAAgC,EAAE,aAAa,KAAK;AAAA,EACzF,UAAU,kCAAU,KAAK,YAAY,+BAA+B,EAAE,aAAa,KAAK;AAAA,EACxF,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,KACjB;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,UAAU,kCAAU,KAAK,YAAY,sCAAsC;AAC7E;AAEO,MAAM,gCAAgC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/styled.js
CHANGED
|
@@ -36,9 +36,20 @@ module.exports = __toCommonJS(styled_exports);
|
|
|
36
36
|
var React = __toESM(require("react"));
|
|
37
37
|
var import_ds_system = require("@elliemae/ds-system");
|
|
38
38
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
39
|
-
var
|
|
39
|
+
var import_constants = require("./constants/index.js");
|
|
40
|
+
const disabledBorder = import_ds_system.css`
|
|
41
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral[400]};
|
|
42
|
+
`;
|
|
43
|
+
const errorBorder = import_ds_system.css`
|
|
44
|
+
border: 1px solid ${({ theme }) => theme.colors.danger[900]};
|
|
45
|
+
`;
|
|
46
|
+
const lockedBorder = import_ds_system.css`
|
|
47
|
+
background-color: ${({ theme }) => theme.colors.neutral["050"]};
|
|
48
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral["080"]};
|
|
49
|
+
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};
|
|
50
|
+
`;
|
|
40
51
|
const normalBorder = import_ds_system.css`
|
|
41
|
-
border: 1px solid ${({
|
|
52
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral[400]};
|
|
42
53
|
`;
|
|
43
54
|
const focusBorder = import_ds_system.css`
|
|
44
55
|
outline: 2px solid ${({ theme }) => theme.colors.brand[700]};
|
|
@@ -48,8 +59,8 @@ const hoverBorder = import_ds_system.css`
|
|
|
48
59
|
border: 1px solid ${({ theme }) => theme.colors.brand[700]};
|
|
49
60
|
`;
|
|
50
61
|
const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
51
|
-
name:
|
|
52
|
-
slot:
|
|
62
|
+
name: import_constants.DSNativeSelectName,
|
|
63
|
+
slot: import_constants.NATIVE_SELECT_SLOTS.CONTAINER
|
|
53
64
|
})`
|
|
54
65
|
background: ${({ disabled, theme }) => disabled ? theme.colors.neutral["080"] : "#ffffff"};
|
|
55
66
|
position: relative;
|
|
@@ -57,17 +68,22 @@ const StyledControlsWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid,
|
|
|
57
68
|
align-items: center;
|
|
58
69
|
align-content: center;
|
|
59
70
|
height: 28px;
|
|
60
|
-
${
|
|
71
|
+
${({ disabled, hasError, applyAriaDisabled, readOnly }) => {
|
|
72
|
+
if (disabled) return disabledBorder;
|
|
73
|
+
if (hasError) return errorBorder;
|
|
74
|
+
if (applyAriaDisabled || readOnly) return lockedBorder;
|
|
75
|
+
return normalBorder;
|
|
76
|
+
}}
|
|
61
77
|
&:hover {
|
|
62
|
-
${({ disabled }) => !disabled ? hoverBorder : ""}
|
|
78
|
+
${({ disabled, applyAriaDisabled, readOnly }) => !disabled && !applyAriaDisabled && !readOnly ? hoverBorder : ""}
|
|
63
79
|
}
|
|
64
80
|
&:focus-within {
|
|
65
81
|
${focusBorder}
|
|
66
82
|
}
|
|
67
83
|
`;
|
|
68
84
|
const StyledDropDownButton = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
69
|
-
name:
|
|
70
|
-
slot:
|
|
85
|
+
name: import_constants.DSNativeSelectName,
|
|
86
|
+
slot: import_constants.NATIVE_SELECT_SLOTS.DROP_INDICATOR
|
|
71
87
|
})`
|
|
72
88
|
position: absolute;
|
|
73
89
|
right: 0;
|
|
@@ -77,8 +93,8 @@ const StyledDropDownButton = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
|
77
93
|
z-index: 1;
|
|
78
94
|
`;
|
|
79
95
|
const StyledSelect = (0, import_ds_system.styled)("select", {
|
|
80
|
-
name:
|
|
81
|
-
slot:
|
|
96
|
+
name: import_constants.DSNativeSelectName,
|
|
97
|
+
slot: import_constants.NATIVE_SELECT_SLOTS.INPUT
|
|
82
98
|
})`
|
|
83
99
|
height: 28px;
|
|
84
100
|
appearance: none;
|
package/dist/cjs/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styled.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled, css } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA4B;AAC5B,qBAAqB;AACrB,
|
|
4
|
+
"sourcesContent": ["import { styled, css } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSNativeSelectName, NATIVE_SELECT_SLOTS } from './constants/index.js';\n\ninterface StyledControlsWrapperT {\n hasError: boolean;\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n}\n\n// Border precedence matches packages/forms/ds-form-input-text/src/styled/borders.ts:\n// disabled \u2192 focus (pseudo) \u2192 hasError \u2192 locked (applyAriaDisabled | readOnly) \u2192 normal\nconst disabledBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.neutral[400]};\n`;\n\nconst errorBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.danger[900]};\n`;\n\nconst lockedBorder = css`\n background-color: ${({ theme }) => theme.colors.neutral['050']};\n border: 1px solid ${({ theme }) => theme.colors.neutral['080']};\n border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};\n`;\n\nconst normalBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.neutral[400]};\n`;\n\nconst focusBorder = css`\n outline: 2px solid ${({ theme }) => theme.colors.brand[700]};\n outline-offset: -2px;\n`;\n\nconst hoverBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.brand[700]};\n`;\n\nexport const StyledControlsWrapper = styled(Grid, {\n name: DSNativeSelectName,\n slot: NATIVE_SELECT_SLOTS.CONTAINER,\n})<StyledControlsWrapperT>`\n background: ${({ disabled, theme }) => (disabled ? theme.colors.neutral['080'] : '#ffffff')};\n position: relative;\n border-radius: 2px;\n align-items: center;\n align-content: center;\n height: 28px;\n ${({ disabled, hasError, applyAriaDisabled, readOnly }) => {\n if (disabled) return disabledBorder;\n if (hasError) return errorBorder;\n if (applyAriaDisabled || readOnly) return lockedBorder;\n return normalBorder;\n }}\n &:hover {\n ${({ disabled, applyAriaDisabled, readOnly }) => (!disabled && !applyAriaDisabled && !readOnly ? hoverBorder : '')}\n }\n &:focus-within {\n ${focusBorder}\n }\n`;\n\nexport const StyledDropDownButton = styled(Grid, {\n name: DSNativeSelectName,\n slot: NATIVE_SELECT_SLOTS.DROP_INDICATOR,\n})`\n position: absolute;\n right: 0;\n height: 100%;\n cursor: pointer;\n width: 28px;\n z-index: 1;\n`;\n\nexport const StyledSelect = styled('select', {\n name: DSNativeSelectName,\n slot: NATIVE_SELECT_SLOTS.INPUT,\n})`\n height: 28px;\n appearance: none;\n background-color: transparent;\n border: none;\n color: ${({ theme }) => theme.colors.neutral['700']};\n cursor: pointer;\n outline: none;\n padding: 0;\n width: 100%;\n text-align: left;\n &:disabled {\n color: ${({ theme }) => theme.colors.neutral['400']};\n cursor: not-allowed;\n }\n z-index: 2;\n padding-left: 8px;\n padding-right: 28px;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA4B;AAC5B,qBAAqB;AACrB,uBAAwD;AAWxD,MAAM,iBAAiB;AAAA,sBACD,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAG9D,MAAM,cAAc;AAAA,sBACE,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA;AAG7D,MAAM,eAAe;AAAA,sBACC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,sBAC1C,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,6BACnC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAGrE,MAAM,eAAe;AAAA,sBACC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAG9D,MAAM,cAAc;AAAA,uBACG,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAI7D,MAAM,cAAc;AAAA,sBACE,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAGrD,MAAM,4BAAwB,yBAAO,qBAAM;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA,gBACe,CAAC,EAAE,UAAU,MAAM,MAAO,WAAW,MAAM,OAAO,QAAQ,KAAK,IAAI,SAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMzF,CAAC,EAAE,UAAU,UAAU,mBAAmB,SAAS,MAAM;AACzD,MAAI,SAAU,QAAO;AACrB,MAAI,SAAU,QAAO;AACrB,MAAI,qBAAqB,SAAU,QAAO;AAC1C,SAAO;AACT,CAAC;AAAA;AAAA,MAEG,CAAC,EAAE,UAAU,mBAAmB,SAAS,MAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,WAAW,cAAc,EAAG;AAAA;AAAA;AAAA,MAGhH,WAAW;AAAA;AAAA;AAIV,MAAM,2BAAuB,yBAAO,qBAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASM,MAAM,mBAAe,yBAAO,UAAU;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,qCAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,WAKU,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAOxC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/NativeSelect.js
CHANGED
|
@@ -1,50 +1,75 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback } from "react";
|
|
3
|
+
import { useCallback, useRef } from "react";
|
|
4
4
|
import { ChevronSmallDown } from "@elliemae/ds-icons";
|
|
5
5
|
import {
|
|
6
6
|
useGetGlobalAttributes,
|
|
7
|
-
globalAttributesPropTypes,
|
|
8
|
-
xstyledPropTypes,
|
|
9
7
|
useGetXstyledProps,
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
useMemoMergePropsWithDefault,
|
|
9
|
+
describe
|
|
12
10
|
} from "@elliemae/ds-props-helpers";
|
|
13
11
|
import { StyledControlsWrapper, StyledDropDownButton, StyledSelect } from "./styled.js";
|
|
14
|
-
|
|
15
|
-
...globalAttributesPropTypes,
|
|
16
|
-
...xstyledPropTypes,
|
|
17
|
-
hasError: PropTypes.bool.description("whether the input has an error").defaultValue(false),
|
|
18
|
-
disabled: PropTypes.bool.description("whether the input is disabled").defaultValue(false),
|
|
19
|
-
children: PropTypes.node.description("options to be rendered in the select")
|
|
20
|
-
};
|
|
12
|
+
import { DSNativeSelectPropTypesSchema, defaultProps } from "./react-desc-prop-types.js";
|
|
21
13
|
const DSNativeSelect = (props) => {
|
|
22
|
-
const { hasError, disabled, children } = props;
|
|
14
|
+
const { hasError, disabled, applyAriaDisabled, readOnly, children } = useMemoMergePropsWithDefault(props, defaultProps);
|
|
15
|
+
const isLocked = applyAriaDisabled || readOnly;
|
|
16
|
+
const userOnChangeRef = useRef(props.onChange);
|
|
17
|
+
userOnChangeRef.current = props.onChange;
|
|
18
|
+
const handleOnChange = useCallback(
|
|
19
|
+
(e) => {
|
|
20
|
+
if (isLocked) return;
|
|
21
|
+
userOnChangeRef.current?.(e);
|
|
22
|
+
},
|
|
23
|
+
[isLocked]
|
|
24
|
+
);
|
|
23
25
|
const getOwnerProps = useCallback(() => props, [props]);
|
|
24
26
|
const getOwnerPropsArguments = useCallback(() => ({}), []);
|
|
25
27
|
const xStyledProps = useGetXstyledProps(props);
|
|
26
|
-
const { id, required, size, ...globalAttributes } = useGetGlobalAttributes(
|
|
27
|
-
|
|
28
|
+
const { id, required, size, ...globalAttributes } = useGetGlobalAttributes(props);
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
30
|
+
StyledControlsWrapper,
|
|
31
|
+
{
|
|
32
|
+
disabled,
|
|
33
|
+
hasError,
|
|
34
|
+
applyAriaDisabled,
|
|
35
|
+
readOnly,
|
|
36
|
+
...xStyledProps,
|
|
37
|
+
...globalAttributes,
|
|
38
|
+
onChange: handleOnChange,
|
|
39
|
+
getOwnerProps,
|
|
40
|
+
getOwnerPropsArguments,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
StyledSelect,
|
|
44
|
+
{
|
|
45
|
+
id,
|
|
46
|
+
disabled,
|
|
47
|
+
required,
|
|
48
|
+
size,
|
|
49
|
+
"aria-invalid": hasError,
|
|
50
|
+
"aria-disabled": isLocked,
|
|
51
|
+
getOwnerProps,
|
|
52
|
+
getOwnerPropsArguments,
|
|
53
|
+
children
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
StyledDropDownButton,
|
|
58
|
+
{
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
getOwnerProps,
|
|
62
|
+
getOwnerPropsArguments,
|
|
63
|
+
children: /* @__PURE__ */ jsx(ChevronSmallDown, {})
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
]
|
|
67
|
+
}
|
|
28
68
|
);
|
|
29
|
-
return /* @__PURE__ */ jsxs(StyledControlsWrapper, { disabled, hasError, ...xStyledProps, ...globalAttributes, children: [
|
|
30
|
-
/* @__PURE__ */ jsx(
|
|
31
|
-
StyledSelect,
|
|
32
|
-
{
|
|
33
|
-
id,
|
|
34
|
-
disabled,
|
|
35
|
-
required,
|
|
36
|
-
size,
|
|
37
|
-
getOwnerProps,
|
|
38
|
-
getOwnerPropsArguments,
|
|
39
|
-
children
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
/* @__PURE__ */ jsx(StyledDropDownButton, { justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx(ChevronSmallDown, {}) })
|
|
43
|
-
] });
|
|
44
69
|
};
|
|
45
70
|
DSNativeSelect.displayName = "DSNativeSelect";
|
|
46
71
|
const DSNativeSelectWithSchema = describe(DSNativeSelect);
|
|
47
|
-
DSNativeSelectWithSchema.propTypes =
|
|
72
|
+
DSNativeSelectWithSchema.propTypes = DSNativeSelectPropTypesSchema;
|
|
48
73
|
export {
|
|
49
74
|
DSNativeSelect,
|
|
50
75
|
DSNativeSelectWithSchema
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/NativeSelect.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useCallback, useRef } from 'react';\nimport { ChevronSmallDown } from '@elliemae/ds-icons';\nimport {\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n describe,\n} from '@elliemae/ds-props-helpers';\nimport type { DSGridT } from '@elliemae/ds-grid';\nimport { StyledControlsWrapper, StyledDropDownButton, StyledSelect } from './styled.js';\nimport { type DSNativeSelectT, DSNativeSelectPropTypesSchema, defaultProps } from './react-desc-prop-types.js';\n\nconst DSNativeSelect: React.ComponentType<DSNativeSelectT.Props> = (props) => {\n const { hasError, disabled, applyAriaDisabled, readOnly, children } =\n useMemoMergePropsWithDefault<DSNativeSelectT.InternalProps>(props, defaultProps);\n\n const isLocked = applyAriaDisabled || readOnly;\n\n // Ref pattern mirrors ds-form-input-text/src/config/useInputText.ts:\n // gate the consumer onChange while locked, but always invoke the latest\n // user handler without recreating the wrapper when the consumer's handler is unmemoised.\n const userOnChangeRef = useRef(props.onChange);\n userOnChangeRef.current = props.onChange;\n const handleOnChange = useCallback(\n (e: React.FormEvent<HTMLDivElement>) => {\n if (isLocked) return;\n userOnChangeRef.current?.(e);\n },\n [isLocked],\n );\n\n const getOwnerProps = useCallback(() => props, [props]);\n const getOwnerPropsArguments = useCallback(() => ({}), []);\n\n const xStyledProps = useGetXstyledProps(props);\n const { id, required, size, ...globalAttributes } = useGetGlobalAttributes<\n DSNativeSelectT.Props,\n HTMLDivElement,\n DSGridT.Props\n >(props);\n return (\n <StyledControlsWrapper\n disabled={disabled}\n hasError={hasError}\n applyAriaDisabled={applyAriaDisabled}\n readOnly={readOnly}\n {...xStyledProps}\n {...globalAttributes}\n onChange={handleOnChange}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledSelect\n id={id}\n disabled={disabled}\n required={required}\n size={size}\n aria-invalid={hasError}\n aria-disabled={isLocked}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {children}\n </StyledSelect>\n <StyledDropDownButton\n justifyContent=\"center\"\n alignItems=\"center\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <ChevronSmallDown />\n </StyledDropDownButton>\n </StyledControlsWrapper>\n );\n};\n\nDSNativeSelect.displayName = 'DSNativeSelect';\nconst DSNativeSelectWithSchema = describe(DSNativeSelect);\nDSNativeSelectWithSchema.propTypes = DSNativeSelectPropTypesSchema;\n\nexport { DSNativeSelect, DSNativeSelectWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACyCnB,SAWE,KAXF;AAzCJ,SAAgB,aAAa,cAAc;AAC3C,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,uBAAuB,sBAAsB,oBAAoB;AAC1E,SAA+B,+BAA+B,oBAAoB;AAElF,MAAM,iBAA6D,CAAC,UAAU;AAC5E,QAAM,EAAE,UAAU,UAAU,mBAAmB,UAAU,SAAS,IAChE,6BAA4D,OAAO,YAAY;AAEjF,QAAM,WAAW,qBAAqB;AAKtC,QAAM,kBAAkB,OAAO,MAAM,QAAQ;AAC7C,kBAAgB,UAAU,MAAM;AAChC,QAAM,iBAAiB;AAAA,IACrB,CAAC,MAAuC;AACtC,UAAI,SAAU;AACd,sBAAgB,UAAU,CAAC;AAAA,IAC7B;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,QAAM,gBAAgB,YAAY,MAAM,OAAO,CAAC,KAAK,CAAC;AACtD,QAAM,yBAAyB,YAAY,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzD,QAAM,eAAe,mBAAmB,KAAK;AAC7C,QAAM,EAAE,IAAI,UAAU,MAAM,GAAG,iBAAiB,IAAI,uBAIlD,KAAK;AACP,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,gBAAc;AAAA,YACd,iBAAe;AAAA,YACf;AAAA,YACA;AAAA,YAEC;AAAA;AAAA,QACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,gBAAe;AAAA,YACf,YAAW;AAAA,YACX;AAAA,YACA;AAAA,YAEA,8BAAC,oBAAiB;AAAA;AAAA,QACpB;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,eAAe,cAAc;AAC7B,MAAM,2BAA2B,SAAS,cAAc;AACxD,yBAAyB,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { slotObjectToDataTestIds } from "@elliemae/ds-system";
|
|
3
|
+
const DSNativeSelectName = "DSNativeselect";
|
|
4
|
+
const NATIVE_SELECT_SLOTS = {
|
|
5
|
+
CONTAINER: "root",
|
|
6
|
+
INPUT: "input",
|
|
7
|
+
DROP_INDICATOR: "drop-indicator"
|
|
8
|
+
};
|
|
9
|
+
const NATIVE_SELECT_DATA_TESTID = slotObjectToDataTestIds(DSNativeSelectName, NATIVE_SELECT_SLOTS);
|
|
10
|
+
export {
|
|
11
|
+
DSNativeSelectName,
|
|
12
|
+
NATIVE_SELECT_DATA_TESTID,
|
|
13
|
+
NATIVE_SELECT_SLOTS
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSNativeSelectName = 'DSNativeselect';\n\n// using ${component_name}_SLOTS convention to namespace & avoid errors on duplicate exports in aggregators\nexport const NATIVE_SELECT_SLOTS = {\n CONTAINER: 'root',\n INPUT: 'input',\n DROP_INDICATOR: 'drop-indicator',\n} as const;\n\n// using ${component_name}_DATA_TESTID convention to namespace & avoid errors on duplicate exports in aggregators\nexport const NATIVE_SELECT_DATA_TESTID = slotObjectToDataTestIds(DSNativeSelectName, NATIVE_SELECT_SLOTS);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAAA,EACjC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,gBAAgB;AAClB;AAGO,MAAM,4BAA4B,wBAAwB,oBAAoB,mBAAmB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
import { DSNativeSelect, DSNativeSelectWithSchema } from "./NativeSelect.js";
|
|
3
|
+
import { NATIVE_SELECT_SLOTS, NATIVE_SELECT_DATA_TESTID, DSNativeSelectName } from "./constants/index.js";
|
|
4
|
+
export {
|
|
5
|
+
DSNativeSelect,
|
|
6
|
+
DSNativeSelectName,
|
|
7
|
+
DSNativeSelectWithSchema,
|
|
8
|
+
NATIVE_SELECT_DATA_TESTID,
|
|
9
|
+
NATIVE_SELECT_SLOTS
|
|
10
|
+
};
|
|
3
11
|
//# 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.ts"],
|
|
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 { DSNativeSelect, DSNativeSelectWithSchema } from './NativeSelect.js';\nexport { type DSNativeSelectT } from './react-desc-prop-types.js';\nexport { NATIVE_SELECT_SLOTS, NATIVE_SELECT_DATA_TESTID, DSNativeSelectName } from './constants/index.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB,gCAAgC;AAEzD,SAAS,qBAAqB,2BAA2B,0BAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import {
|
|
3
|
+
getPropsPerSlotPropTypes,
|
|
4
|
+
globalAttributesPropTypes,
|
|
5
|
+
PropTypes,
|
|
6
|
+
xstyledPropTypes
|
|
7
|
+
} from "@elliemae/ds-props-helpers";
|
|
8
|
+
import { DSNativeSelectName, NATIVE_SELECT_SLOTS } from "./constants/index.js";
|
|
9
|
+
const defaultProps = {
|
|
10
|
+
hasError: false,
|
|
11
|
+
disabled: false,
|
|
12
|
+
applyAriaDisabled: false,
|
|
13
|
+
readOnly: false
|
|
14
|
+
};
|
|
15
|
+
const DSNativeSelectPropTypes = {
|
|
16
|
+
...getPropsPerSlotPropTypes(DSNativeSelectName, NATIVE_SELECT_SLOTS),
|
|
17
|
+
...globalAttributesPropTypes,
|
|
18
|
+
...xstyledPropTypes,
|
|
19
|
+
hasError: PropTypes.bool.description("whether the input has an error").defaultValue(false),
|
|
20
|
+
disabled: PropTypes.bool.description("whether the input is disabled").defaultValue(false),
|
|
21
|
+
applyAriaDisabled: PropTypes.bool.description(
|
|
22
|
+
"Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION"
|
|
23
|
+
).defaultValue(false),
|
|
24
|
+
readOnly: PropTypes.bool.description(
|
|
25
|
+
"Renders the select as aria-disabled (readonly is not a valid HTML attribute on <select>): focusable, blocks onChange, shows the two-tone locked border. Does not set the HTML readonly attribute."
|
|
26
|
+
).defaultValue(false),
|
|
27
|
+
children: PropTypes.node.description("options to be rendered in the select")
|
|
28
|
+
};
|
|
29
|
+
const DSNativeSelectPropTypesSchema = DSNativeSelectPropTypes;
|
|
30
|
+
export {
|
|
31
|
+
DSNativeSelectPropTypes,
|
|
32
|
+
DSNativeSelectPropTypesSchema,
|
|
33
|
+
defaultProps
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n PropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSNativeSelectName, NATIVE_SELECT_SLOTS } from './constants/index.js';\n\nexport declare namespace DSNativeSelectT {\n /**\n * Explicit function-form slot prop types \u2014 one entry per slot.\n * NOTE: SlotFunctionArguments is a known cross-cutting gap across the forms group\n * (see TODO_ENTROPY_REVIEW.md). This package acts as the reference implementation.\n */\n export type SlotFunctionArguments = {\n dsNativeselectRoot: () => object;\n dsNativeselectInput: () => object;\n dsNativeselectDropIndicator: () => object;\n };\n\n export interface RequiredProps {}\n\n export interface DefaultProps {\n hasError: boolean;\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n }\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSNativeSelectName, typeof NATIVE_SELECT_SLOTS> {\n children?: React.ReactNode;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSNativeSelectT.DefaultProps = {\n hasError: false,\n disabled: false,\n applyAriaDisabled: false,\n readOnly: false,\n};\n\nexport const DSNativeSelectPropTypes: DSPropTypesSchema<DSNativeSelectT.Props> = {\n ...getPropsPerSlotPropTypes(DSNativeSelectName, NATIVE_SELECT_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n hasError: PropTypes.bool.description('whether the input has an error').defaultValue(false),\n disabled: PropTypes.bool.description('whether the input is disabled').defaultValue(false),\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 readOnly: PropTypes.bool\n .description(\n 'Renders the select as aria-disabled (readonly is not a valid HTML attribute on <select>): focusable, blocks onChange, shows the two-tone locked border. Does not set the HTML readonly attribute.',\n )\n .defaultValue(false),\n children: PropTypes.node.description('options to be rendered in the select'),\n};\n\nexport const DSNativeSelectPropTypesSchema = DSNativeSelectPropTypes as unknown as ValidationMap<DSNativeSelectT.Props>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,oBAAoB,2BAA2B;AA2CjD,MAAM,eAA6C;AAAA,EACxD,UAAU;AAAA,EACV,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,UAAU;AACZ;AAEO,MAAM,0BAAoE;AAAA,EAC/E,GAAG,yBAAyB,oBAAoB,mBAAmB;AAAA,EACnE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,UAAU,UAAU,KAAK,YAAY,gCAAgC,EAAE,aAAa,KAAK;AAAA,EACzF,UAAU,UAAU,KAAK,YAAY,+BAA+B,EAAE,aAAa,KAAK;AAAA,EACxF,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,UAAU,UAAU,KACjB;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AAAA,EACrB,UAAU,UAAU,KAAK,YAAY,sCAAsC;AAC7E;AAEO,MAAM,gCAAgC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/styled.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { styled, css } from "@elliemae/ds-system";
|
|
3
3
|
import { Grid } from "@elliemae/ds-grid";
|
|
4
|
-
import {
|
|
4
|
+
import { DSNativeSelectName, NATIVE_SELECT_SLOTS } from "./constants/index.js";
|
|
5
|
+
const disabledBorder = css`
|
|
6
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral[400]};
|
|
7
|
+
`;
|
|
8
|
+
const errorBorder = css`
|
|
9
|
+
border: 1px solid ${({ theme }) => theme.colors.danger[900]};
|
|
10
|
+
`;
|
|
11
|
+
const lockedBorder = css`
|
|
12
|
+
background-color: ${({ theme }) => theme.colors.neutral["050"]};
|
|
13
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral["080"]};
|
|
14
|
+
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};
|
|
15
|
+
`;
|
|
5
16
|
const normalBorder = css`
|
|
6
|
-
border: 1px solid ${({
|
|
17
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral[400]};
|
|
7
18
|
`;
|
|
8
19
|
const focusBorder = css`
|
|
9
20
|
outline: 2px solid ${({ theme }) => theme.colors.brand[700]};
|
|
@@ -14,7 +25,7 @@ const hoverBorder = css`
|
|
|
14
25
|
`;
|
|
15
26
|
const StyledControlsWrapper = styled(Grid, {
|
|
16
27
|
name: DSNativeSelectName,
|
|
17
|
-
slot:
|
|
28
|
+
slot: NATIVE_SELECT_SLOTS.CONTAINER
|
|
18
29
|
})`
|
|
19
30
|
background: ${({ disabled, theme }) => disabled ? theme.colors.neutral["080"] : "#ffffff"};
|
|
20
31
|
position: relative;
|
|
@@ -22,9 +33,14 @@ const StyledControlsWrapper = styled(Grid, {
|
|
|
22
33
|
align-items: center;
|
|
23
34
|
align-content: center;
|
|
24
35
|
height: 28px;
|
|
25
|
-
${
|
|
36
|
+
${({ disabled, hasError, applyAriaDisabled, readOnly }) => {
|
|
37
|
+
if (disabled) return disabledBorder;
|
|
38
|
+
if (hasError) return errorBorder;
|
|
39
|
+
if (applyAriaDisabled || readOnly) return lockedBorder;
|
|
40
|
+
return normalBorder;
|
|
41
|
+
}}
|
|
26
42
|
&:hover {
|
|
27
|
-
${({ disabled }) => !disabled ? hoverBorder : ""}
|
|
43
|
+
${({ disabled, applyAriaDisabled, readOnly }) => !disabled && !applyAriaDisabled && !readOnly ? hoverBorder : ""}
|
|
28
44
|
}
|
|
29
45
|
&:focus-within {
|
|
30
46
|
${focusBorder}
|
|
@@ -32,7 +48,7 @@ const StyledControlsWrapper = styled(Grid, {
|
|
|
32
48
|
`;
|
|
33
49
|
const StyledDropDownButton = styled(Grid, {
|
|
34
50
|
name: DSNativeSelectName,
|
|
35
|
-
slot:
|
|
51
|
+
slot: NATIVE_SELECT_SLOTS.DROP_INDICATOR
|
|
36
52
|
})`
|
|
37
53
|
position: absolute;
|
|
38
54
|
right: 0;
|
|
@@ -43,7 +59,7 @@ const StyledDropDownButton = styled(Grid, {
|
|
|
43
59
|
`;
|
|
44
60
|
const StyledSelect = styled("select", {
|
|
45
61
|
name: DSNativeSelectName,
|
|
46
|
-
slot:
|
|
62
|
+
slot: NATIVE_SELECT_SLOTS.INPUT
|
|
47
63
|
})`
|
|
48
64
|
height: 28px;
|
|
49
65
|
appearance: none;
|
package/dist/esm/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,WAAW;AAC5B,SAAS,YAAY;AACrB,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled, css } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSNativeSelectName, NATIVE_SELECT_SLOTS } from './constants/index.js';\n\ninterface StyledControlsWrapperT {\n hasError: boolean;\n disabled: boolean;\n applyAriaDisabled: boolean;\n readOnly: boolean;\n}\n\n// Border precedence matches packages/forms/ds-form-input-text/src/styled/borders.ts:\n// disabled \u2192 focus (pseudo) \u2192 hasError \u2192 locked (applyAriaDisabled | readOnly) \u2192 normal\nconst disabledBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.neutral[400]};\n`;\n\nconst errorBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.danger[900]};\n`;\n\nconst lockedBorder = css`\n background-color: ${({ theme }) => theme.colors.neutral['050']};\n border: 1px solid ${({ theme }) => theme.colors.neutral['080']};\n border-bottom: 1px solid ${({ theme }) => theme.colors.neutral[400]};\n`;\n\nconst normalBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.neutral[400]};\n`;\n\nconst focusBorder = css`\n outline: 2px solid ${({ theme }) => theme.colors.brand[700]};\n outline-offset: -2px;\n`;\n\nconst hoverBorder = css`\n border: 1px solid ${({ theme }) => theme.colors.brand[700]};\n`;\n\nexport const StyledControlsWrapper = styled(Grid, {\n name: DSNativeSelectName,\n slot: NATIVE_SELECT_SLOTS.CONTAINER,\n})<StyledControlsWrapperT>`\n background: ${({ disabled, theme }) => (disabled ? theme.colors.neutral['080'] : '#ffffff')};\n position: relative;\n border-radius: 2px;\n align-items: center;\n align-content: center;\n height: 28px;\n ${({ disabled, hasError, applyAriaDisabled, readOnly }) => {\n if (disabled) return disabledBorder;\n if (hasError) return errorBorder;\n if (applyAriaDisabled || readOnly) return lockedBorder;\n return normalBorder;\n }}\n &:hover {\n ${({ disabled, applyAriaDisabled, readOnly }) => (!disabled && !applyAriaDisabled && !readOnly ? hoverBorder : '')}\n }\n &:focus-within {\n ${focusBorder}\n }\n`;\n\nexport const StyledDropDownButton = styled(Grid, {\n name: DSNativeSelectName,\n slot: NATIVE_SELECT_SLOTS.DROP_INDICATOR,\n})`\n position: absolute;\n right: 0;\n height: 100%;\n cursor: pointer;\n width: 28px;\n z-index: 1;\n`;\n\nexport const StyledSelect = styled('select', {\n name: DSNativeSelectName,\n slot: NATIVE_SELECT_SLOTS.INPUT,\n})`\n height: 28px;\n appearance: none;\n background-color: transparent;\n border: none;\n color: ${({ theme }) => theme.colors.neutral['700']};\n cursor: pointer;\n outline: none;\n padding: 0;\n width: 100%;\n text-align: left;\n &:disabled {\n color: ${({ theme }) => theme.colors.neutral['400']};\n cursor: not-allowed;\n }\n z-index: 2;\n padding-left: 8px;\n padding-right: 28px;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,QAAQ,WAAW;AAC5B,SAAS,YAAY;AACrB,SAAS,oBAAoB,2BAA2B;AAWxD,MAAM,iBAAiB;AAAA,sBACD,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAG9D,MAAM,cAAc;AAAA,sBACE,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,OAAO,GAAG,CAAC;AAAA;AAG7D,MAAM,eAAe;AAAA,sBACC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,sBAC1C,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA,6BACnC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAGrE,MAAM,eAAe;AAAA,sBACC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAG9D,MAAM,cAAc;AAAA,uBACG,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAAA;AAI7D,MAAM,cAAc;AAAA,sBACE,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG,CAAC;AAAA;AAGrD,MAAM,wBAAwB,OAAO,MAAM;AAAA,EAChD,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA,gBACe,CAAC,EAAE,UAAU,MAAM,MAAO,WAAW,MAAM,OAAO,QAAQ,KAAK,IAAI,SAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMzF,CAAC,EAAE,UAAU,UAAU,mBAAmB,SAAS,MAAM;AACzD,MAAI,SAAU,QAAO;AACrB,MAAI,SAAU,QAAO;AACrB,MAAI,qBAAqB,SAAU,QAAO;AAC1C,SAAO;AACT,CAAC;AAAA;AAAA,MAEG,CAAC,EAAE,UAAU,mBAAmB,SAAS,MAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,WAAW,cAAc,EAAG;AAAA;AAAA;AAAA,MAGhH,WAAW;AAAA;AAAA;AAIV,MAAM,uBAAuB,OAAO,MAAM;AAAA,EAC/C,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASM,MAAM,eAAe,OAAO,UAAU;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,oBAAoB;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,WAKU,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAOxC,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
declare const DSNativeSelect: React.ComponentType<Props>;
|
|
8
|
-
declare const DSNativeSelectWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<Props>;
|
|
2
|
+
import { type DSNativeSelectT } from './react-desc-prop-types.js';
|
|
3
|
+
declare const DSNativeSelect: React.ComponentType<DSNativeSelectT.Props>;
|
|
4
|
+
declare const DSNativeSelectWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSNativeSelectT.Props>;
|
|
9
5
|
export { DSNativeSelect, DSNativeSelectWithSchema };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const DSNativeSelectName = "DSNativeselect";
|
|
2
|
+
export declare const NATIVE_SELECT_SLOTS: {
|
|
3
|
+
readonly CONTAINER: "root";
|
|
4
|
+
readonly INPUT: "input";
|
|
5
|
+
readonly DROP_INDICATOR: "drop-indicator";
|
|
6
|
+
};
|
|
7
|
+
export declare const NATIVE_SELECT_DATA_TESTID: {
|
|
8
|
+
readonly CONTAINER: "ds-nativeselect-root";
|
|
9
|
+
readonly INPUT: "ds-nativeselect-input";
|
|
10
|
+
readonly DROP_INDICATOR: "ds-nativeselect-drop-indicator";
|
|
11
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { DSNativeSelect, DSNativeSelectWithSchema } from './NativeSelect.js';
|
|
2
|
+
export { type DSNativeSelectT } from './react-desc-prop-types.js';
|
|
3
|
+
export { NATIVE_SELECT_SLOTS, NATIVE_SELECT_DATA_TESTID, DSNativeSelectName } from './constants/index.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { DSPropTypesSchema, GlobalAttributesT, ValidationMap, XstyledProps } from '@elliemae/ds-props-helpers';
|
|
3
|
+
import { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';
|
|
4
|
+
import { DSNativeSelectName, NATIVE_SELECT_SLOTS } from './constants/index.js';
|
|
5
|
+
export declare namespace DSNativeSelectT {
|
|
6
|
+
/**
|
|
7
|
+
* Explicit function-form slot prop types — one entry per slot.
|
|
8
|
+
* NOTE: SlotFunctionArguments is a known cross-cutting gap across the forms group
|
|
9
|
+
* (see TODO_ENTROPY_REVIEW.md). This package acts as the reference implementation.
|
|
10
|
+
*/
|
|
11
|
+
type SlotFunctionArguments = {
|
|
12
|
+
dsNativeselectRoot: () => object;
|
|
13
|
+
dsNativeselectInput: () => object;
|
|
14
|
+
dsNativeselectDropIndicator: () => object;
|
|
15
|
+
};
|
|
16
|
+
interface RequiredProps {
|
|
17
|
+
}
|
|
18
|
+
interface DefaultProps {
|
|
19
|
+
hasError: boolean;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
applyAriaDisabled: boolean;
|
|
22
|
+
readOnly: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSNativeSelectName, typeof NATIVE_SELECT_SLOTS> {
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>, XstyledProps, RequiredProps {
|
|
28
|
+
}
|
|
29
|
+
interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT<HTMLElement>, keyof DefaultProps | keyof XstyledProps>, XstyledProps, RequiredProps {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export declare const defaultProps: DSNativeSelectT.DefaultProps;
|
|
33
|
+
export declare const DSNativeSelectPropTypes: DSPropTypesSchema<DSNativeSelectT.Props>;
|
|
34
|
+
export declare const DSNativeSelectPropTypesSchema: ValidationMap<DSNativeSelectT.Props>;
|
package/dist/types/styled.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
interface StyledControlsWrapperT {
|
|
2
2
|
hasError: boolean;
|
|
3
3
|
disabled: boolean;
|
|
4
|
+
applyAriaDisabled: boolean;
|
|
5
|
+
readOnly: boolean;
|
|
4
6
|
}
|
|
5
7
|
export declare const StyledControlsWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, StyledControlsWrapperT & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>;
|
|
6
8
|
export declare const StyledDropDownButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-system").Theme, object & import("@elliemae/ds-system").OwnerInterface & import("@elliemae/ds-system").InnerRefInterface<import("react").ForwardRefExoticComponent<import("@elliemae/ds-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>>, never>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-native-select",
|
|
3
|
-
"version": "3.70.0-next.
|
|
3
|
+
"version": "3.70.0-next.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Form Native Select",
|
|
6
6
|
"files": [
|
|
@@ -36,17 +36,18 @@
|
|
|
36
36
|
"indent": 4
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@elliemae/ds-grid": "3.70.0-next.
|
|
40
|
-
"@elliemae/ds-
|
|
41
|
-
"@elliemae/ds-
|
|
42
|
-
"@elliemae/ds-
|
|
39
|
+
"@elliemae/ds-grid": "3.70.0-next.16",
|
|
40
|
+
"@elliemae/ds-icons": "3.70.0-next.16",
|
|
41
|
+
"@elliemae/ds-system": "3.70.0-next.16",
|
|
42
|
+
"@elliemae/ds-props-helpers": "3.70.0-next.16",
|
|
43
|
+
"@elliemae/ds-typescript-helpers": "3.70.0-next.16"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@elliemae/pui-theme": "~2.13.0",
|
|
46
47
|
"jest": "^30.0.0",
|
|
47
48
|
"styled-components": "~5.3.9",
|
|
48
49
|
"styled-system": "^5.1.5",
|
|
49
|
-
"@elliemae/ds-monorepo-devops": "3.70.0-next.
|
|
50
|
+
"@elliemae/ds-monorepo-devops": "3.70.0-next.16"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"@elliemae/pui-theme": "~2.13.0",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/NativeSelectDefinitions.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const DSNativeSelectName = 'DSNativeselect';\n\nexport const DSNativeSelectSlots = {\n CONTAINER: 'root',\n INPUT: 'input',\n DROP_INDICATOR: 'drop-indicator',\n} as const;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,qBAAqB;AAE3B,MAAM,sBAAsB;AAAA,EACjC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,gBAAgB;AAClB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
const DSNativeSelectName = "DSNativeselect";
|
|
3
|
-
const DSNativeSelectSlots = {
|
|
4
|
-
CONTAINER: "root",
|
|
5
|
-
INPUT: "input",
|
|
6
|
-
DROP_INDICATOR: "drop-indicator"
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
DSNativeSelectName,
|
|
10
|
-
DSNativeSelectSlots
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=NativeSelectDefinitions.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/NativeSelectDefinitions.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSNativeSelectName = 'DSNativeselect';\n\nexport const DSNativeSelectSlots = {\n CONTAINER: 'root',\n INPUT: 'input',\n DROP_INDICATOR: 'drop-indicator',\n} as const;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,qBAAqB;AAE3B,MAAM,sBAAsB;AAAA,EACjC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,gBAAgB;AAClB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|