fu-kit 0.7.2 → 1.0.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.
@@ -1,74 +1,74 @@
1
- <template>
2
- <button
3
- v-bind="{
4
- ...$attrs,
5
- type: $attrs.type || 'button',
6
- class: 'ui-button-link',
7
- }"
8
- @mouseup="mUp"
9
- >
10
- <slot />
11
- </button>
12
- </template>
13
-
14
- <script>
15
- import { defineComponent } from 'vue'
16
-
17
- export default defineComponent({
18
- name: 'ui-button-link',
19
- props: {
20
- hollow: { type: Boolean, default: false },
21
- },
22
- setup (props) {
23
- const mUp = (e) => e.target.blur()
24
- return { hollow: props.hollow, mUp }
25
- },
26
- })
27
- </script>
28
-
29
- <style lang="scss" scoped>
30
- @import "../../scss";
31
-
32
- .ui-button-link {
33
- @include typo(200);
34
- padding: spacing(0, 0);
35
-
36
- display: inline-block;
37
- box-sizing: border-box;
38
- cursor: pointer;
39
- font-family: var(--typo-font-text);
40
- border: 0 none;
41
- transition: all var(--ui-transition);
42
- background: transparent;
43
- color: var(--pal-link);
44
- line-height: 1;
45
- will-change: box-shadow, transform;
46
- outline: none;
47
- user-select: none;
48
- -webkit-tap-highlight-color: transparent;
49
- text-decoration: none;
50
-
51
- & > * {
52
- pointer-events: none;
53
- }
54
-
55
- &:hover {
56
- text-decoration: underline;
57
- }
58
-
59
- &:focus {
60
- color: var(--pal-link-active);
61
- text-decoration: underline;
62
- }
63
-
64
- &:active {
65
- color: var(--pal-link-active);
66
- text-decoration: underline;
67
- }
68
-
69
- &:disabled {
70
- cursor: not-allowed;
71
- color: var(--ui-pal-disabled);
72
- }
73
- }
74
- </style>
1
+ <template>
2
+ <button
3
+ v-bind="{
4
+ ...$attrs,
5
+ type: $attrs.type || 'button',
6
+ class: 'ui-button-link',
7
+ }"
8
+ @mouseup="mUp"
9
+ >
10
+ <slot />
11
+ </button>
12
+ </template>
13
+
14
+ <script>
15
+ import { defineComponent } from 'vue'
16
+
17
+ export default defineComponent({
18
+ name: 'ui-button-link',
19
+ props: {
20
+ hollow: { type: Boolean, default: false },
21
+ },
22
+ setup (props) {
23
+ const mUp = (e) => e.target.blur()
24
+ return { hollow: props.hollow, mUp }
25
+ },
26
+ })
27
+ </script>
28
+
29
+ <style lang="scss" scoped>
30
+ @import "../../scss";
31
+
32
+ .ui-button-link {
33
+ @include typo(200);
34
+ padding: spacing(0, 0);
35
+
36
+ display: inline-block;
37
+ box-sizing: border-box;
38
+ cursor: pointer;
39
+ font-family: var(--typo-font-text);
40
+ border: 0 none;
41
+ transition: all var(--ui-transition);
42
+ background: transparent;
43
+ color: var(--pal-link);
44
+ line-height: 1;
45
+ will-change: box-shadow, transform;
46
+ outline: none;
47
+ user-select: none;
48
+ -webkit-tap-highlight-color: transparent;
49
+ text-decoration: none;
50
+
51
+ & > * {
52
+ pointer-events: none;
53
+ }
54
+
55
+ &:hover {
56
+ text-decoration: underline;
57
+ }
58
+
59
+ &:focus {
60
+ color: var(--pal-link-active);
61
+ text-decoration: underline;
62
+ }
63
+
64
+ &:active {
65
+ color: var(--pal-link-active);
66
+ text-decoration: underline;
67
+ }
68
+
69
+ &:disabled {
70
+ cursor: not-allowed;
71
+ color: var(--ui-pal-disabled);
72
+ }
73
+ }
74
+ </style>
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <ui-button
3
+ class="ui-button-route"
4
+ :class="$attrs.class"
5
+ :hollow="$props.hollow"
6
+ :naked="$props.naked"
7
+ :isLoading="$props.isLoading"
8
+ :disabled="$props.disabled"
9
+ >
10
+ <router-link
11
+ v-if="!disabled"
12
+ class="ui-button-route_link"
13
+ :class="{_naked: $props.naked}"
14
+ :to="$props.to"
15
+ :replace="$props.replace"
16
+ :activeClass="$props.activeClass"
17
+ :exactActiveClass="$props.exactActiveClass"
18
+ :custom="$props.custom"
19
+ :ariaCurrentValue="$props.ariaCurrentValue"
20
+ >
21
+ <slot />
22
+ </router-link>
23
+ <div v-else class="ui-button-route_link">
24
+ <slot />
25
+ </div>
26
+ </ui-button>
27
+ </template>
28
+
29
+ <script>
30
+
31
+ import UiButton from './UiButton.vue'
32
+
33
+ export default {
34
+ name: 'ui-button-route',
35
+ components: { UiButton },
36
+ props: {
37
+ disabled: { type: Boolean, default: false },
38
+ hollow: { type: Boolean, default: false },
39
+ naked: { type: Boolean, default: false },
40
+ isLoading: { type: Boolean, default: false },
41
+
42
+ to: { type: [ String, Object ], required: true },
43
+ replace: Boolean,
44
+ activeClass: String,
45
+ exactActiveClass: String,
46
+ custom: Boolean,
47
+ ariaCurrentValue: { type: String, default: 'page' },
48
+ },
49
+
50
+ setup () {
51
+ const mUp = (e) => e.target.blur()
52
+ return { mUp }
53
+ },
54
+ }
55
+ </script>
56
+
57
+
58
+ <style scoped lang="scss">
59
+ .ui-button-route {
60
+ padding: 0 !important;
61
+
62
+ &_link {
63
+ flex: 1;
64
+ padding: var(--ui-button-padding, #{spacing(300,500)});
65
+ display: flex;
66
+ color: inherit;
67
+ text-decoration: none;
68
+ align-items: inherit;
69
+ justify-content: inherit;
70
+ min-height: inherit;
71
+ box-sizing: inherit;
72
+ gap: inherit;
73
+
74
+ &._naked {
75
+ padding: var(--ui-button-padding, var(--lt-sp300));
76
+ }
77
+ }
78
+ }
79
+ </style>
@@ -1,206 +1,206 @@
1
- <template>
2
- <label
3
- :class="{'_disabled': isDisabled, '_checked': modelValue }"
4
- class="ui-check"
5
- v-bind="{ class: $attrs.class, style: $attrs.style }"
6
- @mouseup="mouseUp"
7
- >
8
- <input
9
- ref="inputRef"
10
- :checked="modelValue"
11
- class="ui-check_input"
12
- v-bind="{...$attrs, disabled: isDisabled, type: 'checkbox', class: undefined, style: undefined}"
13
- @input="$emit('update:modelValue', $event.target.checked)"
14
- >
15
- <span
16
- :class="{
17
- 'ui-check_switch': switchLike,
18
- 'ui-check_check': !switchLike,
19
- _loading: isLoading
20
- }"
21
- class="ui-check_box"
22
- >
23
- <svg v-if="!switchLike" class="ui-check_check-icon" viewBox="0 0 24 24">
24
- <path d="m7.5 12.5 4 3 5.5-8" stroke="var(--ui-pal, currentColor)" stroke-linecap="round" stroke-width="2" />
25
- </svg>
26
- </span>
27
- <slot />
28
- </label>
29
- </template>
30
-
31
- <script>
32
- import { computed, defineComponent, ref } from 'vue'
33
-
34
- export default defineComponent({
35
- name: 'ui-check',
36
- props: {
37
- modelValue: { type: Boolean, default: false },
38
- switchLike: { type: Boolean, default: false },
39
- thin: { type: Boolean, default: false },
40
- isLoading: { type: Boolean, default: false },
41
- disabled: { type: Boolean, default: false },
42
- },
43
- emits: [ 'update:modelValue' ],
44
- setup (props) {
45
- const inputRef = ref(null)
46
- const isDisabled = computed(() => props.disabled || props.disabled === '')
47
-
48
-
49
- const mouseUp = () => {
50
- // oof
51
- setTimeout(() => {
52
- inputRef.value.blur()
53
- }, 0)
54
- }
55
-
56
- return { isDisabled, inputRef, mouseUp }
57
- },
58
- })
59
- </script>
60
- <style lang="scss" scoped>
61
- @import "../../scss";
62
-
63
- .ui-check {
64
- @include typo(200);
65
-
66
- user-select: none;
67
- display: flex;
68
- box-sizing: border-box;
69
- align-items: center;
70
- justify-content: var(--ui-check-justify-content, stretch);
71
- height: var(--ui-lt-h);
72
- position: relative;
73
- outline: none;
74
- color: var(--pal-text-dimm);
75
- font-family: var(--typo-font-text);
76
- cursor: pointer;
77
- line-height: 1;
78
-
79
- &_input {
80
- opacity: 0; // weird, but it's working inside the label
81
- position: absolute;
82
- left: 0;
83
- top: 0;
84
- pointer-events: none;
85
- }
86
-
87
- &_check {
88
- border-style: var(--ui-lt-border-style);
89
- border-width: var(--ui-check-border-w);
90
- border-color: var(--pal-grey700);
91
- height: var(--ui-check-size);
92
- width: var(--ui-check-size);
93
- border-radius: var(--ui-lt-border-radius);
94
- display: flex;
95
- justify-content: stretch;
96
- align-items: stretch;
97
- margin-right: spacing(200);
98
- transition: all var(--ui-transition);
99
-
100
- &-icon {
101
- transition: all var(--ui-transition);
102
- transform: scale(0);
103
- width: 100%;
104
- }
105
- }
106
-
107
- &._checked &_check {
108
- border-color: var(--ui-pal);
109
- }
110
-
111
- &._checked &_check-icon {
112
- transform: scale(1.4);
113
- }
114
-
115
- &_switch {
116
- width: var(--ui-switch-w);
117
- border-radius: var(--ui-switch-h);
118
- background-color: var(--pal-grey700);
119
- border: var(--ui-lt-border-width) solid var(--pal-grey700);
120
- margin-right: spacing(200);
121
- display: flex;
122
- align-items: center;
123
- justify-content: flex-start;
124
- height: var(--ui-switch-h);
125
-
126
- --switch-left: 0;
127
-
128
- &:before {
129
- transform: translateX(var(--switch-left));
130
- content: "";
131
- display: block;
132
- background-color: white;
133
- border: var(--ui-lt-border-width) solid transparent;
134
- border-radius: var(--ui-switch-h);
135
- height: calc(100% - var(--ui-lt-border-width) * 2);
136
- aspect-ratio: 1;
137
- transition: all var(--ui-transition);
138
- }
139
- }
140
-
141
- &._checked &_switch {
142
- background-color: var(--ui-pal);
143
- border-color: var(--ui-pal);
144
- }
145
-
146
- &._checked &_switch:before {
147
- --switch-left: calc(var(--ui-switch-w) - var(--ui-switch-h));
148
- transform: translateX(var(--switch-left));
149
- }
150
-
151
- &._checked {
152
- color: var(--pal-text);
153
- }
154
-
155
- &:hover:not(&._disabled) &_box {
156
- box-shadow: 0 5px 12px -4px rgb(var(--rgb-front), 0.2);
157
- }
158
-
159
- &:hover {
160
- color: var(--pal-text);
161
- }
162
-
163
- &:focus-within &_box {
164
- box-shadow: 0 0 2px 4px rgba(var(--ui-rgb), 0.3);
165
- }
166
-
167
- &._disabled {
168
- color: var(--ui-pal-disabled-border);
169
- cursor: not-allowed;
170
- }
171
-
172
- &._disabled &_check {
173
- border: var(--ui-lt-border-width) var(--ui-lt-disabled-border-style) var(--ui-pal-disabled-border);
174
- box-shadow: none;
175
- }
176
-
177
- &._disabled &_switch {
178
- background-color: rgba(var(--rgb-grey700), 0.25);
179
- border-color: transparent;
180
- }
181
-
182
- &._disabled._checked &_switch {
183
- background-color: rgba(var(--ui-rgb), 0.3);
184
- }
185
- }
186
-
187
- ._loading {
188
- animation: pulse 1000ms infinite;
189
- }
190
-
191
- @keyframes pulse {
192
- 40% {
193
- transform: scale(1.1);
194
- box-shadow: 0 0 0 5px rgba(var(--ui-rgb), 0.3);
195
- }
196
-
197
- 80% {
198
- transform: scale(1);
199
- box-shadow: 0 0 0 10px rgba(var(--ui-rgb), 0);
200
- }
201
-
202
- 100% {
203
- box-shadow: 0 0 0 0 rgba(var(--ui-rgb), 0)
204
- }
205
- }
206
- </style>
1
+ <template>
2
+ <label
3
+ :class="{'_disabled': isDisabled, '_checked': modelValue }"
4
+ class="ui-check"
5
+ v-bind="{ class: $attrs.class, style: $attrs.style }"
6
+ @mouseup="mouseUp"
7
+ >
8
+ <input
9
+ ref="inputRef"
10
+ :checked="modelValue"
11
+ class="ui-check_input"
12
+ v-bind="{...$attrs, disabled: isDisabled, type: 'checkbox', class: undefined, style: undefined}"
13
+ @input="$emit('update:modelValue', $event.target.checked)"
14
+ >
15
+ <span
16
+ :class="{
17
+ 'ui-check_switch': switchLike,
18
+ 'ui-check_check': !switchLike,
19
+ _loading: isLoading
20
+ }"
21
+ class="ui-check_box"
22
+ >
23
+ <svg v-if="!switchLike" class="ui-check_check-icon" viewBox="0 0 24 24">
24
+ <path d="m7.5 12.5 4 3 5.5-8" stroke="var(--ui-pal, currentColor)" stroke-linecap="round" stroke-width="2" />
25
+ </svg>
26
+ </span>
27
+ <slot />
28
+ </label>
29
+ </template>
30
+
31
+ <script>
32
+ import { computed, defineComponent, ref } from 'vue'
33
+
34
+ export default defineComponent({
35
+ name: 'ui-check',
36
+ props: {
37
+ modelValue: { type: Boolean, default: false },
38
+ switchLike: { type: Boolean, default: false },
39
+ thin: { type: Boolean, default: false },
40
+ isLoading: { type: Boolean, default: false },
41
+ disabled: { type: Boolean, default: false },
42
+ },
43
+ emits: [ 'update:modelValue' ],
44
+ setup (props) {
45
+ const inputRef = ref(null)
46
+ const isDisabled = computed(() => props.disabled || props.disabled === '')
47
+
48
+
49
+ const mouseUp = () => {
50
+ // oof
51
+ setTimeout(() => {
52
+ inputRef.value.blur()
53
+ }, 0)
54
+ }
55
+
56
+ return { isDisabled, inputRef, mouseUp }
57
+ },
58
+ })
59
+ </script>
60
+ <style lang="scss" scoped>
61
+ @import "../../scss";
62
+
63
+ .ui-check {
64
+ @include typo(200);
65
+
66
+ user-select: none;
67
+ display: flex;
68
+ box-sizing: border-box;
69
+ align-items: center;
70
+ justify-content: var(--ui-check-justify-content, stretch);
71
+ height: var(--ui-lt-h);
72
+ position: relative;
73
+ outline: none;
74
+ color: var(--pal-text-dimm);
75
+ font-family: var(--typo-font-text);
76
+ cursor: pointer;
77
+ line-height: 1;
78
+
79
+ &_input {
80
+ opacity: 0; // weird, but it's working inside the label
81
+ position: absolute;
82
+ left: 0;
83
+ top: 0;
84
+ pointer-events: none;
85
+ }
86
+
87
+ &_check {
88
+ border-style: var(--ui-lt-border-style);
89
+ border-width: var(--ui-check-border-w);
90
+ border-color: var(--pal-grey700);
91
+ height: var(--ui-check-size);
92
+ width: var(--ui-check-size);
93
+ border-radius: var(--ui-lt-border-radius);
94
+ display: flex;
95
+ justify-content: stretch;
96
+ align-items: stretch;
97
+ margin-right: spacing(200);
98
+ transition: all var(--ui-transition);
99
+
100
+ &-icon {
101
+ transition: all var(--ui-transition);
102
+ transform: scale(0);
103
+ width: 100%;
104
+ }
105
+ }
106
+
107
+ &._checked &_check {
108
+ border-color: var(--ui-pal);
109
+ }
110
+
111
+ &._checked &_check-icon {
112
+ transform: scale(1.4);
113
+ }
114
+
115
+ &_switch {
116
+ width: var(--ui-switch-w);
117
+ border-radius: var(--ui-switch-h);
118
+ background-color: var(--pal-grey700);
119
+ border: var(--ui-lt-border-width) solid var(--pal-grey700);
120
+ margin-right: spacing(200);
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: flex-start;
124
+ height: var(--ui-switch-h);
125
+
126
+ --switch-left: 0;
127
+
128
+ &:before {
129
+ transform: translateX(var(--switch-left));
130
+ content: "";
131
+ display: block;
132
+ background-color: white;
133
+ border: var(--ui-lt-border-width) solid transparent;
134
+ border-radius: var(--ui-switch-h);
135
+ height: calc(100% - var(--ui-lt-border-width) * 2);
136
+ aspect-ratio: 1;
137
+ transition: all var(--ui-transition);
138
+ }
139
+ }
140
+
141
+ &._checked &_switch {
142
+ background-color: var(--ui-pal);
143
+ border-color: var(--ui-pal);
144
+ }
145
+
146
+ &._checked &_switch:before {
147
+ --switch-left: calc(var(--ui-switch-w) - var(--ui-switch-h));
148
+ transform: translateX(var(--switch-left));
149
+ }
150
+
151
+ &._checked {
152
+ color: var(--pal-text);
153
+ }
154
+
155
+ &:hover:not(&._disabled) &_box {
156
+ box-shadow: 0 5px 12px -4px rgb(var(--rgb-front), 0.2);
157
+ }
158
+
159
+ &:hover {
160
+ color: var(--pal-text);
161
+ }
162
+
163
+ &:focus-within &_box {
164
+ box-shadow: 0 0 2px 4px rgba(var(--ui-rgb), 0.3);
165
+ }
166
+
167
+ &._disabled {
168
+ color: var(--ui-pal-disabled-border);
169
+ cursor: not-allowed;
170
+ }
171
+
172
+ &._disabled &_check {
173
+ border: var(--ui-lt-border-width) var(--ui-lt-disabled-border-style) var(--ui-pal-disabled-border);
174
+ box-shadow: none;
175
+ }
176
+
177
+ &._disabled &_switch {
178
+ background-color: rgba(var(--rgb-grey700), 0.25);
179
+ border-color: transparent;
180
+ }
181
+
182
+ &._disabled._checked &_switch {
183
+ background-color: rgba(var(--ui-rgb), 0.3);
184
+ }
185
+ }
186
+
187
+ ._loading {
188
+ animation: pulse 1000ms infinite;
189
+ }
190
+
191
+ @keyframes pulse {
192
+ 40% {
193
+ transform: scale(1.1);
194
+ box-shadow: 0 0 0 5px rgba(var(--ui-rgb), 0.3);
195
+ }
196
+
197
+ 80% {
198
+ transform: scale(1);
199
+ box-shadow: 0 0 0 10px rgba(var(--ui-rgb), 0);
200
+ }
201
+
202
+ 100% {
203
+ box-shadow: 0 0 0 0 rgba(var(--ui-rgb), 0)
204
+ }
205
+ }
206
+ </style>