fu-kit 0.4.2 → 0.6.0

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,118 @@
1
+ <template>
2
+ <div class="ui-sidebar" :class="{'_shown':isOpen}" @mousedown.self="$emit('close')">
3
+ <transition name="bounce">
4
+ <div class="ui-sidebar_content" v-if="isOpen">
5
+ <button v-if="showClose" class="ui-sidebar_close" @click="$emit('close')">
6
+ <ui-icon name="cross" />
7
+ </button>
8
+ <slot />
9
+ </div>
10
+ </transition>
11
+ </div>
12
+ </template>
13
+
14
+ <script>
15
+ import { defineComponent } from 'vue'
16
+
17
+ import UiIcon from './UiIcon.vue'
18
+
19
+ export default defineComponent({
20
+ name: 'ui-sidebar',
21
+ components: { UiIcon },
22
+ emits: [ 'close' ],
23
+ props: {
24
+ isOpen: { type: Boolean, default: false },
25
+ // todo: right side as well
26
+ side: { type: String, default: 'right' },
27
+ showClose: { type: Boolean, default: false },
28
+ },
29
+ watch: {
30
+ isOpen (val) {
31
+ if (val) document.body.style.overflow = 'hidden'
32
+ else document.body.style.overflow = 'visible'
33
+ },
34
+ },
35
+ })
36
+ </script>
37
+
38
+ <style lang="scss">
39
+ @import "../../scss";
40
+
41
+ html {
42
+ --ui-sidebar-max-w: 45vw;
43
+ --ui-sidebar-min-w: 25vw;
44
+ }
45
+ </style>
46
+
47
+ <style scoped lang="scss">
48
+ @import "../../scss";
49
+
50
+ .ui-sidebar {
51
+ position: fixed;
52
+ left: 0;
53
+ top: 0;
54
+ right: 0;
55
+ bottom: 0;
56
+ z-index: var(--lt-z-nav);
57
+ background-color: transparent;
58
+ transition-timing-function: linear;
59
+ transition-duration: 200ms;
60
+ transition-property: background-color, visibility;
61
+ pointer-events: none;
62
+ visibility: hidden;
63
+
64
+ &._shown {
65
+ background: var(--pal-overlay);
66
+ visibility: visible;
67
+ pointer-events: unset;
68
+ }
69
+
70
+ &_content {
71
+ @include scrollbar-awesome();
72
+
73
+ overflow: auto;
74
+ position: absolute;
75
+ left: auto;
76
+ top: 0;
77
+ right: 0;
78
+ bottom: 0;
79
+ border-top-left-radius: var(--lt-border-radius);
80
+ border-bottom-left-radius: var(--lt-border-radius);
81
+ background: var(--pal-white);
82
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
83
+ max-width: var(--ui-sidebar-max-w);
84
+ min-width: var(--ui-sidebar-min-w);
85
+ transform-origin: 100% 50%;
86
+ width: var(--ui-sidebar-width, auto);
87
+ }
88
+
89
+ &_close {
90
+ --icon-color: var(--pal-grey800);
91
+
92
+ position: absolute;
93
+ top: spacing(500);
94
+ left: spacing(500);
95
+ border: none;
96
+ padding: 0;
97
+ background: transparent;
98
+ cursor: pointer;
99
+ }
100
+ }
101
+
102
+ .bounce-enter-active {
103
+ animation: slide-right 200ms;
104
+ }
105
+
106
+ .bounce-leave-active {
107
+ animation: slide-right 200ms reverse;
108
+ }
109
+
110
+ @keyframes slide-right {
111
+ 0% {
112
+ transform: translateX(100%);
113
+ }
114
+ 100% {
115
+ transform: translateX(0);
116
+ }
117
+ }
118
+ </style>
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <div
3
+ :class="{'_disabled': disabled || $attrs.readOnly !== undefined, 'ui-text': !naked }"
4
+ v-bind="{ class: $attrs.class }"
5
+ >
6
+ <slot />
7
+ <slot name="left" />
8
+ <input
9
+ v-bind="{...$attrs, disabled, class: undefined}"
10
+ :value="modelValue"
11
+ class="ui-text_input"
12
+ :class="{ _naked: naked }"
13
+ @input="$emit('update:modelValue', $event.target.value)"
14
+ @focus="handleFocus"
15
+ ref="inputRef"
16
+ >
17
+ <slot name="right" />
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ import { defineComponent } from 'vue'
23
+
24
+ export default defineComponent({
25
+ name: 'ui-text',
26
+ props: {
27
+ disabled: { type: Boolean, default: false },
28
+ autoSelect: { type: Boolean, default: false },
29
+ naked: { type: Boolean, default: false },
30
+ modelValue: {
31
+ type: [ String, Number ],
32
+ default: '',
33
+ },
34
+ },
35
+ emits: [ 'update:modelValue' ],
36
+ expose: [ 'focus' ],
37
+ methods: {
38
+ focus () {
39
+ this.$refs.inputRef.focus()
40
+ },
41
+ handleFocus () {
42
+ if (this.autoSelect) this.$refs.inputRef.select()
43
+ },
44
+ },
45
+ })
46
+ </script>
47
+ <style lang="scss" scoped>
48
+ @import "../../scss";
49
+
50
+ .ui-text {
51
+ @include typo(200);
52
+
53
+ padding: 0;
54
+ display: flex;
55
+ box-sizing: border-box;
56
+ align-items: center;
57
+ justify-content: stretch;
58
+ border-style: var(--ui-lt-border-style);
59
+ border-width: var(--ui-lt-border-width);
60
+ border-color: var(--ui-pal-lateral);
61
+ border-radius: var(--ui-lt-border-radius);
62
+ transition-duration: 240ms;
63
+ transition-timing-function: ease-in-out;
64
+ transition-property: border-color, box-shadow;
65
+ height: var(--ui-lt-h);
66
+ background: var(--pal-white);
67
+
68
+ &_input {
69
+ @include typo(200);
70
+ padding: var(--ui-input-padding, #{spacing(100)} #{spacing(300)});
71
+
72
+ font-family: var(--typo-font-ui);
73
+ color: var(--ui-pal-text);
74
+ caret-color: var(--ui-pal);
75
+ min-height: min(100%);
76
+ border: none;
77
+ outline: none;
78
+ background: transparent;
79
+ box-sizing: border-box;
80
+ flex: 1;
81
+ display: block;
82
+ min-width: 0;
83
+ margin: 0;
84
+
85
+ &::selection {
86
+ background-color: var(--ui-pal);
87
+ color: var(--ui-pal-text-select);
88
+ }
89
+
90
+ &::placeholder {
91
+ color: var(--ui-pal-placeholder);
92
+ }
93
+
94
+ &[disabled], &[read-only] {
95
+ cursor: not-allowed;
96
+ color: var(--ui-pal-disabled-border);
97
+ }
98
+
99
+ &._naked {
100
+ padding: var(--ui-input-padding, 0);
101
+ }
102
+ }
103
+
104
+ &:hover {
105
+ outline: none;
106
+ box-shadow: 0 5px 12px -4px rgb(var(--rgb-dark), 0.2);
107
+ }
108
+
109
+ &:focus-within {
110
+ outline: none;
111
+ box-shadow: 0 0 0 0 var(--ui-pal);
112
+ border-color: var(--ui-pal);
113
+ }
114
+
115
+ &._disabled {
116
+ border: var(--ui-lt-border-width) var(--ui-lt-disabled-border-style) var(--ui-pal-disabled-border);
117
+ background: var(--ui-pal-bg);
118
+ box-shadow: none;
119
+ }
120
+ }
121
+ </style>
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <div
3
+ class="ui-text"
4
+ v-bind="{ class: $attrs.class }"
5
+ :class="{'_disabled': $attrs.disabled !== undefined || $attrs.readOnly !== undefined }"
6
+ >
7
+ <textarea
8
+ ref="textarea"
9
+ v-bind="{...$attrs, class: undefined}"
10
+ :value="modelValue"
11
+ class="ui-text_textarea"
12
+ @input="handleInput"
13
+ />
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import { defineComponent, onMounted, ref } from 'vue'
19
+
20
+ export default defineComponent({
21
+ name: 'ui-textarea',
22
+ props: {
23
+ modelValue: {
24
+ type: [ String, Number ],
25
+ default: '',
26
+ },
27
+ autoResize: { type: Boolean, default: false },
28
+ },
29
+ emits: [ 'update:modelValue' ],
30
+ setup (props, { emit }) {
31
+ const textarea = ref(null)
32
+ const handleInput = async (e) => {
33
+ emit('update:modelValue', e.target.value)
34
+ resize(e.target)
35
+ }
36
+ const resize = (elm) => {
37
+ if (!props.autoResize) return
38
+ elm.style.height = 'auto'
39
+ elm.style.height = `${ elm.scrollHeight }px`
40
+ }
41
+ onMounted(() => resize(textarea.value))
42
+
43
+ return { handleInput, textarea }
44
+ },
45
+ })
46
+ </script>
47
+ <style lang="scss" scoped>
48
+ @import "../../scss";
49
+
50
+ .ui-text {
51
+ @include typo(200);
52
+
53
+ padding: 0;
54
+ display: flex;
55
+ box-sizing: border-box;
56
+ align-items: center;
57
+ justify-content: stretch;
58
+ border-style: var(--ui-lt-border-style);
59
+ border-width: var(--ui-lt-border-width);
60
+ border-color: var(--ui-pal-lateral);
61
+ border-radius: var(--ui-lt-border-radius);
62
+ transition-duration: 240ms;
63
+ transition-timing-function: ease-in-out;
64
+ transition-property: border-color, box-shadow;
65
+ min-height: var(--ui-lt-h);
66
+ background: var(--ui-pal-bg);
67
+
68
+ &_textarea {
69
+ @include scrollbar-awesome();
70
+ @include typo(200);
71
+ padding: spacing(200, 300);
72
+ margin: spacing(100, 100, 100, 0);
73
+
74
+ color: var(--ui-pal-text);
75
+ caret-color: var(--ui-pal);
76
+ border: 0 none;
77
+ outline: none;
78
+ background: transparent;
79
+ box-sizing: border-box;
80
+ flex: 1;
81
+ display: block;
82
+ min-width: var(--ui-textarea-min-w, 0);
83
+ max-width: var(--ui-textarea-max-w, unset);
84
+ resize: var(--ui-textarea-resize, vertical);
85
+ min-height: var(--ui-textarea-min-h, 4em);
86
+ max-height: var(--ui-textarea-max-h, 400px);
87
+ height: var(--ui-lt-h);
88
+ font-family: var(--typo-font-ui);
89
+
90
+ &::selection {
91
+ background-color: var(--ui-pal);
92
+ color: var(--ui-pal-text-select);
93
+ }
94
+
95
+ &[disabled], &[read-only] {
96
+ cursor: text;
97
+ color: var(--ui-pal-disabled-border);
98
+ }
99
+ }
100
+
101
+ &:hover {
102
+ outline: none;
103
+ box-shadow: 0 5px 12px -4px rgb(var(--rgb-dark), 0.2);
104
+ }
105
+
106
+ &:focus-within {
107
+ outline: none;
108
+ box-shadow: 0 0 0 0 var(--ui-pal);
109
+ border-color: var(--ui-pal);
110
+ }
111
+
112
+ &._disabled {
113
+ border: var(--ui-lt-border-width) var(--ui-lt-disabled-border-style) var(--ui-pal-disabled-border);
114
+ box-shadow: none;
115
+ }
116
+ }
117
+ </style>
package/src/entry.js ADDED
@@ -0,0 +1,14 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ export { default as UiButton } from './components/UiButton.vue'
3
+ export { default as UiCodeView } from './components/UiCodeView.vue'
4
+ export { default as UiCopy } from './components/UiCopy.vue'
5
+ export { default as UiSelect } from './components/UiSelect.vue'
6
+ export { default as UiSelectX } from './components/UiSelectX.vue'
7
+ export { default as UiSidebar } from './components/UiSidebar.vue'
8
+ export { default as UiText } from './components/UiText.vue'
9
+ export { default as UiTextarea } from './components/UiTextarea.vue'
10
+ export { default as UiCheck } from './components/UiCheck.vue'
11
+ export { default as UiDropdown } from './components/UiDropdown.vue'
12
+ export { default as UiDropdownItem } from './components/UiDropdownItem.vue'
13
+ export { default as UiIconProvider } from './components/UiIconProvider.vue'
14
+ export { default as UiIcon } from './components/UiIcon.vue'
@@ -1,39 +1,39 @@
1
- @mixin typo($h, $l:null) {
2
- font-size: var(--typo-h#{$h});
3
-
4
- @if ($l) {
5
- line-height: var(--typo-lh#{$l});
6
- }
7
- }
8
-
9
- @function spacing($spacing-code: null) {
10
- @if (
11
- $spacing-code == 0 or
12
- $spacing-code == auto or
13
- $spacing-code == unset or
14
- $spacing-code == null
15
- ) {
16
- @return $spacing-code;
17
- }
18
-
19
- @return var(--lt-sp#{$spacing-code});
20
- }
21
-
22
- @mixin spacing-prop($prop, $t, $r: null, $b: null, $l: null) {
23
- #{$prop}: spacing($t) spacing($r) spacing($b) spacing($l);
24
- }
25
-
26
- @mixin spacing-margin($t, $r: null, $b: null, $l: null) {
27
- @include spacing-prop('margin', $t, $r, $b, $l);
28
- }
29
-
30
- @mixin spacing-padding($t, $r: null, $b: null, $l: null) {
31
- @include spacing-prop('padding', $t, $r, $b, $l);
32
- }
33
-
34
- @mixin ellipsis($display: block) {
35
- display: $display;
36
- overflow: hidden;
37
- text-overflow: ellipsis;
38
- white-space: nowrap;
1
+ @function typo-h($h) {
2
+ @return var(--typo-h#{$h});
3
+ }
4
+
5
+ @function typo-lh($l) {
6
+ @return var(--typo-lh#{$l});
7
+ }
8
+
9
+ @mixin typo($h, $l:null) {
10
+ font-size: typo-h($h);
11
+
12
+ @if ($l) {
13
+ line-height: typo-lh($l);
14
+ }
15
+ }
16
+
17
+ @function _spacing($spacing-code) {
18
+ @if (
19
+ $spacing-code == 0 or
20
+ $spacing-code == auto or
21
+ $spacing-code == unset or
22
+ $spacing-code == null
23
+ ) {
24
+ @return $spacing-code;
25
+ }
26
+
27
+ @return var(--lt-sp#{$spacing-code});
28
+ }
29
+
30
+ @function spacing($t, $r: null, $b: null, $l: null) {
31
+ @return _spacing($t) _spacing($r) _spacing($b) _spacing($l)
32
+ }
33
+
34
+ @mixin ellipsis($display: block) {
35
+ display: $display;
36
+ overflow: hidden;
37
+ text-overflow: ellipsis;
38
+ white-space: nowrap;
39
39
  }
@@ -1,46 +1,49 @@
1
- @mixin scrollbar-awesome($transparent: false) {
2
- &::-webkit-scrollbar-track {
3
- background-color: var(--ui-pal-bg);
4
- }
5
-
6
- &::-webkit-scrollbar {
7
- width: var(--ui-lt-scroll-width);
8
- height: var(--ui-lt-scroll-width);
9
- border-radius: var(--ui-lt-scroll-width);
10
- background-color: var(--ui-pal-bg);
11
- }
12
-
13
- &::-webkit-scrollbar-thumb {
14
- border: 1px solid var(--ui-pal-bg);
15
- border-radius: var(--ui-lt-scroll-width);
16
- background-color: transparent;
17
- }
18
-
19
- ::-webkit-scrollbar-corner {
20
- background-color: transparent !important;
21
- border: 0 none !important;
22
- box-shadow: none !important;
23
- }
24
-
25
- &:focus::-webkit-scrollbar-thumb,
26
- &:hover::-webkit-scrollbar-thumb, {
27
- background-color: var(--ui-pal);
28
- }
29
- }
30
-
31
- @mixin scrollbar-invisible() {
32
- &::-webkit-scrollbar {
33
- width: 0;
34
- background-color: transparent;
35
- display: none;
36
- }
37
-
38
- &::-webkit-scrollbar-thumb {
39
- background-color: transparent;
40
- }
41
-
42
- -ms-overflow-style: none;
43
- scrollbar-width: none;
44
- }
45
-
46
-
1
+ @mixin scrollbar-awesome($hide: false) {
2
+ &::-webkit-scrollbar-track {
3
+ background-color: var(--ui-scroll-bg, inherit);
4
+ }
5
+
6
+ &::-webkit-scrollbar {
7
+ width: var(--ui-scroll-width);
8
+ height: var(--ui-scroll-width);
9
+ border-radius: var(--ui-scroll-width);
10
+ background-color: var(--ui-scroll-bg, inherit);
11
+ }
12
+
13
+ &::-webkit-scrollbar-thumb {
14
+ border: 1px solid var(--ui-scroll-bg, inherit);
15
+ border-radius: var(--ui-scroll-width);
16
+ @if ($hide) {
17
+ background-color: inherit;
18
+ } @else {
19
+ background-color: var(--ui-pal);
20
+ }
21
+ }
22
+
23
+ ::-webkit-scrollbar-corner {
24
+ background-color: transparent !important;
25
+ border: 0 none !important;
26
+ box-shadow: none !important;
27
+ }
28
+ @if ($hide) {
29
+ &:focus::-webkit-scrollbar-thumb,
30
+ &:hover::-webkit-scrollbar-thumb, {
31
+ background-color: var(--ui-pal);
32
+ }
33
+ }
34
+ }
35
+
36
+ @mixin scrollbar-invisible() {
37
+ &::-webkit-scrollbar {
38
+ width: 0;
39
+ background-color: transparent;
40
+ display: none;
41
+ }
42
+
43
+ &::-webkit-scrollbar-thumb {
44
+ background-color: transparent;
45
+ }
46
+
47
+ -ms-overflow-style: none;
48
+ scrollbar-width: none;
49
+ }