@uzum-tech/ui 2.1.3 → 2.2.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 (111) hide show
  1. package/dist/index.js +1236 -530
  2. package/dist/index.mjs +1232 -531
  3. package/dist/index.prod.js +2 -2
  4. package/dist/index.prod.mjs +2 -2
  5. package/es/_internal/icon/index.d.ts +1 -1
  6. package/es/_internal/icon/index.mjs +1 -1
  7. package/es/_internal/icon/src/UIcon.d.ts +11 -1
  8. package/es/_internal/icon/src/UIcon.mjs +20 -8
  9. package/es/_internal/icon/src/interface.d.ts +11 -4
  10. package/es/_internal/icon/src/interface.mjs +4 -0
  11. package/es/_internal/icon/src/render-icon.d.ts +1 -0
  12. package/es/_internal/icon/src/render-icon.mjs +5 -0
  13. package/es/_internal/icons/SearchOutline.d.ts +2 -0
  14. package/es/_internal/icons/SearchOutline.mjs +18 -0
  15. package/es/_internal/icons/index.d.ts +1 -0
  16. package/es/_internal/icons/index.mjs +1 -0
  17. package/es/_mixins/use-form-item.mjs +5 -0
  18. package/es/_utils/dom/copy-to-clipboard.d.ts +1 -0
  19. package/es/_utils/dom/copy-to-clipboard.mjs +8 -0
  20. package/es/_utils/dom/index.d.ts +1 -0
  21. package/es/_utils/dom/index.mjs +1 -0
  22. package/es/components.d.ts +1169 -76
  23. package/es/components.mjs +4 -1
  24. package/es/config-provider/src/internal-interface.d.ts +4 -0
  25. package/es/data-table/src/use-table-data.d.ts +1 -1
  26. package/es/date-picker/src/DatePicker.mjs +7 -4
  27. package/es/icon/index.d.ts +1 -1
  28. package/es/icon/index.mjs +1 -1
  29. package/es/icon/src/Icon.d.ts +1 -1
  30. package/es/icon/src/Icon.mjs +1 -1
  31. package/es/icon-pack/index.d.ts +5 -0
  32. package/es/icon-pack/index.mjs +3 -0
  33. package/es/icon-pack/src/IconPack.d.ts +1047 -0
  34. package/es/icon-pack/src/IconPack.mjs +300 -0
  35. package/es/icon-pack/src/interface.d.ts +465 -0
  36. package/es/icon-pack/src/interface.mjs +75 -0
  37. package/es/icon-pack/src/styles/index.cssr.d.ts +2 -0
  38. package/es/icon-pack/src/styles/index.cssr.mjs +131 -0
  39. package/es/icon-pack/styles/dark.d.ts +123 -0
  40. package/es/icon-pack/styles/dark.mjs +20 -0
  41. package/es/icon-pack/styles/index.d.ts +3 -0
  42. package/es/icon-pack/styles/index.mjs +2 -0
  43. package/es/icon-pack/styles/light.d.ts +143 -0
  44. package/es/icon-pack/styles/light.mjs +64 -0
  45. package/es/icon-wrapper/src/IconWrapper.d.ts +1 -1
  46. package/es/input/src/Input.mjs +3 -1
  47. package/es/pagination/index.d.ts +3 -3
  48. package/es/pagination/index.mjs +2 -1
  49. package/es/pagination/src/Pagination.d.ts +74 -1379
  50. package/es/pagination/src/Pagination.mjs +28 -63
  51. package/es/pagination/src/interface.d.ts +1345 -1
  52. package/es/pagination/src/interface.mjs +68 -1
  53. package/es/themes/dark.mjs +2 -0
  54. package/es/themes/light.mjs +2 -0
  55. package/es/version.d.ts +1 -1
  56. package/es/version.mjs +1 -1
  57. package/lib/_internal/icon/index.d.ts +1 -1
  58. package/lib/_internal/icon/index.js +2 -1
  59. package/lib/_internal/icon/src/UIcon.d.ts +11 -1
  60. package/lib/_internal/icon/src/UIcon.js +17 -6
  61. package/lib/_internal/icon/src/interface.d.ts +11 -4
  62. package/lib/_internal/icon/src/interface.js +1 -1
  63. package/lib/_internal/icon/src/render-icon.d.ts +1 -0
  64. package/lib/_internal/icon/src/render-icon.js +4 -0
  65. package/lib/_internal/icons/SearchOutline.d.ts +2 -0
  66. package/lib/_internal/icons/SearchOutline.js +10 -0
  67. package/lib/_internal/icons/index.d.ts +1 -0
  68. package/lib/_internal/icons/index.js +3 -1
  69. package/lib/_mixins/use-form-item.js +5 -0
  70. package/lib/_utils/dom/copy-to-clipboard.d.ts +1 -0
  71. package/lib/_utils/dom/copy-to-clipboard.js +11 -0
  72. package/lib/_utils/dom/index.d.ts +1 -0
  73. package/lib/_utils/dom/index.js +3 -1
  74. package/lib/components.d.ts +1169 -76
  75. package/lib/components.js +12 -5
  76. package/lib/config-provider/src/internal-interface.d.ts +4 -0
  77. package/lib/data-table/src/use-table-data.d.ts +1 -1
  78. package/lib/date-picker/src/DatePicker.js +5 -4
  79. package/lib/icon/index.d.ts +1 -1
  80. package/lib/icon/index.js +2 -1
  81. package/lib/icon/src/Icon.d.ts +1 -1
  82. package/lib/icon/src/Icon.js +2 -1
  83. package/lib/icon-pack/index.d.ts +5 -0
  84. package/lib/icon-pack/index.js +13 -0
  85. package/lib/icon-pack/src/IconPack.d.ts +1047 -0
  86. package/lib/icon-pack/src/IconPack.js +240 -0
  87. package/lib/icon-pack/src/interface.d.ts +465 -0
  88. package/lib/icon-pack/src/interface.js +49 -0
  89. package/lib/icon-pack/src/styles/index.cssr.d.ts +2 -0
  90. package/lib/icon-pack/src/styles/index.cssr.js +136 -0
  91. package/lib/icon-pack/styles/dark.d.ts +123 -0
  92. package/lib/icon-pack/styles/dark.js +22 -0
  93. package/lib/icon-pack/styles/index.d.ts +3 -0
  94. package/lib/icon-pack/styles/index.js +10 -0
  95. package/lib/icon-pack/styles/light.d.ts +143 -0
  96. package/lib/icon-pack/styles/light.js +46 -0
  97. package/lib/icon-wrapper/src/IconWrapper.d.ts +1 -1
  98. package/lib/input/src/Input.js +3 -1
  99. package/lib/pagination/index.d.ts +3 -3
  100. package/lib/pagination/index.js +2 -1
  101. package/lib/pagination/src/Pagination.d.ts +74 -1379
  102. package/lib/pagination/src/Pagination.js +27 -40
  103. package/lib/pagination/src/interface.d.ts +1345 -1
  104. package/lib/pagination/src/interface.js +37 -0
  105. package/lib/themes/dark.js +110 -108
  106. package/lib/themes/light.js +110 -108
  107. package/lib/version.d.ts +1 -1
  108. package/lib/version.js +1 -1
  109. package/package.json +1 -1
  110. package/volar.d.ts +1 -0
  111. package/web-types.json +263 -1
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const vue_1 = require("vue");
7
+ const icons_1 = require("../../_internal/icons");
8
+ const _mixins_1 = require("../../_mixins");
9
+ const _utils_1 = require("../../_utils");
10
+ const debounce_1 = require("../../_utils/debounce");
11
+ const ellipsis_1 = require("../../ellipsis");
12
+ const empty_1 = require("../../empty");
13
+ const input_1 = require("../../input");
14
+ const scrollbar_1 = require("../../scrollbar");
15
+ const styles_1 = require("../styles");
16
+ const interface_1 = require("./interface");
17
+ const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
18
+ exports.default = (0, vue_1.defineComponent)({
19
+ name: 'IconPack',
20
+ props: interface_1.iconPackProps,
21
+ emits: ['update:value', 'update:searchValue', 'select', 'copy', 'search'],
22
+ setup(props, { emit }) {
23
+ const { mergedClsPrefixRef, mergedIconPacksRef } = (0, _mixins_1.useConfig)(props);
24
+ const themeRef = (0, _mixins_1.useTheme)('IconPack', '-icon-pack', index_cssr_1.default, styles_1.iconPackLight, props, mergedClsPrefixRef);
25
+ const formItem = (0, _mixins_1.useFormItem)(props);
26
+ const { mergedDisabledRef } = formItem;
27
+ (0, vue_1.provide)(interface_1.iconPackInjectionKey, {
28
+ mergedClsPrefixRef
29
+ });
30
+ const uncontrolledValueRef = (0, vue_1.ref)(props.defaultValue);
31
+ const mergedValueRef = (0, vue_1.computed)(() => props.value !== undefined ? props.value : uncontrolledValueRef.value);
32
+ const uncontrolledSearchRef = (0, vue_1.ref)(props.defaultSearchValue);
33
+ const mergedSearchRef = (0, vue_1.computed)(() => props.searchValue !== undefined
34
+ ? props.searchValue
35
+ : uncontrolledSearchRef.value);
36
+ const mergedPackRef = (0, vue_1.computed)(() => {
37
+ const { pack } = props;
38
+ if (pack && typeof pack === 'object')
39
+ return pack;
40
+ const config = mergedIconPacksRef === null || mergedIconPacksRef === void 0 ? void 0 : mergedIconPacksRef.value;
41
+ if (!config)
42
+ return undefined;
43
+ const name = typeof pack === 'string' ? pack : config.defaultPackName;
44
+ return config.packs.find(p => p.name === name);
45
+ });
46
+ function renderIconVNode(name) {
47
+ const pack = mergedPackRef.value;
48
+ if (!pack)
49
+ return null;
50
+ if (props.async === true && typeof pack.renderAsyncIcon === 'function')
51
+ return pack.renderAsyncIcon(name);
52
+ if (typeof pack.renderIcon === 'function')
53
+ return pack.renderIcon(name);
54
+ if (typeof pack.renderAsyncIcon === 'function')
55
+ return pack.renderAsyncIcon(name);
56
+ return null;
57
+ }
58
+ const allIconsRef = (0, vue_1.computed)(() => {
59
+ const pack = mergedPackRef.value;
60
+ if (!pack)
61
+ return [];
62
+ const format = props.formatIconLabel;
63
+ return pack.iconNames.map((name) => {
64
+ const slashIndex = name.indexOf('/');
65
+ const group = slashIndex === -1 ? '' : name.slice(0, slashIndex);
66
+ const defaultLabel = slashIndex === -1 ? name : name.slice(slashIndex + 1);
67
+ return {
68
+ name,
69
+ group,
70
+ label: format ? format(name, group) : defaultLabel,
71
+ render: () => renderIconVNode(name)
72
+ };
73
+ });
74
+ });
75
+ const searchIndexRef = (0, vue_1.computed)(() => allIconsRef.value.map(icon => `${icon.name}\n${icon.label}`.toLowerCase()));
76
+ const debouncedQueryRef = (0, vue_1.ref)(mergedSearchRef.value.trim().toLowerCase());
77
+ const applyQuery = (value) => {
78
+ debouncedQueryRef.value = value.trim().toLowerCase();
79
+ };
80
+ const applyQueryDebounced = (0, debounce_1.debounce)(applyQuery, props.searchDebounce);
81
+ (0, vue_1.watch)(mergedSearchRef, (value) => {
82
+ if (props.searchDebounce <= 0)
83
+ applyQuery(value);
84
+ else
85
+ applyQueryDebounced(value);
86
+ });
87
+ const filteredIconsRef = (0, vue_1.computed)(() => {
88
+ const query = debouncedQueryRef.value;
89
+ const icons = allIconsRef.value;
90
+ if (!query)
91
+ return icons;
92
+ const searchIndex = searchIndexRef.value;
93
+ const result = [];
94
+ for (let index = 0; index < icons.length; index++) {
95
+ if (searchIndex[index].includes(query))
96
+ result.push(icons[index]);
97
+ }
98
+ return result;
99
+ });
100
+ const groupsRef = (0, vue_1.computed)(() => {
101
+ const icons = filteredIconsRef.value;
102
+ if (!props.grouped)
103
+ return [{ key: '', label: '', icons }];
104
+ const map = new Map();
105
+ for (const icon of icons) {
106
+ const existing = map.get(icon.group);
107
+ if (existing)
108
+ existing.push(icon);
109
+ else
110
+ map.set(icon.group, [icon]);
111
+ }
112
+ const format = props.formatGroupLabel;
113
+ return Array.from(map, ([key, groupIcons]) => ({
114
+ key,
115
+ label: format ? format(key) : key,
116
+ icons: groupIcons
117
+ }));
118
+ });
119
+ const isEmptyRef = (0, vue_1.computed)(() => filteredIconsRef.value.length === 0);
120
+ function handleSearch(value) {
121
+ if (props.searchValue === undefined)
122
+ uncontrolledSearchRef.value = value;
123
+ emit('update:searchValue', value);
124
+ emit('search', value);
125
+ }
126
+ function handleSelect(icon) {
127
+ if (mergedDisabledRef.value)
128
+ return;
129
+ if (props.value === undefined)
130
+ uncontrolledValueRef.value = icon.name;
131
+ emit('update:value', icon.name);
132
+ emit('select', icon.name, icon);
133
+ formItem.triggerFormInput();
134
+ formItem.triggerFormChange();
135
+ if (props.copyable) {
136
+ const text = props.formatCopy
137
+ ? props.formatCopy(icon.name, icon)
138
+ : icon.name;
139
+ void (0, _utils_1.copyToClipboard)(text).catch(() => { });
140
+ emit('copy', text, icon);
141
+ }
142
+ }
143
+ const cssVarsRef = (0, vue_1.computed)(() => {
144
+ const { common: { cubicBezierEaseInOut }, self: { containerColor, borderRadius, titleTextColor, descriptionTextColor, groupTitleTextColor, groupCounterTextColor, cardColor, cardColorHover, cardColorPressed, cardColorSelected, cardBorderRadius, cardIconColor, cardIconColorSelected, cardLabelTextColor, cardLabelTextColorSelected, dividerColor } } = themeRef.value;
145
+ const { columns } = props;
146
+ const gridTemplateColumns = columns === undefined || columns === null || columns === 'auto'
147
+ ? `repeat(auto-fill, minmax(${(0, _utils_1.formatLength)(props.minColumnWidth)}, 1fr))`
148
+ : `repeat(${columns}, minmax(0, 1fr))`;
149
+ return {
150
+ '--u-bezier': cubicBezierEaseInOut,
151
+ '--u-icon-pack-container-color': containerColor,
152
+ '--u-icon-pack-border-radius': borderRadius,
153
+ '--u-icon-pack-title-text-color': titleTextColor,
154
+ '--u-icon-pack-description-text-color': descriptionTextColor,
155
+ '--u-icon-pack-group-title-text-color': groupTitleTextColor,
156
+ '--u-icon-pack-group-counter-text-color': groupCounterTextColor,
157
+ '--u-icon-pack-card-color': cardColor,
158
+ '--u-icon-pack-card-color-hover': cardColorHover,
159
+ '--u-icon-pack-card-color-pressed': cardColorPressed,
160
+ '--u-icon-pack-card-color-selected': cardColorSelected,
161
+ '--u-icon-pack-card-border-radius': cardBorderRadius,
162
+ '--u-icon-pack-card-icon-color': cardIconColor,
163
+ '--u-icon-pack-card-icon-color-selected': cardIconColorSelected,
164
+ '--u-icon-pack-card-label-text-color': cardLabelTextColor,
165
+ '--u-icon-pack-card-label-text-color-selected': cardLabelTextColorSelected,
166
+ '--u-icon-pack-divider-color': dividerColor,
167
+ '--u-icon-pack-grid-template-columns': gridTemplateColumns,
168
+ '--u-icon-pack-icon-size': (0, _utils_1.formatLength)(props.iconSize),
169
+ '--u-icon-pack-content-padding': (0, _utils_1.formatLength)(props.contentPadding)
170
+ };
171
+ });
172
+ const themeClassHandle = (0, _mixins_1.useThemeClass)('icon-pack', (0, vue_1.computed)(() => ''), cssVarsRef, props);
173
+ return {
174
+ mergedClsPrefix: mergedClsPrefixRef,
175
+ mergedTheme: themeRef,
176
+ cssVars: cssVarsRef,
177
+ themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
178
+ onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender,
179
+ mergedValue: mergedValueRef,
180
+ mergedSearch: mergedSearchRef,
181
+ mergedDisabled: mergedDisabledRef,
182
+ groups: groupsRef,
183
+ isEmpty: isEmptyRef,
184
+ handleSearch,
185
+ handleSelect
186
+ };
187
+ },
188
+ render() {
189
+ var _a;
190
+ const { mergedClsPrefix: cls, $slots, title, description, searchable, grouped, showGroupCounter, searchPlaceholder, searchInputProps, scrollbarProps, emptyText, emptyProps, height, maxBodyHeight, mergedDisabled } = this;
191
+ (_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
192
+ const showHeader = !!(title || description)
193
+ || !!$slots.header
194
+ || !!$slots.title
195
+ || !!$slots.description;
196
+ const hasFixedHeight = height !== undefined && height !== null;
197
+ const bodyStyle = hasFixedHeight
198
+ ? { flex: '1 1 auto', minHeight: 0 }
199
+ : { maxHeight: (0, _utils_1.formatLength)(maxBodyHeight) };
200
+ const renderCard = (icon) => {
201
+ const selected = this.mergedValue === icon.name;
202
+ return ((0, vue_1.h)("div", { key: icon.name, class: [
203
+ `${cls}-icon-pack-card`,
204
+ selected && `${cls}-icon-pack-card--selected`
205
+ ], role: "button", tabindex: mergedDisabled ? -1 : 0, "aria-pressed": selected, "aria-disabled": mergedDisabled, onClick: () => this.handleSelect(icon), onKeydown: (e) => {
206
+ if (e.key === 'Enter' || e.key === ' ') {
207
+ e.preventDefault();
208
+ this.handleSelect(icon);
209
+ }
210
+ } },
211
+ (0, vue_1.h)("div", { class: `${cls}-icon-pack-card__icon` }, icon.render()),
212
+ (0, vue_1.h)(ellipsis_1.UPerformantEllipsis, { class: `${cls}-icon-pack-card__label`, lineClamp: 1 }, { default: () => icon.label })));
213
+ };
214
+ return ((0, vue_1.h)("div", { class: [
215
+ `${cls}-icon-pack`,
216
+ this.themeClass,
217
+ mergedDisabled && `${cls}-icon-pack--disabled`
218
+ ], style: Object.assign(Object.assign({}, this.cssVars), (hasFixedHeight ? { height: (0, _utils_1.formatLength)(height) } : {})) },
219
+ showHeader && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__header` },
220
+ (0, vue_1.h)("div", { class: `${cls}-icon-pack__header-main` }, (0, _utils_1.resolveSlot)($slots.header, () => [
221
+ (title || $slots.title) && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__title` }, $slots.title ? $slots.title() : title)),
222
+ (description || $slots.description) && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__description` }, $slots.description ? $slots.description() : description))
223
+ ])))),
224
+ searchable && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__search` },
225
+ (0, vue_1.h)(input_1.UInput, Object.assign({ value: this.mergedSearch, clearable: true, disabled: mergedDisabled, placeholder: searchPlaceholder, onUpdateValue: this.handleSearch }, searchInputProps), { prefix: () => (0, vue_1.h)(icons_1.SearchOutlineIcon) }))),
226
+ (0, vue_1.h)(scrollbar_1.UScrollbar, Object.assign({ class: `${cls}-icon-pack__body`, style: bodyStyle }, scrollbarProps), {
227
+ default: () => this.isEmpty ? ((0, vue_1.h)("div", { class: `${cls}-icon-pack__empty` }, (0, _utils_1.resolveSlot)($slots.empty, () => [
228
+ (0, vue_1.h)(empty_1.UEmpty, Object.assign({}, emptyProps, { size: "large", description: emptyText, theme: this.mergedTheme.peers.Empty, themeOverrides: this.mergedTheme.peerOverrides.Empty }))
229
+ ]))) : ((0, vue_1.h)("div", { class: `${cls}-icon-pack__groups` }, this.groups.map(group => ((0, vue_1.h)("div", { key: group.key, class: `${cls}-icon-pack__group` },
230
+ grouped && group.key !== '' && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__group-header` },
231
+ (0, vue_1.h)("div", { class: `${cls}-icon-pack__group-title` }, group.label),
232
+ showGroupCounter && ((0, vue_1.h)("span", { class: `${cls}-icon-pack__group-counter` },
233
+ "(",
234
+ group.icons.length,
235
+ ")")))),
236
+ (0, vue_1.h)("div", { class: `${cls}-icon-pack__grid` }, group.icons.map(renderCard)))))))
237
+ }),
238
+ $slots.footer && ((0, vue_1.h)("div", { class: `${cls}-icon-pack__footer` }, $slots.footer()))));
239
+ }
240
+ });