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