@doist/reactist 20.3.0 → 21.0.0

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.
@@ -1680,6 +1680,49 @@ const CheckboxField = /*#__PURE__*/React.forwardRef(function CheckboxField(_ref,
1680
1680
  }, /*#__PURE__*/React.createElement(Text, null, label)) : null);
1681
1681
  });
1682
1682
 
1683
+ function PasswordVisibleIcon(props) {
1684
+ return /*#__PURE__*/React.createElement("svg", _objectSpread2({
1685
+ xmlns: "http://www.w3.org/2000/svg",
1686
+ width: "24",
1687
+ height: "24"
1688
+ }, props), /*#__PURE__*/React.createElement("g", {
1689
+ fill: "none",
1690
+ fillRule: "evenodd",
1691
+ stroke: "gray"
1692
+ }, /*#__PURE__*/React.createElement("path", {
1693
+ d: "M21.358 12C17.825 7.65 14.692 5.5 12 5.5c-2.624 0-5.67 2.043-9.097 6.181a.5.5 0 0 0 0 .638C6.331 16.457 9.376 18.5 12 18.5c2.692 0 5.825-2.15 9.358-6.5z"
1694
+ }), /*#__PURE__*/React.createElement("circle", {
1695
+ cx: "12",
1696
+ cy: "12",
1697
+ r: "3.5"
1698
+ })));
1699
+ }
1700
+
1701
+ function PasswordHiddenIcon(props) {
1702
+ return /*#__PURE__*/React.createElement("svg", _objectSpread2({
1703
+ xmlns: "http://www.w3.org/2000/svg",
1704
+ width: "24",
1705
+ height: "24"
1706
+ }, props), /*#__PURE__*/React.createElement("g", {
1707
+ fill: "gray",
1708
+ fillRule: "evenodd",
1709
+ transform: "translate(2 4)"
1710
+ }, /*#__PURE__*/React.createElement("path", {
1711
+ fillRule: "nonzero",
1712
+ d: "M13.047 2.888C11.962 2.294 10.944 2 10 2 7.56 2 4.63 3.966 1.288 8c1.133 1.368 2.218 2.497 3.253 3.394l-.708.708c-1.068-.93-2.173-2.085-3.315-3.464a1 1 0 0 1 0-1.276C4.031 3.121 7.192 1 10 1c1.196 0 2.456.385 3.78 1.154l-.733.734zm-6.02 10.263C8.084 13.72 9.076 14 10 14c2.443 0 5.373-1.969 8.712-6-1.11-1.34-2.176-2.453-3.193-3.341l.708-.709C17.437 5.013 18.695 6.363 20 8c-3.721 4.667-7.054 7-10 7-1.175 0-2.411-.371-3.709-1.113l.735-.736z"
1713
+ }), /*#__PURE__*/React.createElement("path", {
1714
+ fillRule: "nonzero",
1715
+ d: "M8.478 11.7l.79-.79a3 3 0 0 0 3.642-3.642l.79-.79A4 4 0 0 1 8.477 11.7zM6.334 9.602a4 4 0 0 1 5.268-5.268l-.78.78A3.002 3.002 0 0 0 7.113 8.82l-.78.78z"
1716
+ }), /*#__PURE__*/React.createElement("rect", {
1717
+ width: "21",
1718
+ height: "1",
1719
+ x: "-.722",
1720
+ y: "7.778",
1721
+ rx: ".5",
1722
+ transform: "rotate(-45 9.778 8.278)"
1723
+ })));
1724
+ }
1725
+
1683
1726
  var modules_540a88ff = {"container":"_2e189908","auxiliaryLabel":"_83051e0a","bordered":"fd20ef50","error":"d1a17d92","primaryLabel":"_75e0afa0","secondaryLabel":"d04a867d","messageIcon":"_77b2107e"};
1684
1727
 
1685
1728
  function FieldHint(props) {
@@ -1782,79 +1825,35 @@ function BaseField({
1782
1825
  }, hint) : null);
1783
1826
  }
1784
1827
 
1785
- function PasswordVisibleIcon(props) {
1786
- return /*#__PURE__*/React.createElement("svg", _objectSpread2({
1787
- xmlns: "http://www.w3.org/2000/svg",
1788
- width: "24",
1789
- height: "24"
1790
- }, props), /*#__PURE__*/React.createElement("g", {
1791
- fill: "none",
1792
- fillRule: "evenodd",
1793
- stroke: "gray"
1794
- }, /*#__PURE__*/React.createElement("path", {
1795
- d: "M21.358 12C17.825 7.65 14.692 5.5 12 5.5c-2.624 0-5.67 2.043-9.097 6.181a.5.5 0 0 0 0 .638C6.331 16.457 9.376 18.5 12 18.5c2.692 0 5.825-2.15 9.358-6.5z"
1796
- }), /*#__PURE__*/React.createElement("circle", {
1797
- cx: "12",
1798
- cy: "12",
1799
- r: "3.5"
1800
- })));
1801
- }
1802
-
1803
- function PasswordHiddenIcon(props) {
1804
- return /*#__PURE__*/React.createElement("svg", _objectSpread2({
1805
- xmlns: "http://www.w3.org/2000/svg",
1806
- width: "24",
1807
- height: "24"
1808
- }, props), /*#__PURE__*/React.createElement("g", {
1809
- fill: "gray",
1810
- fillRule: "evenodd",
1811
- transform: "translate(2 4)"
1812
- }, /*#__PURE__*/React.createElement("path", {
1813
- fillRule: "nonzero",
1814
- d: "M13.047 2.888C11.962 2.294 10.944 2 10 2 7.56 2 4.63 3.966 1.288 8c1.133 1.368 2.218 2.497 3.253 3.394l-.708.708c-1.068-.93-2.173-2.085-3.315-3.464a1 1 0 0 1 0-1.276C4.031 3.121 7.192 1 10 1c1.196 0 2.456.385 3.78 1.154l-.733.734zm-6.02 10.263C8.084 13.72 9.076 14 10 14c2.443 0 5.373-1.969 8.712-6-1.11-1.34-2.176-2.453-3.193-3.341l.708-.709C17.437 5.013 18.695 6.363 20 8c-3.721 4.667-7.054 7-10 7-1.175 0-2.411-.371-3.709-1.113l.735-.736z"
1815
- }), /*#__PURE__*/React.createElement("path", {
1816
- fillRule: "nonzero",
1817
- d: "M8.478 11.7l.79-.79a3 3 0 0 0 3.642-3.642l.79-.79A4 4 0 0 1 8.477 11.7zM6.334 9.602a4 4 0 0 1 5.268-5.268l-.78.78A3.002 3.002 0 0 0 7.113 8.82l-.78.78z"
1818
- }), /*#__PURE__*/React.createElement("rect", {
1819
- width: "21",
1820
- height: "1",
1821
- x: "-.722",
1822
- y: "7.778",
1823
- rx: ".5",
1824
- transform: "rotate(-45 9.778 8.278)"
1825
- })));
1826
- }
1827
-
1828
- var modules_3f03ead6 = {"inputWrapper":"_66b448b3"};
1829
-
1830
- var modules_aaf25250 = {"inputWrapper":"fb09cd05","bordered":"f65f40dd","error":"_29118bf0","startIcon":"a40eb111"};
1828
+ var modules_aaf25250 = {"inputWrapper":"_6c84b26d","bordered":"_8522aec5","error":"d4d62845","slot":"_9c20ca38"};
1831
1829
 
1832
- const _excluded$k = ["variant", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "togglePasswordLabel", "hidden", "aria-describedby"];
1833
- const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref, ref) {
1830
+ const _excluded$k = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "type", "maxWidth", "hidden", "aria-describedby", "startSlot", "endSlot"];
1831
+ const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
1834
1832
  let {
1835
1833
  variant = 'default',
1834
+ id,
1836
1835
  label,
1837
1836
  secondaryLabel,
1838
1837
  auxiliaryLabel,
1839
1838
  hint,
1840
1839
  message,
1841
1840
  tone,
1841
+ type = 'text',
1842
1842
  maxWidth,
1843
- togglePasswordLabel = 'Toggle password visibility',
1844
1843
  hidden,
1845
- 'aria-describedby': ariaDescribedBy
1844
+ 'aria-describedby': ariaDescribedBy,
1845
+ startSlot,
1846
+ endSlot
1846
1847
  } = _ref,
1847
1848
  props = _objectWithoutProperties(_ref, _excluded$k);
1848
1849
 
1849
- const id = useId(props.id);
1850
1850
  const internalRef = React.useRef(null);
1851
- const inputRef = ariakitReactUtils.useForkRef(internalRef, ref);
1852
- const [isPasswordVisible, setPasswordVisible] = React.useState(false);
1851
+ const combinedRef = useCallbackRef.useMergeRefs([ref, internalRef]);
1853
1852
 
1854
- function togglePasswordVisibility() {
1853
+ function handleClick(event) {
1855
1854
  var _internalRef$current;
1856
1855
 
1857
- setPasswordVisible(v => !v);
1856
+ if (event.currentTarget === combinedRef.current) return;
1858
1857
  (_internalRef$current = internalRef.current) == null ? void 0 : _internalRef$current.focus();
1859
1858
  }
1860
1859
 
@@ -1873,27 +1872,51 @@ const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref,
1873
1872
  }, extraProps => /*#__PURE__*/React.createElement(Box, {
1874
1873
  display: "flex",
1875
1874
  alignItems: "center",
1876
- className: [modules_3f03ead6.inputWrapper, modules_aaf25250.inputWrapper, tone === 'error' ? modules_aaf25250.error : null, variant === 'bordered' ? modules_aaf25250.bordered : null]
1877
- }, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
1878
- ref: inputRef,
1879
- type: isPasswordVisible ? 'text' : 'password'
1880
- })), /*#__PURE__*/React.createElement(Tooltip, {
1881
- content: togglePasswordLabel
1882
- }, /*#__PURE__*/React.createElement("button", {
1883
- type: "button",
1884
- onClick: togglePasswordVisibility,
1885
- "aria-label": togglePasswordLabel,
1886
- tabIndex: -1
1887
- }, isPasswordVisible ? /*#__PURE__*/React.createElement(PasswordVisibleIcon, {
1888
- "aria-hidden": true
1889
- }) : /*#__PURE__*/React.createElement(PasswordHiddenIcon, {
1890
- "aria-hidden": true
1891
- })))));
1875
+ className: [modules_aaf25250.inputWrapper, tone === 'error' ? modules_aaf25250.error : null, variant === 'bordered' ? modules_aaf25250.bordered : null],
1876
+ onClick: handleClick
1877
+ }, startSlot ? /*#__PURE__*/React.createElement(Box, {
1878
+ className: modules_aaf25250.slot,
1879
+ display: "flex",
1880
+ marginRight: variant === 'bordered' ? 'xsmall' : '-xsmall',
1881
+ marginLeft: variant === 'bordered' ? '-xsmall' : 'xsmall'
1882
+ }, startSlot) : null, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
1883
+ type: type,
1884
+ ref: combinedRef
1885
+ })), endSlot ? /*#__PURE__*/React.createElement(Box, {
1886
+ className: modules_aaf25250.slot,
1887
+ display: "flex",
1888
+ marginRight: variant === 'bordered' ? '-xsmall' : 'xsmall',
1889
+ marginLeft: variant === 'bordered' ? 'xsmall' : '-xsmall'
1890
+ }, endSlot) : null));
1891
+ });
1892
+
1893
+ const _excluded$l = ["togglePasswordLabel"];
1894
+ const PasswordField = /*#__PURE__*/React.forwardRef(function PasswordField(_ref, ref) {
1895
+ let {
1896
+ togglePasswordLabel = 'Toggle password visibility'
1897
+ } = _ref,
1898
+ props = _objectWithoutProperties(_ref, _excluded$l);
1899
+
1900
+ const [isPasswordVisible, setPasswordVisible] = React.useState(false);
1901
+ const Icon = isPasswordVisible ? PasswordVisibleIcon : PasswordHiddenIcon;
1902
+ return /*#__PURE__*/React.createElement(TextField, _objectSpread2(_objectSpread2({}, props), {}, {
1903
+ ref: ref,
1904
+ // @ts-expect-error TextField does not support type="password", so we override the type check here
1905
+ type: isPasswordVisible ? 'text' : 'password',
1906
+ endSlot: /*#__PURE__*/React.createElement(Button, {
1907
+ variant: "quaternary",
1908
+ icon: /*#__PURE__*/React.createElement(Icon, {
1909
+ "aria-hidden": true
1910
+ }),
1911
+ "aria-label": togglePasswordLabel,
1912
+ onClick: () => setPasswordVisible(v => !v)
1913
+ })
1914
+ }));
1892
1915
  });
1893
1916
 
1894
1917
  var modules_1fa9b208 = {"selectWrapper":"a804edbf","bordered":"_50a3655f","error":"a6d38abf"};
1895
1918
 
1896
- const _excluded$l = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "children", "hidden", "aria-describedby"];
1919
+ const _excluded$m = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "children", "hidden", "aria-describedby"];
1897
1920
  const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref) {
1898
1921
  let {
1899
1922
  variant = 'default',
@@ -1909,7 +1932,7 @@ const SelectField = /*#__PURE__*/React.forwardRef(function SelectField(_ref, ref
1909
1932
  hidden,
1910
1933
  'aria-describedby': ariaDescribedBy
1911
1934
  } = _ref,
1912
- props = _objectWithoutProperties(_ref, _excluded$l);
1935
+ props = _objectWithoutProperties(_ref, _excluded$m);
1913
1936
 
1914
1937
  return /*#__PURE__*/React.createElement(BaseField, {
1915
1938
  variant: variant,
@@ -1947,7 +1970,7 @@ function SelectChevron(props) {
1947
1970
 
1948
1971
  var modules_8e05f7c9 = {"container":"bae487be","disabled":"_408d32a0","checked":"_99b0ead7","toggle":"_5af09fb5","label":"a66e1846","handle":"_0dcf70ec","keyFocused":"_1f5e7fd4"};
1949
1972
 
1950
- const _excluded$m = ["label", "hint", "disabled", "hidden", "defaultChecked", "id", "aria-describedby", "aria-label", "aria-labelledby", "onChange"];
1973
+ const _excluded$n = ["label", "hint", "disabled", "hidden", "defaultChecked", "id", "aria-describedby", "aria-label", "aria-labelledby", "onChange"];
1951
1974
  const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref) {
1952
1975
  var _ref2, _props$checked, _props$checked2;
1953
1976
 
@@ -1963,7 +1986,7 @@ const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref
1963
1986
  'aria-labelledby': originalAriaLabelledby,
1964
1987
  onChange
1965
1988
  } = _ref,
1966
- props = _objectWithoutProperties(_ref, _excluded$m);
1989
+ props = _objectWithoutProperties(_ref, _excluded$n);
1967
1990
 
1968
1991
  const id = useId(originalId);
1969
1992
  const hintId = useId();
@@ -2023,7 +2046,7 @@ const SwitchField = /*#__PURE__*/React.forwardRef(function SwitchField(_ref, ref
2023
2046
 
2024
2047
  var modules_2728c236 = {"textAreaContainer":"_21dbfa84","innerContainer":"_43588660","bordered":"f081b428","error":"a862f0e5","autoExpand":"_46360b15"};
2025
2048
 
2026
- const _excluded$n = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "hidden", "aria-describedby", "rows", "autoExpand"];
2049
+ const _excluded$o = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "maxWidth", "hidden", "aria-describedby", "rows", "autoExpand"];
2027
2050
  const TextArea = /*#__PURE__*/React.forwardRef(function TextArea(_ref, ref) {
2028
2051
  let {
2029
2052
  variant = 'default',
@@ -2040,7 +2063,7 @@ const TextArea = /*#__PURE__*/React.forwardRef(function TextArea(_ref, ref) {
2040
2063
  rows,
2041
2064
  autoExpand = false
2042
2065
  } = _ref,
2043
- props = _objectWithoutProperties(_ref, _excluded$n);
2066
+ props = _objectWithoutProperties(_ref, _excluded$o);
2044
2067
 
2045
2068
  const containerRef = React.useRef(null);
2046
2069
  const internalRef = React.useRef(null);
@@ -2084,63 +2107,6 @@ const TextArea = /*#__PURE__*/React.forwardRef(function TextArea(_ref, ref) {
2084
2107
  }))));
2085
2108
  });
2086
2109
 
2087
- const _excluded$o = ["variant", "id", "label", "secondaryLabel", "auxiliaryLabel", "hint", "message", "tone", "type", "maxWidth", "hidden", "aria-describedby", "startIcon"];
2088
- const TextField = /*#__PURE__*/React.forwardRef(function TextField(_ref, ref) {
2089
- let {
2090
- variant = 'default',
2091
- id,
2092
- label,
2093
- secondaryLabel,
2094
- auxiliaryLabel,
2095
- hint,
2096
- message,
2097
- tone,
2098
- type = 'text',
2099
- maxWidth,
2100
- hidden,
2101
- 'aria-describedby': ariaDescribedBy,
2102
- startIcon
2103
- } = _ref,
2104
- props = _objectWithoutProperties(_ref, _excluded$o);
2105
-
2106
- const internalRef = React.useRef(null);
2107
- const combinedRef = useCallbackRef.useMergeRefs([ref, internalRef]);
2108
-
2109
- function focusOnIconClick() {
2110
- var _internalRef$current;
2111
-
2112
- (_internalRef$current = internalRef.current) == null ? void 0 : _internalRef$current.focus();
2113
- }
2114
-
2115
- return /*#__PURE__*/React.createElement(BaseField, {
2116
- variant: variant,
2117
- id: id,
2118
- label: label,
2119
- secondaryLabel: secondaryLabel,
2120
- auxiliaryLabel: auxiliaryLabel,
2121
- hint: hint,
2122
- message: message,
2123
- tone: tone,
2124
- maxWidth: maxWidth,
2125
- hidden: hidden,
2126
- "aria-describedby": ariaDescribedBy
2127
- }, extraProps => /*#__PURE__*/React.createElement(Box, {
2128
- display: "flex",
2129
- alignItems: "center",
2130
- className: [modules_aaf25250.inputWrapper, tone === 'error' ? modules_aaf25250.error : null, variant === 'bordered' ? modules_aaf25250.bordered : null]
2131
- }, startIcon ? /*#__PURE__*/React.createElement(Box, {
2132
- display: "flex",
2133
- className: modules_aaf25250.startIcon,
2134
- onClick: focusOnIconClick,
2135
- marginRight: "-xsmall",
2136
- marginLeft: "small",
2137
- "aria-hidden": true
2138
- }, startIcon) : null, /*#__PURE__*/React.createElement("input", _objectSpread2(_objectSpread2(_objectSpread2({}, props), extraProps), {}, {
2139
- type: type,
2140
- ref: combinedRef
2141
- }))));
2142
- });
2143
-
2144
2110
  function getInitials(name) {
2145
2111
  var _initials;
2146
2112