@navikt/ds-react 2.7.7 → 2.8.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/_docs.json +340 -0
- package/cjs/expansion-card/ExpansionCard.js +76 -0
- package/cjs/expansion-card/ExpansionCardContent.js +56 -0
- package/cjs/expansion-card/ExpansionCardDescription.js +47 -0
- package/cjs/expansion-card/ExpansionCardHeader.js +56 -0
- package/cjs/expansion-card/ExpansionCardTitle.js +46 -0
- package/cjs/expansion-card/index.js +8 -0
- package/cjs/expansion-card/package.json +6 -0
- package/cjs/index.js +1 -0
- package/esm/expansion-card/ExpansionCard.d.ts +43 -0
- package/esm/expansion-card/ExpansionCard.js +48 -0
- package/esm/expansion-card/ExpansionCard.js.map +1 -0
- package/esm/expansion-card/ExpansionCardContent.d.ts +7 -0
- package/esm/expansion-card/ExpansionCardContent.js +29 -0
- package/esm/expansion-card/ExpansionCardContent.js.map +1 -0
- package/esm/expansion-card/ExpansionCardDescription.d.ts +7 -0
- package/esm/expansion-card/ExpansionCardDescription.js +19 -0
- package/esm/expansion-card/ExpansionCardDescription.js.map +1 -0
- package/esm/expansion-card/ExpansionCardHeader.d.ts +7 -0
- package/esm/expansion-card/ExpansionCardHeader.js +29 -0
- package/esm/expansion-card/ExpansionCardHeader.js.map +1 -0
- package/esm/expansion-card/ExpansionCardTitle.d.ts +13 -0
- package/esm/expansion-card/ExpansionCardTitle.js +18 -0
- package/esm/expansion-card/ExpansionCardTitle.js.map +1 -0
- package/esm/expansion-card/index.d.ts +1 -0
- package/esm/expansion-card/index.js +2 -0
- package/esm/expansion-card/index.js.map +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/package.json +3 -2
- package/src/expansion-card/ExpansionCard.tsx +119 -0
- package/src/expansion-card/ExpansionCardContent.tsx +42 -0
- package/src/expansion-card/ExpansionCardDescription.tsx +22 -0
- package/src/expansion-card/ExpansionCardHeader.tsx +50 -0
- package/src/expansion-card/ExpansionCardTitle.tsx +34 -0
- package/src/expansion-card/expansion-card.stories.tsx +269 -0
- package/src/expansion-card/index.ts +4 -0
- package/src/index.ts +1 -0
package/_docs.json
CHANGED
|
@@ -1631,6 +1631,346 @@
|
|
|
1631
1631
|
}
|
|
1632
1632
|
}
|
|
1633
1633
|
},
|
|
1634
|
+
{
|
|
1635
|
+
"filePath": "src/expansion-card/ExpansionCard.tsx",
|
|
1636
|
+
"displayName": "ExpansionCard",
|
|
1637
|
+
"props": {
|
|
1638
|
+
"onToggle": {
|
|
1639
|
+
"defaultValue": null,
|
|
1640
|
+
"description": "Callback for when Card is toggled open/closed",
|
|
1641
|
+
"name": "onToggle",
|
|
1642
|
+
"parent": {
|
|
1643
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1644
|
+
"name": "ExpansionCardProps"
|
|
1645
|
+
},
|
|
1646
|
+
"declarations": [
|
|
1647
|
+
{
|
|
1648
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1649
|
+
"name": "ExpansionCardProps"
|
|
1650
|
+
}
|
|
1651
|
+
],
|
|
1652
|
+
"required": false,
|
|
1653
|
+
"type": {
|
|
1654
|
+
"name": "((open: boolean) => void)"
|
|
1655
|
+
}
|
|
1656
|
+
},
|
|
1657
|
+
"open": {
|
|
1658
|
+
"defaultValue": null,
|
|
1659
|
+
"description": "Controlled open-state\nUsing this removes automatic control of open-state",
|
|
1660
|
+
"name": "open",
|
|
1661
|
+
"parent": {
|
|
1662
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1663
|
+
"name": "ExpansionCardProps"
|
|
1664
|
+
},
|
|
1665
|
+
"declarations": [
|
|
1666
|
+
{
|
|
1667
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1668
|
+
"name": "ExpansionCardProps"
|
|
1669
|
+
}
|
|
1670
|
+
],
|
|
1671
|
+
"required": false,
|
|
1672
|
+
"type": {
|
|
1673
|
+
"name": "boolean"
|
|
1674
|
+
}
|
|
1675
|
+
},
|
|
1676
|
+
"defaultOpen": {
|
|
1677
|
+
"defaultValue": {
|
|
1678
|
+
"value": "false"
|
|
1679
|
+
},
|
|
1680
|
+
"description": "Defaults to open if not controlled",
|
|
1681
|
+
"name": "defaultOpen",
|
|
1682
|
+
"parent": {
|
|
1683
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1684
|
+
"name": "ExpansionCardProps"
|
|
1685
|
+
},
|
|
1686
|
+
"declarations": [
|
|
1687
|
+
{
|
|
1688
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1689
|
+
"name": "ExpansionCardProps"
|
|
1690
|
+
}
|
|
1691
|
+
],
|
|
1692
|
+
"required": false,
|
|
1693
|
+
"type": {
|
|
1694
|
+
"name": "boolean"
|
|
1695
|
+
}
|
|
1696
|
+
},
|
|
1697
|
+
"size": {
|
|
1698
|
+
"defaultValue": {
|
|
1699
|
+
"value": "\"medium\""
|
|
1700
|
+
},
|
|
1701
|
+
"description": "",
|
|
1702
|
+
"name": "size",
|
|
1703
|
+
"parent": {
|
|
1704
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1705
|
+
"name": "ExpansionCardProps"
|
|
1706
|
+
},
|
|
1707
|
+
"declarations": [
|
|
1708
|
+
{
|
|
1709
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1710
|
+
"name": "ExpansionCardProps"
|
|
1711
|
+
}
|
|
1712
|
+
],
|
|
1713
|
+
"required": false,
|
|
1714
|
+
"type": {
|
|
1715
|
+
"name": "\"medium\" | \"small\""
|
|
1716
|
+
}
|
|
1717
|
+
},
|
|
1718
|
+
"aria-label": {
|
|
1719
|
+
"defaultValue": null,
|
|
1720
|
+
"description": "Since ExpansionCard is a section-element, accessible name is required.",
|
|
1721
|
+
"name": "aria-label",
|
|
1722
|
+
"parent": {
|
|
1723
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1724
|
+
"name": "ExpansionCardProps"
|
|
1725
|
+
},
|
|
1726
|
+
"declarations": [
|
|
1727
|
+
{
|
|
1728
|
+
"fileName": "src/expansion-card/ExpansionCard.tsx",
|
|
1729
|
+
"name": "ExpansionCardProps"
|
|
1730
|
+
}
|
|
1731
|
+
],
|
|
1732
|
+
"required": true,
|
|
1733
|
+
"type": {
|
|
1734
|
+
"name": "string"
|
|
1735
|
+
}
|
|
1736
|
+
},
|
|
1737
|
+
"className": {
|
|
1738
|
+
"defaultValue": null,
|
|
1739
|
+
"description": "",
|
|
1740
|
+
"name": "className",
|
|
1741
|
+
"parent": {
|
|
1742
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1743
|
+
"name": "HTMLAttributes"
|
|
1744
|
+
},
|
|
1745
|
+
"declarations": [
|
|
1746
|
+
{
|
|
1747
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1748
|
+
"name": "HTMLAttributes"
|
|
1749
|
+
}
|
|
1750
|
+
],
|
|
1751
|
+
"required": false,
|
|
1752
|
+
"type": {
|
|
1753
|
+
"name": "string"
|
|
1754
|
+
}
|
|
1755
|
+
},
|
|
1756
|
+
"ref": {
|
|
1757
|
+
"defaultValue": null,
|
|
1758
|
+
"description": "",
|
|
1759
|
+
"name": "ref",
|
|
1760
|
+
"parent": {
|
|
1761
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1762
|
+
"name": "RefAttributes"
|
|
1763
|
+
},
|
|
1764
|
+
"declarations": [
|
|
1765
|
+
{
|
|
1766
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1767
|
+
"name": "RefAttributes"
|
|
1768
|
+
}
|
|
1769
|
+
],
|
|
1770
|
+
"required": false,
|
|
1771
|
+
"type": {
|
|
1772
|
+
"name": "Ref<HTMLDivElement>"
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
"filePath": "src/expansion-card/ExpansionCardContent.tsx",
|
|
1779
|
+
"displayName": "ExpansionCardContent",
|
|
1780
|
+
"props": {
|
|
1781
|
+
"className": {
|
|
1782
|
+
"defaultValue": null,
|
|
1783
|
+
"description": "",
|
|
1784
|
+
"name": "className",
|
|
1785
|
+
"parent": {
|
|
1786
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1787
|
+
"name": "HTMLAttributes"
|
|
1788
|
+
},
|
|
1789
|
+
"declarations": [
|
|
1790
|
+
{
|
|
1791
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1792
|
+
"name": "HTMLAttributes"
|
|
1793
|
+
}
|
|
1794
|
+
],
|
|
1795
|
+
"required": false,
|
|
1796
|
+
"type": {
|
|
1797
|
+
"name": "string"
|
|
1798
|
+
}
|
|
1799
|
+
},
|
|
1800
|
+
"ref": {
|
|
1801
|
+
"defaultValue": null,
|
|
1802
|
+
"description": "",
|
|
1803
|
+
"name": "ref",
|
|
1804
|
+
"parent": {
|
|
1805
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1806
|
+
"name": "RefAttributes"
|
|
1807
|
+
},
|
|
1808
|
+
"declarations": [
|
|
1809
|
+
{
|
|
1810
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1811
|
+
"name": "RefAttributes"
|
|
1812
|
+
}
|
|
1813
|
+
],
|
|
1814
|
+
"required": false,
|
|
1815
|
+
"type": {
|
|
1816
|
+
"name": "Ref<HTMLDivElement>"
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
"filePath": "src/expansion-card/ExpansionCardDescription.tsx",
|
|
1823
|
+
"displayName": "ExpansionCardDescription",
|
|
1824
|
+
"props": {
|
|
1825
|
+
"className": {
|
|
1826
|
+
"defaultValue": null,
|
|
1827
|
+
"description": "",
|
|
1828
|
+
"name": "className",
|
|
1829
|
+
"parent": {
|
|
1830
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1831
|
+
"name": "HTMLAttributes"
|
|
1832
|
+
},
|
|
1833
|
+
"declarations": [
|
|
1834
|
+
{
|
|
1835
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1836
|
+
"name": "HTMLAttributes"
|
|
1837
|
+
}
|
|
1838
|
+
],
|
|
1839
|
+
"required": false,
|
|
1840
|
+
"type": {
|
|
1841
|
+
"name": "string"
|
|
1842
|
+
}
|
|
1843
|
+
},
|
|
1844
|
+
"ref": {
|
|
1845
|
+
"defaultValue": null,
|
|
1846
|
+
"description": "",
|
|
1847
|
+
"name": "ref",
|
|
1848
|
+
"parent": {
|
|
1849
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1850
|
+
"name": "RefAttributes"
|
|
1851
|
+
},
|
|
1852
|
+
"declarations": [
|
|
1853
|
+
{
|
|
1854
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1855
|
+
"name": "RefAttributes"
|
|
1856
|
+
}
|
|
1857
|
+
],
|
|
1858
|
+
"required": false,
|
|
1859
|
+
"type": {
|
|
1860
|
+
"name": "Ref<HTMLParagraphElement>"
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
},
|
|
1865
|
+
{
|
|
1866
|
+
"filePath": "src/expansion-card/ExpansionCardHeader.tsx",
|
|
1867
|
+
"displayName": "ExpansionCardHeader",
|
|
1868
|
+
"props": {
|
|
1869
|
+
"className": {
|
|
1870
|
+
"defaultValue": null,
|
|
1871
|
+
"description": "",
|
|
1872
|
+
"name": "className",
|
|
1873
|
+
"parent": {
|
|
1874
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1875
|
+
"name": "HTMLAttributes"
|
|
1876
|
+
},
|
|
1877
|
+
"declarations": [
|
|
1878
|
+
{
|
|
1879
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1880
|
+
"name": "HTMLAttributes"
|
|
1881
|
+
}
|
|
1882
|
+
],
|
|
1883
|
+
"required": false,
|
|
1884
|
+
"type": {
|
|
1885
|
+
"name": "string"
|
|
1886
|
+
}
|
|
1887
|
+
},
|
|
1888
|
+
"ref": {
|
|
1889
|
+
"defaultValue": null,
|
|
1890
|
+
"description": "",
|
|
1891
|
+
"name": "ref",
|
|
1892
|
+
"parent": {
|
|
1893
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1894
|
+
"name": "RefAttributes"
|
|
1895
|
+
},
|
|
1896
|
+
"declarations": [
|
|
1897
|
+
{
|
|
1898
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1899
|
+
"name": "RefAttributes"
|
|
1900
|
+
}
|
|
1901
|
+
],
|
|
1902
|
+
"required": false,
|
|
1903
|
+
"type": {
|
|
1904
|
+
"name": "Ref<HTMLDivElement>"
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
},
|
|
1909
|
+
{
|
|
1910
|
+
"filePath": "src/expansion-card/ExpansionCardTitle.tsx",
|
|
1911
|
+
"displayName": "ExpansionCardTitle",
|
|
1912
|
+
"props": {
|
|
1913
|
+
"size": {
|
|
1914
|
+
"defaultValue": {
|
|
1915
|
+
"value": "small"
|
|
1916
|
+
},
|
|
1917
|
+
"description": "Changes text-sizing",
|
|
1918
|
+
"name": "size",
|
|
1919
|
+
"parent": {
|
|
1920
|
+
"fileName": "src/expansion-card/ExpansionCardTitle.tsx",
|
|
1921
|
+
"name": "ExpansionCardTitleProps"
|
|
1922
|
+
},
|
|
1923
|
+
"declarations": [
|
|
1924
|
+
{
|
|
1925
|
+
"fileName": "src/expansion-card/ExpansionCardTitle.tsx",
|
|
1926
|
+
"name": "ExpansionCardTitleProps"
|
|
1927
|
+
}
|
|
1928
|
+
],
|
|
1929
|
+
"required": false,
|
|
1930
|
+
"type": {
|
|
1931
|
+
"name": "\"large\" | \"medium\" | \"small\""
|
|
1932
|
+
}
|
|
1933
|
+
},
|
|
1934
|
+
"className": {
|
|
1935
|
+
"defaultValue": null,
|
|
1936
|
+
"description": "",
|
|
1937
|
+
"name": "className",
|
|
1938
|
+
"parent": {
|
|
1939
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1940
|
+
"name": "HTMLAttributes"
|
|
1941
|
+
},
|
|
1942
|
+
"declarations": [
|
|
1943
|
+
{
|
|
1944
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1945
|
+
"name": "HTMLAttributes"
|
|
1946
|
+
}
|
|
1947
|
+
],
|
|
1948
|
+
"required": false,
|
|
1949
|
+
"type": {
|
|
1950
|
+
"name": "string"
|
|
1951
|
+
}
|
|
1952
|
+
},
|
|
1953
|
+
"ref": {
|
|
1954
|
+
"defaultValue": null,
|
|
1955
|
+
"description": "",
|
|
1956
|
+
"name": "ref",
|
|
1957
|
+
"parent": {
|
|
1958
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1959
|
+
"name": "RefAttributes"
|
|
1960
|
+
},
|
|
1961
|
+
"declarations": [
|
|
1962
|
+
{
|
|
1963
|
+
"fileName": "aksel/node_modules/@types/react/index.d.ts",
|
|
1964
|
+
"name": "RefAttributes"
|
|
1965
|
+
}
|
|
1966
|
+
],
|
|
1967
|
+
"required": false,
|
|
1968
|
+
"type": {
|
|
1969
|
+
"name": "Ref<HTMLHeadingElement>"
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
},
|
|
1634
1974
|
{
|
|
1635
1975
|
"filePath": "src/form/ConfirmationPanel.tsx",
|
|
1636
1976
|
"displayName": "ConfirmationPanel",
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.ExpansionCard = exports.ExpansionCardContext = void 0;
|
|
41
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
|
+
const ExpansionCardContent_1 = __importDefault(require("./ExpansionCardContent"));
|
|
44
|
+
const ExpansionCardDescription_1 = require("./ExpansionCardDescription");
|
|
45
|
+
const ExpansionCardHeader_1 = __importDefault(require("./ExpansionCardHeader"));
|
|
46
|
+
const ExpansionCardTitle_1 = require("./ExpansionCardTitle");
|
|
47
|
+
exports.ExpansionCardContext = (0, react_1.createContext)({
|
|
48
|
+
open: false,
|
|
49
|
+
toggleOpen: () => { },
|
|
50
|
+
});
|
|
51
|
+
exports.ExpansionCard = (0, react_1.forwardRef)((_a, ref) => {
|
|
52
|
+
var { className, onToggle, open, defaultOpen = false, size = "medium" } = _a, rest = __rest(_a, ["className", "onToggle", "open", "defaultOpen", "size"]);
|
|
53
|
+
const [_open, _setOpen] = (0, react_1.useState)(defaultOpen);
|
|
54
|
+
const shouldFade = (0, react_1.useRef)(!(Boolean(open) || defaultOpen));
|
|
55
|
+
const handleOpen = () => {
|
|
56
|
+
if (open === undefined) {
|
|
57
|
+
const newOpen = !_open;
|
|
58
|
+
_setOpen(newOpen);
|
|
59
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(newOpen);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle(!open);
|
|
63
|
+
}
|
|
64
|
+
shouldFade.current = true;
|
|
65
|
+
};
|
|
66
|
+
return (react_1.default.createElement(exports.ExpansionCardContext.Provider, { value: { open: open !== null && open !== void 0 ? open : _open, toggleOpen: handleOpen } },
|
|
67
|
+
react_1.default.createElement("section", Object.assign({}, rest, { className: (0, clsx_1.default)("navds-expansioncard", className, `navds-expansioncard--${size}`, {
|
|
68
|
+
"navds-expansioncard--open": open !== null && open !== void 0 ? open : _open,
|
|
69
|
+
"navds-expansioncard--no-fade": !shouldFade.current,
|
|
70
|
+
}), ref: ref }))));
|
|
71
|
+
});
|
|
72
|
+
exports.ExpansionCard.Header = ExpansionCardHeader_1.default;
|
|
73
|
+
exports.ExpansionCard.Content = ExpansionCardContent_1.default;
|
|
74
|
+
exports.ExpansionCard.Title = ExpansionCardTitle_1.ExpansionCardTitle;
|
|
75
|
+
exports.ExpansionCard.Description = ExpansionCardDescription_1.ExpansionCardDescription;
|
|
76
|
+
exports.default = exports.ExpansionCard;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const BodyLong_1 = require("../typography/BodyLong");
|
|
43
|
+
const ExpansionCard_1 = require("./ExpansionCard");
|
|
44
|
+
const ExpansionCardContent = (0, react_1.forwardRef)((_a, ref) => {
|
|
45
|
+
var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
|
|
46
|
+
const panelContext = (0, react_1.useContext)(ExpansionCard_1.ExpansionCardContext);
|
|
47
|
+
if (panelContext === null) {
|
|
48
|
+
console.error("<ExpansionCard.Content> has to be used within an <ExpansionCard>");
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return (react_1.default.createElement(BodyLong_1.BodyLong, Object.assign({}, rest, { ref: ref, as: "div", className: (0, clsx_1.default)("navds-expansioncard__content", {
|
|
52
|
+
"navds-expansioncard__content--closed": !panelContext.open,
|
|
53
|
+
}), "aria-hidden": !panelContext.open }),
|
|
54
|
+
react_1.default.createElement("div", { className: "navds-expansioncard__content-inner" }, children)));
|
|
55
|
+
});
|
|
56
|
+
exports.default = ExpansionCardContent;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.ExpansionCardDescription = void 0;
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
43
|
+
const BodyLong_1 = require("../typography/BodyLong");
|
|
44
|
+
exports.ExpansionCardDescription = (0, react_1.forwardRef)((_a, ref) => {
|
|
45
|
+
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
46
|
+
return (react_1.default.createElement(BodyLong_1.BodyLong, Object.assign({}, rest, { as: "p", ref: ref, className: (0, clsx_1.default)("navds-link-panel__description", className) })));
|
|
47
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const ExpansionCard_1 = require("./ExpansionCard");
|
|
43
|
+
const aksel_icons_1 = require("@navikt/aksel-icons");
|
|
44
|
+
const ExpansionCardHeader = (0, react_1.forwardRef)((_a, ref) => {
|
|
45
|
+
var { children, className } = _a, rest = __rest(_a, ["children", "className"]);
|
|
46
|
+
const panelContext = (0, react_1.useContext)(ExpansionCard_1.ExpansionCardContext);
|
|
47
|
+
if (panelContext === null) {
|
|
48
|
+
console.error("<ExpansionCard.Header> has to be used within an <ExpansionCard>");
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return (react_1.default.createElement("div", Object.assign({ ref: ref }, rest, { className: (0, clsx_1.default)("navds-expansioncard__header", className) }),
|
|
52
|
+
react_1.default.createElement("div", { className: "navds-expansioncard__header-content" }, children),
|
|
53
|
+
react_1.default.createElement("button", { className: "navds-expansioncard__header-button", onClick: () => panelContext.toggleOpen(), type: "button", "aria-expanded": panelContext.open },
|
|
54
|
+
react_1.default.createElement(aksel_icons_1.ChevronDownIcon, { className: "navds-expansioncard__header-chevron", title: "Vis mer" }))));
|
|
55
|
+
});
|
|
56
|
+
exports.default = ExpansionCardHeader;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.ExpansionCardTitle = void 0;
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
43
|
+
exports.ExpansionCardTitle = (0, react_1.forwardRef)((_a, ref) => {
|
|
44
|
+
var { className, as: Component = "h3", size = "small" } = _a, rest = __rest(_a, ["className", "as", "size"]);
|
|
45
|
+
return (react_1.default.createElement(Component, Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)("navds-expansioncard__title", `navds-expansioncard__title--${size}`, "navds-heading", `navds-heading--${size}`, className) })));
|
|
46
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ExpansionCard = void 0;
|
|
7
|
+
var ExpansionCard_1 = require("./ExpansionCard");
|
|
8
|
+
Object.defineProperty(exports, "ExpansionCard", { enumerable: true, get: function () { return __importDefault(ExpansionCard_1).default; } });
|
package/cjs/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./chat"), exports);
|
|
|
21
21
|
__exportStar(require("./chips"), exports);
|
|
22
22
|
__exportStar(require("./date"), exports);
|
|
23
23
|
__exportStar(require("./form"), exports);
|
|
24
|
+
__exportStar(require("./expansion-card"), exports);
|
|
24
25
|
__exportStar(require("./grid"), exports);
|
|
25
26
|
__exportStar(require("./guide-panel"), exports);
|
|
26
27
|
__exportStar(require("./help-text"), exports);
|