@helsenorge/designsystem-react 2.15.0 → 2.16.1
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/CHANGELOG.md +38 -2
- package/HorizontalScroll.js +1 -1
- package/HorizontalScroll.js.map +1 -1
- package/ListHeader.js +1 -1
- package/ListHeader.js.map +1 -1
- package/Panel.js +1 -1
- package/Panel.js.map +1 -1
- package/TableExpandedRow.js +1 -1
- package/TableExpandedRow.js.map +1 -1
- package/TableExpanderCell.js +1 -1
- package/TableExpanderCell.js.map +1 -1
- package/TableRow.js +1 -1
- package/TableRow.js.map +1 -1
- package/components/Duolist/index.js +1 -1
- package/components/Duolist/index.js.map +1 -1
- package/components/Duolist/styles.module.scss +0 -4
- package/components/Duolist/styles.module.scss.d.ts +0 -1
- package/components/HorizontalScroll/HorizontalScroll.d.ts +2 -0
- package/components/HorizontalScroll/HorizontalScroll.d.ts.map +1 -1
- package/components/HorizontalScroll/componentdata.json +1 -1
- package/components/HorizontalScroll/styles.module.scss +5 -0
- package/components/ListHeader/ListHeader.d.ts.map +1 -1
- package/components/Panel/Panel.d.ts.map +1 -1
- package/components/Panel/styles.module.scss +1 -1
- package/components/Table/Table.d.ts +19 -9
- package/components/Table/Table.d.ts.map +1 -1
- package/components/Table/TableExpandedRow/TableExpandedRow.d.ts.map +1 -1
- package/components/Table/TableExpanderCell/TableExpanderCell.d.ts.map +1 -1
- package/components/Table/TableExpanderCell/TableExpanderCellMobile.d.ts +6 -0
- package/components/Table/TableExpanderCell/TableExpanderCellMobile.d.ts.map +1 -0
- package/components/Table/TableRow/TableRow.d.ts +1 -1
- package/components/Table/TableRow/TableRow.d.ts.map +1 -1
- package/components/Table/TableRow/componentdata.json +1 -1
- package/components/Table/index.js +1 -1
- package/components/Table/index.js.map +1 -1
- package/components/Table/styles.module.scss +131 -126
- package/components/Table/styles.module.scss.d.ts +12 -4
- package/components/Table/utils.d.ts +21 -0
- package/components/Table/utils.d.ts.map +1 -0
- package/package.json +1 -1
- package/utils/device.d.ts +2 -0
- package/utils/device.d.ts.map +1 -0
- package/utils/device.js +2 -0
- package/utils/device.js.map +1 -0
|
@@ -127,7 +127,6 @@
|
|
|
127
127
|
|
|
128
128
|
&__btn-container {
|
|
129
129
|
display: flex;
|
|
130
|
-
flex-direction: column;
|
|
131
130
|
@media (min-width: map-get($grid-breakpoints, lg)) {
|
|
132
131
|
align-self: flex-end;
|
|
133
132
|
}
|
|
@@ -149,6 +148,7 @@
|
|
|
149
148
|
align-self: flex-start;
|
|
150
149
|
@media (min-width: map-get($grid-breakpoints, lg)) {
|
|
151
150
|
align-self: flex-end;
|
|
151
|
+
margin-left: auto;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Breakpoint } from '../../hooks/useBreakpoint';
|
|
2
3
|
export declare enum SmallViewportVariant {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/** No handling responsive behaviour. This will be the default in v3.0.0. */
|
|
5
|
+
none = "none",
|
|
6
|
+
/** Overflow parent container to the left and right while remaining centered horizontally. */
|
|
7
|
+
centeredoverflow = "centeredoverflow",
|
|
8
|
+
/** Show horizontal scrollbar when table is too big for the screen. */
|
|
6
9
|
horizontalscroll = "horizontalscroll",
|
|
7
|
-
/**
|
|
8
|
-
* Collapse to two columns on small screens
|
|
9
|
-
*/
|
|
10
|
+
/** Collapse to two columns. */
|
|
10
11
|
block = "block"
|
|
11
12
|
}
|
|
13
|
+
export interface BreakpointConfig {
|
|
14
|
+
/** Breakpoint at which responsive behaviour will be applied. The table component uses a "desktop first" approach. */
|
|
15
|
+
breakpoint: keyof typeof Breakpoint;
|
|
16
|
+
/** Desired behaviour on this breakpoint and all smaller screens. */
|
|
17
|
+
variant: keyof typeof SmallViewportVariant;
|
|
18
|
+
/** If variant is horizontallscroll, use a fallback instead of device is not a touch device. */
|
|
19
|
+
fallbackVariant?: keyof typeof SmallViewportVariant;
|
|
20
|
+
}
|
|
12
21
|
export interface Props {
|
|
13
22
|
/** Unique ID */
|
|
14
23
|
id?: string;
|
|
15
24
|
/** Id used for testing */
|
|
16
25
|
testId?: string;
|
|
17
|
-
/**
|
|
18
|
-
|
|
26
|
+
/** Customize how the table behaves on various screen widths */
|
|
27
|
+
/** @deprecated Rename to breakpointConfig in v3.0.0 and drop support for SmallViewPortVariant */
|
|
28
|
+
smallViewportVariant?: SmallViewportVariant | BreakpointConfig | BreakpointConfig[];
|
|
19
29
|
/** Adds custom classes to the element. */
|
|
20
30
|
className?: string;
|
|
21
31
|
/** Sets the content of the table. Use TableHead and TableBody */
|
|
22
32
|
children: React.ReactNode;
|
|
23
33
|
}
|
|
24
|
-
export declare const Table:
|
|
34
|
+
export declare const Table: React.FC<Props>;
|
|
25
35
|
export default Table;
|
|
26
36
|
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAQhD,OAAO,EAAE,UAAU,EAAiB,MAAM,2BAA2B,CAAC;AAItE,oBAAY,oBAAoB;IAC9B,4EAA4E;IAC5E,IAAI,SAAS;IACb,6FAA6F;IAC7F,gBAAgB,qBAAqB;IACrC,sEAAsE;IACtE,gBAAgB,qBAAqB;IACrC,+BAA+B;IAC/B,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,qHAAqH;IACrH,UAAU,EAAE,MAAM,OAAO,UAAU,CAAC;IACpC,oEAAoE;IACpE,OAAO,EAAE,MAAM,OAAO,oBAAoB,CAAC;IAC3C,+FAA+F;IAC/F,eAAe,CAAC,EAAE,MAAM,OAAO,oBAAoB,CAAC;CACrD;AAED,MAAM,WAAW,KAAK;IACpB,gBAAgB;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0BAA0B;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,iGAAiG;IACjG,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;IACpF,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAoCjC,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableExpandedRow.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/TableExpandedRow/TableExpandedRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,WAAW,KAAK;IACpB,uBAAuB;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,kCAAkC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,gBAAgB,sFAO1B,KAAK,
|
|
1
|
+
{"version":3,"file":"TableExpandedRow.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/TableExpandedRow/TableExpandedRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,WAAW,KAAK;IACpB,uBAAuB;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,kCAAkC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,4BAA4B;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,gBAAgB,sFAO1B,KAAK,gBAyBP,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableExpanderCell.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/TableExpanderCell/TableExpanderCell.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"TableExpanderCell.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/TableExpanderCell/TableExpanderCell.tsx"],"names":[],"mappings":";AAQA,MAAM,WAAW,KAAK;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,iBAAiB,gFAM3B,KAAK,gBAgBP,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Props } from '../TableRow/TableRow';
|
|
3
|
+
declare type TableExpanderCellMobile = Pick<Props, 'expanded' | 'onClick' | 'hideDetailsText' | 'showDetailsText'>;
|
|
4
|
+
declare const TableExpanderCellMobile: React.FC<TableExpanderCellMobile>;
|
|
5
|
+
export default TableExpanderCellMobile;
|
|
6
|
+
//# sourceMappingURL=TableExpanderCellMobile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableExpanderCellMobile.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/TableExpanderCell/TableExpanderCellMobile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,aAAK,uBAAuB,GAAG,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;AAE3G,QAAA,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAY9D,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -17,6 +17,6 @@ export interface Props {
|
|
|
17
17
|
/** Sets the cells of the table row element. */
|
|
18
18
|
children?: React.ReactNode;
|
|
19
19
|
}
|
|
20
|
-
export declare const TableRow:
|
|
20
|
+
export declare const TableRow: React.FC<Props>;
|
|
21
21
|
export default TableRow;
|
|
22
22
|
//# sourceMappingURL=TableRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/TableRow/TableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TableRow.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/TableRow/TableRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,WAAW,KAAK;IACpB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,yCAAyC;IACzC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAgCpC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"props":{"expandable":{"defaultValue":null,"description":"Sets if expanded row can be expanded","name":"expandable","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"boolean"}},"expanded":{"defaultValue":null,"description":"Sets if expanded row is expanded","name":"expanded","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"boolean"}},"onClick":{"defaultValue":null,"description":"When hide/show button for expanded row is clicked.","name":"onClick","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"(() => void)"}},"hideDetailsText":{"defaultValue":null,"description":"Text for expanded row hide button.","name":"hideDetailsText","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"string"}},"showDetailsText":{"defaultValue":null,"description":"Text for expanded row show button.","name":"showDetailsText","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"string"}},"rowKey":{"defaultValue":null,"description":"Key attribute for row","name":"rowKey","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"string"}},"className":{"defaultValue":null,"description":"Adds custom classes to the element.","name":"className","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"string"}},"children":{"defaultValue":null,"description":"Sets the cells of the table row element.","name":"children","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"ReactNode"}}}}
|
|
1
|
+
{"props":{"expandable":{"defaultValue":null,"description":"Sets if expanded row can be expanded","name":"expandable","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"boolean"}},"expanded":{"defaultValue":null,"description":"Sets if expanded row is expanded","name":"expanded","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"boolean"}},"onClick":{"defaultValue":null,"description":"When hide/show button for expanded row is clicked.","name":"onClick","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"(() => void)"}},"hideDetailsText":{"defaultValue":null,"description":"Text for expanded row hide button.","name":"hideDetailsText","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"string"}},"showDetailsText":{"defaultValue":null,"description":"Text for expanded row show button.","name":"showDetailsText","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"string"}},"rowKey":{"defaultValue":null,"description":"Key attribute for row","name":"rowKey","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"string"}},"className":{"defaultValue":null,"description":"Adds custom classes to the element.","name":"className","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"}],"required":false,"type":{"name":"string"}},"children":{"defaultValue":null,"description":"Sets the cells of the table row element.","name":"children","parent":{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},"declarations":[{"fileName":"src/components/Table/TableRow/TableRow.tsx","name":"Props"},{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"TypeLiteral"}],"required":false,"type":{"name":"ReactNode"}}}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import d,{useRef as T,useState as w}from"react";import z from"classnames";import k from"./styles.module.scss";import{AnalyticsId as C}from"../../constants.js";import{H as x}from"../../HorizontalScroll.js";import{useSize as y}from"../../hooks/useSize.js";import{Breakpoint as m,useBreakpoint as B}from"../../hooks/useBreakpoint.js";import{isTouchDevice as H}from"../../utils/device.js";import{useLayoutEvent as W}from"../../hooks/useLayoutEvent.js";import{T as ur}from"../../TableBody.js";import{T as Tr,a as wr}from"../../TableCell.js";import{T as Cr}from"../../TableExpandedRow.js";import{T as yr}from"../../TableExpanderCell.js";import{H as Hr,T as Wr}from"../../TableHead.js";import{S as Er,T as Rr}from"../../TableHeadCell.js";import{T as Vr}from"../../TableRow.js";import"../../hooks/useIsVisible.js";import"../../hooks/useIntersectionObserver.js";import"../HorizontalScroll/styles.module.scss";import"../../utils/debounce.js";import"../../theme/grid.js";import"../../Button.js";import"../../utils/environment.js";import"../../theme/currys/color.js";import"../../theme/index.js";import"../../theme/palette.js";import"../../theme/spacers.js";import"../Icons/Icon.js";import"../../hooks/useUuid.js";import"../../uuid.js";import"../../hooks/useHover.js";import"../../hooks/useIcons.js";import"../Button/styles.module.scss";import"../Icons/ArrowRight.js";import"../Icons/ChevronUp.js";import"../Icons/ChevronDown.js";import"../Icons/ArrowUp.js";import"../Icons/ArrowDown.js";const S=r=>r.variant===t.centeredoverflow||r.variant===t.block,E=r=>k[`table--${r.variant}-${r.breakpoint}`],R=(r,e)=>m[r.breakpoint]-m[e.breakpoint],f=(r,e)=>m[r.breakpoint]>=e,A=(r,e)=>{if(Array.isArray(r))return r.sort(R),r.find(i=>f(i,e));if(r&&f(r,e))return r},V=(r,e,i,p)=>{var s,c;const o=A(r,e),n=H(),l=i<=p;if(!!o)return o.variant===t.centeredoverflow&&!l&&o.fallbackVariant===t.horizontalscroll?{variant:n?t.horizontalscroll:t.none,breakpoint:o.breakpoint}:o.variant===t.centeredoverflow&&!l&&o.fallbackVariant!==t.centeredoverflow?{variant:(s=o.fallbackVariant)!=null?s:t.none,breakpoint:o.breakpoint}:o.variant===t.horizontalscroll&&!n&&o.fallbackVariant===t.centeredoverflow?{variant:l?t.centeredoverflow:t.none,breakpoint:o.breakpoint}:o.variant===t.horizontalscroll&&!n&&o.fallbackVariant!==t.horizontalscroll?{variant:(c=o.fallbackVariant)!=null?c:t.none,breakpoint:o.breakpoint}:o},D=r=>r&&S(r)?E(r):void 0,F=r=>r===t.block||r===t.horizontalscroll,U=r=>({breakpoint:"sm",variant:r});var t=(r=>(r.none="none",r.centeredoverflow="centeredoverflow",r.horizontalscroll="horizontalscroll",r.block="block",r))(t||{});const fr=({id:r,testId:e,className:i,children:p,smallViewportVariant:o="horizontalscroll"})=>{const n=T(null),l=B(),{width:s=0}=y(n)||{},[c,v]=w(window.innerWidth);W(()=>v(window.innerWidth),["resize"],100);const a=F(o)?U(o):V(o,l,s,c),u=D(a),h=z(k.table,u,i),b=d.createElement("table",{className:h,id:r,"data-testid":e,"data-analyticsid":C.Table,ref:n},p);return(a==null?void 0:a.variant)==="horizontalscroll"&&!(a!=null&&a.fallbackVariant)?d.createElement(x,{childWidth:s,testId:"horizontal-scroll"},b):b};export{Hr as HeaderCategory,t as SmallViewportVariant,Er as SortDirection,fr as Table,ur as TableBody,Tr as TableCell,Cr as TableExpandedRow,yr as TableExpanderCell,Wr as TableHead,Rr as TableHeadCell,Vr as TableRow,wr as TextAlign,fr as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Table/Table.tsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport classNames from 'classnames';\n\nimport tableStyles from './styles.module.scss';\n\nimport { AnalyticsId } from '../../constants';\nimport HorizontalScroll from '../HorizontalScroll';\nimport { useSize } from '../../hooks/useSize';\n\nexport enum SmallViewportVariant {\n /**\n * Show horizontal scrollbar when table is too big for the screen\n */\n horizontalscroll = 'horizontalscroll',\n /**\n * Collapse to two columns on small screens\n */\n block = 'block',\n}\n\nexport interface Props {\n /** Unique ID */\n id?: string;\n /** Id used for testing */\n testId?: string;\n /** Type of table view om small devices */\n smallViewportVariant?: SmallViewportVariant;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the content of the table. Use TableHead and TableBody */\n children: React.ReactNode;\n}\n\nexport const Table = function Table({\n id,\n testId,\n className,\n children,\n smallViewportVariant = SmallViewportVariant.horizontalscroll,\n}: Props) {\n const tableRef = useRef<HTMLTableElement>(null);\n const { width: tableWidth = 0 } = useSize(tableRef) || {};\n const tableClass = classNames(\n tableStyles['table'],\n { [tableStyles['table--collapse2col']]: smallViewportVariant === SmallViewportVariant.block },\n className\n );\n\n return (\n <HorizontalScroll childWidth={tableWidth}>\n <table className={tableClass} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Table} ref={tableRef}>\n {children}\n </table>\n </HorizontalScroll>\n );\n};\n\nexport default Table;\n"],"names":["SmallViewportVariant","Table","id","testId","className","children","smallViewportVariant","tableRef","useRef","tableWidth","useSize","tableClass","classNames","tableStyles","React","HorizontalScroll","AnalyticsId"],"mappings":"sxCASY,IAAAA,GAAAA,IAIVA,EAAA,iBAAmB,mBAInBA,EAAA,MAAQ,QAREA,IAAAA,GAAA,CAAA,CAAA,EAwBC,MAAAC,EAAQ,SAAe,CAClC,GAAAC,EACA,OAAAC,EACA,UAAAC,EACA,SAAAC,EACA,qBAAAC,EAAuB,kBACzB,EAAU,CACF,MAAAC,EAAWC,EAAyB,IAAI,EACxC,CAAE,MAAOC,EAAa,GAAMC,EAAQH,CAAQ,GAAK,GACjDI,EAAaC,EACjBC,EAAY,MACZ,CAAE,CAACA,EAAY,wBAAyBP,IAAyB,OAA2B,EAC5FF,CAAA,EAGF,OACGU,EAAA,cAAAC,EAAA,CAAiB,WAAYN,CAAA,EAC3BK,EAAA,cAAA,QAAA,CAAM,UAAWH,EAAY,GAAAT,EAAQ,cAAaC,EAAQ,mBAAkBa,EAAY,MAAO,IAAKT,CAAA,EAClGF,CACH,CACF,CAEJ"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Table/utils.ts","../../../src/components/Table/Table.tsx"],"sourcesContent":["import { Breakpoint } from '../../hooks/useBreakpoint';\nimport { isTouchDevice } from '../../utils/device';\nimport { BreakpointConfig, SmallViewportVariant } from './Table';\n\nimport styles from './styles.module.scss';\n\n/**\n * Sjekk om det skal brukes CSS for å bestemme responsivt utseende på dette breakpoint\n * @param config Konfigurasjon for responsiv oppførsel\n * @returns true om breakpoint bruker CSS\n */\nconst configUsesCss = (config: BreakpointConfig): boolean =>\n config.variant === SmallViewportVariant.centeredoverflow || config.variant === SmallViewportVariant.block;\n\n/**\n * Lag klassenavn for CSS-config\n * @param config Konfigurasjon for responsiv oppførsel\n * @returns CSS-klassenavn\n */\nconst mapConfigToClass = (config: BreakpointConfig): string => styles[`table--${config.variant}-${config.breakpoint}`];\n\n/**\n * Sorter konfigurasjon etter breakpoints, fra største til minste\n * @param a Konfigurasjon for responsiv oppførsel\n * @param b Konfigurasjon for responsiv oppførsel\n * @returns Sortert liste\n */\nconst sortByBreakpointsDescending = (a: BreakpointConfig, b: BreakpointConfig): number =>\n Breakpoint[a.breakpoint] - Breakpoint[b.breakpoint];\n\n/**\n * Sjekk om en konfigurasjon skal brukes for nåværende breakpoint\n * @param a Konfigurasjon for responsiv oppførsel\n * @param breakpoint Nåværende breakpoint\n * @returns true dersom config skal brukes for breakpointet\n */\nconst isValidForCurrentBreakpoint = (config: BreakpointConfig, breakpoint: Breakpoint): boolean =>\n Breakpoint[config.breakpoint] >= breakpoint;\n\n/**\n * Finn konfigurasjon for nåværende breakpoint\n * @param config Konfigurasjon for responsiv oppførsel\n * @param breakpoint Nåværende breakpoint\n * @returns Konfigurasjon for responsiv oppførsel\n */\nconst getConfigForBreakpoint = (config: BreakpointConfig | BreakpointConfig[], breakpoint: Breakpoint): BreakpointConfig | undefined => {\n if (Array.isArray(config)) {\n config.sort(sortByBreakpointsDescending);\n\n return config.find(x => isValidForCurrentBreakpoint(x, breakpoint));\n } else if (config && isValidForCurrentBreakpoint(config, breakpoint)) {\n return config;\n }\n};\n\n/**\n * Finn konfigurasjon for nåværende breakpoint og tabellbredde\n * @param config Konfigurasjon for responsiv oppførsel\n * @param breakpoint Nåværende breakpoint\n * @param tableWidth Bredde på tabell i px\n * @returns Konfigurasjon for responsiv oppførsel\n */\nexport const getCurrentConfig = (\n config: BreakpointConfig | BreakpointConfig[],\n breakpoint: Breakpoint,\n tableWidth: number,\n windowWidth: number\n): BreakpointConfig | undefined => {\n const breakpointConfig = getConfigForBreakpoint(config, breakpoint);\n const canUseHorizontalScroll = isTouchDevice();\n const canUseCenteredOverflow = tableWidth <= windowWidth;\n\n if (!breakpointConfig) {\n return;\n }\n\n if (\n breakpointConfig.variant === SmallViewportVariant.centeredoverflow &&\n !canUseCenteredOverflow &&\n breakpointConfig.fallbackVariant === SmallViewportVariant.horizontalscroll\n ) {\n return {\n variant: canUseHorizontalScroll ? SmallViewportVariant.horizontalscroll : SmallViewportVariant.none,\n breakpoint: breakpointConfig.breakpoint,\n };\n }\n\n if (\n breakpointConfig.variant === SmallViewportVariant.centeredoverflow &&\n !canUseCenteredOverflow &&\n breakpointConfig.fallbackVariant !== SmallViewportVariant.centeredoverflow\n ) {\n return {\n variant: breakpointConfig.fallbackVariant ?? SmallViewportVariant.none,\n breakpoint: breakpointConfig.breakpoint,\n };\n }\n\n if (\n breakpointConfig.variant === SmallViewportVariant.horizontalscroll &&\n !canUseHorizontalScroll &&\n breakpointConfig.fallbackVariant === SmallViewportVariant.centeredoverflow\n ) {\n return {\n variant: canUseCenteredOverflow ? SmallViewportVariant.centeredoverflow : SmallViewportVariant.none,\n breakpoint: breakpointConfig.breakpoint,\n };\n }\n\n if (\n breakpointConfig.variant === SmallViewportVariant.horizontalscroll &&\n !canUseHorizontalScroll &&\n breakpointConfig.fallbackVariant !== SmallViewportVariant.horizontalscroll\n ) {\n return {\n variant: breakpointConfig.fallbackVariant ?? SmallViewportVariant.none,\n breakpoint: breakpointConfig.breakpoint,\n };\n }\n\n return breakpointConfig;\n};\n\n/**\n * Finn klassenavn for responsiv oppførsel\n * @param config Konfigurasjon for responsiv oppførsel\n * @returns Klassenavn\n */\nexport const getBreakpointClass = (config?: BreakpointConfig): string | undefined =>\n config && configUsesCss(config) ? mapConfigToClass(config) : undefined;\n\n/** @deprecated Midlertidig, fjernes i v3.0.0 */\nexport const isOldFormat = (x: unknown): x is SmallViewportVariant =>\n (x as SmallViewportVariant) === SmallViewportVariant.block || (x as SmallViewportVariant) === SmallViewportVariant.horizontalscroll;\n\n/** @deprecated Midlertidig, fjernes i v3.0.0 */\nexport const getBackwardsCompatibleConfig = (variant: SmallViewportVariant): BreakpointConfig => {\n return {\n breakpoint: 'sm',\n variant,\n };\n};\n","import React, { useRef, useState } from 'react';\nimport classNames from 'classnames';\n\nimport styles from './styles.module.scss';\n\nimport { AnalyticsId } from '../../constants';\nimport HorizontalScroll from '../HorizontalScroll';\nimport { useSize } from '../../hooks/useSize';\nimport { Breakpoint, useBreakpoint } from '../../hooks/useBreakpoint';\nimport { getBackwardsCompatibleConfig, getCurrentConfig, getBreakpointClass, isOldFormat } from './utils';\nimport { useLayoutEvent } from '../../hooks/useLayoutEvent';\n\nexport enum SmallViewportVariant {\n /** No handling responsive behaviour. This will be the default in v3.0.0. */\n none = 'none',\n /** Overflow parent container to the left and right while remaining centered horizontally. */\n centeredoverflow = 'centeredoverflow',\n /** Show horizontal scrollbar when table is too big for the screen. */\n horizontalscroll = 'horizontalscroll',\n /** Collapse to two columns. */\n block = 'block',\n}\n\nexport interface BreakpointConfig {\n /** Breakpoint at which responsive behaviour will be applied. The table component uses a \"desktop first\" approach. */\n breakpoint: keyof typeof Breakpoint;\n /** Desired behaviour on this breakpoint and all smaller screens. */\n variant: keyof typeof SmallViewportVariant;\n /** If variant is horizontallscroll, use a fallback instead of device is not a touch device. */\n fallbackVariant?: keyof typeof SmallViewportVariant;\n}\n\nexport interface Props {\n /** Unique ID */\n id?: string;\n /** Id used for testing */\n testId?: string;\n /** Customize how the table behaves on various screen widths */\n /** @deprecated Rename to breakpointConfig in v3.0.0 and drop support for SmallViewPortVariant */\n smallViewportVariant?: SmallViewportVariant | BreakpointConfig | BreakpointConfig[];\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the content of the table. Use TableHead and TableBody */\n children: React.ReactNode;\n}\n\nexport const Table: React.FC<Props> = ({\n id,\n testId,\n className,\n children,\n smallViewportVariant: breakpointConfig = SmallViewportVariant.horizontalscroll,\n}) => {\n const tableRef = useRef<HTMLTableElement>(null);\n const breakpoint = useBreakpoint();\n const { width: tableWidth = 0 } = useSize(tableRef) || {};\n const [windowWidth, setWindowWidth] = useState(window.innerWidth);\n useLayoutEvent(() => setWindowWidth(window.innerWidth), ['resize'], 100);\n\n const currentConfig = isOldFormat(breakpointConfig)\n ? getBackwardsCompatibleConfig(breakpointConfig)\n : getCurrentConfig(breakpointConfig, breakpoint, tableWidth, windowWidth);\n const breakpointClass = getBreakpointClass(currentConfig);\n const tableClass = classNames(styles.table, breakpointClass, className);\n\n const table = (\n <table className={tableClass} id={id} data-testid={testId} data-analyticsid={AnalyticsId.Table} ref={tableRef}>\n {children}\n </table>\n );\n\n const useHorizontalScroll = currentConfig?.variant === SmallViewportVariant.horizontalscroll && !currentConfig?.fallbackVariant;\n\n if (useHorizontalScroll) {\n return (\n <HorizontalScroll childWidth={tableWidth} testId=\"horizontal-scroll\">\n {table}\n </HorizontalScroll>\n );\n }\n\n return table;\n};\n\nexport default Table;\n"],"names":["configUsesCss","config","SmallViewportVariant","mapConfigToClass","styles","sortByBreakpointsDescending","a","b","Breakpoint","isValidForCurrentBreakpoint","breakpoint","getConfigForBreakpoint","x","getCurrentConfig","tableWidth","windowWidth","breakpointConfig","canUseHorizontalScroll","isTouchDevice","canUseCenteredOverflow","_a","_b","getBreakpointClass","isOldFormat","getBackwardsCompatibleConfig","variant","Table","id","testId","className","children","tableRef","useRef","useBreakpoint","useSize","setWindowWidth","useState","useLayoutEvent","currentConfig","breakpointClass","tableClass","classNames","table","React","AnalyticsId","HorizontalScroll"],"mappings":"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"}
|
|
@@ -2,161 +2,166 @@
|
|
|
2
2
|
@import '../../scss/_breakpoints.scss';
|
|
3
3
|
@import '../../scss/_palette.scss';
|
|
4
4
|
@import '../../scss/_font-settings.scss';
|
|
5
|
+
@import '../../scss/_grid.scss';
|
|
5
6
|
|
|
6
7
|
/* fix outline for Safari */
|
|
7
8
|
table tbody tr {
|
|
8
9
|
outline: 3px solid transparent;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
@mixin centeredoverflow {
|
|
13
|
+
position: relative;
|
|
14
|
+
left: 50%;
|
|
15
|
+
transform: translateX(-50%);
|
|
16
|
+
}
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
@mixin block {
|
|
19
|
+
.table__cell-expander {
|
|
16
20
|
display: none;
|
|
17
21
|
}
|
|
18
|
-
&--collapse2col {
|
|
19
|
-
@media (max-width: map-get($grid-max-breakpoints, sm)) {
|
|
20
|
-
.table__cell-expander {
|
|
21
|
-
display: none;
|
|
22
|
-
}
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
.table__head {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
display: block;
|
|
28
|
+
clear: both;
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
tbody,
|
|
31
|
+
tr,
|
|
32
|
+
th,
|
|
33
|
+
td {
|
|
34
|
+
display: block;
|
|
35
|
+
}
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
tr {
|
|
38
|
+
clear: both;
|
|
39
|
+
}
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
select {
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
}
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/* Get data from the td-tag attribute "data-label" and use this to populate :before content */
|
|
66
|
-
&::before {
|
|
67
|
-
content: attr(data-label);
|
|
68
|
-
position: relative;
|
|
69
|
-
top: 0;
|
|
70
|
-
left: 0;
|
|
71
|
-
width: 60%;
|
|
72
|
-
padding-right: $spacer;
|
|
73
|
-
white-space: normal;
|
|
74
|
-
display: block;
|
|
75
|
-
float: left;
|
|
76
|
-
word-wrap: break-word;
|
|
77
|
-
margin-left: -67%;
|
|
78
|
-
padding-left: 0.75rem;
|
|
79
|
-
font-weight: 400;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
45
|
+
th:focus {
|
|
46
|
+
outline: none;
|
|
47
|
+
background-color: $blueberry800;
|
|
48
|
+
text-decoration: underline;
|
|
49
|
+
}
|
|
50
|
+
td {
|
|
51
|
+
position: relative;
|
|
52
|
+
padding-left: 40%;
|
|
53
|
+
padding-right: 0;
|
|
54
|
+
padding-top: 0.75rem;
|
|
55
|
+
padding-bottom: 0.75rem;
|
|
56
|
+
float: left;
|
|
57
|
+
clear: both;
|
|
58
|
+
width: 100%;
|
|
59
|
+
|
|
60
|
+
&:not(.expandable-container) {
|
|
61
|
+
font-weight: 400;
|
|
62
|
+
}
|
|
82
63
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
64
|
+
/* Get data from the td-tag attribute "data-label" and use this to populate :before content */
|
|
65
|
+
&::before {
|
|
66
|
+
content: attr(data-label);
|
|
67
|
+
position: relative;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
width: 60%;
|
|
71
|
+
padding-right: $spacer;
|
|
72
|
+
white-space: normal;
|
|
73
|
+
display: block;
|
|
74
|
+
float: left;
|
|
75
|
+
word-wrap: break-word;
|
|
76
|
+
margin-left: -67%;
|
|
77
|
+
padding-left: 0.75rem;
|
|
78
|
+
font-weight: 400;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
86
81
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
&:hover {
|
|
91
|
-
background-color: $blueberry50;
|
|
92
|
-
}
|
|
93
|
-
&--expanded {
|
|
94
|
-
background-color: $blueberry50;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
82
|
+
.table__expander-cell-mobile {
|
|
83
|
+
padding-left: 0.75rem;
|
|
84
|
+
}
|
|
97
85
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
86
|
+
.table__expanded-row td {
|
|
87
|
+
text-align: left;
|
|
88
|
+
padding: 0.75rem;
|
|
89
|
+
}
|
|
102
90
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
.table__expanded-row {
|
|
92
|
+
display: none;
|
|
93
|
+
&--expanded {
|
|
94
|
+
display: block;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
109
97
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
98
|
+
.table__cell {
|
|
99
|
+
border-top: 0;
|
|
100
|
+
border-bottom: 0;
|
|
113
101
|
|
|
114
|
-
|
|
102
|
+
outline: 0;
|
|
115
103
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
104
|
+
&--center {
|
|
105
|
+
text-align: left;
|
|
106
|
+
}
|
|
107
|
+
&--right {
|
|
108
|
+
text-align: left;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
.table__cell:first-child {
|
|
112
|
+
border-collapse: collapse;
|
|
113
|
+
border-top: 1px solid $neutral500;
|
|
114
|
+
}
|
|
115
|
+
.table__expanded-row {
|
|
116
|
+
.table__cell:first-child {
|
|
117
|
+
border-top: 0;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
.table__row--expandable {
|
|
121
|
+
.table__cell:nth-child(2) {
|
|
122
|
+
border-collapse: collapse;
|
|
123
|
+
border-top: 1px solid $neutral500;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
138
126
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
tr:last-child .table__cell:last-child {
|
|
128
|
+
border-bottom: 1px solid $neutral500;
|
|
129
|
+
}
|
|
142
130
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
131
|
+
.table__expander-cell-mobile {
|
|
132
|
+
border-bottom: 1px solid $neutral500;
|
|
133
|
+
&--expanded {
|
|
134
|
+
border-bottom: 0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.table__row--expandable {
|
|
139
|
+
&:focus-within {
|
|
140
|
+
outline: none;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.table {
|
|
146
|
+
width: 100%;
|
|
147
|
+
border-collapse: collapse;
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
@each $breakpoint in map-keys($grid-breakpoints) {
|
|
150
|
+
&--centeredoverflow-#{$breakpoint} {
|
|
151
|
+
@include media-breakpoint-down($breakpoint) {
|
|
152
|
+
@include centeredoverflow;
|
|
154
153
|
}
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
}
|
|
155
|
+
&--block-#{$breakpoint} {
|
|
156
|
+
@include media-breakpoint-down($breakpoint) {
|
|
157
|
+
@include block;
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
}
|
|
161
|
+
|
|
162
|
+
&__expander-cell-mobile {
|
|
163
|
+
display: none;
|
|
164
|
+
}
|
|
160
165
|
}
|
|
161
166
|
|
|
162
167
|
.table__head {
|
|
@@ -8,11 +8,8 @@ export type Styles = {
|
|
|
8
8
|
'table__cell-expander': string;
|
|
9
9
|
'table__expanded-row': string;
|
|
10
10
|
'table__expanded-row--expanded': string;
|
|
11
|
-
'table__expanded-row-button': string;
|
|
12
11
|
'table__expanded-row-container': string;
|
|
13
12
|
'table__expanded-row-container--open': string;
|
|
14
|
-
'table__expander-button-mobile': string;
|
|
15
|
-
'table__expander-button-mobile--expanded': string;
|
|
16
13
|
'table__expander-cell-mobile': string;
|
|
17
14
|
'table__expander-cell-mobile--expanded': string;
|
|
18
15
|
table__head: string;
|
|
@@ -26,7 +23,18 @@ export type Styles = {
|
|
|
26
23
|
'table__row--expandable': string;
|
|
27
24
|
'table__row--expandable--selected': string;
|
|
28
25
|
'table__sort-button': string;
|
|
29
|
-
'table--
|
|
26
|
+
'table--block-lg': string;
|
|
27
|
+
'table--block-md': string;
|
|
28
|
+
'table--block-sm': string;
|
|
29
|
+
'table--block-xl': string;
|
|
30
|
+
'table--block-xs': string;
|
|
31
|
+
'table--block-xxs': string;
|
|
32
|
+
'table--centeredoverflow-lg': string;
|
|
33
|
+
'table--centeredoverflow-md': string;
|
|
34
|
+
'table--centeredoverflow-sm': string;
|
|
35
|
+
'table--centeredoverflow-xl': string;
|
|
36
|
+
'table--centeredoverflow-xs': string;
|
|
37
|
+
'table--centeredoverflow-xxs': string;
|
|
30
38
|
};
|
|
31
39
|
|
|
32
40
|
export type ClassNames = keyof Styles;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Breakpoint } from '../../hooks/useBreakpoint';
|
|
2
|
+
import { BreakpointConfig, SmallViewportVariant } from './Table';
|
|
3
|
+
/**
|
|
4
|
+
* Finn konfigurasjon for nåværende breakpoint og tabellbredde
|
|
5
|
+
* @param config Konfigurasjon for responsiv oppførsel
|
|
6
|
+
* @param breakpoint Nåværende breakpoint
|
|
7
|
+
* @param tableWidth Bredde på tabell i px
|
|
8
|
+
* @returns Konfigurasjon for responsiv oppførsel
|
|
9
|
+
*/
|
|
10
|
+
export declare const getCurrentConfig: (config: BreakpointConfig | BreakpointConfig[], breakpoint: Breakpoint, tableWidth: number, windowWidth: number) => BreakpointConfig | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Finn klassenavn for responsiv oppførsel
|
|
13
|
+
* @param config Konfigurasjon for responsiv oppførsel
|
|
14
|
+
* @returns Klassenavn
|
|
15
|
+
*/
|
|
16
|
+
export declare const getBreakpointClass: (config?: BreakpointConfig) => string | undefined;
|
|
17
|
+
/** @deprecated Midlertidig, fjernes i v3.0.0 */
|
|
18
|
+
export declare const isOldFormat: (x: unknown) => x is SmallViewportVariant;
|
|
19
|
+
/** @deprecated Midlertidig, fjernes i v3.0.0 */
|
|
20
|
+
export declare const getBackwardsCompatibleConfig: (variant: SmallViewportVariant) => BreakpointConfig;
|
|
21
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Table/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAqDjE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,WACnB,gBAAgB,GAAG,gBAAgB,EAAE,cACjC,UAAU,cACV,MAAM,eACL,MAAM,KAClB,gBAAgB,GAAG,SAsDrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,YAAa,gBAAgB,KAAG,MAAM,GAAG,SACA,CAAC;AAEzE,gDAAgD;AAChD,eAAO,MAAM,WAAW,MAAO,OAAO,8BAC+F,CAAC;AAEtI,gDAAgD;AAChD,eAAO,MAAM,4BAA4B,YAAa,oBAAoB,KAAG,gBAK5E,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../src/utils/device.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,QAAO,OAEhC,CAAC"}
|
package/utils/device.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"device.js","sources":["../../src/utils/device.ts"],"sourcesContent":["export const isTouchDevice = (): boolean => {\n return 'ontouchstart' in window || navigator.maxTouchPoints > 0;\n};\n"],"names":["isTouchDevice"],"mappings":"AAAO,MAAMA,EAAgB,IACpB,iBAAkB,QAAU,UAAU,eAAiB"}
|