@mirai/ui 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -1
- package/build/components/Button/Button.module.css +20 -13
- package/build/components/InputNumber/InputNumber.js +10 -8
- package/build/components/InputNumber/InputNumber.js.map +1 -1
- package/build/components/InputNumber/InputNumber.module.css +14 -2
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +78 -1
- package/build/components/InputOption/InputOption.js +1 -1
- package/build/components/InputOption/InputOption.js.map +1 -1
- package/build/components/InputOption/InputOption.module.css +6 -1
- package/build/components/InputSelect/InputSelect.js +4 -4
- package/build/components/InputSelect/InputSelect.js.map +1 -1
- package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +9 -9
- package/build/components/InputText/InputText.js +3 -3
- package/build/components/InputText/InputText.js.map +1 -1
- package/build/components/InputText/InputText.module.css +41 -24
- package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +1 -1
- package/build/components/Modal/Modal.module.css +5 -3
- package/build/components/Table/Table.module.css +27 -25
- package/build/primitives/Checkbox/Checkbox.js +5 -3
- package/build/primitives/Checkbox/Checkbox.js.map +1 -1
- package/build/primitives/Checkbox/Checkbox.module.css +6 -6
- package/build/primitives/Input/Input.module.css +13 -5
- package/build/primitives/Layer/Layer.js +89 -0
- package/build/primitives/Layer/Layer.js.map +1 -0
- package/build/primitives/Layer/Layer.module.css +10 -0
- package/build/primitives/Layer/LayerContent.js +22 -0
- package/build/primitives/Layer/LayerContent.js.map +1 -0
- package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +55 -0
- package/build/primitives/Layer/helpers/getElementLayout.js +23 -0
- package/build/primitives/Layer/helpers/getElementLayout.js.map +1 -0
- package/build/primitives/Layer/helpers/getLayerPosition.js +43 -0
- package/build/primitives/Layer/helpers/getLayerPosition.js.map +1 -0
- package/build/primitives/Layer/helpers/index.js +32 -0
- package/build/primitives/Layer/helpers/index.js.map +1 -0
- package/build/primitives/Layer/index.js +32 -0
- package/build/primitives/Layer/index.js.map +1 -0
- package/build/primitives/Radio/Radio.js +5 -3
- package/build/primitives/Radio/Radio.js.map +1 -1
- package/build/primitives/Radio/Radio.module.css +10 -9
- package/build/primitives/Radio/__tests__/__snapshots__/Radio.test.js.snap +0 -1
- package/build/primitives/ScrollView/ScrollView.module.css +1 -1
- package/build/primitives/Select/Select.module.css +9 -7
- package/build/primitives/Switch/Switch.js +2 -4
- package/build/primitives/Switch/Switch.js.map +1 -1
- package/build/primitives/Switch/Switch.module.css +27 -19
- package/build/primitives/Switch/__tests__/__snapshots__/Switch.test.js.snap +0 -5
- package/build/primitives/Text/Text.js +2 -3
- package/build/primitives/Text/Text.js.map +1 -1
- package/build/primitives/Text/Text.module.css +1 -4
- package/build/primitives/Text/__tests__/__snapshots__/Text.test.js.snap +0 -10
- package/build/primitives/View/View.js +12 -3
- package/build/primitives/View/View.js.map +1 -1
- package/build/primitives/index.js +33 -20
- package/build/primitives/index.js.map +1 -1
- package/build/theme/default.theme.css +23 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,6 +81,34 @@ const MyComponent = () => (
|
|
|
81
81
|
);
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
### Layer
|
|
85
|
+
|
|
86
|
+
This primitive returns an element that displays with relative position to other element based on the following props:
|
|
87
|
+
|
|
88
|
+
- `children:node` two children elements are accepted, the first one is the element to be displayed and the second one is the LayerContent that wraps the element to be displayed if the visible prop is true
|
|
89
|
+
- `visible:boolean` showing or hiding the layer
|
|
90
|
+
|
|
91
|
+
The position of the layer is based on the position of the element to be displayed. If the layer can show on right or left because have a gap in this direction, the layer will be shown on the right or left of the element to be displayed. If the layer can open on top or bottom because have a gap in this direction, the layer will be shown on the top or bottom of the element to be displayed
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
import { Button, Calendar, Layer, LayerContent } from '@mirai/ui';
|
|
95
|
+
|
|
96
|
+
const MyComponent = () => {
|
|
97
|
+
const [visible, setVisible] = useState(false);
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Layer visible={visible}>
|
|
101
|
+
<Button style={{ position: 'absolute', left: '500px', top: '100px' }} onPress={() => setVisible(!visible)}>
|
|
102
|
+
{visible ? 'close' : 'open'}
|
|
103
|
+
</Button>
|
|
104
|
+
<LayerContent>
|
|
105
|
+
<Calendar months={2} range />
|
|
106
|
+
</LayerContent>
|
|
107
|
+
</Layer>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
```
|
|
111
|
+
|
|
84
112
|
### Pressable
|
|
85
113
|
|
|
86
114
|
This primitive returns pressable elements based on the following properties:
|
|
@@ -162,7 +190,6 @@ A primitive for displaying text. It receives the following props:
|
|
|
162
190
|
- `bold:boolean` modifying font-weight
|
|
163
191
|
- `children:string`
|
|
164
192
|
- `headline:boolean` modifying font-size
|
|
165
|
-
- `lighten:boolean` modifying text color
|
|
166
193
|
- `upperCase:boolean` switching text to upper case
|
|
167
194
|
- `small:boolean` modifying font-size
|
|
168
195
|
- `tag:string` html tag of resulting element
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--mirai-ui-button-
|
|
2
|
+
--mirai-ui-button-background: var(--mirai-ui-accent);
|
|
3
|
+
--mirai-ui-button-color: var(--mirai-ui-base);
|
|
3
4
|
--mirai-ui-button-color-active: rgba(255, 255, 255, 0.2);
|
|
4
5
|
--mirai-ui-button-color-focus: var(--mirai-ui-content);
|
|
5
|
-
--mirai-ui-button-
|
|
6
|
+
--mirai-ui-button-disabled-background: var(--mirai-ui-content-300);
|
|
7
|
+
--mirai-ui-button-disabled-color: var(--mirai-ui-content-400);
|
|
8
|
+
--mirai-ui-button-outlined-background: var(--mirai-ui-base);
|
|
9
|
+
--mirai-ui-button-padding-x: var(--mirai-ui-space-S);
|
|
10
|
+
--mirai-ui-button-padding-y: var(--mirai-ui-space-L);
|
|
6
11
|
--mirai-ui-button-radius: var(--mirai-ui-border-radius);
|
|
7
12
|
}
|
|
8
13
|
|
|
9
14
|
.button {
|
|
10
15
|
align-items: center;
|
|
11
|
-
background-color: var(--mirai-ui-button-
|
|
16
|
+
background-color: var(--mirai-ui-button-background);
|
|
12
17
|
border-radius: var(--mirai-ui-button-radius);
|
|
13
|
-
color: var(--mirai-ui-button-color
|
|
18
|
+
color: var(--mirai-ui-button-color);
|
|
14
19
|
display: flex;
|
|
15
20
|
font-family: var(--mirai-ui-font);
|
|
16
21
|
font-size: var(--mirai-ui-font-size-action);
|
|
17
22
|
font-weight: var(--mirai-ui-font-bold-weight);
|
|
18
23
|
justify-content: center;
|
|
19
|
-
padding: var(--mirai-ui-
|
|
24
|
+
padding: var(--mirai-ui-button-padding-x) var(--mirai-ui-button-padding-y);
|
|
20
25
|
transition: background-color var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
21
26
|
box-shadow var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
22
27
|
color var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
|
|
@@ -24,28 +29,27 @@
|
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
.button:disabled {
|
|
27
|
-
background-color: var(--mirai-ui-disabled);
|
|
28
|
-
color: var(--mirai-ui-
|
|
32
|
+
background-color: var(--mirai-ui-button-disabled-background);
|
|
33
|
+
color: var(--mirai-ui-button-disabled-color);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
.outlined {
|
|
32
|
-
border: solid 1px var(--mirai-ui-button-
|
|
33
|
-
background-color: var(--mirai-ui-
|
|
34
|
-
color: var(--mirai-ui-button-
|
|
37
|
+
border: solid 1px var(--mirai-ui-button-background);
|
|
38
|
+
background-color: var(--mirai-ui-button-outlined-background);
|
|
39
|
+
color: var(--mirai-ui-button-background);
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
.button:not(:disabled):active {
|
|
38
|
-
box-shadow: inset 0 0 var(--mirai-ui-space-
|
|
43
|
+
box-shadow: inset 0 0 var(--mirai-ui-space-XL) var(--mirai-ui-space-XL) var(--mirai-ui-button-color-active);
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
.large:not(.squared) {
|
|
42
47
|
font-size: var(--mirai-ui-font-size-headline);
|
|
43
|
-
padding: var(--mirai-ui-space-M) var(--mirai-ui-space-XL);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
.small:not(.squared) {
|
|
47
51
|
font-size: var(--mirai-ui-font-size-small);
|
|
48
|
-
padding: var(--mirai-ui-
|
|
52
|
+
padding: calc(var(--mirai-ui-button-padding-x) / 2) calc(var(--mirai-ui-button-padding-y) / 2);
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
.rounded {
|
|
@@ -55,16 +59,19 @@
|
|
|
55
59
|
.squared {
|
|
56
60
|
padding: 0;
|
|
57
61
|
height: var(--mirai-ui-space-XL);
|
|
62
|
+
min-width: var(--mirai-ui-space-XL);
|
|
58
63
|
width: var(--mirai-ui-space-XL);
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
.squared.small {
|
|
62
67
|
height: var(--mirai-ui-space-L);
|
|
68
|
+
min-width: var(--mirai-ui-space-L);
|
|
63
69
|
width: var(--mirai-ui-space-L);
|
|
64
70
|
}
|
|
65
71
|
|
|
66
72
|
.squared.large {
|
|
67
73
|
height: var(--mirai-ui-space-XXL);
|
|
74
|
+
min-width: var(--mirai-ui-space-XXL);
|
|
68
75
|
width: var(--mirai-ui-space-XXL);
|
|
69
76
|
}
|
|
70
77
|
|
|
@@ -19,10 +19,11 @@ var _Button = require("../Button");
|
|
|
19
19
|
|
|
20
20
|
var _InputNumberModule = _interopRequireDefault(require("./InputNumber.module.css"));
|
|
21
21
|
|
|
22
|
-
var _excluded = ["hint", "label", "max", "min", "name", "step", "value", "onChange"];
|
|
22
|
+
var _excluded = ["disabled", "hint", "label", "max", "min", "name", "step", "value", "onChange"];
|
|
23
23
|
|
|
24
24
|
var InputNumber = function InputNumber(_ref) {
|
|
25
|
-
var
|
|
25
|
+
var disabled = _ref.disabled,
|
|
26
|
+
hint = _ref.hint,
|
|
26
27
|
label = _ref.label,
|
|
27
28
|
max = _ref.max,
|
|
28
29
|
_ref$min = _ref.min,
|
|
@@ -40,12 +41,13 @@ var InputNumber = function InputNumber(_ref) {
|
|
|
40
41
|
className: (0, _helpers.styles)(_InputNumberModule.default.inputNumber, others.className)
|
|
41
42
|
}), /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
42
43
|
className: _InputNumberModule.default.texts
|
|
43
|
-
}, label && /*#__PURE__*/_react.default.createElement(_primitives.Text,
|
|
44
|
-
|
|
44
|
+
}, label && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
45
|
+
className: disabled && _InputNumberModule.default.disabled
|
|
46
|
+
}, label), hint && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
45
47
|
small: true,
|
|
46
|
-
className: _InputNumberModule.default.hint
|
|
48
|
+
className: (0, _helpers.styles)(_InputNumberModule.default.hint, disabled && _InputNumberModule.default.disabled)
|
|
47
49
|
}, hint)), /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
48
|
-
disabled: value <= min,
|
|
50
|
+
disabled: disabled || value <= min,
|
|
49
51
|
outlined: true,
|
|
50
52
|
squared: true,
|
|
51
53
|
onPress: function onPress() {
|
|
@@ -55,8 +57,8 @@ var InputNumber = function InputNumber(_ref) {
|
|
|
55
57
|
name: "Minus"
|
|
56
58
|
})), /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
57
59
|
className: _InputNumberModule.default.value
|
|
58
|
-
}, value), /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
59
|
-
disabled: value >= max,
|
|
60
|
+
}, typeof value === 'number' ? value : min), /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
61
|
+
disabled: disabled || value >= max,
|
|
60
62
|
outlined: true,
|
|
61
63
|
squared: true,
|
|
62
64
|
onPress: function onPress() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputNumber.js","names":["InputNumber","hint","label","max","min","name","step","value","onChange","others","style","inputNumber","className","texts"],"sources":["../../../src/components/InputNumber/InputNumber.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Text, View } from '../../primitives';\nimport { Button } from '../Button';\nimport style from './InputNumber.module.css';\n\nexport const InputNumber = ({\n hint,\n label,\n max,\n min = 0,\n name,\n step = 1,\n value = 0,\n onChange = () => {},\n ...others\n}) => (\n <View {...others} row className={styles(style.inputNumber, others.className)}>\n <View className={style.texts}>\n {label && <Text>{label}</Text>}\n {hint && (\n <Text
|
|
1
|
+
{"version":3,"file":"InputNumber.js","names":["InputNumber","disabled","hint","label","max","min","name","step","value","onChange","others","style","inputNumber","className","texts"],"sources":["../../../src/components/InputNumber/InputNumber.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Text, View } from '../../primitives';\nimport { Button } from '../Button';\nimport style from './InputNumber.module.css';\n\nexport const InputNumber = ({\n disabled,\n hint,\n label,\n max,\n min = 0,\n name,\n step = 1,\n value = 0,\n onChange = () => {},\n ...others\n}) => (\n <View {...others} row className={styles(style.inputNumber, others.className)}>\n <View className={style.texts}>\n {label && <Text className={disabled && style.disabled}>{label}</Text>}\n {hint && (\n <Text small className={styles(style.hint, disabled && style.disabled)}>\n {hint}\n </Text>\n )}\n </View>\n <Button disabled={disabled || value <= min} outlined squared onPress={() => onChange(value - step, name)}>\n <Icon name=\"Minus\" />\n </Button>\n <Text className={style.value}>{typeof value === 'number' ? value : min}</Text>\n <Button disabled={disabled || value >= max} outlined squared onPress={() => onChange(value + step, name)}>\n <Icon name=\"Plus\" />\n </Button>\n </View>\n);\n\nInputNumber.propTypes = {\n disabled: PropTypes.bool,\n hint: PropTypes.string,\n label: PropTypes.string,\n max: PropTypes.number,\n min: PropTypes.number,\n name: Prop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T,EAAeD,IAAf,CAAd;IAAA;EAAtE,gBACE,6BAAC,gBAAD;IAAM,IAAI,EAAC;EAAX,EADF,CATF,eAYE,6BAAC,gBAAD;IAAM,SAAS,EAAEK,2BAAMH;EAAvB,GAA+B,OAAOA,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCH,GAAnE,CAZF,eAaE,6BAAC,cAAD;IAAQ,QAAQ,EAAEJ,QAAQ,IAAIO,KAAK,IAAIJ,GAAvC;IAA4C,QAAQ,MAApD;IAAqD,OAAO,MAA5D;IAA6D,OAAO,EAAE;MAAA,OAAMK,QAAQ,CAACD,KAAK,GAAGD,IAAT,EAAeD,IAAf,CAAd;IAAA;EAAtE,gBACE,6BAAC,gBAAD;IAAM,IAAI,EAAC;EAAX,EADF,CAbF,CAZyB;AAAA,CAApB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--mirai-ui-input-number-value-width: var(--mirai-ui-space-XXL);
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.inputNumber {
|
|
2
|
-
margin-bottom: var(--mirai-ui-input-
|
|
6
|
+
margin-bottom: var(--mirai-ui-input-text-padding-y);
|
|
3
7
|
}
|
|
4
8
|
|
|
5
9
|
.texts {
|
|
@@ -9,5 +13,13 @@
|
|
|
9
13
|
.value {
|
|
10
14
|
display: block;
|
|
11
15
|
text-align: center;
|
|
12
|
-
width: var(--mirai-ui-
|
|
16
|
+
width: var(--mirai-ui-input-number-value-width);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.hint {
|
|
20
|
+
color: var(--mirai-ui-input-disabled);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.disabled {
|
|
24
|
+
color: var(--mirai-ui-input-text-disabled);
|
|
13
25
|
}
|
|
@@ -76,6 +76,83 @@ exports[`component:<InputNumber> inherit:className 1`] = `
|
|
|
76
76
|
</DocumentFragment>
|
|
77
77
|
`;
|
|
78
78
|
|
|
79
|
+
exports[`component:<InputNumber> prop:disabled 1`] = `
|
|
80
|
+
<DocumentFragment>
|
|
81
|
+
<div
|
|
82
|
+
class="view row inputNumber"
|
|
83
|
+
>
|
|
84
|
+
<div
|
|
85
|
+
class="view texts"
|
|
86
|
+
/>
|
|
87
|
+
<button
|
|
88
|
+
class="pressable button squared"
|
|
89
|
+
disabled=""
|
|
90
|
+
>
|
|
91
|
+
<span
|
|
92
|
+
class="icon"
|
|
93
|
+
>
|
|
94
|
+
<svg
|
|
95
|
+
fill="none"
|
|
96
|
+
height="1em"
|
|
97
|
+
stroke="currentColor"
|
|
98
|
+
stroke-linecap="round"
|
|
99
|
+
stroke-linejoin="round"
|
|
100
|
+
stroke-width="2"
|
|
101
|
+
viewBox="0 0 24 24"
|
|
102
|
+
width="1em"
|
|
103
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
104
|
+
>
|
|
105
|
+
<line
|
|
106
|
+
x1="5"
|
|
107
|
+
x2="19"
|
|
108
|
+
y1="12"
|
|
109
|
+
y2="12"
|
|
110
|
+
/>
|
|
111
|
+
</svg>
|
|
112
|
+
</span>
|
|
113
|
+
</button>
|
|
114
|
+
<span
|
|
115
|
+
class="text paragraph value"
|
|
116
|
+
>
|
|
117
|
+
0
|
|
118
|
+
</span>
|
|
119
|
+
<button
|
|
120
|
+
class="pressable button squared"
|
|
121
|
+
disabled=""
|
|
122
|
+
>
|
|
123
|
+
<span
|
|
124
|
+
class="icon"
|
|
125
|
+
>
|
|
126
|
+
<svg
|
|
127
|
+
fill="none"
|
|
128
|
+
height="1em"
|
|
129
|
+
stroke="currentColor"
|
|
130
|
+
stroke-linecap="round"
|
|
131
|
+
stroke-linejoin="round"
|
|
132
|
+
stroke-width="2"
|
|
133
|
+
viewBox="0 0 24 24"
|
|
134
|
+
width="1em"
|
|
135
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
136
|
+
>
|
|
137
|
+
<line
|
|
138
|
+
x1="12"
|
|
139
|
+
x2="12"
|
|
140
|
+
y1="5"
|
|
141
|
+
y2="19"
|
|
142
|
+
/>
|
|
143
|
+
<line
|
|
144
|
+
x1="5"
|
|
145
|
+
x2="19"
|
|
146
|
+
y1="12"
|
|
147
|
+
y2="12"
|
|
148
|
+
/>
|
|
149
|
+
</svg>
|
|
150
|
+
</span>
|
|
151
|
+
</button>
|
|
152
|
+
</div>
|
|
153
|
+
</DocumentFragment>
|
|
154
|
+
`;
|
|
155
|
+
|
|
79
156
|
exports[`component:<InputNumber> prop:hint 1`] = `
|
|
80
157
|
<DocumentFragment>
|
|
81
158
|
<div
|
|
@@ -85,7 +162,7 @@ exports[`component:<InputNumber> prop:hint 1`] = `
|
|
|
85
162
|
class="view texts"
|
|
86
163
|
>
|
|
87
164
|
<span
|
|
88
|
-
class="text
|
|
165
|
+
class="text small hint"
|
|
89
166
|
>
|
|
90
167
|
hint
|
|
91
168
|
</span>
|
|
@@ -34,7 +34,7 @@ var InputOption = function InputOption(_ref) {
|
|
|
34
34
|
_ref$onChange = _ref.onChange,
|
|
35
35
|
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
36
36
|
others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
37
|
-
var Primitive = type === _InputOption.CHECKBOX ? _primitives.Checkbox : _primitives.Radio;
|
|
37
|
+
var Primitive = type === _InputOption.CHECKBOX ? _primitives.Checkbox : type === _InputOption.RADIO ? _primitives.Radio : _primitives.Switch;
|
|
38
38
|
|
|
39
39
|
var handleChange = function handleChange(event) {
|
|
40
40
|
onChange(type === _InputOption.CHECKBOX ? !checked : value, event);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputOption.js","names":["InputOption","checked","disabled","label","name","reverse","type","CHECKBOX","value","onChange","others","Primitive","Checkbox","Radio","handleChange","event","style","inputOption","className","icon","undefined","displayName"],"sources":["../../../src/components/InputOption/InputOption.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport {
|
|
1
|
+
{"version":3,"file":"InputOption.js","names":["InputOption","checked","disabled","label","name","reverse","type","CHECKBOX","value","onChange","others","Primitive","Checkbox","RADIO","Radio","Switch","handleChange","event","style","inputOption","className","icon","undefined","displayName"],"sources":["../../../src/components/InputOption/InputOption.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Checkbox, Icon, Pressable, Radio, Switch, Text } from '../../primitives';\nimport { CHECKBOX, RADIO, SWITCH } from './InputOption.constants';\nimport style from './InputOption.module.css';\n\nconst InputOption = ({\n checked,\n disabled,\n label,\n name,\n reverse,\n type = CHECKBOX,\n value = '',\n onChange = () => {},\n ...others\n}) => {\n const Primitive = type === CHECKBOX ? Checkbox : type === RADIO ? Radio : Switch;\n\n const handleChange = (event) => {\n onChange(type === CHECKBOX ? !checked : value, event);\n };\n\n return (\n <Pressable\n {...others}\n style={others.style}\n className={styles(style.inputOption, reverse && style.reverse, others.className)}\n onPress={handleChange}\n >\n <Primitive checked={checked} disabled={disabled} name={name} type={type} value={value}>\n {type === CHECKBOX && checked ? <Icon name=\"Check\" className={styles(style.icon)} /> : undefined}\n </Primitive>\n {label && <Text className={styles(style.label, disabled && style.disabled)}>{label}</Text>}\n </Pressable>\n );\n};\n\nInputOption.displayName = 'Component:InputOption';\n\nInputOption.propTypes = {\n checked: PropTypes.bool,\n disabled: PropTypes.bool,\n label: PropTypes.string,\n name: PropTypes.string.isRequired,\n reverse: PropTypes.bool,\n type: PropTypes.oneOf([CHECKBOX, RADIO, SWITCH]),\n value: PropTypes.string,\n onChange: PropTypes.func,\n};\n\nexport { InputOption };\n"],"mappings":";;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;AAEA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OAUd;EAAA,IATJC,OASI,QATJA,OASI;EAAA,IARJC,QAQI,QARJA,QAQI;EAAA,IAPJC,KAOI,QAPJA,KAOI;EAAA,IANJC,IAMI,QANJA,IAMI;EAAA,IALJ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AZ,GAA0B,uBAA1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--mirai-ui-input-option-disabled: var(--mirai-ui-
|
|
2
|
+
--mirai-ui-input-option-disabled: var(--mirai-ui-content-300);
|
|
3
3
|
--mirai-ui-input-option-label-margin: var(--mirai-ui-space-S);
|
|
4
4
|
--mirai-ui-input-option-padding-y: var(--mirai-ui-space-S);
|
|
5
5
|
}
|
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
flex-direction: row-reverse;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
.reverse .icon {
|
|
36
|
+
left: auto;
|
|
37
|
+
right: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
.reverse .label {
|
|
36
41
|
margin-left: 0;
|
|
37
42
|
margin-right: var(--mirai-ui-input-option-label-margin);
|
|
@@ -67,14 +67,14 @@ var InputSelect = function InputSelect(_ref) {
|
|
|
67
67
|
className: (0, _helpers.styles)(_InputTextModule.default.inputContainer, others.className),
|
|
68
68
|
style: others.style
|
|
69
69
|
}, label && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
70
|
-
className: (0, _helpers.styles)(_InputTextModule.default.text, _InputTextModule.default.label,
|
|
70
|
+
className: (0, _helpers.styles)(_InputTextModule.default.text, _InputTextModule.default.label, disabled && _InputTextModule.default.disabled, error && _InputTextModule.default.error, focus && _InputTextModule.default.focus, (focus || error || has.value) && _InputTextModule.default.value)
|
|
71
71
|
}, label), /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
72
72
|
row: true,
|
|
73
|
-
className: (0, _helpers.styles)(_InputTextModule.default.inputBorder, focus && !error && _InputTextModule.default.focus, error && _InputTextModule.default.error)
|
|
73
|
+
className: (0, _helpers.styles)(_InputTextModule.default.inputBorder, disabled && _InputTextModule.default.disabled, focus && !error && _InputTextModule.default.focus, error && _InputTextModule.default.error)
|
|
74
74
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Select, Object.assign({}, others, {
|
|
75
75
|
disabled: disabled,
|
|
76
76
|
value: others.value || '',
|
|
77
|
-
className: _InputTextModule.default.input,
|
|
77
|
+
className: (0, _helpers.styles)(_InputTextModule.default.input, _InputTextModule.default.iconRight, !(focus || error || has.value) && _InputTextModule.default.empty),
|
|
78
78
|
style: undefined,
|
|
79
79
|
onChange: handleChange,
|
|
80
80
|
onEnter: handleEnter,
|
|
@@ -84,7 +84,7 @@ var InputSelect = function InputSelect(_ref) {
|
|
|
84
84
|
className: [_InputTextModule.default.icon, _InputTextModule.default.right]
|
|
85
85
|
})), hint && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
86
86
|
small: true,
|
|
87
|
-
className: (0, _helpers.styles)(_InputTextModule.default.text, _InputTextModule.default.hint, error && _InputTextModule.default.error)
|
|
87
|
+
className: (0, _helpers.styles)(_InputTextModule.default.text, _InputTextModule.default.hint, disabled && _InputTextModule.default.disabled, error && _InputTextModule.default.error)
|
|
88
88
|
}, hint));
|
|
89
89
|
};
|
|
90
90
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputSelect.js","names":["InputSelect","disabled","error","hint","label","onChange","onEnter","onLeave","others","focus","setFocus","handleChange","value","event","target","blur","handleEnter","handleLeave","has","undefined","length","style","inputContainer","className","text","inputBorder","input","icon","right","displayName"],"sources":["../../../src/components/InputSelect/InputSelect.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Select, Text, View } from '../../primitives';\nimport style from '../InputText/InputText.module.css';\nconst InputSelect = ({\n disabled,\n error,\n hint,\n label,\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 value: others.value !== undefined && others.value?.length > 0,\n };\n\n return (\n <View className={styles(style.inputContainer, others.className)} style={others.style}>\n {label && (\n <Text\n className={styles(\n style.text,\n style.label,\n
|
|
1
|
+
{"version":3,"file":"InputSelect.js","names":["InputSelect","disabled","error","hint","label","onChange","onEnter","onLeave","others","focus","setFocus","handleChange","value","event","target","blur","handleEnter","handleLeave","has","undefined","length","style","inputContainer","className","text","inputBorder","input","iconRight","empty","icon","right","displayName"],"sources":["../../../src/components/InputSelect/InputSelect.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Select, Text, View } from '../../primitives';\nimport style from '../InputText/InputText.module.css';\n\nconst InputSelect = ({\n disabled,\n error,\n hint,\n label,\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 value: others.value !== undefined && others.value?.length > 0,\n };\n\n return (\n <View className={styles(style.inputContainer, others.className)} style={others.style}>\n {label && (\n <Text\n className={styles(\n style.text,\n style.label,\n disabled && style.disabled,\n error && style.error,\n focus && style.focus,\n (focus || error || has.value) && style.value,\n )}\n >\n {label}\n </Text>\n )}\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 <Select\n {...others}\n disabled={disabled}\n value={others.value || ''}\n className={styles(style.input, style.iconRight, !(focus || error || has.value) && style.empty)}\n style={undefined}\n onChange={handleChange}\n onEnter={handleEnter}\n onLeave={handleLeave}\n />\n {!disabled && <Icon name=\"CloseArrow\" className={[style.icon, style.right]} />}\n </View>\n\n {hint && (\n <Text small className={styles(style.text, style.hint, disabled && style.disabled, error && style.error)}>\n {hint}\n </Text>\n )}\n </View>\n );\n};\n\nInputSelect.displayName = 'Component:InputSelect';\n\nInputSelect.propTypes = {\n disabled: PropTypes.bool,\n error: PropTypes.bool,\n hint: PropTypes.string,\n label: PropTypes.string,\n name: PropTypes.string.isRequired,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { InputSelect };\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;;;AAEA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OASd;EAAA;;EAAA,IARJC,QAQI,QARJA,QAQI;EAAA,IAPJC,KAOI,QAPJA,KAOI;EAAA,IANJC,IAMI,QANJA,IAMI;EAAA,IALJC,KAKI,QALJA,KAKI;EAAA,yBAJJC,QAII;EAAA,IAJJA,QAII,8BAJO,YAAM,CAAE,CAIf;EAAA,wBAHJC,OAGI;EAAA,IAHJA,OAGI,6BAHM,YAAM,CAAE,CAGd;EAAA,wBAFJC,OAEI;EAAA,IAFJA,OAEI,6BAFM,YAAM,CAAE,CAEd;EAAA,IADDC,MACC;;EACJ,gBAA0B,qBAAS,KAAT,CAA1B;EAAA;EAAA,IAAOC,KAAP;EAAA,IAAcC,QAAd;;EAEA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAQC,KAAR,EAAkB;IAAA;;IACrCR,QAAQ,CAACO,KAAD,EAAQC,KAAR,CAAR;IACA,iBAAAA,KAAK,CAACC,MAAN,gEAAcC,IAAd;EACD,CAHD;;EAKA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACH,KAAD,EAAW;IAC7BH,QAAQ,CAAC,IAAD,CAAR;IACAJ,OAAO,CAACO,KAAD,CAAP;EACD,CAHD;;EAKA,IAAMI,WAAW,GAAG,SAAdA,WAAc,CAACJ,KAAD,EAAW;IAC7BH,QAAQ,CAAC,KAAD,CAAR;IACAH,OAAO,CAACM,KAAD,CAAP;EACD,CAHD;;EAKA,IAAMK,GAAG,GAAG;IACV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B,SAAS,EAAE,CAACoB,yBAAMQ,IAAP,EAAaR,yBAAMS,KAAnB;EAAnC,EAnBhB,CAhBF,EAsCG3B,IAAI,iBACH,6BAAC,gBAAD;IAAM,KAAK,MAAX;IAAY,SAAS,EAAE,qBAAOkB,yBAAMG,IAAb,EAAmBH,yBAAMlB,IAAzB,EAA+BF,QAAQ,IAAIoB,yBAAMpB,QAAjD,EAA2DC,KAAK,IAAImB,yBAAMnB,KAA1E;EAAvB,GACGC,IADH,CAvCJ,CADF;AA8CD,CA7ED;;;AA+EAH,WAAW,CAAC+B,WAAZ,GAA0B,uBAA1B"}
|
|
@@ -9,7 +9,7 @@ exports[`component:<InputSelect> inherit:className 1`] = `
|
|
|
9
9
|
class="view row inputBorder"
|
|
10
10
|
>
|
|
11
11
|
<select
|
|
12
|
-
class="select empty input"
|
|
12
|
+
class="select empty input iconRight empty"
|
|
13
13
|
name="name"
|
|
14
14
|
>
|
|
15
15
|
<option
|
|
@@ -68,10 +68,10 @@ exports[`component:<InputSelect> prop:disabled 1`] = `
|
|
|
68
68
|
class="view inputContainer"
|
|
69
69
|
>
|
|
70
70
|
<div
|
|
71
|
-
class="view row inputBorder"
|
|
71
|
+
class="view row inputBorder disabled"
|
|
72
72
|
>
|
|
73
73
|
<select
|
|
74
|
-
class="select empty input"
|
|
74
|
+
class="select empty input iconRight empty"
|
|
75
75
|
disabled=""
|
|
76
76
|
name="name"
|
|
77
77
|
>
|
|
@@ -115,7 +115,7 @@ exports[`component:<InputSelect> prop:error 1`] = `
|
|
|
115
115
|
class="view row inputBorder"
|
|
116
116
|
>
|
|
117
117
|
<select
|
|
118
|
-
class="select empty input"
|
|
118
|
+
class="select empty input iconRight empty"
|
|
119
119
|
name="name"
|
|
120
120
|
>
|
|
121
121
|
<option
|
|
@@ -177,7 +177,7 @@ exports[`component:<InputSelect> prop:hint 1`] = `
|
|
|
177
177
|
class="view row inputBorder"
|
|
178
178
|
>
|
|
179
179
|
<select
|
|
180
|
-
class="select empty input"
|
|
180
|
+
class="select empty input iconRight empty"
|
|
181
181
|
name="name"
|
|
182
182
|
>
|
|
183
183
|
<option
|
|
@@ -249,7 +249,7 @@ exports[`component:<InputSelect> prop:label 1`] = `
|
|
|
249
249
|
class="view row inputBorder"
|
|
250
250
|
>
|
|
251
251
|
<select
|
|
252
|
-
class="select empty input"
|
|
252
|
+
class="select empty input iconRight empty"
|
|
253
253
|
name="name"
|
|
254
254
|
>
|
|
255
255
|
<option
|
|
@@ -311,7 +311,7 @@ exports[`component:<InputSelect> prop:label 2`] = `
|
|
|
311
311
|
class="view row inputBorder"
|
|
312
312
|
>
|
|
313
313
|
<select
|
|
314
|
-
class="select input"
|
|
314
|
+
class="select input iconRight"
|
|
315
315
|
name="name"
|
|
316
316
|
>
|
|
317
317
|
<option
|
|
@@ -373,7 +373,7 @@ exports[`component:<InputSelect> renders 1`] = `
|
|
|
373
373
|
class="view row inputBorder"
|
|
374
374
|
>
|
|
375
375
|
<select
|
|
376
|
-
class="select empty input"
|
|
376
|
+
class="select empty input iconRight empty"
|
|
377
377
|
name="name"
|
|
378
378
|
>
|
|
379
379
|
<option
|
|
@@ -435,7 +435,7 @@ exports[`component:<InputSelect> testID 1`] = `
|
|
|
435
435
|
class="view row inputBorder"
|
|
436
436
|
>
|
|
437
437
|
<select
|
|
438
|
-
class="select empty input"
|
|
438
|
+
class="select empty input iconRight empty"
|
|
439
439
|
data-testid="mirai"
|
|
440
440
|
name="name"
|
|
441
441
|
>
|
|
@@ -74,10 +74,10 @@ var InputText = function InputText(_ref) {
|
|
|
74
74
|
className: (0, _helpers.styles)(_InputTextModule.default.inputContainer, others.className),
|
|
75
75
|
style: others.style
|
|
76
76
|
}, label && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
77
|
-
className: (0, _helpers.styles)(_InputTextModule.default.text, _InputTextModule.default.label, focus && _InputTextModule.default.focus, error && _InputTextModule.default.error, (focus || error || has.value) && _InputTextModule.default.value)
|
|
77
|
+
className: (0, _helpers.styles)(_InputTextModule.default.text, _InputTextModule.default.label, disabled && _InputTextModule.default.disabled, focus && _InputTextModule.default.focus, error && _InputTextModule.default.error, (focus || error || has.value) && _InputTextModule.default.value)
|
|
78
78
|
}, label), /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
79
79
|
row: true,
|
|
80
|
-
className: (0, _helpers.styles)(_InputTextModule.default.inputBorder,
|
|
80
|
+
className: (0, _helpers.styles)(_InputTextModule.default.inputBorder, disabled && _InputTextModule.default.disabled, error && _InputTextModule.default.error, focus && !error && _InputTextModule.default.focus)
|
|
81
81
|
}, icon && /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
|
|
82
82
|
name: icon,
|
|
83
83
|
className: [_InputTextModule.default.icon, _InputTextModule.default.left]
|
|
@@ -99,7 +99,7 @@ var InputText = function InputText(_ref) {
|
|
|
99
99
|
name: password ? 'EyeClose' : 'EyeOpen'
|
|
100
100
|
}))), hint && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
101
101
|
small: true,
|
|
102
|
-
className: (0, _helpers.styles)(_InputTextModule.default.text, _InputTextModule.default.hint, error && _InputTextModule.default.error)
|
|
102
|
+
className: (0, _helpers.styles)(_InputTextModule.default.text, _InputTextModule.default.hint, disabled && _InputTextModule.default.disabled, error && _InputTextModule.default.error)
|
|
103
103
|
}, hint));
|
|
104
104
|
};
|
|
105
105
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputText.js","names":["InputText","disabled","error","hint","icon","label","type","onChange","onEnter","onLeave","others","focus","setFocus","password","setPassword","handleChange","value","event","handleEnter","handleLeave","has","undefined","length","is","style","inputContainer","className","text","inputBorder","left","input","iconLeft","pressable","displayName"],"sources":["../../../src/components/InputText/InputText.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Input, Pressable, Text, View } from '../../primitives';\nimport style from './InputText.module.css';\n\nconst InputText = ({\n disabled,\n error,\n hint,\n icon,\n label,\n type,\n onChange = () => {},\n onEnter = () => {},\n onLeave = () => {},\n ...others\n}) => {\n const [focus, setFocus] = useState(false);\n const [password, setPassword] = useState(true);\n\n const handleChange = (value, event) => {\n onChange(value, event);\n };\n\n const handleEnter = (event) => {\n setFocus(true);\n onEnter(event);\n };\n\n const handleLeave = () => {\n setFocus(false);\n onLeave(event);\n };\n\n const has = {\n value: others.value !== undefined && others.value?.length > 0,\n };\n const is = { password: type === 'password' };\n\n return (\n <View className={styles(style.inputContainer, others.className)} style={others.style}>\n {label && (\n <Text\n className={styles(\n style.text,\n style.label,\n focus && style.focus,\n error && style.error,\n (focus || error || has.value) && style.value,\n )}\n >\n {label}\n </Text>\n )}\n\n <View
|
|
1
|
+
{"version":3,"file":"InputText.js","names":["InputText","disabled","error","hint","icon","label","type","onChange","onEnter","onLeave","others","focus","setFocus","password","setPassword","handleChange","value","event","handleEnter","handleLeave","has","undefined","length","is","style","inputContainer","className","text","inputBorder","left","input","iconLeft","pressable","displayName"],"sources":["../../../src/components/InputText/InputText.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, Input, Pressable, Text, View } from '../../primitives';\nimport style from './InputText.module.css';\n\nconst InputText = ({\n disabled,\n error,\n hint,\n icon,\n label,\n type,\n onChange = () => {},\n onEnter = () => {},\n onLeave = () => {},\n ...others\n}) => {\n const [focus, setFocus] = useState(false);\n const [password, setPassword] = useState(true);\n\n const handleChange = (value, event) => {\n onChange(value, event);\n };\n\n const handleEnter = (event) => {\n setFocus(true);\n onEnter(event);\n };\n\n const handleLeave = () => {\n setFocus(false);\n onLeave(event);\n };\n\n const has = {\n value: others.value !== undefined && others.value?.length > 0,\n };\n const is = { password: type === 'password' };\n\n return (\n <View className={styles(style.inputContainer, others.className)} style={others.style}>\n {label && (\n <Text\n className={styles(\n style.text,\n style.label,\n disabled && style.disabled,\n focus && style.focus,\n error && style.error,\n (focus || error || has.value) && style.value,\n )}\n >\n {label}\n </Text>\n )}\n\n <View\n row\n className={styles(\n style.inputBorder,\n disabled && style.disabled,\n error && style.error,\n focus && !error && style.focus,\n )}\n >\n {icon && <Icon name={icon} className={[style.icon, style.left]} />}\n <Input\n {...others}\n disabled={disabled}\n type={!is.password || password ? type : 'text'}\n value={others.value || ''}\n className={styles(style.input, icon && style.iconLeft)}\n style={undefined}\n onChange={handleChange}\n onEnter={handleEnter}\n onLeave={handleLeave}\n />\n {is.password && !disabled && (\n <Pressable className={style.pressable} onPress={() => setPassword(!password)}>\n <Icon name={password ? 'EyeClose' : 'EyeOpen'} />\n </Pressable>\n )}\n </View>\n\n {hint && (\n <Text small className={styles(style.text, style.hint, disabled && style.disabled, error && style.error)}>\n {hint}\n </Text>\n )}\n </View>\n );\n};\n\nInputText.displayName = 'Component:InputText';\n\nInputText.propTypes = {\n disabled: PropTypes.bool,\n error: PropTypes.bool,\n hint: PropTypes.string,\n icon: PropTypes.string,\n label: PropTypes.string,\n multiLine: PropTypes.bool,\n name: PropTypes.string.isRequired,\n type: PropTypes.string,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { InputText };\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;;;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAY,OAWZ;EAAA;;EAAA,IAVJC,QAUI,QAVJA,QAUI;EAAA,IATJC,KASI,QATJA,KASI;EAAA,IARJC,IAQI,QARJA,IAQI;EAAA,IAPJC,IAOI,QAPJA,IAOI;EAAA,IANJC,KAMI,QANJA,KAMI;EAAA,IALJC,IAKI,QALJA,IAKI;EAAA,yBAJJC,QAII;EAAA,IAJJA,QAII,8BAJO,YAAM,CAAE,CAIf;EAAA,wBAHJC,OAGI;EAAA,IAHJA,OAGI,6BAHM,YAAM,CAAE,CAGd;EAAA,wBAFJC,OAEI;EAAA,IAFJA,OAEI,6BAFM,YAAM,CAAE,CAEd;EAAA,IADDC,M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