@mirai/ui 1.1.0-f → 1.1.1
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 +109 -60
- package/build/components/Action/Action.js +1 -1
- package/build/components/Action/Action.js.map +1 -1
- package/build/components/Action/Action.module.css +4 -7
- package/build/components/Action/Action.stories.js +1 -1
- package/build/components/Action/Action.stories.js.map +1 -1
- package/build/components/Action/__tests__/__snapshots__/Action.test.js.snap +26 -40
- package/build/components/Button/Button.module.css +30 -33
- package/build/components/Button/Button.stories.js +9 -0
- package/build/components/Button/Button.stories.js.map +1 -1
- package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +21 -30
- package/build/components/Calendar/Calendar.Month.js +12 -8
- package/build/components/Calendar/Calendar.Month.js.map +1 -1
- package/build/components/Calendar/Calendar.Week.js +7 -10
- package/build/components/Calendar/Calendar.Week.js.map +1 -1
- package/build/components/Calendar/Calendar.js +10 -2
- package/build/components/Calendar/Calendar.js.map +1 -1
- package/build/components/Calendar/Calendar.module.css +8 -9
- package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +15768 -15800
- package/build/components/Form/Form.constants.js +1 -1
- package/build/components/Form/Form.constants.js.map +1 -1
- package/build/components/Form/Form.js +3 -1
- package/build/components/Form/Form.js.map +1 -1
- package/build/components/Form/Form.stories.js +6 -1
- package/build/components/Form/Form.stories.js.map +1 -1
- package/build/components/Form/__tests__/__snapshots__/Form.test.jsx.snap +9 -9
- package/build/components/InputDate/__tests__/__snapshots__/InputDate.test.js.snap +42 -42
- package/build/components/InputNumber/InputNumber.js +2 -1
- package/build/components/InputNumber/InputNumber.js.map +1 -1
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +138 -153
- package/build/components/InputOption/InputOption.js +8 -1
- package/build/components/InputOption/InputOption.js.map +1 -1
- package/build/components/InputOption/InputOption.module.css +13 -2
- package/build/components/InputOption/InputOption.stories.js +2 -1
- package/build/components/InputOption/InputOption.stories.js.map +1 -1
- package/build/components/InputOption/__tests__/__snapshots__/InputOption.test.js.snap +96 -90
- package/build/components/InputPhone/InputPhone.js +23 -20
- package/build/components/InputPhone/InputPhone.js.map +1 -1
- package/build/components/InputPhone/InputPhone.module.css +19 -6
- package/build/components/InputPhone/InputPhone.stories.js +3 -3
- package/build/components/InputPhone/InputPhone.stories.js.map +1 -1
- package/build/components/InputPhone/__tests__/__snapshots__/InputPhone.test.js.snap +410 -410
- package/build/components/InputPhone/helpers/index.js +11 -0
- package/build/components/InputPhone/helpers/index.js.map +1 -1
- package/build/components/InputPhone/helpers/sanitizePrefixes.js +24 -0
- package/build/components/InputPhone/helpers/sanitizePrefixes.js.map +1 -0
- package/build/components/InputSelect/InputSelect.js +3 -5
- package/build/components/InputSelect/InputSelect.js.map +1 -1
- package/build/components/InputSelect/InputSelect.stories.js +1 -0
- package/build/components/InputSelect/InputSelect.stories.js.map +1 -1
- package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +136 -136
- package/build/components/InputSelect/partials/InputSelect.Expand.js +23 -0
- package/build/components/InputSelect/partials/InputSelect.Expand.js.map +1 -0
- package/build/components/InputSelect/partials/index.js +17 -0
- package/build/components/InputSelect/partials/index.js.map +1 -0
- package/build/components/InputText/InputText.js +6 -4
- package/build/components/InputText/InputText.js.map +1 -1
- package/build/components/InputText/InputText.module.css +18 -6
- package/build/components/InputText/InputText.stories.js +7 -2
- package/build/components/InputText/InputText.stories.js.map +1 -1
- package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +142 -143
- package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +72 -70
- package/build/components/Modal/Modal.js +15 -8
- package/build/components/Modal/Modal.js.map +1 -1
- package/build/components/Modal/Modal.module.css +30 -14
- package/build/components/Modal/Modal.stories.js +1 -0
- package/build/components/Modal/Modal.stories.js.map +1 -1
- package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +92 -98
- package/build/components/Notification/Notification.js +20 -12
- package/build/components/Notification/Notification.js.map +1 -1
- package/build/components/Notification/Notification.module.css +44 -58
- package/build/components/Notification/Notification.stories.js +15 -2
- package/build/components/Notification/Notification.stories.js.map +1 -1
- package/build/components/Notification/__tests__/__snapshots__/Notification.test.js.snap +600 -254
- package/build/components/Progress/Progress.js +2 -0
- package/build/components/Progress/Progress.js.map +1 -1
- package/build/components/Progress/__tests__/__snapshots__/Progress.test.jsx.snap +18 -18
- package/build/components/Slider/Slider.constants.js +3 -1
- package/build/components/Slider/Slider.constants.js.map +1 -1
- package/build/components/Slider/Slider.js +67 -66
- package/build/components/Slider/Slider.js.map +1 -1
- package/build/components/Slider/Slider.module.css +55 -52
- package/build/components/Slider/Slider.stories.js +9 -6
- package/build/components/Slider/Slider.stories.js.map +1 -1
- package/build/components/Slider/__tests__/__snapshots__/Slider.test.js.snap +714 -333
- package/build/components/Table/Table.ColumnFilter.js +17 -14
- package/build/components/Table/Table.ColumnFilter.js.map +1 -1
- package/build/components/Table/Table.Row.js +2 -1
- package/build/components/Table/Table.Row.js.map +1 -1
- package/build/components/Table/Table.constants.js +3 -1
- package/build/components/Table/Table.constants.js.map +1 -1
- package/build/components/Table/Table.js +54 -17
- package/build/components/Table/Table.js.map +1 -1
- package/build/components/Table/Table.module.css +12 -6
- package/build/components/Table/Table.stories.js +39 -19
- package/build/components/Table/Table.stories.js.map +1 -1
- package/build/components/Table/Table.stories.module.css +4 -5
- package/build/components/Table/__tests__/__snapshots__/Table.ColumnFilter.test.js.snap +221 -240
- package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +1725 -1085
- package/build/components/Table/helpers/exists.js +2 -3
- package/build/components/Table/helpers/exists.js.map +1 -1
- package/build/components/Table/helpers/select.js +24 -16
- package/build/components/Table/helpers/select.js.map +1 -1
- package/build/components/Tooltip/Tooltip.js +29 -6
- package/build/components/Tooltip/Tooltip.js.map +1 -1
- package/build/components/Tooltip/__tests__/__snapshots__/Tooltip.test.jsx.snap +51 -44
- package/build/components/index.js +11 -0
- package/build/components/index.js.map +1 -1
- package/build/helpers/getInputPhoneErrors.js +3 -2
- package/build/helpers/getInputPhoneErrors.js.map +1 -1
- package/build/hooks/useDevice.js +1 -1
- package/build/hooks/useDevice.js.map +1 -1
- package/build/primitives/Checkbox/Checkbox.js +4 -3
- package/build/primitives/Checkbox/Checkbox.js.map +1 -1
- package/build/primitives/Checkbox/Checkbox.module.css +42 -6
- package/build/primitives/Checkbox/__tests__/__snapshots__/Checkbox.test.js.snap +47 -16
- package/build/primitives/Icon/Icon.constants.js +43 -21
- package/build/primitives/Icon/Icon.constants.js.map +1 -1
- package/build/primitives/Icon/Icon.js +15 -5
- package/build/primitives/Icon/Icon.js.map +1 -1
- package/build/primitives/Icon/Icon.module.css +32 -19
- package/build/primitives/Icon/Icon.stories.js +5 -0
- package/build/primitives/Icon/Icon.stories.js.map +1 -1
- package/build/primitives/Icon/__tests__/__snapshots__/Icon.test.js.snap +291 -100
- package/build/primitives/Input/Input.js +9 -3
- package/build/primitives/Input/Input.js.map +1 -1
- package/build/primitives/Input/Input.stories.js +2 -0
- package/build/primitives/Input/Input.stories.js.map +1 -1
- package/build/primitives/Input/__tests__/__snapshots__/Input.test.js.snap +22 -0
- package/build/primitives/Layer/Layer.js +11 -5
- package/build/primitives/Layer/Layer.js.map +1 -1
- package/build/primitives/Layer/Layer.module.css +4 -0
- package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +78 -42
- package/build/primitives/Layer/helpers/index.js +11 -0
- package/build/primitives/Layer/helpers/index.js.map +1 -1
- package/build/primitives/Layer/helpers/isComponentFixed.js +32 -0
- package/build/primitives/Layer/helpers/isComponentFixed.js.map +1 -0
- package/build/primitives/Pressable/Pressable.constants.js +1 -1
- package/build/primitives/Pressable/Pressable.constants.js.map +1 -1
- package/build/primitives/Pressable/Pressable.js +3 -7
- package/build/primitives/Pressable/Pressable.js.map +1 -1
- package/build/primitives/Pressable/Pressable.module.css +0 -1
- package/build/primitives/Pressable/__tests__/__snapshots__/Pressable.test.js.snap +10 -14
- package/build/primitives/Primitive/Primitive.js +2 -2
- package/build/primitives/Primitive/Primitive.js.map +1 -1
- package/build/primitives/Primitive/__tests__/__snapshots__/Primitive.test.js.snap +7 -7
- package/build/primitives/Primitive/helpers/index.js +0 -11
- package/build/primitives/Primitive/helpers/index.js.map +1 -1
- package/build/primitives/Radio/Radio.js +1 -1
- package/build/primitives/Radio/Radio.js.map +1 -1
- package/build/primitives/Radio/Radio.module.css +18 -2
- package/build/primitives/Radio/__tests__/__snapshots__/Radio.test.js.snap +21 -21
- package/build/primitives/ScrollView/ScrollView.js +1 -1
- package/build/primitives/ScrollView/ScrollView.js.map +1 -1
- package/build/primitives/ScrollView/ScrollView.module.css +1 -0
- package/build/primitives/ScrollView/ScrollView.stories.js +5 -6
- package/build/primitives/ScrollView/ScrollView.stories.js.map +1 -1
- package/build/primitives/ScrollView/__tests__/__snapshots__/ScrollView.test.js.snap +20 -20
- package/build/primitives/Select/Select.js +13 -6
- package/build/primitives/Select/Select.js.map +1 -1
- package/build/primitives/Select/Select.stories.js +1 -0
- package/build/primitives/Select/Select.stories.js.map +1 -1
- package/build/primitives/Select/__tests__/__snapshots__/Select.test.js.snap +36 -0
- package/build/primitives/Switch/Switch.js +5 -3
- package/build/primitives/Switch/Switch.js.map +1 -1
- package/build/primitives/Switch/Switch.module.css +36 -8
- package/build/primitives/Switch/Switch.stories.js +1 -0
- package/build/primitives/Switch/Switch.stories.js.map +1 -1
- package/build/primitives/Switch/__tests__/__snapshots__/Switch.test.js.snap +88 -25
- package/build/primitives/Text/Text.js +12 -5
- package/build/primitives/Text/Text.js.map +1 -1
- package/build/primitives/Text/Text.module.css +29 -14
- package/build/primitives/Text/Text.stories.js +4 -0
- package/build/primitives/Text/Text.stories.js.map +1 -1
- package/build/primitives/Text/__tests__/__snapshots__/Text.test.js.snap +78 -38
- package/build/primitives/View/View.js +1 -1
- package/build/primitives/View/View.js.map +1 -1
- package/build/primitives/View/__tests__/__snapshots__/View.test.js.snap +10 -10
- package/build/theme/default.theme.css +54 -53
- package/build/theme/theme.constants.js +3 -1
- package/build/theme/theme.constants.js.map +1 -1
- package/build/theme/theme.js +34 -11
- package/build/theme/theme.js.map +1 -1
- package/package.json +4 -5
- package/build/primitives/Primitive/helpers/getTag.js +0 -33
- package/build/primitives/Primitive/helpers/getTag.js.map +0 -1
|
@@ -2,34 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`component:<Action> inherit:className 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<
|
|
5
|
+
<button
|
|
6
6
|
class="pressable action mirai"
|
|
7
|
-
tabindex="0"
|
|
8
7
|
>
|
|
9
8
|
children
|
|
10
|
-
</
|
|
9
|
+
</button>
|
|
11
10
|
</DocumentFragment>
|
|
12
11
|
`;
|
|
13
12
|
|
|
14
13
|
exports[`component:<Action> prop:bold 1`] = `
|
|
15
14
|
<DocumentFragment>
|
|
16
|
-
<
|
|
15
|
+
<button
|
|
17
16
|
class="pressable action bold"
|
|
18
|
-
tabindex="0"
|
|
19
17
|
>
|
|
20
18
|
children
|
|
21
|
-
</
|
|
19
|
+
</button>
|
|
22
20
|
</DocumentFragment>
|
|
23
21
|
`;
|
|
24
22
|
|
|
25
23
|
exports[`component:<Action> prop:disabled 1`] = `
|
|
26
24
|
<DocumentFragment>
|
|
27
|
-
<
|
|
25
|
+
<button
|
|
28
26
|
class="pressable disabled action disabled"
|
|
29
27
|
disabled=""
|
|
30
28
|
>
|
|
31
29
|
children
|
|
32
|
-
</
|
|
30
|
+
</button>
|
|
33
31
|
</DocumentFragment>
|
|
34
32
|
`;
|
|
35
33
|
|
|
@@ -38,7 +36,6 @@ exports[`component:<Action> prop:href + prop:target 1`] = `
|
|
|
38
36
|
<a
|
|
39
37
|
class="pressable action"
|
|
40
38
|
href="soyjavi.com"
|
|
41
|
-
tabindex="0"
|
|
42
39
|
>
|
|
43
40
|
children
|
|
44
41
|
</a>
|
|
@@ -50,7 +47,6 @@ exports[`component:<Action> prop:href 1`] = `
|
|
|
50
47
|
<a
|
|
51
48
|
class="pressable action"
|
|
52
49
|
href="soyjavi.com"
|
|
53
|
-
tabindex="0"
|
|
54
50
|
>
|
|
55
51
|
children
|
|
56
52
|
</a>
|
|
@@ -59,111 +55,101 @@ exports[`component:<Action> prop:href 1`] = `
|
|
|
59
55
|
|
|
60
56
|
exports[`component:<Action> prop:inline & prop:large 1`] = `
|
|
61
57
|
<DocumentFragment>
|
|
62
|
-
<
|
|
58
|
+
<button
|
|
63
59
|
class="pressable action inline large"
|
|
64
|
-
tabindex="0"
|
|
65
60
|
>
|
|
66
61
|
children
|
|
67
|
-
</
|
|
62
|
+
</button>
|
|
68
63
|
</DocumentFragment>
|
|
69
64
|
`;
|
|
70
65
|
|
|
71
66
|
exports[`component:<Action> prop:inline & prop:small 1`] = `
|
|
72
67
|
<DocumentFragment>
|
|
73
|
-
<
|
|
68
|
+
<button
|
|
74
69
|
class="pressable action inline small"
|
|
75
|
-
tabindex="0"
|
|
76
70
|
>
|
|
77
71
|
children
|
|
78
|
-
</
|
|
72
|
+
</button>
|
|
79
73
|
</DocumentFragment>
|
|
80
74
|
`;
|
|
81
75
|
|
|
82
76
|
exports[`component:<Action> prop:inline default 1`] = `
|
|
83
77
|
<DocumentFragment>
|
|
84
|
-
<
|
|
78
|
+
<button
|
|
85
79
|
class="pressable action inline"
|
|
86
|
-
tabindex="0"
|
|
87
80
|
>
|
|
88
81
|
children
|
|
89
|
-
</
|
|
82
|
+
</button>
|
|
90
83
|
</DocumentFragment>
|
|
91
84
|
`;
|
|
92
85
|
|
|
93
86
|
exports[`component:<Action> prop:large 1`] = `
|
|
94
87
|
<DocumentFragment>
|
|
95
|
-
<
|
|
88
|
+
<button
|
|
96
89
|
class="pressable action large"
|
|
97
|
-
tabindex="0"
|
|
98
90
|
>
|
|
99
91
|
children
|
|
100
|
-
</
|
|
92
|
+
</button>
|
|
101
93
|
</DocumentFragment>
|
|
102
94
|
`;
|
|
103
95
|
|
|
104
96
|
exports[`component:<Action> prop:small 1`] = `
|
|
105
97
|
<DocumentFragment>
|
|
106
|
-
<
|
|
98
|
+
<button
|
|
107
99
|
class="pressable action small"
|
|
108
|
-
tabindex="0"
|
|
109
100
|
>
|
|
110
101
|
children
|
|
111
|
-
</
|
|
102
|
+
</button>
|
|
112
103
|
</DocumentFragment>
|
|
113
104
|
`;
|
|
114
105
|
|
|
115
106
|
exports[`component:<Action> prop:tag 1`] = `
|
|
116
107
|
<DocumentFragment>
|
|
117
|
-
<
|
|
108
|
+
<a
|
|
118
109
|
class="pressable action"
|
|
119
|
-
tabindex="0"
|
|
120
110
|
>
|
|
121
111
|
children
|
|
122
|
-
</
|
|
112
|
+
</a>
|
|
123
113
|
</DocumentFragment>
|
|
124
114
|
`;
|
|
125
115
|
|
|
126
116
|
exports[`component:<Action> prop:underline 1`] = `
|
|
127
117
|
<DocumentFragment>
|
|
128
|
-
<
|
|
118
|
+
<button
|
|
129
119
|
class="pressable action underline"
|
|
130
|
-
tabindex="0"
|
|
131
120
|
>
|
|
132
121
|
children
|
|
133
|
-
</
|
|
122
|
+
</button>
|
|
134
123
|
</DocumentFragment>
|
|
135
124
|
`;
|
|
136
125
|
|
|
137
126
|
exports[`component:<Action> prop:wide 1`] = `
|
|
138
127
|
<DocumentFragment>
|
|
139
|
-
<
|
|
128
|
+
<button
|
|
140
129
|
class="pressable action wide"
|
|
141
|
-
tabindex="0"
|
|
142
130
|
>
|
|
143
131
|
children
|
|
144
|
-
</
|
|
132
|
+
</button>
|
|
145
133
|
</DocumentFragment>
|
|
146
134
|
`;
|
|
147
135
|
|
|
148
136
|
exports[`component:<Action> renders 1`] = `
|
|
149
137
|
<DocumentFragment>
|
|
150
|
-
<
|
|
138
|
+
<button
|
|
151
139
|
class="pressable action"
|
|
152
|
-
tabindex="0"
|
|
153
140
|
>
|
|
154
141
|
children
|
|
155
|
-
</
|
|
142
|
+
</button>
|
|
156
143
|
</DocumentFragment>
|
|
157
144
|
`;
|
|
158
145
|
|
|
159
146
|
exports[`component:<Action> testId 1`] = `
|
|
160
147
|
<DocumentFragment>
|
|
161
|
-
<
|
|
148
|
+
<button
|
|
162
149
|
class="pressable action"
|
|
163
150
|
data-testid="mirai"
|
|
164
|
-
tabindex="0"
|
|
165
151
|
>
|
|
166
152
|
children
|
|
167
|
-
</
|
|
153
|
+
</button>
|
|
168
154
|
</DocumentFragment>
|
|
169
155
|
`;
|
|
@@ -8,44 +8,31 @@ button.button {
|
|
|
8
8
|
font-size: var(--mirai-ui-font-size-action);
|
|
9
9
|
font-weight: var(--mirai-ui-button-font-weight);
|
|
10
10
|
justify-content: center;
|
|
11
|
+
outline: none;
|
|
12
|
+
overflow: hidden;
|
|
11
13
|
padding: var(--mirai-ui-button-padding-y) var(--mirai-ui-button-padding-x);
|
|
12
14
|
position: relative;
|
|
15
|
+
transition: background-color var(--mirai-ui-motion-collapse) var(--mirai-ui-motion-easing),
|
|
16
|
+
box-shadow var(--mirai-ui-motion-collapse) var(--mirai-ui-motion-easing);
|
|
13
17
|
width: fit-content;
|
|
14
18
|
}
|
|
15
19
|
|
|
20
|
+
/* -- variants */
|
|
16
21
|
button.button:disabled:not(.busy) {
|
|
17
22
|
background-color: var(--mirai-ui-button-disabled-background);
|
|
18
23
|
color: var(--mirai-ui-button-disabled-color);
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
button.button:not(.transparent):not(:disabled):hover {
|
|
22
|
-
color: var(--mirai-ui-button-color);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
button.button:not(.secondary):not(:disabled):active {
|
|
26
|
-
box-shadow: inset 0 0 var(--mirai-ui-space-XL) var(--mirai-ui-space-XL) var(--mirai-ui-button-color-active);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
button.button.secondary:not(:disabled):active {
|
|
30
|
-
background-color: var(--mirai-ui-button-color-hover);
|
|
31
|
-
box-shadow: none;
|
|
32
|
-
color: var(--mirai-ui-button-color);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
button.large:not(.squared) {
|
|
36
|
-
font-size: var(--mirai-ui-font-size-paragraph);
|
|
37
|
-
padding: var(--mirai-ui-button-padding-y)
|
|
38
|
-
calc(var(--mirai-ui-button-padding-x) + calc(var(--mirai-ui-button-padding-y) / 2));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
26
|
button.secondary {
|
|
42
27
|
background-color: var(--mirai-ui-button-secondary-background);
|
|
43
28
|
box-shadow: inset 0 0 0 var(--mirai-ui-border-width) var(--mirai-ui-button-background);
|
|
44
29
|
color: var(--mirai-ui-button-background);
|
|
45
30
|
}
|
|
46
31
|
|
|
47
|
-
button.
|
|
48
|
-
|
|
32
|
+
button.button:not(:disabled).secondary:focus,
|
|
33
|
+
button.button:not(:disabled).secondary:hover {
|
|
34
|
+
box-shadow: inset 0 0 0 var(--mirai-ui-border-width) var(--mirai-ui-focus-color), var(--mirai-ui-focus-shadow);
|
|
35
|
+
color: var(--mirai-ui-focus-color);
|
|
49
36
|
}
|
|
50
37
|
|
|
51
38
|
button.transparent {
|
|
@@ -53,10 +40,28 @@ button.transparent {
|
|
|
53
40
|
color: var(--mirai-ui-content);
|
|
54
41
|
}
|
|
55
42
|
|
|
56
|
-
button.transparent:
|
|
43
|
+
button.transparent:not(:disabled):focus,
|
|
44
|
+
button.transparent:not(:disabled):hover {
|
|
57
45
|
background-color: var(--mirai-ui-content-background);
|
|
58
46
|
}
|
|
59
47
|
|
|
48
|
+
button.button:not(:disabled):not(.secondary):not(.transparent):focus,
|
|
49
|
+
button.button:not(:disabled):not(.secondary):not(.transparent):hover {
|
|
50
|
+
background-color: var(--mirai-ui-focus-color);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
button.button:not(:disabled):focus,
|
|
54
|
+
button.button:not(:disabled):hover {
|
|
55
|
+
box-shadow: var(--mirai-ui-focus-shadow);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* -- sizing */
|
|
59
|
+
button.large:not(.squared) {
|
|
60
|
+
font-size: var(--mirai-ui-font-size-paragraph);
|
|
61
|
+
padding: var(--mirai-ui-button-padding-y)
|
|
62
|
+
calc(var(--mirai-ui-button-padding-x) + calc(var(--mirai-ui-button-padding-y) / 2));
|
|
63
|
+
}
|
|
64
|
+
|
|
60
65
|
button.rounded {
|
|
61
66
|
border-radius: var(--mirai-ui-space-XXL);
|
|
62
67
|
}
|
|
@@ -77,6 +82,7 @@ button.wide {
|
|
|
77
82
|
width: 100%;
|
|
78
83
|
}
|
|
79
84
|
|
|
85
|
+
/* -- children */
|
|
80
86
|
button.button .children,
|
|
81
87
|
button.button .spinner {
|
|
82
88
|
transition: opacity var(--mirai-ui-motion-expand) var(--mirai-ui-motion-easing),
|
|
@@ -98,15 +104,6 @@ button.button.busy .spinner {
|
|
|
98
104
|
transform: translateY(0%);
|
|
99
105
|
}
|
|
100
106
|
|
|
101
|
-
.button:not(:disabled).secondary:hover:not(:active) {
|
|
102
|
-
box-shadow: inset 0 0 0 var(--mirai-ui-border-width) var(--mirai-ui-button-color-hover);
|
|
103
|
-
color: var(--mirai-ui-button-color-hover);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.button:not(:disabled):not(.secondary):not(.transparent):hover {
|
|
107
|
-
background-color: var(--mirai-ui-button-color-hover);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
107
|
.busyContainer {
|
|
111
108
|
align-items: center;
|
|
112
109
|
justify-content: center;
|
|
@@ -144,7 +141,7 @@ button.button.busy .spinner {
|
|
|
144
141
|
.spinner::after {
|
|
145
142
|
animation: mirai-button-busy calc(var(--mirai-ui-motion-expand) * 3) infinite var(--mirai-ui-motion-easing) alternate;
|
|
146
143
|
background-color: var(--mirai-ui-button-color-active);
|
|
147
|
-
border-radius:
|
|
144
|
+
border-radius: var(--mirai-ui-space-XXS);
|
|
148
145
|
height: var(--mirai-ui-space-XS);
|
|
149
146
|
width: var(--mirai-ui-space-XS);
|
|
150
147
|
}
|
|
@@ -11,6 +11,7 @@ var _Button = require("./Button");
|
|
|
11
11
|
var _excluded = ["busy", "icon"];
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
16
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
17
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -38,6 +39,14 @@ var Story = function Story(_ref) {
|
|
|
38
39
|
setBusy = _useState2[1];
|
|
39
40
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
40
41
|
busy: busy
|
|
42
|
+
})), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
|
|
43
|
+
busy: busy
|
|
44
|
+
}), {
|
|
45
|
+
secondary: true
|
|
46
|
+
})), /*#__PURE__*/_react.default.createElement(_Button.Button, _extends({}, _objectSpread(_objectSpread({}, props), {}, {
|
|
47
|
+
busy: busy
|
|
48
|
+
}), {
|
|
49
|
+
transparent: true
|
|
41
50
|
})), /*#__PURE__*/_react.default.createElement(_Button.Button, _objectSpread(_objectSpread({}, props), {}, {
|
|
42
51
|
busy: busy
|
|
43
52
|
}), /*#__PURE__*/_react.default.createElement(_.Icon, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.js","names":["title","Story","busyProp","busy","icon","props","useState","setBusy","ICON","storyName","args","children","disabled","undefined","large","rounded","secondary","small","squared","tag","tooltip","transparent","wide","testId","style","marginBottom","argTypes","options","Object","keys","control","type","defaultValue","onEnter","action","onLeave","onPress"],"sources":["../../../src/components/Button/Button.stories.jsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React, { useState } from 'react';\n\nimport { Icon, ICON, View } from '../../';\nimport { Button } from './Button';\n\nexport default { title: 'Components' };\n\nexport const Story = ({ busy: busyProp, icon, ...props }) => {\n const [busy, setBusy] = useState(busyProp);\n\n return (\n <>\n <Button {...{ ...props, busy }} />\n <Button {...{ ...props, busy }}>\n <Icon value={ICON[icon]} />\n </Button>\n\n <View onClick={() => setBusy(!busy)}>Switch busy</View>\n </>\n );\n};\n\nStory.storyName = 'Button';\n\nStory.args = {\n busy: false,\n children: 'children',\n disabled: false,\n icon: undefined,\n large: false,\n rounded: false,\n secondary: false,\n small: false,\n squared: false,\n tag: 'button',\n tooltip: 'tooltip',\n transparent: false,\n wide: false,\n // inherited properties\n testId: 'test-story',\n style: { marginBottom: 'var(--mirai-ui-space-M)' },\n};\n\nStory.argTypes = {\n icon: {\n options: Object.keys(ICON),\n control: { type: 'select' },\n defaultValue: Object.keys(ICON)[0],\n },\n onEnter: { action: 'onEnter' },\n onLeave: { action: 'onLeave' },\n onPress: { action: 'onPress' },\n};\n"],"mappings":";;;;;;;AACA;AAEA;AACA;AAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEnB;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,OAA2C;EAAA,IAA/BC,QAAQ,QAAdC,IAAI;IAAYC,IAAI,QAAJA,IAAI;IAAKC,KAAK;EACpD,gBAAwB,IAAAC,eAAQ,EAACJ,QAAQ,CAAC;IAAA;IAAnCC,IAAI;IAAEI,OAAO;EAEpB,oBACE,yEACE,6BAAC,cAAM,kCAAUF,KAAK;IAAEF,IAAI,EAAJA;EAAI,GAAM,eAClC,6BAAC,cAAM,kCAAUE,KAAK;IAAEF,IAAI,EAAJA;EAAI,iBAC1B,6BAAC,MAAI;IAAC,KAAK,EAAEK,MAAI,CAACJ,IAAI;EAAE,EAAG,CACpB,eAET,6BAAC,MAAI;IAAC,OAAO,EAAE;MAAA,OAAMG,OAAO,CAAC,CAACJ,IAAI,CAAC;IAAA;EAAC,iBAAmB,CACtD;AAEP,CAAC;AAAC;AAEFF,KAAK,CAACQ,SAAS,GAAG,QAAQ;AAE1BR,KAAK,CAACS,IAAI,GAAG;EACXP,IAAI,EAAE,KAAK;EACXQ,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE,KAAK;EACfR,IAAI,EAAES,SAAS;EACfC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE,KAAK;EAChBC,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE,KAAK;EACdC,GAAG,EAAE,QAAQ;EACbC,OAAO,EAAE,SAAS;EAClBC,WAAW,EAAE,KAAK;EAClBC,IAAI,EAAE,KAAK;EACX;EACAC,MAAM,EAAE,YAAY;EACpBC,KAAK,EAAE;IAAEC,YAAY,EAAE;EAA0B;AACnD,CAAC;AAEDxB,KAAK,CAACyB,QAAQ,GAAG;EACftB,IAAI,EAAE;IACJuB,OAAO,EAAEC,MAAM,CAACC,IAAI,CAACrB,MAAI,CAAC;IAC1BsB,OAAO,EAAE;MAAEC,IAAI,EAAE;IAAS,CAAC;IAC3BC,YAAY,EAAEJ,MAAM,CAACC,IAAI,CAACrB,MAAI,CAAC,CAAC,CAAC;EACnC,CAAC;EACDyB,OAAO,EAAE;IAAEC,MAAM,EAAE;EAAU,CAAC;EAC9BC,OAAO,EAAE;IAAED,MAAM,EAAE;EAAU,CAAC;EAC9BE,OAAO,EAAE;IAAEF,MAAM,EAAE;EAAU;AAC/B,CAAC"}
|
|
1
|
+
{"version":3,"file":"Button.stories.js","names":["title","Story","busyProp","busy","icon","props","useState","setBusy","ICON","storyName","args","children","disabled","undefined","large","rounded","secondary","small","squared","tag","tooltip","transparent","wide","testId","style","marginBottom","argTypes","options","Object","keys","control","type","defaultValue","onEnter","action","onLeave","onPress"],"sources":["../../../src/components/Button/Button.stories.jsx"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport React, { useState } from 'react';\n\nimport { Icon, ICON, View } from '../../';\nimport { Button } from './Button';\n\nexport default { title: 'Components' };\n\nexport const Story = ({ busy: busyProp, icon, ...props }) => {\n const [busy, setBusy] = useState(busyProp);\n\n return (\n <>\n <Button {...{ ...props, busy }} />\n <Button {...{ ...props, busy }} secondary />\n <Button {...{ ...props, busy }} transparent />\n <Button {...{ ...props, busy }}>\n <Icon value={ICON[icon]} />\n </Button>\n\n <View onClick={() => setBusy(!busy)}>Switch busy</View>\n </>\n );\n};\n\nStory.storyName = 'Button';\n\nStory.args = {\n busy: false,\n children: 'children',\n disabled: false,\n icon: undefined,\n large: false,\n rounded: false,\n secondary: false,\n small: false,\n squared: false,\n tag: 'button',\n tooltip: 'tooltip',\n transparent: false,\n wide: false,\n // inherited properties\n testId: 'test-story',\n style: { marginBottom: 'var(--mirai-ui-space-M)' },\n};\n\nStory.argTypes = {\n icon: {\n options: Object.keys(ICON),\n control: { type: 'select' },\n defaultValue: Object.keys(ICON)[0],\n },\n onEnter: { action: 'onEnter' },\n onLeave: { action: 'onLeave' },\n onPress: { action: 'onPress' },\n};\n"],"mappings":";;;;;;;AACA;AAEA;AACA;AAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAEnB;EAAEA,KAAK,EAAE;AAAa,CAAC;AAAA;AAE/B,IAAMC,KAAK,GAAG,SAARA,KAAK,OAA2C;EAAA,IAA/BC,QAAQ,QAAdC,IAAI;IAAYC,IAAI,QAAJA,IAAI;IAAKC,KAAK;EACpD,gBAAwB,IAAAC,eAAQ,EAACJ,QAAQ,CAAC;IAAA;IAAnCC,IAAI;IAAEI,OAAO;EAEpB,oBACE,yEACE,6BAAC,cAAM,kCAAUF,KAAK;IAAEF,IAAI,EAAJA;EAAI,GAAM,eAClC,6BAAC,cAAM,+CAAUE,KAAK;IAAEF,IAAI,EAAJA;EAAI;IAAI,SAAS;EAAA,GAAG,eAC5C,6BAAC,cAAM,+CAAUE,KAAK;IAAEF,IAAI,EAAJA;EAAI;IAAI,WAAW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|
<DocumentFragment>
|
|
5
5
|
<button
|
|
6
6
|
class="pressable button mirai"
|
|
7
|
-
tabindex="0"
|
|
8
7
|
>
|
|
9
8
|
children
|
|
10
9
|
</button>
|
|
@@ -17,18 +16,18 @@ exports[`component:<Button> prop:busy 1`] = `
|
|
|
17
16
|
class="pressable disabled button busy disabled"
|
|
18
17
|
disabled=""
|
|
19
18
|
>
|
|
20
|
-
<
|
|
19
|
+
<div
|
|
21
20
|
class="view busyContainer active"
|
|
22
21
|
>
|
|
23
|
-
<
|
|
22
|
+
<div
|
|
24
23
|
class="view spinner"
|
|
25
24
|
/>
|
|
26
|
-
</
|
|
27
|
-
<
|
|
25
|
+
</div>
|
|
26
|
+
<div
|
|
28
27
|
class="view row children"
|
|
29
28
|
>
|
|
30
29
|
children
|
|
31
|
-
</
|
|
30
|
+
</div>
|
|
32
31
|
</button>
|
|
33
32
|
</DocumentFragment>
|
|
34
33
|
`;
|
|
@@ -48,7 +47,6 @@ exports[`component:<Button> prop:large 1`] = `
|
|
|
48
47
|
<DocumentFragment>
|
|
49
48
|
<button
|
|
50
49
|
class="pressable button large"
|
|
51
|
-
tabindex="0"
|
|
52
50
|
>
|
|
53
51
|
children
|
|
54
52
|
</button>
|
|
@@ -61,18 +59,18 @@ exports[`component:<Button> prop:secondary && prop:busy 1`] = `
|
|
|
61
59
|
class="pressable disabled button busy secondary disabled"
|
|
62
60
|
disabled=""
|
|
63
61
|
>
|
|
64
|
-
<
|
|
62
|
+
<div
|
|
65
63
|
class="view busyContainer active"
|
|
66
64
|
>
|
|
67
|
-
<
|
|
65
|
+
<div
|
|
68
66
|
class="view spinner"
|
|
69
67
|
/>
|
|
70
|
-
</
|
|
71
|
-
<
|
|
68
|
+
</div>
|
|
69
|
+
<div
|
|
72
70
|
class="view row children"
|
|
73
71
|
>
|
|
74
72
|
children
|
|
75
|
-
</
|
|
73
|
+
</div>
|
|
76
74
|
</button>
|
|
77
75
|
</DocumentFragment>
|
|
78
76
|
`;
|
|
@@ -83,18 +81,18 @@ exports[`component:<Button> prop:secondary && prop:busy 2`] = `
|
|
|
83
81
|
class="pressable disabled button busy transparent disabled"
|
|
84
82
|
disabled=""
|
|
85
83
|
>
|
|
86
|
-
<
|
|
84
|
+
<div
|
|
87
85
|
class="view busyContainer active"
|
|
88
86
|
>
|
|
89
|
-
<
|
|
87
|
+
<div
|
|
90
88
|
class="view spinner"
|
|
91
89
|
/>
|
|
92
|
-
</
|
|
93
|
-
<
|
|
90
|
+
</div>
|
|
91
|
+
<div
|
|
94
92
|
class="view row children"
|
|
95
93
|
>
|
|
96
94
|
children
|
|
97
|
-
</
|
|
95
|
+
</div>
|
|
98
96
|
</button>
|
|
99
97
|
</DocumentFragment>
|
|
100
98
|
`;
|
|
@@ -103,7 +101,6 @@ exports[`component:<Button> prop:secondary 1`] = `
|
|
|
103
101
|
<DocumentFragment>
|
|
104
102
|
<button
|
|
105
103
|
class="pressable button secondary"
|
|
106
|
-
tabindex="0"
|
|
107
104
|
>
|
|
108
105
|
children
|
|
109
106
|
</button>
|
|
@@ -114,7 +111,6 @@ exports[`component:<Button> prop:small 1`] = `
|
|
|
114
111
|
<DocumentFragment>
|
|
115
112
|
<button
|
|
116
113
|
class="pressable button small"
|
|
117
|
-
tabindex="0"
|
|
118
114
|
>
|
|
119
115
|
children
|
|
120
116
|
</button>
|
|
@@ -125,7 +121,6 @@ exports[`component:<Button> prop:squared 1`] = `
|
|
|
125
121
|
<DocumentFragment>
|
|
126
122
|
<button
|
|
127
123
|
class="pressable button squared"
|
|
128
|
-
tabindex="0"
|
|
129
124
|
>
|
|
130
125
|
children
|
|
131
126
|
</button>
|
|
@@ -134,25 +129,25 @@ exports[`component:<Button> prop:squared 1`] = `
|
|
|
134
129
|
|
|
135
130
|
exports[`component:<Button> prop:tag 1`] = `
|
|
136
131
|
<DocumentFragment>
|
|
137
|
-
<
|
|
132
|
+
<a
|
|
138
133
|
class="pressable button"
|
|
139
|
-
tabindex="0"
|
|
140
134
|
>
|
|
141
135
|
children
|
|
142
|
-
</
|
|
136
|
+
</a>
|
|
143
137
|
</DocumentFragment>
|
|
144
138
|
`;
|
|
145
139
|
|
|
146
140
|
exports[`component:<Button> prop:tooltip 1`] = `
|
|
147
141
|
<DocumentFragment>
|
|
148
|
-
<
|
|
142
|
+
<span
|
|
143
|
+
class="container"
|
|
144
|
+
>
|
|
149
145
|
<button
|
|
150
146
|
class="pressable dispatcher button"
|
|
151
|
-
tabindex="0"
|
|
152
147
|
>
|
|
153
148
|
children
|
|
154
149
|
</button>
|
|
155
|
-
</
|
|
150
|
+
</span>
|
|
156
151
|
</DocumentFragment>
|
|
157
152
|
`;
|
|
158
153
|
|
|
@@ -160,7 +155,6 @@ exports[`component:<Button> prop:transparent 1`] = `
|
|
|
160
155
|
<DocumentFragment>
|
|
161
156
|
<button
|
|
162
157
|
class="pressable button transparent"
|
|
163
|
-
tabindex="0"
|
|
164
158
|
>
|
|
165
159
|
children
|
|
166
160
|
</button>
|
|
@@ -171,7 +165,6 @@ exports[`component:<Button> prop:wide 1`] = `
|
|
|
171
165
|
<DocumentFragment>
|
|
172
166
|
<button
|
|
173
167
|
class="pressable button wide"
|
|
174
|
-
tabindex="0"
|
|
175
168
|
>
|
|
176
169
|
children
|
|
177
170
|
</button>
|
|
@@ -182,7 +175,6 @@ exports[`component:<Button> renders 1`] = `
|
|
|
182
175
|
<DocumentFragment>
|
|
183
176
|
<button
|
|
184
177
|
class="pressable button"
|
|
185
|
-
tabindex="0"
|
|
186
178
|
>
|
|
187
179
|
children
|
|
188
180
|
</button>
|
|
@@ -194,7 +186,6 @@ exports[`component:<Button> testId 1`] = `
|
|
|
194
186
|
<button
|
|
195
187
|
class="pressable button"
|
|
196
188
|
data-testid="mirai"
|
|
197
|
-
tabindex="0"
|
|
198
189
|
>
|
|
199
190
|
children
|
|
200
191
|
</button>
|
|
@@ -10,6 +10,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _helpers = require("../../helpers");
|
|
11
11
|
var _primitives = require("../../primitives");
|
|
12
12
|
var _theme = require("../../theme");
|
|
13
|
+
var _Button = require("../Button");
|
|
13
14
|
var _Calendar = require("./Calendar.constants");
|
|
14
15
|
var _CalendarModule = _interopRequireDefault(require("./Calendar.module.css"));
|
|
15
16
|
var _Calendar2 = require("./Calendar.Week");
|
|
@@ -25,7 +26,6 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
25
26
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
26
27
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
28
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
28
|
-
var LEFT = _theme.DIRECTION_TYPE.LEFT;
|
|
29
29
|
var Month = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
30
30
|
var disabledPast = _ref.disabledPast,
|
|
31
31
|
focus = _ref.focus,
|
|
@@ -46,7 +46,7 @@ var Month = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
46
46
|
onNext = _ref.onNext,
|
|
47
47
|
onPrevious = _ref.onPrevious,
|
|
48
48
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
-
var
|
|
49
|
+
var defaultDirection = _theme.Theme.getDirection() === _theme.DIRECTION_TYPE.LEFT;
|
|
50
50
|
var weekNumber = (0, _helpers2.getWeekNumber)(instance);
|
|
51
51
|
var testId = others.testId;
|
|
52
52
|
return /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
@@ -55,21 +55,25 @@ var Month = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
55
55
|
}, /*#__PURE__*/_react.default.createElement(_primitives.View, {
|
|
56
56
|
forceRow: true,
|
|
57
57
|
className: _CalendarModule.default.header
|
|
58
|
-
}, onPrevious && /*#__PURE__*/_react.default.createElement(
|
|
58
|
+
}, onPrevious && /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
59
|
+
small: true,
|
|
60
|
+
squared: true,
|
|
61
|
+
transparent: true,
|
|
59
62
|
onPress: onPrevious,
|
|
60
63
|
testId: testId ? "".concat(testId, "-previous") : undefined
|
|
61
64
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
|
|
62
|
-
value:
|
|
65
|
+
value: defaultDirection ? _primitives.ICON.LEFT : _primitives.ICON.RIGHT
|
|
63
66
|
})), /*#__PURE__*/_react.default.createElement(_primitives.Text, {
|
|
64
67
|
bold: true,
|
|
65
|
-
headline: true,
|
|
66
|
-
level: 4,
|
|
67
68
|
className: _CalendarModule.default.title
|
|
68
|
-
}, (0, _helpers2.getHeader)(instance, locale)), onNext && /*#__PURE__*/_react.default.createElement(
|
|
69
|
+
}, (0, _helpers2.getHeader)(instance, locale)), onNext && /*#__PURE__*/_react.default.createElement(_Button.Button, {
|
|
70
|
+
small: true,
|
|
71
|
+
squared: true,
|
|
72
|
+
transparent: true,
|
|
69
73
|
onPress: onNext,
|
|
70
74
|
testId: testId ? "".concat(testId, "-next") : undefined
|
|
71
75
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Icon, {
|
|
72
|
-
value:
|
|
76
|
+
value: defaultDirection ? _primitives.ICON.RIGHT : _primitives.ICON.LEFT
|
|
73
77
|
}))), !vertical && /*#__PURE__*/_react.default.createElement(_Calendar3.Weekdays, {
|
|
74
78
|
locale: locale
|
|
75
79
|
}), _Calendar.VISIBLE_WEEKS.map(function (week) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.Month.js","names":["
|
|
1
|
+
{"version":3,"file":"Calendar.Month.js","names":["Month","React","forwardRef","ref","disabledPast","focus","format","from","instance","locale","range","selected","timestamp","to","vertical","onChange","onFocus","onNext","onPrevious","others","defaultDirection","Theme","getDirection","DIRECTION_TYPE","LEFT","weekNumber","getWeekNumber","testId","styles","style","month","className","header","undefined","ICON","RIGHT","title","getHeader","VISIBLE_WEEKS","map","week","getMonth","getFullYear","displayName","propTypes","captions","PropTypes","shape","any","disabledDates","arrayOf","string","bool","instanceOf","Date","number","tooltips","value","oneOfType","func"],"sources":["../../../src/components/Calendar/Calendar.Month.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Icon, ICON, Text, View } from '../../primitives';\nimport { DIRECTION_TYPE, Theme } from '../../theme';\nimport { Button } from '../Button';\nimport { VISIBLE_WEEKS } from './Calendar.constants';\nimport style from './Calendar.module.css';\nimport { Week } from './Calendar.Week';\nimport { Weekdays } from './Calendar.Weekdays';\nimport { getHeader, getWeekNumber } from './helpers';\n\nexport const Month = React.forwardRef(\n (\n {\n disabledPast,\n focus,\n format,\n from,\n instance,\n locale,\n range = false,\n selected,\n timestamp,\n to,\n vertical,\n onChange = () => {},\n onFocus = () => {},\n onNext,\n onPrevious,\n ...others\n },\n ref,\n ) => {\n const defaultDirection = Theme.getDirection() === DIRECTION_TYPE.LEFT;\n const weekNumber = getWeekNumber(instance);\n const { testId } = others;\n\n return (\n <View ref={ref} className={styles(style.month, others.className)}>\n <View forceRow className={style.header}>\n {onPrevious && (\n <Button small squared transparent onPress={onPrevious} testId={testId ? `${testId}-previous` : undefined}>\n <Icon value={defaultDirection ? ICON.LEFT : ICON.RIGHT} />\n </Button>\n )}\n <Text bold className={style.title}>\n {getHeader(instance, locale)}\n </Text>\n {onNext && (\n <Button small squared transparent onPress={onNext} testId={testId ? `${testId}-next` : undefined}>\n <Icon value={defaultDirection ? ICON.RIGHT : ICON.LEFT} />\n </Button>\n )}\n </View>\n\n {!vertical && <Weekdays locale={locale} />}\n\n {VISIBLE_WEEKS.map((week) => (\n <Week\n {...{\n ...others,\n disabledPast,\n focus,\n format,\n from,\n locale,\n range,\n selected,\n timestamp,\n to,\n }}\n key={week}\n month={instance.getMonth()}\n number={weekNumber + week}\n year={instance.getFullYear()}\n onFocus={onFocus}\n onPress={onChange}\n />\n ))}\n </View>\n );\n },\n);\n\nMonth.displayName = 'Component:Calendar:Month';\n\nMonth.propTypes = {\n captions: PropTypes.shape({}),\n focus: PropTypes.any,\n instance: PropTypes.any,\n selected: PropTypes.any,\n disabledDates: PropTypes.arrayOf(PropTypes.string),\n disabledPast: PropTypes.bool,\n format: PropTypes.string,\n from: PropTypes.instanceOf(Date),\n locale: PropTypes.string,\n range: PropTypes.bool,\n timestamp: PropTypes.number,\n to: PropTypes.instanceOf(Date),\n tooltips: PropTypes.shape({}),\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),\n vertical: PropTypes.bool,\n onChange: PropTypes.func,\n onFocus: PropTypes.func,\n onNext: PropTypes.func,\n onPrevious: PropTypes.func,\n};\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAqD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE9C,IAAMA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CACnC,gBAmBEC,GAAG,EACA;EAAA,IAlBDC,YAAY,QAAZA,YAAY;IACZC,KAAK,QAALA,KAAK;IACLC,MAAM,QAANA,MAAM;IACNC,IAAI,QAAJA,IAAI;IACJC,QAAQ,QAARA,QAA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