@v1nt1248/3nclient-lib 0.0.42 → 0.1.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.
Files changed (56) hide show
  1. package/README.md +4 -4
  2. package/dist/components/index.d.ts +20 -19
  3. package/dist/components/ui3n-badge-simple.vue.d.ts +2 -2
  4. package/dist/components/ui3n-badge.vue.d.ts +1 -1
  5. package/dist/components/ui3n-breadcrumb.vue.d.ts +7 -7
  6. package/dist/components/ui3n-breadcrumbs.vue.d.ts +3 -3
  7. package/dist/components/ui3n-button.vue.d.ts +29 -4
  8. package/dist/components/ui3n-checkbox.vue.d.ts +2 -2
  9. package/dist/components/ui3n-chip.vue.d.ts +2 -2
  10. package/dist/components/ui3n-dialog.vue.d.ts +4 -4
  11. package/dist/components/ui3n-drop-files.vue.d.ts +23 -3
  12. package/dist/components/ui3n-emoji.vue.d.ts +2 -2
  13. package/dist/components/ui3n-icon.vue.d.ts +29 -3
  14. package/dist/components/ui3n-input.vue.d.ts +9 -9
  15. package/dist/components/ui3n-list.vue.d.ts +1 -1
  16. package/dist/components/ui3n-menu.vue.d.ts +2 -2
  17. package/dist/components/ui3n-notification.vue.d.ts +30 -1
  18. package/dist/components/ui3n-switch.vue.d.ts +55 -0
  19. package/dist/components/ui3n-table-sort-icon.vue.d.ts +1 -1
  20. package/dist/components/ui3n-table.vue.d.ts +2 -2
  21. package/dist/components/ui3n-tabs.vue.d.ts +2 -2
  22. package/dist/components/ui3n-text.vue.d.ts +29 -3
  23. package/dist/components/ui3n-virtual-scroll.vue.d.ts +9 -6
  24. package/dist/constants/types.d.ts +2 -4
  25. package/dist/directives/index.d.ts +1 -1
  26. package/dist/index.d.ts +25 -27
  27. package/dist/plugins/dialogs.d.ts +1 -1
  28. package/dist/plugins/index.d.ts +8 -8
  29. package/dist/plugins/notifications.d.ts +1 -1
  30. package/dist/plugins/vue-bus.d.ts +1 -1
  31. package/dist/style.css +1 -1
  32. package/dist/tools/sqlite-on-3nstorage/index.d.ts +3 -3
  33. package/dist/ui-3n-lib.js +6794 -6469
  34. package/package.json +57 -59
  35. package/src/components/index.ts +47 -41
  36. package/src/components/ui3n-badge-simple.vue +35 -38
  37. package/src/components/ui3n-badge.vue +25 -25
  38. package/src/components/ui3n-breadcrumb.vue +44 -44
  39. package/src/components/ui3n-breadcrumbs.vue +19 -19
  40. package/src/components/ui3n-button.vue +240 -150
  41. package/src/components/ui3n-checkbox.vue +199 -158
  42. package/src/components/ui3n-chip.vue +96 -98
  43. package/src/components/ui3n-dialog.vue +225 -235
  44. package/src/components/ui3n-drop-files.vue +146 -154
  45. package/src/components/ui3n-emoji.vue +62 -64
  46. package/src/components/ui3n-icon.vue +32 -13
  47. package/src/components/ui3n-input.vue +239 -221
  48. package/src/components/ui3n-list.vue +92 -111
  49. package/src/components/ui3n-menu.vue +101 -100
  50. package/src/components/ui3n-notification.vue +182 -113
  51. package/src/components/ui3n-switch.vue +146 -0
  52. package/src/components/ui3n-table-sort-icon.vue +1 -2
  53. package/src/components/ui3n-table.vue +229 -223
  54. package/src/components/ui3n-tabs.vue +141 -148
  55. package/src/components/ui3n-text.vue +235 -146
  56. package/src/components/ui3n-virtual-scroll.vue +68 -68
@@ -1,133 +1,202 @@
1
- ui<script lang="ts" setup>
2
- import { computed } from 'vue'
3
- import Ui3nIcon from './ui3n-icon.vue'
4
- import Ui3nButton from './ui3n-button.vue'
5
- import type { Ui3nNotificationProps } from '../constants'
6
-
7
- const props = defineProps<Ui3nNotificationProps>()
8
- const params = computed(() => {
9
- const {
10
- id,
11
- type = 'info',
12
- content,
13
- icon,
14
- iconSize = '16',
15
- iconColor = 'var(--black-30, #b3b3b3)',
16
- position = 'center',
17
- duration = 0,
18
- onOpen = () => void(0),
19
- onClose = () => void(0),
20
- } = props
21
- return { id, type, content, icon, iconSize, iconColor, position, duration, onOpen, onClose }
22
- })
23
-
24
- const closeNotification = () => {
25
- params.value.onClose()
1
+ <script lang="ts" setup>
2
+ import { onMounted } from 'vue';
3
+ import Ui3nIcon from './ui3n-icon.vue';
4
+ import Ui3nButton from './ui3n-button.vue';
5
+ import type { Ui3nNotificationProps } from '../constants';
6
+
7
+ const props = withDefaults(
8
+ defineProps<Ui3nNotificationProps>(),
9
+ {
10
+ type: 'info',
11
+ position: 'center',
12
+ duration: 0,
13
+ withIcon: true,
14
+ onOpen: () => void (0),
15
+ onClose: () => void (0),
16
+ },
17
+ );
18
+
19
+ const stylesByTypes = {
20
+ success: {
21
+ color: 'var(--success-content-default)',
22
+ icon: 'warning',
23
+ iconColor: 'var(--success-fill-default)',
24
+ iconRotate: 0,
25
+ },
26
+ warning: {
27
+ color: 'var(--warning-content-default)',
28
+ icon: 'warning',
29
+ iconColor: 'var(--warning-fill-default)',
30
+ iconRotate: 0,
31
+ },
32
+ info: {
33
+ color: 'var(--info-content-default)',
34
+ icon: 'info',
35
+ iconColor: 'var(--info-fill-default)',
36
+ iconRotate: 90,
37
+ },
38
+ error: {
39
+ color: 'var(--error-content-default)',
40
+ icon: 'info',
41
+ iconColor: 'var(--error-fill-default)',
42
+ iconRotate: 90,
43
+ },
44
+ };
45
+
46
+ onMounted(() => {
47
+ if (props.duration > 500) {
48
+ setTimeout(() => {
49
+ props.onClose();
50
+ }, props.duration);
26
51
  }
52
+ });
53
+
54
+ const closeNotification = () => {
55
+ props.onClose();
56
+ };
27
57
  </script>
28
58
 
29
59
  <template>
30
60
  <div
31
- :id="params.id"
32
- :class="[
33
- 'ui3n-notification',
34
- `ui3n-notification--${params.type}`,
35
- `ui3n-notification--${params.position}`,
36
- {
37
- 'ui3n-notification--with-icon': params.icon,
38
- },
39
- ]"
61
+ :id="id"
62
+ :class="[$style.notification, $style[`${type}Type`], $style[`${position}Position`], withIcon && $style.withIcon]"
40
63
  >
41
- <ui3n-icon
42
- v-if="params.icon"
43
- :icon="params.icon"
44
- :width="params.iconSize"
45
- :height="params.iconSize"
46
- :color="params.iconColor"
47
- />
64
+ <div v-if="withIcon" :class="$style.icon">
65
+ <ui3n-icon
66
+ :icon="stylesByTypes[type].icon"
67
+ width="16"
68
+ height="16"
69
+ :rotate="stylesByTypes[type].iconRotate"
70
+ :color="stylesByTypes[type].iconColor"
71
+ />
72
+ </div>
48
73
 
49
- <div class="ui3n-notification__content">
50
- {{ params.content }}
74
+
75
+ <div :class="$style.content">
76
+ {{ content }}
51
77
  </div>
52
78
 
53
79
  <ui3n-button
54
80
  v-if="!props.duration"
55
- round
81
+ type="icon"
82
+ size="small"
56
83
  color="transparent"
57
84
  icon="close"
58
- icon-size="12"
59
- icon-color="var(--system-white, #fff)"
60
- class="ui3n-notification__close"
85
+ :icon-color="stylesByTypes[type].color"
86
+ :class="$style.closeBtn"
61
87
  @click="closeNotification"
62
88
  />
63
89
  </div>
64
90
  </template>
65
91
 
66
- <style lang="scss" scoped>
67
- .ui3n-notification {
68
- display: flex;
69
- position: relative;
70
- z-index: 5000;
71
- border-radius: var(--half-size, 4px);
72
- padding: var(--base-size, 8px);
73
- max-width: 400px;
74
- margin-bottom: var(--base-size);
75
-
76
- &--with-icon {
77
- display: flex;
78
- justify-content: flex-start;
79
- align-items: center;
80
-
81
- .ui3n-notification__content {
82
- padding-left: var(--base-size, 8px);
83
- }
84
- }
85
-
86
- &__content {
87
- position: relative;
88
- flex-grow: 2;
89
- font-size: var(--font-13, 13px);
90
- font-weight: 400;
91
- line-height: 1.5;
92
- color: var(--system-white, #fff);
93
- }
94
-
95
- &__close {
96
- position: absolute;
97
- z-index: 1;
98
- top: 0;
99
- right: 0;
100
- }
101
-
102
- &--success {
103
- background-color: rgb(16, 196, 143);
104
- }
105
-
106
- &--warning {
107
- background-color: rgb(255, 136,0);
108
- }
109
-
110
- &--info {
111
- background-color: rgb(16, 175, 239);
112
- }
113
-
114
- &--error {
115
- background-color: rgb(239, 83, 80);
116
- }
117
-
118
- &--left {
119
- margin-left: 0;
120
- margin-right: auto;
121
- }
122
-
123
- &--center {
124
- margin-left: auto;
125
- margin-right: auto;
126
- }
127
-
128
- &--right {
129
- margin-left: auto;
130
- margin-right: 0;
131
- }
92
+ <style lang="scss" module>
93
+ .notification {
94
+ --ui3n-notification-width: 380px;
95
+
96
+ display: flex;
97
+ position: relative;
98
+ z-index: 5000;
99
+ border-radius: var(--spacing-s);
100
+ outline: 1px solid var(--color-border-control-tritery-default);
101
+ padding: var(--spacing-m);
102
+ max-width: var(--ui3n-notification-width);
103
+ margin-bottom: var(--spacing-s);
104
+ justify-content: center;
105
+ align-items: center;
106
+ gap: var(--spacing-s);
107
+ }
108
+
109
+ .withIcon {
110
+ justify-content: flex-start;
111
+ }
112
+
113
+ .icon {
114
+ position: relative;
115
+ min-width: var(--spacing-l);
116
+ width: var(--spacing-l);
117
+ min-height: var(--spacing-l);
118
+ height: var(--spacing-l);
119
+ border-radius: 50%;
120
+ display: flex;
121
+ justify-content: center;
122
+ align-items: center;
123
+ }
124
+
125
+ .content {
126
+ position: relative;
127
+ flex-grow: 2;
128
+ font-size: var(--font-12);
129
+ font-weight: 500;
130
+ line-height: var(--font-16);
131
+ }
132
+
133
+ .closeBtn {
134
+ position: absolute;
135
+ z-index: 1;
136
+ top: 0;
137
+ right: 0;
138
+ }
139
+
140
+ .infoType {
141
+ background-color: var(--info-fill-default);
142
+
143
+ .icon {
144
+ background-color: var(--info-content-default);
145
+ }
146
+
147
+ .content {
148
+ color: var(--info-content-default);
149
+ }
150
+ }
151
+
152
+ .successType {
153
+ background-color: var(--success-fill-default);
154
+
155
+ .icon {
156
+ background-color: var(--success-content-default);
157
+ }
158
+
159
+ .content {
160
+ color: var(--success-content-default);
161
+ }
162
+ }
163
+
164
+ .warningType {
165
+ background-color: var(--warning-fill-default);
166
+
167
+ .icon {
168
+ background-color: var(--warning-content-default);
169
+ }
170
+
171
+ .content {
172
+ color: var(--warning-content-default);
173
+ }
174
+ }
175
+
176
+ .errorType {
177
+ background-color: var(--error-fill-default);
178
+
179
+ .icon {
180
+ background-color: var(--error-content-default);
181
+ }
182
+
183
+ .content {
184
+ color: var(--error-content-default);
132
185
  }
186
+ }
187
+
188
+ .leftPosition {
189
+ margin-left: 0;
190
+ margin-right: auto;
191
+ }
192
+
193
+ .centerPosition {
194
+ margin-left: auto;
195
+ margin-right: auto;
196
+ }
197
+
198
+ .rightPosition {
199
+ margin-left: auto;
200
+ margin-right: 0;
201
+ }
133
202
  </style>
@@ -0,0 +1,146 @@
1
+ <script lang="ts" setup>
2
+ import { onMounted, ref, watch, useSlots } from 'vue';
3
+
4
+ export interface Ui3nSwitchProps {
5
+ modelValue: boolean;
6
+ size?: number | string;
7
+ color?: string;
8
+ disabled?: boolean;
9
+ }
10
+
11
+ export interface Ui3nSwitchEmits {
12
+ (ev: 'change', value: boolean): void;
13
+ (ev: 'update:modelValue', value: boolean): void;
14
+ }
15
+
16
+ export interface Ui3nSwitchSlots {
17
+ default: () => any;
18
+ }
19
+
20
+ const props = withDefaults(
21
+ defineProps<Ui3nSwitchProps>(),
22
+ {
23
+ size: 16,
24
+ color: 'var(--color-icon-control-accent-default)',
25
+ disabled: false,
26
+ },
27
+ );
28
+
29
+ const emits = defineEmits<Ui3nSwitchEmits>();
30
+
31
+ defineSlots<Ui3nSwitchSlots>();
32
+
33
+ const slots = useSlots();
34
+ const switchEl = ref<HTMLDivElement | null>(null);
35
+ const val = ref<boolean>(false);
36
+
37
+ onMounted(() => {
38
+ if (switchEl.value) {
39
+ switchEl.value.style.setProperty('--ui3n-switch-color', `${props.color}`);
40
+ props.size && switchEl.value.style.setProperty('--ui3n-switch-size', `${props.size}px`);
41
+ }
42
+ });
43
+
44
+ watch(
45
+ () => props.modelValue,
46
+ newValue => val.value = newValue,
47
+ { immediate: true },
48
+ );
49
+
50
+ function change() {
51
+ val.value = !val.value;
52
+ emits('change', val.value);
53
+ emits('update:modelValue', val.value);
54
+ }
55
+ </script>
56
+
57
+ <template>
58
+ <div
59
+ ref="switchEl"
60
+ :class="[$style.switch, val && $style.checked, !slots.default && $style.noLabel, disabled && $style.disabled]"
61
+ >
62
+ <Transition>
63
+ <div :class="$style.body" @click="change">
64
+ <div :class="[$style.dot, val ? $style.right : $style.left]" />
65
+ </div>
66
+ </Transition>
67
+
68
+ <div :class="$style.label">
69
+ <slot />
70
+ </div>
71
+ </div>
72
+ </template>
73
+
74
+ <style lang="scss" module>
75
+ .switch {
76
+ --ui3n-switch-size: 16px;
77
+ --ui3n-switch-color: var(--color-icon-control-accent-default);
78
+ --ui3n-switch-off-color: var(--color-bg-table-cell-pressed);
79
+ --ui3n-switch-font-size: 12px;
80
+ --ui3n-switch-font-color: var(--color-text-control-primary-default);
81
+ --ui3n-switch-font-weight: 500;
82
+
83
+ position: relative;
84
+ display: flex;
85
+ justify-content: flex-start;
86
+ align-items: center;
87
+ gap: var(--spacing-s);
88
+ }
89
+
90
+ .body {
91
+ position: relative;
92
+ background-color: var(--ui3n-switch-off-color);
93
+ height: var(--ui3n-switch-size);
94
+ width: calc(var(--ui3n-switch-size) * 2);
95
+ border-radius: var(--ui3n-switch-size);
96
+ cursor: pointer;
97
+ }
98
+
99
+ .checked {
100
+ .body {
101
+ background-color: var(--ui3n-switch-color);
102
+ }
103
+
104
+ .dot {
105
+ border-color: var(--ui3n-switch-color);
106
+ }
107
+ }
108
+
109
+ .noLabel {
110
+ gap: 0;
111
+ }
112
+
113
+ .dot {
114
+ --ui3n-switch-dot-size: calc(var(--ui3n-switch-size) / 4 * 3);
115
+
116
+ position: absolute;
117
+ width: var(--ui3n-switch-dot-size);
118
+ height: var(--ui3n-switch-dot-size);
119
+ border-radius: 50%;
120
+ background-color: var(--white-0);
121
+ top: 0;
122
+ margin: calc(var(--ui3n-switch-size) / 8);
123
+ transition: all 250ms ease-in-out;
124
+ }
125
+
126
+ .left {
127
+ left: 0;
128
+ }
129
+
130
+ .right {
131
+ left: calc(100% - var(--ui3n-switch-size));
132
+ }
133
+
134
+ .label {
135
+ font-size: var(--ui3n-switch-font-size);
136
+ font-weight: var(--ui3n-switch-font-weight);
137
+ color: var(--ui3n-switch-font-color);
138
+ user-select: none;
139
+ cursor: pointer;
140
+ }
141
+
142
+ .disabled {
143
+ opacity: 0.7;
144
+ pointer-events: none;
145
+ }
146
+ </style>
@@ -11,7 +11,7 @@
11
11
  const props = defineProps<Ui3nTableSortIconProps>()
12
12
 
13
13
  const iconSize = computed(() => props.size ? +props.size : 16)
14
- const iconColor = computed(() => props.color || 'var(--black-90, #212121)')
14
+ const iconColor = computed(() => props.color || 'var(--color-icon-table-primary-default)')
15
15
  </script>
16
16
 
17
17
  <template>
@@ -20,6 +20,5 @@
20
20
  :width="iconSize"
21
21
  :height="iconSize"
22
22
  :color="iconColor"
23
- class="ui3n-table-sort-icon"
24
23
  />
25
24
  </template>