@navikt/ds-react 6.10.1 → 6.12.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/cjs/alert/Alert.d.ts +5 -0
- package/cjs/alert/Alert.js +5 -3
- package/cjs/alert/Alert.js.map +1 -1
- package/cjs/collapsible/parts/Collapsible.Content.js +1 -1
- package/cjs/collapsible/parts/Collapsible.Trigger.js +1 -1
- package/cjs/date/datepicker/types.d.ts +1 -1
- package/cjs/date/monthpicker/types.d.ts +1 -1
- package/cjs/form/file-upload/parts/Trigger.js +1 -1
- package/cjs/form/file-upload/parts/item/Item.d.ts +5 -0
- package/cjs/form/file-upload/parts/item/Item.js +2 -2
- package/cjs/form/file-upload/parts/item/Item.js.map +1 -1
- package/cjs/layout/base/BasePrimitive.d.ts +167 -0
- package/cjs/layout/base/BasePrimitive.js +70 -0
- package/cjs/layout/base/BasePrimitive.js.map +1 -0
- package/cjs/layout/base/PrimitiveAsChildProps.d.ts +41 -0
- package/cjs/layout/base/PrimitiveAsChildProps.js +3 -0
- package/cjs/layout/base/PrimitiveAsChildProps.js.map +1 -0
- package/cjs/layout/bleed/Bleed.js +1 -1
- package/cjs/layout/box/Box.d.ts +14 -35
- package/cjs/layout/box/Box.js +15 -4
- package/cjs/layout/box/Box.js.map +1 -1
- package/cjs/layout/grid/HGrid.d.ts +7 -5
- package/cjs/layout/grid/HGrid.js +7 -2
- package/cjs/layout/grid/HGrid.js.map +1 -1
- package/cjs/layout/page/Page.d.ts +4 -3
- package/cjs/layout/page/Page.js.map +1 -1
- package/cjs/layout/responsive/Responsive.js +1 -1
- package/cjs/layout/stack/HStack.d.ts +2 -1
- package/cjs/layout/stack/HStack.js.map +1 -1
- package/cjs/layout/stack/Stack.d.ts +8 -5
- package/cjs/layout/stack/Stack.js +10 -5
- package/cjs/layout/stack/Stack.js.map +1 -1
- package/cjs/layout/stack/VStack.d.ts +2 -1
- package/cjs/layout/stack/VStack.js.map +1 -1
- package/cjs/layout/utilities/css.js +3 -0
- package/cjs/layout/utilities/css.js.map +1 -1
- package/cjs/layout/utilities/types.d.ts +2 -1
- package/cjs/list/ListItem.js +2 -2
- package/cjs/list/ListItem.js.map +1 -1
- package/cjs/modal/dialog-polyfill.js +0 -3
- package/cjs/modal/dialog-polyfill.js.map +1 -1
- package/cjs/overlays/dismissablelayer/DismissableLayer.js +1 -1
- package/cjs/overlays/dismissablelayer/util/useFocusOutside.d.ts +2 -2
- package/cjs/overlays/dismissablelayer/util/useFocusOutside.js +6 -2
- package/cjs/overlays/dismissablelayer/util/useFocusOutside.js.map +1 -1
- package/cjs/overlays/dismissablelayer/util/usePointerDownOutside.d.ts +1 -1
- package/cjs/overlays/dismissablelayer/util/usePointerDownOutside.js +3 -1
- package/cjs/overlays/dismissablelayer/util/usePointerDownOutside.js.map +1 -1
- package/cjs/overlays/floating/Floating.js +1 -1
- package/cjs/pagination/Pagination.d.ts +7 -0
- package/cjs/pagination/Pagination.js +5 -2
- package/cjs/pagination/Pagination.js.map +1 -1
- package/cjs/pagination/PaginationItem.js +4 -2
- package/cjs/pagination/PaginationItem.js.map +1 -1
- package/cjs/portal/Portal.js +1 -1
- package/cjs/slot/Slot.d.ts +6 -0
- package/cjs/{util → slot}/Slot.js +6 -37
- package/cjs/slot/Slot.js.map +1 -0
- package/cjs/slot/merge-props.d.ts +4 -0
- package/cjs/slot/merge-props.js +37 -0
- package/cjs/slot/merge-props.js.map +1 -0
- package/cjs/toggle-group/ToggleGroup.d.ts +3 -3
- package/cjs/toggle-group/ToggleGroup.js +3 -3
- package/cjs/toggle-group/parts/ToggleItem.d.ts +32 -5
- package/cjs/toggle-group/parts/ToggleItem.js +4 -2
- package/cjs/toggle-group/parts/ToggleItem.js.map +1 -1
- package/cjs/toggle-group/parts/useToggleItem.js +1 -1
- package/cjs/toggle-group/parts/useToggleItem.js.map +1 -1
- package/cjs/util/hooks/descendants/useDescendant.js +1 -1
- package/cjs/util/hooks/descendants/useDescendant.js.map +1 -1
- package/cjs/util/hooks/descendants/utils.js +1 -1
- package/cjs/util/hooks/descendants/utils.js.map +1 -1
- package/cjs/util/i18n/get.js +3 -2
- package/cjs/util/i18n/get.js.map +1 -1
- package/cjs/util/types/AsChildProps.d.ts +1 -0
- package/esm/alert/Alert.d.ts +5 -0
- package/esm/alert/Alert.js +5 -3
- package/esm/alert/Alert.js.map +1 -1
- package/esm/collapsible/parts/Collapsible.Content.js +1 -1
- package/esm/collapsible/parts/Collapsible.Trigger.js +1 -1
- package/esm/date/datepicker/types.d.ts +1 -1
- package/esm/date/monthpicker/types.d.ts +1 -1
- package/esm/form/file-upload/parts/Trigger.js +1 -1
- package/esm/form/file-upload/parts/item/Item.d.ts +5 -0
- package/esm/form/file-upload/parts/item/Item.js +2 -2
- package/esm/form/file-upload/parts/item/Item.js.map +1 -1
- package/esm/layout/base/BasePrimitive.d.ts +167 -0
- package/esm/layout/base/BasePrimitive.js +63 -0
- package/esm/layout/base/BasePrimitive.js.map +1 -0
- package/esm/layout/base/PrimitiveAsChildProps.d.ts +41 -0
- package/esm/layout/base/PrimitiveAsChildProps.js +2 -0
- package/esm/layout/base/PrimitiveAsChildProps.js.map +1 -0
- package/esm/layout/bleed/Bleed.js +1 -1
- package/esm/layout/box/Box.d.ts +14 -35
- package/esm/layout/box/Box.js +15 -4
- package/esm/layout/box/Box.js.map +1 -1
- package/esm/layout/grid/HGrid.d.ts +7 -5
- package/esm/layout/grid/HGrid.js +7 -2
- package/esm/layout/grid/HGrid.js.map +1 -1
- package/esm/layout/page/Page.d.ts +4 -3
- package/esm/layout/page/Page.js.map +1 -1
- package/esm/layout/responsive/Responsive.js +1 -1
- package/esm/layout/stack/HStack.d.ts +2 -1
- package/esm/layout/stack/HStack.js.map +1 -1
- package/esm/layout/stack/Stack.d.ts +8 -5
- package/esm/layout/stack/Stack.js +10 -5
- package/esm/layout/stack/Stack.js.map +1 -1
- package/esm/layout/stack/VStack.d.ts +2 -1
- package/esm/layout/stack/VStack.js.map +1 -1
- package/esm/layout/utilities/css.js +3 -0
- package/esm/layout/utilities/css.js.map +1 -1
- package/esm/layout/utilities/types.d.ts +2 -1
- package/esm/list/ListItem.js +3 -3
- package/esm/list/ListItem.js.map +1 -1
- package/esm/modal/dialog-polyfill.js +0 -3
- package/esm/modal/dialog-polyfill.js.map +1 -1
- package/esm/overlays/dismissablelayer/DismissableLayer.js +1 -1
- package/esm/overlays/dismissablelayer/util/useFocusOutside.d.ts +2 -2
- package/esm/overlays/dismissablelayer/util/useFocusOutside.js +6 -2
- package/esm/overlays/dismissablelayer/util/useFocusOutside.js.map +1 -1
- package/esm/overlays/dismissablelayer/util/usePointerDownOutside.d.ts +1 -1
- package/esm/overlays/dismissablelayer/util/usePointerDownOutside.js +3 -1
- package/esm/overlays/dismissablelayer/util/usePointerDownOutside.js.map +1 -1
- package/esm/overlays/floating/Floating.js +1 -1
- package/esm/pagination/Pagination.d.ts +7 -0
- package/esm/pagination/Pagination.js +6 -3
- package/esm/pagination/Pagination.js.map +1 -1
- package/esm/pagination/PaginationItem.js +4 -2
- package/esm/pagination/PaginationItem.js.map +1 -1
- package/esm/portal/Portal.js +1 -1
- package/esm/slot/Slot.d.ts +6 -0
- package/esm/slot/Slot.js +32 -0
- package/esm/slot/Slot.js.map +1 -0
- package/esm/slot/merge-props.d.ts +4 -0
- package/esm/slot/merge-props.js +34 -0
- package/esm/slot/merge-props.js.map +1 -0
- package/esm/toggle-group/ToggleGroup.d.ts +3 -3
- package/esm/toggle-group/ToggleGroup.js +3 -3
- package/esm/toggle-group/parts/ToggleItem.d.ts +32 -5
- package/esm/toggle-group/parts/ToggleItem.js +4 -2
- package/esm/toggle-group/parts/ToggleItem.js.map +1 -1
- package/esm/toggle-group/parts/useToggleItem.js +1 -1
- package/esm/toggle-group/parts/useToggleItem.js.map +1 -1
- package/esm/util/hooks/descendants/useDescendant.js +1 -1
- package/esm/util/hooks/descendants/useDescendant.js.map +1 -1
- package/esm/util/hooks/descendants/utils.js +1 -1
- package/esm/util/hooks/descendants/utils.js.map +1 -1
- package/esm/util/i18n/get.js +3 -2
- package/esm/util/i18n/get.js.map +1 -1
- package/esm/util/types/AsChildProps.d.ts +1 -0
- package/package.json +3 -3
- package/src/alert/Alert.tsx +23 -2
- package/src/collapsible/parts/Collapsible.Content.tsx +1 -1
- package/src/collapsible/parts/Collapsible.Trigger.tsx +1 -1
- package/src/date/datepicker/types.ts +1 -1
- package/src/date/monthpicker/types.ts +1 -1
- package/src/form/file-upload/parts/Trigger.tsx +1 -1
- package/src/form/file-upload/parts/item/Item.tsx +7 -1
- package/src/layout/base/BasePrimitive.tsx +314 -0
- package/src/layout/base/PrimitiveAsChildProps.ts +42 -0
- package/src/layout/bleed/Bleed.tsx +1 -1
- package/src/layout/box/Box.tsx +66 -76
- package/src/layout/grid/HGrid.tsx +73 -45
- package/src/layout/page/Page.tsx +4 -3
- package/src/layout/responsive/Responsive.tsx +1 -1
- package/src/layout/stack/HStack.tsx +2 -1
- package/src/layout/stack/Stack.tsx +80 -62
- package/src/layout/stack/VStack.tsx +3 -1
- package/src/layout/utilities/css.ts +3 -0
- package/src/layout/utilities/types.ts +2 -3
- package/src/list/ListItem.tsx +5 -5
- package/src/modal/dialog-polyfill.ts +0 -3
- package/src/overlays/dismissablelayer/DismissableLayer.tsx +1 -1
- package/src/overlays/dismissablelayer/util/useFocusOutside.ts +6 -2
- package/src/overlays/dismissablelayer/util/usePointerDownOutside.ts +3 -1
- package/src/overlays/floating/Floating.tsx +1 -1
- package/src/pagination/Pagination.tsx +26 -1
- package/src/pagination/PaginationItem.tsx +4 -0
- package/src/portal/Portal.tsx +1 -1
- package/src/slot/Slot.tsx +33 -0
- package/src/{util/Slot.tsx → slot/merge-props.ts} +2 -34
- package/src/slot/tests/merge-props.test.ts +49 -0
- package/src/toggle-group/ToggleGroup.test.tsx +3 -9
- package/src/toggle-group/ToggleGroup.tsx +3 -3
- package/src/toggle-group/parts/ToggleItem.tsx +54 -8
- package/src/toggle-group/parts/useToggleItem.ts +4 -1
- package/src/util/hooks/descendants/useDescendant.tsx +1 -1
- package/src/util/hooks/descendants/utils.ts +1 -1
- package/src/util/i18n/get.ts +4 -2
- package/src/util/types/AsChildProps.ts +1 -0
- package/cjs/layout/sidemal-test/AvatarPanel.d.ts +0 -4
- package/cjs/layout/sidemal-test/AvatarPanel.js +0 -19
- package/cjs/layout/sidemal-test/AvatarPanel.js.map +0 -1
- package/cjs/layout/sidemal-test/Content.d.ts +0 -2
- package/cjs/layout/sidemal-test/Content.js +0 -67
- package/cjs/layout/sidemal-test/Content.js.map +0 -1
- package/cjs/layout/sidemal-test/Filter.d.ts +0 -2
- package/cjs/layout/sidemal-test/Filter.js +0 -49
- package/cjs/layout/sidemal-test/Filter.js.map +0 -1
- package/cjs/layout/sidemal-test/Header.d.ts +0 -2
- package/cjs/layout/sidemal-test/Header.js +0 -49
- package/cjs/layout/sidemal-test/Header.js.map +0 -1
- package/cjs/layout/sidemal-test/Intro.d.ts +0 -2
- package/cjs/layout/sidemal-test/Intro.js +0 -37
- package/cjs/layout/sidemal-test/Intro.js.map +0 -1
- package/cjs/layout/sidemal-test/Sidebar.d.ts +0 -4
- package/cjs/layout/sidemal-test/Sidebar.js +0 -50
- package/cjs/layout/sidemal-test/Sidebar.js.map +0 -1
- package/cjs/layout/sidemal-test/content-box/ContentBox.d.ts +0 -8
- package/cjs/layout/sidemal-test/content-box/ContentBox.js +0 -66
- package/cjs/layout/sidemal-test/content-box/ContentBox.js.map +0 -1
- package/cjs/layout/sidemal-test/content-box/index.d.ts +0 -1
- package/cjs/layout/sidemal-test/content-box/index.js +0 -9
- package/cjs/layout/sidemal-test/content-box/index.js.map +0 -1
- package/cjs/util/Slot.d.ts +0 -6
- package/cjs/util/Slot.js.map +0 -1
- package/esm/layout/sidemal-test/AvatarPanel.d.ts +0 -4
- package/esm/layout/sidemal-test/AvatarPanel.js +0 -12
- package/esm/layout/sidemal-test/AvatarPanel.js.map +0 -1
- package/esm/layout/sidemal-test/Content.d.ts +0 -2
- package/esm/layout/sidemal-test/Content.js +0 -60
- package/esm/layout/sidemal-test/Content.js.map +0 -1
- package/esm/layout/sidemal-test/Filter.d.ts +0 -2
- package/esm/layout/sidemal-test/Filter.js +0 -22
- package/esm/layout/sidemal-test/Filter.js.map +0 -1
- package/esm/layout/sidemal-test/Header.d.ts +0 -2
- package/esm/layout/sidemal-test/Header.js +0 -42
- package/esm/layout/sidemal-test/Header.js.map +0 -1
- package/esm/layout/sidemal-test/Intro.d.ts +0 -2
- package/esm/layout/sidemal-test/Intro.js +0 -30
- package/esm/layout/sidemal-test/Intro.js.map +0 -1
- package/esm/layout/sidemal-test/Sidebar.d.ts +0 -4
- package/esm/layout/sidemal-test/Sidebar.js +0 -41
- package/esm/layout/sidemal-test/Sidebar.js.map +0 -1
- package/esm/layout/sidemal-test/content-box/ContentBox.d.ts +0 -8
- package/esm/layout/sidemal-test/content-box/ContentBox.js +0 -37
- package/esm/layout/sidemal-test/content-box/ContentBox.js.map +0 -1
- package/esm/layout/sidemal-test/content-box/index.d.ts +0 -1
- package/esm/layout/sidemal-test/content-box/index.js +0 -2
- package/esm/layout/sidemal-test/content-box/index.js.map +0 -1
- package/esm/util/Slot.d.ts +0 -6
- package/esm/util/Slot.js +0 -63
- package/esm/util/Slot.js.map +0 -1
- package/src/layout/sidemal-test/AvatarPanel.tsx +0 -27
- package/src/layout/sidemal-test/Content.tsx +0 -129
- package/src/layout/sidemal-test/Filter.tsx +0 -46
- package/src/layout/sidemal-test/Header.tsx +0 -96
- package/src/layout/sidemal-test/Intro.tsx +0 -91
- package/src/layout/sidemal-test/Sidebar.tsx +0 -77
- package/src/layout/sidemal-test/content-box/ContentBox.tsx +0 -46
- package/src/layout/sidemal-test/content-box/index.ts +0 -1
- package/src/layout/sidemal-test/styling.css +0 -43
- /package/src/{util/__tests__ → slot/tests}/Slot.test.tsx +0 -0
package/cjs/alert/Alert.d.ts
CHANGED
|
@@ -18,6 +18,11 @@ export interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
18
18
|
* @default false
|
|
19
19
|
*/
|
|
20
20
|
fullWidth?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Sets max-width on the content to 43.5rem.
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
contentMaxWidth?: boolean;
|
|
21
26
|
/**
|
|
22
27
|
* Removes background from Alert.
|
|
23
28
|
* @default false
|
package/cjs/alert/Alert.js
CHANGED
|
@@ -68,16 +68,18 @@ const Icon = (_a) => {
|
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
70
|
exports.Alert = (0, react_1.forwardRef)((_a, ref) => {
|
|
71
|
-
var { children, className, variant, size = "medium", fullWidth = false, inline = false, closeButton = false, onClose } = _a, rest = __rest(_a, ["children", "className", "variant", "size", "fullWidth", "inline", "closeButton", "onClose"]);
|
|
71
|
+
var { children, className, variant, size = "medium", fullWidth = false, contentMaxWidth = true, inline = false, closeButton = false, onClose } = _a, rest = __rest(_a, ["children", "className", "variant", "size", "fullWidth", "contentMaxWidth", "inline", "closeButton", "onClose"]);
|
|
72
72
|
return (react_1.default.createElement("div", Object.assign({}, rest, { ref: ref, className: (0, clsx_1.default)(className, "navds-alert", `navds-alert--${variant}`, `navds-alert--${size}`, {
|
|
73
73
|
"navds-alert--full-width": fullWidth,
|
|
74
74
|
"navds-alert--inline": inline,
|
|
75
75
|
"navds-alert--close-button": closeButton,
|
|
76
76
|
}) }),
|
|
77
77
|
react_1.default.createElement(Icon, { variant: variant, className: "navds-alert__icon" }),
|
|
78
|
-
react_1.default.createElement(typography_1.BodyLong, { as: "div", size: size, className: "navds-alert__wrapper" }, children),
|
|
78
|
+
react_1.default.createElement(typography_1.BodyLong, { as: "div", size: size, className: (0, clsx_1.default)("navds-alert__wrapper", contentMaxWidth && "navds-alert__wrapper--maxwidth") }, children),
|
|
79
79
|
closeButton && !inline && (react_1.default.createElement("div", { className: "navds-alert__button-wrapper" },
|
|
80
|
-
react_1.default.createElement(button_1.Button, { className: "navds-alert__button", size: "small", variant: "tertiary-neutral", onClick: onClose, type: "button", icon: react_1.default.createElement(aksel_icons_1.XMarkIcon, { title: "
|
|
80
|
+
react_1.default.createElement(button_1.Button, { className: "navds-alert__button", size: "small", variant: "tertiary-neutral", onClick: onClose, type: "button", icon: react_1.default.createElement(aksel_icons_1.XMarkIcon, { title: ["error", "warning"].includes(variant)
|
|
81
|
+
? "Lukk varsel"
|
|
82
|
+
: "Lukk melding" }) })))));
|
|
81
83
|
});
|
|
82
84
|
exports.default = exports.Alert;
|
|
83
85
|
//# sourceMappingURL=Alert.js.map
|
package/cjs/alert/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/alert/Alert.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAsB;AACtB,+CAA0C;AAC1C,qDAM6B;AAC7B,sCAAmC;AACnC,8CAAyC;
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/alert/Alert.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAsB;AACtB,+CAA0C;AAC1C,qDAM6B;AAC7B,sCAAmC;AACnC,8CAAyC;AA8CzC,MAAM,IAAI,GAAG,CAAC,EAAqB,EAAE,EAAE;QAAzB,EAAE,OAAO,OAAY,EAAP,KAAK,cAAnB,WAAqB,CAAF;IAC/B,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,8BAAC,kCAAoB,kBAAC,KAAK,EAAC,MAAM,IAAK,KAAK,EAAI,CAAC;QAC1D,KAAK,SAAS;YACZ,OAAO,8BAAC,6CAA+B,kBAAC,KAAK,EAAC,UAAU,IAAK,KAAK,EAAI,CAAC;QACzE,KAAK,MAAM;YACT,OAAO,8BAAC,uCAAyB,kBAAC,KAAK,EAAC,aAAa,IAAK,KA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E,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;wBACpC,CAAC,CAAC,aAAa;wBACf,CAAC,CAAC,cAAc,GAEpB,GAEJ,CACE,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAe,aAAK,CAAC"}
|
|
@@ -36,7 +36,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.CollapsibleContent = void 0;
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
|
-
const Slot_1 = require("../../
|
|
39
|
+
const Slot_1 = require("../../slot/Slot");
|
|
40
40
|
const Collapsible_context_1 = require("../Collapsible.context");
|
|
41
41
|
exports.CollapsibleContent = (0, react_1.forwardRef)((_a, ref) => {
|
|
42
42
|
var { children, asChild } = _a, rest = __rest(_a, ["children", "asChild"]);
|
|
@@ -36,7 +36,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
37
|
exports.CollapsibleTrigger = void 0;
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
|
-
const Slot_1 = require("../../
|
|
39
|
+
const Slot_1 = require("../../slot/Slot");
|
|
40
40
|
const composeEventHandlers_1 = require("../../util/composeEventHandlers");
|
|
41
41
|
const Collapsible_context_1 = require("../Collapsible.context");
|
|
42
42
|
exports.CollapsibleTrigger = (0, react_1.forwardRef)((_a, ref) => {
|
|
@@ -62,7 +62,7 @@ export interface DatePickerDefaultProps extends Omit<React.HTMLAttributes<HTMLDi
|
|
|
62
62
|
dropdownCaption?: boolean;
|
|
63
63
|
/**
|
|
64
64
|
* Apply the disabled modifier to the matching days.
|
|
65
|
-
* https://react-day-picker.js.org/api/
|
|
65
|
+
* https://react-day-picker.js.org/api/type-aliases/Matcher
|
|
66
66
|
*/
|
|
67
67
|
disabled?: Matcher[];
|
|
68
68
|
/**
|
|
@@ -33,7 +33,7 @@ export interface MonthPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
33
33
|
*/
|
|
34
34
|
dropdownCaption?: boolean;
|
|
35
35
|
/**
|
|
36
|
-
* Apply the disabled modifier to the matching months. Uses a subset of React Day Picker Matcher type. https://react-day-picker.js.org/api/
|
|
36
|
+
* Apply the disabled modifier to the matching months. Uses a subset of React Day Picker Matcher type. https://react-day-picker.js.org/api/type-aliases/Matcher
|
|
37
37
|
*/
|
|
38
38
|
disabled?: Matcher[];
|
|
39
39
|
/**
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const react_1 = __importStar(require("react"));
|
|
27
|
-
const Slot_1 = require("../../../
|
|
27
|
+
const Slot_1 = require("../../../slot/Slot");
|
|
28
28
|
const useFileUpload_1 = require("../useFileUpload");
|
|
29
29
|
const Trigger = (0, react_1.forwardRef)(({ children, multiple = true, accept, onSelect, validator, maxSizeInBytes, }, ref) => {
|
|
30
30
|
const { onChange, inputRef, mergedRef } = (0, useFileUpload_1.useFileUpload)({
|
|
@@ -33,6 +33,11 @@ export interface FileUploadItemProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
33
33
|
* @default "idle"
|
|
34
34
|
*/
|
|
35
35
|
status?: "downloading" | "uploading" | "idle";
|
|
36
|
+
/**
|
|
37
|
+
* File description. Replaces file size when status is "idle".
|
|
38
|
+
* This is useful for displaying upload date. Should not act as a replacement for error messages.
|
|
39
|
+
*/
|
|
40
|
+
description?: string;
|
|
36
41
|
/**
|
|
37
42
|
* Props for the action button.
|
|
38
43
|
*/
|
|
@@ -49,7 +49,7 @@ const ItemIcon_1 = __importDefault(require("./ItemIcon"));
|
|
|
49
49
|
const ItemName_1 = __importDefault(require("./ItemName"));
|
|
50
50
|
const format_file_size_1 = require("./utils/format-file-size");
|
|
51
51
|
exports.Item = (0, react_1.forwardRef)((_a, ref) => {
|
|
52
|
-
var { as: Component = "div", file, status = "idle", error, className, href, onFileClick, button, translations } = _a, rest = __rest(_a, ["as", "file", "status", "error", "className", "href", "onFileClick", "button", "translations"]);
|
|
52
|
+
var { as: Component = "div", file, status = "idle", error, className, href, onFileClick, button, translations, description } = _a, rest = __rest(_a, ["as", "file", "status", "error", "className", "href", "onFileClick", "button", "translations", "description"]);
|
|
53
53
|
const context = (0, FileUpload_context_1.useFileUploadTranslation)(false);
|
|
54
54
|
const translate = (0, i18n_context_1.useI18n)("FileUpload", { item: translations }, context === null || context === void 0 ? void 0 : context.translations);
|
|
55
55
|
const showError = !!error && status === "idle";
|
|
@@ -60,7 +60,7 @@ exports.Item = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
60
60
|
if (status === "downloading") {
|
|
61
61
|
return translate("item.downloading");
|
|
62
62
|
}
|
|
63
|
-
return (0, format_file_size_1.formatFileSize)(file);
|
|
63
|
+
return description !== null && description !== void 0 ? description : (0, format_file_size_1.formatFileSize)(file);
|
|
64
64
|
}
|
|
65
65
|
return (react_1.default.createElement(Component, Object.assign({ ref: ref }, rest, { className: (0, clsx_1.default)("navds-file-item", className, {
|
|
66
66
|
"navds-file-item--error": showError,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../../src/form/file-upload/parts/item/Item.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAsB;AACtB,+CAAsD;AACtD,qDAAkE;AAClE,uDAAmD;AAEnD,qEAA6D;AAE7D,iEAAoE;AAEpE,8DAAsC;AACtC,0DAAkC;AAClC,0DAAkC;AAClC,+DAA0D;
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../../src/form/file-upload/parts/item/Item.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAsB;AACtB,+CAAsD;AACtD,qDA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EAC5B,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,GACpB;YACF,uCAAK,SAAS,EAAC,4BAA4B;gBACzC,8BAAC,kBAAQ,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,GAAI;gBAC1D,8BAAC,sBAAS,IAAC,EAAE,EAAC,KAAK,EAAC,IAAI,EAAC,OAAO,IAC7B,aAAa,EAAE,CACN;gBACZ,uCACE,SAAS,EAAC,wBAAwB,mBACpB,oBAAoB,eACxB,QAAQ,IAEjB,SAAS,IAAI,CACZ,8BAAC,sBAAS,IACR,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,gCAAgC;oBAE1C,8BAAC,yCAA2B,0BAAe;oBAC1C,KAAK,CACI,CACb,CACG,CACF;YAEL,MAAM,KAAK,MAAM,IAAI,MAAM,IAAI,CAC9B,8BAAC,oBAAU,oBACL,MAAM,IACV,KAAK,EAAE,SAAS,CACd,MAAM,CAAC,MAAM,KAAK,OAAO;oBACvB,CAAC,CAAC,uBAAuB;oBACzB,CAAC,CAAC,wBAAwB,CAC7B,IACD,CACH,CACG,CACI,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,kBAAe,YAAI,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
3
|
+
export type PrimitiveProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Padding around children.
|
|
7
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
8
|
+
* or an object of spacing tokens for different breakpoints.
|
|
9
|
+
* @example
|
|
10
|
+
* padding='4'
|
|
11
|
+
* padding={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
12
|
+
*/
|
|
13
|
+
padding?: ResponsiveProp<SpacingScale>;
|
|
14
|
+
/**
|
|
15
|
+
* Horizontal padding around children.
|
|
16
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
17
|
+
* or an object of spacing tokens for different breakpoints.
|
|
18
|
+
* @example
|
|
19
|
+
* paddingInline='4'
|
|
20
|
+
* paddingInline='4 5'
|
|
21
|
+
* paddingInline={{xs: '0 32', sm: '3', md: '4 5', lg: '5', xl: '6'}}
|
|
22
|
+
*/
|
|
23
|
+
paddingInline?: ResponsiveProp<SpacingScale | `${SpacingScale} ${SpacingScale}`>;
|
|
24
|
+
/**
|
|
25
|
+
* Vertical padding around children.
|
|
26
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
27
|
+
* or an object of spacing tokens for different breakpoints.
|
|
28
|
+
* @example
|
|
29
|
+
* paddingBlock='4'
|
|
30
|
+
* paddingBlock='4 5'
|
|
31
|
+
* paddingBlock={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
32
|
+
*/
|
|
33
|
+
paddingBlock?: ResponsiveProp<SpacingScale | `${SpacingScale} ${SpacingScale}`>;
|
|
34
|
+
/**
|
|
35
|
+
* Margin around element.
|
|
36
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
37
|
+
* or an object of spacing tokens for different breakpoints.
|
|
38
|
+
* @example
|
|
39
|
+
* margin='4'
|
|
40
|
+
* margin={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
41
|
+
*/
|
|
42
|
+
margin?: ResponsiveProp<SpacingScale>;
|
|
43
|
+
/**
|
|
44
|
+
* Horizontal margin around element.
|
|
45
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
46
|
+
* or an object of spacing tokens for different breakpoints.
|
|
47
|
+
* @example
|
|
48
|
+
* marginInline='4'
|
|
49
|
+
* marginInline='4 5'
|
|
50
|
+
* marginInline={{xs: '0 32', sm: '3', md: '4 5', lg: '5', xl: '6'}}
|
|
51
|
+
*/
|
|
52
|
+
marginInline?: ResponsiveProp<SpacingScale | `${SpacingScale} ${SpacingScale}` | "auto" | `auto ${SpacingScale}` | `${SpacingScale} auto`>;
|
|
53
|
+
/**
|
|
54
|
+
* Vertical margin around element.
|
|
55
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
56
|
+
* or an object of spacing tokens for different breakpoints.
|
|
57
|
+
* @example
|
|
58
|
+
* marginBlock='4'
|
|
59
|
+
* marginBlock='4 5'
|
|
60
|
+
* marginBlock={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
61
|
+
*/
|
|
62
|
+
marginBlock?: ResponsiveProp<SpacingScale | `${SpacingScale} ${SpacingScale}` | "auto" | `auto ${SpacingScale}` | `${SpacingScale} auto`>;
|
|
63
|
+
/**
|
|
64
|
+
* CSS `width`
|
|
65
|
+
*/
|
|
66
|
+
width?: ResponsiveProp<string>;
|
|
67
|
+
/**
|
|
68
|
+
* CSS `min-width`
|
|
69
|
+
*/
|
|
70
|
+
minWidth?: ResponsiveProp<string>;
|
|
71
|
+
/**
|
|
72
|
+
* CSS `max-width`
|
|
73
|
+
*/
|
|
74
|
+
maxWidth?: ResponsiveProp<string>;
|
|
75
|
+
/**
|
|
76
|
+
* CSS `height`
|
|
77
|
+
*/
|
|
78
|
+
height?: ResponsiveProp<string>;
|
|
79
|
+
/**
|
|
80
|
+
* CSS `min-height`
|
|
81
|
+
*/
|
|
82
|
+
minHeight?: ResponsiveProp<string>;
|
|
83
|
+
/**
|
|
84
|
+
* CSS `max-height`
|
|
85
|
+
*/
|
|
86
|
+
maxHeight?: ResponsiveProp<string>;
|
|
87
|
+
/**
|
|
88
|
+
* CSS `position`
|
|
89
|
+
*/
|
|
90
|
+
position?: ResponsiveProp<"static" | "relative" | "absolute" | "fixed" | "sticky">;
|
|
91
|
+
/**
|
|
92
|
+
* CSS `inset`.
|
|
93
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
94
|
+
* or an object of spacing tokens for different breakpoints.
|
|
95
|
+
* @example
|
|
96
|
+
* inset='4'
|
|
97
|
+
* inset='4 5'
|
|
98
|
+
* inset={{xs: '0 32', sm: '3', md: '4 5', lg: '5', xl: '6'}}
|
|
99
|
+
*/
|
|
100
|
+
inset?: ResponsiveProp<SpacingScale | `${SpacingScale} ${SpacingScale}`>;
|
|
101
|
+
/**
|
|
102
|
+
* CSS `top`
|
|
103
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
104
|
+
* or an object of spacing tokens for different breakpoints.
|
|
105
|
+
* @example
|
|
106
|
+
* top='4'
|
|
107
|
+
* top={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
108
|
+
*/
|
|
109
|
+
top?: ResponsiveProp<SpacingScale>;
|
|
110
|
+
/**
|
|
111
|
+
* CSS `right`
|
|
112
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
113
|
+
* or an object of spacing tokens for different breakpoints.
|
|
114
|
+
* @example
|
|
115
|
+
* right='4'
|
|
116
|
+
* right={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
117
|
+
*/
|
|
118
|
+
right?: ResponsiveProp<SpacingScale>;
|
|
119
|
+
/**
|
|
120
|
+
* CSS `bottom`
|
|
121
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
122
|
+
* or an object of spacing tokens for different breakpoints.
|
|
123
|
+
* @example
|
|
124
|
+
* bottom='4'
|
|
125
|
+
* bottom={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
126
|
+
*/
|
|
127
|
+
bottom?: ResponsiveProp<SpacingScale>;
|
|
128
|
+
/**
|
|
129
|
+
* CSS `left`
|
|
130
|
+
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
131
|
+
* or an object of spacing tokens for different breakpoints.
|
|
132
|
+
* @example
|
|
133
|
+
* left='4'
|
|
134
|
+
* left={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
135
|
+
*/
|
|
136
|
+
left?: ResponsiveProp<SpacingScale>;
|
|
137
|
+
/**
|
|
138
|
+
* CSS `overflow`
|
|
139
|
+
*/
|
|
140
|
+
overflow?: ResponsiveProp<"visible" | "hidden" | "clip" | "scroll" | "auto">;
|
|
141
|
+
/**
|
|
142
|
+
* CSS `overflow-x`
|
|
143
|
+
*/
|
|
144
|
+
overflowX?: ResponsiveProp<"visible" | "hidden" | "clip" | "scroll" | "auto">;
|
|
145
|
+
/**
|
|
146
|
+
* CSS `overflow-y`
|
|
147
|
+
*/
|
|
148
|
+
overflowY?: ResponsiveProp<"visible" | "hidden" | "clip" | "scroll" | "auto">;
|
|
149
|
+
/**
|
|
150
|
+
* CSS `flex-basis`
|
|
151
|
+
*/
|
|
152
|
+
flexBasis?: ResponsiveProp<string>;
|
|
153
|
+
/**
|
|
154
|
+
* CSS `flex-shrink`
|
|
155
|
+
*/
|
|
156
|
+
flexShrink?: ResponsiveProp<string>;
|
|
157
|
+
/**
|
|
158
|
+
* CSS `flex-grow`
|
|
159
|
+
*/
|
|
160
|
+
flexGrow?: ResponsiveProp<string>;
|
|
161
|
+
};
|
|
162
|
+
export declare const PRIMITIVE_PROPS: (keyof PrimitiveProps)[];
|
|
163
|
+
interface BasePrimitiveProps extends PrimitiveProps {
|
|
164
|
+
children: React.ReactElement;
|
|
165
|
+
}
|
|
166
|
+
export declare const BasePrimitive: ({ children, className, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, position, inset, top, right, left, bottom, overflow, overflowX, overflowY, flexBasis, flexGrow, flexShrink, }: BasePrimitiveProps) => React.JSX.Element;
|
|
167
|
+
export default BasePrimitive;
|
|
@@ -0,0 +1,70 @@
|
|
|
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.BasePrimitive = exports.PRIMITIVE_PROPS = void 0;
|
|
7
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const Slot_1 = require("../../slot/Slot");
|
|
10
|
+
const css_1 = require("../utilities/css");
|
|
11
|
+
exports.PRIMITIVE_PROPS = [
|
|
12
|
+
"className",
|
|
13
|
+
"padding",
|
|
14
|
+
"paddingInline",
|
|
15
|
+
"paddingBlock",
|
|
16
|
+
"margin",
|
|
17
|
+
"marginInline",
|
|
18
|
+
"marginBlock",
|
|
19
|
+
"width",
|
|
20
|
+
"minWidth",
|
|
21
|
+
"maxWidth",
|
|
22
|
+
"height",
|
|
23
|
+
"minHeight",
|
|
24
|
+
"maxHeight",
|
|
25
|
+
"position",
|
|
26
|
+
"inset",
|
|
27
|
+
"top",
|
|
28
|
+
"right",
|
|
29
|
+
"bottom",
|
|
30
|
+
"left",
|
|
31
|
+
"overflow",
|
|
32
|
+
"overflowX",
|
|
33
|
+
"overflowY",
|
|
34
|
+
"flexBasis",
|
|
35
|
+
"flexGrow",
|
|
36
|
+
"flexShrink",
|
|
37
|
+
];
|
|
38
|
+
const BasePrimitive = ({ children, className, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, position, inset, top, right, left, bottom, overflow, overflowX, overflowY, flexBasis, flexGrow, flexShrink, }) => {
|
|
39
|
+
const style = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, css_1.getResponsiveProps)("r", "p", "spacing", padding)), (0, css_1.getResponsiveProps)("r", "pi", "spacing", paddingInline)), (0, css_1.getResponsiveProps)("r", "pb", "spacing", paddingBlock)), (0, css_1.getResponsiveProps)("r", "m", "spacing", margin)), (0, css_1.getResponsiveProps)("r", "mi", "spacing", marginInline)), (0, css_1.getResponsiveProps)("r", "mb", "spacing", marginBlock)), (0, css_1.getResponsiveValue)("r", "w", width)), (0, css_1.getResponsiveValue)("r", "minw", minWidth)), (0, css_1.getResponsiveValue)("r", "maxw", maxWidth)), (0, css_1.getResponsiveValue)("r", "h", height)), (0, css_1.getResponsiveValue)("r", "minh", minHeight)), (0, css_1.getResponsiveValue)("r", "maxh", maxHeight)), (0, css_1.getResponsiveValue)("r", "position", position)), (0, css_1.getResponsiveProps)("r", "inset", "spacing", inset)), (0, css_1.getResponsiveProps)("r", "top", "spacing", top)), (0, css_1.getResponsiveProps)("r", "right", "spacing", right)), (0, css_1.getResponsiveProps)("r", "bottom", "spacing", bottom)), (0, css_1.getResponsiveProps)("r", "left", "spacing", left)), (0, css_1.getResponsiveValue)("r", "overflow", overflow)), (0, css_1.getResponsiveValue)("r", "overflowx", overflowX)), (0, css_1.getResponsiveValue)("r", "overflowy", overflowY)), (0, css_1.getResponsiveValue)("r", "flex-basis", flexBasis)), (0, css_1.getResponsiveValue)("r", "flex-grow", flexGrow)), (0, css_1.getResponsiveValue)("r", "flex-shrink", flexShrink));
|
|
40
|
+
return (react_1.default.createElement(Slot_1.Slot, { className: (0, clsx_1.default)({
|
|
41
|
+
className,
|
|
42
|
+
"navds-r-p": padding,
|
|
43
|
+
"navds-r-pi": paddingInline,
|
|
44
|
+
"navds-r-pb": paddingBlock,
|
|
45
|
+
"navds-r-m": margin,
|
|
46
|
+
"navds-r-mi": marginInline,
|
|
47
|
+
"navds-r-mb": marginBlock,
|
|
48
|
+
"navds-r-w": width,
|
|
49
|
+
"navds-r-minw": minWidth,
|
|
50
|
+
"navds-r-maxw": maxWidth,
|
|
51
|
+
"navds-r-h": height,
|
|
52
|
+
"navds-r-minh": minHeight,
|
|
53
|
+
"navds-r-maxh": maxHeight,
|
|
54
|
+
"navds-r-position": position,
|
|
55
|
+
"navds-r-inset": inset,
|
|
56
|
+
"navds-r-top": top,
|
|
57
|
+
"navds-r-right": right,
|
|
58
|
+
"navds-r-bottom": bottom,
|
|
59
|
+
"navds-r-left": left,
|
|
60
|
+
"navds-r-overflow": overflow,
|
|
61
|
+
"navds-r-overflowx": overflowX,
|
|
62
|
+
"navds-r-overflowy": overflowY,
|
|
63
|
+
"navds-r-flex-basis": flexBasis,
|
|
64
|
+
"navds-r-flex-grow": flexGrow,
|
|
65
|
+
"navds-r-flex-shrink": flexShrink,
|
|
66
|
+
}), style: style }, children));
|
|
67
|
+
};
|
|
68
|
+
exports.BasePrimitive = BasePrimitive;
|
|
69
|
+
exports.default = exports.BasePrimitive;
|
|
70
|
+
//# sourceMappingURL=BasePrimitive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BasePrimitive.js","sourceRoot":"","sources":["../../../src/layout/base/BasePrimitive.tsx"],"names":[],"mappings":";;;;;;AAAA,gDAAsB;AACtB,kDAA0B;AAC1B,0CAAuC;AACvC,0CAA0E;AAqL7D,QAAA,eAAe,GAA6B;IACvD,WAAW;IACX,SAAS;IACT,eAAe;IACf,cAAc;IACd,QAAQ;IACR,cAAc;IACd,aAAa;IACb,OAAO;IACP,UAAU;IACV,UAAU;IACV,QAAQ;IACR,WAAW;IACX,WAAW;IACX,UAAU;IACV,OAAO;IACP,KAAK;IACL,OAAO;IACP,QAAQ;IACR,MAAM;IACN,UAAU;IACV,WAAW;IACX,WAAW;IACX,WAAW;IACX,UAAU;IACV,YAAY;CACb,CAAC;AAMK,MAAM,aAAa,GAAG,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,OAAO,EACP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Ac,EAAE,IAAI;YACpB,kBAAkB,EAAE,QAAQ;YAC5B,mBAAmB,EAAE,SAAS;YAC9B,mBAAmB,EAAE,SAAS;YAC9B,oBAAoB,EAAE,SAAS;YAC/B,mBAAmB,EAAE,QAAQ;YAC7B,qBAAqB,EAAE,UAAU;SAClC,CAAC,EACF,KAAK,EAAE,KAAK,IAEX,QAAQ,CACJ,CACR,CAAC;AACJ,CAAC,CAAC;AA/FW,QAAA,aAAa,iBA+FxB;AAEF,kBAAe,qBAAa,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type PrimitiveAsChildProps = {
|
|
3
|
+
children: React.ReactElement | false | null;
|
|
4
|
+
/**
|
|
5
|
+
* Renders the component and its child as a single element,
|
|
6
|
+
* merging the props of the component with the props of the child.
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <Component asChild data-prop>
|
|
10
|
+
* <ChildComponent data-child />
|
|
11
|
+
* </Component>
|
|
12
|
+
*
|
|
13
|
+
* // Renders
|
|
14
|
+
* <div data-prop data-child />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
asChild: true;
|
|
18
|
+
/**
|
|
19
|
+
* Implements [OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent)
|
|
20
|
+
*
|
|
21
|
+
* When using asChild, the prop is not allowed as it would have no effect.
|
|
22
|
+
*/
|
|
23
|
+
as?: never;
|
|
24
|
+
} | {
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Renders the component and its child as a single element,
|
|
28
|
+
* merging the props of the component with the props of the child.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Component asChild data-prop>
|
|
33
|
+
* <ChildComponent data-child />
|
|
34
|
+
* </Component>
|
|
35
|
+
*
|
|
36
|
+
* // Renders
|
|
37
|
+
* <div data-prop data-child />
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
asChild?: false;
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrimitiveAsChildProps.js","sourceRoot":"","sources":["../../../src/layout/base/PrimitiveAsChildProps.ts"],"names":[],"mappings":""}
|
|
@@ -40,7 +40,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
exports.Bleed = void 0;
|
|
41
41
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
|
-
const Slot_1 = require("../../
|
|
43
|
+
const Slot_1 = require("../../slot/Slot");
|
|
44
44
|
const css_1 = require("../utilities/css");
|
|
45
45
|
/**
|
|
46
46
|
* Foundational Layout-primitive for generic encapsulation & styling.
|
package/cjs/layout/box/Box.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { OverridableComponent } from "../../util/types";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/**
|
|
3
|
+
import { PrimitiveProps } from "../base/BasePrimitive";
|
|
4
|
+
import { PrimitiveAsChildProps } from "../base/PrimitiveAsChildProps";
|
|
5
|
+
import { BackgroundColorToken, BorderColorToken, BorderRadiiToken, ResponsiveProp, ShadowToken, SpaceDelimitedAttribute, SurfaceColorToken } from "../utilities/types";
|
|
6
|
+
export type BoxProps = PrimitiveProps & PrimitiveAsChildProps & React.HTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
/**
|
|
8
|
+
* CSS `background-color` property.
|
|
9
|
+
* Accepts a [background/surface color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#afff774dad80).
|
|
10
|
+
*/
|
|
11
|
+
background?: BackgroundColorToken | SurfaceColorToken;
|
|
12
|
+
/**
|
|
13
|
+
* CSS `border-color` property.
|
|
14
|
+
* Accepts a [border color token](https://aksel.nav.no/grunnleggende/styling/design-tokens#adb1767e2f87).
|
|
15
|
+
*/
|
|
8
16
|
borderColor?: BorderColorToken;
|
|
9
17
|
/**
|
|
10
18
|
* CSS `border-radius` property.
|
|
@@ -23,41 +31,12 @@ export interface BoxProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
23
31
|
* borderWidth='1 2 3 4'
|
|
24
32
|
*/
|
|
25
33
|
borderWidth?: SpaceDelimitedAttribute<"0" | "1" | "2" | "3" | "4" | "5">;
|
|
26
|
-
/**
|
|
27
|
-
* Padding around children.
|
|
28
|
-
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
29
|
-
* or an object of spacing tokens for different breakpoints.
|
|
30
|
-
* @example
|
|
31
|
-
* padding='4'
|
|
32
|
-
* padding={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
33
|
-
*/
|
|
34
|
-
padding?: ResponsiveProp<SpacingScale>;
|
|
35
|
-
/**
|
|
36
|
-
* Horizontal padding around children.
|
|
37
|
-
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
38
|
-
* or an object of spacing tokens for different breakpoints.
|
|
39
|
-
* @example
|
|
40
|
-
* paddingInline='4'
|
|
41
|
-
* paddingInline='4 5'
|
|
42
|
-
* paddingInline={{xs: '0 32', sm: '3', md: '4 5', lg: '5', xl: '6'}}
|
|
43
|
-
*/
|
|
44
|
-
paddingInline?: ResponsiveProp<SpacingScale | `${SpacingScale} ${SpacingScale}`>;
|
|
45
|
-
/**
|
|
46
|
-
* Vertical padding around children.
|
|
47
|
-
* Accepts a [spacing token](https://aksel.nav.no/grunnleggende/styling/design-tokens#0cc9fb32f213)
|
|
48
|
-
* or an object of spacing tokens for different breakpoints.
|
|
49
|
-
* @example
|
|
50
|
-
* paddingBlock='4'
|
|
51
|
-
* paddingBlock='4 5'
|
|
52
|
-
* paddingBlock={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}}
|
|
53
|
-
*/
|
|
54
|
-
paddingBlock?: ResponsiveProp<SpacingScale | `${SpacingScale} ${SpacingScale}`>;
|
|
55
34
|
/** Shadow on box. Accepts a shadow token.
|
|
56
35
|
* @example
|
|
57
36
|
* shadow='small'
|
|
58
37
|
*/
|
|
59
38
|
shadow?: ShadowToken;
|
|
60
|
-
}
|
|
39
|
+
};
|
|
61
40
|
/**
|
|
62
41
|
* Foundational Layout-primitive for generic encapsulation & styling.
|
|
63
42
|
*
|
package/cjs/layout/box/Box.js
CHANGED
|
@@ -40,6 +40,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
exports.Box = void 0;
|
|
41
41
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
|
+
const Slot_1 = require("../../slot/Slot");
|
|
44
|
+
const util_1 = require("../../util");
|
|
45
|
+
const BasePrimitive_1 = __importStar(require("../base/BasePrimitive"));
|
|
43
46
|
const css_1 = require("../utilities/css");
|
|
44
47
|
/**
|
|
45
48
|
* Foundational Layout-primitive for generic encapsulation & styling.
|
|
@@ -69,8 +72,8 @@ const css_1 = require("../utilities/css");
|
|
|
69
72
|
* </VStack>
|
|
70
73
|
*/
|
|
71
74
|
exports.Box = (0, react_1.forwardRef)((_a, ref) => {
|
|
72
|
-
var { as: Component = "div", background, borderColor, borderWidth, borderRadius,
|
|
73
|
-
const style = Object.assign(Object.assign(Object.assign(
|
|
75
|
+
var { children, className, as: Component = "div", background, borderColor, borderWidth, borderRadius, shadow, style: _style, asChild } = _a, rest = __rest(_a, ["children", "className", "as", "background", "borderColor", "borderWidth", "borderRadius", "shadow", "style", "asChild"]);
|
|
76
|
+
const style = Object.assign(Object.assign(Object.assign({}, _style), { "--__ac-box-background": background
|
|
74
77
|
? `var(--a-${background})`
|
|
75
78
|
: undefined, "--__ac-box-shadow": shadow ? `var(--a-shadow-${shadow})` : undefined, "--__ac-box-border-color": borderColor
|
|
76
79
|
? `var(--a-${borderColor})`
|
|
@@ -79,8 +82,16 @@ exports.Box = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
79
82
|
.split(" ")
|
|
80
83
|
.map((x) => `${x}px`)
|
|
81
84
|
.join(" ")
|
|
82
|
-
: undefined }), (0, css_1.getResponsiveProps)("box", "border-radius", "border-radius", borderRadius, false, ["0"]))
|
|
83
|
-
|
|
85
|
+
: undefined }), (0, css_1.getResponsiveProps)("box", "border-radius", "border-radius", borderRadius, false, ["0"]));
|
|
86
|
+
const Comp = asChild ? Slot_1.Slot : Component;
|
|
87
|
+
return (react_1.default.createElement(BasePrimitive_1.default, Object.assign({}, rest),
|
|
88
|
+
react_1.default.createElement(Comp, Object.assign({}, (0, util_1.omit)(rest, BasePrimitive_1.PRIMITIVE_PROPS), { ref: ref, style: style, className: (0, clsx_1.default)("navds-box", className, {
|
|
89
|
+
"navds-box-bg": background,
|
|
90
|
+
"navds-box-border-color": borderColor,
|
|
91
|
+
"navds-box-border-width": borderWidth,
|
|
92
|
+
"navds-box-border-radius": borderRadius,
|
|
93
|
+
"navds-box-shadow": shadow,
|
|
94
|
+
}) }), children)));
|
|
84
95
|
});
|
|
85
96
|
exports.default = exports.Box;
|
|
86
97
|
//# sourceMappingURL=Box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/layout/box/Box.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAsB;AACtB,+CAA0C;
|
|
1
|
+
{"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/layout/box/Box.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAsB;AACtB,+CAA0C;AAC1C,0CAAuC;AACvC,qCAAkC;AAElC,uEAG+B;AAE/B,0CAAsD;AAgDtD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,GAAG,GAAmD,IAAA,kBAAU,EAC3E,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AyB,EAAE,YAAY;gBACvC,kBAAkB,EAAE,MAAM;aAC3B,CAAC,KAED,QAAQ,CACJ,CACO,CACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAe,WAAG,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OverridableComponent } from "../../util";
|
|
3
|
+
import { PrimitiveProps } from "../base/BasePrimitive";
|
|
4
|
+
import { PrimitiveAsChildProps } from "../base/PrimitiveAsChildProps";
|
|
2
5
|
import { ResponsiveProp, SpacingScale } from "../utilities/types";
|
|
3
|
-
export
|
|
4
|
-
children: React.ReactNode;
|
|
6
|
+
export type HGridProps = PrimitiveProps & PrimitiveAsChildProps & React.HTMLAttributes<HTMLDivElement> & {
|
|
5
7
|
/**
|
|
6
8
|
* Number of columns to display. Can be a number, a string, or an object with values for specific breakpoints.
|
|
7
9
|
* Sets `grid-template-columns`, so `fr`, `minmax` etc. works.
|
|
@@ -25,7 +27,7 @@ export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
25
27
|
* Vertical alignment of children. Elements will by default stretch to the height of parent-element.
|
|
26
28
|
*/
|
|
27
29
|
align?: "start" | "center" | "end";
|
|
28
|
-
}
|
|
30
|
+
};
|
|
29
31
|
/**
|
|
30
32
|
* Horizontal Grid Primitive with dynamic columns and gap based on breakpoints.
|
|
31
33
|
*
|
|
@@ -51,5 +53,5 @@ export interface HGridProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
51
53
|
* <div />
|
|
52
54
|
* </HGrid>
|
|
53
55
|
*/
|
|
54
|
-
export declare const HGrid:
|
|
56
|
+
export declare const HGrid: OverridableComponent<HGridProps, HTMLDivElement>;
|
|
55
57
|
export default HGrid;
|
package/cjs/layout/grid/HGrid.js
CHANGED
|
@@ -40,6 +40,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
exports.HGrid = void 0;
|
|
41
41
|
const clsx_1 = __importDefault(require("clsx"));
|
|
42
42
|
const react_1 = __importStar(require("react"));
|
|
43
|
+
const Slot_1 = require("../../slot/Slot");
|
|
44
|
+
const util_1 = require("../../util");
|
|
45
|
+
const BasePrimitive_1 = __importStar(require("../base/BasePrimitive"));
|
|
43
46
|
const css_1 = require("../utilities/css");
|
|
44
47
|
/**
|
|
45
48
|
* Horizontal Grid Primitive with dynamic columns and gap based on breakpoints.
|
|
@@ -67,9 +70,11 @@ const css_1 = require("../utilities/css");
|
|
|
67
70
|
* </HGrid>
|
|
68
71
|
*/
|
|
69
72
|
exports.HGrid = (0, react_1.forwardRef)((_a, ref) => {
|
|
70
|
-
var { className, columns, gap, style, align } = _a, rest = __rest(_a, ["className", "columns", "gap", "style", "align"]);
|
|
73
|
+
var { children, className, as: Component = "div", columns, gap, style, align, asChild } = _a, rest = __rest(_a, ["children", "className", "as", "columns", "gap", "style", "align", "asChild"]);
|
|
71
74
|
const styles = Object.assign(Object.assign(Object.assign(Object.assign({}, style), { "--__ac-hgrid-align": align }), (0, css_1.getResponsiveProps)(`hgrid`, "gap", "spacing", gap)), (0, css_1.getResponsiveValue)(`hgrid`, "columns", formatGrid(columns)));
|
|
72
|
-
|
|
75
|
+
const Comp = asChild ? Slot_1.Slot : Component;
|
|
76
|
+
return (react_1.default.createElement(BasePrimitive_1.default, Object.assign({}, rest),
|
|
77
|
+
react_1.default.createElement(Comp, Object.assign({}, (0, util_1.omit)(rest, BasePrimitive_1.PRIMITIVE_PROPS), { ref: ref, className: (0, clsx_1.default)("navds-hgrid", className), style: styles }), children)));
|
|
73
78
|
});
|
|
74
79
|
function formatGrid(props) {
|
|
75
80
|
if (!props) {
|