@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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ReactDOM from 'react-dom';
|
|
2
2
|
import React3, { forwardRef, useState, useEffect, createContext, useCallback, useContext, useMemo, useRef } from 'react';
|
|
3
|
-
import { ArrowRightIcon, CloseIcon, SearchIcon, ErrorIcon, WarningIcon, InfoIcon, SuccessIcon, CheckIcon
|
|
3
|
+
import { ArrowRightIcon, CloseIcon, SearchIcon, ErrorIcon, WarningIcon, InfoIcon, SuccessIcon, CheckIcon } from '@officesdk/design/icons';
|
|
4
4
|
import { lightTheme } from '@officesdk/design/theme';
|
|
5
5
|
import baseStyled, { createGlobalStyle as createGlobalStyle$1 } from 'styled-components';
|
|
6
6
|
import RcTooltip from 'rc-tooltip';
|
|
@@ -1851,7 +1851,10 @@ var init_NumberInput = __esm({
|
|
|
1851
1851
|
useThousandsSeparator = false,
|
|
1852
1852
|
onChange,
|
|
1853
1853
|
className,
|
|
1854
|
-
style
|
|
1854
|
+
style,
|
|
1855
|
+
onFocus: onFocusProp,
|
|
1856
|
+
onBlur: onBlurProp,
|
|
1857
|
+
onInputChange
|
|
1855
1858
|
}) => {
|
|
1856
1859
|
const config = useUIConfig();
|
|
1857
1860
|
const locale = config?.locale ?? "en-US";
|
|
@@ -1951,29 +1954,44 @@ var init_NumberInput = __esm({
|
|
|
1951
1954
|
setDisplayValue(formatValueForEdit(clampedValue));
|
|
1952
1955
|
}
|
|
1953
1956
|
}, [disabled, value, step, handleValueChange, isFocused, clampValue, formatValueForEdit]);
|
|
1954
|
-
const handleInputChange = useCallback(
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1957
|
+
const handleInputChange = useCallback(
|
|
1958
|
+
(e) => {
|
|
1959
|
+
const inputValue = e.target.value;
|
|
1960
|
+
setDisplayValue(inputValue);
|
|
1961
|
+
const trimmed = inputValue.trim();
|
|
1962
|
+
const parsedValue = trimmed === "" ? void 0 : parseValue(trimmed) ?? void 0;
|
|
1963
|
+
onInputChange?.(inputValue, parsedValue);
|
|
1964
|
+
},
|
|
1965
|
+
[parseValue, onInputChange]
|
|
1966
|
+
);
|
|
1967
|
+
const handleBlur = useCallback(
|
|
1968
|
+
(e) => {
|
|
1969
|
+
setIsFocused(false);
|
|
1970
|
+
const trimmedValue = displayValue.trim();
|
|
1971
|
+
if (trimmedValue === "") {
|
|
1972
|
+
handleValueChange(void 0);
|
|
1973
|
+
setDisplayValue("");
|
|
1968
1974
|
} else {
|
|
1969
|
-
|
|
1975
|
+
const parsed = parseValue(trimmedValue);
|
|
1976
|
+
if (parsed !== null) {
|
|
1977
|
+
const preciseValue = applyPrecision(parsed);
|
|
1978
|
+
handleValueChange(preciseValue);
|
|
1979
|
+
} else {
|
|
1980
|
+
setDisplayValue(formatValue(value));
|
|
1981
|
+
}
|
|
1970
1982
|
}
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1983
|
+
onBlurProp?.(e);
|
|
1984
|
+
},
|
|
1985
|
+
[displayValue, parseValue, handleValueChange, value, formatValue, applyPrecision, onBlurProp]
|
|
1986
|
+
);
|
|
1987
|
+
const handleFocus = useCallback(
|
|
1988
|
+
(e) => {
|
|
1989
|
+
setIsFocused(true);
|
|
1990
|
+
setDisplayValue(formatValueForEdit(value));
|
|
1991
|
+
onFocusProp?.(e);
|
|
1992
|
+
},
|
|
1993
|
+
[value, formatValueForEdit, onFocusProp]
|
|
1994
|
+
);
|
|
1977
1995
|
const handleKeyDown = useCallback(
|
|
1978
1996
|
(e) => {
|
|
1979
1997
|
if (e.key === "ArrowUp") {
|
|
@@ -2091,7 +2109,8 @@ var init_SpinButton = __esm({
|
|
|
2091
2109
|
parser,
|
|
2092
2110
|
onChange,
|
|
2093
2111
|
className,
|
|
2094
|
-
style
|
|
2112
|
+
style,
|
|
2113
|
+
inputProps
|
|
2095
2114
|
}) => {
|
|
2096
2115
|
const [internalValue, setInternalValue] = useState(controlledValue ?? defaultValue);
|
|
2097
2116
|
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
@@ -2132,6 +2151,7 @@ var init_SpinButton = __esm({
|
|
|
2132
2151
|
precision,
|
|
2133
2152
|
formatter,
|
|
2134
2153
|
parser,
|
|
2154
|
+
...inputProps,
|
|
2135
2155
|
onChange: handleValueChange
|
|
2136
2156
|
}
|
|
2137
2157
|
));
|
|
@@ -3662,6 +3682,9 @@ Tooltip.displayName = "Tooltip";
|
|
|
3662
3682
|
|
|
3663
3683
|
// src/ToolbarButton/ToolbarButton.tsx
|
|
3664
3684
|
init_styled();
|
|
3685
|
+
var ArrowDownIcon = () => {
|
|
3686
|
+
return /* @__PURE__ */ React3.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React3.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" }));
|
|
3687
|
+
};
|
|
3665
3688
|
var ToolbarButtonContainer = styled.div`
|
|
3666
3689
|
display: inline-flex;
|
|
3667
3690
|
align-items: center;
|