@mirai/ui 1.0.5 → 1.0.6

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.
Files changed (67) hide show
  1. package/README.md +131 -1
  2. package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +5 -5
  3. package/build/components/InputOption/InputOption.constants.js +13 -0
  4. package/build/components/InputOption/InputOption.constants.js.map +1 -0
  5. package/build/components/InputOption/InputOption.js +63 -0
  6. package/build/components/InputOption/InputOption.js.map +1 -0
  7. package/build/components/InputOption/InputOption.module.css +38 -0
  8. package/build/components/InputOption/__tests__/__snapshots__/InputOption.test.js.snap +232 -0
  9. package/build/components/InputOption/index.js +19 -0
  10. package/build/components/InputOption/index.js.map +1 -0
  11. package/build/components/Modal/Modal.module.css +2 -1
  12. package/build/components/Table/Table.Row.js +76 -0
  13. package/build/components/Table/Table.Row.js.map +1 -0
  14. package/build/components/Table/Table.js +92 -0
  15. package/build/components/Table/Table.js.map +1 -0
  16. package/build/components/Table/Table.module.css +76 -0
  17. package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +2285 -0
  18. package/build/components/Table/helpers/index.js +19 -0
  19. package/build/components/Table/helpers/index.js.map +1 -0
  20. package/build/components/Table/helpers/select.js +29 -0
  21. package/build/components/Table/helpers/select.js.map +1 -0
  22. package/build/components/Table/index.js +19 -0
  23. package/build/components/Table/index.js.map +1 -0
  24. package/build/components/index.js +26 -0
  25. package/build/components/index.js.map +1 -1
  26. package/build/primitives/Checkbox/Checkbox.js +52 -0
  27. package/build/primitives/Checkbox/Checkbox.js.map +1 -0
  28. package/build/primitives/Checkbox/Checkbox.module.css +45 -0
  29. package/build/primitives/Checkbox/__tests__/__snapshots__/Checkbox.test.js.snap +127 -0
  30. package/build/primitives/Checkbox/index.js +19 -0
  31. package/build/primitives/Checkbox/index.js.map +1 -0
  32. package/build/primitives/Icon/Icon.constants.js +3 -1
  33. package/build/primitives/Icon/Icon.constants.js.map +1 -1
  34. package/build/primitives/Input/Input.module.css +4 -0
  35. package/build/primitives/Layer/Layer.js +89 -0
  36. package/build/primitives/Layer/Layer.js.map +1 -0
  37. package/build/primitives/Layer/Layer.module.css +10 -0
  38. package/build/primitives/Layer/LayerContent.js +22 -0
  39. package/build/primitives/Layer/LayerContent.js.map +1 -0
  40. package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +55 -0
  41. package/build/primitives/Layer/helpers/getElementLayout.js +23 -0
  42. package/build/primitives/Layer/helpers/getElementLayout.js.map +1 -0
  43. package/build/primitives/Layer/helpers/getLayerPosition.js +43 -0
  44. package/build/primitives/Layer/helpers/getLayerPosition.js.map +1 -0
  45. package/build/primitives/Layer/helpers/index.js +32 -0
  46. package/build/primitives/Layer/helpers/index.js.map +1 -0
  47. package/build/primitives/Layer/index.js +32 -0
  48. package/build/primitives/Layer/index.js.map +1 -0
  49. package/build/primitives/Radio/Radio.js +49 -0
  50. package/build/primitives/Radio/Radio.js.map +1 -0
  51. package/build/primitives/Radio/Radio.module.css +59 -0
  52. package/build/primitives/Radio/__tests__/__snapshots__/Radio.test.js.snap +126 -0
  53. package/build/primitives/Radio/index.js +19 -0
  54. package/build/primitives/Radio/index.js.map +1 -0
  55. package/build/primitives/Select/Select.module.css +1 -0
  56. package/build/primitives/Switch/Switch.js +50 -0
  57. package/build/primitives/Switch/Switch.js.map +1 -0
  58. package/build/primitives/Switch/Switch.module.css +57 -0
  59. package/build/primitives/Switch/__tests__/__snapshots__/Switch.test.js.snap +109 -0
  60. package/build/primitives/Switch/index.js +19 -0
  61. package/build/primitives/Switch/index.js.map +1 -0
  62. package/build/primitives/View/View.js +12 -3
  63. package/build/primitives/View/View.js.map +1 -1
  64. package/build/primitives/index.js +64 -12
  65. package/build/primitives/index.js.map +1 -1
  66. package/build/theme/default.theme.css +7 -0
  67. package/package.json +1 -1
package/README.md CHANGED
@@ -12,6 +12,30 @@ yarn add @mirai/ui
12
12
 
13
13
  ## Primitives
14
14
 
15
+ ### Checkbox
16
+
17
+ This primitive returns a checkbox button based on the following properties:
18
+
19
+ - `checked:boolean` if true, the checkbox button is checked
20
+ - `disabled:boolean` applying 'disabled' attribute
21
+ - `name:string` input name
22
+ - `onChange:function` executed when input value changes
23
+
24
+ ```js
25
+ import { Checkbox, View } from '@mirai/ui';
26
+
27
+ const MyComponent = () => (
28
+ <View>
29
+ <Checkbox
30
+ name="checkbox"
31
+ checked={false}
32
+ disabled={false}
33
+ value={primitive}
34
+ onChange={() => console.log('change')
35
+ />
36
+ </View>
37
+ ```
38
+
15
39
  ### Icon
16
40
 
17
41
  This primitive returns a span with an icon based on a mandatory string prop `name` with one of the following possible values: Left, Right, Up, Down, Close, CloseArrow, Plus, Minus, EyeOpen, EyeClose.
@@ -57,6 +81,34 @@ const MyComponent = () => (
57
81
  );
58
82
  ```
59
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
+
60
112
  ### Pressable
61
113
 
62
114
  This primitive returns pressable elements based on the following properties:
@@ -80,6 +132,30 @@ const MyComponent = () => (
80
132
  );
81
133
  ```
82
134
 
135
+ ### Radio
136
+
137
+ This primitive returns a radio button based on the following properties:
138
+
139
+ - `checked:boolean` if true, the radio button is checked
140
+ - `disabled:boolean` applying 'disabled' attribute
141
+ - `name:string` input name
142
+ - `onChange:function` executed when input value changes
143
+
144
+ ```js
145
+ import { Radio, View } from '@mirai/ui';
146
+
147
+ const MyComponent = () => (
148
+ <View>
149
+ <Radio
150
+ name="radio"
151
+ checked={false}
152
+ disabled={false}
153
+ value={primitive}
154
+ onChange={() => console.log('change')
155
+ />
156
+ </View>
157
+ ```
158
+
83
159
  ### ScrollView
84
160
 
85
161
  This primitive is used to make vertically scrollable views and receives the following props:
@@ -234,7 +310,7 @@ const MyComponent = props => {
234
310
 
235
311
  ### InputNumber
236
312
 
237
- Input number component controling the value with 2 buttons. Receives the following props:
313
+ Input number component controlling the value with 2 buttons. Receives the following props:
238
314
 
239
315
  - `hint:string` brief message
240
316
  - `label:string` input label
@@ -255,6 +331,60 @@ const MyComponent = (props) => {
255
331
  };
256
332
  ```
257
333
 
334
+ ### InputOption
335
+
336
+ This component is used to display a radio button or checkbox base on a mandatory string prop `type`. It receives the following props:
337
+
338
+ - `reverse:boolean` if true the label is placed on the left side of the input element (false by default)
339
+ - `checked:boolean` if true, the input is checked
340
+ - `disabled:boolean` applying 'disabled' attribute
341
+ - `label:string` input label
342
+ - `name:string` input name
343
+ - `type:string` type of input (radio or checkbox)
344
+ - `value:number` input value
345
+ - `onChange:function` executed when input value changes
346
+
347
+ ```js
348
+ import { InputOption, View } from '@mirai/ui';
349
+
350
+ const MyComponent = () => {
351
+ const [value, setValue] = useState('');
352
+ const [checked, setChecked] = useState(false);
353
+ return (
354
+ <View>
355
+ <InputOption
356
+ type="radio"
357
+ label="Option 1"
358
+ name="option"
359
+ checked={value === 'radio1'}
360
+ disabled={false}
361
+ value="radio1"
362
+ onChange={() => useState('radio1')}
363
+ />
364
+ <InputOption
365
+ type="radio"
366
+ label="Option 2"
367
+ name="option"
368
+ checked={value === 'radio2'}
369
+ disabled={false}
370
+ value="radio2"
371
+ onChange={() => useState('radio2')}
372
+ />
373
+ </View>
374
+ <View>
375
+ <InputOption
376
+ type="checkbox"
377
+ label="Option 3"
378
+ name="optionCheckbox"
379
+ checked={checked}
380
+ disabled={false}
381
+ onChange={() => useChecked(!checked)}
382
+ />
383
+ </View>
384
+ );
385
+ };
386
+ ```
387
+
258
388
  ### InputText
259
389
 
260
390
  Text input component receiving the following props:
@@ -9,7 +9,7 @@ exports[`component:<InputNumber> inherit:className 1`] = `
9
9
  class="view texts"
10
10
  />
11
11
  <button
12
- class="pressable disabled button squared disabled"
12
+ class="pressable button squared"
13
13
  disabled=""
14
14
  >
15
15
  <span
@@ -91,7 +91,7 @@ exports[`component:<InputNumber> prop:hint 1`] = `
91
91
  </span>
92
92
  </div>
93
93
  <button
94
- class="pressable disabled button squared disabled"
94
+ class="pressable button squared"
95
95
  disabled=""
96
96
  >
97
97
  <span
@@ -173,7 +173,7 @@ exports[`component:<InputNumber> prop:label 1`] = `
173
173
  </span>
174
174
  </div>
175
175
  <button
176
- class="pressable disabled button squared disabled"
176
+ class="pressable button squared"
177
177
  disabled=""
178
178
  >
179
179
  <span
@@ -476,7 +476,7 @@ exports[`component:<InputNumber> renders 1`] = `
476
476
  class="view texts"
477
477
  />
478
478
  <button
479
- class="pressable disabled button squared disabled"
479
+ class="pressable button squared"
480
480
  disabled=""
481
481
  >
482
482
  <span
@@ -553,7 +553,7 @@ exports[`component:<InputNumber> testID 1`] = `
553
553
  class="view texts"
554
554
  />
555
555
  <button
556
- class="pressable disabled button squared disabled"
556
+ class="pressable button squared"
557
557
  disabled=""
558
558
  >
559
559
  <span
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SWITCH = exports.RADIO = exports.CHECKBOX = void 0;
7
+ var CHECKBOX = 'checkbox';
8
+ exports.CHECKBOX = CHECKBOX;
9
+ var RADIO = 'radio';
10
+ exports.RADIO = RADIO;
11
+ var SWITCH = 'switch';
12
+ exports.SWITCH = SWITCH;
13
+ //# sourceMappingURL=InputOption.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/InputOption/InputOption.constants.js"],"names":["CHECKBOX","RADIO","SWITCH"],"mappings":";;;;;;AAAA,IAAMA,QAAQ,GAAG,UAAjB;;AACA,IAAMC,KAAK,GAAG,OAAd;;AACA,IAAMC,MAAM,GAAG,QAAf","sourcesContent":["const CHECKBOX = 'checkbox';\nconst RADIO = 'radio';\nconst SWITCH = 'switch';\n\nexport { CHECKBOX, RADIO, SWITCH };\n"],"file":"InputOption.constants.js"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.InputOption = void 0;
9
+
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _helpers = require("../../helpers");
15
+
16
+ var _primitives = require("../../primitives");
17
+
18
+ var _InputOption = require("./InputOption.constants");
19
+
20
+ var _InputOptionModule = _interopRequireDefault(require("./InputOption.module.css"));
21
+
22
+ var _excluded = ["checked", "disabled", "label", "name", "reverse", "type", "value", "onChange"];
23
+
24
+ var InputOption = function InputOption(_ref) {
25
+ var checked = _ref.checked,
26
+ disabled = _ref.disabled,
27
+ label = _ref.label,
28
+ name = _ref.name,
29
+ reverse = _ref.reverse,
30
+ _ref$type = _ref.type,
31
+ type = _ref$type === void 0 ? _InputOption.CHECKBOX : _ref$type,
32
+ _ref$value = _ref.value,
33
+ value = _ref$value === void 0 ? '' : _ref$value,
34
+ _ref$onChange = _ref.onChange,
35
+ onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
36
+ others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
37
+ var Primitive = type === _InputOption.CHECKBOX ? _primitives.Checkbox : _primitives.Radio;
38
+
39
+ var handleChange = function handleChange(event) {
40
+ onChange(type === _InputOption.CHECKBOX ? !checked : value, event);
41
+ };
42
+
43
+ return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, Object.assign({}, others, {
44
+ style: others.style,
45
+ className: (0, _helpers.styles)(_InputOptionModule.default.inputOption, reverse && _InputOptionModule.default.reverse, others.className),
46
+ onPress: handleChange
47
+ }), /*#__PURE__*/_react.default.createElement(Primitive, {
48
+ checked: checked,
49
+ disabled: disabled,
50
+ name: name,
51
+ type: type,
52
+ value: value
53
+ }, type === _InputOption.CHECKBOX && checked ? /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
54
+ name: "Check",
55
+ className: (0, _helpers.styles)(_InputOptionModule.default.icon)
56
+ }) : undefined), label && /*#__PURE__*/_react.default.createElement(_primitives.Text, {
57
+ className: (0, _helpers.styles)(_InputOptionModule.default.label, disabled && _InputOptionModule.default.disabled)
58
+ }, label));
59
+ };
60
+
61
+ exports.InputOption = InputOption;
62
+ InputOption.displayName = 'Component:InputOption';
63
+ //# sourceMappingURL=InputOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/InputOption/InputOption.jsx"],"names":["InputOption","checked","disabled","label","name","reverse","type","CHECKBOX","value","onChange","others","Primitive","Checkbox","Radio","handleChange","event","style","inputOption","className","icon","undefined","displayName"],"mappings":";;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;AAEA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OAUd;AAAA,MATJC,OASI,QATJA,OASI;AAAA,MARJC,QAQI,QARJA,QAQI;AAAA,MAPJC,KAOI,QAPJA,KAOI;AAAA,MANJC,IAMI,QANJA,IAMI;AAAA,MALJC,OAKI,QALJA,OAKI;AAAA,uBAJJC,IAII;AAAA,MAJJA,IAII,0BAJGC,qBAIH;AAAA,wBAHJC,KAGI;AAAA,MAHJA,KAGI,2BAHI,EAGJ;AAAA,2BAFJC,QAEI;AAAA,MAFJA,QAEI,8BAFO,YAAM,CAAE,CAEf;AAAA,MADDC,MACC;AACJ,MAAMC,SAAS,GAAGL,IAAI,KAAKC,qBAAT,GAAoBK,oBAApB,GAA+BC,iBAAjD;;AAEA,MAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAW;AAC9BN,IAAAA,QAAQ,CAACH,IAAI,KAAKC,qBAAT,GAAoB,CAACN,OAArB,GAA+BO,KAAhC,EAAuCO,KAAvC,CAAR;AACD,GAFD;;AAIA,sBACE,6BAAC,qBAAD,oBACML,MADN;AAEE,IAAA,KAAK,EAAEA,MAAM,CAACM,KAFhB;AAGE,IAAA,SAAS,EAAE,qBAAOA,2BAAMC,WAAb,EAA0BZ,OAAO,IAAIW,2BAAMX,OAA3C,EAAoDK,MAAM,CAACQ,SAA3D,CAHb;AAIE,IAAA,OAAO,EAAEJ;AAJX,mBAME,6BAAC,SAAD;AAAW,IAAA,OAAO,EAAEb,OAApB;AAA6B,IAAA,QAAQ,EAAEC,QAAvC;AAAiD,IAAA,IAAI,EAAEE,IAAvD;AAA6D,IAAA,IAAI,EAAEE,IAAnE;AAAyE,IAAA,KAAK,EAAEE;AAAhF,KACGF,IAAI,KAAKC,qBAAT,IAAqBN,OAArB,gBAA+B,6BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC,OAAX;AAAmB,IAAA,SAAS,EAAE,qBAAOe,2BAAMG,IAAb;AAA9B,IAA/B,GAAsFC,SADzF,CANF,EASGjB,KAAK,iBAAI,6BAAC,gBAAD;AAAM,IAAA,SAAS,EAAE,qBAAOa,2BAAMb,KAAb,EAAoBD,QAAQ,IAAIc,2BAAMd,QAAtC;AAAjB,KAAmEC,KAAnE,CATZ,CADF;AAaD,CA9BD;;;AAgCAH,WAAW,CAACqB,WAAZ,GAA0B,uBAA1B","sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Radio, Checkbox, Icon, Pressable, 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 : Radio;\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"],"file":"InputOption.js"}
@@ -0,0 +1,38 @@
1
+ :root {
2
+ --mirai-ui-input-option-disabled: var(--mirai-ui-disabled);
3
+ --mirai-ui-input-option-label-margin: var(--mirai-ui-space-S);
4
+ --mirai-ui-input-option-padding-y: var(--mirai-ui-space-S);
5
+ }
6
+
7
+ .inputOption {
8
+ align-items: center;
9
+ display: flex;
10
+ flex-direction: row;
11
+ margin-bottom: var(--mirai-ui-input-option-padding-y);
12
+ position: relative;
13
+ }
14
+
15
+ .icon {
16
+ color: var(--mirai-ui-base);
17
+ left: 0;
18
+ margin: calc(calc(var(--mirai-ui-checkbox-size) - var(--mirai-ui-font-size-paragraph)) / 2);
19
+ position: absolute;
20
+ top: 0;
21
+ }
22
+
23
+ .label {
24
+ margin-left: var(--mirai-ui-input-option-label-margin);
25
+ }
26
+
27
+ .label.disabled {
28
+ color: var(--mirai-ui-input-option-disabled);
29
+ }
30
+
31
+ .reverse {
32
+ flex-direction: row-reverse;
33
+ }
34
+
35
+ .reverse .label {
36
+ margin-left: 0;
37
+ margin-right: var(--mirai-ui-input-option-label-margin);
38
+ }
@@ -0,0 +1,232 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`primitive:<InputOption> inherit:className 1`] = `
4
+ <DocumentFragment>
5
+ <button
6
+ class="pressable inputOption mirai"
7
+ >
8
+ <div
9
+ class="checkbox"
10
+ >
11
+ <input
12
+ class=""
13
+ name="name"
14
+ type="checkbox"
15
+ value=""
16
+ />
17
+ </div>
18
+ </button>
19
+ </DocumentFragment>
20
+ `;
21
+
22
+ exports[`primitive:<InputOption> prop:checked && disabled 1`] = `
23
+ <DocumentFragment>
24
+ <button
25
+ class="pressable inputOption"
26
+ >
27
+ <div
28
+ class="checkbox"
29
+ >
30
+ <input
31
+ checked=""
32
+ class="checked"
33
+ disabled=""
34
+ name="name"
35
+ type="checkbox"
36
+ value=""
37
+ />
38
+ <span
39
+ class="icon icon"
40
+ >
41
+ <svg
42
+ fill="none"
43
+ height="1em"
44
+ stroke="currentColor"
45
+ stroke-linecap="round"
46
+ stroke-linejoin="round"
47
+ stroke-width="2"
48
+ viewBox="0 0 24 24"
49
+ width="1em"
50
+ xmlns="http://www.w3.org/2000/svg"
51
+ >
52
+ <polyline
53
+ points="20 6 9 17 4 12"
54
+ />
55
+ </svg>
56
+ </span>
57
+ </div>
58
+ </button>
59
+ </DocumentFragment>
60
+ `;
61
+
62
+ exports[`primitive:<InputOption> prop:checked 1`] = `
63
+ <DocumentFragment>
64
+ <button
65
+ class="pressable inputOption"
66
+ >
67
+ <div
68
+ class="checkbox"
69
+ >
70
+ <input
71
+ checked=""
72
+ class="checked"
73
+ name="name"
74
+ type="checkbox"
75
+ value=""
76
+ />
77
+ <span
78
+ class="icon icon"
79
+ >
80
+ <svg
81
+ fill="none"
82
+ height="1em"
83
+ stroke="currentColor"
84
+ stroke-linecap="round"
85
+ stroke-linejoin="round"
86
+ stroke-width="2"
87
+ viewBox="0 0 24 24"
88
+ width="1em"
89
+ xmlns="http://www.w3.org/2000/svg"
90
+ >
91
+ <polyline
92
+ points="20 6 9 17 4 12"
93
+ />
94
+ </svg>
95
+ </span>
96
+ </div>
97
+ </button>
98
+ </DocumentFragment>
99
+ `;
100
+
101
+ exports[`primitive:<InputOption> prop:disabled 1`] = `
102
+ <DocumentFragment>
103
+ <button
104
+ class="pressable inputOption"
105
+ >
106
+ <div
107
+ class="checkbox"
108
+ >
109
+ <input
110
+ class=""
111
+ disabled=""
112
+ name="name"
113
+ type="checkbox"
114
+ value=""
115
+ />
116
+ </div>
117
+ </button>
118
+ </DocumentFragment>
119
+ `;
120
+
121
+ exports[`primitive:<InputOption> prop:label 1`] = `
122
+ <DocumentFragment>
123
+ <button
124
+ class="pressable inputOption"
125
+ >
126
+ <div
127
+ class="checkbox"
128
+ >
129
+ <input
130
+ class=""
131
+ name="name"
132
+ type="checkbox"
133
+ value=""
134
+ />
135
+ </div>
136
+ <span
137
+ class="text paragraph label"
138
+ >
139
+ label
140
+ </span>
141
+ </button>
142
+ </DocumentFragment>
143
+ `;
144
+
145
+ exports[`primitive:<InputOption> prop:reverse + label 1`] = `
146
+ <DocumentFragment>
147
+ <button
148
+ class="pressable inputOption reverse"
149
+ >
150
+ <div
151
+ class="checkbox"
152
+ >
153
+ <input
154
+ class=""
155
+ name="name"
156
+ type="checkbox"
157
+ value=""
158
+ />
159
+ </div>
160
+ <span
161
+ class="text paragraph label"
162
+ >
163
+ label
164
+ </span>
165
+ </button>
166
+ </DocumentFragment>
167
+ `;
168
+
169
+ exports[`primitive:<InputOption> prop:type 1`] = `
170
+ <DocumentFragment>
171
+ <button
172
+ class="pressable inputOption"
173
+ >
174
+ <div
175
+ class="radio"
176
+ >
177
+ <input
178
+ name="name"
179
+ type="radio"
180
+ value=""
181
+ />
182
+ <span
183
+ class="checkmark"
184
+ />
185
+ </div>
186
+ <span
187
+ class="text paragraph label"
188
+ >
189
+ label
190
+ </span>
191
+ </button>
192
+ </DocumentFragment>
193
+ `;
194
+
195
+ exports[`primitive:<InputOption> renders 1`] = `
196
+ <DocumentFragment>
197
+ <button
198
+ class="pressable inputOption"
199
+ >
200
+ <div
201
+ class="checkbox"
202
+ >
203
+ <input
204
+ class=""
205
+ name="name"
206
+ type="checkbox"
207
+ value=""
208
+ />
209
+ </div>
210
+ </button>
211
+ </DocumentFragment>
212
+ `;
213
+
214
+ exports[`primitive:<InputOption> testID 1`] = `
215
+ <DocumentFragment>
216
+ <button
217
+ class="pressable inputOption"
218
+ data-testid="mirai"
219
+ >
220
+ <div
221
+ class="checkbox"
222
+ >
223
+ <input
224
+ class=""
225
+ name="name"
226
+ type="checkbox"
227
+ value=""
228
+ />
229
+ </div>
230
+ </button>
231
+ </DocumentFragment>
232
+ `;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _InputOption = require("./InputOption");
8
+
9
+ Object.keys(_InputOption).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _InputOption[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _InputOption[key];
16
+ }
17
+ });
18
+ });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/InputOption/index.js"],"names":[],"mappings":";;;;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './InputOption';\n"],"file":"index.js"}
@@ -2,6 +2,7 @@
2
2
  --mirai-ui-modal-background: var(--mirai-ui-base);
3
3
  --mirai-ui-modal-overflow: rgba(0, 0, 0, 0.2);
4
4
  --mirai-ui-modal-icon: var(--mirai-ui-space-L);
5
+ --mirai-ui-modal-layer: var(--mirai-ui-layer-L);
5
6
  }
6
7
 
7
8
  .modal {
@@ -30,7 +31,7 @@
30
31
  transition: opacity var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing);
31
32
  top: 0;
32
33
  width: 100vw;
33
- z-index: 1000;
34
+ z-index: var(--mirai-ui-modal-layer);
34
35
  }
35
36
 
36
37
  .overflow.visible {
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.TableRow = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
11
+
12
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _helpers = require("../../helpers");
17
+
18
+ var _primitives = require("../../primitives");
19
+
20
+ var _InputOption = require("../InputOption");
21
+
22
+ var _TableModule = _interopRequireDefault(require("./Table.module.css"));
23
+
24
+ var _excluded = ["dataSource", "schema", "selected", "sort", "onPress", "onSelect", "onSort"];
25
+
26
+ var TableRow = function TableRow(_ref) {
27
+ var dataSource = _ref.dataSource,
28
+ schema = _ref.schema,
29
+ selected = _ref.selected,
30
+ _ref$sort = _ref.sort,
31
+ sort = _ref$sort === void 0 ? {} : _ref$sort,
32
+ onPress = _ref.onPress,
33
+ onSelect = _ref.onSelect,
34
+ onSort = _ref.onSort,
35
+ others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
36
+ var isHead = dataSource === undefined;
37
+ var fields = Object.keys(schema);
38
+ var tag = isHead ? 'th' : 'td';
39
+ var testId = others['data-testid'];
40
+ return /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, others, {
41
+ role: "tr",
42
+ className: (0, _helpers.styles)(selected && _TableModule.default.selected, onPress && _TableModule.default.onPress, others.className)
43
+ }), onSelect && /*#__PURE__*/_react.default.createElement(tag, {
44
+ className: _TableModule.default.select
45
+ }, /*#__PURE__*/_react.default.createElement(_primitives.View, {
46
+ row: true
47
+ }, !isHead && /*#__PURE__*/_react.default.createElement(_InputOption.InputOption, {
48
+ checked: selected,
49
+ "data-testid": testId ? "".concat(testId, "-checkbox") : undefined,
50
+ name: "checkbox",
51
+ className: _TableModule.default.checkbox,
52
+ onChange: function onChange() {
53
+ return onSelect(dataSource);
54
+ }
55
+ }))), fields.map(function (field) {
56
+ var _React$createElement;
57
+
58
+ return /*#__PURE__*/_react.default.createElement(tag, (_React$createElement = {}, (0, _defineProperty2.default)(_React$createElement, 'data-testid', testId ? "".concat(testId, "-").concat(field) : undefined), (0, _defineProperty2.default)(_React$createElement, "key", field), (0, _defineProperty2.default)(_React$createElement, "onClick", !isHead && onPress ? function () {
59
+ return onPress(dataSource);
60
+ } : undefined), _React$createElement), /*#__PURE__*/_react.default.createElement(_primitives.View, {
61
+ row: true,
62
+ tag: "span",
63
+ className: isHead && _TableModule.default.head,
64
+ onClick: isHead ? function () {
65
+ return onSort(field);
66
+ } : undefined
67
+ }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isHead ? schema[field].label : dataSource[field], isHead && onSort && /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
68
+ name: sort[field] ? 'Down' : 'Up',
69
+ className: sort[field] === undefined && _TableModule.default.hideIcon
70
+ }))));
71
+ }));
72
+ };
73
+
74
+ exports.TableRow = TableRow;
75
+ TableRow.displayName = 'Table:Row';
76
+ //# sourceMappingURL=Table.Row.js.map