@officesdk/design 0.2.3 → 0.2.5
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.
- package/dist/components/cjs/index.d.ts +15 -1
- package/dist/components/cjs/index.js +50 -11
- package/dist/components/cjs/index.js.map +1 -1
- package/dist/components/esm/index.d.ts +15 -1
- package/dist/components/esm/index.js +51 -12
- package/dist/components/esm/index.js.map +1 -1
- package/dist/theme/cjs/index.js +6 -4
- package/dist/theme/cjs/index.js.map +1 -1
- package/dist/theme/esm/index.js +6 -4
- package/dist/theme/esm/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -583,6 +583,11 @@ interface NumberInputProps {
|
|
|
583
583
|
* Placeholder text
|
|
584
584
|
*/
|
|
585
585
|
placeholder?: string;
|
|
586
|
+
/**
|
|
587
|
+
* Whether to show step buttons (increment/decrement)
|
|
588
|
+
* @default true
|
|
589
|
+
*/
|
|
590
|
+
showStepButtons?: boolean;
|
|
586
591
|
/**
|
|
587
592
|
* Callback when value changes
|
|
588
593
|
* @param fixedValue - The clamped value within min/max range (can be undefined if empty)
|
|
@@ -927,6 +932,10 @@ interface TabsProps {
|
|
|
927
932
|
* Tab size
|
|
928
933
|
*/
|
|
929
934
|
size?: 'large';
|
|
935
|
+
/**
|
|
936
|
+
* Tab items alignment (only works for 'line' variant)
|
|
937
|
+
*/
|
|
938
|
+
justify?: 'start' | 'center' | 'end';
|
|
930
939
|
/**
|
|
931
940
|
* Callback when tab changes
|
|
932
941
|
*/
|
|
@@ -1095,7 +1104,7 @@ interface ToolbarButtonProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
|
|
|
1095
1104
|
*/
|
|
1096
1105
|
declare const ToolbarButton: React$1.FC<ToolbarButtonProps>;
|
|
1097
1106
|
|
|
1098
|
-
type DropdownButtonSize = 'large' | 'medium';
|
|
1107
|
+
type DropdownButtonSize = 'large' | 'medium' | 'small';
|
|
1099
1108
|
type DropdownButtonVariant = 'framed' | 'frameless';
|
|
1100
1109
|
interface DropdownButtonProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
1101
1110
|
/**
|
|
@@ -1148,6 +1157,11 @@ interface DropdownButtonProps extends Omit<React$1.ButtonHTMLAttributes<HTMLButt
|
|
|
1148
1157
|
* Custom text style
|
|
1149
1158
|
*/
|
|
1150
1159
|
textStyle?: React$1.CSSProperties;
|
|
1160
|
+
/**
|
|
1161
|
+
* Custom content to render instead of value/placeholder
|
|
1162
|
+
* When provided, value and placeholder are ignored
|
|
1163
|
+
*/
|
|
1164
|
+
children?: React$1.ReactNode;
|
|
1151
1165
|
}
|
|
1152
1166
|
/**
|
|
1153
1167
|
* DropdownButton Component
|
|
@@ -1291,10 +1291,26 @@ var init_Slider2 = __esm({
|
|
|
1291
1291
|
init_valueMap();
|
|
1292
1292
|
}
|
|
1293
1293
|
});
|
|
1294
|
-
var NumberInputContainer, InputWrapper, UnitText, StyledInput, ButtonGroup, StepButton, UpArrow, DownArrow; exports.NumberInput = void 0;
|
|
1294
|
+
var getDecimalPlaces, precisionAdd, precisionSubtract, NumberInputContainer, InputWrapper, UnitText, StyledInput, ButtonGroup, StepButton, UpArrow, DownArrow; exports.NumberInput = void 0;
|
|
1295
1295
|
var init_NumberInput = __esm({
|
|
1296
1296
|
"src/NumberInput/NumberInput.tsx"() {
|
|
1297
1297
|
init_styled();
|
|
1298
|
+
getDecimalPlaces = (num) => {
|
|
1299
|
+
const str = String(num);
|
|
1300
|
+
const decimalIndex = str.indexOf(".");
|
|
1301
|
+
if (decimalIndex === -1) return 0;
|
|
1302
|
+
return str.length - decimalIndex - 1;
|
|
1303
|
+
};
|
|
1304
|
+
precisionAdd = (a, b) => {
|
|
1305
|
+
const precision = Math.max(getDecimalPlaces(a), getDecimalPlaces(b));
|
|
1306
|
+
const multiplier = Math.pow(10, precision);
|
|
1307
|
+
return Math.round(a * multiplier + b * multiplier) / multiplier;
|
|
1308
|
+
};
|
|
1309
|
+
precisionSubtract = (a, b) => {
|
|
1310
|
+
const precision = Math.max(getDecimalPlaces(a), getDecimalPlaces(b));
|
|
1311
|
+
const multiplier = Math.pow(10, precision);
|
|
1312
|
+
return Math.round(a * multiplier - b * multiplier) / multiplier;
|
|
1313
|
+
};
|
|
1298
1314
|
NumberInputContainer = exports.styled.div`
|
|
1299
1315
|
display: inline-flex;
|
|
1300
1316
|
align-items: center;
|
|
@@ -1484,6 +1500,7 @@ var init_NumberInput = __esm({
|
|
|
1484
1500
|
parser,
|
|
1485
1501
|
unit,
|
|
1486
1502
|
placeholder,
|
|
1503
|
+
showStepButtons = true,
|
|
1487
1504
|
onChange,
|
|
1488
1505
|
className,
|
|
1489
1506
|
style
|
|
@@ -1545,13 +1562,23 @@ var init_NumberInput = __esm({
|
|
|
1545
1562
|
const increment = React3.useCallback(() => {
|
|
1546
1563
|
if (disabled) return;
|
|
1547
1564
|
const currentValue = value ?? 0;
|
|
1548
|
-
|
|
1549
|
-
|
|
1565
|
+
const newValue = precisionAdd(currentValue, step);
|
|
1566
|
+
handleValueChange(newValue);
|
|
1567
|
+
if (isFocused) {
|
|
1568
|
+
const clampedValue = clampValue(newValue);
|
|
1569
|
+
setDisplayValue(formatValue(clampedValue));
|
|
1570
|
+
}
|
|
1571
|
+
}, [disabled, value, step, handleValueChange, isFocused, clampValue, formatValue]);
|
|
1550
1572
|
const decrement = React3.useCallback(() => {
|
|
1551
1573
|
if (disabled) return;
|
|
1552
1574
|
const currentValue = value ?? 0;
|
|
1553
|
-
|
|
1554
|
-
|
|
1575
|
+
const newValue = precisionSubtract(currentValue, step);
|
|
1576
|
+
handleValueChange(newValue);
|
|
1577
|
+
if (isFocused) {
|
|
1578
|
+
const clampedValue = clampValue(newValue);
|
|
1579
|
+
setDisplayValue(formatValue(clampedValue));
|
|
1580
|
+
}
|
|
1581
|
+
}, [disabled, value, step, handleValueChange, isFocused, clampValue, formatValue]);
|
|
1555
1582
|
const handleInputChange = React3.useCallback((e) => {
|
|
1556
1583
|
setDisplayValue(e.target.value);
|
|
1557
1584
|
}, []);
|
|
@@ -1618,7 +1645,7 @@ var init_NumberInput = __esm({
|
|
|
1618
1645
|
$disabled: disabled
|
|
1619
1646
|
}
|
|
1620
1647
|
), unit && /* @__PURE__ */ React3__default.default.createElement(UnitText, { $size: size, $disabled: disabled }, unit)),
|
|
1621
|
-
/* @__PURE__ */ React3__default.default.createElement(ButtonGroup, { $alert: alert, $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(
|
|
1648
|
+
showStepButtons && /* @__PURE__ */ React3__default.default.createElement(ButtonGroup, { $alert: alert, $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(
|
|
1622
1649
|
StepButton,
|
|
1623
1650
|
{
|
|
1624
1651
|
type: "button",
|
|
@@ -2869,10 +2896,12 @@ var TabList = exports.styled.div`
|
|
|
2869
2896
|
height: 100%;
|
|
2870
2897
|
|
|
2871
2898
|
|
|
2872
|
-
${({ $variant, theme: theme2 }) => {
|
|
2899
|
+
${({ $variant, $justify, theme: theme2 }) => {
|
|
2873
2900
|
const variantConfig = theme2.components.tab[$variant];
|
|
2901
|
+
const justifyContent = $variant === "line" ? $justify === "center" ? "center" : $justify === "end" ? "flex-end" : "flex-start" : "flex-start";
|
|
2874
2902
|
return `
|
|
2875
2903
|
gap: ${variantConfig.layout.gap};
|
|
2904
|
+
justify-content: ${justifyContent};
|
|
2876
2905
|
`;
|
|
2877
2906
|
}}
|
|
2878
2907
|
|
|
@@ -3003,6 +3032,7 @@ var Tabs = ({
|
|
|
3003
3032
|
variant = "line",
|
|
3004
3033
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3005
3034
|
size: _size = "large",
|
|
3035
|
+
justify = "start",
|
|
3006
3036
|
onChange,
|
|
3007
3037
|
className,
|
|
3008
3038
|
style,
|
|
@@ -3023,7 +3053,7 @@ var Tabs = ({
|
|
|
3023
3053
|
},
|
|
3024
3054
|
[controlledActiveKey, onChange]
|
|
3025
3055
|
);
|
|
3026
|
-
return /* @__PURE__ */ React3__default.default.createElement(TabContainer, { $variant: variant, className, style }, /* @__PURE__ */ React3__default.default.createElement(TabList, { $variant: variant, role: "tablist" }, items.map((item) => /* @__PURE__ */ React3__default.default.createElement(
|
|
3056
|
+
return /* @__PURE__ */ React3__default.default.createElement(TabContainer, { $variant: variant, className, style }, /* @__PURE__ */ React3__default.default.createElement(TabList, { $variant: variant, $justify: justify, role: "tablist" }, items.map((item) => /* @__PURE__ */ React3__default.default.createElement(
|
|
3027
3057
|
TabItem,
|
|
3028
3058
|
{
|
|
3029
3059
|
key: item.key,
|
|
@@ -3238,6 +3268,8 @@ var TooltipGlobalStyles = baseStyled.createGlobalStyle`
|
|
|
3238
3268
|
line-height: ${() => exports.getGlobalTheme().components.tooltip.black.lineHeight};
|
|
3239
3269
|
font-weight: ${() => exports.getGlobalTheme().components.tooltip.black.fontWeight};
|
|
3240
3270
|
max-width: ${() => exports.getGlobalTheme().components.tooltip.black.maxWidth};
|
|
3271
|
+
white-space: normal;
|
|
3272
|
+
word-wrap: break-word;
|
|
3241
3273
|
text-align: left;
|
|
3242
3274
|
text-decoration: none;
|
|
3243
3275
|
}
|
|
@@ -3257,6 +3289,9 @@ var TooltipGlobalStyles = baseStyled.createGlobalStyle`
|
|
|
3257
3289
|
font-size: ${() => exports.getGlobalTheme().components.tooltip.white.small.fontSize};
|
|
3258
3290
|
line-height: ${() => exports.getGlobalTheme().components.tooltip.white.small.lineHeight};
|
|
3259
3291
|
font-weight: ${() => exports.getGlobalTheme().components.tooltip.white.small.fontWeight};
|
|
3292
|
+
max-width: ${() => exports.getGlobalTheme().components.tooltip.white.small.maxWidth};
|
|
3293
|
+
white-space: normal;
|
|
3294
|
+
word-wrap: break-word;
|
|
3260
3295
|
text-align: left;
|
|
3261
3296
|
text-decoration: none;
|
|
3262
3297
|
}
|
|
@@ -3276,6 +3311,9 @@ var TooltipGlobalStyles = baseStyled.createGlobalStyle`
|
|
|
3276
3311
|
font-size: ${() => exports.getGlobalTheme().components.tooltip.white.large.fontSize};
|
|
3277
3312
|
line-height: ${() => exports.getGlobalTheme().components.tooltip.white.large.lineHeight};
|
|
3278
3313
|
font-weight: ${() => exports.getGlobalTheme().components.tooltip.white.large.fontWeight};
|
|
3314
|
+
max-width: ${() => exports.getGlobalTheme().components.tooltip.white.large.maxWidth};
|
|
3315
|
+
white-space: normal;
|
|
3316
|
+
word-wrap: break-word;
|
|
3279
3317
|
text-align: left;
|
|
3280
3318
|
text-decoration: none;
|
|
3281
3319
|
}
|
|
@@ -3667,7 +3705,7 @@ var ToolbarButton = ({
|
|
|
3667
3705
|
},
|
|
3668
3706
|
renderIcon(),
|
|
3669
3707
|
renderLabel(),
|
|
3670
|
-
/* @__PURE__ */ React3__default.default.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(icons.
|
|
3708
|
+
/* @__PURE__ */ React3__default.default.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(icons.ArrowDownIcon, null))
|
|
3671
3709
|
)
|
|
3672
3710
|
);
|
|
3673
3711
|
}
|
|
@@ -3703,7 +3741,7 @@ var ToolbarButton = ({
|
|
|
3703
3741
|
onClick: handleDropdownClick,
|
|
3704
3742
|
disabled
|
|
3705
3743
|
},
|
|
3706
|
-
/* @__PURE__ */ React3__default.default.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(icons.
|
|
3744
|
+
/* @__PURE__ */ React3__default.default.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(icons.ArrowDownIcon, null))
|
|
3707
3745
|
)
|
|
3708
3746
|
);
|
|
3709
3747
|
}
|
|
@@ -3896,6 +3934,7 @@ var DropdownButton2 = React3.forwardRef(
|
|
|
3896
3934
|
style,
|
|
3897
3935
|
textStyle,
|
|
3898
3936
|
onClick,
|
|
3937
|
+
children,
|
|
3899
3938
|
...rest
|
|
3900
3939
|
}, ref) => {
|
|
3901
3940
|
const effectiveSize = size || (variant === "framed" ? "large" : "medium");
|
|
@@ -3925,7 +3964,7 @@ var DropdownButton2 = React3.forwardRef(
|
|
|
3925
3964
|
...rest
|
|
3926
3965
|
},
|
|
3927
3966
|
iconElement && /* @__PURE__ */ React3__default.default.createElement(IconWrapper5, { $size: effectiveSize }, iconElement),
|
|
3928
|
-
/* @__PURE__ */ React3__default.default.createElement(TextContent, { $disabled: disabled, $hasValue: hasValue, style: textStyle }, value || placeholder),
|
|
3967
|
+
children ? children : /* @__PURE__ */ React3__default.default.createElement(TextContent, { $disabled: disabled, $hasValue: hasValue, style: textStyle }, value || placeholder),
|
|
3929
3968
|
/* @__PURE__ */ React3__default.default.createElement(IndicatorWrapper, { $size: effectiveSize, $open: open, $disabled: disabled }, indicatorIcon || /* @__PURE__ */ React3__default.default.createElement(icons.ArrowRightIcon, null))
|
|
3930
3969
|
);
|
|
3931
3970
|
}
|