@uzum-tech/ui 1.12.5 → 1.12.6

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.
@@ -1,3 +1,7 @@
1
1
  export { default as InternalUText, internalTextProps } from './src/text';
2
2
  export type { InternalTextProps } from './src/text';
3
- export type { TypographyVariant, TypographyVariantOptions, TypographyVariantWeightsOptions } from './src/variants';
3
+ export type { TypographyVariant, TypographyVariantOptions,
4
+ /**
5
+ * @deprecated Weight options are fixed; override via `variantOptions` instead.
6
+ */
7
+ TypographyVariantWeightsOptions } from './src/variants';
@@ -25,6 +25,9 @@ export declare const internalTextProps: {
25
25
  readonly type: PropType<TypographyVariantOptions>;
26
26
  readonly default: () => {};
27
27
  };
28
+ /**
29
+ * @deprecated Weight options are fixed internally; kept for backwards compatibility.
30
+ */
28
31
  readonly variantWeightsOptions: {
29
32
  readonly type: PropType<TypographyVariantWeightsOptions>;
30
33
  readonly default: () => {};
@@ -114,6 +117,9 @@ declare const _default: import("vue").DefineComponent<{
114
117
  readonly type: PropType<TypographyVariantOptions>;
115
118
  readonly default: () => {};
116
119
  };
120
+ /**
121
+ * @deprecated Weight options are fixed internally; kept for backwards compatibility.
122
+ */
117
123
  readonly variantWeightsOptions: {
118
124
  readonly type: PropType<TypographyVariantWeightsOptions>;
119
125
  readonly default: () => {};
@@ -207,6 +213,9 @@ declare const _default: import("vue").DefineComponent<{
207
213
  readonly type: PropType<TypographyVariantOptions>;
208
214
  readonly default: () => {};
209
215
  };
216
+ /**
217
+ * @deprecated Weight options are fixed internally; kept for backwards compatibility.
218
+ */
210
219
  readonly variantWeightsOptions: {
211
220
  readonly type: PropType<TypographyVariantWeightsOptions>;
212
221
  readonly default: () => {};
@@ -22,7 +22,11 @@ export const internalTextProps = Object.assign(Object.assign({}, useTheme.props)
22
22
  }, variantOptions: {
23
23
  type: Object,
24
24
  default: () => ({})
25
- }, variantWeightsOptions: {
25
+ },
26
+ /**
27
+ * @deprecated Weight options are fixed internally; kept for backwards compatibility.
28
+ */
29
+ variantWeightsOptions: {
26
30
  type: Object,
27
31
  default: () => ({})
28
32
  }, strong: Boolean, italic: Boolean, underline: Boolean, strikethrough: Boolean });
@@ -54,14 +58,13 @@ export default defineComponent({
54
58
  '--u-margin': margin,
55
59
  '--u-prefix-color': blockquotePrefixColor
56
60
  };
57
- return getVariantCssVars(variant, baseVars, fontFamilyWixMadeforDisplay, props.variantOptions, props.variantWeightsOptions);
61
+ return getVariantCssVars(variant, baseVars, fontFamilyWixMadeforDisplay, props.variantOptions);
58
62
  });
59
63
  const themeClassHandle = inlineThemeDisabled
60
64
  ? useThemeClass('text', computed(() => `${(props === null || props === void 0 ? void 0 : props.variant) || ''}${(props === null || props === void 0 ? void 0 : props.tag) || ''}`), cssVarsRef, props)
61
65
  : undefined;
62
66
  const tagToRender = props.tag ||
63
- (props.variant &&
64
- getVariantTag(props.variant, props.variantOptions, props.variantWeightsOptions)) ||
67
+ (props.variant && getVariantTag(props.variant, props.variantOptions)) ||
65
68
  'span';
66
69
  return {
67
70
  mergedClsPrefix: mergedClsPrefixRef,
@@ -2,9 +2,13 @@ export interface TypographyVariantBase {
2
2
  fontSize: string;
3
3
  lineHeight: string;
4
4
  letterSpacing: string;
5
+ fontStyle?: string;
6
+ fontFamily?: string;
7
+ defaultFontWeight?: TypographyFontWeight;
5
8
  tag: keyof HTMLElementTagNameMap;
6
9
  }
7
10
  export type TypographyVariantOptions = Record<PropertyKey, Record<PropertyKey, TypographyVariantBase>>;
11
+ /** @deprecated Weight options are now fixed; this is kept for type compatibility. */
8
12
  export type TypographyVariantWeightsOptions = Record<PropertyKey, readonly string[]>;
9
13
  export interface TypographyVariantConfig {
10
14
  fontFamily: string;
@@ -91,24 +95,20 @@ export declare const defaultVariantOptions: {
91
95
  };
92
96
  };
93
97
  };
94
- declare const variantWeights: {
95
- readonly display: readonly ["", "medium", "semi-bold", "bold"];
96
- readonly heading: readonly ["medium", "semi-bold", "bold"];
97
- readonly title: readonly ["medium", "semi-bold", "bold"];
98
- readonly body: readonly ["medium", "semi-bold", "bold"];
99
- };
100
- type VariantWeights = typeof variantWeights;
98
+ declare const weightOrder: readonly ["", "thin", "extra-light", "light", "normal", "medium", "semi-bold", "bold", "extra-bold", "black"];
99
+ export type TypographyFontWeight = (typeof weightOrder)[number];
100
+ type VariantWeights = typeof weightOrder;
101
101
  type WeightSuffix<W> = W extends string ? (W extends '' ? '' : `-${W}`) : '';
102
+ type VariantCategories<Options> = Options;
102
103
  export type TypographyVariantFromOptions<Options extends TypographyVariantOptions> = {
103
- [Category in keyof Options & keyof VariantWeights]: {
104
- [Size in keyof Options[Category]]: `${string & Category}-${string & Size}${WeightSuffix<VariantWeights[Category][number]>}`;
105
- }[keyof Options[Category]];
106
- }[keyof Options & keyof VariantWeights];
104
+ [Category in keyof VariantCategories<Options>]: {
105
+ [Size in keyof VariantCategories<Options>[Category]]: `${string & Category}-${string & Size}${WeightSuffix<VariantWeights[number]>}`;
106
+ }[keyof VariantCategories<Options>[Category]];
107
+ }[keyof VariantCategories<Options>];
107
108
  export type TypographyDefaultVariant = TypographyVariantFromOptions<typeof defaultVariantOptions>;
108
109
  export type TypographyVariant = TypographyDefaultVariant | (string & {});
109
110
  export declare function mergeVariantOptions(variantOptions?: TypographyVariantOptions): TypographyVariantOptions;
110
- export declare function mergeVariantWeights(variantWeightsOptions?: Partial<Record<PropertyKey, readonly string[]>>): Record<PropertyKey, readonly string[]>;
111
- export declare function getVariantCssVars(variant: TypographyVariant | undefined, baseVars: Record<string, string>, fontFamilyVariant: string, variantOptions?: TypographyVariantOptions, variantWeightsOptions?: Partial<Record<PropertyKey, readonly string[]>>): Record<string, string>;
112
- export declare function getVariantTag(variant: TypographyVariant, variantOptions?: TypographyVariantOptions, variantWeightsOptions?: Partial<Record<PropertyKey, readonly string[]>>): keyof HTMLElementTagNameMap;
111
+ export declare function getVariantCssVars(variant: TypographyVariant | undefined, baseVars: Record<string, string>, fontFamilyVariant: string, variantOptions?: TypographyVariantOptions): Record<string, string>;
112
+ export declare function getVariantTag(variant: TypographyVariant, variantOptions?: TypographyVariantOptions): keyof HTMLElementTagNameMap;
113
113
  export declare const variantToCssVars: Record<string, TypographyVariantConfig>;
114
114
  export {};
@@ -75,27 +75,42 @@ export const defaultVariantOptions = {
75
75
  }
76
76
  }
77
77
  };
78
- const variantWeights = {
79
- display: ['', 'medium', 'semi-bold', 'bold'],
80
- heading: ['medium', 'semi-bold', 'bold'],
81
- title: ['medium', 'semi-bold', 'bold'],
82
- body: ['medium', 'semi-bold', 'bold']
83
- };
78
+ const weightOrder = [
79
+ '',
80
+ 'thin',
81
+ 'extra-light',
82
+ 'light',
83
+ 'normal',
84
+ 'medium',
85
+ 'semi-bold',
86
+ 'bold',
87
+ 'extra-bold',
88
+ 'black'
89
+ ];
84
90
  const fontWeights = {
85
- medium: { weight: '500', style: 'medium' },
86
- 'semi-bold': { weight: '600', style: 'semibold' },
87
- bold: { weight: '700', style: 'bold' },
88
- '': { weight: '700', style: 'bold' }
91
+ thin: { weight: '100', style: 'normal' },
92
+ 'extra-light': { weight: '200', style: 'normal' },
93
+ light: { weight: '300', style: 'normal' },
94
+ normal: { weight: '400', style: 'normal' },
95
+ medium: { weight: '500', style: 'normal' },
96
+ 'semi-bold': { weight: '600', style: 'normal' },
97
+ bold: { weight: '700', style: 'normal' },
98
+ 'extra-bold': { weight: '800', style: 'normal' },
99
+ black: { weight: '900', style: 'normal' },
100
+ '': { weight: '700', style: 'normal' }
89
101
  };
90
102
  function createVariant(options, category, size, weight) {
91
- var _a, _b, _c;
103
+ var _a, _b, _c, _d, _e, _f;
92
104
  const base = (_b = (_a = options === null || options === void 0 ? void 0 : options[category]) === null || _a === void 0 ? void 0 : _a[size]) !== null && _b !== void 0 ? _b : (_c = defaultVariantOptions[category]) === null || _c === void 0 ? void 0 : _c[size];
93
- const { weight: fontWeight, style: fontStyle } = fontWeights[weight];
105
+ const effectiveWeight = weight === '' ? (_d = base === null || base === void 0 ? void 0 : base.defaultFontWeight) !== null && _d !== void 0 ? _d : '' : weight;
106
+ const { weight: fontWeight, style: fontStyle } = fontWeights[effectiveWeight] || fontWeights[''];
107
+ const resolvedFontFamily = (_e = base.fontFamily) !== null && _e !== void 0 ? _e : fontFamily;
108
+ const resolvedFontStyle = (_f = base.fontStyle) !== null && _f !== void 0 ? _f : fontStyle;
94
109
  return {
95
- fontFamily,
110
+ fontFamily: resolvedFontFamily,
96
111
  fontSize: base.fontSize,
97
112
  fontWeight,
98
- fontStyle,
113
+ fontStyle: resolvedFontStyle,
99
114
  lineHeight: base.lineHeight,
100
115
  letterSpacing: base.letterSpacing,
101
116
  tag: base.tag
@@ -115,34 +130,11 @@ export function mergeVariantOptions(variantOptions) {
115
130
  });
116
131
  return mergedOptions;
117
132
  }
118
- export function mergeVariantWeights(variantWeightsOptions) {
119
- if (!variantWeightsOptions)
120
- return variantWeights;
121
- const mergedWeights = {};
122
- const categories = new Set([
123
- ...Object.keys(variantWeights),
124
- ...Object.keys(variantWeightsOptions)
125
- ]);
126
- categories.forEach((category) => {
127
- const defaultWeights = variantWeights[category] || [];
128
- const customWeights = variantWeightsOptions[category] || [];
129
- const combined = [...defaultWeights];
130
- customWeights.forEach((weight) => {
131
- if (!combined.includes(weight)) {
132
- combined.push(weight);
133
- }
134
- });
135
- mergedWeights[category] = combined;
136
- });
137
- return mergedWeights;
138
- }
139
- function createVariantToCssVars(variantOptions, variantWeightsOptions) {
133
+ function createVariantToCssVars(variantOptions) {
140
134
  const configs = {};
141
- const mergedWeights = mergeVariantWeights(variantWeightsOptions);
142
135
  Object.entries(variantOptions).forEach(([category, sizes]) => {
143
- const weights = mergedWeights[category] || [];
144
136
  Object.keys(sizes).forEach((size) => {
145
- weights.forEach((weight) => {
137
+ weightOrder.forEach((weight) => {
146
138
  const variantKey = `${category}-${size}${weight ? `-${weight}` : ''}`;
147
139
  configs[variantKey] = createVariant(variantOptions, category, size, weight);
148
140
  });
@@ -150,25 +142,25 @@ function createVariantToCssVars(variantOptions, variantWeightsOptions) {
150
142
  });
151
143
  return configs;
152
144
  }
153
- function resolveVariantConfigs(variantOptions, variantWeightsOptions) {
145
+ function resolveVariantConfigs(variantOptions) {
154
146
  const hasCustomOptions = variantOptions && Object.keys(variantOptions).length > 0;
155
- const hasCustomWeights = variantWeightsOptions && Object.keys(variantWeightsOptions).length > 0;
156
- if (!hasCustomOptions && !hasCustomWeights) {
147
+ if (!hasCustomOptions) {
157
148
  return variantToCssVars;
158
149
  }
159
- return createVariantToCssVars(mergeVariantOptions(variantOptions), variantWeightsOptions);
150
+ const mergedOptions = mergeVariantOptions(variantOptions);
151
+ return createVariantToCssVars(mergedOptions);
160
152
  }
161
- export function getVariantCssVars(variant, baseVars, fontFamilyVariant, variantOptions, variantWeightsOptions) {
153
+ export function getVariantCssVars(variant, baseVars, fontFamilyVariant, variantOptions) {
162
154
  const variantStyles = variant
163
- ? resolveVariantConfigs(variantOptions, variantWeightsOptions)[variant]
155
+ ? resolveVariantConfigs(variantOptions)[variant]
164
156
  : undefined;
165
157
  if (!variantStyles) {
166
158
  return baseVars;
167
159
  }
168
160
  return Object.assign(Object.assign({}, baseVars), { '--u-font-famliy-variant': fontFamilyVariant, '--u-variant-font-size': variantStyles.fontSize, '--u-variant-font-weight': variantStyles.fontWeight, '--u-variant-line-height': variantStyles.lineHeight, '--u-variant-font-family': variantStyles.fontFamily, '--u-variant-font-style': variantStyles.fontStyle, '--u-variant-letter-spacing': variantStyles.letterSpacing });
169
161
  }
170
- export function getVariantTag(variant, variantOptions, variantWeightsOptions) {
162
+ export function getVariantTag(variant, variantOptions) {
171
163
  var _a;
172
- return (_a = resolveVariantConfigs(variantOptions, variantWeightsOptions)[variant]) === null || _a === void 0 ? void 0 : _a.tag;
164
+ return (_a = resolveVariantConfigs(variantOptions)[variant]) === null || _a === void 0 ? void 0 : _a.tag;
173
165
  }
174
- export const variantToCssVars = createVariantToCssVars(defaultVariantOptions, variantWeights);
166
+ export const variantToCssVars = createVariantToCssVars(defaultVariantOptions);
@@ -384,7 +384,7 @@ export default defineComponent({
384
384
  };
385
385
  const renderFooter = () => {
386
386
  return (h("div", { class: `${mergedClsPrefixRef.value}-chat-main__footer` },
387
- h(UUpload, Object.assign({ abstract: true, multiple: true, defaultUpload: false, fileList: attachmentFileList.value, onUpdateFileList: handleFileListUpdate }, footerUploadPropsRef.value, { onChange: handleOnChange() }), {
387
+ h(UUpload, Object.assign({ abstract: true, multiple: true, defaultUpload: false, fileList: attachmentFileList.value, onUpdateFileList: !handleOnChange() ? handleFileListUpdate : undefined }, footerUploadPropsRef.value, { onChange: handleOnChange() }), {
388
388
  default: () => (h(UFlex, { align: "end", size: "small", wrap: false, class: `${mergedClsPrefixRef.value}-chat-main__input-container` }, {
389
389
  default: () => (h(Fragment, null,
390
390
  h(UUploadTrigger, { abstract: true }, {
@@ -20,4 +20,8 @@ export type { OlProps } from './src/ol';
20
20
  export { default as ULi } from './src/li';
21
21
  export { default as UText, textProps } from './src/text';
22
22
  export type { TextProps } from './src/text';
23
- export type { TypographyVariant, TypographyVariantOptions, TypographyVariantWeightsOptions } from '../_internal/typography';
23
+ export type { TypographyVariant, TypographyVariantOptions,
24
+ /**
25
+ * @deprecated Weight options are fixed; kept for backwards compatibility.
26
+ */
27
+ TypographyVariantWeightsOptions } from '../_internal/typography';
package/es/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.12.5";
1
+ declare const _default: "1.12.6";
2
2
  export default _default;
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export default '1.12.5';
1
+ export default '1.12.6';
@@ -1,3 +1,7 @@
1
1
  export { default as InternalUText, internalTextProps } from './src/text';
2
2
  export type { InternalTextProps } from './src/text';
3
- export type { TypographyVariant, TypographyVariantOptions, TypographyVariantWeightsOptions } from './src/variants';
3
+ export type { TypographyVariant, TypographyVariantOptions,
4
+ /**
5
+ * @deprecated Weight options are fixed; override via `variantOptions` instead.
6
+ */
7
+ TypographyVariantWeightsOptions } from './src/variants';
@@ -25,6 +25,9 @@ export declare const internalTextProps: {
25
25
  readonly type: PropType<TypographyVariantOptions>;
26
26
  readonly default: () => {};
27
27
  };
28
+ /**
29
+ * @deprecated Weight options are fixed internally; kept for backwards compatibility.
30
+ */
28
31
  readonly variantWeightsOptions: {
29
32
  readonly type: PropType<TypographyVariantWeightsOptions>;
30
33
  readonly default: () => {};
@@ -114,6 +117,9 @@ declare const _default: import("vue").DefineComponent<{
114
117
  readonly type: PropType<TypographyVariantOptions>;
115
118
  readonly default: () => {};
116
119
  };
120
+ /**
121
+ * @deprecated Weight options are fixed internally; kept for backwards compatibility.
122
+ */
117
123
  readonly variantWeightsOptions: {
118
124
  readonly type: PropType<TypographyVariantWeightsOptions>;
119
125
  readonly default: () => {};
@@ -207,6 +213,9 @@ declare const _default: import("vue").DefineComponent<{
207
213
  readonly type: PropType<TypographyVariantOptions>;
208
214
  readonly default: () => {};
209
215
  };
216
+ /**
217
+ * @deprecated Weight options are fixed internally; kept for backwards compatibility.
218
+ */
210
219
  readonly variantWeightsOptions: {
211
220
  readonly type: PropType<TypographyVariantWeightsOptions>;
212
221
  readonly default: () => {};
@@ -28,7 +28,11 @@ exports.internalTextProps = Object.assign(Object.assign({}, _mixins_1.useTheme.p
28
28
  }, variantOptions: {
29
29
  type: Object,
30
30
  default: () => ({})
31
- }, variantWeightsOptions: {
31
+ },
32
+ /**
33
+ * @deprecated Weight options are fixed internally; kept for backwards compatibility.
34
+ */
35
+ variantWeightsOptions: {
32
36
  type: Object,
33
37
  default: () => ({})
34
38
  }, strong: Boolean, italic: Boolean, underline: Boolean, strikethrough: Boolean });
@@ -60,14 +64,13 @@ exports.default = (0, vue_1.defineComponent)({
60
64
  '--u-margin': margin,
61
65
  '--u-prefix-color': blockquotePrefixColor
62
66
  };
63
- return (0, variants_1.getVariantCssVars)(variant, baseVars, fontFamilyWixMadeforDisplay, props.variantOptions, props.variantWeightsOptions);
67
+ return (0, variants_1.getVariantCssVars)(variant, baseVars, fontFamilyWixMadeforDisplay, props.variantOptions);
64
68
  });
65
69
  const themeClassHandle = inlineThemeDisabled
66
70
  ? (0, _mixins_1.useThemeClass)('text', (0, vue_1.computed)(() => `${(props === null || props === void 0 ? void 0 : props.variant) || ''}${(props === null || props === void 0 ? void 0 : props.tag) || ''}`), cssVarsRef, props)
67
71
  : undefined;
68
72
  const tagToRender = props.tag ||
69
- (props.variant &&
70
- (0, variants_1.getVariantTag)(props.variant, props.variantOptions, props.variantWeightsOptions)) ||
73
+ (props.variant && (0, variants_1.getVariantTag)(props.variant, props.variantOptions)) ||
71
74
  'span';
72
75
  return {
73
76
  mergedClsPrefix: mergedClsPrefixRef,
@@ -2,9 +2,13 @@ export interface TypographyVariantBase {
2
2
  fontSize: string;
3
3
  lineHeight: string;
4
4
  letterSpacing: string;
5
+ fontStyle?: string;
6
+ fontFamily?: string;
7
+ defaultFontWeight?: TypographyFontWeight;
5
8
  tag: keyof HTMLElementTagNameMap;
6
9
  }
7
10
  export type TypographyVariantOptions = Record<PropertyKey, Record<PropertyKey, TypographyVariantBase>>;
11
+ /** @deprecated Weight options are now fixed; this is kept for type compatibility. */
8
12
  export type TypographyVariantWeightsOptions = Record<PropertyKey, readonly string[]>;
9
13
  export interface TypographyVariantConfig {
10
14
  fontFamily: string;
@@ -91,24 +95,20 @@ export declare const defaultVariantOptions: {
91
95
  };
92
96
  };
93
97
  };
94
- declare const variantWeights: {
95
- readonly display: readonly ["", "medium", "semi-bold", "bold"];
96
- readonly heading: readonly ["medium", "semi-bold", "bold"];
97
- readonly title: readonly ["medium", "semi-bold", "bold"];
98
- readonly body: readonly ["medium", "semi-bold", "bold"];
99
- };
100
- type VariantWeights = typeof variantWeights;
98
+ declare const weightOrder: readonly ["", "thin", "extra-light", "light", "normal", "medium", "semi-bold", "bold", "extra-bold", "black"];
99
+ export type TypographyFontWeight = (typeof weightOrder)[number];
100
+ type VariantWeights = typeof weightOrder;
101
101
  type WeightSuffix<W> = W extends string ? (W extends '' ? '' : `-${W}`) : '';
102
+ type VariantCategories<Options> = Options;
102
103
  export type TypographyVariantFromOptions<Options extends TypographyVariantOptions> = {
103
- [Category in keyof Options & keyof VariantWeights]: {
104
- [Size in keyof Options[Category]]: `${string & Category}-${string & Size}${WeightSuffix<VariantWeights[Category][number]>}`;
105
- }[keyof Options[Category]];
106
- }[keyof Options & keyof VariantWeights];
104
+ [Category in keyof VariantCategories<Options>]: {
105
+ [Size in keyof VariantCategories<Options>[Category]]: `${string & Category}-${string & Size}${WeightSuffix<VariantWeights[number]>}`;
106
+ }[keyof VariantCategories<Options>[Category]];
107
+ }[keyof VariantCategories<Options>];
107
108
  export type TypographyDefaultVariant = TypographyVariantFromOptions<typeof defaultVariantOptions>;
108
109
  export type TypographyVariant = TypographyDefaultVariant | (string & {});
109
110
  export declare function mergeVariantOptions(variantOptions?: TypographyVariantOptions): TypographyVariantOptions;
110
- export declare function mergeVariantWeights(variantWeightsOptions?: Partial<Record<PropertyKey, readonly string[]>>): Record<PropertyKey, readonly string[]>;
111
- export declare function getVariantCssVars(variant: TypographyVariant | undefined, baseVars: Record<string, string>, fontFamilyVariant: string, variantOptions?: TypographyVariantOptions, variantWeightsOptions?: Partial<Record<PropertyKey, readonly string[]>>): Record<string, string>;
112
- export declare function getVariantTag(variant: TypographyVariant, variantOptions?: TypographyVariantOptions, variantWeightsOptions?: Partial<Record<PropertyKey, readonly string[]>>): keyof HTMLElementTagNameMap;
111
+ export declare function getVariantCssVars(variant: TypographyVariant | undefined, baseVars: Record<string, string>, fontFamilyVariant: string, variantOptions?: TypographyVariantOptions): Record<string, string>;
112
+ export declare function getVariantTag(variant: TypographyVariant, variantOptions?: TypographyVariantOptions): keyof HTMLElementTagNameMap;
113
113
  export declare const variantToCssVars: Record<string, TypographyVariantConfig>;
114
114
  export {};
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.variantToCssVars = exports.defaultVariantOptions = void 0;
4
4
  exports.mergeVariantOptions = mergeVariantOptions;
5
- exports.mergeVariantWeights = mergeVariantWeights;
6
5
  exports.getVariantCssVars = getVariantCssVars;
7
6
  exports.getVariantTag = getVariantTag;
8
7
  const fontFamily = 'var(--u-font-famliy-variant)';
@@ -82,27 +81,42 @@ exports.defaultVariantOptions = {
82
81
  }
83
82
  }
84
83
  };
85
- const variantWeights = {
86
- display: ['', 'medium', 'semi-bold', 'bold'],
87
- heading: ['medium', 'semi-bold', 'bold'],
88
- title: ['medium', 'semi-bold', 'bold'],
89
- body: ['medium', 'semi-bold', 'bold']
90
- };
84
+ const weightOrder = [
85
+ '',
86
+ 'thin',
87
+ 'extra-light',
88
+ 'light',
89
+ 'normal',
90
+ 'medium',
91
+ 'semi-bold',
92
+ 'bold',
93
+ 'extra-bold',
94
+ 'black'
95
+ ];
91
96
  const fontWeights = {
92
- medium: { weight: '500', style: 'medium' },
93
- 'semi-bold': { weight: '600', style: 'semibold' },
94
- bold: { weight: '700', style: 'bold' },
95
- '': { weight: '700', style: 'bold' }
97
+ thin: { weight: '100', style: 'normal' },
98
+ 'extra-light': { weight: '200', style: 'normal' },
99
+ light: { weight: '300', style: 'normal' },
100
+ normal: { weight: '400', style: 'normal' },
101
+ medium: { weight: '500', style: 'normal' },
102
+ 'semi-bold': { weight: '600', style: 'normal' },
103
+ bold: { weight: '700', style: 'normal' },
104
+ 'extra-bold': { weight: '800', style: 'normal' },
105
+ black: { weight: '900', style: 'normal' },
106
+ '': { weight: '700', style: 'normal' }
96
107
  };
97
108
  function createVariant(options, category, size, weight) {
98
- var _a, _b, _c;
109
+ var _a, _b, _c, _d, _e, _f;
99
110
  const base = (_b = (_a = options === null || options === void 0 ? void 0 : options[category]) === null || _a === void 0 ? void 0 : _a[size]) !== null && _b !== void 0 ? _b : (_c = exports.defaultVariantOptions[category]) === null || _c === void 0 ? void 0 : _c[size];
100
- const { weight: fontWeight, style: fontStyle } = fontWeights[weight];
111
+ const effectiveWeight = weight === '' ? (_d = base === null || base === void 0 ? void 0 : base.defaultFontWeight) !== null && _d !== void 0 ? _d : '' : weight;
112
+ const { weight: fontWeight, style: fontStyle } = fontWeights[effectiveWeight] || fontWeights[''];
113
+ const resolvedFontFamily = (_e = base.fontFamily) !== null && _e !== void 0 ? _e : fontFamily;
114
+ const resolvedFontStyle = (_f = base.fontStyle) !== null && _f !== void 0 ? _f : fontStyle;
101
115
  return {
102
- fontFamily,
116
+ fontFamily: resolvedFontFamily,
103
117
  fontSize: base.fontSize,
104
118
  fontWeight,
105
- fontStyle,
119
+ fontStyle: resolvedFontStyle,
106
120
  lineHeight: base.lineHeight,
107
121
  letterSpacing: base.letterSpacing,
108
122
  tag: base.tag
@@ -122,34 +136,11 @@ function mergeVariantOptions(variantOptions) {
122
136
  });
123
137
  return mergedOptions;
124
138
  }
125
- function mergeVariantWeights(variantWeightsOptions) {
126
- if (!variantWeightsOptions)
127
- return variantWeights;
128
- const mergedWeights = {};
129
- const categories = new Set([
130
- ...Object.keys(variantWeights),
131
- ...Object.keys(variantWeightsOptions)
132
- ]);
133
- categories.forEach((category) => {
134
- const defaultWeights = variantWeights[category] || [];
135
- const customWeights = variantWeightsOptions[category] || [];
136
- const combined = [...defaultWeights];
137
- customWeights.forEach((weight) => {
138
- if (!combined.includes(weight)) {
139
- combined.push(weight);
140
- }
141
- });
142
- mergedWeights[category] = combined;
143
- });
144
- return mergedWeights;
145
- }
146
- function createVariantToCssVars(variantOptions, variantWeightsOptions) {
139
+ function createVariantToCssVars(variantOptions) {
147
140
  const configs = {};
148
- const mergedWeights = mergeVariantWeights(variantWeightsOptions);
149
141
  Object.entries(variantOptions).forEach(([category, sizes]) => {
150
- const weights = mergedWeights[category] || [];
151
142
  Object.keys(sizes).forEach((size) => {
152
- weights.forEach((weight) => {
143
+ weightOrder.forEach((weight) => {
153
144
  const variantKey = `${category}-${size}${weight ? `-${weight}` : ''}`;
154
145
  configs[variantKey] = createVariant(variantOptions, category, size, weight);
155
146
  });
@@ -157,25 +148,25 @@ function createVariantToCssVars(variantOptions, variantWeightsOptions) {
157
148
  });
158
149
  return configs;
159
150
  }
160
- function resolveVariantConfigs(variantOptions, variantWeightsOptions) {
151
+ function resolveVariantConfigs(variantOptions) {
161
152
  const hasCustomOptions = variantOptions && Object.keys(variantOptions).length > 0;
162
- const hasCustomWeights = variantWeightsOptions && Object.keys(variantWeightsOptions).length > 0;
163
- if (!hasCustomOptions && !hasCustomWeights) {
153
+ if (!hasCustomOptions) {
164
154
  return exports.variantToCssVars;
165
155
  }
166
- return createVariantToCssVars(mergeVariantOptions(variantOptions), variantWeightsOptions);
156
+ const mergedOptions = mergeVariantOptions(variantOptions);
157
+ return createVariantToCssVars(mergedOptions);
167
158
  }
168
- function getVariantCssVars(variant, baseVars, fontFamilyVariant, variantOptions, variantWeightsOptions) {
159
+ function getVariantCssVars(variant, baseVars, fontFamilyVariant, variantOptions) {
169
160
  const variantStyles = variant
170
- ? resolveVariantConfigs(variantOptions, variantWeightsOptions)[variant]
161
+ ? resolveVariantConfigs(variantOptions)[variant]
171
162
  : undefined;
172
163
  if (!variantStyles) {
173
164
  return baseVars;
174
165
  }
175
166
  return Object.assign(Object.assign({}, baseVars), { '--u-font-famliy-variant': fontFamilyVariant, '--u-variant-font-size': variantStyles.fontSize, '--u-variant-font-weight': variantStyles.fontWeight, '--u-variant-line-height': variantStyles.lineHeight, '--u-variant-font-family': variantStyles.fontFamily, '--u-variant-font-style': variantStyles.fontStyle, '--u-variant-letter-spacing': variantStyles.letterSpacing });
176
167
  }
177
- function getVariantTag(variant, variantOptions, variantWeightsOptions) {
168
+ function getVariantTag(variant, variantOptions) {
178
169
  var _a;
179
- return (_a = resolveVariantConfigs(variantOptions, variantWeightsOptions)[variant]) === null || _a === void 0 ? void 0 : _a.tag;
170
+ return (_a = resolveVariantConfigs(variantOptions)[variant]) === null || _a === void 0 ? void 0 : _a.tag;
180
171
  }
181
- exports.variantToCssVars = createVariantToCssVars(exports.defaultVariantOptions, variantWeights);
172
+ exports.variantToCssVars = createVariantToCssVars(exports.defaultVariantOptions);
@@ -389,7 +389,7 @@ exports.default = (0, vue_1.defineComponent)({
389
389
  };
390
390
  const renderFooter = () => {
391
391
  return ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-main__footer` },
392
- (0, vue_1.h)(upload_1.UUpload, Object.assign({ abstract: true, multiple: true, defaultUpload: false, fileList: attachmentFileList.value, onUpdateFileList: handleFileListUpdate }, footerUploadPropsRef.value, { onChange: handleOnChange() }), {
392
+ (0, vue_1.h)(upload_1.UUpload, Object.assign({ abstract: true, multiple: true, defaultUpload: false, fileList: attachmentFileList.value, onUpdateFileList: !handleOnChange() ? handleFileListUpdate : undefined }, footerUploadPropsRef.value, { onChange: handleOnChange() }), {
393
393
  default: () => ((0, vue_1.h)(flex_1.UFlex, { align: "end", size: "small", wrap: false, class: `${mergedClsPrefixRef.value}-chat-main__input-container` }, {
394
394
  default: () => ((0, vue_1.h)(vue_1.Fragment, null,
395
395
  (0, vue_1.h)(upload_1.UUploadTrigger, { abstract: true }, {
@@ -20,4 +20,8 @@ export type { OlProps } from './src/ol';
20
20
  export { default as ULi } from './src/li';
21
21
  export { default as UText, textProps } from './src/text';
22
22
  export type { TextProps } from './src/text';
23
- export type { TypographyVariant, TypographyVariantOptions, TypographyVariantWeightsOptions } from '../_internal/typography';
23
+ export type { TypographyVariant, TypographyVariantOptions,
24
+ /**
25
+ * @deprecated Weight options are fixed; kept for backwards compatibility.
26
+ */
27
+ TypographyVariantWeightsOptions } from '../_internal/typography';
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.12.5";
1
+ declare const _default: "1.12.6";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.12.5';
3
+ exports.default = '1.12.6';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uzum-tech/ui",
3
- "version": "1.12.5",
3
+ "version": "1.12.6",
4
4
  "description": "A Vue 3 Component Library. Fairly Complete, Theme Customizable, Uses TypeScript, Fast",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "@uzum-tech/ui",
5
- "version": "1.12.5",
5
+ "version": "1.12.6",
6
6
  "js-types-syntax": "typescript",
7
7
  "contributions": {
8
8
  "html": {
@@ -17062,14 +17062,14 @@
17062
17062
  "name": "variantOptions",
17063
17063
  "doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/typography",
17064
17064
  "type": "TypographyVariantOptions",
17065
- "description": "Custom varinats as object: TypographyVariantOptions",
17065
+ "description": "Custom variants as object: TypographyVariantOptions (`fontWeight` is controlled internally; set `defaultFontWeight` inside a variant config to override the default weight used for suffix-less variants)",
17066
17066
  "default": "() => ({})"
17067
17067
  },
17068
17068
  {
17069
17069
  "name": "variantWeightsOptions",
17070
17070
  "doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/typography",
17071
17071
  "type": "TypographyVariantWeightsOptions",
17072
- "description": "Custom varinatWeights as object: Record<PropertyKey, readonly string[]>",
17072
+ "description": "**Deprecated**. Weight options are fixed;",
17073
17073
  "default": "() => ({})"
17074
17074
  }
17075
17075
  ],