@mirai/ui 1.0.252 → 1.0.254
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/build/components/InputPhone/InputPhone.js +15 -12
- package/build/components/InputPhone/InputPhone.js.map +1 -1
- package/build/components/InputPhone/InputPhone.module.css +1 -6
- package/build/components/InputPhone/__tests__/__snapshots__/InputPhone.test.js.snap +17 -17
- package/build/components/InputSelect/InputSelect.js +2 -4
- package/build/components/InputSelect/InputSelect.js.map +1 -1
- package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +11 -11
- package/build/components/InputSelect/partials/InputSelect.Expand.js +23 -0
- package/build/components/InputSelect/partials/InputSelect.Expand.js.map +1 -0
- package/build/components/InputSelect/partials/index.js +17 -0
- package/build/components/InputSelect/partials/index.js.map +1 -0
- package/build/components/InputText/InputText.module.css +10 -3
- package/package.json +1 -1
|
@@ -9,8 +9,10 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _helpers = require("../../helpers");
|
|
11
11
|
var _primitives = require("../../primitives");
|
|
12
|
+
var _theme = require("../../theme");
|
|
13
|
+
var _partials = require("../InputSelect/partials");
|
|
12
14
|
var _InputTextModule = _interopRequireDefault(require("../InputText/InputText.module.css"));
|
|
13
|
-
var
|
|
15
|
+
var _partials2 = require("../InputText/partials");
|
|
14
16
|
var _helpers2 = require("./helpers");
|
|
15
17
|
var _InputPhoneModule = _interopRequireDefault(require("./InputPhone.module.css"));
|
|
16
18
|
var _excluded = ["disabled", "error", "hint", "icon", "label", "labelPrefix", "name", "prefixes", "showRequired", "showState", "success", "value", "warning", "onChange", "onEnter", "onError", "onLeave"];
|
|
@@ -52,6 +54,7 @@ var InputPhone = function InputPhone(_ref) {
|
|
|
52
54
|
_ref$onLeave = _ref.onLeave,
|
|
53
55
|
onLeave = _ref$onLeave === void 0 ? function () {} : _ref$onLeave,
|
|
54
56
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
57
|
+
var direction = _theme.Theme.getDirection();
|
|
55
58
|
var _useState = (0, _react.useState)(false),
|
|
56
59
|
_useState2 = _slicedToArray(_useState, 2),
|
|
57
60
|
focus = _useState2[0],
|
|
@@ -117,6 +120,7 @@ var InputPhone = function InputPhone(_ref) {
|
|
|
117
120
|
stateIcon: showState && (error || success || warning)
|
|
118
121
|
};
|
|
119
122
|
var testId = others.testId;
|
|
123
|
+
var prefixDirection = direction === _theme.DIRECTION_TYPE.RIGHT ? '' : '';
|
|
120
124
|
return /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
121
125
|
role: others.role || 'input-phone',
|
|
122
126
|
className: (0, _helpers.styles)(_InputPhoneModule.default.container, others.className),
|
|
@@ -127,8 +131,8 @@ var InputPhone = function InputPhone(_ref) {
|
|
|
127
131
|
}, hasPrefixes && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
128
132
|
row: true
|
|
129
133
|
}, /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
130
|
-
className:
|
|
131
|
-
}, labelPrefix && /*#__PURE__*/_react.default.createElement(
|
|
134
|
+
className: _InputTextModule.default.content
|
|
135
|
+
}, labelPrefix && /*#__PURE__*/_react.default.createElement(_partials2.Label, {
|
|
132
136
|
disabled: disabled,
|
|
133
137
|
error: error,
|
|
134
138
|
focus: prefixFocus,
|
|
@@ -136,10 +140,12 @@ var InputPhone = function InputPhone(_ref) {
|
|
|
136
140
|
value: prefix
|
|
137
141
|
}), prefix && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
138
142
|
className: _InputPhoneModule.default.prefixValue
|
|
139
|
-
}, prefix), /*#__PURE__*/_react.default.createElement(_primitives.Select, _extends({}, others, {
|
|
143
|
+
}, prefixDirection, prefix), /*#__PURE__*/_react.default.createElement(_primitives.Select, _extends({}, others, {
|
|
140
144
|
disabled: disabled,
|
|
141
145
|
name: "".concat(name, "-prefix"),
|
|
142
|
-
options: prefixes
|
|
146
|
+
options: prefixes.map(function (prefix) {
|
|
147
|
+
return "".concat(prefixDirection).concat(prefix);
|
|
148
|
+
}),
|
|
143
149
|
values: (0, _helpers2.sanitizePrefixes)(prefixes),
|
|
144
150
|
style: undefined,
|
|
145
151
|
type: undefined,
|
|
@@ -161,10 +167,7 @@ var InputPhone = function InputPhone(_ref) {
|
|
|
161
167
|
},
|
|
162
168
|
className: (0, _helpers.styles)(_InputTextModule.default.input, _InputPhoneModule.default.prefix, has.labelPrefix && _InputTextModule.default.withLabel, has.labelPrefix && !(prefixFocus || error || has.prefix) && _InputTextModule.default.empty),
|
|
163
169
|
testId: testId ? "".concat(testId, "-select") : undefined
|
|
164
|
-
}))), !disabled && /*#__PURE__*/_react.default.createElement(_primitives.
|
|
165
|
-
value: _primitives.ICON.EXPAND_MORE,
|
|
166
|
-
className: (0, _helpers.styles)(_InputTextModule.default.icon, _InputTextModule.default.select, _InputPhoneModule.default.expand)
|
|
167
|
-
})), /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
170
|
+
}))), !disabled && /*#__PURE__*/_react.default.createElement(_partials.Expand, null)), /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
168
171
|
forceRow: true,
|
|
169
172
|
className: _InputPhoneModule.default.separator
|
|
170
173
|
})), /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
@@ -176,7 +179,7 @@ var InputPhone = function InputPhone(_ref) {
|
|
|
176
179
|
}), /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
177
180
|
wide: true,
|
|
178
181
|
className: _InputTextModule.default.content
|
|
179
|
-
}, label && /*#__PURE__*/_react.default.createElement(
|
|
182
|
+
}, label && /*#__PURE__*/_react.default.createElement(_partials2.Label, {
|
|
180
183
|
disabled: disabled,
|
|
181
184
|
error: error,
|
|
182
185
|
focus: focus,
|
|
@@ -200,11 +203,11 @@ var InputPhone = function InputPhone(_ref) {
|
|
|
200
203
|
},
|
|
201
204
|
className: (0, _helpers.styles)(_InputTextModule.default.input, has.label && _InputTextModule.default.withLabel),
|
|
202
205
|
testId: testId ? "".concat(testId, "-input") : undefined
|
|
203
|
-
})))), has.stateIcon && /*#__PURE__*/_react.default.createElement(
|
|
206
|
+
})))), has.stateIcon && /*#__PURE__*/_react.default.createElement(_partials2.IconState, {
|
|
204
207
|
error: error,
|
|
205
208
|
success: success,
|
|
206
209
|
warning: warning
|
|
207
|
-
})), hint && /*#__PURE__*/_react.default.createElement(
|
|
210
|
+
})), hint && /*#__PURE__*/_react.default.createElement(_partials2.Hint, {
|
|
208
211
|
disabled: disabled,
|
|
209
212
|
error: error,
|
|
210
213
|
hint: hint
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputPhone.js","names":["InputPhone","disabled","error","hint","icon","label","labelPrefix","name","prefixes","showRequired","showState","success","propValue","value","warning","onChange","onEnter","onError","onLeave","others","useState","focus","setFocus","prefixFocus","setPrefixFocus","parseValue","sanitizePrefixes","setValue","useEffect","getInputPhoneErrors","handleChange","next","event","isPhone","hasPrefixes","split","undefined","prefix","phone","nextValue","replace","join","trim","handleEnter","handleLeave","length","has","stateIcon","testId","role","styles","stylePhone","container","className","style","inputBorder","content","prefixValue","input","withLabel","empty","ICON","EXPAND_MORE","select","expand","separator","left","required","displayName","propTypes","PropTypes","bool","string","func","isRequired","arrayOf"],"sources":["../../../src/components/InputPhone/InputPhone.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { getInputPhoneErrors } from '../../helpers';\nimport { Icon, ICON, Input, Select, Text, View } from '../../primitives';\nimport style from '../InputText/InputText.module.css';\nimport { Hint, IconState, Label } from '../InputText/partials';\nimport { parseValue, sanitizePrefixes } from './helpers';\nimport stylePhone from './InputPhone.module.css';\n\nconst InputPhone = ({\n disabled,\n error,\n hint,\n icon,\n label,\n labelPrefix,\n name,\n prefixes = [],\n showRequired = false,\n showState = true,\n success,\n value: propValue,\n warning,\n onChange = () => {},\n onEnter = () => {},\n onError = () => {},\n onLeave = () => {},\n ...others\n}) => {\n const [focus, setFocus] = useState(false);\n const [prefixFocus, setPrefixFocus] = useState(false);\n const [value, setValue] = useState(parseValue(propValue, sanitizePrefixes(prefixes)));\n\n useEffect(() => {\n setValue(parseValue(propValue, sanitizePrefixes(prefixes)));\n }, [prefixes, propValue]);\n\n useEffect(() => {\n onError(getInputPhoneErrors({ prefixes: sanitizePrefixes(prefixes), value }));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [prefixes, value]);\n\n const handleChange = (next, event, { isPhone = true } = {}) => {\n const [prefix = '', phone = ''] = hasPrefixes ? value?.split(' ') || [] : [undefined, value];\n let nextValue = (isPhone ? [prefix, next?.replace(/[^\\d]/g, '')] : [next, phone]).join(' ');\n if (!hasPrefixes) nextValue = nextValue.trim();\n\n setValue(nextValue);\n onChange(nextValue, event);\n };\n\n const handleEnter = (event, { isPhone = true } = {}) => {\n isPhone ? setFocus(true) : setPrefixFocus(true);\n onEnter(event);\n };\n\n const handleLeave = (event, { isPhone = true } = {}) => {\n isPhone ? setFocus(false) : setPrefixFocus(false);\n onLeave(event);\n };\n\n const hasPrefixes = !!prefixes?.length;\n const [prefix, phone] = hasPrefixes ? value?.split(' ') || [] : [undefined, value];\n const has = {\n icon: !!icon,\n label: !!label,\n labelPrefix: !!labelPrefix,\n prefix: prefix?.length > 0,\n phone: phone?.length > 0,\n stateIcon: showState && (error || success || warning),\n };\n const { testId } = others;\n\n return (\n <View\n role={others.role || 'input-phone'}\n className={styles(stylePhone.container, others.className)}\n style={others.style}\n >\n <View\n row\n className={styles(\n style.inputBorder,\n disabled && style.disabled,\n error && style.error,\n (focus || prefixFocus) && !error && style.focus,\n )}\n >\n {hasPrefixes && (\n <>\n <View row>\n <View className={styles(style.content)}>\n {labelPrefix && (\n <Label {...{ disabled, error, focus: prefixFocus, label: labelPrefix, value: prefix }} />\n )}\n {prefix && <Text className={stylePhone.prefixValue}>{prefix}</Text>}\n <Select\n {...others}\n disabled={disabled}\n name={`${name}-prefix`}\n options={prefixes}\n values={sanitizePrefixes(prefixes)}\n style={undefined}\n type={undefined}\n value={prefix || ''}\n onChange={(value, event) => handleChange(value, event, { isPhone: false })}\n onEnter={(event) => handleEnter(event, { isPhone: false })}\n onLeave={(event) => handleLeave(event, { isPhone: false })}\n className={styles(\n style.input,\n stylePhone.prefix,\n has.labelPrefix && style.withLabel,\n has.labelPrefix && !(prefixFocus || error || has.prefix) && style.empty,\n )}\n testId={testId ? `${testId}-select` : undefined}\n />\n </View>\n {!disabled && (\n <Icon value={ICON.EXPAND_MORE} className={styles(style.icon, style.select, stylePhone.expand)} />\n )}\n </View>\n <View forceRow className={stylePhone.separator}></View>\n </>\n )}\n\n <View row wide>\n {has.icon && (\n <Icon\n value={icon}\n className={styles(style.icon, style.left, disabled && style.disabled, error && style.error)}\n />\n )}\n <View wide className={style.content}>\n {label && (\n <Label {...{ disabled, error, focus, label, required: showRequired && others.required, value: phone }} />\n )}\n <Input\n {...others}\n disabled={disabled}\n maxLength={12}\n name={`${name}-phone`}\n type=\"tel\"\n value={phone || ''}\n onChange={(value, event) => handleChange(value, event)}\n onEnter={(event) => handleEnter(event)}\n onLeave={(event) => handleLeave(event)}\n className={styles(style.input, has.label && style.withLabel)}\n testId={testId ? `${testId}-input` : undefined}\n />\n </View>\n </View>\n {has.stateIcon && <IconState {...{ error, success, warning }} />}\n </View>\n {hint && <Hint {...{ disabled, error, hint }} />}\n </View>\n );\n};\n\nInputPhone.displayName = 'Component:InputPhone';\n\nInputPhone.propTypes = {\n disabled: PropTypes.bool,\n error: PropTypes.bool,\n hint: PropTypes.string,\n icon: PropTypes.func,\n label: PropTypes.string,\n labelPrefix: PropTypes.string,\n name: PropTypes.string.isRequired,\n prefixes: PropTypes.arrayOf(PropTypes.string),\n showRequired: PropTypes.bool,\n showState: PropTypes.bool,\n success: PropTypes.bool,\n value: PropTypes.string,\n warning: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,SAAS,GAAG;EACrBpE,QAAQ,EAAEqE,kBAAS,CAACC,IAAI;EACxBrE,KAAK,EAAEoE,kBAAS,CAACC,IAAI;EACrBpE,IAAI,EAAEmE,kBAAS,CAACE,MAAM;EACtBpE,IAAI,EAAEkE,kBAAS,CAACG,IAAI;EACpBpE,KAAK,EAAEiE,kBAAS,CAACE,MAAM;EACvBlE,WAAW,EAAEgE,kBAAS,CAACE,MAAM;EAC7BjE,IAAI,EAAE+D,kBAAS,CAACE,MAAM,CAACE,UAAU;EACjClE,QAAQ,EAAE8D,kBAAS,CAACK,OAAO,CAACL,kBAAS,CAACE,MAAM,CAAC;EAC7C/D,YAAY,EAAE6D,kBAAS,CAACC,IAAI;EAC5B7D,SAAS,EAAE4D,kBAAS,CAACC,IAAI;EACzB5D,OAAO,EAAE2D,kBAAS,CAACC,IAAI;EACvB1D,KAAK,EAAEyD,kBAAS,CAACE,MAAM;EACvB1D,OAAO,EAAEwD,kBAAS,CAACC,IAAI;EACvBxD,QAAQ,EAAEuD,kBAAS,CAACG,IAAI;EACxBzD,OAAO,EAAEsD,kBAAS,CAACG,IAAI;EACvBxD,OAAO,EAAEqD,kBAAS,CAACG,IAAI;EACvBvD,OAAO,EAAEoD,kBAAS,CAACG;AACrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"InputPhone.js","names":["InputPhone","disabled","error","hint","icon","label","labelPrefix","name","prefixes","showRequired","showState","success","propValue","value","warning","onChange","onEnter","onError","onLeave","others","direction","Theme","getDirection","useState","focus","setFocus","prefixFocus","setPrefixFocus","parseValue","sanitizePrefixes","setValue","useEffect","getInputPhoneErrors","handleChange","next","event","isPhone","hasPrefixes","split","undefined","prefix","phone","nextValue","replace","join","trim","handleEnter","handleLeave","length","has","stateIcon","testId","prefixDirection","DIRECTION_TYPE","RIGHT","role","styles","stylePhone","container","className","style","inputBorder","content","prefixValue","map","input","withLabel","empty","separator","left","required","displayName","propTypes","PropTypes","bool","string","func","isRequired","arrayOf"],"sources":["../../../src/components/InputPhone/InputPhone.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { getInputPhoneErrors } from '../../helpers';\nimport { Icon, Input, Select, Text, View } from '../../primitives';\nimport { DIRECTION_TYPE, Theme } from '../../theme';\nimport { Expand } from '../InputSelect/partials';\nimport style from '../InputText/InputText.module.css';\nimport { Hint, IconState, Label } from '../InputText/partials';\nimport { parseValue, sanitizePrefixes } from './helpers';\nimport stylePhone from './InputPhone.module.css';\n\nconst InputPhone = ({\n disabled,\n error,\n hint,\n icon,\n label,\n labelPrefix,\n name,\n prefixes = [],\n showRequired = false,\n showState = true,\n success,\n value: propValue,\n warning,\n onChange = () => {},\n onEnter = () => {},\n onError = () => {},\n onLeave = () => {},\n ...others\n}) => {\n const direction = Theme.getDirection();\n\n const [focus, setFocus] = useState(false);\n const [prefixFocus, setPrefixFocus] = useState(false);\n const [value, setValue] = useState(parseValue(propValue, sanitizePrefixes(prefixes)));\n\n useEffect(() => {\n setValue(parseValue(propValue, sanitizePrefixes(prefixes)));\n }, [prefixes, propValue]);\n\n useEffect(() => {\n onError(getInputPhoneErrors({ prefixes: sanitizePrefixes(prefixes), value }));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [prefixes, value]);\n\n const handleChange = (next, event, { isPhone = true } = {}) => {\n const [prefix = '', phone = ''] = hasPrefixes ? value?.split(' ') || [] : [undefined, value];\n let nextValue = (isPhone ? [prefix, next?.replace(/[^\\d]/g, '')] : [next, phone]).join(' ');\n if (!hasPrefixes) nextValue = nextValue.trim();\n\n setValue(nextValue);\n onChange(nextValue, event);\n };\n\n const handleEnter = (event, { isPhone = true } = {}) => {\n isPhone ? setFocus(true) : setPrefixFocus(true);\n onEnter(event);\n };\n\n const handleLeave = (event, { isPhone = true } = {}) => {\n isPhone ? setFocus(false) : setPrefixFocus(false);\n onLeave(event);\n };\n\n const hasPrefixes = !!prefixes?.length;\n const [prefix, phone] = hasPrefixes ? value?.split(' ') || [] : [undefined, value];\n const has = {\n icon: !!icon,\n label: !!label,\n labelPrefix: !!labelPrefix,\n prefix: prefix?.length > 0,\n phone: phone?.length > 0,\n stateIcon: showState && (error || success || warning),\n };\n const { testId } = others;\n const prefixDirection = direction === DIRECTION_TYPE.RIGHT ? '' : '';\n\n return (\n <View\n role={others.role || 'input-phone'}\n className={styles(stylePhone.container, others.className)}\n style={others.style}\n >\n <View\n row\n className={styles(\n style.inputBorder,\n disabled && style.disabled,\n error && style.error,\n (focus || prefixFocus) && !error && style.focus,\n )}\n >\n {hasPrefixes && (\n <>\n <View row>\n <View className={style.content}>\n {labelPrefix && (\n <Label {...{ disabled, error, focus: prefixFocus, label: labelPrefix, value: prefix }} />\n )}\n {prefix && (\n <Text className={stylePhone.prefixValue}>\n {prefixDirection}\n {prefix}\n </Text>\n )}\n <Select\n {...others}\n disabled={disabled}\n name={`${name}-prefix`}\n options={prefixes.map((prefix) => `${prefixDirection}${prefix}`)}\n values={sanitizePrefixes(prefixes)}\n style={undefined}\n type={undefined}\n value={prefix || ''}\n onChange={(value, event) => handleChange(value, event, { isPhone: false })}\n onEnter={(event) => handleEnter(event, { isPhone: false })}\n onLeave={(event) => handleLeave(event, { isPhone: false })}\n className={styles(\n style.input,\n stylePhone.prefix,\n has.labelPrefix && style.withLabel,\n has.labelPrefix && !(prefixFocus || error || has.prefix) && style.empty,\n )}\n testId={testId ? `${testId}-select` : undefined}\n />\n </View>\n\n {!disabled && <Expand />}\n </View>\n <View forceRow className={stylePhone.separator}></View>\n </>\n )}\n\n <View row wide>\n {has.icon && (\n <Icon\n value={icon}\n className={styles(style.icon, style.left, disabled && style.disabled, error && style.error)}\n />\n )}\n <View wide className={style.content}>\n {label && (\n <Label {...{ disabled, error, focus, label, required: showRequired && others.required, value: phone }} />\n )}\n <Input\n {...others}\n disabled={disabled}\n maxLength={12}\n name={`${name}-phone`}\n type=\"tel\"\n value={phone || ''}\n onChange={(value, event) => handleChange(value, event)}\n onEnter={(event) => handleEnter(event)}\n onLeave={(event) => handleLeave(event)}\n className={styles(style.input, has.label && style.withLabel)}\n testId={testId ? `${testId}-input` : undefined}\n />\n </View>\n </View>\n {has.stateIcon && <IconState {...{ error, success, warning }} />}\n </View>\n {hint && <Hint {...{ disabled, error, hint }} />}\n </View>\n );\n};\n\nInputPhone.displayName = 'Component:InputPhone';\n\nInputPhone.propTypes = {\n disabled: PropTypes.bool,\n error: PropTypes.bool,\n hint: PropTypes.string,\n icon: PropTypes.func,\n label: PropTypes.string,\n labelPrefix: PropTypes.string,\n name: PropTypes.string.isRequired,\n prefixes: PropTypes.arrayOf(PropTypes.string),\n showRequired: PropTypes.bool,\n showState: PropTypes.bool,\n success: PropTypes.bool,\n value: PropTypes.string,\n warning: PropTypes.bool,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onError: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { InputPhone };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEjD,IAAMA,UAAU,GAAG,SAAbA,UAAU,OAmBV;EAAA,IAlBJC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,IAAI,QAAJA,IAAI;IACJC,IAAI,QAAJA,IAAI;IACJC,KAAK,QAALA,KAAK;IACLC,WAAW,QAAXA,WAAW;IACXC,IAAI,QAAJA,IAAI;IAAA,qBACJC,QAAQ;IAARA,QAAQ,8BAAG,EAAE;IAAA,yBACbC,YAAY;IAAZA,YAAY,kCAAG,KAAK;IAAA,sBACpBC,SAAS;IAATA,SAAS,+BAAG,IAAI;IAChBC,OAAO,QAAPA,OAAO;IACAC,SAAS,QAAhBC,KAAK;IACLC,OAAO,QAAPA,OAAO;IAAA,qBACPC,QAAQ;IAARA,QAAQ,8BAAG,YAAM,CAAC,CAAC;IAAA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EyD,kBAAS,CAACG,IAAI;EACvB3D,OAAO,EAAEwD,kBAAS,CAACG,IAAI;EACvB1D,OAAO,EAAEuD,kBAAS,CAACG;AACrB,CAAC"}
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
margin-bottom: var(--mirai-ui-input-text-padding-y);
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.expand {
|
|
6
|
-
padding-left: calc(var(--mirai-ui-input-text-padding-x) / 4);
|
|
7
|
-
padding-right: calc(var(--mirai-ui-input-text-padding-x) / 4);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
5
|
.prefix {
|
|
11
6
|
padding-right: 0;
|
|
12
7
|
width: calc(var(--mirai-ui-space-XXL) + var(--mirai-ui-space-XS));
|
|
@@ -23,7 +18,7 @@
|
|
|
23
18
|
left: calc(var(--mirai-ui-input-text-padding-x) / 2);
|
|
24
19
|
pointer-events: none;
|
|
25
20
|
position: absolute;
|
|
26
|
-
|
|
21
|
+
right: calc(var(--mirai-ui-input-text-padding-x) / 2);
|
|
27
22
|
|
|
28
23
|
appearance: none;
|
|
29
24
|
-webkit-appearance: none;
|
|
@@ -36,7 +36,7 @@ exports[`component:<InputPhone> inherit:className 1`] = `
|
|
|
36
36
|
</select>
|
|
37
37
|
</div>
|
|
38
38
|
<span
|
|
39
|
-
class="icon headline-3 icon
|
|
39
|
+
class="icon headline-3 icon expand expandLeft"
|
|
40
40
|
>
|
|
41
41
|
<svg
|
|
42
42
|
fill="currentColor"
|
|
@@ -178,7 +178,7 @@ exports[`component:<InputPhone> prop:error 1`] = `
|
|
|
178
178
|
</select>
|
|
179
179
|
</div>
|
|
180
180
|
<span
|
|
181
|
-
class="icon headline-3 icon
|
|
181
|
+
class="icon headline-3 icon expand expandLeft"
|
|
182
182
|
>
|
|
183
183
|
<svg
|
|
184
184
|
fill="currentColor"
|
|
@@ -280,7 +280,7 @@ exports[`component:<InputPhone> prop:hint 1`] = `
|
|
|
280
280
|
</select>
|
|
281
281
|
</div>
|
|
282
282
|
<span
|
|
283
|
-
class="icon headline-3 icon
|
|
283
|
+
class="icon headline-3 icon expand expandLeft"
|
|
284
284
|
>
|
|
285
285
|
<svg
|
|
286
286
|
fill="currentColor"
|
|
@@ -448,7 +448,7 @@ exports[`component:<InputPhone> prop:icon & error 1`] = `
|
|
|
448
448
|
</select>
|
|
449
449
|
</div>
|
|
450
450
|
<span
|
|
451
|
-
class="icon headline-3 icon
|
|
451
|
+
class="icon headline-3 icon expand expandLeft"
|
|
452
452
|
>
|
|
453
453
|
<svg
|
|
454
454
|
fill="currentColor"
|
|
@@ -571,7 +571,7 @@ exports[`component:<InputPhone> prop:icon 1`] = `
|
|
|
571
571
|
</select>
|
|
572
572
|
</div>
|
|
573
573
|
<span
|
|
574
|
-
class="icon headline-3 icon
|
|
574
|
+
class="icon headline-3 icon expand expandLeft"
|
|
575
575
|
>
|
|
576
576
|
<svg
|
|
577
577
|
fill="currentColor"
|
|
@@ -673,7 +673,7 @@ exports[`component:<InputPhone> prop:label 1`] = `
|
|
|
673
673
|
</select>
|
|
674
674
|
</div>
|
|
675
675
|
<span
|
|
676
|
-
class="icon headline-3 icon
|
|
676
|
+
class="icon headline-3 icon expand expandLeft"
|
|
677
677
|
>
|
|
678
678
|
<svg
|
|
679
679
|
fill="currentColor"
|
|
@@ -764,7 +764,7 @@ exports[`component:<InputPhone> prop:labelPrefix 1`] = `
|
|
|
764
764
|
</select>
|
|
765
765
|
</div>
|
|
766
766
|
<span
|
|
767
|
-
class="icon headline-3 icon
|
|
767
|
+
class="icon headline-3 icon expand expandLeft"
|
|
768
768
|
>
|
|
769
769
|
<svg
|
|
770
770
|
fill="currentColor"
|
|
@@ -851,7 +851,7 @@ exports[`component:<InputPhone> prop:required & prop:showRequired (true) 1`] = `
|
|
|
851
851
|
</select>
|
|
852
852
|
</div>
|
|
853
853
|
<span
|
|
854
|
-
class="icon headline-3 icon
|
|
854
|
+
class="icon headline-3 icon expand expandLeft"
|
|
855
855
|
>
|
|
856
856
|
<svg
|
|
857
857
|
fill="currentColor"
|
|
@@ -949,7 +949,7 @@ exports[`component:<InputPhone> prop:required 1`] = `
|
|
|
949
949
|
</select>
|
|
950
950
|
</div>
|
|
951
951
|
<span
|
|
952
|
-
class="icon headline-3 icon
|
|
952
|
+
class="icon headline-3 icon expand expandLeft"
|
|
953
953
|
>
|
|
954
954
|
<svg
|
|
955
955
|
fill="currentColor"
|
|
@@ -1036,7 +1036,7 @@ exports[`component:<InputPhone> prop:showState (false) & error 1`] = `
|
|
|
1036
1036
|
</select>
|
|
1037
1037
|
</div>
|
|
1038
1038
|
<span
|
|
1039
|
-
class="icon headline-3 icon
|
|
1039
|
+
class="icon headline-3 icon expand expandLeft"
|
|
1040
1040
|
>
|
|
1041
1041
|
<svg
|
|
1042
1042
|
fill="currentColor"
|
|
@@ -1138,7 +1138,7 @@ exports[`component:<InputPhone> prop:showState (false) & success 1`] = `
|
|
|
1138
1138
|
</select>
|
|
1139
1139
|
</div>
|
|
1140
1140
|
<span
|
|
1141
|
-
class="icon headline-3 icon
|
|
1141
|
+
class="icon headline-3 icon expand expandLeft"
|
|
1142
1142
|
>
|
|
1143
1143
|
<svg
|
|
1144
1144
|
fill="currentColor"
|
|
@@ -1240,7 +1240,7 @@ exports[`component:<InputPhone> prop:showState (false) & warning 1`] = `
|
|
|
1240
1240
|
</select>
|
|
1241
1241
|
</div>
|
|
1242
1242
|
<span
|
|
1243
|
-
class="icon headline-3 icon
|
|
1243
|
+
class="icon headline-3 icon expand expandLeft"
|
|
1244
1244
|
>
|
|
1245
1245
|
<svg
|
|
1246
1246
|
fill="currentColor"
|
|
@@ -1338,7 +1338,7 @@ exports[`component:<InputPhone> prop:success 1`] = `
|
|
|
1338
1338
|
</select>
|
|
1339
1339
|
</div>
|
|
1340
1340
|
<span
|
|
1341
|
-
class="icon headline-3 icon
|
|
1341
|
+
class="icon headline-3 icon expand expandLeft"
|
|
1342
1342
|
>
|
|
1343
1343
|
<svg
|
|
1344
1344
|
fill="currentColor"
|
|
@@ -1445,7 +1445,7 @@ exports[`component:<InputPhone> prop:value 1`] = `
|
|
|
1445
1445
|
</select>
|
|
1446
1446
|
</div>
|
|
1447
1447
|
<span
|
|
1448
|
-
class="icon headline-3 icon
|
|
1448
|
+
class="icon headline-3 icon expand expandLeft"
|
|
1449
1449
|
>
|
|
1450
1450
|
<svg
|
|
1451
1451
|
fill="currentColor"
|
|
@@ -1554,7 +1554,7 @@ exports[`component:<InputPhone> prop:warning 1`] = `
|
|
|
1554
1554
|
</select>
|
|
1555
1555
|
</div>
|
|
1556
1556
|
<span
|
|
1557
|
-
class="icon headline-3 icon
|
|
1557
|
+
class="icon headline-3 icon expand expandLeft"
|
|
1558
1558
|
>
|
|
1559
1559
|
<svg
|
|
1560
1560
|
fill="currentColor"
|
|
@@ -1652,7 +1652,7 @@ exports[`component:<InputPhone> renders 1`] = `
|
|
|
1652
1652
|
</select>
|
|
1653
1653
|
</div>
|
|
1654
1654
|
<span
|
|
1655
|
-
class="icon headline-3 icon
|
|
1655
|
+
class="icon headline-3 icon expand expandLeft"
|
|
1656
1656
|
>
|
|
1657
1657
|
<svg
|
|
1658
1658
|
fill="currentColor"
|
|
@@ -1734,7 +1734,7 @@ exports[`component:<InputPhone> testId 1`] = `
|
|
|
1734
1734
|
</select>
|
|
1735
1735
|
</div>
|
|
1736
1736
|
<span
|
|
1737
|
-
class="icon headline-3 icon
|
|
1737
|
+
class="icon headline-3 icon expand expandLeft"
|
|
1738
1738
|
>
|
|
1739
1739
|
<svg
|
|
1740
1740
|
fill="currentColor"
|
|
@@ -11,6 +11,7 @@ var _helpers = require("../../helpers");
|
|
|
11
11
|
var _primitives = require("../../primitives");
|
|
12
12
|
var _InputTextModule = _interopRequireDefault(require("../InputText/InputText.module.css"));
|
|
13
13
|
var _partials = require("../InputText/partials");
|
|
14
|
+
var _partials2 = require("./partials");
|
|
14
15
|
var _excluded = ["caption", "disabled", "error", "hint", "label", "showRequired", "showState", "success", "warning", "onChange", "onEnter", "onLeave"];
|
|
15
16
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -94,10 +95,7 @@ var InputSelect = function InputSelect(_ref) {
|
|
|
94
95
|
onChange: handleChange,
|
|
95
96
|
onEnter: handleEnter,
|
|
96
97
|
onLeave: handleLeave
|
|
97
|
-
}))), !disabled && /*#__PURE__*/_react.default.createElement(
|
|
98
|
-
value: _primitives.ICON.EXPAND_MORE,
|
|
99
|
-
className: (0, _helpers.styles)(_InputTextModule.default.icon, _InputTextModule.default.select)
|
|
100
|
-
}), has.stateIcon && /*#__PURE__*/_react.default.createElement(_partials.IconState, {
|
|
98
|
+
}))), !disabled && /*#__PURE__*/_react.default.createElement(_partials2.Expand, null), has.stateIcon && /*#__PURE__*/_react.default.createElement(_partials.IconState, {
|
|
101
99
|
error: error,
|
|
102
100
|
success: success,
|
|
103
101
|
warning: warning
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputSelect.js","names":["InputSelect","caption","disabled","error","hint","label","showRequired","showState","success","warning","onChange","onEnter","onLeave","others","useState","focus","setFocus","handleChange","value","event","target","blur","handleEnter","handleLeave","has","undefined","length","stateIcon","role","styles","style","inputContainer","className","inputBorder","content","required","input","withLabel","empty","
|
|
1
|
+
{"version":3,"file":"InputSelect.js","names":["InputSelect","caption","disabled","error","hint","label","showRequired","showState","success","warning","onChange","onEnter","onLeave","others","useState","focus","setFocus","handleChange","value","event","target","blur","handleEnter","handleLeave","has","undefined","length","stateIcon","role","styles","style","inputContainer","className","inputBorder","content","required","input","withLabel","empty","displayName","propTypes","PropTypes","string","bool","name","isRequired","func"],"sources":["../../../src/components/InputSelect/InputSelect.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { Select, Text, View } from '../../primitives';\nimport style from '../InputText/InputText.module.css';\nimport { Hint, IconState, Label } from '../InputText/partials';\nimport { Expand } from './partials';\n\nconst InputSelect = ({\n caption,\n disabled,\n error,\n hint,\n label,\n showRequired = false,\n showState = true,\n success,\n warning,\n onChange = () => {},\n onEnter = () => {},\n onLeave = () => {},\n ...others\n}) => {\n const [focus, setFocus] = useState(false);\n\n const handleChange = (value, event) => {\n onChange(value, event);\n event.target?.blur();\n };\n\n const handleEnter = (event) => {\n setFocus(true);\n onEnter(event);\n };\n\n const handleLeave = (event) => {\n setFocus(false);\n onLeave(event);\n };\n\n const has = {\n label: !!label,\n value: others.value !== undefined && others.value?.length > 0,\n stateIcon: showState && (error || success || warning),\n };\n\n return (\n <View\n role={others.role || 'input-select'}\n className={styles(style.inputContainer, others.className)}\n style={others.style}\n >\n <View\n row\n className={styles(\n style.inputBorder,\n disabled && style.disabled,\n focus && !error && style.focus,\n error && style.error,\n )}\n >\n {caption && (\n <Text action lighten className={style.caption}>\n {caption}\n </Text>\n )}\n\n <View wide className={style.content}>\n {label && (\n <Label\n {...{\n disabled,\n error,\n focus,\n label,\n required: showRequired && others.required,\n value: others.value,\n }}\n />\n )}\n\n <Select\n {...others}\n disabled={disabled}\n value={others.value || ''}\n className={styles(\n style.input,\n has.label && style.withLabel,\n !!label && !(focus || error || has.value) && style.empty,\n )}\n onChange={handleChange}\n onEnter={handleEnter}\n onLeave={handleLeave}\n />\n </View>\n\n {!disabled && <Expand />}\n {has.stateIcon && <IconState {...{ error, success, warning }} />}\n </View>\n\n {hint && <Hint {...{ disabled, error, hint }} />}\n </View>\n );\n};\n\nInputSelect.displayName = 'Component:InputSelect';\n\nInputSelect.propTypes = {\n caption: PropTypes.string,\n disabled: PropTypes.bool,\n error: PropTypes.bool,\n hint: PropTypes.string,\n label: PropTypes.string,\n name: PropTypes.string.isRequired,\n showRequired: PropTypes.bool,\n showState: PropTypes.bool,\n success: PropTypes.bool,\n warning: PropTypes.bool,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { InputSelect };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEpC,IAAMA,WAAW,GAAG,SAAdA,WAAW,OAcX;EAAA;EAAA,IAbJC,OAAO,QAAPA,OAAO;IACPC,QAAQ,QAARA,QAAQ;IACRC,KAAK,QAALA,KAAK;IACLC,IAAI,QAAJA,IAAI;IACJC,KAAK,QAALA,KAAK;IAAA,yBACLC,YAAY;IAAZA,YAAY,kCAAG,KAAK;IAAA,sBACpBC,SAAS;IAATA,SAAS,+BAAG,IAAI;IAChBC,OAAO,QAAPA,OAAO;IACPC,OAAO,QAAPA,OAAO;IAAA,qBACPC,QAAQ;IAARA,QAAQ,8BAAG,YAAM,CAAC,CAAC;IAAA,oBACnBC,OAAO;IAAPA,OAAO,6BAAG,YAAM,CAAC,CAAC;IAAA,oBAClBC,OAAO;IAAPA,OAAO,6BAAG,YAAM,CAAC,CAAC;IACfC,MAAM;EAET,gBAA0B,IAAAC,eAAQ,EAAC,KAAK,CAAC;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AW,CAACwC,SAAS,GAAG;EACtBvC,OAAO,EAAEwC,kBAAS,CAACC,MAAM;EACzBxC,QAAQ,EAAEuC,kBAAS,CAACE,IAAI;EACxBxC,KAAK,EAAEsC,kBAAS,CAACE,IAAI;EACrBvC,IAAI,EAAEqC,kBAAS,CAACC,MAAM;EACtBrC,KAAK,EAAEoC,kBAAS,CAACC,MAAM;EACvBE,IAAI,EAAEH,kBAAS,CAACC,MAAM,CAACG,UAAU;EACjCvC,YAAY,EAAEmC,kBAAS,CAACE,IAAI;EAC5BpC,SAAS,EAAEkC,kBAAS,CAACE,IAAI;EACzBnC,OAAO,EAAEiC,kBAAS,CAACE,IAAI;EACvBlC,OAAO,EAAEgC,kBAAS,CAACE,IAAI;EACvBjC,QAAQ,EAAE+B,kBAAS,CAACK,IAAI;EACxBnC,OAAO,EAAE8B,kBAAS,CAACK,IAAI;EACvBlC,OAAO,EAAE6B,kBAAS,CAACK;AACrB,CAAC"}
|
|
@@ -43,7 +43,7 @@ exports[`component:<InputSelect> inherit:className 1`] = `
|
|
|
43
43
|
</select>
|
|
44
44
|
</div>
|
|
45
45
|
<span
|
|
46
|
-
class="icon headline-3 icon
|
|
46
|
+
class="icon headline-3 icon expand expandLeft"
|
|
47
47
|
>
|
|
48
48
|
<svg
|
|
49
49
|
fill="currentColor"
|
|
@@ -117,7 +117,7 @@ exports[`component:<InputSelect> prop:caption 1`] = `
|
|
|
117
117
|
</select>
|
|
118
118
|
</div>
|
|
119
119
|
<span
|
|
120
|
-
class="icon headline-3 icon
|
|
120
|
+
class="icon headline-3 icon expand expandLeft"
|
|
121
121
|
>
|
|
122
122
|
<svg
|
|
123
123
|
fill="currentColor"
|
|
@@ -234,7 +234,7 @@ exports[`component:<InputSelect> prop:error 1`] = `
|
|
|
234
234
|
</select>
|
|
235
235
|
</div>
|
|
236
236
|
<span
|
|
237
|
-
class="icon headline-3 icon
|
|
237
|
+
class="icon headline-3 icon expand expandLeft"
|
|
238
238
|
>
|
|
239
239
|
<svg
|
|
240
240
|
fill="currentColor"
|
|
@@ -303,7 +303,7 @@ exports[`component:<InputSelect> prop:hint 1`] = `
|
|
|
303
303
|
</select>
|
|
304
304
|
</div>
|
|
305
305
|
<span
|
|
306
|
-
class="icon headline-3 icon
|
|
306
|
+
class="icon headline-3 icon expand expandLeft"
|
|
307
307
|
>
|
|
308
308
|
<svg
|
|
309
309
|
fill="currentColor"
|
|
@@ -382,7 +382,7 @@ exports[`component:<InputSelect> prop:label 1`] = `
|
|
|
382
382
|
</select>
|
|
383
383
|
</div>
|
|
384
384
|
<span
|
|
385
|
-
class="icon headline-3 icon
|
|
385
|
+
class="icon headline-3 icon expand expandLeft"
|
|
386
386
|
>
|
|
387
387
|
<svg
|
|
388
388
|
fill="currentColor"
|
|
@@ -462,7 +462,7 @@ exports[`component:<InputSelect> prop:required & prop:showRequired (true) 1`] =
|
|
|
462
462
|
</select>
|
|
463
463
|
</div>
|
|
464
464
|
<span
|
|
465
|
-
class="icon headline-3 icon
|
|
465
|
+
class="icon headline-3 icon expand expandLeft"
|
|
466
466
|
>
|
|
467
467
|
<svg
|
|
468
468
|
fill="currentColor"
|
|
@@ -537,7 +537,7 @@ exports[`component:<InputSelect> prop:required 1`] = `
|
|
|
537
537
|
</select>
|
|
538
538
|
</div>
|
|
539
539
|
<span
|
|
540
|
-
class="icon headline-3 icon
|
|
540
|
+
class="icon headline-3 icon expand expandLeft"
|
|
541
541
|
>
|
|
542
542
|
<svg
|
|
543
543
|
fill="currentColor"
|
|
@@ -654,7 +654,7 @@ exports[`component:<InputSelect> prop:value 1`] = `
|
|
|
654
654
|
</select>
|
|
655
655
|
</div>
|
|
656
656
|
<span
|
|
657
|
-
class="icon headline-3 icon
|
|
657
|
+
class="icon headline-3 icon expand expandLeft"
|
|
658
658
|
>
|
|
659
659
|
<svg
|
|
660
660
|
fill="currentColor"
|
|
@@ -723,7 +723,7 @@ exports[`component:<InputSelect> prop:warning 1`] = `
|
|
|
723
723
|
</select>
|
|
724
724
|
</div>
|
|
725
725
|
<span
|
|
726
|
-
class="icon headline-3 icon
|
|
726
|
+
class="icon headline-3 icon expand expandLeft"
|
|
727
727
|
>
|
|
728
728
|
<svg
|
|
729
729
|
fill="currentColor"
|
|
@@ -809,7 +809,7 @@ exports[`component:<InputSelect> renders 1`] = `
|
|
|
809
809
|
</select>
|
|
810
810
|
</div>
|
|
811
811
|
<span
|
|
812
|
-
class="icon headline-3 icon
|
|
812
|
+
class="icon headline-3 icon expand expandLeft"
|
|
813
813
|
>
|
|
814
814
|
<svg
|
|
815
815
|
fill="currentColor"
|
|
@@ -879,7 +879,7 @@ exports[`component:<InputSelect> testId 1`] = `
|
|
|
879
879
|
</select>
|
|
880
880
|
</div>
|
|
881
881
|
<span
|
|
882
|
-
class="icon headline-3 icon
|
|
882
|
+
class="icon headline-3 icon expand expandLeft"
|
|
883
883
|
>
|
|
884
884
|
<svg
|
|
885
885
|
fill="currentColor"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Expand = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _helpers = require("../../../helpers");
|
|
9
|
+
var _primitives = require("../../../primitives");
|
|
10
|
+
var _theme = require("../../../theme");
|
|
11
|
+
var _InputTextModule = _interopRequireDefault(require("../../InputText/InputText.module.css"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
var Expand = function Expand() {
|
|
14
|
+
var direction = _theme.Theme.getDirection();
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
|
|
16
|
+
value: _primitives.ICON.EXPAND_MORE,
|
|
17
|
+
className: (0, _helpers.styles)(_InputTextModule.default.icon, _InputTextModule.default.expand, direction === _theme.DIRECTION_TYPE.RIGHT ? _InputTextModule.default.expandRight : _InputTextModule.default.expandLeft)
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
exports.Expand = Expand;
|
|
21
|
+
Expand.displayName = 'Component:InputSelect.Expand';
|
|
22
|
+
Expand.propTypes = {};
|
|
23
|
+
//# sourceMappingURL=InputSelect.Expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputSelect.Expand.js","names":["Expand","direction","Theme","getDirection","ICON","EXPAND_MORE","styles","style","icon","expand","DIRECTION_TYPE","RIGHT","expandRight","expandLeft","displayName","propTypes"],"sources":["../../../../src/components/InputSelect/partials/InputSelect.Expand.jsx"],"sourcesContent":["import React from 'react';\n\nimport { styles } from '../../../helpers';\nimport { Icon, ICON } from '../../../primitives';\nimport { DIRECTION_TYPE, Theme } from '../../../theme';\nimport style from '../../InputText/InputText.module.css';\n\nconst Expand = () => {\n const direction = Theme.getDirection();\n\n return (\n <Icon\n value={ICON.EXPAND_MORE}\n className={styles(\n style.icon,\n style.expand,\n direction === DIRECTION_TYPE.RIGHT ? style.expandRight : style.expandLeft,\n )}\n />\n );\n};\n\nExpand.displayName = 'Component:InputSelect.Expand';\n\nExpand.propTypes = {};\n\nexport { Expand };\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AAAyD;AAEzD,IAAMA,MAAM,GAAG,SAATA,MAAM,GAAS;EACnB,IAAMC,SAAS,GAAGC,YAAK,CAACC,YAAY,EAAE;EAEtC,oBACE,6BAAC,gBAAI;IACH,KAAK,EAAEC,gBAAI,CAACC,WAAY;IACxB,SAAS,EAAE,IAAAC,eAAM,EACfC,wBAAK,CAACC,IAAI,EACVD,wBAAK,CAACE,MAAM,EACZR,SAAS,KAAKS,qBAAc,CAACC,KAAK,GAAGJ,wBAAK,CAACK,WAAW,GAAGL,wBAAK,CAACM,UAAU;EACzE,EACF;AAEN,CAAC;AAAC;AAEFb,MAAM,CAACc,WAAW,GAAG,8BAA8B;AAEnDd,MAAM,CAACe,SAAS,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _InputSelect = require("./InputSelect.Expand");
|
|
7
|
+
Object.keys(_InputSelect).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _InputSelect[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _InputSelect[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/InputSelect/partials/index.js"],"sourcesContent":["export * from './InputSelect.Expand';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -44,13 +44,20 @@
|
|
|
44
44
|
pointer-events: none;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.icon.
|
|
48
|
-
margin-left: calc(var(--mirai-ui-input-text-icon) * -1);
|
|
47
|
+
.icon.expand {
|
|
49
48
|
pointer-events: none;
|
|
50
49
|
z-index: var(--mirai-ui-layer-S);
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
.icon.
|
|
52
|
+
.icon.expandLeft {
|
|
53
|
+
margin-left: calc(var(--mirai-ui-input-text-icon) * -1);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.icon.expandRight {
|
|
57
|
+
margin-right: calc(var(--mirai-ui-input-text-icon) * -1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.icon.expand,
|
|
54
61
|
.icon.password {
|
|
55
62
|
color: var(--mirai-ui-content);
|
|
56
63
|
}
|