@officesdk/design 0.2.8 → 0.2.10

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.
@@ -1601,29 +1601,12 @@ var init_numberLocale = __esm({
1601
1601
  };
1602
1602
  }
1603
1603
  });
1604
- var getDecimalPlaces, precisionAdd, precisionSubtract, NumberInputContainer, InputWrapper, UnitText, StyledInput, ButtonGroup, StepButton, UpArrow, DownArrow, NumberInput;
1605
- var init_NumberInput = __esm({
1606
- "src/NumberInput/NumberInput.tsx"() {
1604
+
1605
+ // src/NumberInput/NumberInput.styled.ts
1606
+ var NumberInputContainer, InputWrapper, StyledInput, ButtonGroup, StepButton;
1607
+ var init_NumberInput_styled = __esm({
1608
+ "src/NumberInput/NumberInput.styled.ts"() {
1607
1609
  init_styled();
1608
- init_UIConfigProvider2();
1609
- init_numberLocale();
1610
- init_valueMap();
1611
- getDecimalPlaces = (num) => {
1612
- const str = String(num);
1613
- const decimalIndex = str.indexOf(".");
1614
- if (decimalIndex === -1) return 0;
1615
- return str.length - decimalIndex - 1;
1616
- };
1617
- precisionAdd = (a, b) => {
1618
- const precision = Math.max(getDecimalPlaces(a), getDecimalPlaces(b));
1619
- const multiplier = Math.pow(10, precision);
1620
- return Math.round(a * multiplier + b * multiplier) / multiplier;
1621
- };
1622
- precisionSubtract = (a, b) => {
1623
- const precision = Math.max(getDecimalPlaces(a), getDecimalPlaces(b));
1624
- const multiplier = Math.pow(10, precision);
1625
- return Math.round(a * multiplier - b * multiplier) / multiplier;
1626
- };
1627
1610
  NumberInputContainer = styled.div`
1628
1611
  display: inline-flex;
1629
1612
  align-items: center;
@@ -1694,25 +1677,6 @@ var init_NumberInput = __esm({
1694
1677
  align-items: center;
1695
1678
  padding: 0 8px;
1696
1679
  min-width: 0;
1697
- gap: 4px;
1698
- `;
1699
- UnitText = styled.span`
1700
- flex-shrink: 0;
1701
- font-family: 'PingFang SC', sans-serif;
1702
- font-weight: 400;
1703
- line-height: 20px;
1704
-
1705
- ${({ $size }) => $size === "small" ? `
1706
- font-size: 12px;
1707
- ` : `
1708
- font-size: 13px;
1709
- `}
1710
-
1711
- ${({ $disabled, theme: theme2 }) => $disabled ? `
1712
- color: ${theme2.colors.palettes.transparency["30"]};
1713
- ` : `
1714
- color: ${theme2.colors.palettes.gray["120"]};
1715
- `}
1716
1680
  `;
1717
1681
  StyledInput = styled.input`
1718
1682
  width: 100%;
@@ -1830,6 +1794,31 @@ var init_NumberInput = __esm({
1830
1794
  fill: ${({ $disabled, theme: theme2 }) => $disabled ? theme2.colors.palettes.transparency["30"] : theme2.colors.palettes.gray["120"]};
1831
1795
  }
1832
1796
  `;
1797
+ }
1798
+ });
1799
+ var getDecimalPlaces, precisionAdd, precisionSubtract, UpArrow, DownArrow, NumberInput;
1800
+ var init_NumberInput = __esm({
1801
+ "src/NumberInput/NumberInput.tsx"() {
1802
+ init_UIConfigProvider2();
1803
+ init_numberLocale();
1804
+ init_valueMap();
1805
+ init_NumberInput_styled();
1806
+ getDecimalPlaces = (num) => {
1807
+ const str = String(num);
1808
+ const decimalIndex = str.indexOf(".");
1809
+ if (decimalIndex === -1) return 0;
1810
+ return str.length - decimalIndex - 1;
1811
+ };
1812
+ precisionAdd = (a, b) => {
1813
+ const precision = Math.max(getDecimalPlaces(a), getDecimalPlaces(b));
1814
+ const multiplier = Math.pow(10, precision);
1815
+ return Math.round(a * multiplier + b * multiplier) / multiplier;
1816
+ };
1817
+ precisionSubtract = (a, b) => {
1818
+ const precision = Math.max(getDecimalPlaces(a), getDecimalPlaces(b));
1819
+ const multiplier = Math.pow(10, precision);
1820
+ return Math.round(a * multiplier - b * multiplier) / multiplier;
1821
+ };
1833
1822
  UpArrow = () => /* @__PURE__ */ React3.createElement("svg", { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("path", { d: "M7 4.5L10.5 8.5H3.5L7 4.5Z", fill: "currentColor" }));
1834
1823
  DownArrow = () => /* @__PURE__ */ React3.createElement("svg", { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("path", { d: "M7 9.5L3.5 5.5H10.5L7 9.5Z", fill: "currentColor" }));
1835
1824
  NumberInput = ({
@@ -1879,15 +1868,20 @@ var init_NumberInput = __esm({
1879
1868
  if (val === void 0) {
1880
1869
  return "";
1881
1870
  }
1871
+ let formatted;
1882
1872
  if (formatter) {
1883
- return formatter(val);
1873
+ formatted = formatter(val);
1874
+ } else if (useThousandsSeparator) {
1875
+ formatted = formatNumber(val, locale, precision);
1876
+ } else {
1877
+ formatted = formatNumberForEdit(val, locale, precision);
1884
1878
  }
1885
- if (useThousandsSeparator) {
1886
- return formatNumber(val, locale, precision);
1879
+ if (unit) {
1880
+ return formatted + unit;
1887
1881
  }
1888
- return formatNumberForEdit(val, locale, precision);
1882
+ return formatted;
1889
1883
  },
1890
- [formatter, precision, locale, useThousandsSeparator]
1884
+ [formatter, precision, locale, useThousandsSeparator, unit]
1891
1885
  );
1892
1886
  const formatValueForEdit = useCallback(
1893
1887
  (val) => {
@@ -2058,7 +2052,7 @@ var init_NumberInput = __esm({
2058
2052
  $size: size,
2059
2053
  $disabled: disabled
2060
2054
  }
2061
- ), unit && /* @__PURE__ */ React3.createElement(UnitText, { $size: size, $disabled: disabled }, unit)),
2055
+ )),
2062
2056
  showStepButtons && (showStepButtonsTrigger !== "hover" || isHovered || isFocused) && /* @__PURE__ */ React3.createElement(ButtonGroup, { $alert: alert, $disabled: disabled, $lineType: lineType }, /* @__PURE__ */ React3.createElement(
2063
2057
  StepButton,
2064
2058
  {
@@ -3968,7 +3962,6 @@ var ToolbarButton = ({
3968
3962
  };
3969
3963
  const handleDropdownClick = (e) => {
3970
3964
  if (disabled) return;
3971
- e.stopPropagation();
3972
3965
  onDropdownClick?.(e);
3973
3966
  };
3974
3967
  const renderIcon = () => {