@navikt/ds-react 3.4.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_docs.json +5615 -3780
- package/cjs/date/hooks/index.js +4 -4
- package/cjs/date/index.js +6 -6
- package/cjs/dropdown/Dropdown.js +57 -0
- package/cjs/dropdown/Menu/Divider.js +47 -0
- package/cjs/dropdown/Menu/GroupedList/Heading.js +47 -0
- package/cjs/dropdown/Menu/GroupedList/Item.js +54 -0
- package/cjs/dropdown/Menu/GroupedList/index.js +51 -0
- package/cjs/dropdown/Menu/GroupedList/package.json +6 -0
- package/cjs/dropdown/Menu/List/Item.js +54 -0
- package/cjs/dropdown/Menu/List/index.js +49 -0
- package/cjs/dropdown/Menu/List/package.json +6 -0
- package/cjs/dropdown/Menu/index.js +64 -0
- package/cjs/dropdown/Menu/package.json +6 -0
- package/cjs/dropdown/Toggle.js +66 -0
- package/cjs/dropdown/index.js +23 -0
- package/cjs/dropdown/package.json +6 -0
- package/cjs/form/radio/RadioGroup.js +10 -0
- package/cjs/index.js +3 -0
- package/cjs/internal-header/InternalHeader.js +55 -0
- package/cjs/internal-header/InternalHeaderButton.js +47 -0
- package/cjs/internal-header/InternalHeaderTitle.js +48 -0
- package/cjs/internal-header/InternalHeaderUser.js +51 -0
- package/cjs/internal-header/InternalHeaderUserButton.js +54 -0
- package/cjs/internal-header/index.js +8 -0
- package/cjs/internal-header/package.json +6 -0
- package/cjs/read-more/ReadMore.js +17 -0
- package/cjs/timeline/AxisLabels.js +90 -0
- package/cjs/timeline/Pin.js +106 -0
- package/cjs/timeline/Timeline.js +162 -0
- package/cjs/timeline/TimelineRow.js +86 -0
- package/cjs/timeline/hooks/usePeriodContext.js +16 -0
- package/cjs/timeline/hooks/useRowContext.js +18 -0
- package/cjs/timeline/hooks/useTimelineContext.js +23 -0
- package/cjs/timeline/hooks/useTimelineRows.js +79 -0
- package/cjs/timeline/index.js +8 -0
- package/cjs/timeline/package.json +6 -0
- package/cjs/timeline/period/ClickablePeriod.js +120 -0
- package/cjs/timeline/period/NonClickablePeriod.js +18 -0
- package/cjs/timeline/period/index.js +46 -0
- package/cjs/timeline/period/package.json +6 -0
- package/cjs/timeline/utils/calc.js +19 -0
- package/cjs/timeline/utils/filter.js +18 -0
- package/cjs/timeline/utils/index.js +7 -0
- package/cjs/timeline/utils/package.json +6 -0
- package/cjs/timeline/utils/period.js +40 -0
- package/cjs/timeline/utils/sort.js +10 -0
- package/cjs/timeline/utils/timeline.js +79 -0
- package/cjs/timeline/utils/types.external.js +2 -0
- package/cjs/timeline/utils/types.internal.js +2 -0
- package/cjs/timeline/zoom/ZoomButton.js +68 -0
- package/cjs/timeline/zoom/index.js +50 -0
- package/cjs/timeline/zoom/package.json +6 -0
- package/esm/date/hooks/index.d.ts +3 -3
- package/esm/date/hooks/index.js +3 -3
- package/esm/date/hooks/index.js.map +1 -1
- package/esm/date/index.d.ts +3 -3
- package/esm/date/index.js +3 -3
- package/esm/date/index.js.map +1 -1
- package/esm/dropdown/Dropdown.d.ts +37 -0
- package/esm/dropdown/Dropdown.js +29 -0
- package/esm/dropdown/Dropdown.js.map +1 -0
- package/esm/dropdown/Menu/Divider.d.ts +4 -0
- package/esm/dropdown/Menu/Divider.js +19 -0
- package/esm/dropdown/Menu/Divider.js.map +1 -0
- package/esm/dropdown/Menu/GroupedList/Heading.d.ts +10 -0
- package/esm/dropdown/Menu/GroupedList/Heading.js +19 -0
- package/esm/dropdown/Menu/GroupedList/Heading.js.map +1 -0
- package/esm/dropdown/Menu/GroupedList/Item.d.ts +11 -0
- package/esm/dropdown/Menu/GroupedList/Item.js +26 -0
- package/esm/dropdown/Menu/GroupedList/Item.js.map +1 -0
- package/esm/dropdown/Menu/GroupedList/index.d.ts +15 -0
- package/esm/dropdown/Menu/GroupedList/index.js +23 -0
- package/esm/dropdown/Menu/GroupedList/index.js.map +1 -0
- package/esm/dropdown/Menu/List/Item.d.ts +11 -0
- package/esm/dropdown/Menu/List/Item.js +26 -0
- package/esm/dropdown/Menu/List/Item.js.map +1 -0
- package/esm/dropdown/Menu/List/index.d.ts +13 -0
- package/esm/dropdown/Menu/List/index.js +21 -0
- package/esm/dropdown/Menu/List/index.js.map +1 -0
- package/esm/dropdown/Menu/index.d.ts +27 -0
- package/esm/dropdown/Menu/index.js +36 -0
- package/esm/dropdown/Menu/index.js.map +1 -0
- package/esm/dropdown/Toggle.d.ts +10 -0
- package/esm/dropdown/Toggle.js +38 -0
- package/esm/dropdown/Toggle.js.map +1 -0
- package/esm/dropdown/index.d.ts +2 -0
- package/esm/dropdown/index.js +3 -0
- package/esm/dropdown/index.js.map +1 -0
- package/esm/form/radio/RadioGroup.d.ts +10 -0
- package/esm/form/radio/RadioGroup.js +10 -0
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/index.d.ts +3 -0
- package/esm/index.js +3 -0
- package/esm/index.js.map +1 -1
- package/esm/internal-header/InternalHeader.d.ts +16 -0
- package/esm/internal-header/InternalHeader.js +27 -0
- package/esm/internal-header/InternalHeader.js.map +1 -0
- package/esm/internal-header/InternalHeaderButton.d.ts +11 -0
- package/esm/internal-header/InternalHeaderButton.js +19 -0
- package/esm/internal-header/InternalHeaderButton.js.map +1 -0
- package/esm/internal-header/InternalHeaderTitle.d.ts +11 -0
- package/esm/internal-header/InternalHeaderTitle.js +20 -0
- package/esm/internal-header/InternalHeaderTitle.js.map +1 -0
- package/esm/internal-header/InternalHeaderUser.d.ts +14 -0
- package/esm/internal-header/InternalHeaderUser.js +23 -0
- package/esm/internal-header/InternalHeaderUser.js.map +1 -0
- package/esm/internal-header/InternalHeaderUserButton.d.ts +15 -0
- package/esm/internal-header/InternalHeaderUserButton.js +26 -0
- package/esm/internal-header/InternalHeaderUserButton.js.map +1 -0
- package/esm/internal-header/index.d.ts +5 -0
- package/esm/internal-header/index.js +2 -0
- package/esm/internal-header/index.js.map +1 -0
- package/esm/read-more/ReadMore.d.ts +17 -0
- package/esm/read-more/ReadMore.js +17 -0
- package/esm/read-more/ReadMore.js.map +1 -1
- package/esm/timeline/AxisLabels.d.ts +6 -0
- package/esm/timeline/AxisLabels.js +81 -0
- package/esm/timeline/AxisLabels.js.map +1 -0
- package/esm/timeline/Pin.d.ts +17 -0
- package/esm/timeline/Pin.js +81 -0
- package/esm/timeline/Pin.js.map +1 -0
- package/esm/timeline/Timeline.d.ts +45 -0
- package/esm/timeline/Timeline.js +134 -0
- package/esm/timeline/Timeline.js.map +1 -0
- package/esm/timeline/TimelineRow.d.ts +22 -0
- package/esm/timeline/TimelineRow.js +58 -0
- package/esm/timeline/TimelineRow.js.map +1 -0
- package/esm/timeline/hooks/usePeriodContext.d.ts +9 -0
- package/esm/timeline/hooks/usePeriodContext.js +13 -0
- package/esm/timeline/hooks/usePeriodContext.js.map +1 -0
- package/esm/timeline/hooks/useRowContext.d.ts +11 -0
- package/esm/timeline/hooks/useRowContext.js +15 -0
- package/esm/timeline/hooks/useRowContext.js.map +1 -0
- package/esm/timeline/hooks/useTimelineContext.d.ts +15 -0
- package/esm/timeline/hooks/useTimelineContext.js +20 -0
- package/esm/timeline/hooks/useTimelineContext.js.map +1 -0
- package/esm/timeline/hooks/useTimelineRows.d.ts +4 -0
- package/esm/timeline/hooks/useTimelineRows.js +74 -0
- package/esm/timeline/hooks/useTimelineRows.js.map +1 -0
- package/esm/timeline/index.d.ts +6 -0
- package/esm/timeline/index.js +2 -0
- package/esm/timeline/index.js.map +1 -0
- package/esm/timeline/period/ClickablePeriod.d.ts +9 -0
- package/esm/timeline/period/ClickablePeriod.js +93 -0
- package/esm/timeline/period/ClickablePeriod.js.map +1 -0
- package/esm/timeline/period/NonClickablePeriod.d.ts +7 -0
- package/esm/timeline/period/NonClickablePeriod.js +14 -0
- package/esm/timeline/period/NonClickablePeriod.js.map +1 -0
- package/esm/timeline/period/index.d.ts +57 -0
- package/esm/timeline/period/index.js +18 -0
- package/esm/timeline/period/index.js.map +1 -0
- package/esm/timeline/utils/calc.d.ts +5 -0
- package/esm/timeline/utils/calc.js +15 -0
- package/esm/timeline/utils/calc.js.map +1 -0
- package/esm/timeline/utils/filter.d.ts +10 -0
- package/esm/timeline/utils/filter.js +11 -0
- package/esm/timeline/utils/filter.js.map +1 -0
- package/esm/timeline/utils/index.d.ts +1 -0
- package/esm/timeline/utils/index.js +2 -0
- package/esm/timeline/utils/index.js.map +1 -0
- package/esm/timeline/utils/period.d.ts +2 -0
- package/esm/timeline/utils/period.js +33 -0
- package/esm/timeline/utils/period.js.map +1 -0
- package/esm/timeline/utils/sort.d.ts +4 -0
- package/esm/timeline/utils/sort.js +5 -0
- package/esm/timeline/utils/sort.js.map +1 -0
- package/esm/timeline/utils/timeline.d.ts +12 -0
- package/esm/timeline/utils/timeline.js +73 -0
- package/esm/timeline/utils/timeline.js.map +1 -0
- package/esm/timeline/utils/types.external.d.ts +53 -0
- package/esm/timeline/utils/types.external.js +2 -0
- package/esm/timeline/utils/types.external.js.map +1 -0
- package/esm/timeline/utils/types.internal.d.ts +61 -0
- package/esm/timeline/utils/types.internal.js +2 -0
- package/esm/timeline/utils/types.internal.js.map +1 -0
- package/esm/timeline/zoom/ZoomButton.d.ts +19 -0
- package/esm/timeline/zoom/ZoomButton.js +43 -0
- package/esm/timeline/zoom/ZoomButton.js.map +1 -0
- package/esm/timeline/zoom/index.d.ts +11 -0
- package/esm/timeline/zoom/index.js +22 -0
- package/esm/timeline/zoom/index.js.map +1 -0
- package/package.json +2 -2
- package/src/date/datepicker/datepicker.stories.tsx +19 -21
- package/src/date/datepicker/datepicker.test.tsx +5 -5
- package/src/date/hooks/index.ts +3 -3
- package/src/date/hooks/useRangeDatepicker.test.tsx +6 -6
- package/src/date/index.ts +5 -5
- package/src/date/monthpicker/monthpicker.stories.tsx +5 -5
- package/src/date/utils/__tests__/get-dates.test.ts +0 -1
- package/src/dropdown/Dropdown.tsx +80 -0
- package/src/dropdown/Menu/Divider.tsx +18 -0
- package/src/dropdown/Menu/GroupedList/Heading.tsx +31 -0
- package/src/dropdown/Menu/GroupedList/Item.tsx +45 -0
- package/src/dropdown/Menu/GroupedList/index.tsx +33 -0
- package/src/dropdown/Menu/List/Item.tsx +44 -0
- package/src/dropdown/Menu/List/index.tsx +27 -0
- package/src/dropdown/Menu/index.tsx +85 -0
- package/src/dropdown/Toggle.tsx +52 -0
- package/src/dropdown/dropdown.stories.tsx +91 -0
- package/src/dropdown/index.ts +2 -0
- package/src/form/radio/RadioGroup.tsx +10 -0
- package/src/index.ts +3 -0
- package/src/internal-header/InternalHeader.tsx +44 -0
- package/src/internal-header/InternalHeaderButton.tsx +28 -0
- package/src/internal-header/InternalHeaderTitle.tsx +35 -0
- package/src/internal-header/InternalHeaderUser.tsx +39 -0
- package/src/internal-header/InternalHeaderUserButton.tsx +43 -0
- package/src/internal-header/header.stories.tsx +225 -0
- package/src/internal-header/index.ts +8 -0
- package/src/read-more/ReadMore.tsx +17 -0
- package/src/timeline/AxisLabels.tsx +143 -0
- package/src/timeline/Pin.tsx +169 -0
- package/src/timeline/Timeline.tsx +219 -0
- package/src/timeline/TimelineRow.tsx +122 -0
- package/src/timeline/hooks/usePeriodContext.tsx +22 -0
- package/src/timeline/hooks/useRowContext.tsx +26 -0
- package/src/timeline/hooks/useTimelineContext.tsx +37 -0
- package/src/timeline/hooks/useTimelineRows.ts +161 -0
- package/src/timeline/index.ts +6 -0
- package/src/timeline/period/ClickablePeriod.tsx +193 -0
- package/src/timeline/period/NonClickablePeriod.tsx +46 -0
- package/src/timeline/period/index.tsx +130 -0
- package/src/timeline/timeline.stories.tsx +444 -0
- package/src/timeline/utils/calc.ts +26 -0
- package/src/timeline/utils/filter.ts +32 -0
- package/src/timeline/utils/index.ts +6 -0
- package/src/timeline/utils/period.ts +48 -0
- package/src/timeline/utils/sort.ts +11 -0
- package/src/timeline/utils/timeline.ts +83 -0
- package/src/timeline/utils/types.external.ts +67 -0
- package/src/timeline/utils/types.internal.ts +76 -0
- package/src/timeline/zoom/ZoomButton.tsx +83 -0
- package/src/timeline/zoom/index.tsx +30 -0
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ZoomButton = void 0;
|
|
38
|
+
const Detail_1 = require("../../typography/Detail");
|
|
39
|
+
const date_fns_1 = require("date-fns");
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
41
|
+
const useTimelineContext_1 = require("../hooks/useTimelineContext");
|
|
42
|
+
exports.ZoomButton = (0, react_1.forwardRef)((_a, ref) => {
|
|
43
|
+
var { label, interval, count } = _a, rest = __rest(_a, ["label", "interval", "count"]);
|
|
44
|
+
const { setStart, endDate, startDate, direction } = (0, useTimelineContext_1.useTimelineContext)();
|
|
45
|
+
let startOfRange;
|
|
46
|
+
if (interval === "month") {
|
|
47
|
+
startOfRange =
|
|
48
|
+
direction === "left"
|
|
49
|
+
? (0, date_fns_1.subMonths)(endDate, count)
|
|
50
|
+
: (0, date_fns_1.addMonths)(startDate, count);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
startOfRange =
|
|
54
|
+
direction === "left"
|
|
55
|
+
? (0, date_fns_1.subYears)(endDate, count)
|
|
56
|
+
: (0, date_fns_1.addYears)(startDate, count);
|
|
57
|
+
}
|
|
58
|
+
const currentZoom = direction === "left"
|
|
59
|
+
? (0, date_fns_1.isSameDay)(startDate, startOfRange)
|
|
60
|
+
: (0, date_fns_1.isSameDay)(endDate, startOfRange);
|
|
61
|
+
return (react_1.default.createElement(Detail_1.Detail, { as: "li" },
|
|
62
|
+
react_1.default.createElement("button", Object.assign({ type: "button", "aria-label": !currentZoom
|
|
63
|
+
? `Zoom tidslinjen ${(0, date_fns_1.format)(startOfRange, "dd.MM.yyyy")} til ${(0, date_fns_1.format)(endDate, "dd.MM.yyyy")}`
|
|
64
|
+
: "Tilbakestill til initiell tidsperspektiv", ref: ref }, rest, { className: "navds-timeline__zoom-button", onClick: () => {
|
|
65
|
+
setStart(startOfRange);
|
|
66
|
+
}, "aria-pressed": currentZoom }), label)));
|
|
67
|
+
});
|
|
68
|
+
exports.default = exports.ZoomButton;
|
|
@@ -0,0 +1,50 @@
|
|
|
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.Zoom = void 0;
|
|
41
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
|
+
const ZoomButton_1 = __importDefault(require("./ZoomButton"));
|
|
44
|
+
exports.Zoom = (0, react_1.forwardRef)((_a, ref) => {
|
|
45
|
+
var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
|
|
46
|
+
return (react_1.default.createElement("ul", Object.assign({ ref: ref, className: (0, clsx_1.default)(className, "navds-timeline__zoom") }, rest), children));
|
|
47
|
+
});
|
|
48
|
+
exports.Zoom.Button = ZoomButton_1.default;
|
|
49
|
+
exports.Zoom.componentType = "zoom";
|
|
50
|
+
exports.default = exports.Zoom;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { useDatepicker
|
|
1
|
+
export { useDatepicker } from "./useDatepicker";
|
|
2
2
|
export type { DateValidationT } from "./useDatepicker";
|
|
3
|
-
export { useRangeDatepicker
|
|
3
|
+
export { useRangeDatepicker } from "./useRangeDatepicker";
|
|
4
4
|
export type { RangeValidationT } from "./useRangeDatepicker";
|
|
5
|
-
export { useMonthpicker
|
|
5
|
+
export { useMonthpicker } from "./useMonthPicker";
|
|
6
6
|
export type { MonthValidationT } from "./useMonthPicker";
|
package/esm/date/hooks/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useDatepicker
|
|
2
|
-
export { useRangeDatepicker
|
|
3
|
-
export { useMonthpicker
|
|
1
|
+
export { useDatepicker } from "./useDatepicker";
|
|
2
|
+
export { useRangeDatepicker } from "./useRangeDatepicker";
|
|
3
|
+
export { useMonthpicker } from "./useMonthPicker";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/date/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/esm/date/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { type DateInputProps } from "./DateInput";
|
|
2
|
-
export { type DatePickerProps, default as
|
|
2
|
+
export { type DatePickerProps, default as DatePicker, } from "./datepicker/DatePicker";
|
|
3
3
|
export { type DatePickerStandaloneProps } from "./datepicker/DatePickerStandalone";
|
|
4
4
|
export { type MonthPickerStandaloneProps } from "./monthpicker/MonthPickerStandalone";
|
|
5
|
-
export {
|
|
6
|
-
export { default as
|
|
5
|
+
export { useDatepicker, useMonthpicker, useRangeDatepicker, type RangeValidationT, type DateValidationT, type MonthValidationT, } from "./hooks";
|
|
6
|
+
export { default as MonthPicker, type MonthPickerProps, } from "./monthpicker/MonthPicker";
|
package/esm/date/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export {
|
|
3
|
-
export { default as
|
|
1
|
+
export { default as DatePicker, } from "./datepicker/DatePicker";
|
|
2
|
+
export { useDatepicker, useMonthpicker, useRangeDatepicker, } from "./hooks";
|
|
3
|
+
export { default as MonthPicker, } from "./monthpicker/MonthPicker";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/esm/date/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/date/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/date/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,IAAI,UAAU,GACtB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,aAAa,EACb,cAAc,EACd,kBAAkB,GAInB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,OAAO,IAAI,WAAW,GAEvB,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ToggleType } from "./Toggle";
|
|
3
|
+
import { MenuType } from "./Menu";
|
|
4
|
+
export interface DropdownProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Handler called when an item is selected.
|
|
8
|
+
*/
|
|
9
|
+
onSelect?: (element: React.MouseEvent) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the Menu closes when a selection is made.
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
closeOnSelect?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Controlled state of the dropdown. When set, you will need to handle onClose and onSelect manually.
|
|
21
|
+
*/
|
|
22
|
+
open?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface DropdownType extends React.FC<DropdownProps> {
|
|
25
|
+
Toggle: ToggleType;
|
|
26
|
+
Menu: MenuType;
|
|
27
|
+
}
|
|
28
|
+
export interface DropdownContextType {
|
|
29
|
+
readonly isOpen: boolean;
|
|
30
|
+
handleToggle: (v: boolean) => void;
|
|
31
|
+
readonly anchorEl: Element | null;
|
|
32
|
+
setAnchorEl: React.Dispatch<React.SetStateAction<Element | null>>;
|
|
33
|
+
onSelect: (element: React.MouseEvent) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare const DropdownContext: React.Context<DropdownContextType | null>;
|
|
36
|
+
export declare const Dropdown: DropdownType;
|
|
37
|
+
export default Dropdown;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { createContext, useState } from "react";
|
|
2
|
+
import Toggle from "./Toggle";
|
|
3
|
+
import Menu from "./Menu";
|
|
4
|
+
export const DropdownContext = createContext(null);
|
|
5
|
+
export const Dropdown = (({ children, onSelect, closeOnSelect = true, defaultOpen = false, open, }) => {
|
|
6
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
7
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
8
|
+
const handleToggle = (v) => {
|
|
9
|
+
if (open === undefined) {
|
|
10
|
+
setIsOpen(v);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
return (React.createElement(DropdownContext.Provider, { value: {
|
|
14
|
+
isOpen: open !== null && open !== void 0 ? open : isOpen,
|
|
15
|
+
handleToggle,
|
|
16
|
+
anchorEl,
|
|
17
|
+
setAnchorEl,
|
|
18
|
+
onSelect: (event) => {
|
|
19
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(event);
|
|
20
|
+
if (closeOnSelect) {
|
|
21
|
+
open === undefined && setIsOpen(false);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
} }, children));
|
|
25
|
+
});
|
|
26
|
+
Dropdown.Toggle = Toggle;
|
|
27
|
+
Dropdown.Menu = Menu;
|
|
28
|
+
export default Dropdown;
|
|
29
|
+
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../src/dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,MAAsB,MAAM,UAAU,CAAC;AAC9C,OAAO,IAAkB,MAAM,QAAQ,CAAC;AAoCxC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAA6B,IAAI,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,EACxB,QAAQ,EACR,QAAQ,EACR,aAAa,GAAG,IAAI,EACpB,WAAW,GAAG,KAAK,EACnB,IAAI,GACL,EAAE,EAAE;IACH,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAU,WAAW,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAC;IAE/D,MAAM,YAAY,GAAG,CAAC,CAAU,EAAE,EAAE;QAClC,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,SAAS,CAAC,CAAC,CAAC,CAAC;SACd;IACH,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,eAAe,CAAC,QAAQ,IACvB,KAAK,EAAE;YACL,MAAM,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,MAAM;YACtB,YAAY;YACZ,QAAQ;YACR,WAAW;YACX,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBAClB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,KAAK,CAAC,CAAC;gBAClB,IAAI,aAAa,EAAE;oBACjB,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;iBACxC;YACH,CAAC;SACF,IAEA,QAAQ,CACgB,CAC5B,CAAC;AACJ,CAAC,CAAiB,CAAC;AAEnB,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;AACzB,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;AAErB,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
export const Divider = forwardRef((_a, ref) => {
|
|
15
|
+
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
16
|
+
return (React.createElement("hr", Object.assign({}, rest, { ref: ref, className: cl("navds-dropdown__divider", className) })));
|
|
17
|
+
});
|
|
18
|
+
export default Divider;
|
|
19
|
+
//# sourceMappingURL=Divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.js","sourceRoot":"","sources":["../../../src/dropdown/Menu/Divider.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,MAAM,CAAC;AAMtB,MAAM,CAAC,MAAM,OAAO,GAAgB,UAAU,CAC5C,CAAC,EAAsB,EAAE,GAAG,EAAE,EAAE;QAA/B,EAAE,SAAS,OAAW,EAAN,IAAI,cAApB,aAAsB,CAAF;IAAY,OAAA,CAC/B,4CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,IACnD,CACH,CAAA;CAAA,CACF,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface GroupedHeadingProps extends React.HTMLAttributes<HTMLDetailsElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Heading
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export type GroupedHeadingType = React.ForwardRefExoticComponent<GroupedHeadingProps & React.RefAttributes<HTMLElement>>;
|
|
9
|
+
export declare const GroupedHeading: GroupedHeadingType;
|
|
10
|
+
export default GroupedHeading;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
export const GroupedHeading = forwardRef((_a, ref) => {
|
|
15
|
+
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
16
|
+
return (React.createElement("dt", Object.assign({}, rest, { ref: ref, className: cl("navds-dropdown__list-heading", "navds-heading", "navds-heading--xsmall", className) })));
|
|
17
|
+
});
|
|
18
|
+
export default GroupedHeading;
|
|
19
|
+
//# sourceMappingURL=Heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/GroupedList/Heading.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,MAAM,CAAC;AActB,MAAM,CAAC,MAAM,cAAc,GAAuB,UAAU,CAC1D,CAAC,EAAsB,EAAE,GAAG,EAAE,EAAE;QAA/B,EAAE,SAAS,OAAW,EAAN,IAAI,cAApB,aAAsB,CAAF;IAAY,OAAA,CAC/B,4CACM,IAAI,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,8BAA8B,EAC9B,eAAe,EACf,uBAAuB,EACvB,SAAS,CACV,IACD,CACH,CAAA;CAAA,CACF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OverridableComponent } from "../../../util/OverridableComponent";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export interface GroupedItemProps extends React.ButtonHTMLAttributes<HTMLElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Menu item content
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export type GroupedItemType = OverridableComponent<GroupedItemProps, HTMLButtonElement>;
|
|
10
|
+
export declare const GroupedItem: GroupedItemType;
|
|
11
|
+
export default GroupedItem;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import cl from "clsx";
|
|
13
|
+
import React, { forwardRef, useContext } from "react";
|
|
14
|
+
import { DropdownContext } from "../../Dropdown";
|
|
15
|
+
export const GroupedItem = forwardRef((_a, ref) => {
|
|
16
|
+
var { as: Component = "button", className } = _a, rest = __rest(_a, ["as", "className"]);
|
|
17
|
+
const context = useContext(DropdownContext);
|
|
18
|
+
return (React.createElement("dd", { className: "navds-dropdown__list-item" },
|
|
19
|
+
React.createElement(Component, Object.assign({}, rest, { value: rest.children, onClick: (event) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
(_a = context === null || context === void 0 ? void 0 : context.onSelect) === null || _a === void 0 ? void 0 : _a.call(context, event);
|
|
22
|
+
(_b = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _b === void 0 ? void 0 : _b.call(rest, event);
|
|
23
|
+
}, ref: ref, className: cl("navds-dropdown__item", "navds-body-short", "navds-body-short--small", className) }))));
|
|
24
|
+
});
|
|
25
|
+
export default GroupedItem;
|
|
26
|
+
//# sourceMappingURL=Item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/GroupedList/Item.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAejD,MAAM,CAAC,MAAM,WAAW,GAAoB,UAAU,CACpD,CAAC,EAAgD,EAAE,GAAG,EAAE,EAAE;QAAzD,EAAE,EAAE,EAAE,SAAS,GAAG,QAAQ,EAAE,SAAS,OAAW,EAAN,IAAI,cAA9C,mBAAgD,CAAF;IAC7C,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5C,OAAO,CACL,4BAAI,SAAS,EAAC,2BAA2B;QACvC,oBAAC,SAAS,oBACJ,IAAI,IACR,KAAK,EAAE,IAAI,CAAC,QAAQ,EACpB,OAAO,EAAE,CAAC,KAAgD,EAAE,EAAE;;gBAC5D,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,wDAAG,KAAK,CAAC,CAAC;gBAC3B,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,qDAAG,KAAK,CAAC,CAAC;YACzB,CAAC,EACD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,CACV,IACD,CACC,CACN,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { GroupedHeadingType } from "./Heading";
|
|
3
|
+
import { GroupedItemType } from "./Item";
|
|
4
|
+
export interface GroupedListProps extends React.HTMLAttributes<HTMLDListElement> {
|
|
5
|
+
/**
|
|
6
|
+
* Menu list content
|
|
7
|
+
*/
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export interface GroupedListType extends React.ForwardRefExoticComponent<GroupedListProps & React.RefAttributes<HTMLDListElement>> {
|
|
11
|
+
Heading: GroupedHeadingType;
|
|
12
|
+
Item: GroupedItemType;
|
|
13
|
+
}
|
|
14
|
+
export declare const DescriptionList: GroupedListType;
|
|
15
|
+
export default DescriptionList;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import GroupedHeading from "./Heading";
|
|
15
|
+
import GroupedItem from "./Item";
|
|
16
|
+
export const DescriptionList = forwardRef((_a, ref) => {
|
|
17
|
+
var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
|
|
18
|
+
return (React.createElement("dl", Object.assign({}, rest, { ref: ref, className: cl("navds-dropdown__list", className) }), children));
|
|
19
|
+
});
|
|
20
|
+
DescriptionList.Heading = GroupedHeading;
|
|
21
|
+
DescriptionList.Item = GroupedItem;
|
|
22
|
+
export default DescriptionList;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/GroupedList/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,cAAsC,MAAM,WAAW,CAAC;AAC/D,OAAO,WAAgC,MAAM,QAAQ,CAAC;AAkBtD,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CACvC,CAAC,EAAgC,EAAE,GAAG,EAAE,EAAE;QAAzC,EAAE,SAAS,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAAY,OAAA,CACzC,4CAAQ,IAAI,IAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KACrE,QAAQ,CACN,CACN,CAAA;CAAA,CACiB,CAAC;AAErB,eAAe,CAAC,OAAO,GAAG,cAAc,CAAC;AACzC,eAAe,CAAC,IAAI,GAAG,WAAW,CAAC;AAEnC,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OverridableComponent } from "../../../util/OverridableComponent";
|
|
3
|
+
export interface ListItemProps extends React.ButtonHTMLAttributes<HTMLElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Menu item content
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export type ListItemType = OverridableComponent<ListItemProps, HTMLButtonElement>;
|
|
10
|
+
export declare const ListItem: ListItemType;
|
|
11
|
+
export default ListItem;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef, useContext } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import { DropdownContext } from "../../Dropdown";
|
|
15
|
+
export const ListItem = forwardRef((_a, ref) => {
|
|
16
|
+
var { as: Component = "button", className } = _a, rest = __rest(_a, ["as", "className"]);
|
|
17
|
+
const context = useContext(DropdownContext);
|
|
18
|
+
return (React.createElement("li", { className: "navds-dropdown__list-item" },
|
|
19
|
+
React.createElement(Component, Object.assign({}, rest, { value: rest.children, onClick: (event) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
(_a = context === null || context === void 0 ? void 0 : context.onSelect) === null || _a === void 0 ? void 0 : _a.call(context, event);
|
|
22
|
+
(_b = rest === null || rest === void 0 ? void 0 : rest.onClick) === null || _b === void 0 ? void 0 : _b.call(rest, event);
|
|
23
|
+
}, ref: ref, className: cl("navds-dropdown__item", "navds-body-short", "navds-body-short--small", className) }))));
|
|
24
|
+
});
|
|
25
|
+
export default ListItem;
|
|
26
|
+
//# sourceMappingURL=Item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Item.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/List/Item.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,MAAM,MAAM,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAcjD,MAAM,CAAC,MAAM,QAAQ,GAAiB,UAAU,CAC9C,CAAC,EAAgD,EAAE,GAAG,EAAE,EAAE;QAAzD,EAAE,EAAE,EAAE,SAAS,GAAG,QAAQ,EAAE,SAAS,OAAW,EAAN,IAAI,cAA9C,mBAAgD,CAAF;IAC7C,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5C,OAAO,CACL,4BAAI,SAAS,EAAC,2BAA2B;QACvC,oBAAC,SAAS,oBACJ,IAAI,IACR,KAAK,EAAE,IAAI,CAAC,QAAQ,EACpB,OAAO,EAAE,CAAC,KAAgD,EAAE,EAAE;;gBAC5D,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,wDAAG,KAAK,CAAC,CAAC;gBAC3B,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,qDAAG,KAAK,CAAC,CAAC;YACzB,CAAC,EACD,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,CACV,IACD,CACC,CACN,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ListItemType } from "./Item";
|
|
3
|
+
export interface ListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Menu list content
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export interface ListType extends React.ForwardRefExoticComponent<ListProps & React.RefAttributes<HTMLUListElement>> {
|
|
10
|
+
Item: ListItemType;
|
|
11
|
+
}
|
|
12
|
+
export declare const List: ListType;
|
|
13
|
+
export default List;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import ListItem from "./Item";
|
|
15
|
+
export const List = forwardRef((_a, ref) => {
|
|
16
|
+
var { className, children } = _a, rest = __rest(_a, ["className", "children"]);
|
|
17
|
+
return (React.createElement("ul", Object.assign({}, rest, { ref: ref, className: cl("navds-dropdown__list", className) }), children));
|
|
18
|
+
});
|
|
19
|
+
List.Item = ListItem;
|
|
20
|
+
export default List;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/dropdown/Menu/List/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,QAA0B,MAAM,QAAQ,CAAC;AAgBhD,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,EAAgC,EAAE,GAAG,EAAE,EAAE;QAAzC,EAAE,SAAS,EAAE,QAAQ,OAAW,EAAN,IAAI,cAA9B,yBAAgC,CAAF;IAAY,OAAA,CACxE,4CAAQ,IAAI,IAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,KACrE,QAAQ,CACN,CACN,CAAA;CAAA,CAAa,CAAC;AAEf,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;AAErB,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DividerType } from "./Divider";
|
|
3
|
+
import { GroupedListType } from "./GroupedList";
|
|
4
|
+
import { ListType } from "./List";
|
|
5
|
+
interface MenuProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Dropdown content
|
|
8
|
+
*/
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* onClose callback
|
|
12
|
+
*/
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
/**
|
|
15
|
+
* Popover positionion strategy
|
|
16
|
+
* @default "absolute"
|
|
17
|
+
*/
|
|
18
|
+
strategy?: "fixed" | "absolute";
|
|
19
|
+
placement?: "top" | "bottom" | "right" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end";
|
|
20
|
+
}
|
|
21
|
+
export interface MenuType<Props = MenuProps> extends React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>> {
|
|
22
|
+
List: ListType;
|
|
23
|
+
GroupedList: GroupedListType;
|
|
24
|
+
Divider: DividerType;
|
|
25
|
+
}
|
|
26
|
+
export declare const Menu: MenuType<MenuProps>;
|
|
27
|
+
export default Menu;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { Popover } from "../../popover";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import React, { forwardRef, useContext } from "react";
|
|
15
|
+
import { DropdownContext } from "../Dropdown";
|
|
16
|
+
import Divider from "./Divider";
|
|
17
|
+
import GroupedList from "./GroupedList";
|
|
18
|
+
import List from "./List";
|
|
19
|
+
export const Menu = forwardRef((_a, ref) => {
|
|
20
|
+
var { className, onClose, placement = "bottom-end" } = _a, rest = __rest(_a, ["className", "onClose", "placement"]);
|
|
21
|
+
const context = useContext(DropdownContext);
|
|
22
|
+
if (!context) {
|
|
23
|
+
console.warn("Dropdown.Menu has to be wrapped in <Dropdown />");
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const { isOpen, anchorEl, handleToggle } = context;
|
|
27
|
+
return (React.createElement(Popover, Object.assign({}, rest, { placement: placement, ref: ref, arrow: false, className: cl("navds-dropdown__menu", className), offset: -4, anchorEl: anchorEl, open: isOpen, onClose: () => {
|
|
28
|
+
handleToggle(false);
|
|
29
|
+
onClose && onClose();
|
|
30
|
+
} })));
|
|
31
|
+
});
|
|
32
|
+
Menu.List = List;
|
|
33
|
+
Menu.GroupedList = GroupedList;
|
|
34
|
+
Menu.Divider = Divider;
|
|
35
|
+
export default Menu;
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dropdown/Menu/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,OAAwB,MAAM,WAAW,CAAC;AACjD,OAAO,WAAgC,MAAM,eAAe,CAAC;AAC7D,OAAO,IAAkB,MAAM,QAAQ,CAAC;AA4CxC,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAC5B,CAAC,EAAyD,EAAE,GAAG,EAAE,EAAE;QAAlE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,GAAG,YAAY,OAAW,EAAN,IAAI,cAAvD,qCAAyD,CAAF;IACtD,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;KACb;IAED,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAEnD,OAAO,CACL,oBAAC,OAAO,oBACF,IAAI,IACR,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAChD,MAAM,EAAE,CAAC,CAAC,EACV,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,GAAG,EAAE;YACZ,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,IAAI,OAAO,EAAE,CAAC;QACvB,CAAC,IACD,CACH,CAAC;AACJ,CAAC,CACU,CAAC;AAEd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;AACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;AAEvB,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ToggleProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Button content
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export type ToggleType = React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export declare const Toggle: ToggleType;
|
|
10
|
+
export default Toggle;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef, useContext } from "react";
|
|
13
|
+
import cl from "clsx";
|
|
14
|
+
import { DropdownContext } from ".";
|
|
15
|
+
export const Toggle = forwardRef((_a, ref) => {
|
|
16
|
+
var { className, onClick } = _a, rest = __rest(_a, ["className", "onClick"]);
|
|
17
|
+
const context = useContext(DropdownContext);
|
|
18
|
+
if (!context) {
|
|
19
|
+
console.warn("Dropdown.Toggle has to be wrapped in <Dropdown />");
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const { setAnchorEl, handleToggle, isOpen } = context;
|
|
23
|
+
return (React.createElement("button", Object.assign({}, rest, { ref: (el) => {
|
|
24
|
+
setAnchorEl(el);
|
|
25
|
+
if (typeof ref === "function") {
|
|
26
|
+
ref(el);
|
|
27
|
+
}
|
|
28
|
+
else if (ref != null) {
|
|
29
|
+
ref.current = el;
|
|
30
|
+
}
|
|
31
|
+
}, onClick: (e) => {
|
|
32
|
+
setAnchorEl(e.currentTarget);
|
|
33
|
+
handleToggle(!isOpen);
|
|
34
|
+
onClick && onClick(e);
|
|
35
|
+
}, "aria-expanded": isOpen, className: cl("navds-dropdown__toggle", className) })));
|
|
36
|
+
});
|
|
37
|
+
export default Toggle;
|
|
38
|
+
//# sourceMappingURL=Toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toggle.js","sourceRoot":"","sources":["../../src/dropdown/Toggle.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,GAAG,CAAC;AAcpC,MAAM,CAAC,MAAM,MAAM,GAAe,UAAU,CAC1C,CAAC,EAA+B,EAAE,GAAG,EAAE,EAAE;QAAxC,EAAE,SAAS,EAAE,OAAO,OAAW,EAAN,IAAI,cAA7B,wBAA+B,CAAF;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IAE5C,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;KACb;IAED,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEtD,OAAO,CACL,gDACM,IAAI,IACR,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE;YACV,WAAW,CAAC,EAAE,CAAC,CAAC;YAEhB,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;gBAC7B,GAAG,CAAC,EAAE,CAAC,CAAC;aACT;iBAAM,IAAI,GAAG,IAAI,IAAI,EAAE;gBACtB,GAAG,CAAC,OAAO,GAAG,EAAE,CAAC;aAClB;QACH,CAAC,EACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;YAC7B,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;YACtB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC,mBACc,MAAM,EACrB,SAAS,EAAE,EAAE,CAAC,wBAAwB,EAAE,SAAS,CAAC,IAClD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|