@sebgroup/green-react 1.0.3 → 1.1.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.
- package/index.esm.js +372 -152
- package/index.umd.js +370 -150
- package/lib/alert-ribbon/alert-ribbon.d.ts +2 -2
- package/lib/form/iconButton/iconButton.d.ts +9 -0
- package/lib/form/index.d.ts +1 -0
- package/lib/form/input/input.d.ts +5 -6
- package/lib/form/radioButton/radioGroup.d.ts +6 -2
- package/lib/form/types.d.ts +2 -0
- package/lib/formItem/formItem.d.ts +16 -0
- package/lib/formItem/index.d.ts +1 -0
- package/lib/icons/bankId.d.ts +2 -0
- package/lib/icons/check.d.ts +2 -1
- package/lib/icons/chevronDown.d.ts +2 -1
- package/lib/icons/index.d.ts +5 -2
- package/lib/icons/infoCircle.d.ts +2 -0
- package/lib/icons/square-exclamation.d.ts +2 -1
- package/lib/icons/square-info.d.ts +2 -1
- package/lib/icons/times.d.ts +2 -0
- package/lib/layout/flexbox/flexbox.d.ts +1 -1
- package/lib/select/select.d.ts +3 -0
- package/package.json +1 -1
- package/types/props/index.d.ts +6 -0
package/index.umd.js
CHANGED
|
@@ -1061,6 +1061,16 @@
|
|
|
1061
1061
|
t[p[i]] = s[p[i]];
|
|
1062
1062
|
}
|
|
1063
1063
|
return t;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1067
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1068
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1069
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1070
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1071
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1072
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1073
|
+
});
|
|
1064
1074
|
}
|
|
1065
1075
|
|
|
1066
1076
|
function Button({
|
|
@@ -1773,55 +1783,156 @@
|
|
|
1773
1783
|
}));
|
|
1774
1784
|
}
|
|
1775
1785
|
|
|
1776
|
-
const
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1786
|
+
const Check = ({
|
|
1787
|
+
focusable: _focusable = false,
|
|
1788
|
+
title
|
|
1789
|
+
}) => {
|
|
1790
|
+
let id;
|
|
1791
|
+
if (title) id = extract.randomId();
|
|
1792
|
+
return jsxRuntime.jsxs("svg", Object.assign({
|
|
1793
|
+
width: "24",
|
|
1794
|
+
height: "24",
|
|
1795
|
+
viewBox: "0 0 24 24",
|
|
1796
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1797
|
+
focusable: _focusable,
|
|
1798
|
+
"aria-labelledby": id
|
|
1799
|
+
}, {
|
|
1800
|
+
children: ["title && ", jsxRuntime.jsx("title", Object.assign({
|
|
1801
|
+
id: id
|
|
1802
|
+
}, {
|
|
1803
|
+
children: title
|
|
1804
|
+
})), jsxRuntime.jsx("path", {
|
|
1805
|
+
d: "M17.6203 6.60836L9.40014 14.8285L6.37976 11.8081C6.23332 11.6617 5.99588 11.6617 5.84942 11.8081L4.96554 12.692C4.8191 12.8384 4.8191 13.0759 4.96554 13.2223L9.13495 17.3917C9.28138 17.5382 9.51882 17.5382 9.66529 17.3917L19.0344 8.02258C19.1809 7.87614 19.1809 7.63871 19.0344 7.49224L18.1506 6.60836C18.0041 6.46193 17.7667 6.46193 17.6203 6.60836Z",
|
|
1806
|
+
fill: "white"
|
|
1807
|
+
})]
|
|
1808
|
+
}));
|
|
1809
|
+
};
|
|
1790
1810
|
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1811
|
+
const ChevronDown = ({
|
|
1812
|
+
focusable: _focusable = false,
|
|
1813
|
+
title
|
|
1814
|
+
}) => {
|
|
1815
|
+
let id;
|
|
1816
|
+
if (title) id = extract.randomId();
|
|
1817
|
+
return jsxRuntime.jsxs("svg", Object.assign({
|
|
1818
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1819
|
+
width: "24",
|
|
1820
|
+
height: "24",
|
|
1821
|
+
viewBox: "0 0 448 512",
|
|
1822
|
+
focusable: _focusable,
|
|
1823
|
+
"aria-labelledby": id
|
|
1824
|
+
}, {
|
|
1825
|
+
children: ["title && ", jsxRuntime.jsx("title", Object.assign({
|
|
1826
|
+
id: id
|
|
1827
|
+
}, {
|
|
1828
|
+
children: title
|
|
1829
|
+
})), jsxRuntime.jsx("path", {
|
|
1830
|
+
d: "M441.9 167.3l-19.8-19.8c-4.7-4.7-12.3-4.7-17 0L224 328.2 42.9 147.5c-4.7-4.7-12.3-4.7-17 0L6.1 167.3c-4.7 4.7-4.7 12.3 0 17l209.4 209.4c4.7 4.7 12.3 4.7 17 0l209.4-209.4c4.7-4.7 4.7-12.3 0-17z"
|
|
1831
|
+
})]
|
|
1832
|
+
}));
|
|
1833
|
+
};
|
|
1801
1834
|
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1835
|
+
const SquareExclamation = _a => {
|
|
1836
|
+
var {
|
|
1837
|
+
focusable = false,
|
|
1838
|
+
title
|
|
1839
|
+
} = _a,
|
|
1840
|
+
props = __rest(_a, ["focusable", "title"]);
|
|
1841
|
+
|
|
1842
|
+
let id;
|
|
1843
|
+
if (title) id = extract.randomId();
|
|
1844
|
+
return jsxRuntime.jsxs("svg", Object.assign({
|
|
1845
|
+
viewBox: "0 0 24 24",
|
|
1846
|
+
fill: "none",
|
|
1847
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1848
|
+
"aria-hidden": props['aria-hidden'],
|
|
1849
|
+
focusable: focusable,
|
|
1850
|
+
"aria-labelledby": id
|
|
1851
|
+
}, {
|
|
1852
|
+
children: [title && jsxRuntime.jsx("title", Object.assign({
|
|
1853
|
+
id: id
|
|
1854
|
+
}, {
|
|
1855
|
+
children: title
|
|
1856
|
+
})), jsxRuntime.jsx("path", {
|
|
1857
|
+
fillRule: "evenodd",
|
|
1858
|
+
clipRule: "evenodd",
|
|
1859
|
+
d: "M18.2857 4H5.71429C4.7675 4 4 4.7675 4 5.71429V18.2857C4 19.2325 4.7675 20 5.71429 20H18.2857C19.2325 20 20 19.2325 20 18.2857V5.71429C20 4.7675 19.2325 4 18.2857 4ZM10.8682 7.42857H13.1318C13.3777 7.42857 13.5731 7.635 13.5597 7.8805L13.2948 12.7376C13.2824 12.9649 13.0945 13.1429 12.8669 13.1429H11.1331C10.9055 13.1429 10.7176 12.9649 10.7052 12.7376L10.4402 7.8805C10.4269 7.635 10.6223 7.42857 10.8682 7.42857ZM12 17.0714C11.0927 17.0714 10.3571 16.3359 10.3571 15.4286C10.3571 14.5213 11.0927 13.7857 12 13.7857C12.9073 13.7857 13.6429 14.5213 13.6429 15.4286C13.6429 16.3359 12.9073 17.0714 12 17.0714Z",
|
|
1860
|
+
fill: "#333333"
|
|
1861
|
+
})]
|
|
1862
|
+
}));
|
|
1863
|
+
};
|
|
1814
1864
|
|
|
1815
|
-
const
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1865
|
+
const SquareInfo = _a => {
|
|
1866
|
+
var {
|
|
1867
|
+
focusable = false,
|
|
1868
|
+
title
|
|
1869
|
+
} = _a,
|
|
1870
|
+
props = __rest(_a, ["focusable", "title"]);
|
|
1871
|
+
|
|
1872
|
+
let id;
|
|
1873
|
+
if (title) id = extract.randomId();
|
|
1874
|
+
return jsxRuntime.jsx("svg", Object.assign({
|
|
1875
|
+
viewBox: "0 0 24 24",
|
|
1876
|
+
fill: "none",
|
|
1877
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1878
|
+
"aria-labelledby": id,
|
|
1879
|
+
"aria-hidden": props['aria-hidden'],
|
|
1880
|
+
focusable: focusable
|
|
1881
|
+
}, {
|
|
1882
|
+
children: jsxRuntime.jsx("path", {
|
|
1883
|
+
d: "M18.2857 4H5.71429C4.7675 4 4 4.7675 4 5.71429V18.2857C4 19.2325 4.7675 20 5.71429 20H18.2857C19.2325 20 20 19.2325 20 18.2857V5.71429C20 4.7675 19.2325 4 18.2857 4ZM12 7.07143C12.8284 7.07143 13.5 7.743 13.5 8.57143C13.5 9.39986 12.8284 10.0714 12 10.0714C11.1716 10.0714 10.5 9.39986 10.5 8.57143C10.5 7.743 11.1716 7.07143 12 7.07143ZM14 16.1429C14 16.3795 13.8081 16.5714 13.5714 16.5714H10.4286C10.1919 16.5714 10 16.3795 10 16.1429V15.2857C10 15.049 10.1919 14.8571 10.4286 14.8571H10.8571V12.5714H10.4286C10.1919 12.5714 10 12.3795 10 12.1429V11.2857C10 11.049 10.1919 10.8571 10.4286 10.8571H12.7143C12.951 10.8571 13.1429 11.049 13.1429 11.2857V14.8571H13.5714C13.8081 14.8571 14 15.049 14 15.2857V16.1429Z",
|
|
1884
|
+
fill: "#333333"
|
|
1885
|
+
})
|
|
1886
|
+
}));
|
|
1887
|
+
};
|
|
1888
|
+
|
|
1889
|
+
const Times = ({
|
|
1890
|
+
focusable: _focusable = false,
|
|
1891
|
+
title
|
|
1892
|
+
}) => {
|
|
1893
|
+
let id;
|
|
1894
|
+
if (title) id = extract.randomId();
|
|
1895
|
+
return jsxRuntime.jsxs("svg", Object.assign({
|
|
1896
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1897
|
+
viewBox: "0 0 320 512",
|
|
1898
|
+
focusable: _focusable,
|
|
1899
|
+
"aria-labelledby": id
|
|
1900
|
+
}, {
|
|
1901
|
+
children: [title && jsxRuntime.jsx("title", Object.assign({
|
|
1902
|
+
id: id
|
|
1903
|
+
}, {
|
|
1904
|
+
children: title
|
|
1905
|
+
})), jsxRuntime.jsx("path", {
|
|
1906
|
+
d: "M207.6 256l107.72-107.72c6.23-6.23 6.23-16.34 0-22.58l-25.03-25.03c-6.23-6.23-16.34-6.23-22.58 0L160 208.4 52.28 100.68c-6.23-6.23-16.34-6.23-22.58 0L4.68 125.7c-6.23 6.23-6.23 16.34 0 22.58L112.4 256 4.68 363.72c-6.23 6.23-6.23 16.34 0 22.58l25.03 25.03c6.23 6.23 16.34 6.23 22.58 0L160 303.6l107.72 107.72c6.23 6.23 16.34 6.23 22.58 0l25.03-25.03c6.23-6.23 6.23-16.34 0-22.58L207.6 256z"
|
|
1907
|
+
})]
|
|
1908
|
+
}));
|
|
1909
|
+
};
|
|
1910
|
+
|
|
1911
|
+
const InfoCircle = _a => {
|
|
1912
|
+
var {
|
|
1913
|
+
focusable = false,
|
|
1914
|
+
title
|
|
1915
|
+
} = _a,
|
|
1916
|
+
props = __rest(_a, ["focusable", "title"]);
|
|
1917
|
+
|
|
1918
|
+
let id;
|
|
1919
|
+
if (title) id = extract.randomId();
|
|
1920
|
+
return jsxRuntime.jsxs("svg", Object.assign({
|
|
1921
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1922
|
+
viewBox: "0 0 512 512",
|
|
1923
|
+
"aria-labelledby": id,
|
|
1924
|
+
"aria-hidden": props['aria-hidden'],
|
|
1925
|
+
focusable: focusable
|
|
1926
|
+
}, {
|
|
1927
|
+
children: [title && jsxRuntime.jsx("title", Object.assign({
|
|
1928
|
+
id: id
|
|
1929
|
+
}, {
|
|
1930
|
+
children: title
|
|
1931
|
+
})), jsxRuntime.jsx("path", {
|
|
1932
|
+
d: "M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 448c-110.532 0-200-89.431-200-200 0-110.495 89.472-200 200-200 110.491 0 200 89.471 200 200 0 110.53-89.431 200-200 200zm0-338c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"
|
|
1933
|
+
})]
|
|
1934
|
+
}));
|
|
1935
|
+
};
|
|
1825
1936
|
|
|
1826
1937
|
function AlertRibbon({
|
|
1827
1938
|
type,
|
|
@@ -1832,7 +1943,7 @@
|
|
|
1832
1943
|
isCloseable = true,
|
|
1833
1944
|
onClose,
|
|
1834
1945
|
role,
|
|
1835
|
-
|
|
1946
|
+
'aria-live': ariaLive,
|
|
1836
1947
|
closeAriaLabel
|
|
1837
1948
|
}) {
|
|
1838
1949
|
const [closeButton, setCloseButton] = React.useState();
|
|
@@ -1862,15 +1973,21 @@
|
|
|
1862
1973
|
|
|
1863
1974
|
const renderIcon = () => {
|
|
1864
1975
|
switch (type) {
|
|
1865
|
-
case
|
|
1866
|
-
case
|
|
1867
|
-
return SquareExclamation
|
|
1976
|
+
case 'danger':
|
|
1977
|
+
case 'warning':
|
|
1978
|
+
return jsxRuntime.jsx(SquareExclamation, {
|
|
1979
|
+
"aria-hidden": true
|
|
1980
|
+
});
|
|
1868
1981
|
|
|
1869
|
-
case
|
|
1870
|
-
return Check
|
|
1982
|
+
case 'success':
|
|
1983
|
+
return jsxRuntime.jsx(Check, {
|
|
1984
|
+
"aria-hidden": true
|
|
1985
|
+
});
|
|
1871
1986
|
|
|
1872
1987
|
default:
|
|
1873
|
-
return SquareInfo
|
|
1988
|
+
return jsxRuntime.jsx(SquareInfo, {
|
|
1989
|
+
"aria-hidden": true
|
|
1990
|
+
});
|
|
1874
1991
|
}
|
|
1875
1992
|
};
|
|
1876
1993
|
|
|
@@ -1896,7 +2013,7 @@
|
|
|
1896
2013
|
})), closeButton && jsxRuntime.jsx("button", Object.assign({
|
|
1897
2014
|
className: "close",
|
|
1898
2015
|
type: "button",
|
|
1899
|
-
"aria-label": closeAriaLabel !== null && closeAriaLabel !== void 0 ? closeAriaLabel :
|
|
2016
|
+
"aria-label": closeAriaLabel !== null && closeAriaLabel !== void 0 ? closeAriaLabel : 'Close alert',
|
|
1900
2017
|
onClick: event => {
|
|
1901
2018
|
onClose && onClose(event);
|
|
1902
2019
|
}
|
|
@@ -1910,6 +2027,23 @@
|
|
|
1910
2027
|
}));
|
|
1911
2028
|
}
|
|
1912
2029
|
|
|
2030
|
+
const IconButton = _a => {
|
|
2031
|
+
var {
|
|
2032
|
+
children,
|
|
2033
|
+
onClick
|
|
2034
|
+
} = _a,
|
|
2035
|
+
props = __rest(_a, ["children", "onClick"]);
|
|
2036
|
+
|
|
2037
|
+
return jsxRuntime.jsx("button", Object.assign({
|
|
2038
|
+
className: "icon",
|
|
2039
|
+
onClick: onClick,
|
|
2040
|
+
"aria-controls": props['aria-controls'],
|
|
2041
|
+
"aria-expanded": props['aria-expanded']
|
|
2042
|
+
}, {
|
|
2043
|
+
children: children
|
|
2044
|
+
}));
|
|
2045
|
+
};
|
|
2046
|
+
|
|
1913
2047
|
const ButtonGroup = ({
|
|
1914
2048
|
children,
|
|
1915
2049
|
selectedIndex,
|
|
@@ -2167,6 +2301,111 @@
|
|
|
2167
2301
|
}));
|
|
2168
2302
|
}
|
|
2169
2303
|
|
|
2304
|
+
const FormItem = ({
|
|
2305
|
+
expandableInfo,
|
|
2306
|
+
label,
|
|
2307
|
+
labelInformation,
|
|
2308
|
+
validator,
|
|
2309
|
+
inputId,
|
|
2310
|
+
children,
|
|
2311
|
+
expandableInfoButtonLabel,
|
|
2312
|
+
role
|
|
2313
|
+
}) => {
|
|
2314
|
+
const expandableInnerRef = React.useRef(null);
|
|
2315
|
+
const expandableRef = React.useRef(null);
|
|
2316
|
+
const [expandableHeight, setExpandableHeight] = React.useState(0);
|
|
2317
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
2318
|
+
const [isHidden, setIsHidden] = React.useState(false);
|
|
2319
|
+
React.useLayoutEffect(() => {
|
|
2320
|
+
expandableInnerRef.current && setExpandableHeight(expandableInnerRef.current['clientHeight']);
|
|
2321
|
+
setIsHidden(true);
|
|
2322
|
+
}, []);
|
|
2323
|
+
React.useEffect(() => {
|
|
2324
|
+
const handleResize = extract.debounce(function setExpandableHeightAfterResize() {
|
|
2325
|
+
isExpanded && expandableInnerRef.current && setExpandableHeight(expandableInnerRef.current['clientHeight']);
|
|
2326
|
+
}, 300);
|
|
2327
|
+
|
|
2328
|
+
if (expandableRef.current) {
|
|
2329
|
+
window.addEventListener('resize', handleResize);
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
return () => {
|
|
2333
|
+
window.removeEventListener('resize', handleResize);
|
|
2334
|
+
};
|
|
2335
|
+
}, [isExpanded, expandableInnerRef]);
|
|
2336
|
+
if (!inputId) inputId = extract.randomId();
|
|
2337
|
+
return jsxRuntime.jsxs("div", Object.assign({
|
|
2338
|
+
className: `gds-form-item ${validator && extract.validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator)}`,
|
|
2339
|
+
role: role ? role : undefined,
|
|
2340
|
+
"aria-labelledby": role ? `${inputId}-label` : undefined
|
|
2341
|
+
}, {
|
|
2342
|
+
children: [expandableInfo && jsxRuntime.jsx("div", {
|
|
2343
|
+
className: "gds-form-item__backdrop"
|
|
2344
|
+
}), jsxRuntime.jsxs("div", Object.assign({
|
|
2345
|
+
className: "gds-form-item__header"
|
|
2346
|
+
}, {
|
|
2347
|
+
children: [jsxRuntime.jsxs("div", Object.assign({
|
|
2348
|
+
className: "gds-form-item__labels"
|
|
2349
|
+
}, {
|
|
2350
|
+
children: [label && jsxRuntime.jsx("label", Object.assign({
|
|
2351
|
+
id: role ? `${inputId}-label` : undefined,
|
|
2352
|
+
htmlFor: role ? undefined : inputId
|
|
2353
|
+
}, {
|
|
2354
|
+
children: label
|
|
2355
|
+
})), labelInformation && jsxRuntime.jsx("div", Object.assign({
|
|
2356
|
+
className: "form-info",
|
|
2357
|
+
id: `${inputId}_info`
|
|
2358
|
+
}, {
|
|
2359
|
+
children: labelInformation
|
|
2360
|
+
}))]
|
|
2361
|
+
})), expandableInfo && jsxRuntime.jsx(IconButton, Object.assign({
|
|
2362
|
+
"aria-expanded": isExpanded,
|
|
2363
|
+
"aria-controls": `${inputId}-expandable-info`,
|
|
2364
|
+
onClick: event => __awaiter(void 0, void 0, void 0, function* () {
|
|
2365
|
+
if (!isExpanded) {
|
|
2366
|
+
setIsHidden(false);
|
|
2367
|
+
yield extract.delay(10);
|
|
2368
|
+
expandableInnerRef.current && setExpandableHeight(expandableInnerRef.current['clientHeight']);
|
|
2369
|
+
setIsExpanded(true);
|
|
2370
|
+
} else {
|
|
2371
|
+
setIsExpanded(false);
|
|
2372
|
+
yield extract.delay(300);
|
|
2373
|
+
setIsHidden(true);
|
|
2374
|
+
}
|
|
2375
|
+
})
|
|
2376
|
+
}, {
|
|
2377
|
+
children: isExpanded ? jsxRuntime.jsx(Times, {
|
|
2378
|
+
title: expandableInfoButtonLabel
|
|
2379
|
+
}) : jsxRuntime.jsx(InfoCircle, {
|
|
2380
|
+
title: expandableInfoButtonLabel
|
|
2381
|
+
})
|
|
2382
|
+
}))]
|
|
2383
|
+
})), expandableInfo && jsxRuntime.jsx("div", Object.assign({
|
|
2384
|
+
ref: expandableRef,
|
|
2385
|
+
id: `gds-expandable-info-${inputId}`,
|
|
2386
|
+
className: "gds-form-item__expandable-info",
|
|
2387
|
+
hidden: isHidden,
|
|
2388
|
+
style: {
|
|
2389
|
+
height: isExpanded ? expandableHeight : 0
|
|
2390
|
+
}
|
|
2391
|
+
}, {
|
|
2392
|
+
children: jsxRuntime.jsxs("div", Object.assign({
|
|
2393
|
+
ref: expandableInnerRef
|
|
2394
|
+
}, {
|
|
2395
|
+
children: [" ", expandableInfo, " "]
|
|
2396
|
+
}))
|
|
2397
|
+
})), children, jsxRuntime.jsx("div", Object.assign({
|
|
2398
|
+
className: "gds-form-item__footer"
|
|
2399
|
+
}, {
|
|
2400
|
+
children: validator && jsxRuntime.jsx("span", Object.assign({
|
|
2401
|
+
className: "form-info"
|
|
2402
|
+
}, {
|
|
2403
|
+
children: validator.message
|
|
2404
|
+
}))
|
|
2405
|
+
}))]
|
|
2406
|
+
}));
|
|
2407
|
+
};
|
|
2408
|
+
|
|
2170
2409
|
const useInput = (props, onChanges, onChangeInput) => {
|
|
2171
2410
|
const id = React.useMemo(() => props.id || extract.randomId(), [props.id]);
|
|
2172
2411
|
const ref = React.useRef(null);
|
|
@@ -2204,7 +2443,7 @@
|
|
|
2204
2443
|
});
|
|
2205
2444
|
};
|
|
2206
2445
|
|
|
2207
|
-
const RenderInput = (type, props, onChange, onChangeInput, label, info, validator) => {
|
|
2446
|
+
const RenderInput = (type, props, onChange, onChangeInput, label, info, validator, expandableInfo, expandableInfoButtonLabel) => {
|
|
2208
2447
|
const _a = useInput(props, onChange, onChangeInput),
|
|
2209
2448
|
{
|
|
2210
2449
|
value
|
|
@@ -2215,32 +2454,24 @@
|
|
|
2215
2454
|
'aria-describedby': `${inputProps.id}_info`
|
|
2216
2455
|
}) : inputProps; // Render naked
|
|
2217
2456
|
|
|
2218
|
-
if (!label && !info) return jsxRuntime.jsx("input", Object.assign({
|
|
2457
|
+
if (!label && !info && !expandableInfo) return jsxRuntime.jsx("input", Object.assign({
|
|
2219
2458
|
type: type,
|
|
2220
2459
|
value: value
|
|
2221
2460
|
}, propsWithDescription));
|
|
2222
|
-
return jsxRuntime.
|
|
2223
|
-
|
|
2461
|
+
return jsxRuntime.jsx(FormItem, Object.assign({
|
|
2462
|
+
validator: validator,
|
|
2463
|
+
labelInformation: info,
|
|
2464
|
+
label: label,
|
|
2465
|
+
expandableInfo: expandableInfo,
|
|
2466
|
+
expandableInfoButtonLabel: expandableInfoButtonLabel,
|
|
2467
|
+
inputId: inputProps.id
|
|
2224
2468
|
}, {
|
|
2225
|
-
children:
|
|
2226
|
-
htmlFor: inputProps.id
|
|
2227
|
-
}, {
|
|
2228
|
-
children: label
|
|
2229
|
-
})), info && jsxRuntime.jsx("span", Object.assign({
|
|
2230
|
-
className: "form-info",
|
|
2231
|
-
id: `${inputProps.id}_info`
|
|
2232
|
-
}, {
|
|
2233
|
-
children: info
|
|
2234
|
-
})), jsxRuntime.jsx("input", Object.assign({
|
|
2469
|
+
children: jsxRuntime.jsx("input", Object.assign({
|
|
2235
2470
|
type: type,
|
|
2236
2471
|
value: value
|
|
2237
2472
|
}, propsWithDescription, {
|
|
2238
2473
|
className: validator && extract.validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator)
|
|
2239
|
-
}))
|
|
2240
|
-
className: "form-info"
|
|
2241
|
-
}, {
|
|
2242
|
-
children: validator.message
|
|
2243
|
-
}))]
|
|
2474
|
+
}))
|
|
2244
2475
|
}));
|
|
2245
2476
|
};
|
|
2246
2477
|
const TextInput = _a => {
|
|
@@ -2249,11 +2480,13 @@
|
|
|
2249
2480
|
info,
|
|
2250
2481
|
onChange,
|
|
2251
2482
|
onChangeInput,
|
|
2252
|
-
validator
|
|
2483
|
+
validator,
|
|
2484
|
+
expandableInfo,
|
|
2485
|
+
expandableInfoButtonLabel
|
|
2253
2486
|
} = _a,
|
|
2254
|
-
props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator"]);
|
|
2487
|
+
props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator", "expandableInfo", "expandableInfoButtonLabel"]);
|
|
2255
2488
|
|
|
2256
|
-
return RenderInput('text', props, onChange, onChangeInput, label, info, validator);
|
|
2489
|
+
return RenderInput('text', props, onChange, onChangeInput, label, info, validator, expandableInfo, expandableInfoButtonLabel);
|
|
2257
2490
|
};
|
|
2258
2491
|
const EmailInput = _a => {
|
|
2259
2492
|
var {
|
|
@@ -2273,11 +2506,13 @@
|
|
|
2273
2506
|
info,
|
|
2274
2507
|
onChange,
|
|
2275
2508
|
onChangeInput,
|
|
2276
|
-
validator
|
|
2509
|
+
validator,
|
|
2510
|
+
expandableInfo,
|
|
2511
|
+
expandableInfoButtonLabel
|
|
2277
2512
|
} = _a,
|
|
2278
|
-
props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator"]);
|
|
2513
|
+
props = __rest(_a, ["label", "info", "onChange", "onChangeInput", "validator", "expandableInfo", "expandableInfoButtonLabel"]);
|
|
2279
2514
|
|
|
2280
|
-
return RenderInput('number', props, onChange, onChangeInput, label, info, validator);
|
|
2515
|
+
return RenderInput('number', props, onChange, onChangeInput, label, info, validator, expandableInfo, expandableInfoButtonLabel);
|
|
2281
2516
|
};
|
|
2282
2517
|
const Checkbox = _a => {
|
|
2283
2518
|
var {
|
|
@@ -2452,14 +2687,20 @@
|
|
|
2452
2687
|
const RadioGroup = ({
|
|
2453
2688
|
defaultSelected,
|
|
2454
2689
|
valueSelected,
|
|
2455
|
-
|
|
2690
|
+
label,
|
|
2456
2691
|
title,
|
|
2692
|
+
labelInformation,
|
|
2693
|
+
description,
|
|
2694
|
+
expandableInfo,
|
|
2695
|
+
expandableInfoButtonLabel,
|
|
2457
2696
|
validator,
|
|
2458
2697
|
onChangeRadio,
|
|
2459
2698
|
onChange,
|
|
2460
2699
|
name,
|
|
2461
2700
|
children
|
|
2462
2701
|
}) => {
|
|
2702
|
+
if (title) console.warn('"title" prop is deprecated. Please use "label" instead.');
|
|
2703
|
+
if (description) console.warn('"description" prop is deprecated. Please use "labelInformation" instead.');
|
|
2463
2704
|
const [selected, setSelected] = React.useState(valueSelected !== null && valueSelected !== void 0 ? valueSelected : defaultSelected);
|
|
2464
2705
|
const [prevValueSelected, setPrevValueSelected] = React.useState(valueSelected);
|
|
2465
2706
|
|
|
@@ -2497,34 +2738,27 @@
|
|
|
2497
2738
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2498
2739
|
|
|
2499
2740
|
}, []);
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
})
|
|
2522
|
-
})]
|
|
2523
|
-
})), (validator === null || validator === void 0 ? void 0 : validator.message) && jsxRuntime.jsx("span", Object.assign({
|
|
2524
|
-
className: "form-info"
|
|
2525
|
-
}, {
|
|
2526
|
-
children: validator === null || validator === void 0 ? void 0 : validator.message
|
|
2527
|
-
}))]
|
|
2741
|
+
const labelFromTitle = label || title;
|
|
2742
|
+
const labelInformationFromDescription = labelInformation || description;
|
|
2743
|
+
const formItemProps = {
|
|
2744
|
+
validator,
|
|
2745
|
+
labelInformation: labelInformationFromDescription,
|
|
2746
|
+
label: labelFromTitle,
|
|
2747
|
+
expandableInfo,
|
|
2748
|
+
expandableInfoButtonLabel,
|
|
2749
|
+
role: 'radiogroup'
|
|
2750
|
+
};
|
|
2751
|
+
if (!name) name = extract.randomId();
|
|
2752
|
+
return jsxRuntime.jsx(FormItem, Object.assign({}, formItemProps, {
|
|
2753
|
+
children: React__default["default"].Children.map(children, radioButton => {
|
|
2754
|
+
return /*#__PURE__*/React__default["default"].isValidElement(radioButton) ? /*#__PURE__*/React__default["default"].cloneElement(radioButton, {
|
|
2755
|
+
validator: validatorClassName,
|
|
2756
|
+
onChange: handleOnChange,
|
|
2757
|
+
checked: selected === radioButton.props.value,
|
|
2758
|
+
name,
|
|
2759
|
+
ref: radioBtnRef
|
|
2760
|
+
}) : radioButton;
|
|
2761
|
+
})
|
|
2528
2762
|
}));
|
|
2529
2763
|
};
|
|
2530
2764
|
|
|
@@ -2879,49 +3113,37 @@
|
|
|
2879
3113
|
value,
|
|
2880
3114
|
testId,
|
|
2881
3115
|
onChange,
|
|
2882
|
-
onSelect
|
|
3116
|
+
onSelect,
|
|
3117
|
+
expandableInfo,
|
|
3118
|
+
expandableInfoButtonLabel
|
|
2883
3119
|
}, ref) => {
|
|
2884
3120
|
const selectId = id !== null && id !== void 0 ? id : extract.randomId();
|
|
2885
3121
|
const validatorClassName = extract.validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator);
|
|
2886
|
-
return jsxRuntime.jsx(
|
|
2887
|
-
|
|
2888
|
-
|
|
3122
|
+
return jsxRuntime.jsx(FormItem, Object.assign({
|
|
3123
|
+
label: label,
|
|
3124
|
+
labelInformation: labelInformation,
|
|
3125
|
+
expandableInfo: expandableInfo,
|
|
3126
|
+
expandableInfoButtonLabel: expandableInfoButtonLabel,
|
|
3127
|
+
inputId: selectId
|
|
3128
|
+
}, {
|
|
3129
|
+
children: jsxRuntime.jsxs("div", Object.assign({
|
|
3130
|
+
className: `gsd-select ${validatorClassName}`
|
|
2889
3131
|
}, {
|
|
2890
|
-
children: jsxRuntime.
|
|
2891
|
-
|
|
3132
|
+
children: [jsxRuntime.jsx("select", Object.assign({
|
|
3133
|
+
id: selectId,
|
|
3134
|
+
"data-testid": testId,
|
|
3135
|
+
className: className,
|
|
3136
|
+
defaultValue: defaultValue,
|
|
3137
|
+
value: value,
|
|
3138
|
+
ref: ref,
|
|
3139
|
+
onChange: event => {
|
|
3140
|
+
onChange && onChange(event);
|
|
3141
|
+
}
|
|
2892
3142
|
}, {
|
|
2893
|
-
children:
|
|
2894
|
-
|
|
2895
|
-
}, {
|
|
2896
|
-
children: label
|
|
2897
|
-
})), labelInformation && jsxRuntime.jsx("div", Object.assign({
|
|
2898
|
-
className: "form-info"
|
|
2899
|
-
}, {
|
|
2900
|
-
children: labelInformation
|
|
2901
|
-
})), jsxRuntime.jsxs("div", Object.assign({
|
|
2902
|
-
className: `gsd--select-wrapper ${validatorClassName}`
|
|
2903
|
-
}, {
|
|
2904
|
-
children: [jsxRuntime.jsx("select", Object.assign({
|
|
2905
|
-
id: selectId,
|
|
2906
|
-
"data-testid": testId,
|
|
2907
|
-
className: className,
|
|
2908
|
-
defaultValue: defaultValue,
|
|
2909
|
-
value: value,
|
|
2910
|
-
ref: ref,
|
|
2911
|
-
onChange: event => {
|
|
2912
|
-
onChange && onChange(event);
|
|
2913
|
-
}
|
|
2914
|
-
}, {
|
|
2915
|
-
children: children
|
|
2916
|
-
})), ChevronDown]
|
|
2917
|
-
})), (validator === null || validator === void 0 ? void 0 : validator.message) && jsxRuntime.jsx("div", Object.assign({
|
|
2918
|
-
className: "form-info"
|
|
2919
|
-
}, {
|
|
2920
|
-
children: validator.message
|
|
2921
|
-
}))]
|
|
2922
|
-
}))
|
|
3143
|
+
children: children
|
|
3144
|
+
})), jsxRuntime.jsx(ChevronDown, {})]
|
|
2923
3145
|
}))
|
|
2924
|
-
});
|
|
3146
|
+
}));
|
|
2925
3147
|
});
|
|
2926
3148
|
const Option = _a => {
|
|
2927
3149
|
var {
|
|
@@ -3188,11 +3410,9 @@
|
|
|
3188
3410
|
className: "sg-fieldset-container"
|
|
3189
3411
|
}, {
|
|
3190
3412
|
children: jsxRuntime.jsxs("fieldset", Object.assign({}, multiSelectProps.fieldsetProps, {
|
|
3191
|
-
children: [jsxRuntime.jsx("legend", Object.assign({}, multiSelectProps.legendProps)), jsxRuntime.
|
|
3192
|
-
children: (
|
|
3193
|
-
|
|
3194
|
-
}), checkboxItem.labelProps.id))
|
|
3195
|
-
})]
|
|
3413
|
+
children: [jsxRuntime.jsx("legend", Object.assign({}, multiSelectProps.legendProps)), (_a = multiSelectProps.checkboxes) === null || _a === void 0 ? void 0 : _a.map(checkboxItem => jsxRuntime.jsxs("label", Object.assign({}, checkboxItem.labelProps, {
|
|
3414
|
+
children: [jsxRuntime.jsx("input", Object.assign({}, checkboxItem.inputProps)), jsxRuntime.jsx("span", Object.assign({}, checkboxItem.spanProps)), jsxRuntime.jsx("i", {})]
|
|
3415
|
+
}), checkboxItem.labelProps.id))]
|
|
3196
3416
|
}))
|
|
3197
3417
|
})) : jsxRuntime.jsx("ul", Object.assign({
|
|
3198
3418
|
role: "listbox"
|
|
@@ -9,8 +9,8 @@ export interface AlertRibbonProps {
|
|
|
9
9
|
closeText?: string;
|
|
10
10
|
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
11
11
|
role?: 'alert';
|
|
12
|
-
[
|
|
12
|
+
['aria-live']?: AriaAttributes['aria-live'];
|
|
13
13
|
closeAriaLabel?: string;
|
|
14
14
|
}
|
|
15
|
-
export declare function AlertRibbon({ type, header, footer, children, closeText, isCloseable, onClose, role,
|
|
15
|
+
export declare function AlertRibbon({ type, header, footer, children, closeText, isCloseable, onClose, role, 'aria-live': ariaLive, closeAriaLabel, }: AlertRibbonProps): JSX.Element;
|
|
16
16
|
export default AlertRibbon;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode, MouseEvent } from 'react';
|
|
2
|
+
interface IconButtonInterface {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
onClick: (event: MouseEvent) => void;
|
|
5
|
+
'aria-expanded'?: boolean;
|
|
6
|
+
'aria-controls'?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const IconButton: ({ children, onClick, ...props }: IconButtonInterface) => JSX.Element;
|
|
9
|
+
export default IconButton;
|