@v1nt1248/3nclient-lib 0.0.25 → 0.0.26
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 +1 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/ui3n-button.vue.d.ts +11 -52
- package/dist/components/ui3n-checkbox.vue.d.ts +68 -0
- package/dist/components/ui3n-dialog.vue.d.ts +11 -24
- package/dist/components/ui3n-drop-files.vue.d.ts +11 -22
- package/dist/components/ui3n-emoji.vue.d.ts +22 -28
- package/dist/components/ui3n-icon.vue.d.ts +11 -72
- package/dist/components/ui3n-input.vue.d.ts +11 -60
- package/dist/components/ui3n-list.vue.d.ts +36 -11
- package/dist/components/ui3n-menu.vue.d.ts +29 -45
- package/dist/components/ui3n-notification.vue.d.ts +10 -70
- package/dist/components/ui3n-table-sort-icon.vue.d.ts +9 -22
- package/dist/components/ui3n-table.vue.d.ts +11 -18
- package/dist/components/ui3n-text.vue.d.ts +11 -48
- package/dist/components/ui3n-virtual-scroll.vue.d.ts +21 -11
- package/dist/index.d.ts +2 -0
- package/dist/stories/Ui3nButton.stories.d.ts +32 -47
- package/dist/stories/Ui3nCheckbox.stories.d.ts +226 -0
- package/dist/stories/Ui3nDropFiles.stories.d.ts +15 -47
- package/dist/stories/Ui3nEmoji.stories.d.ts +8 -8
- package/dist/stories/Ui3nList.stories.d.ts +36 -11
- package/dist/style.css +1 -1
- package/dist/ui-3n-lib.js +4949 -4860
- package/package.json +11 -11
- package/src/components/index.ts +6 -0
- package/src/components/ui3n-button.vue +2 -15
- package/src/components/ui3n-checkbox.vue +191 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@v1nt1248/3nclient-lib",
|
|
3
3
|
"license": "AGPL-3.0-or-later",
|
|
4
4
|
"author": "v1nt1248",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.26",
|
|
6
6
|
"description": "Library for 3NWeb clients",
|
|
7
7
|
"private": false,
|
|
8
8
|
"type": "module",
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
"vue": "^3.3.4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@storybook/addon-actions": "^7.
|
|
51
|
-
"@storybook/addon-docs": "^7.
|
|
52
|
-
"@storybook/addon-essentials": "^7.
|
|
53
|
-
"@storybook/addon-interactions": "^7.
|
|
54
|
-
"@storybook/addon-links": "^7.
|
|
55
|
-
"@storybook/blocks": "^7.
|
|
56
|
-
"@storybook/builder-vite": "^7.
|
|
50
|
+
"@storybook/addon-actions": "^7.5.1",
|
|
51
|
+
"@storybook/addon-docs": "^7.5.1",
|
|
52
|
+
"@storybook/addon-essentials": "^7.5.1",
|
|
53
|
+
"@storybook/addon-interactions": "^7.5.1",
|
|
54
|
+
"@storybook/addon-links": "^7.5.1",
|
|
55
|
+
"@storybook/blocks": "^7.5.1",
|
|
56
|
+
"@storybook/builder-vite": "^7.5.1",
|
|
57
57
|
"@storybook/testing-library": "^0.2.1",
|
|
58
|
-
"@storybook/vue3": "^7.
|
|
59
|
-
"@storybook/vue3-vite": "^7.
|
|
58
|
+
"@storybook/vue3": "^7.5.1",
|
|
59
|
+
"@storybook/vue3-vite": "^7.5.1",
|
|
60
60
|
"@types/lodash": "^4.14.197",
|
|
61
61
|
"@types/node": "^20.5.6",
|
|
62
62
|
"@types/sanitize-html": "^2.9.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"stylelint-rscss": "^0.4.0",
|
|
87
87
|
"stylelint-scss": "^5.1.0",
|
|
88
88
|
"typescript": "^5.2.2",
|
|
89
|
-
"vite": "^4.
|
|
89
|
+
"vite": "^4.5.0",
|
|
90
90
|
"vite-plugin-css-injected-by-js": "^3.3.0",
|
|
91
91
|
"vite-plugin-dts": "^3.5.3",
|
|
92
92
|
"vue": "^3.3.4",
|
package/src/components/index.ts
CHANGED
|
@@ -10,6 +10,8 @@ import Ui3nInput from './ui3n-input.vue'
|
|
|
10
10
|
import type { Ui3nInputProps, Ui3nInputEmits } from './ui3n-input.vue'
|
|
11
11
|
import Ui3nText from './ui3n-text.vue'
|
|
12
12
|
import type { Ui3nTextProps, Ui3nTextEmits } from './ui3n-text.vue'
|
|
13
|
+
import Ui3mCheckbox from './ui3n-checkbox.vue'
|
|
14
|
+
import type { Ui3nCheckboxProps, Ui3nCheckboxEmits, Ui3nCheckboxSlots } from './ui3n-checkbox.vue'
|
|
13
15
|
import Ui3nNotification from './ui3n-notification.vue'
|
|
14
16
|
import Ui3nTableSortIcon from './ui3n-table-sort-icon.vue'
|
|
15
17
|
import type { Ui3nTableSortIconProps } from './ui3n-table-sort-icon.vue'
|
|
@@ -43,6 +45,10 @@ export {
|
|
|
43
45
|
Ui3nText,
|
|
44
46
|
Ui3nTextProps,
|
|
45
47
|
Ui3nTextEmits,
|
|
48
|
+
Ui3mCheckbox,
|
|
49
|
+
Ui3nCheckboxProps,
|
|
50
|
+
Ui3nCheckboxEmits,
|
|
51
|
+
Ui3nCheckboxSlots,
|
|
46
52
|
Ui3nNotification,
|
|
47
53
|
Ui3nTableSortIcon,
|
|
48
54
|
Ui3nTableSortIconProps,
|
|
@@ -110,8 +110,6 @@
|
|
|
110
110
|
line-height: var(--ui3n-button-text-height);
|
|
111
111
|
font-weight: 600;
|
|
112
112
|
color: var(--ui3n-button-text-color);
|
|
113
|
-
background-position: center;
|
|
114
|
-
transition: background 0.5s ease-in-out;
|
|
115
113
|
|
|
116
114
|
&--round {
|
|
117
115
|
--ui3n-button-padding-vert: 6px;
|
|
@@ -125,13 +123,7 @@
|
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
&:not([disabled]) {
|
|
128
|
-
cursor: pointer;
|
|
129
|
-
|
|
130
126
|
&:hover {
|
|
131
|
-
background:
|
|
132
|
-
var(--ui3n-button-background)
|
|
133
|
-
radial-gradient(circle, transparent 1%, var(--ui3n-button-background) 1%)
|
|
134
|
-
center/15000%;
|
|
135
127
|
box-shadow: 0 0 4px var(--shadow-key-ambient-opacity, rgba(0, 0, 0, 0.12));
|
|
136
128
|
|
|
137
129
|
.ui3n-button {
|
|
@@ -141,13 +133,6 @@
|
|
|
141
133
|
}
|
|
142
134
|
}
|
|
143
135
|
}
|
|
144
|
-
|
|
145
|
-
&:active {
|
|
146
|
-
opacity: 1;
|
|
147
|
-
background-color: var(--black-30, #b3b3b3);
|
|
148
|
-
background-size: 100%;
|
|
149
|
-
transition: background 0s;
|
|
150
|
-
}
|
|
151
136
|
}
|
|
152
137
|
|
|
153
138
|
&__icon {
|
|
@@ -168,5 +153,7 @@
|
|
|
168
153
|
&[disabled] {
|
|
169
154
|
opacity: 0.7;
|
|
170
155
|
}
|
|
156
|
+
|
|
157
|
+
@include ripple(var(--ui3n-button-background));
|
|
171
158
|
}
|
|
172
159
|
</style>
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { computed, onMounted, watch, onBeforeMount, ref, useSlots } from 'vue'
|
|
3
|
+
import Ui3nIcon from './ui3n-icon.vue'
|
|
4
|
+
|
|
5
|
+
type Ui3nCheckboxValue = boolean | string | number;
|
|
6
|
+
|
|
7
|
+
export interface Ui3nCheckboxProps {
|
|
8
|
+
modelValue: Ui3nCheckboxValue;
|
|
9
|
+
checkedValue?: Ui3nCheckboxValue;
|
|
10
|
+
uncheckedValue?: Ui3nCheckboxValue;
|
|
11
|
+
size?: number|string;
|
|
12
|
+
color?: string;
|
|
13
|
+
indeterminate?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface Ui3nCheckboxEmits {
|
|
18
|
+
(ev: 'change', value: Ui3nCheckboxValue): void;
|
|
19
|
+
(ev: 'update:modelValue', value: Ui3nCheckboxValue): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Ui3nCheckboxSlots {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
default: () => any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const iconMap = {
|
|
28
|
+
checked: 'check-box-checked',
|
|
29
|
+
unchecked: 'check-box',
|
|
30
|
+
indeterminate: 'check-box-inderterminate',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const props = withDefaults(
|
|
34
|
+
defineProps<Ui3nCheckboxProps>(),
|
|
35
|
+
{
|
|
36
|
+
modelValue: false,
|
|
37
|
+
checkedValue: true,
|
|
38
|
+
uncheckedValue: false,
|
|
39
|
+
size: '16',
|
|
40
|
+
color: '#0090ec',
|
|
41
|
+
indeterminate: false,
|
|
42
|
+
disabled: false,
|
|
43
|
+
},
|
|
44
|
+
)
|
|
45
|
+
const emits = defineEmits<Ui3nCheckboxEmits>()
|
|
46
|
+
defineSlots<Ui3nCheckboxSlots>()
|
|
47
|
+
|
|
48
|
+
const slots = useSlots()
|
|
49
|
+
|
|
50
|
+
const checkboxEl = ref<HTMLDivElement|null>(null)
|
|
51
|
+
const val = ref<Ui3nCheckboxValue>(props.uncheckedValue || false)
|
|
52
|
+
const uncertain = ref(false)
|
|
53
|
+
|
|
54
|
+
onBeforeMount(() => {
|
|
55
|
+
const checkedValueType = typeof props.checkedValue
|
|
56
|
+
const uncheckedValueType = typeof props.uncheckedValue
|
|
57
|
+
const valueType = typeof props.modelValue
|
|
58
|
+
if (
|
|
59
|
+
checkedValueType !== uncheckedValueType
|
|
60
|
+
|| checkedValueType !== valueType
|
|
61
|
+
|| uncheckedValueType !== valueType
|
|
62
|
+
) {
|
|
63
|
+
throw Error('[Ui3nCheckbox] types of "value", "checkedValue" and "unchecktdValue" are different')
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
onMounted(() => {
|
|
68
|
+
if (checkboxEl.value) {
|
|
69
|
+
checkboxEl.value.style.setProperty('--ui3n-checkbox-size', `${props.size}px`)
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
watch(
|
|
74
|
+
() => props.modelValue,
|
|
75
|
+
newValue => val.value = newValue,
|
|
76
|
+
{ immediate: true },
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
watch(
|
|
80
|
+
() => props.indeterminate,
|
|
81
|
+
newValue => uncertain.value = newValue,
|
|
82
|
+
{ immediate: true},
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
watch(
|
|
86
|
+
() => props.size,
|
|
87
|
+
newValue => {
|
|
88
|
+
if (checkboxEl.value) {
|
|
89
|
+
checkboxEl.value.style.setProperty('--ui3n-checkbox-size', `${newValue}px`)
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
const checkBoxValue = computed(() => {
|
|
95
|
+
if (uncertain.value) {
|
|
96
|
+
return 'indeterminate'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return val.value === props.checkedValue
|
|
100
|
+
? 'checked'
|
|
101
|
+
: 'unchecked'
|
|
102
|
+
} )
|
|
103
|
+
|
|
104
|
+
const change = () => {
|
|
105
|
+
val.value = checkBoxValue.value !== 'unchecked'
|
|
106
|
+
? props.uncheckedValue
|
|
107
|
+
: props.checkedValue
|
|
108
|
+
|
|
109
|
+
if (uncertain.value) {
|
|
110
|
+
uncertain.value = false
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
emits('change', val.value)
|
|
114
|
+
emits('update:modelValue', val.value)
|
|
115
|
+
}
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<template>
|
|
119
|
+
<div
|
|
120
|
+
ref="checkboxEl"
|
|
121
|
+
:class="[
|
|
122
|
+
'ui3n-checkbox',
|
|
123
|
+
{
|
|
124
|
+
'ui3n-checkbox--disabled': props.disabled,
|
|
125
|
+
'ui3n-checkbox--with-label': slots.default,
|
|
126
|
+
},
|
|
127
|
+
]"
|
|
128
|
+
>
|
|
129
|
+
<div
|
|
130
|
+
class="ui3n-checkbox__wrapper"
|
|
131
|
+
@click="change"
|
|
132
|
+
>
|
|
133
|
+
<ui3n-icon
|
|
134
|
+
class="ui3n-checkbox__icon"
|
|
135
|
+
:icon="iconMap[checkBoxValue]"
|
|
136
|
+
:width="props.size"
|
|
137
|
+
:height="props.size"
|
|
138
|
+
:color="props.color"
|
|
139
|
+
/>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div
|
|
143
|
+
class="ui3n-checkbox__label"
|
|
144
|
+
@click="change"
|
|
145
|
+
>
|
|
146
|
+
<slot />
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</template>
|
|
150
|
+
|
|
151
|
+
<style lang="scss" scoped>
|
|
152
|
+
@import "../assets/styles/mixins";
|
|
153
|
+
|
|
154
|
+
.ui3n-checkbox {
|
|
155
|
+
--ui3n-checkbox-size: 16px;
|
|
156
|
+
--ui3n-checkbox-text-size: 12px;
|
|
157
|
+
--ui3n-checkbox-text-color: var(--black-90, #212121);
|
|
158
|
+
--ui3n-checkbox-text-weight: 500;
|
|
159
|
+
|
|
160
|
+
position: relative;
|
|
161
|
+
display: flex;
|
|
162
|
+
justify-content: flex-start;
|
|
163
|
+
align-items: center;
|
|
164
|
+
|
|
165
|
+
&__wrapper {
|
|
166
|
+
position: relative;
|
|
167
|
+
display: flex;
|
|
168
|
+
width: calc(var(--ui3n-checkbox-size) * 1.5);
|
|
169
|
+
height: calc(var(--ui3n-checkbox-size) * 1.5);
|
|
170
|
+
justify-content: center;
|
|
171
|
+
align-items: center;
|
|
172
|
+
border-radius: 50%;
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
|
|
175
|
+
@include ripple(transparent);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&__label {
|
|
179
|
+
font-size: var(--ui3n-checkbox-text-size);
|
|
180
|
+
font-weight: var(--ui3n-checkbox-text-weight);
|
|
181
|
+
color: var(--ui3n-checkbox-text-color);
|
|
182
|
+
user-select: none;
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&--disabled {
|
|
187
|
+
pointer-events: none;
|
|
188
|
+
opacity: 0.5;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
</style>
|