@uzum-tech/ui 2.3.7 → 3.0.0-alpha.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 (83) hide show
  1. package/dist/index.js +811 -215
  2. package/dist/index.mjs +807 -216
  3. package/dist/index.prod.js +3 -3
  4. package/dist/index.prod.mjs +3 -3
  5. package/es/_internal/button-v3/index.d.ts +5 -0
  6. package/es/_internal/button-v3/index.mjs +3 -0
  7. package/es/_internal/button-v3/src/ButtonV3.d.ts +533 -0
  8. package/es/_internal/button-v3/src/ButtonV3.mjs +200 -0
  9. package/es/_internal/button-v3/src/interface.d.ts +281 -0
  10. package/es/_internal/button-v3/src/interface.mjs +29 -0
  11. package/es/_internal/button-v3/src/styles/index.cssr.d.ts +2 -0
  12. package/es/_internal/button-v3/src/styles/index.cssr.mjs +119 -0
  13. package/es/_internal/button-v3/src/utils.d.ts +10 -0
  14. package/es/_internal/button-v3/src/utils.mjs +52 -0
  15. package/es/_internal/button-v3/styles/_common.d.ts +19 -0
  16. package/es/_internal/button-v3/styles/_common.mjs +18 -0
  17. package/es/_internal/button-v3/styles/dark.d.ts +3 -0
  18. package/es/_internal/button-v3/styles/dark.mjs +8 -0
  19. package/es/_internal/button-v3/styles/index.d.ts +3 -0
  20. package/es/_internal/button-v3/styles/index.mjs +2 -0
  21. package/es/_internal/button-v3/styles/light.d.ts +81 -0
  22. package/es/_internal/button-v3/styles/light.mjs +91 -0
  23. package/es/_internal/index.d.ts +2 -0
  24. package/es/_internal/index.mjs +1 -0
  25. package/es/_styles/common/dark.mjs +12 -0
  26. package/es/_styles/common/light.d.ts +12 -0
  27. package/es/_styles/common/light.mjs +12 -0
  28. package/es/button-v3/index.d.ts +4 -0
  29. package/es/button-v3/index.mjs +2 -0
  30. package/es/button-v3/src/ButtonV3.d.ts +525 -0
  31. package/es/button-v3/src/ButtonV3.mjs +17 -0
  32. package/es/components.d.ts +524 -2
  33. package/es/components.mjs +185 -180
  34. package/es/config-provider/src/internal-interface.d.ts +4 -0
  35. package/es/dialog/src/DialogProvider.d.ts +48 -0
  36. package/es/styles.d.ts +1 -0
  37. package/es/styles.mjs +1 -0
  38. package/es/theme-editor/src/ThemeEditor.d.ts +12 -0
  39. package/es/themes/dark.mjs +2 -0
  40. package/es/themes/light.mjs +2 -0
  41. package/es/version.d.ts +1 -1
  42. package/es/version.mjs +1 -1
  43. package/lib/_internal/button-v3/index.d.ts +5 -0
  44. package/lib/_internal/button-v3/index.js +13 -0
  45. package/lib/_internal/button-v3/src/ButtonV3.d.ts +533 -0
  46. package/lib/_internal/button-v3/src/ButtonV3.js +170 -0
  47. package/lib/_internal/button-v3/src/interface.d.ts +281 -0
  48. package/lib/_internal/button-v3/src/interface.js +20 -0
  49. package/lib/_internal/button-v3/src/styles/index.cssr.d.ts +2 -0
  50. package/lib/_internal/button-v3/src/styles/index.cssr.js +124 -0
  51. package/lib/_internal/button-v3/src/utils.d.ts +10 -0
  52. package/lib/_internal/button-v3/src/utils.js +56 -0
  53. package/lib/_internal/button-v3/styles/_common.d.ts +19 -0
  54. package/lib/_internal/button-v3/styles/_common.js +20 -0
  55. package/lib/_internal/button-v3/styles/dark.d.ts +3 -0
  56. package/lib/_internal/button-v3/styles/dark.js +10 -0
  57. package/lib/_internal/button-v3/styles/index.d.ts +3 -0
  58. package/lib/_internal/button-v3/styles/index.js +10 -0
  59. package/lib/_internal/button-v3/styles/light.d.ts +81 -0
  60. package/lib/_internal/button-v3/styles/light.js +19 -0
  61. package/lib/_internal/index.d.ts +2 -0
  62. package/lib/_internal/index.js +4 -1
  63. package/lib/_styles/common/dark.js +1 -1
  64. package/lib/_styles/common/light.d.ts +12 -0
  65. package/lib/_styles/common/light.js +1 -1
  66. package/lib/button-v3/index.d.ts +4 -0
  67. package/lib/button-v3/index.js +13 -0
  68. package/lib/button-v3/src/ButtonV3.d.ts +525 -0
  69. package/lib/button-v3/src/ButtonV3.js +17 -0
  70. package/lib/components.d.ts +524 -2
  71. package/lib/components.js +16 -8
  72. package/lib/config-provider/src/internal-interface.d.ts +4 -0
  73. package/lib/dialog/src/DialogProvider.d.ts +48 -0
  74. package/lib/styles.d.ts +1 -0
  75. package/lib/styles.js +195 -193
  76. package/lib/theme-editor/src/ThemeEditor.d.ts +12 -0
  77. package/lib/themes/dark.js +202 -200
  78. package/lib/themes/light.js +202 -200
  79. package/lib/version.d.ts +1 -1
  80. package/lib/version.js +1 -1
  81. package/package.json +1 -1
  82. package/volar.d.ts +2 -0
  83. package/web-types.json +14 -1
@@ -0,0 +1,170 @@
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
+ exports.XButtonV3 = void 0;
7
+ const vue_1 = require("vue");
8
+ const _mixins_1 = require("../../../_mixins");
9
+ const _utils_1 = require("../../../_utils");
10
+ const styles_1 = require("../styles");
11
+ const interface_1 = require("./interface");
12
+ const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
13
+ const utils_1 = require("./utils");
14
+ const ButtonV3 = (0, vue_1.defineComponent)({
15
+ name: 'ButtonV3',
16
+ props: interface_1.buttonV3Props,
17
+ slots: Object,
18
+ setup(props, { attrs }) {
19
+ if (process.env.NODE_ENV !== 'production') {
20
+ (0, vue_1.watchEffect)(() => {
21
+ if (props.type === 'secondary' && props.tone === 'negative') {
22
+ (0, _utils_1.warnOnce)('button-v3', 'У типа `secondary` нет тона `negative` — используется тон `default`.');
23
+ }
24
+ if (props.iconOnly
25
+ && !attrs['aria-label']
26
+ && !attrs['aria-labelledby']
27
+ && !attrs.title) {
28
+ (0, _utils_1.warnOnce)('button-v3', 'Кнопке с `icon-only` нужен `aria-label` (или `title`) — иначе действие непонятно.');
29
+ }
30
+ });
31
+ }
32
+ const selfElRef = (0, vue_1.ref)(null);
33
+ const { inlineThemeDisabled, mergedClsPrefixRef } = (0, _mixins_1.useConfig)(props);
34
+ const themeRef = (0, _mixins_1.useTheme)('ButtonV3', '-button-v3', index_cssr_1.default, styles_1.buttonV3Light, props, mergedClsPrefixRef);
35
+ const { mergedSizeRef } = (0, _mixins_1.useFormItem)({}, {
36
+ defaultSize: 'medium',
37
+ mergedSize: (UFormItem) => {
38
+ const { size } = props;
39
+ if (size)
40
+ return size;
41
+ const { mergedSize: formItemSize } = UFormItem || {};
42
+ if (formItemSize)
43
+ return formItemSize.value;
44
+ return 'medium';
45
+ }
46
+ });
47
+ const variantKeyRef = (0, vue_1.computed)(() => (0, utils_1.resolveVariantKey)(props.type, props.tone));
48
+ const mergedDisabledRef = (0, vue_1.computed)(() => props.disabled);
49
+ const inertRef = (0, vue_1.computed)(() => props.disabled || props.loading);
50
+ const mergedFocusableRef = (0, vue_1.computed)(() => props.focusable && !props.disabled);
51
+ const spinnerStrokeWidthRef = (0, vue_1.computed)(() => {
52
+ const { self } = themeRef.value;
53
+ return (0, utils_1.resolveSpinnerStrokeWidth)(self[(0, _utils_1.createKey)('iconSize', mergedSizeRef.value)], self.spinnerStrokeWidth);
54
+ });
55
+ const handleClick = (e) => {
56
+ if (inertRef.value) {
57
+ e.preventDefault();
58
+ e.stopPropagation();
59
+ return;
60
+ }
61
+ const { onClick } = props;
62
+ if (onClick)
63
+ (0, _utils_1.call)(onClick, e);
64
+ };
65
+ const cssVarsRef = (0, vue_1.computed)(() => {
66
+ const { common: { cubicBezierEaseInOut }, self } = themeRef.value;
67
+ const { fontFamily, fontSize, lineHeight, fontWeight, letterSpacing, iconMargin, borderWidth, focusRingWidth, focusRingColor, pressedOverlayColor, textColorDisabled } = self;
68
+ const size = mergedSizeRef.value;
69
+ const variant = (0, utils_1.upperFirst)(variantKeyRef.value);
70
+ const colors = self;
71
+ return {
72
+ '--u-bezier': cubicBezierEaseInOut,
73
+ '--u-height': self[(0, _utils_1.createKey)('height', size)],
74
+ '--u-padding': self[(0, _utils_1.createKey)('padding', size)],
75
+ '--u-border-radius': self[(0, _utils_1.createKey)('borderRadius', size)],
76
+ '--u-icon-size': self[(0, _utils_1.createKey)('iconSize', size)],
77
+ '--u-icon-margin': iconMargin,
78
+ '--u-font-family': fontFamily,
79
+ '--u-font-size': fontSize,
80
+ '--u-line-height': lineHeight,
81
+ '--u-font-weight': fontWeight,
82
+ '--u-letter-spacing': letterSpacing,
83
+ '--u-border-width': borderWidth,
84
+ '--u-focus-ring-width': focusRingWidth,
85
+ '--u-focus-ring-color': focusRingColor,
86
+ '--u-pressed-overlay-color': pressedOverlayColor,
87
+ '--u-color': colors[`color${variant}`],
88
+ '--u-color-hover': colors[`color${variant}Hover`],
89
+ '--u-color-disabled': colors[`color${variant}Disabled`],
90
+ '--u-text-color': colors[`textColor${variant}`],
91
+ '--u-text-color-hover': colors[`textColor${variant}Hover`],
92
+ '--u-text-color-disabled': textColorDisabled,
93
+ '--u-border-color': colors[`borderColor${variant}`],
94
+ '--u-border-color-disabled': colors[`borderColor${variant}Disabled`]
95
+ };
96
+ });
97
+ const themeClassHashRef = (0, vue_1.computed)(() => `${variantKeyRef.value}-${mergedSizeRef.value}`);
98
+ const themeClassHandle = inlineThemeDisabled
99
+ ? (0, _mixins_1.useThemeClass)('button-v3', themeClassHashRef, cssVarsRef, props)
100
+ : undefined;
101
+ return {
102
+ selfElRef,
103
+ mergedClsPrefix: mergedClsPrefixRef,
104
+ mergedSize: mergedSizeRef,
105
+ mergedDisabled: mergedDisabledRef,
106
+ mergedFocusable: mergedFocusableRef,
107
+ inert: inertRef,
108
+ spinnerStrokeWidth: spinnerStrokeWidthRef,
109
+ handleClick,
110
+ cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
111
+ themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
112
+ onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
113
+ };
114
+ },
115
+ render() {
116
+ const { $slots, mergedClsPrefix: clsPrefix, tag: Component, iconOnly, loading, mergedDisabled, inert, spinnerStrokeWidth: strokeWidth, onRender } = this;
117
+ onRender === null || onRender === void 0 ? void 0 : onRender();
118
+ const iconStartSlot = $slots['icon-start'];
119
+ const iconEndSlot = $slots['icon-end'];
120
+ const hasIconStart = !!iconStartSlot;
121
+ const hasIconEnd = !!iconEndSlot;
122
+ const centeredSpinner = loading && !iconOnly && !hasIconStart && !hasIconEnd;
123
+ const children = [];
124
+ if (iconOnly) {
125
+ children.push((0, utils_1.renderIconSlot)({
126
+ clsPrefix,
127
+ slot: iconStartSlot || $slots.default,
128
+ showSpinner: loading,
129
+ strokeWidth,
130
+ key: 'icon'
131
+ }));
132
+ }
133
+ else {
134
+ children.push((0, utils_1.renderIconSlot)({
135
+ clsPrefix,
136
+ slot: iconStartSlot,
137
+ showSpinner: loading && hasIconStart,
138
+ strokeWidth,
139
+ key: 'icon-start'
140
+ }));
141
+ if ($slots.default) {
142
+ children.push((0, vue_1.h)("span", { class: `${clsPrefix}-button-v3__label` }, $slots.default()));
143
+ }
144
+ children.push((0, utils_1.renderIconSlot)({
145
+ clsPrefix,
146
+ slot: iconEndSlot,
147
+ showSpinner: loading && !hasIconStart && hasIconEnd,
148
+ strokeWidth,
149
+ key: 'icon-end'
150
+ }));
151
+ if (centeredSpinner) {
152
+ children.push((0, vue_1.h)("span", { class: `${clsPrefix}-button-v3__spinner` }, (0, utils_1.renderSpinner)(clsPrefix, strokeWidth)));
153
+ }
154
+ }
155
+ return ((0, vue_1.h)(Component, { ref: "selfElRef", class: [
156
+ `${clsPrefix}-button-v3`,
157
+ this.themeClass,
158
+ `${clsPrefix}-button-v3--${this.type}-type`,
159
+ `${clsPrefix}-button-v3--${this.tone}-tone`,
160
+ `${clsPrefix}-button-v3--${this.mergedSize}-size`,
161
+ iconOnly && `${clsPrefix}-button-v3--icon-only`,
162
+ this.block && `${clsPrefix}-button-v3--block`,
163
+ mergedDisabled && `${clsPrefix}-button-v3--disabled`,
164
+ loading && `${clsPrefix}-button-v3--loading`,
165
+ centeredSpinner && `${clsPrefix}-button-v3--loading-text-only`
166
+ ], style: this.cssVars, type: Component === 'button' ? this.attrType : undefined, disabled: Component === 'button' ? mergedDisabled : undefined, tabindex: this.mergedFocusable ? 0 : -1, "aria-disabled": inert ? 'true' : undefined, "aria-busy": loading ? 'true' : undefined, onClick: this.handleClick }, children));
167
+ }
168
+ });
169
+ exports.default = ButtonV3;
170
+ exports.XButtonV3 = ButtonV3;
@@ -0,0 +1,281 @@
1
+ import type { ButtonHTMLAttributes, ExtractPropTypes, PropType, VNode } from 'vue';
2
+ import type { ExtractPublicPropTypes, MaybeArray } from '../../../_utils';
3
+ export declare const buttonV3Props: {
4
+ readonly type: {
5
+ readonly type: PropType<ButtonV3Type>;
6
+ readonly default: "primary";
7
+ };
8
+ readonly tone: {
9
+ readonly type: PropType<ButtonV3Tone>;
10
+ readonly default: "default";
11
+ };
12
+ readonly size: PropType<ButtonV3Size>;
13
+ readonly iconOnly: BooleanConstructor;
14
+ readonly block: BooleanConstructor;
15
+ readonly disabled: BooleanConstructor;
16
+ readonly loading: BooleanConstructor;
17
+ readonly focusable: {
18
+ readonly type: BooleanConstructor;
19
+ readonly default: true;
20
+ };
21
+ readonly tag: {
22
+ readonly type: PropType<ButtonV3Tag>;
23
+ readonly default: "button";
24
+ };
25
+ readonly attrType: {
26
+ readonly type: PropType<ButtonV3AttrType>;
27
+ readonly default: "button";
28
+ };
29
+ readonly onClick: PropType<ButtonV3ClickHandler>;
30
+ readonly theme: PropType<import("../../../_mixins").Theme<"ButtonV3", {
31
+ fontFamily: string;
32
+ fontSize: string;
33
+ lineHeight: string;
34
+ fontWeight: string;
35
+ letterSpacing: string;
36
+ pressedOverlayColor: string;
37
+ focusRingColor: string;
38
+ textColorDisabled: string;
39
+ colorPrimary: string;
40
+ colorPrimaryHover: string;
41
+ textColorPrimary: string;
42
+ textColorPrimaryHover: string;
43
+ borderColorPrimary: string;
44
+ colorPrimaryDisabled: string;
45
+ borderColorPrimaryDisabled: string;
46
+ colorPrimaryNegative: string;
47
+ colorPrimaryNegativeHover: string;
48
+ textColorPrimaryNegative: string;
49
+ textColorPrimaryNegativeHover: string;
50
+ borderColorPrimaryNegative: string;
51
+ colorPrimaryNegativeDisabled: string;
52
+ borderColorPrimaryNegativeDisabled: string;
53
+ colorSecondary: string;
54
+ colorSecondaryHover: string;
55
+ textColorSecondary: string;
56
+ textColorSecondaryHover: string;
57
+ borderColorSecondary: string;
58
+ colorSecondaryDisabled: string;
59
+ borderColorSecondaryDisabled: string;
60
+ colorTertiary: string;
61
+ colorTertiaryHover: string;
62
+ textColorTertiary: string;
63
+ textColorTertiaryHover: string;
64
+ borderColorTertiary: string;
65
+ colorTertiaryDisabled: string;
66
+ borderColorTertiaryDisabled: string;
67
+ colorTertiaryNegative: string;
68
+ colorTertiaryNegativeHover: string;
69
+ textColorTertiaryNegative: string;
70
+ textColorTertiaryNegativeHover: string;
71
+ borderColorTertiaryNegative: string;
72
+ colorTertiaryNegativeDisabled: string;
73
+ borderColorTertiaryNegativeDisabled: string;
74
+ colorGhost: string;
75
+ colorGhostHover: string;
76
+ textColorGhost: string;
77
+ textColorGhostHover: string;
78
+ borderColorGhost: string;
79
+ colorGhostDisabled: string;
80
+ borderColorGhostDisabled: string;
81
+ colorGhostNegative: string;
82
+ colorGhostNegativeHover: string;
83
+ textColorGhostNegative: string;
84
+ textColorGhostNegativeHover: string;
85
+ borderColorGhostNegative: string;
86
+ colorGhostNegativeDisabled: string;
87
+ borderColorGhostNegativeDisabled: string;
88
+ heightSmall: string;
89
+ heightMedium: string;
90
+ heightLarge: string;
91
+ paddingSmall: string;
92
+ paddingMedium: string;
93
+ paddingLarge: string;
94
+ borderRadiusSmall: string;
95
+ borderRadiusMedium: string;
96
+ borderRadiusLarge: string;
97
+ iconSizeSmall: string;
98
+ iconSizeMedium: string;
99
+ iconSizeLarge: string;
100
+ iconMargin: string;
101
+ borderWidth: string;
102
+ focusRingWidth: string;
103
+ spinnerStrokeWidth: string;
104
+ }, any>>;
105
+ readonly themeOverrides: PropType<import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"ButtonV3", {
106
+ fontFamily: string;
107
+ fontSize: string;
108
+ lineHeight: string;
109
+ fontWeight: string;
110
+ letterSpacing: string;
111
+ pressedOverlayColor: string;
112
+ focusRingColor: string;
113
+ textColorDisabled: string;
114
+ colorPrimary: string;
115
+ colorPrimaryHover: string;
116
+ textColorPrimary: string;
117
+ textColorPrimaryHover: string;
118
+ borderColorPrimary: string;
119
+ colorPrimaryDisabled: string;
120
+ borderColorPrimaryDisabled: string;
121
+ colorPrimaryNegative: string;
122
+ colorPrimaryNegativeHover: string;
123
+ textColorPrimaryNegative: string;
124
+ textColorPrimaryNegativeHover: string;
125
+ borderColorPrimaryNegative: string;
126
+ colorPrimaryNegativeDisabled: string;
127
+ borderColorPrimaryNegativeDisabled: string;
128
+ colorSecondary: string;
129
+ colorSecondaryHover: string;
130
+ textColorSecondary: string;
131
+ textColorSecondaryHover: string;
132
+ borderColorSecondary: string;
133
+ colorSecondaryDisabled: string;
134
+ borderColorSecondaryDisabled: string;
135
+ colorTertiary: string;
136
+ colorTertiaryHover: string;
137
+ textColorTertiary: string;
138
+ textColorTertiaryHover: string;
139
+ borderColorTertiary: string;
140
+ colorTertiaryDisabled: string;
141
+ borderColorTertiaryDisabled: string;
142
+ colorTertiaryNegative: string;
143
+ colorTertiaryNegativeHover: string;
144
+ textColorTertiaryNegative: string;
145
+ textColorTertiaryNegativeHover: string;
146
+ borderColorTertiaryNegative: string;
147
+ colorTertiaryNegativeDisabled: string;
148
+ borderColorTertiaryNegativeDisabled: string;
149
+ colorGhost: string;
150
+ colorGhostHover: string;
151
+ textColorGhost: string;
152
+ textColorGhostHover: string;
153
+ borderColorGhost: string;
154
+ colorGhostDisabled: string;
155
+ borderColorGhostDisabled: string;
156
+ colorGhostNegative: string;
157
+ colorGhostNegativeHover: string;
158
+ textColorGhostNegative: string;
159
+ textColorGhostNegativeHover: string;
160
+ borderColorGhostNegative: string;
161
+ colorGhostNegativeDisabled: string;
162
+ borderColorGhostNegativeDisabled: string;
163
+ heightSmall: string;
164
+ heightMedium: string;
165
+ heightLarge: string;
166
+ paddingSmall: string;
167
+ paddingMedium: string;
168
+ paddingLarge: string;
169
+ borderRadiusSmall: string;
170
+ borderRadiusMedium: string;
171
+ borderRadiusLarge: string;
172
+ iconSizeSmall: string;
173
+ iconSizeMedium: string;
174
+ iconSizeLarge: string;
175
+ iconMargin: string;
176
+ borderWidth: string;
177
+ focusRingWidth: string;
178
+ spinnerStrokeWidth: string;
179
+ }, any>>>;
180
+ readonly builtinThemeOverrides: PropType<import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"ButtonV3", {
181
+ fontFamily: string;
182
+ fontSize: string;
183
+ lineHeight: string;
184
+ fontWeight: string;
185
+ letterSpacing: string;
186
+ pressedOverlayColor: string;
187
+ focusRingColor: string;
188
+ textColorDisabled: string;
189
+ colorPrimary: string;
190
+ colorPrimaryHover: string;
191
+ textColorPrimary: string;
192
+ textColorPrimaryHover: string;
193
+ borderColorPrimary: string;
194
+ colorPrimaryDisabled: string;
195
+ borderColorPrimaryDisabled: string;
196
+ colorPrimaryNegative: string;
197
+ colorPrimaryNegativeHover: string;
198
+ textColorPrimaryNegative: string;
199
+ textColorPrimaryNegativeHover: string;
200
+ borderColorPrimaryNegative: string;
201
+ colorPrimaryNegativeDisabled: string;
202
+ borderColorPrimaryNegativeDisabled: string;
203
+ colorSecondary: string;
204
+ colorSecondaryHover: string;
205
+ textColorSecondary: string;
206
+ textColorSecondaryHover: string;
207
+ borderColorSecondary: string;
208
+ colorSecondaryDisabled: string;
209
+ borderColorSecondaryDisabled: string;
210
+ colorTertiary: string;
211
+ colorTertiaryHover: string;
212
+ textColorTertiary: string;
213
+ textColorTertiaryHover: string;
214
+ borderColorTertiary: string;
215
+ colorTertiaryDisabled: string;
216
+ borderColorTertiaryDisabled: string;
217
+ colorTertiaryNegative: string;
218
+ colorTertiaryNegativeHover: string;
219
+ textColorTertiaryNegative: string;
220
+ textColorTertiaryNegativeHover: string;
221
+ borderColorTertiaryNegative: string;
222
+ colorTertiaryNegativeDisabled: string;
223
+ borderColorTertiaryNegativeDisabled: string;
224
+ colorGhost: string;
225
+ colorGhostHover: string;
226
+ textColorGhost: string;
227
+ textColorGhostHover: string;
228
+ borderColorGhost: string;
229
+ colorGhostDisabled: string;
230
+ borderColorGhostDisabled: string;
231
+ colorGhostNegative: string;
232
+ colorGhostNegativeHover: string;
233
+ textColorGhostNegative: string;
234
+ textColorGhostNegativeHover: string;
235
+ borderColorGhostNegative: string;
236
+ colorGhostNegativeDisabled: string;
237
+ borderColorGhostNegativeDisabled: string;
238
+ heightSmall: string;
239
+ heightMedium: string;
240
+ heightLarge: string;
241
+ paddingSmall: string;
242
+ paddingMedium: string;
243
+ paddingLarge: string;
244
+ borderRadiusSmall: string;
245
+ borderRadiusMedium: string;
246
+ borderRadiusLarge: string;
247
+ iconSizeSmall: string;
248
+ iconSizeMedium: string;
249
+ iconSizeLarge: string;
250
+ iconMargin: string;
251
+ borderWidth: string;
252
+ focusRingWidth: string;
253
+ spinnerStrokeWidth: string;
254
+ }, any>>>;
255
+ };
256
+ export interface ButtonV3Slots {
257
+ default?: () => VNode[];
258
+ 'icon-start'?: () => VNode[];
259
+ 'icon-end'?: () => VNode[];
260
+ }
261
+ export interface ButtonV3ThemeSelfVars {
262
+ [key: string]: string;
263
+ }
264
+ export interface ButtonV3IconSlotOptions {
265
+ clsPrefix: string;
266
+ slot: (() => VNode[]) | undefined;
267
+ showSpinner: boolean;
268
+ strokeWidth: number;
269
+ key: string;
270
+ }
271
+ export type ButtonV3Type = 'primary' | 'secondary' | 'tertiary' | 'ghost';
272
+ export type ButtonV3Tone = 'default' | 'negative';
273
+ export type ButtonV3Size = 'small' | 'medium' | 'large';
274
+ export type ButtonV3Tag = keyof HTMLElementTagNameMap;
275
+ export type ButtonV3AttrType = 'button' | 'submit' | 'reset';
276
+ export type ButtonV3VariantKey = 'primary' | 'primaryNegative' | 'secondary' | 'tertiary' | 'tertiaryNegative' | 'ghost' | 'ghostNegative';
277
+ export type ButtonV3ClickHandler = MaybeArray<(e: MouseEvent) => void>;
278
+ export type ButtonV3Props = ExtractPublicPropTypes<typeof buttonV3Props>;
279
+ export type InternalButtonV3Props = ExtractPropTypes<typeof buttonV3Props>;
280
+ export type ButtonV3NativeProps = Omit<ButtonHTMLAttributes, keyof InternalButtonV3Props>;
281
+ export type ButtonV3MergedProps = Partial<InternalButtonV3Props & ButtonV3NativeProps>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buttonV3Props = void 0;
4
+ const _mixins_1 = require("../../../_mixins");
5
+ exports.buttonV3Props = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { type: {
6
+ type: String,
7
+ default: 'primary'
8
+ }, tone: {
9
+ type: String,
10
+ default: 'default'
11
+ }, size: String, iconOnly: Boolean, block: Boolean, disabled: Boolean, loading: Boolean, focusable: {
12
+ type: Boolean,
13
+ default: true
14
+ }, tag: {
15
+ type: String,
16
+ default: 'button'
17
+ }, attrType: {
18
+ type: String,
19
+ default: 'button'
20
+ }, onClick: [Function, Array] });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("css-render").CNode;
2
+ export default _default;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ const cssr_1 = require("../../../../_utils/cssr");
7
+ exports.default = (0, cssr_1.c)([(0, cssr_1.c)('@keyframes u-button-v3-spin', `
8
+ from {
9
+ transform: rotate(0deg);
10
+ }
11
+ to {
12
+ transform: rotate(360deg);
13
+ }
14
+ `), (0, cssr_1.cB)('button-v3', `
15
+ box-sizing: border-box;
16
+ position: relative;
17
+ display: inline-flex;
18
+ flex-wrap: nowrap;
19
+ flex-shrink: 0;
20
+ align-items: center;
21
+ justify-content: center;
22
+ gap: var(--u-icon-margin);
23
+ margin: 0;
24
+ max-width: 100%;
25
+ height: var(--u-height);
26
+ padding: var(--u-padding);
27
+ border: var(--u-border-width) solid var(--u-border-color);
28
+ border-radius: var(--u-border-radius);
29
+ background-color: var(--u-color);
30
+ color: var(--u-text-color);
31
+ font-family: var(--u-font-family);
32
+ font-size: var(--u-font-size);
33
+ line-height: var(--u-line-height);
34
+ font-weight: var(--u-font-weight);
35
+ letter-spacing: var(--u-letter-spacing);
36
+ text-align: center;
37
+ text-decoration: none;
38
+ white-space: nowrap;
39
+ cursor: pointer;
40
+ outline: none;
41
+ user-select: none;
42
+ -webkit-user-select: none;
43
+ -webkit-tap-highlight-color: transparent;
44
+ transition:
45
+ color .3s var(--u-bezier),
46
+ background-color .3s var(--u-bezier),
47
+ border-color .3s var(--u-bezier);
48
+ `, [(0, cssr_1.c)('&::after', `
49
+ content: "";
50
+ position: absolute;
51
+ inset: calc(var(--u-border-width) * -1);
52
+ z-index: 0;
53
+ border-radius: inherit;
54
+ background-color: var(--u-pressed-overlay-color);
55
+ opacity: 0;
56
+ pointer-events: none;
57
+ transition: opacity .2s var(--u-bezier);
58
+ `), (0, cssr_1.cE)('label', `
59
+ position: relative;
60
+ z-index: 1;
61
+ min-width: 0;
62
+ overflow: hidden;
63
+ text-overflow: ellipsis;
64
+ white-space: nowrap;
65
+ `), (0, cssr_1.cE)('icon', `
66
+ position: relative;
67
+ z-index: 1;
68
+ display: inline-flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ flex: none;
72
+ width: var(--u-icon-size);
73
+ height: var(--u-icon-size);
74
+ font-size: var(--u-icon-size);
75
+ line-height: 1;
76
+ `, [(0, cssr_1.c)('svg', `
77
+ width: 1em;
78
+ height: 1em;
79
+ `)]), (0, cssr_1.cE)('spinner', `
80
+ position: absolute;
81
+ z-index: 1;
82
+ top: 50%;
83
+ left: 50%;
84
+ transform: translate(-50%, -50%);
85
+ width: var(--u-icon-size);
86
+ height: var(--u-icon-size);
87
+ font-size: var(--u-icon-size);
88
+ line-height: 1;
89
+ `), (0, cssr_1.cE)('spinner-icon', `
90
+ display: block;
91
+ width: 100%;
92
+ height: 100%;
93
+ color: currentColor;
94
+ animation: u-button-v3-spin 1s linear infinite;
95
+ `), (0, cssr_1.cM)('block', `
96
+ display: flex;
97
+ width: 100%;
98
+ `), (0, cssr_1.cM)('icon-only', `
99
+ padding: 0;
100
+ width: var(--u-height);
101
+ `), (0, cssr_1.cNotM)('disabled', [(0, cssr_1.c)('&:hover', `
102
+ background-color: var(--u-color-hover);
103
+ color: var(--u-text-color-hover);
104
+ `), (0, cssr_1.c)('&:focus-visible', `
105
+ outline: var(--u-focus-ring-width) solid var(--u-focus-ring-color);
106
+ outline-offset: 0;
107
+ `), (0, cssr_1.cNotM)('loading', [(0, cssr_1.c)('&:active', `
108
+ background-color: var(--u-color);
109
+ `, [(0, cssr_1.c)('&::after', `
110
+ opacity: 1;
111
+ `)])])]), (0, cssr_1.cM)('ghost-type', [(0, cssr_1.c)('&::after', `
112
+ display: none;
113
+ `), (0, cssr_1.cNotM)('disabled', [(0, cssr_1.c)('&:focus-visible', `
114
+ color: var(--u-text-color-hover);
115
+ `)])]), (0, cssr_1.cM)('disabled', `
116
+ cursor: not-allowed;
117
+ background-color: var(--u-color-disabled);
118
+ border-color: var(--u-border-color-disabled);
119
+ color: var(--u-text-color-disabled);
120
+ `), (0, cssr_1.cM)('loading', `
121
+ cursor: default;
122
+ `), (0, cssr_1.cM)('loading-text-only', [(0, cssr_1.cE)('label', `
123
+ visibility: hidden;
124
+ `)])])]);
@@ -0,0 +1,10 @@
1
+ import type { VNode } from 'vue';
2
+ import type { ButtonV3IconSlotOptions, ButtonV3Tone, ButtonV3Type, ButtonV3VariantKey } from './interface';
3
+ export declare const SPINNER_VIEWBOX = 100;
4
+ export declare const SPINNER_ARC = 0.75;
5
+ export declare const DEFAULT_SPINNER_STROKE_WIDTH = 18.5;
6
+ export declare function resolveVariantKey(type: ButtonV3Type, tone: ButtonV3Tone): ButtonV3VariantKey;
7
+ export declare function upperFirst(value: string): string;
8
+ export declare function resolveSpinnerStrokeWidth(iconSize: string, strokeWidth: string): number;
9
+ export declare function renderSpinner(clsPrefix: string, strokeWidth: number): VNode;
10
+ export declare function renderIconSlot(options: ButtonV3IconSlotOptions): VNode | null;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_SPINNER_STROKE_WIDTH = exports.SPINNER_ARC = exports.SPINNER_VIEWBOX = void 0;
4
+ exports.resolveVariantKey = resolveVariantKey;
5
+ exports.upperFirst = upperFirst;
6
+ exports.resolveSpinnerStrokeWidth = resolveSpinnerStrokeWidth;
7
+ exports.renderSpinner = renderSpinner;
8
+ exports.renderIconSlot = renderIconSlot;
9
+ const vue_1 = require("vue");
10
+ exports.SPINNER_VIEWBOX = 100;
11
+ exports.SPINNER_ARC = 0.75;
12
+ exports.DEFAULT_SPINNER_STROKE_WIDTH = 18.5;
13
+ function resolveVariantKey(type, tone) {
14
+ if (tone !== 'negative' || type === 'secondary')
15
+ return type;
16
+ return `${type}Negative`;
17
+ }
18
+ function upperFirst(value) {
19
+ return value.charAt(0).toUpperCase() + value.slice(1);
20
+ }
21
+ function resolveSpinnerStrokeWidth(iconSize, strokeWidth) {
22
+ const size = Number.parseFloat(iconSize);
23
+ const stroke = Number.parseFloat(strokeWidth);
24
+ if (!size || !stroke)
25
+ return exports.DEFAULT_SPINNER_STROKE_WIDTH;
26
+ return (stroke / size) * exports.SPINNER_VIEWBOX;
27
+ }
28
+ function renderSpinner(clsPrefix, strokeWidth) {
29
+ const radius = (exports.SPINNER_VIEWBOX - strokeWidth) / 2;
30
+ const circumference = 2 * Math.PI * radius;
31
+ const arc = exports.SPINNER_ARC * circumference;
32
+ return (0, vue_1.h)('svg', {
33
+ class: `${clsPrefix}-button-v3__spinner-icon`,
34
+ viewBox: `0 0 ${exports.SPINNER_VIEWBOX} ${exports.SPINNER_VIEWBOX}`,
35
+ xmlns: 'http://www.w3.org/2000/svg',
36
+ role: 'img',
37
+ 'aria-label': 'loading'
38
+ }, [
39
+ (0, vue_1.h)('circle', {
40
+ cx: exports.SPINNER_VIEWBOX / 2,
41
+ cy: exports.SPINNER_VIEWBOX / 2,
42
+ r: radius,
43
+ fill: 'none',
44
+ stroke: 'currentColor',
45
+ 'stroke-width': strokeWidth,
46
+ 'stroke-linecap': 'round',
47
+ 'stroke-dasharray': `${arc} ${circumference - arc}`
48
+ })
49
+ ]);
50
+ }
51
+ function renderIconSlot(options) {
52
+ const { clsPrefix, slot, showSpinner, strokeWidth, key } = options;
53
+ if (!showSpinner && !slot)
54
+ return null;
55
+ return (0, vue_1.h)('span', { key, class: `${clsPrefix}-button-v3__icon` }, showSpinner ? [renderSpinner(clsPrefix, strokeWidth)] : slot === null || slot === void 0 ? void 0 : slot());
56
+ }
@@ -0,0 +1,19 @@
1
+ declare const _default: {
2
+ heightSmall: string;
3
+ heightMedium: string;
4
+ heightLarge: string;
5
+ paddingSmall: string;
6
+ paddingMedium: string;
7
+ paddingLarge: string;
8
+ borderRadiusSmall: string;
9
+ borderRadiusMedium: string;
10
+ borderRadiusLarge: string;
11
+ iconSizeSmall: string;
12
+ iconSizeMedium: string;
13
+ iconSizeLarge: string;
14
+ iconMargin: string;
15
+ borderWidth: string;
16
+ focusRingWidth: string;
17
+ spinnerStrokeWidth: string;
18
+ };
19
+ export default _default;