@mirai/ui 1.0.1 → 1.0.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/InputSelect/index.js"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './InputSelect';\n"],"file":"index.js"}
@@ -70,21 +70,23 @@ var InputText = function InputText(_ref) {
70
70
  password: type === 'password'
71
71
  };
72
72
  return /*#__PURE__*/_react.default.createElement(_primitives.View, {
73
- className: (0, _helpers.styles)(_InputTextModule.default.inputText, others.className)
73
+ className: (0, _helpers.styles)(_InputTextModule.default.inputContainer, others.className),
74
+ style: others.style
74
75
  }, label && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
75
76
  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)
76
77
  }, label), /*#__PURE__*/_react.default.createElement(_primitives.View, {
77
- className: (0, _helpers.styles)(_InputTextModule.default.content)
78
+ row: true,
79
+ className: (0, _helpers.styles)(_InputTextModule.default.inputBorder, focus && !error && _InputTextModule.default.focus, error && _InputTextModule.default.error)
78
80
  }, /*#__PURE__*/_react.default.createElement(_primitives.Input, Object.assign({}, others, {
79
81
  disabled: disabled,
80
82
  type: !is.password || password ? type : 'text',
81
83
  value: others.value || '',
82
- className: (0, _helpers.styles)(_InputTextModule.default.input, error && _InputTextModule.default.error),
84
+ className: _InputTextModule.default.input,
85
+ style: undefined,
83
86
  onChange: handleChange,
84
87
  onEnter: handleEnter,
85
88
  onLeave: handleLeave
86
89
  })), is.password && !disabled && /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
87
- className: _InputTextModule.default.pressable,
88
90
  onPress: function onPress() {
89
91
  return setPassword(!password);
90
92
  }
@@ -97,4 +99,5 @@ var InputText = function InputText(_ref) {
97
99
  };
98
100
 
99
101
  exports.InputText = InputText;
102
+ InputText.displayName = 'Component:InputText';
100
103
  //# sourceMappingURL=InputText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/InputText/InputText.jsx"],"names":["InputText","disabled","error","hint","label","type","onChange","onEnter","onLeave","others","focus","setFocus","password","setPassword","handleChange","value","event","handleEnter","handleLeave","has","undefined","length","is","style","inputText","className","text","content","input","pressable"],"mappings":";;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;;;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAY,OAUZ;AAAA;;AAAA,MATJC,QASI,QATJA,QASI;AAAA,MARJC,KAQI,QARJA,KAQI;AAAA,MAPJC,IAOI,QAPJA,IAOI;AAAA,MANJC,KAMI,QANJA,KAMI;AAAA,MALJC,IAKI,QALJA,IAKI;AAAA,2BAJJC,QAII;AAAA,MAJJA,QAII,8BAJO,YAAM,CAAE,CAIf;AAAA,0BAHJC,OAGI;AAAA,MAHJA,OAGI,6BAHM,YAAM,CAAE,CAGd;AAAA,0BAFJC,OAEI;AAAA,MAFJA,OAEI,6BAFM,YAAM,CAAE,CAEd;AAAA,MADDC,MACC;;AACJ,kBAA0B,qBAAS,KAAT,CAA1B;AAAA;AAAA,MAAOC,KAAP;AAAA,MAAcC,QAAd;;AACA,mBAAgC,qBAAS,IAAT,CAAhC;AAAA;AAAA,MAAOC,QAAP;AAAA,MAAiBC,WAAjB;;AAEA,MAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAQC,KAAR,EAAkB;AACrCV,IAAAA,QAAQ,CAACS,KAAD,EAAQC,KAAR,CAAR;AACD,GAFD;;AAIA,MAAMC,WAAW,GAAG,SAAdA,WAAc,CAACD,KAAD,EAAW;AAC7BL,IAAAA,QAAQ,CAAC,IAAD,CAAR;AACAJ,IAAAA,OAAO,CAACS,KAAD,CAAP;AACD,GAHD;;AAKA,MAAME,WAAW,GAA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,EAAE,CAACV,QAAH,IAAe,CAACX,QAAhB,iBACC,6BAAC,qBAAD;AAAW,IAAA,SAAS,EAAEsB,yBAAMM,SAA5B;AAAuC,IAAA,OAAO,EAAE;AAAA,aAAMhB,WAAW,CAAC,CAACD,QAAF,CAAjB;AAAA;AAAhD,kBACE,6BAAC,gBAAD;AAAM,IAAA,IAAI,EAAEA,QAAQ,GAAG,UAAH,GAAgB;AAApC,IADF,CAZJ,CAfF,EAiCGT,IAAI,iBACH,6BAAC,gBAAD;AAAM,IAAA,KAAK,MAAX;AAAY,IAAA,SAAS,EAAE,qBAAOoB,yBAAMG,IAAb,EAAmBH,yBAAMpB,IAAzB,EAA+BD,KAAK,IAAIqB,yBAAMrB,KAA9C;AAAvB,KACGC,IADH,CAlCJ,CADF;AAyCD,CA1ED","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 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.inputText, others.className)}>\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 className={styles(style.content)}>\n <Input\n {...others}\n disabled={disabled}\n type={!is.password || password ? type : 'text'}\n value={others.value || ''}\n className={styles(style.input, error && style.error)}\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, error && style.error)}>\n {hint}\n </Text>\n )}\n </View>\n );\n};\n\nInputText.propTypes = {\n disabled: PropTypes.bool,\n error: PropTypes.bool,\n hint: 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"],"file":"InputText.js"}
1
+ {"version":3,"sources":["../../../src/components/InputText/InputText.jsx"],"names":["InputText","disabled","error","hint","label","type","onChange","onEnter","onLeave","others","focus","setFocus","password","setPassword","handleChange","value","event","handleEnter","handleLeave","has","undefined","length","is","style","inputContainer","className","text","inputBorder","input","displayName"],"mappings":";;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;;;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAY,OAUZ;AAAA;;AAAA,MATJC,QASI,QATJA,QASI;AAAA,MARJC,KAQI,QARJA,KAQI;AAAA,MAPJC,IAOI,QAPJA,IAOI;AAAA,MANJC,KAMI,QANJA,KAMI;AAAA,MALJC,IAKI,QALJA,IAKI;AAAA,2BAJJC,QAII;AAAA,MAJJA,QAII,8BAJO,YAAM,CAAE,CAIf;AAAA,0BAHJC,OAGI;AAAA,MAHJA,OAGI,6BAHM,YAAM,CAAE,CAGd;AAAA,0BAFJC,OAEI;AAAA,MAFJA,OAEI,6BAFM,YAAM,CAAE,CAEd;AAAA,MADDC,MACC;;AACJ,kBAA0B,qBAAS,KAAT,CAA1B;AAAA;AAAA,MAAOC,KAAP;AAAA,MAAcC,QAAd;;AACA,mBAAgC,qBAAS,IAAT,CAAhC;AAAA;AAAA,MAAOC,QAAP;AAAA,MAAiBC,WAAjB;;AAEA,MAAMC,YAAY,GAAG,S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AAIqB,yBAAMrB,KAAzE;AAArB,kBACE,6BAAC,iBAAD,oBACMO,MADN;AAEE,IAAA,QAAQ,EAAER,QAFZ;AAGE,IAAA,IAAI,EAAE,CAACqB,EAAE,CAACV,QAAJ,IAAgBA,QAAhB,GAA2BP,IAA3B,GAAkC,MAH1C;AAIE,IAAA,KAAK,EAAEI,MAAM,CAACM,KAAP,IAAgB,EAJzB;AAKE,IAAA,SAAS,EAAEQ,yBAAMK,KALnB;AAME,IAAA,KAAK,EAAER,SANT;AAOE,IAAA,QAAQ,EAAEN,YAPZ;AAQE,IAAA,OAAO,EAAEG,WARX;AASE,IAAA,OAAO,EAAEC;AATX,KADF,EAYGI,EAAE,CAACV,QAAH,IAAe,CAACX,QAAhB,iBACC,6BAAC,qBAAD;AAAW,IAAA,OAAO,EAAE;AAAA,aAAMY,WAAW,CAAC,CAACD,QAAF,CAAjB;AAAA;AAApB,kBACE,6BAAC,gBAAD;AAAM,IAAA,IAAI,EAAEA,QAAQ,GAAG,UAAH,GAAgB;AAApC,IADF,CAbJ,CAfF,EAkCGT,IAAI,iBACH,6BAAC,gBAAD;AAAM,IAAA,KAAK,MAAX;AAAY,IAAA,SAAS,EAAE,qBAAOoB,yBAAMG,IAAb,EAAmBH,yBAAMpB,IAAzB,EAA+BD,KAAK,IAAIqB,yBAAMrB,KAA9C;AAAvB,KACGC,IADH,CAnCJ,CADF;AA0CD,CA3ED;;;AA6EAH,SAAS,CAAC6B,WAAV,GAAwB,qBAAxB","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 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 row className={styles(style.inputBorder, focus && !error && style.focus, error && style.error)}>\n <Input\n {...others}\n disabled={disabled}\n type={!is.password || password ? type : 'text'}\n value={others.value || ''}\n className={style.input}\n style={undefined}\n onChange={handleChange}\n onEnter={handleEnter}\n onLeave={handleLeave}\n />\n {is.password && !disabled && (\n <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, 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 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"],"file":"InputText.js"}
@@ -6,29 +6,33 @@
6
6
  --mirai-ui-input-field-radius: var(--mirai-ui-border-radius);
7
7
  }
8
8
 
9
- .inputText {
9
+ .inputContainer {
10
10
  position: relative;
11
11
  margin-bottom: var(--mirai-ui-input-field-padding-y);
12
12
  }
13
13
 
14
- .input {
14
+ .inputBorder {
15
15
  border: var(--mirai-ui-input-field-border);
16
16
  border-radius: var(--mirai-ui-input-field-radius);
17
- padding: var(--mirai-ui-input-field-padding-y) var(--mirai-ui-input-field-padding-x);
17
+ padding: 0 var(--mirai-ui-input-field-padding-x) 0 0;
18
18
  }
19
19
 
20
- .input::placeholder {
21
- color: var(--mirai-ui-base);
22
- }
23
-
24
- .input.error {
20
+ .inputBorder.error {
25
21
  border-color: var(--mirai-ui-error);
26
22
  }
27
23
 
28
- .input:not(.error):focus {
24
+ .inputBorder.focus {
29
25
  border-color: var(--mirai-ui-input-field-focus);
30
26
  }
31
27
 
28
+ .input {
29
+ padding: var(--mirai-ui-input-field-padding-y) var(--mirai-ui-input-field-padding-x);
30
+ }
31
+
32
+ .input::placeholder {
33
+ color: var(--mirai-ui-base);
34
+ }
35
+
32
36
  .text {
33
37
  color: var(--mirai-ui-lighten);
34
38
  }
@@ -50,6 +54,7 @@
50
54
  position: absolute;
51
55
  top: var(--mirai-ui-input-field-padding-y);
52
56
  transition: all var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
57
+ z-index: 1;
53
58
  }
54
59
 
55
60
  .label.value {
@@ -57,12 +62,6 @@
57
62
  top: calc(calc(var(--mirai-ui-input-field-padding-y) * -1) + calc(var(--mirai-ui-input-field-padding-y) / 2));
58
63
  }
59
64
 
60
- .pressable {
61
- position: absolute;
62
- right: var(--mirai-ui-input-field-padding-x);
63
- top: var(--mirai-ui-input-field-padding-y);
64
- }
65
-
66
65
  .hint {
67
66
  margin: calc(var(--mirai-ui-input-field-padding-x) / 4) var(--mirai-ui-input-field-padding-x);
68
67
  }
@@ -3,10 +3,10 @@
3
3
  exports[`component:<InputText> inherit:className 1`] = `
4
4
  <DocumentFragment>
5
5
  <div
6
- class="view inputText mirai"
6
+ class="view inputContainer mirai"
7
7
  >
8
8
  <div
9
- class="view content"
9
+ class="view row inputBorder"
10
10
  >
11
11
  <input
12
12
  class="input input"
@@ -22,10 +22,10 @@ exports[`component:<InputText> inherit:className 1`] = `
22
22
  exports[`component:<InputText> prop:disabled 1`] = `
23
23
  <DocumentFragment>
24
24
  <div
25
- class="view inputText"
25
+ class="view inputContainer"
26
26
  >
27
27
  <div
28
- class="view content"
28
+ class="view row inputBorder"
29
29
  >
30
30
  <input
31
31
  class="input input"
@@ -42,13 +42,13 @@ exports[`component:<InputText> prop:disabled 1`] = `
42
42
  exports[`component:<InputText> prop:error 1`] = `
43
43
  <DocumentFragment>
44
44
  <div
45
- class="view inputText"
45
+ class="view inputContainer"
46
46
  >
47
47
  <div
48
- class="view content"
48
+ class="view row inputBorder error"
49
49
  >
50
50
  <input
51
- class="input input error"
51
+ class="input input"
52
52
  name="name"
53
53
  type="text"
54
54
  value=""
@@ -61,10 +61,10 @@ exports[`component:<InputText> prop:error 1`] = `
61
61
  exports[`component:<InputText> prop:hint 1`] = `
62
62
  <DocumentFragment>
63
63
  <div
64
- class="view inputText"
64
+ class="view inputContainer"
65
65
  >
66
66
  <div
67
- class="view content"
67
+ class="view row inputBorder"
68
68
  >
69
69
  <input
70
70
  class="input input"
@@ -85,7 +85,7 @@ exports[`component:<InputText> prop:hint 1`] = `
85
85
  exports[`component:<InputText> prop:label 1`] = `
86
86
  <DocumentFragment>
87
87
  <div
88
- class="view inputText"
88
+ class="view inputContainer"
89
89
  >
90
90
  <span
91
91
  class="text paragraph text label"
@@ -93,7 +93,7 @@ exports[`component:<InputText> prop:label 1`] = `
93
93
  label
94
94
  </span>
95
95
  <div
96
- class="view content"
96
+ class="view row inputBorder"
97
97
  >
98
98
  <input
99
99
  class="input input"
@@ -109,10 +109,10 @@ exports[`component:<InputText> prop:label 1`] = `
109
109
  exports[`component:<InputText> prop:multiLine 1`] = `
110
110
  <DocumentFragment>
111
111
  <div
112
- class="view inputText"
112
+ class="view inputContainer"
113
113
  >
114
114
  <div
115
- class="view content"
115
+ class="view row inputBorder"
116
116
  >
117
117
  <textarea
118
118
  class="input input"
@@ -127,10 +127,10 @@ exports[`component:<InputText> prop:multiLine 1`] = `
127
127
  exports[`component:<InputText> prop:type 1`] = `
128
128
  <DocumentFragment>
129
129
  <div
130
- class="view inputText"
130
+ class="view inputContainer"
131
131
  >
132
132
  <div
133
- class="view content"
133
+ class="view row inputBorder"
134
134
  >
135
135
  <input
136
136
  class="input input"
@@ -139,7 +139,7 @@ exports[`component:<InputText> prop:type 1`] = `
139
139
  value=""
140
140
  />
141
141
  <button
142
- class="pressable pressable"
142
+ class="pressable"
143
143
  >
144
144
  <span
145
145
  class="icon"
@@ -175,10 +175,10 @@ exports[`component:<InputText> prop:type 1`] = `
175
175
  exports[`component:<InputText> renders 1`] = `
176
176
  <DocumentFragment>
177
177
  <div
178
- class="view inputText"
178
+ class="view inputContainer"
179
179
  >
180
180
  <div
181
- class="view content"
181
+ class="view row inputBorder"
182
182
  >
183
183
  <input
184
184
  class="input input"
@@ -194,10 +194,10 @@ exports[`component:<InputText> renders 1`] = `
194
194
  exports[`component:<InputText> testID 1`] = `
195
195
  <DocumentFragment>
196
196
  <div
197
- class="view inputText"
197
+ class="view inputContainer"
198
198
  >
199
199
  <div
200
- class="view content"
200
+ class="view row inputBorder"
201
201
  >
202
202
  <input
203
203
  class="input input"
@@ -56,6 +56,19 @@ Object.keys(_InputNumber).forEach(function (key) {
56
56
  });
57
57
  });
58
58
 
59
+ var _InputSelect = require("./InputSelect");
60
+
61
+ Object.keys(_InputSelect).forEach(function (key) {
62
+ if (key === "default" || key === "__esModule") return;
63
+ if (key in exports && exports[key] === _InputSelect[key]) return;
64
+ Object.defineProperty(exports, key, {
65
+ enumerable: true,
66
+ get: function get() {
67
+ return _InputSelect[key];
68
+ }
69
+ });
70
+ });
71
+
59
72
  var _InputText = require("./InputText");
60
73
 
61
74
  Object.keys(_InputText).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/index.js"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './Button';\nexport * from './Calendar';\nexport * from './Form';\nexport * from './InputNumber';\nexport * from './InputText';\nexport * from './Modal';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/components/index.js"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './Button';\nexport * from './Calendar';\nexport * from './Form';\nexport * from './InputNumber';\nexport * from './InputSelect';\nexport * from './InputText';\nexport * from './Modal';\n"],"file":"index.js"}
@@ -1,8 +1,3 @@
1
- :root {
2
- --mirai-ui-input-font: var(--mirai-ui-font);
3
- --mirai-ui-input-font-size: var(--mirai-ui-font-size-paragraph);
4
- }
5
-
6
1
  .input {
7
2
  background-color: var(--mirai-ui-base);
8
3
  border: none;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.Select = void 0;
11
+
12
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
13
+
14
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
15
+
16
+ var _react = _interopRequireWildcard(require("react"));
17
+
18
+ var _helpers = require("../../helpers");
19
+
20
+ var _SelectModule = _interopRequireDefault(require("./Select.module.css"));
21
+
22
+ var _excluded = ["disabled", "emptyOption", "options", "value", "onChange", "onEnter", "onError", "onLeave"];
23
+ var EMPTY = '';
24
+
25
+ var Select = function Select(_ref) {
26
+ var disabled = _ref.disabled,
27
+ emptyOption = _ref.emptyOption,
28
+ _ref$options = _ref.options,
29
+ options = _ref$options === void 0 ? [] : _ref$options,
30
+ value = _ref.value,
31
+ onChange = _ref.onChange,
32
+ onEnter = _ref.onEnter,
33
+ onError = _ref.onError,
34
+ onLeave = _ref.onLeave,
35
+ others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
36
+ (0, _react.useEffect)(function () {
37
+ var errors = (0, _helpers.getInputErrors)((0, _objectSpread2.default)({}, others));
38
+ if (errors && onError) onError(errors); // eslint-disable-next-line react-hooks/exhaustive-deps
39
+ }, []);
40
+
41
+ var handleChange = function handleChange(value, event) {
42
+ onError && onError((0, _helpers.getInputErrors)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, others), {}, {
43
+ value: value
44
+ })));
45
+ onChange && onChange(value, event);
46
+ };
47
+
48
+ return /*#__PURE__*/_react.default.createElement('select', (0, _objectSpread2.default)((0, _objectSpread2.default)({}, others), {}, {
49
+ disabled: disabled,
50
+ value: value,
51
+ className: (0, _helpers.styles)(_SelectModule.default.select, value === EMPTY && _SelectModule.default.empty, others.className)
52
+ }, !disabled ? {
53
+ onChange: function onChange(event) {
54
+ return handleChange(event.target.value, event);
55
+ },
56
+ onFocus: onEnter,
57
+ onBlur: onLeave
58
+ } : {}), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, emptyOption && /*#__PURE__*/_react.default.createElement("option", {
59
+ value: EMPTY
60
+ }, emptyOption), options.map(function (option) {
61
+ return /*#__PURE__*/_react.default.createElement("option", {
62
+ svalue: option,
63
+ key: option
64
+ }, option);
65
+ })));
66
+ };
67
+
68
+ exports.Select = Select;
69
+ Select.displayName = 'Primitive:Input';
70
+ //# sourceMappingURL=Select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/Select/Select.jsx"],"names":["EMPTY","Select","disabled","emptyOption","options","value","onChange","onEnter","onError","onLeave","others","errors","handleChange","event","React","createElement","className","style","select","empty","target","onFocus","onBlur","map","option","displayName"],"mappings":";;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;;AAEA,IAAMA,KAAK,GAAG,EAAd;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,OAAoG;AAAA,MAAjGC,QAAiG,QAAjGA,QAAiG;AAAA,MAAvFC,WAAuF,QAAvFA,WAAuF;AAAA,0BAA1EC,OAA0E;AAAA,MAA1EA,OAA0E,6BAAhE,EAAgE;AAAA,MAA5DC,KAA4D,QAA5DA,KAA4D;AAAA,MAArDC,QAAqD,QAArDA,QAAqD;AAAA,MAA3CC,OAA2C,QAA3CA,OAA2C;AAAA,MAAlCC,OAAkC,QAAlCA,OAAkC;AAAA,MAAzBC,OAAyB,QAAzBA,OAAyB;AAAA,MAAbC,MAAa;AACjH,wBAAU,YAAM;AACd,QAAMC,MAAM,GAAG,6DAAoBD,MAApB,EAAf;AACA,QAAIC,MAAM,IAAIH,OAAd,EAAuBA,OAAO,CAACG,MAAD,CAAP,CAFT,CAGd;AACD,GAJD,EAIG,EAJH;;AAMA,MAAMC,YAAY,GAAG,SAAfA,YAAe,CAACP,KAAD,EAAQQ,KAAR,EAAkB;AACrCL,IAAAA,OAAO,IAAIA,OAAO,CAAC,yFAAoBE,MAApB;AAA4BL,MAAAA,KAAK,EAALA;AAA5B,OAAD,CAAlB;AACAC,IAAAA,QAAQ,IAAIA,QAAQ,CAACD,KAAD,EAAQQ,KAAR,CAApB;AACD,GAHD;;AAKA,sBAAOC,eAAMC,aAAN,CACL,QADK,8DAGAL,MAHA;AAIHR,IAAAA,QAAQ,EAARA,QAJG;AAKHG,IAAAA,KAAK,EAALA,KALG;AAMHW,IAAAA,SAAS,EAAE,qBAAOC,sBAAMC,MAAb,EAAqBb,KAAK,KAAKL,KAAV,IAAmBiB,sBAAME,KAA9C,EAAqDT,MAAM,CAACM,SAA5D;AANR,KAOC,CAACd,QAAD,GACA;AACEI,IAAAA,QAAQ,EAAE,kBAACO,KAAD;AAAA,aAAWD,YAAY,CAACC,KAAK,CAACO,MAAN,CAAaf,KAAd,EAAqBQ,KAArB,CAAvB;AAAA,KADZ;AAEEQ,IAAAA,OAAO,EAAEd,OAFX;AAGEe,IAAAA,MAAM,EAAEb;AAHV,GADA,GAMA,EAbD,gBAeL,4DACGN,WAAW,iBAAI;AAAQ,IAAA,KAAK,EAAEH;AAAf,KAAuBG,WAAvB,CADlB,EAEGC,OAAO,CAACmB,GAAR,CAAY,UAACC,MAAD;AAAA,wBACX;AAAQ,MAAA,MAAM,EAAEA,MAAhB;AAAwB,MAAA,GAAG,EAAEA;AAA7B,OACGA,MADH,CADW;AAAA,GAAZ,CAFH,CAfK,CAAP;AAwBD,CApCD;;;AAsCAvB,MAAM,CAACwB,WAAP,GAAqB,iBAArB","sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useEffect } from 'react';\n\nimport { getInputErrors, styles } from '../../helpers';\nimport style from './Select.module.css';\n\nconst EMPTY = '';\n\nconst Select = ({ disabled, emptyOption, options = [], value, onChange, onEnter, onError, onLeave, ...others }) => {\n useEffect(() => {\n const errors = getInputErrors({ ...others });\n if (errors && onError) onError(errors);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleChange = (value, event) => {\n onError && onError(getInputErrors({ ...others, value }));\n onChange && onChange(value, event);\n };\n\n return React.createElement(\n 'select',\n {\n ...others,\n disabled,\n value,\n className: styles(style.select, value === EMPTY && style.empty, others.className),\n ...(!disabled\n ? {\n onChange: (event) => handleChange(event.target.value, event),\n onFocus: onEnter,\n onBlur: onLeave,\n }\n : {}),\n },\n <>\n {emptyOption && <option value={EMPTY}>{emptyOption}</option>}\n {options.map((option) => (\n <option svalue={option} key={option}>\n {option}\n </option>\n ))}\n </>,\n );\n};\n\nSelect.displayName = 'Primitive:Input';\n\nSelect.propTypes = {\n disabled: PropTypes.bool,\n emptyOption: PropTypes.string,\n name: PropTypes.string.isRequired,\n options: PropTypes.arrayOf(PropTypes.string),\n value: PropTypes.string,\n onChange: PropTypes.func,\n onEnter: PropTypes.func,\n onError: PropTypes.func,\n onLeave: PropTypes.func,\n};\n\nexport { Select };\n"],"file":"Select.js"}
@@ -0,0 +1,24 @@
1
+ .select {
2
+ background-color: var(--mirai-ui-base);
3
+ border: none;
4
+ box-sizing: border-box;
5
+ color: var(--mirai-ui-content);
6
+ font-family: var(--mirai-ui-input-font);
7
+ font-size: var(--mirai-ui-input-font-size);
8
+ width: 100%;
9
+ margin: 0;
10
+ outline: none;
11
+ user-select: none;
12
+
13
+ -webkit-appearance: none;
14
+ -moz-appearance: none;
15
+ }
16
+
17
+ .select.empty {
18
+ color: var(--mirai-ui-lighten);
19
+ }
20
+
21
+ .select:disabled {
22
+ /* background-color: transparent; */
23
+ color: var(--mirai-ui-lighten);
24
+ }
@@ -0,0 +1,178 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`primitive:<Select> inherit:className 1`] = `
4
+ <DocumentFragment>
5
+ <select
6
+ class="select mirai"
7
+ name="name"
8
+ >
9
+ <option
10
+ svalue="one"
11
+ >
12
+ one
13
+ </option>
14
+ <option
15
+ svalue="two"
16
+ >
17
+ two
18
+ </option>
19
+ <option
20
+ svalue="three"
21
+ >
22
+ three
23
+ </option>
24
+ <option
25
+ svalue="four"
26
+ >
27
+ four
28
+ </option>
29
+ <option
30
+ svalue="five"
31
+ >
32
+ five
33
+ </option>
34
+ </select>
35
+ </DocumentFragment>
36
+ `;
37
+
38
+ exports[`primitive:<Select> prop:disabled 1`] = `
39
+ <DocumentFragment>
40
+ <select
41
+ class="select"
42
+ disabled=""
43
+ name="name"
44
+ >
45
+ <option
46
+ svalue="one"
47
+ >
48
+ one
49
+ </option>
50
+ <option
51
+ svalue="two"
52
+ >
53
+ two
54
+ </option>
55
+ <option
56
+ svalue="three"
57
+ >
58
+ three
59
+ </option>
60
+ <option
61
+ svalue="four"
62
+ >
63
+ four
64
+ </option>
65
+ <option
66
+ svalue="five"
67
+ >
68
+ five
69
+ </option>
70
+ </select>
71
+ </DocumentFragment>
72
+ `;
73
+
74
+ exports[`primitive:<Select> prop:value 1`] = `
75
+ <DocumentFragment>
76
+ <select
77
+ class="select"
78
+ name="name"
79
+ >
80
+ <option
81
+ svalue="one"
82
+ >
83
+ one
84
+ </option>
85
+ <option
86
+ svalue="two"
87
+ >
88
+ two
89
+ </option>
90
+ <option
91
+ svalue="three"
92
+ >
93
+ three
94
+ </option>
95
+ <option
96
+ svalue="four"
97
+ >
98
+ four
99
+ </option>
100
+ <option
101
+ svalue="five"
102
+ >
103
+ five
104
+ </option>
105
+ </select>
106
+ </DocumentFragment>
107
+ `;
108
+
109
+ exports[`primitive:<Select> renders 1`] = `
110
+ <DocumentFragment>
111
+ <select
112
+ class="select"
113
+ name="name"
114
+ >
115
+ <option
116
+ svalue="one"
117
+ >
118
+ one
119
+ </option>
120
+ <option
121
+ svalue="two"
122
+ >
123
+ two
124
+ </option>
125
+ <option
126
+ svalue="three"
127
+ >
128
+ three
129
+ </option>
130
+ <option
131
+ svalue="four"
132
+ >
133
+ four
134
+ </option>
135
+ <option
136
+ svalue="five"
137
+ >
138
+ five
139
+ </option>
140
+ </select>
141
+ </DocumentFragment>
142
+ `;
143
+
144
+ exports[`primitive:<Select> testID 1`] = `
145
+ <DocumentFragment>
146
+ <select
147
+ class="select"
148
+ data-testid="mirai"
149
+ name="name"
150
+ >
151
+ <option
152
+ svalue="one"
153
+ >
154
+ one
155
+ </option>
156
+ <option
157
+ svalue="two"
158
+ >
159
+ two
160
+ </option>
161
+ <option
162
+ svalue="three"
163
+ >
164
+ three
165
+ </option>
166
+ <option
167
+ svalue="four"
168
+ >
169
+ four
170
+ </option>
171
+ <option
172
+ svalue="five"
173
+ >
174
+ five
175
+ </option>
176
+ </select>
177
+ </DocumentFragment>
178
+ `;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _Select = require("./Select");
8
+
9
+ Object.keys(_Select).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _Select[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _Select[key];
16
+ }
17
+ });
18
+ });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/primitives/Select/index.js"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './Select';\n"],"file":"index.js"}
@@ -43,6 +43,19 @@ Object.keys(_Pressable).forEach(function (key) {
43
43
  });
44
44
  });
45
45
 
46
+ var _Select = require("./Select");
47
+
48
+ Object.keys(_Select).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _Select[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function get() {
54
+ return _Select[key];
55
+ }
56
+ });
57
+ });
58
+
46
59
  var _View = require("./View");
47
60
 
48
61
  Object.keys(_View).forEach(function (key) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/primitives/index.js"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './Icon';\nexport * from './Input';\nexport * from './Pressable';\nexport * from './View';\nexport * from './ScrollView';\nexport * from './Text';\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/primitives/index.js"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './Icon';\nexport * from './Input';\nexport * from './Pressable';\nexport * from './Select';\nexport * from './View';\nexport * from './ScrollView';\nexport * from './Text';\n"],"file":"index.js"}
@@ -1,7 +1,7 @@
1
1
  :root {
2
2
  /* typography */
3
3
  --mirai-ui-font: Helvetica;
4
- --mirai-ui-input-font: Helvetica,
4
+ --mirai-ui-input-font: Helvetica;
5
5
  --mirai-ui-font-weight: 400;
6
6
  --mirai-ui-font-bold: Helvetica;
7
7
  --mirai-ui-font-bold-weight: 700;
@@ -9,6 +9,7 @@
9
9
  --mirai-ui-font-size-paragraph: 16px;
10
10
  --mirai-ui-font-size-action: 15px;
11
11
  --mirai-ui-font-size-small: 11px;
12
+ --mirai-ui-input-font-size: 16px;
12
13
  --mirai-ui-text-direction: ltr;
13
14
 
14
15
  /* palette */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/ui",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "repository": "git@gitlab.com:miraicorp/dev/frontend/ui.git",
5
5
  "author": "JΛVI <hello@soyjavi.com>",
6
6
  "license": "MIT",