@officesdk/design 0.2.6 → 0.2.7
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 +126 -106
- package/dist/components/cjs/index.js +48 -25
- package/dist/components/cjs/index.js.map +1 -1
- package/dist/components/esm/index.d.ts +126 -106
- package/dist/components/esm/index.js +47 -24
- package/dist/components/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -73,6 +73,125 @@ interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
73
73
|
*/
|
|
74
74
|
declare const Button: React$1.FC<ButtonProps>;
|
|
75
75
|
|
|
76
|
+
type LineType$1 = 'outlined' | 'underlined' | 'borderless';
|
|
77
|
+
interface NumberInputProps {
|
|
78
|
+
/**
|
|
79
|
+
* Current value
|
|
80
|
+
*/
|
|
81
|
+
value?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Default value
|
|
84
|
+
*/
|
|
85
|
+
defaultValue?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Minimum value
|
|
88
|
+
*/
|
|
89
|
+
min?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Maximum value
|
|
92
|
+
*/
|
|
93
|
+
max?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Step increment/decrement
|
|
96
|
+
*/
|
|
97
|
+
step?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Size variant
|
|
100
|
+
*/
|
|
101
|
+
size?: 'small' | 'large';
|
|
102
|
+
/**
|
|
103
|
+
* Whether the input is disabled
|
|
104
|
+
*/
|
|
105
|
+
disabled?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Whether to show alert state (red border)
|
|
108
|
+
*/
|
|
109
|
+
alert?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Number of decimal places
|
|
112
|
+
*/
|
|
113
|
+
precision?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Format the display value
|
|
116
|
+
*/
|
|
117
|
+
formatter?: (value: number) => string;
|
|
118
|
+
/**
|
|
119
|
+
* Parse the input value
|
|
120
|
+
*/
|
|
121
|
+
parser?: (displayValue: string) => number;
|
|
122
|
+
/**
|
|
123
|
+
* Unit text to display after the input
|
|
124
|
+
*/
|
|
125
|
+
unit?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Placeholder text
|
|
128
|
+
*/
|
|
129
|
+
placeholder?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Whether to show step buttons (increment/decrement)
|
|
132
|
+
* @default true
|
|
133
|
+
*/
|
|
134
|
+
showStepButtons?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Trigger mode for showing step buttons
|
|
137
|
+
* - 'normal': always show (default)
|
|
138
|
+
* - 'hover': show only on hover
|
|
139
|
+
* @default 'normal'
|
|
140
|
+
*/
|
|
141
|
+
showStepButtonsTrigger?: 'hover' | 'normal';
|
|
142
|
+
/**
|
|
143
|
+
* Input line type
|
|
144
|
+
* - 'outlined': with full border (default)
|
|
145
|
+
* - 'underlined': with bottom border only
|
|
146
|
+
* - 'borderless': no border
|
|
147
|
+
* @default 'outlined'
|
|
148
|
+
*/
|
|
149
|
+
lineType?: LineType$1;
|
|
150
|
+
/**
|
|
151
|
+
* Whether to use thousands separator in display
|
|
152
|
+
* @default false
|
|
153
|
+
*/
|
|
154
|
+
useThousandsSeparator?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Callback when value changes
|
|
157
|
+
* @param fixedValue - The clamped value within min/max range (can be undefined if empty)
|
|
158
|
+
* @param rawValue - The original input value before clamping (can be undefined if empty)
|
|
159
|
+
*/
|
|
160
|
+
onChange?: (fixedValue: number | undefined, rawValue: number | undefined) => void;
|
|
161
|
+
/**
|
|
162
|
+
* Custom className
|
|
163
|
+
*/
|
|
164
|
+
className?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Custom style
|
|
167
|
+
*/
|
|
168
|
+
style?: React$1.CSSProperties;
|
|
169
|
+
/**
|
|
170
|
+
* Callback when input receives focus
|
|
171
|
+
*/
|
|
172
|
+
onFocus?: (e: React$1.FocusEvent<HTMLInputElement>) => void;
|
|
173
|
+
/**
|
|
174
|
+
* Callback when input loses focus
|
|
175
|
+
*/
|
|
176
|
+
onBlur?: (e: React$1.FocusEvent<HTMLInputElement>) => void;
|
|
177
|
+
/**
|
|
178
|
+
* Callback when input value changes during typing
|
|
179
|
+
* Useful for real-time validation (e.g., check if value is multiple of 3)
|
|
180
|
+
* @param inputValue - The raw input string
|
|
181
|
+
* @param parsedValue - The parsed number value (undefined if invalid)
|
|
182
|
+
*/
|
|
183
|
+
onInputChange?: (inputValue: string, parsedValue: number | undefined) => void;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* NumberInput Component
|
|
187
|
+
*
|
|
188
|
+
* A numeric input with increment/decrement buttons
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* <NumberInput value={35} onChange={(val) => console.log(val)} />
|
|
192
|
+
*/
|
|
193
|
+
declare const NumberInput: React$1.FC<NumberInputProps>;
|
|
194
|
+
|
|
76
195
|
interface SpinButtonProps {
|
|
77
196
|
/**
|
|
78
197
|
* Current value
|
|
@@ -134,6 +253,11 @@ interface SpinButtonProps {
|
|
|
134
253
|
* Custom style
|
|
135
254
|
*/
|
|
136
255
|
style?: React$1.CSSProperties;
|
|
256
|
+
/**
|
|
257
|
+
* Additional props passed to the internal NumberInput component
|
|
258
|
+
* Allows customizing unit, placeholder, lineType, showStepButtons, etc.
|
|
259
|
+
*/
|
|
260
|
+
inputProps?: Partial<Omit<NumberInputProps, 'value' | 'defaultValue' | 'min' | 'max' | 'step' | 'size' | 'disabled' | 'alert' | 'precision' | 'formatter' | 'parser' | 'onChange' | 'className' | 'style'>>;
|
|
137
261
|
}
|
|
138
262
|
/**
|
|
139
263
|
* SpinButton Component - Spin Button
|
|
@@ -386,12 +510,12 @@ interface SliderProps {
|
|
|
386
510
|
declare const Slider: React$1.FC<SliderProps>;
|
|
387
511
|
|
|
388
512
|
type InputSize = 'mini' | 'small' | 'medium' | 'large';
|
|
389
|
-
type LineType
|
|
513
|
+
type LineType = 'outlined' | 'underlined' | 'borderless';
|
|
390
514
|
interface InputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
|
391
515
|
/**
|
|
392
516
|
* Input line type
|
|
393
517
|
*/
|
|
394
|
-
lineType?: LineType
|
|
518
|
+
lineType?: LineType;
|
|
395
519
|
/**
|
|
396
520
|
* Input size
|
|
397
521
|
*/
|
|
@@ -530,110 +654,6 @@ declare const SearchInput: React$1.ForwardRefExoticComponent<SearchInputProps &
|
|
|
530
654
|
*/
|
|
531
655
|
declare const UnderlinedInput: React$1.ForwardRefExoticComponent<Omit<InputProps, "lineType"> & React$1.RefAttributes<HTMLInputElement>>;
|
|
532
656
|
|
|
533
|
-
type LineType = 'outlined' | 'underlined' | 'borderless';
|
|
534
|
-
interface NumberInputProps {
|
|
535
|
-
/**
|
|
536
|
-
* Current value
|
|
537
|
-
*/
|
|
538
|
-
value?: number;
|
|
539
|
-
/**
|
|
540
|
-
* Default value
|
|
541
|
-
*/
|
|
542
|
-
defaultValue?: number;
|
|
543
|
-
/**
|
|
544
|
-
* Minimum value
|
|
545
|
-
*/
|
|
546
|
-
min?: number;
|
|
547
|
-
/**
|
|
548
|
-
* Maximum value
|
|
549
|
-
*/
|
|
550
|
-
max?: number;
|
|
551
|
-
/**
|
|
552
|
-
* Step increment/decrement
|
|
553
|
-
*/
|
|
554
|
-
step?: number;
|
|
555
|
-
/**
|
|
556
|
-
* Size variant
|
|
557
|
-
*/
|
|
558
|
-
size?: 'small' | 'large';
|
|
559
|
-
/**
|
|
560
|
-
* Whether the input is disabled
|
|
561
|
-
*/
|
|
562
|
-
disabled?: boolean;
|
|
563
|
-
/**
|
|
564
|
-
* Whether to show alert state (red border)
|
|
565
|
-
*/
|
|
566
|
-
alert?: boolean;
|
|
567
|
-
/**
|
|
568
|
-
* Number of decimal places
|
|
569
|
-
*/
|
|
570
|
-
precision?: number;
|
|
571
|
-
/**
|
|
572
|
-
* Format the display value
|
|
573
|
-
*/
|
|
574
|
-
formatter?: (value: number) => string;
|
|
575
|
-
/**
|
|
576
|
-
* Parse the input value
|
|
577
|
-
*/
|
|
578
|
-
parser?: (displayValue: string) => number;
|
|
579
|
-
/**
|
|
580
|
-
* Unit text to display after the input
|
|
581
|
-
*/
|
|
582
|
-
unit?: string;
|
|
583
|
-
/**
|
|
584
|
-
* Placeholder text
|
|
585
|
-
*/
|
|
586
|
-
placeholder?: string;
|
|
587
|
-
/**
|
|
588
|
-
* Whether to show step buttons (increment/decrement)
|
|
589
|
-
* @default true
|
|
590
|
-
*/
|
|
591
|
-
showStepButtons?: boolean;
|
|
592
|
-
/**
|
|
593
|
-
* Trigger mode for showing step buttons
|
|
594
|
-
* - 'normal': always show (default)
|
|
595
|
-
* - 'hover': show only on hover
|
|
596
|
-
* @default 'normal'
|
|
597
|
-
*/
|
|
598
|
-
showStepButtonsTrigger?: 'hover' | 'normal';
|
|
599
|
-
/**
|
|
600
|
-
* Input line type
|
|
601
|
-
* - 'outlined': with full border (default)
|
|
602
|
-
* - 'underlined': with bottom border only
|
|
603
|
-
* - 'borderless': no border
|
|
604
|
-
* @default 'outlined'
|
|
605
|
-
*/
|
|
606
|
-
lineType?: LineType;
|
|
607
|
-
/**
|
|
608
|
-
* Whether to use thousands separator in display
|
|
609
|
-
* @default false
|
|
610
|
-
*/
|
|
611
|
-
useThousandsSeparator?: boolean;
|
|
612
|
-
/**
|
|
613
|
-
* Callback when value changes
|
|
614
|
-
* @param fixedValue - The clamped value within min/max range (can be undefined if empty)
|
|
615
|
-
* @param rawValue - The original input value before clamping (can be undefined if empty)
|
|
616
|
-
*/
|
|
617
|
-
onChange?: (fixedValue: number | undefined, rawValue: number | undefined) => void;
|
|
618
|
-
/**
|
|
619
|
-
* Custom className
|
|
620
|
-
*/
|
|
621
|
-
className?: string;
|
|
622
|
-
/**
|
|
623
|
-
* Custom style
|
|
624
|
-
*/
|
|
625
|
-
style?: React$1.CSSProperties;
|
|
626
|
-
}
|
|
627
|
-
/**
|
|
628
|
-
* NumberInput Component
|
|
629
|
-
*
|
|
630
|
-
* A numeric input with increment/decrement buttons
|
|
631
|
-
*
|
|
632
|
-
* @example
|
|
633
|
-
* <NumberInput value={35} onChange={(val) => console.log(val)} />
|
|
634
|
-
*/
|
|
635
|
-
declare const NumberInput: React$1.FC<NumberInputProps>;
|
|
636
|
-
|
|
637
657
|
interface IconSize {
|
|
638
658
|
width: string;
|
|
639
659
|
height: string;
|
|
@@ -1864,7 +1864,10 @@ var init_NumberInput = __esm({
|
|
|
1864
1864
|
useThousandsSeparator = false,
|
|
1865
1865
|
onChange,
|
|
1866
1866
|
className,
|
|
1867
|
-
style
|
|
1867
|
+
style,
|
|
1868
|
+
onFocus: onFocusProp,
|
|
1869
|
+
onBlur: onBlurProp,
|
|
1870
|
+
onInputChange
|
|
1868
1871
|
}) => {
|
|
1869
1872
|
const config = exports.useUIConfig();
|
|
1870
1873
|
const locale = config?.locale ?? "en-US";
|
|
@@ -1964,29 +1967,44 @@ var init_NumberInput = __esm({
|
|
|
1964
1967
|
setDisplayValue(formatValueForEdit(clampedValue));
|
|
1965
1968
|
}
|
|
1966
1969
|
}, [disabled, value, step, handleValueChange, isFocused, clampValue, formatValueForEdit]);
|
|
1967
|
-
const handleInputChange = React3.useCallback(
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1970
|
+
const handleInputChange = React3.useCallback(
|
|
1971
|
+
(e) => {
|
|
1972
|
+
const inputValue = e.target.value;
|
|
1973
|
+
setDisplayValue(inputValue);
|
|
1974
|
+
const trimmed = inputValue.trim();
|
|
1975
|
+
const parsedValue = trimmed === "" ? void 0 : parseValue(trimmed) ?? void 0;
|
|
1976
|
+
onInputChange?.(inputValue, parsedValue);
|
|
1977
|
+
},
|
|
1978
|
+
[parseValue, onInputChange]
|
|
1979
|
+
);
|
|
1980
|
+
const handleBlur = React3.useCallback(
|
|
1981
|
+
(e) => {
|
|
1982
|
+
setIsFocused(false);
|
|
1983
|
+
const trimmedValue = displayValue.trim();
|
|
1984
|
+
if (trimmedValue === "") {
|
|
1985
|
+
handleValueChange(void 0);
|
|
1986
|
+
setDisplayValue("");
|
|
1981
1987
|
} else {
|
|
1982
|
-
|
|
1988
|
+
const parsed = parseValue(trimmedValue);
|
|
1989
|
+
if (parsed !== null) {
|
|
1990
|
+
const preciseValue = applyPrecision(parsed);
|
|
1991
|
+
handleValueChange(preciseValue);
|
|
1992
|
+
} else {
|
|
1993
|
+
setDisplayValue(formatValue(value));
|
|
1994
|
+
}
|
|
1983
1995
|
}
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1996
|
+
onBlurProp?.(e);
|
|
1997
|
+
},
|
|
1998
|
+
[displayValue, parseValue, handleValueChange, value, formatValue, applyPrecision, onBlurProp]
|
|
1999
|
+
);
|
|
2000
|
+
const handleFocus = React3.useCallback(
|
|
2001
|
+
(e) => {
|
|
2002
|
+
setIsFocused(true);
|
|
2003
|
+
setDisplayValue(formatValueForEdit(value));
|
|
2004
|
+
onFocusProp?.(e);
|
|
2005
|
+
},
|
|
2006
|
+
[value, formatValueForEdit, onFocusProp]
|
|
2007
|
+
);
|
|
1990
2008
|
const handleKeyDown = React3.useCallback(
|
|
1991
2009
|
(e) => {
|
|
1992
2010
|
if (e.key === "ArrowUp") {
|
|
@@ -2104,7 +2122,8 @@ var init_SpinButton = __esm({
|
|
|
2104
2122
|
parser,
|
|
2105
2123
|
onChange,
|
|
2106
2124
|
className,
|
|
2107
|
-
style
|
|
2125
|
+
style,
|
|
2126
|
+
inputProps
|
|
2108
2127
|
}) => {
|
|
2109
2128
|
const [internalValue, setInternalValue] = React3.useState(controlledValue ?? defaultValue);
|
|
2110
2129
|
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
@@ -2145,6 +2164,7 @@ var init_SpinButton = __esm({
|
|
|
2145
2164
|
precision,
|
|
2146
2165
|
formatter,
|
|
2147
2166
|
parser,
|
|
2167
|
+
...inputProps,
|
|
2148
2168
|
onChange: handleValueChange
|
|
2149
2169
|
}
|
|
2150
2170
|
));
|
|
@@ -3675,6 +3695,9 @@ Tooltip.displayName = "Tooltip";
|
|
|
3675
3695
|
|
|
3676
3696
|
// src/ToolbarButton/ToolbarButton.tsx
|
|
3677
3697
|
init_styled();
|
|
3698
|
+
var ArrowDownIcon = () => {
|
|
3699
|
+
return /* @__PURE__ */ React3__default.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React3__default.default.createElement("path", { d: "M8.1858 9.79353C8.08649 9.90387 7.91346 9.90387 7.81415 9.79353L4.77549 6.41724C4.6307 6.25636 4.74487 6 4.96132 6L11.0386 6C11.2551 6 11.3693 6.25636 11.2245 6.41724L8.1858 9.79353Z", fill: "#41464B", fillOpacity: "0.6" }));
|
|
3700
|
+
};
|
|
3678
3701
|
var ToolbarButtonContainer = exports.styled.div`
|
|
3679
3702
|
display: inline-flex;
|
|
3680
3703
|
align-items: center;
|
|
@@ -3975,7 +3998,7 @@ var ToolbarButton = ({
|
|
|
3975
3998
|
},
|
|
3976
3999
|
renderIcon(),
|
|
3977
4000
|
renderLabel(),
|
|
3978
|
-
/* @__PURE__ */ React3__default.default.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(
|
|
4001
|
+
/* @__PURE__ */ React3__default.default.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(ArrowDownIcon, null))
|
|
3979
4002
|
)
|
|
3980
4003
|
);
|
|
3981
4004
|
}
|
|
@@ -4011,7 +4034,7 @@ var ToolbarButton = ({
|
|
|
4011
4034
|
onClick: handleDropdownClick,
|
|
4012
4035
|
disabled
|
|
4013
4036
|
},
|
|
4014
|
-
/* @__PURE__ */ React3__default.default.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(
|
|
4037
|
+
/* @__PURE__ */ React3__default.default.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3__default.default.createElement(ArrowDownIcon, null))
|
|
4015
4038
|
)
|
|
4016
4039
|
);
|
|
4017
4040
|
}
|