@v1nt1248/3nclient-lib 0.0.42 → 0.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.
Files changed (62) hide show
  1. package/README.md +7 -4
  2. package/dist/components/index.d.ts +23 -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 +30 -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 +18 -11
  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-progress-circular.vue.d.ts +43 -0
  19. package/dist/components/ui3n-progress-linear.vue.d.ts +42 -0
  20. package/dist/components/ui3n-step-line-bar.vue.d.ts +30 -0
  21. package/dist/components/ui3n-switch.vue.d.ts +55 -0
  22. package/dist/components/ui3n-table-sort-icon.vue.d.ts +1 -1
  23. package/dist/components/ui3n-table.vue.d.ts +2 -2
  24. package/dist/components/ui3n-tabs.vue.d.ts +2 -2
  25. package/dist/components/ui3n-text.vue.d.ts +29 -3
  26. package/dist/components/ui3n-virtual-scroll.vue.d.ts +9 -6
  27. package/dist/constants/types.d.ts +2 -4
  28. package/dist/directives/index.d.ts +1 -1
  29. package/dist/index.d.ts +31 -27
  30. package/dist/plugins/dialogs.d.ts +1 -1
  31. package/dist/plugins/index.d.ts +8 -8
  32. package/dist/plugins/notifications.d.ts +1 -1
  33. package/dist/plugins/vue-bus.d.ts +1 -1
  34. package/dist/style.css +1 -1
  35. package/dist/tools/sqlite-on-3nstorage/index.d.ts +3 -3
  36. package/dist/ui-3n-lib.js +7273 -6748
  37. package/package.json +58 -59
  38. package/src/components/index.ts +59 -41
  39. package/src/components/ui3n-badge-simple.vue +35 -38
  40. package/src/components/ui3n-badge.vue +25 -25
  41. package/src/components/ui3n-breadcrumb.vue +44 -44
  42. package/src/components/ui3n-breadcrumbs.vue +19 -19
  43. package/src/components/ui3n-button.vue +246 -150
  44. package/src/components/ui3n-checkbox.vue +199 -158
  45. package/src/components/ui3n-chip.vue +96 -98
  46. package/src/components/ui3n-dialog.vue +225 -235
  47. package/src/components/ui3n-drop-files.vue +146 -154
  48. package/src/components/ui3n-emoji.vue +62 -64
  49. package/src/components/ui3n-icon.vue +32 -13
  50. package/src/components/ui3n-input.vue +283 -215
  51. package/src/components/ui3n-list.vue +92 -111
  52. package/src/components/ui3n-menu.vue +101 -100
  53. package/src/components/ui3n-notification.vue +182 -113
  54. package/src/components/ui3n-progress-circular.vue +188 -0
  55. package/src/components/ui3n-progress-linear.vue +119 -0
  56. package/src/components/ui3n-step-line-bar.vue +66 -0
  57. package/src/components/ui3n-switch.vue +146 -0
  58. package/src/components/ui3n-table-sort-icon.vue +1 -2
  59. package/src/components/ui3n-table.vue +233 -228
  60. package/src/components/ui3n-tabs.vue +141 -148
  61. package/src/components/ui3n-text.vue +235 -146
  62. package/src/components/ui3n-virtual-scroll.vue +68 -68
@@ -1,172 +1,268 @@
1
1
  <script lang="ts" setup>
2
- import { computed, onMounted, ref, useSlots, watch } from 'vue'
3
- import { hasSlotContent } from '../tools/ui.helpers'
4
- import Ui3nIcon from './ui3n-icon.vue'
5
-
6
- export interface Ui3nButtonProps {
7
- textColor?: string;
8
- color?: string;
9
- round?: boolean;
10
- elevation?: boolean;
11
- icon?: string;
12
- iconSize?: string | number;
13
- iconColor?: string;
14
- disabled?: boolean;
15
- }
16
-
17
- export interface Ui3nButtonEmits {
18
- (ev: 'init', value: HTMLButtonElement): void;
19
- (ev: 'click', value: Event): void;
20
- (ev: 'focus', value: Event): void;
21
- (ev: 'blur', value: Event): void;
22
- }
23
-
24
- const slots = useSlots()
25
- const props = defineProps<Ui3nButtonProps>()
26
- const emits = defineEmits<Ui3nButtonEmits>()
27
-
28
- const buttonEl = ref<HTMLButtonElement | null>(null)
29
- const isSlotEmpty = computed(() => !hasSlotContent(slots['default']))
30
-
31
- watch(
32
- [() => props.color, () => props.textColor],
33
- (newValue: [string|undefined, string|undefined], prevValue: [string|undefined, string|undefined]) => {
34
- const [ prevColor, prevTextColor ] = prevValue
35
- const [ color, textColor ] = newValue
36
- if (buttonEl.value) {
37
- if (color !== prevColor) {
38
- buttonEl.value.style.setProperty('--ui3n-button-background', color ?? 'var(--blue-main, #0090ec)')
39
- }
40
- if (textColor !== prevTextColor) {
41
- buttonEl.value.style.setProperty('--ui3n-button-text-color', textColor ?? 'var(--system-white, #fff)')
42
- }
43
- }
44
- },
45
- )
46
-
47
- onMounted(() => {
48
- if (buttonEl.value) {
49
- if (props.color) {
50
- buttonEl.value.style.setProperty('--ui3n-button-background', props.color)
51
- }
52
- if (props.textColor) {
53
- buttonEl.value.style.setProperty('--ui3n-button-text-color', props.textColor)
54
- }
55
-
56
- emits('init', buttonEl.value)
57
- }
58
- })
2
+ import { onMounted, ref, watch } from 'vue';
3
+ import Ui3nIcon from './ui3n-icon.vue';
4
+
5
+ export interface Ui3nButtonProps {
6
+ type?: 'primary' | 'secondary' | 'tertiary' | 'icon' | 'custom';
7
+ size?: 'regular' | 'small';
8
+ block?: boolean;
9
+ textColor?: string;
10
+ color?: string;
11
+ elevation?: boolean;
12
+ icon?: string;
13
+ iconSize?: string | number;
14
+ iconColor?: string;
15
+ iconPosition?: 'left' | 'right';
16
+ disabled?: boolean;
17
+ }
18
+
19
+ export interface Ui3nButtonEmits {
20
+ (ev: 'init', value: HTMLButtonElement): void;
21
+ (ev: 'click', value: Event): void;
22
+ (ev: 'focus', value: Event): void;
23
+ (ev: 'blur', value: Event): void;
24
+ }
25
+
26
+ const props = withDefaults(
27
+ defineProps<Ui3nButtonProps>(),
28
+ {
29
+ type: 'primary',
30
+ size: 'regular',
31
+ iconPosition: 'right',
32
+ disabled: false,
33
+ },
34
+ );
35
+ const emits = defineEmits<Ui3nButtonEmits>();
36
+
37
+ const buttonEl = ref<HTMLButtonElement | null>(null);
38
+
39
+ watch(
40
+ [() => props.color, () => props.textColor],
41
+ (newValue: [string | undefined, string | undefined], prevValue: [string | undefined, string | undefined]) => {
42
+ if (!buttonEl.value) return;
43
+
44
+ const [prevColor, prevTextColor] = prevValue;
45
+ const [color, textColor] = newValue;
46
+
47
+ (props.type === 'custom' || props.type === 'icon')
48
+ && color !== prevColor
49
+ && buttonEl.value.style.setProperty('--ui3n-button-bg-color-custom', color ?? 'var(--color-bg-button-primary-default)');
50
+
51
+ props.type === 'custom'
52
+ && textColor !== prevTextColor
53
+ && buttonEl.value.style.setProperty('--ui3n-button-text-color-custom', textColor ?? 'var(--color-text-button-primary-default');
54
+ },
55
+ );
56
+
57
+ onMounted(() => {
58
+ if (!buttonEl.value) return;
59
+
60
+ (props.type === 'custom' || props.type === 'icon') && props.color && buttonEl.value.style.setProperty('--ui3n-button-bg-color-custom', props.color);
61
+
62
+ props.type === 'custom' && props.textColor && buttonEl.value.style.setProperty('--ui3n-button-text-color-custom', props.textColor);
63
+
64
+ emits('init', buttonEl.value);
65
+ });
59
66
  </script>
60
67
 
61
68
  <template>
62
69
  <button
63
70
  ref="buttonEl"
64
71
  :class="[
65
- 'ui3n-button',
66
- { 'ui3n-button--round': props.round, 'ui3n-button--elevation': props.elevation },
72
+ $style.button,
73
+ $style[size],
74
+ $style[type],
75
+ block && type !== 'icon' && $style.block,
76
+ icon && $style[`withIcon-${iconPosition}`],
77
+ elevation && $style.elevation,
67
78
  ]"
68
79
  type="button"
69
- :disabled="props.disabled"
80
+ :disabled="disabled"
70
81
  @click="emits('click', $event)"
71
82
  @focusin="emits('focus', $event)"
72
83
  @focusout="emits('blur', $event)"
73
84
  >
74
85
  <ui3n-icon
75
- v-if="props.icon"
76
- class="ui3n-button__icon"
77
- :icon="props.icon"
78
- :width="props.iconSize"
79
- :height="props.iconSize"
80
- :color="props.iconColor || 'var(--ui3n-button-text-color)'"
86
+ v-if="icon"
87
+ :class="$style.buttonIcon"
88
+ :icon="icon"
89
+ :width="iconSize || (size === 'small' ? 12 : 16)"
90
+ :height="iconSize || (size === 'small' ? 12 : 16)"
91
+ :color="iconColor || 'var(--color-text-button-primary-default)'"
81
92
  />
82
- <span
83
- :class="[
84
- 'ui3n-button__text',
85
- { 'ui3n-button__text--margin': !isSlotEmpty && props.icon },
86
- ]"
87
- >
93
+
94
+ <span v-if="type !== 'icon'" :class="$style.text">
88
95
  <slot />
89
96
  </span>
90
97
  </button>
91
98
  </template>
92
99
 
93
- <style lang="scss" scoped>
94
- @import "../assets/styles/mixins";
95
-
96
- .ui3n-button {
97
- --ui3n-button-text-size: 12px;
98
- --ui3n-button-text-height: 16px;
99
- --ui3n-button-text-color: var(--system-white, #fff);
100
- --ui3n-button-background: var(--blue-main, #0090ec);
101
- --ui3n-button-padding-vert: 8px;
102
- --ui3n-button-padding-horiz: 16px;
103
-
104
- display: flex;
105
- justify-content: center;
106
- align-items: center;
107
- border: none;
108
- outline: none;
109
- padding: var(--ui3n-button-padding-vert) var(--ui3n-button-padding-horiz);
110
- border-radius: 4px;
111
- background: var(--ui3n-button-background);
112
- font-size: var(--ui3n-button-text-size);
113
- line-height: var(--ui3n-button-text-height);
114
- font-weight: 600;
115
- color: var(--ui3n-button-text-color);
116
- user-select: none;
117
-
118
- &--round {
119
- --ui3n-button-padding-vert: 6px;
120
- --ui3n-button-padding-horiz: 6px;
121
-
122
- border-radius: 50%;
123
- }
124
-
125
- &--elevation {
126
- @include elevation();
127
- }
128
-
129
- &:not([disabled]) {
130
- &:hover {
131
- box-shadow: 0 0 4px var(--shadow-key-ambient-opacity, rgba(0, 0, 0, 0.12));
132
-
133
- .ui3n-button {
134
- &__icon,
135
- &__text {
136
- opacity: 1;
137
- }
138
- }
139
- }
140
- }
141
-
142
- &__icon {
143
- opacity: 0.85;
144
- transition: opacity 0.2s ease-in-out;
145
- }
146
-
147
- &__text {
148
- display: flex;
149
- opacity: 0.85;
150
- transition: opacity 0.2s ease-in-out;
151
-
152
- &--margin {
153
- margin-left: 4px;
154
- }
155
- }
156
-
157
- &[disabled] {
158
- opacity: 0.7;
159
- }
160
-
161
- &:not(.ui3n-button--round) {
162
- .ui3n-button {
163
- &__icon,
164
- &__text {
165
- pointer-events: none
166
- }
167
- }
168
- }
169
-
170
- @include ripple(var(--ui3n-button-background));
100
+ <style lang="scss" module>
101
+ @import "../assets/styles/mixins";
102
+
103
+ .button {
104
+ --ui3n-button-padding: var(--spacing-m);
105
+ --ui3n-button-text-size: var(--font-12);
106
+ --ui3n-button-text-color-custom: var(--color-text-button-primary-default);
107
+ --ui3n-button-bg-color-custom: var(--color-bg-button-primary-default);
108
+
109
+ display: flex;
110
+ justify-content: center;
111
+ align-items: center;
112
+ gap: var(--spacing-s);
113
+ border: none;
114
+ outline: none;
115
+ border-radius: var(--spacing-xs);
116
+ font-size: var(--ui3n-button-text-size);
117
+ font-weight: 600;
118
+ line-height: calc(var(--ui3n-button-text-size) * 1.25);
119
+ user-select: none;
120
+ }
121
+
122
+ .regular {
123
+ height: var(--spacing-l);
124
+ padding: 0 var(--spacing-m);
125
+
126
+ &.withIcon-left {
127
+ padding-left: var(--spacing-s);
128
+ }
129
+
130
+ &.withIcon-right {
131
+ padding-right: var(--spacing-s);
132
+ }
133
+ }
134
+
135
+ .small {
136
+ height: var(--spacing-ml);
137
+ padding: 0 var(--spacing-s);
138
+
139
+ &.withIcon-left {
140
+ padding-left: var(--spacing-xs);
141
+ }
142
+
143
+ &.withIcon-right {
144
+ padding-right: var(--spacing-xs);
145
+ }
146
+ }
147
+
148
+ .block {
149
+ width: 100%;
150
+ }
151
+
152
+ .primary {
153
+ background: var(--color-bg-button-primary-default);
154
+ color: var(--color-text-button-primary-default);
155
+
156
+ &:hover {
157
+ background: var(--color-bg-button-primary-hover);
158
+ color: var(--color-text-button-primary-hover);
159
+ @include ripple(var(--color-bg-button-primary-hover));
160
+ }
161
+
162
+ &[disabled] {
163
+ background: var(--color-bg-button-primary-disabled);
164
+ color: var(--color-text-button-primary-disabled);
165
+ pointer-events: none;
171
166
  }
167
+ }
168
+
169
+ .secondary {
170
+ background: var(--color-bg-button-secondary-default);
171
+ color: var(--color-text-button-secondary-default);
172
+
173
+ &:hover {
174
+ background: var(--color-bg-button-secondary-hover);
175
+ color: var(--color-text-button-secondary-hover);
176
+ @include ripple(var(--color-bg-button-secondary-hover));
177
+ }
178
+
179
+ &[disabled] {
180
+ background: var(--color-bg-button-secondary-disabled);
181
+ color: var(--color-text-button-secondary-disabled);
182
+ pointer-events: none;
183
+ }
184
+ }
185
+
186
+ .tertiary {
187
+ background: transparent;
188
+ color: var(--color-text-button-secondary-default);
189
+ padding: 0;
190
+
191
+ &:hover {
192
+ background: transparent;
193
+ color: var(--color-text-button-secondary-hover);
194
+ text-decoration: underline;
195
+ cursor: pointer;
196
+ }
197
+
198
+ &[disabled] {
199
+ background: transparent;
200
+ color: var(--color-text-button-secondary-disabled);
201
+ pointer-events: none;
202
+ }
203
+ }
204
+
205
+ .icon {
206
+ --ui3n-button-icon-bg-color: hsl(from var(--ui3n-button-bg-color-custom) h s calc(l - 10));
207
+
208
+ background: var(--ui3n-button-bg-color-custom);
209
+ color: var(--ui3n-button-text-color-custom);
210
+ border-radius: 50%;
211
+
212
+ &.regular {
213
+ min-width: var(--spacing-l);
214
+ width: var(--spacing-l);
215
+ padding: 0;
216
+ }
217
+
218
+ &.small {
219
+ min-width: var(--spacing-ml);
220
+ width: var(--spacing-ml);
221
+ padding: 0;
222
+ }
223
+
224
+ &:hover {
225
+ background: var(--ui3n-button-icon-bg-color);
226
+ @include ripple(var(--ui3n-button-icon-bg-color));
227
+ }
228
+
229
+ &[disabled] {
230
+ opacity: 0.7;
231
+ pointer-events: none;
232
+ }
233
+ }
234
+
235
+ .custom {
236
+ --ui3n-button-custom-bg-color: hsl(from var(--ui3n-button-bg-color-custom) h s calc(l - 10));
237
+
238
+ background: var(--ui3n-button-bg-color-custom);
239
+ color: var(--ui3n-button-text-color-custom);
240
+
241
+ &:hover {
242
+ background: var(--ui3n-button-custom-bg-color);
243
+ @include ripple(var(--ui3n-button-custom-bg-color));
244
+ }
245
+
246
+ &[disabled] {
247
+ opacity: 0.7;
248
+ pointer-events: none;
249
+ }
250
+ }
251
+
252
+ .withIcon-left {
253
+ flex-direction: row;
254
+ }
255
+
256
+ .withIcon-right {
257
+ flex-direction: row-reverse;
258
+ }
259
+
260
+ .buttonIcon,
261
+ .text {
262
+ pointer-events: none;
263
+ }
264
+
265
+ .elevation {
266
+ @include elevation();
267
+ }
172
268
  </style>