@telia/teddy 0.0.37 → 0.0.39
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/dist/components/card/card-button.cjs +42 -0
- package/dist/components/card/card-button.d.ts +35 -0
- package/dist/components/card/card-button.js +42 -0
- package/dist/components/card/card-content.cjs +15 -0
- package/dist/components/card/card-content.d.ts +6 -0
- package/dist/components/card/card-content.js +15 -0
- package/dist/components/card/card-footer.cjs +15 -0
- package/dist/components/card/card-footer.d.ts +6 -0
- package/dist/components/card/card-footer.js +15 -0
- package/dist/components/card/card-heading.cjs +25 -0
- package/dist/components/card/card-heading.d.ts +6 -0
- package/dist/components/card/card-heading.js +25 -0
- package/dist/components/card/card-illustration.cjs +22 -0
- package/dist/components/card/card-illustration.d.ts +15 -0
- package/dist/components/card/card-illustration.js +22 -0
- package/dist/components/card/card-line.cjs +13 -0
- package/dist/components/card/card-line.d.ts +5 -0
- package/dist/components/card/card-line.js +13 -0
- package/dist/components/card/card-link.cjs +18 -0
- package/dist/components/card/card-link.d.ts +11 -0
- package/dist/components/card/card-link.js +18 -0
- package/dist/components/card/card-slot.cjs +36 -0
- package/dist/components/card/card-slot.d.ts +8 -0
- package/dist/components/card/card-slot.js +36 -0
- package/dist/components/card/card.cjs +38 -171
- package/dist/components/card/card.d.ts +15 -99
- package/dist/components/card/card.js +39 -172
- package/dist/components/card/index.cjs +28 -1
- package/dist/components/card/index.d.ts +64 -2
- package/dist/components/card/index.js +28 -1
- package/dist/components/card/utils.cjs +4 -0
- package/dist/components/card/utils.d.ts +2 -0
- package/dist/components/card/utils.js +4 -0
- package/dist/components/date-picker/css.cjs +59 -0
- package/dist/components/date-picker/css.d.ts +1 -0
- package/dist/components/date-picker/css.js +59 -0
- package/dist/components/date-picker/date-picker-day.cjs +67 -0
- package/dist/components/date-picker/date-picker-day.d.ts +13 -0
- package/dist/components/date-picker/date-picker-day.js +67 -0
- package/dist/components/date-picker/date-picker-input.cjs +89 -0
- package/dist/components/date-picker/date-picker-input.d.ts +27 -0
- package/dist/components/date-picker/date-picker-input.js +90 -0
- package/dist/components/date-picker/date-picker-localization.cjs +31 -0
- package/dist/components/date-picker/date-picker-localization.d.ts +20 -0
- package/dist/components/date-picker/date-picker-localization.js +32 -0
- package/dist/components/date-picker/date-picker-month.cjs +42 -0
- package/dist/components/date-picker/date-picker-month.d.ts +20 -0
- package/dist/components/date-picker/date-picker-month.js +43 -0
- package/dist/components/date-picker/date-picker-navigation-key.cjs +15 -0
- package/dist/components/date-picker/date-picker-navigation-key.d.ts +14 -0
- package/dist/components/date-picker/date-picker-navigation-key.js +16 -0
- package/dist/components/date-picker/date-picker-props.cjs +1 -0
- package/dist/components/date-picker/date-picker-props.d.ts +23 -0
- package/dist/components/date-picker/date-picker-props.js +1 -0
- package/dist/components/date-picker/date-picker-unique-id.cjs +4 -0
- package/dist/components/date-picker/date-picker-unique-id.d.ts +1 -0
- package/dist/components/date-picker/date-picker-unique-id.js +4 -0
- package/dist/components/date-picker/date-picker-year-print.cjs +61 -0
- package/dist/components/date-picker/date-picker-year-print.d.ts +12 -0
- package/dist/components/date-picker/date-picker-year-print.js +61 -0
- package/dist/components/date-picker/date-picker-year.cjs +36 -0
- package/dist/components/date-picker/date-picker-year.d.ts +16 -0
- package/dist/components/date-picker/date-picker-year.js +37 -0
- package/dist/components/date-picker/date-picker.cjs +597 -0
- package/dist/components/date-picker/date-picker.d.ts +5 -0
- package/dist/components/date-picker/date-picker.js +597 -0
- package/dist/components/date-picker/date-utils.cjs +340 -0
- package/dist/components/date-picker/date-utils.d.ts +29 -0
- package/dist/components/date-picker/date-utils.js +340 -0
- package/dist/components/date-picker/date-year-range.cjs +1 -0
- package/dist/components/date-picker/date-year-range.d.ts +4 -0
- package/dist/components/date-picker/date-year-range.js +1 -0
- package/dist/components/date-picker/dialog-utils.cjs +36 -0
- package/dist/components/date-picker/dialog-utils.d.ts +3 -0
- package/dist/components/date-picker/dialog-utils.js +36 -0
- package/dist/components/date-picker/index.cjs +4 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +4 -0
- package/dist/components/expandable-card/expandable-card-root.cjs +15 -15
- package/dist/components/expandable-card/expandable-card-root.js +15 -15
- package/dist/components/image/image.cjs +1 -1
- package/dist/components/image/image.js +1 -1
- package/dist/components/index.cjs +4 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +3 -1
- package/dist/components/modal/modal.cjs +4 -4
- package/dist/components/modal/modal.js +4 -4
- package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.cjs +33 -18
- package/dist/components/navigation-menu/global-navigation/global-navigation-my-pages.js +34 -19
- package/dist/components/navigation-menu/global-navigation/global-navigation-root.d.ts +3 -1
- package/dist/components/navigation-menu/global-navigation/utils.cjs +152 -125
- package/dist/components/navigation-menu/global-navigation/utils.d.ts +229 -219
- package/dist/components/navigation-menu/global-navigation/utils.js +152 -125
- package/dist/components/notification/notification.cjs +2 -2
- package/dist/components/notification/notification.d.ts +7 -7
- package/dist/components/notification/notification.js +1 -1
- package/dist/main.cjs +4 -2
- package/dist/main.js +3 -1
- package/dist/style.css +637 -187
- package/package.json +1 -1
|
@@ -1,2 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { HeadingProps } from './card-heading';
|
|
2
|
+
import { RootProps } from './card';
|
|
3
|
+
import { ButtonProps } from './card-button';
|
|
4
|
+
import { ContentProps } from './card-content';
|
|
5
|
+
import { IllustrationProps } from './card-illustration';
|
|
6
|
+
import { LineProps } from './card-line';
|
|
7
|
+
import { LinkProps } from './card-link';
|
|
8
|
+
import { SlotProps } from './card-slot';
|
|
9
|
+
import { FooterProps } from './card-footer';
|
|
10
|
+
|
|
11
|
+
export declare const Card: import('react').ForwardRefExoticComponent<RootProps & import('react').RefAttributes<HTMLDivElement>> & {
|
|
12
|
+
Heading: import('react').ForwardRefExoticComponent<HeadingProps & import('react').RefAttributes<HTMLHeadingElement>>;
|
|
13
|
+
Button: import('react').ForwardRefExoticComponent<Omit<Omit<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
|
|
14
|
+
display?: import('../../utils/generate-styling').DisplayChildren | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
asChild?: boolean | undefined;
|
|
17
|
+
loading?: boolean | undefined;
|
|
18
|
+
fullWidth?: boolean | undefined;
|
|
19
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
20
|
+
variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
21
|
+
} & {
|
|
22
|
+
iconOnly: true;
|
|
23
|
+
"aria-label": string;
|
|
24
|
+
} & import('react').RefAttributes<HTMLButtonElement>, "ref"> | Omit<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "aria-label"> & import('../../utils/generate-styling/flex').FlexChildren & import('../../utils/generate-styling/grid').GridChildren & import('../../utils/generate-styling/position').PositionProps & import('../../utils/generate-styling/inset').InsetProps & import('../../utils/generate-styling/margin').MarginProps & import('../../utils/generate-styling/padding').PaddingProps & import('../../utils/generate-styling/width').WidthProps & import('../../utils/generate-styling/height').HeightProps & import('../../utils/generate-styling/color').ColorProps & {
|
|
25
|
+
display?: import('../../utils/generate-styling').DisplayChildren | undefined;
|
|
26
|
+
} & {
|
|
27
|
+
asChild?: boolean | undefined;
|
|
28
|
+
loading?: boolean | undefined;
|
|
29
|
+
fullWidth?: boolean | undefined;
|
|
30
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
31
|
+
variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
32
|
+
} & {
|
|
33
|
+
iconOnly?: false | undefined;
|
|
34
|
+
"aria-label"?: string | undefined;
|
|
35
|
+
} & import('react').RefAttributes<HTMLButtonElement>, "ref">, "variant"> & {
|
|
36
|
+
variant?: "text" | "list-item" | "primary" | "secondary" | "destructive" | "tertiary-purple" | "expressive" | "primary-negative" | "secondary-negative" | "destructive-negative" | "tertiary-purple-negative" | "text-negative" | "expressive-negative" | undefined;
|
|
37
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
38
|
+
Content: import('react').ForwardRefExoticComponent<ContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
39
|
+
Illustration: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
40
|
+
inset?: "top" | "bottom" | "left" | "right" | "all" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-right-left" | "bottom-left-right" | "top-bottom" | "left-right" | undefined;
|
|
41
|
+
rounded?: boolean | undefined;
|
|
42
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
43
|
+
Line: import('react').ForwardRefExoticComponent<LineProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
44
|
+
Link: import('react').ForwardRefExoticComponent<Omit<Omit<import('react').DetailedHTMLProps<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
|
|
45
|
+
asChild?: boolean | undefined;
|
|
46
|
+
disableVisited?: boolean | undefined;
|
|
47
|
+
ensureTargetArea?: boolean | undefined;
|
|
48
|
+
silent?: boolean | undefined;
|
|
49
|
+
variant: "text" | "navigation" | "text-negative" | "standalone" | "standalone-negative" | "navigation-negative";
|
|
50
|
+
} & import('react').RefAttributes<HTMLAnchorElement>, "ref"> & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
51
|
+
Slot: import('react').ForwardRefExoticComponent<SlotProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
52
|
+
Footer: import('react').ForwardRefExoticComponent<FooterProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
53
|
+
};
|
|
54
|
+
export type CardProps = {
|
|
55
|
+
Root: RootProps;
|
|
56
|
+
Heading: HeadingProps;
|
|
57
|
+
Button: ButtonProps;
|
|
58
|
+
Content: ContentProps;
|
|
59
|
+
Illustration: IllustrationProps;
|
|
60
|
+
Line: LineProps;
|
|
61
|
+
Link: LinkProps;
|
|
62
|
+
Slot: SlotProps;
|
|
63
|
+
Footer: FooterProps;
|
|
64
|
+
};
|
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Heading } from "./card-heading.js";
|
|
2
|
+
import { Root } from "./card.js";
|
|
3
|
+
import { Button } from "./card-button.js";
|
|
4
|
+
import { Content } from "./card-content.js";
|
|
5
|
+
import { Illustration } from "./card-illustration.js";
|
|
6
|
+
import { Line } from "./card-line.js";
|
|
7
|
+
import { Link } from "./card-link.js";
|
|
8
|
+
import { Slot } from "./card-slot.js";
|
|
9
|
+
import { Footer } from "./card-footer.js";
|
|
10
|
+
Root.displayName = "Card";
|
|
11
|
+
Button.displayName = "Card.Button";
|
|
12
|
+
Content.displayName = "Card.Content";
|
|
13
|
+
Heading.displayName = "Card.Heading";
|
|
14
|
+
Illustration.displayName = "Card.Illustration";
|
|
15
|
+
Line.displayName = "Card.Line";
|
|
16
|
+
Link.displayName = "Card.Link";
|
|
17
|
+
Slot.displayName = "Card.Slot";
|
|
18
|
+
Footer.displayName = "Card.Footer";
|
|
19
|
+
const Card = Object.assign(Root, {
|
|
20
|
+
Heading,
|
|
21
|
+
Button,
|
|
22
|
+
Content,
|
|
23
|
+
Illustration,
|
|
24
|
+
Line,
|
|
25
|
+
Link,
|
|
26
|
+
Slot,
|
|
27
|
+
Footer
|
|
28
|
+
});
|
|
2
29
|
export {
|
|
3
30
|
Card
|
|
4
31
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const clsx = require("clsx");
|
|
4
|
+
const styles = {
|
|
5
|
+
"date-picker": "_date-picker_1vj0x_1",
|
|
6
|
+
"date-picker__container": "_date-picker__container_1vj0x_7",
|
|
7
|
+
"date-picker__input": "_date-picker__input_1vj0x_20",
|
|
8
|
+
"date-picker__input--touched": "_date-picker__input--touched_1vj0x_38",
|
|
9
|
+
"date-picker__input-icon-container": "_date-picker__input-icon-container_1vj0x_46",
|
|
10
|
+
"date-picker__toggle-button": "_date-picker__toggle-button_1vj0x_52",
|
|
11
|
+
"date-picker__additional": "_date-picker__additional_1vj0x_59",
|
|
12
|
+
"date-picker__error": "_date-picker__error_1vj0x_62",
|
|
13
|
+
"date-picker__toggle-icon": "_date-picker__toggle-icon_1vj0x_70",
|
|
14
|
+
"date-picker__dialog-container": "_date-picker__dialog-container_1vj0x_79",
|
|
15
|
+
"date-picker__dialog": "_date-picker__dialog_1vj0x_79",
|
|
16
|
+
"is-active": "_is-active_1vj0x_108",
|
|
17
|
+
"date-picker__dialog-content": "_date-picker__dialog-content_1vj0x_113",
|
|
18
|
+
"date-picker__table-scrollable": "_date-picker__table-scrollable_1vj0x_137",
|
|
19
|
+
"date-picker__table-wrapper": "_date-picker__table-wrapper_1vj0x_142",
|
|
20
|
+
"date-picker__table": "_date-picker__table_1vj0x_137",
|
|
21
|
+
"date-picker__table-header": "_date-picker__table-header_1vj0x_156",
|
|
22
|
+
"date-picker__row": "_date-picker__row_1vj0x_167",
|
|
23
|
+
"date-picker__cell": "_date-picker__cell_1vj0x_170",
|
|
24
|
+
"date-picker__year-button": "_date-picker__year-button_1vj0x_175",
|
|
25
|
+
"date-picker__year-chevron": "_date-picker__year-chevron_1vj0x_204",
|
|
26
|
+
"date-picker__year": "_date-picker__year_1vj0x_175",
|
|
27
|
+
"is-today": "_is-today_1vj0x_226",
|
|
28
|
+
"is-focused": "_is-focused_1vj0x_230",
|
|
29
|
+
"date-picker__day": "_date-picker__day_1vj0x_259",
|
|
30
|
+
"is-month": "_is-month_1vj0x_280",
|
|
31
|
+
"date-picker__header": "_date-picker__header_1vj0x_311",
|
|
32
|
+
"date-picker__nav": "_date-picker__nav_1vj0x_317",
|
|
33
|
+
"date-picker__nav-month": "_date-picker__nav-month_1vj0x_323",
|
|
34
|
+
"date-picker__prev": "_date-picker__prev_1vj0x_331",
|
|
35
|
+
"date-picker__next": "_date-picker__next_1vj0x_331",
|
|
36
|
+
"date-picker__prev-icon": "_date-picker__prev-icon_1vj0x_362",
|
|
37
|
+
"date-picker__next-icon": "_date-picker__next-icon_1vj0x_367",
|
|
38
|
+
"date-picker__select": "_date-picker__select_1vj0x_372",
|
|
39
|
+
"date-picker__select-label": "_date-picker__select-label_1vj0x_386",
|
|
40
|
+
"date-picker__select-icon": "_date-picker__select-icon_1vj0x_389",
|
|
41
|
+
"date-picker__close_year": "_date-picker__close_year_1vj0x_408",
|
|
42
|
+
"date-picker__vhidden": "_date-picker__vhidden_1vj0x_422"
|
|
43
|
+
};
|
|
44
|
+
const rootClassName = "date-picker";
|
|
45
|
+
const css = (suffix) => {
|
|
46
|
+
if (suffix == null)
|
|
47
|
+
return "";
|
|
48
|
+
let tmp = null;
|
|
49
|
+
if (suffix.startsWith("_") || suffix.startsWith("-") || suffix === "") {
|
|
50
|
+
tmp = clsx([styles[`${rootClassName + suffix}`]], "");
|
|
51
|
+
} else {
|
|
52
|
+
tmp = clsx([styles[`${suffix}`]], "");
|
|
53
|
+
}
|
|
54
|
+
if (!tmp) {
|
|
55
|
+
console.warn("Could not find css class " + suffix + " for the root " + rootClassName);
|
|
56
|
+
}
|
|
57
|
+
return tmp;
|
|
58
|
+
};
|
|
59
|
+
exports.css = css;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const css: (suffix: string | null) => string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
const styles = {
|
|
3
|
+
"date-picker": "_date-picker_1vj0x_1",
|
|
4
|
+
"date-picker__container": "_date-picker__container_1vj0x_7",
|
|
5
|
+
"date-picker__input": "_date-picker__input_1vj0x_20",
|
|
6
|
+
"date-picker__input--touched": "_date-picker__input--touched_1vj0x_38",
|
|
7
|
+
"date-picker__input-icon-container": "_date-picker__input-icon-container_1vj0x_46",
|
|
8
|
+
"date-picker__toggle-button": "_date-picker__toggle-button_1vj0x_52",
|
|
9
|
+
"date-picker__additional": "_date-picker__additional_1vj0x_59",
|
|
10
|
+
"date-picker__error": "_date-picker__error_1vj0x_62",
|
|
11
|
+
"date-picker__toggle-icon": "_date-picker__toggle-icon_1vj0x_70",
|
|
12
|
+
"date-picker__dialog-container": "_date-picker__dialog-container_1vj0x_79",
|
|
13
|
+
"date-picker__dialog": "_date-picker__dialog_1vj0x_79",
|
|
14
|
+
"is-active": "_is-active_1vj0x_108",
|
|
15
|
+
"date-picker__dialog-content": "_date-picker__dialog-content_1vj0x_113",
|
|
16
|
+
"date-picker__table-scrollable": "_date-picker__table-scrollable_1vj0x_137",
|
|
17
|
+
"date-picker__table-wrapper": "_date-picker__table-wrapper_1vj0x_142",
|
|
18
|
+
"date-picker__table": "_date-picker__table_1vj0x_137",
|
|
19
|
+
"date-picker__table-header": "_date-picker__table-header_1vj0x_156",
|
|
20
|
+
"date-picker__row": "_date-picker__row_1vj0x_167",
|
|
21
|
+
"date-picker__cell": "_date-picker__cell_1vj0x_170",
|
|
22
|
+
"date-picker__year-button": "_date-picker__year-button_1vj0x_175",
|
|
23
|
+
"date-picker__year-chevron": "_date-picker__year-chevron_1vj0x_204",
|
|
24
|
+
"date-picker__year": "_date-picker__year_1vj0x_175",
|
|
25
|
+
"is-today": "_is-today_1vj0x_226",
|
|
26
|
+
"is-focused": "_is-focused_1vj0x_230",
|
|
27
|
+
"date-picker__day": "_date-picker__day_1vj0x_259",
|
|
28
|
+
"is-month": "_is-month_1vj0x_280",
|
|
29
|
+
"date-picker__header": "_date-picker__header_1vj0x_311",
|
|
30
|
+
"date-picker__nav": "_date-picker__nav_1vj0x_317",
|
|
31
|
+
"date-picker__nav-month": "_date-picker__nav-month_1vj0x_323",
|
|
32
|
+
"date-picker__prev": "_date-picker__prev_1vj0x_331",
|
|
33
|
+
"date-picker__next": "_date-picker__next_1vj0x_331",
|
|
34
|
+
"date-picker__prev-icon": "_date-picker__prev-icon_1vj0x_362",
|
|
35
|
+
"date-picker__next-icon": "_date-picker__next-icon_1vj0x_367",
|
|
36
|
+
"date-picker__select": "_date-picker__select_1vj0x_372",
|
|
37
|
+
"date-picker__select-label": "_date-picker__select-label_1vj0x_386",
|
|
38
|
+
"date-picker__select-icon": "_date-picker__select-icon_1vj0x_389",
|
|
39
|
+
"date-picker__close_year": "_date-picker__close_year_1vj0x_408",
|
|
40
|
+
"date-picker__vhidden": "_date-picker__vhidden_1vj0x_422"
|
|
41
|
+
};
|
|
42
|
+
const rootClassName = "date-picker";
|
|
43
|
+
const css = (suffix) => {
|
|
44
|
+
if (suffix == null)
|
|
45
|
+
return "";
|
|
46
|
+
let tmp = null;
|
|
47
|
+
if (suffix.startsWith("_") || suffix.startsWith("-") || suffix === "") {
|
|
48
|
+
tmp = clsx([styles[`${rootClassName + suffix}`]], "");
|
|
49
|
+
} else {
|
|
50
|
+
tmp = clsx([styles[`${suffix}`]], "");
|
|
51
|
+
}
|
|
52
|
+
if (!tmp) {
|
|
53
|
+
console.warn("Could not find css class " + suffix + " for the root " + rootClassName);
|
|
54
|
+
}
|
|
55
|
+
return tmp;
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
css
|
|
59
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const components_datePicker_dateUtils = require("./date-utils.cjs");
|
|
6
|
+
const components_datePicker_css = require("./css.cjs");
|
|
7
|
+
const DatePickerDay = ({
|
|
8
|
+
focusedDay,
|
|
9
|
+
today,
|
|
10
|
+
day,
|
|
11
|
+
onDaySelect,
|
|
12
|
+
disabled,
|
|
13
|
+
inRange,
|
|
14
|
+
isSelected,
|
|
15
|
+
dateFormatter
|
|
16
|
+
}) => {
|
|
17
|
+
const isToday = components_datePicker_dateUtils.isEqual(day, today);
|
|
18
|
+
const isMonth = components_datePicker_dateUtils.isEqualMonth(day, focusedDay);
|
|
19
|
+
const isFocused = components_datePicker_dateUtils.isEqual(day, focusedDay);
|
|
20
|
+
const isOutsideRange = !inRange;
|
|
21
|
+
const isDisabled = disabled || isOutsideRange;
|
|
22
|
+
const handleClick = (e) => {
|
|
23
|
+
onDaySelect(e, day);
|
|
24
|
+
};
|
|
25
|
+
const buttonRef = React.useRef(null);
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (isFocused && buttonRef.current) {
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
var _a;
|
|
30
|
+
return (_a = buttonRef.current) == null ? void 0 : _a.focus();
|
|
31
|
+
}, 3);
|
|
32
|
+
}
|
|
33
|
+
}, [isFocused, buttonRef]);
|
|
34
|
+
let dayClass = components_datePicker_css.css("__day");
|
|
35
|
+
if (isDisabled) {
|
|
36
|
+
dayClass += " " + components_datePicker_css.css("is-disabled");
|
|
37
|
+
} else {
|
|
38
|
+
if (isToday) {
|
|
39
|
+
dayClass += " " + components_datePicker_css.css("is-today");
|
|
40
|
+
}
|
|
41
|
+
if (isMonth) {
|
|
42
|
+
dayClass += " " + components_datePicker_css.css("is-month");
|
|
43
|
+
}
|
|
44
|
+
if (isFocused) {
|
|
45
|
+
dayClass += " " + components_datePicker_css.css("is-focused");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
className: dayClass,
|
|
52
|
+
tabIndex: isFocused ? 0 : void 0,
|
|
53
|
+
onClick: handleClick,
|
|
54
|
+
"aria-disabled": isDisabled ? "true" : void 0,
|
|
55
|
+
disabled: isOutsideRange,
|
|
56
|
+
type: "button",
|
|
57
|
+
"aria-label": day.getDate().toString(),
|
|
58
|
+
"aria-pressed": isSelected ? "true" : "false",
|
|
59
|
+
ref: buttonRef,
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, children: day.getDate() }),
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: components_datePicker_css.css("__vhidden"), children: dateFormatter == null ? void 0 : dateFormatter.format(day) })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
exports.DatePickerDay = DatePickerDay;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export type DatePickerDayProps = {
|
|
4
|
+
focusedDay: Date;
|
|
5
|
+
today: Date;
|
|
6
|
+
day: Date;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
inRange: boolean;
|
|
9
|
+
isSelected: boolean;
|
|
10
|
+
dateFormatter: Intl.DateTimeFormat | undefined;
|
|
11
|
+
onDaySelect: (event: React.MouseEvent<HTMLButtonElement>, day: Date) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const DatePickerDay: React.FC<DatePickerDayProps>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default, { useRef } from "react";
|
|
3
|
+
import { isEqual, isEqualMonth } from "./date-utils.js";
|
|
4
|
+
import { css } from "./css.js";
|
|
5
|
+
const DatePickerDay = ({
|
|
6
|
+
focusedDay,
|
|
7
|
+
today,
|
|
8
|
+
day,
|
|
9
|
+
onDaySelect,
|
|
10
|
+
disabled,
|
|
11
|
+
inRange,
|
|
12
|
+
isSelected,
|
|
13
|
+
dateFormatter
|
|
14
|
+
}) => {
|
|
15
|
+
const isToday = isEqual(day, today);
|
|
16
|
+
const isMonth = isEqualMonth(day, focusedDay);
|
|
17
|
+
const isFocused = isEqual(day, focusedDay);
|
|
18
|
+
const isOutsideRange = !inRange;
|
|
19
|
+
const isDisabled = disabled || isOutsideRange;
|
|
20
|
+
const handleClick = (e) => {
|
|
21
|
+
onDaySelect(e, day);
|
|
22
|
+
};
|
|
23
|
+
const buttonRef = useRef(null);
|
|
24
|
+
React__default.useEffect(() => {
|
|
25
|
+
if (isFocused && buttonRef.current) {
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
var _a;
|
|
28
|
+
return (_a = buttonRef.current) == null ? void 0 : _a.focus();
|
|
29
|
+
}, 3);
|
|
30
|
+
}
|
|
31
|
+
}, [isFocused, buttonRef]);
|
|
32
|
+
let dayClass = css("__day");
|
|
33
|
+
if (isDisabled) {
|
|
34
|
+
dayClass += " " + css("is-disabled");
|
|
35
|
+
} else {
|
|
36
|
+
if (isToday) {
|
|
37
|
+
dayClass += " " + css("is-today");
|
|
38
|
+
}
|
|
39
|
+
if (isMonth) {
|
|
40
|
+
dayClass += " " + css("is-month");
|
|
41
|
+
}
|
|
42
|
+
if (isFocused) {
|
|
43
|
+
dayClass += " " + css("is-focused");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsxs(
|
|
47
|
+
"button",
|
|
48
|
+
{
|
|
49
|
+
className: dayClass,
|
|
50
|
+
tabIndex: isFocused ? 0 : void 0,
|
|
51
|
+
onClick: handleClick,
|
|
52
|
+
"aria-disabled": isDisabled ? "true" : void 0,
|
|
53
|
+
disabled: isOutsideRange,
|
|
54
|
+
type: "button",
|
|
55
|
+
"aria-label": day.getDate().toString(),
|
|
56
|
+
"aria-pressed": isSelected ? "true" : "false",
|
|
57
|
+
ref: buttonRef,
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: day.getDate() }),
|
|
60
|
+
/* @__PURE__ */ jsx("span", { className: css("__vhidden"), children: dateFormatter == null ? void 0 : dateFormatter.format(day) })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
DatePickerDay
|
|
67
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
require("../../assets/sprite.269ba410-teddy.svg");
|
|
4
|
+
const components_icon_icon = require("../icon/icon.cjs");
|
|
5
|
+
const components_datePicker_css = require("./css.cjs");
|
|
6
|
+
const DatePickerInput = ({
|
|
7
|
+
dateFormatter,
|
|
8
|
+
describedBy,
|
|
9
|
+
localization,
|
|
10
|
+
name,
|
|
11
|
+
formattedValue,
|
|
12
|
+
valueAsDate,
|
|
13
|
+
value,
|
|
14
|
+
identifier,
|
|
15
|
+
disabled,
|
|
16
|
+
readonly,
|
|
17
|
+
required,
|
|
18
|
+
role,
|
|
19
|
+
touched,
|
|
20
|
+
buttonRef,
|
|
21
|
+
inputRef,
|
|
22
|
+
onInput,
|
|
23
|
+
onBlur,
|
|
24
|
+
onFocus,
|
|
25
|
+
makeTouched,
|
|
26
|
+
formId
|
|
27
|
+
}) => {
|
|
28
|
+
const handleBlur = (event) => {
|
|
29
|
+
makeTouched();
|
|
30
|
+
onBlur(event);
|
|
31
|
+
};
|
|
32
|
+
const handleInvalid = (event) => {
|
|
33
|
+
makeTouched();
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
};
|
|
36
|
+
const onCalendarIconClicked = (event) => {
|
|
37
|
+
var _a;
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
(_a = document.getElementById(identifier)) == null ? void 0 : _a.focus();
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
42
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: components_datePicker_css.css("__input-icon-container"), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
className: components_datePicker_css.css("__toggle-button"),
|
|
46
|
+
onClick: onCalendarIconClicked,
|
|
47
|
+
ref: buttonRef,
|
|
48
|
+
type: "button",
|
|
49
|
+
"aria-hidden": true,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: "calendar", className: components_datePicker_css.css("__toggle-icon") }),
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: components_datePicker_css.css("__vhidden"), children: [
|
|
53
|
+
localization.buttonLabel,
|
|
54
|
+
valueAsDate && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
55
|
+
", ",
|
|
56
|
+
localization.selectedDateMessage,
|
|
57
|
+
" ",
|
|
58
|
+
dateFormatter == null ? void 0 : dateFormatter.format(valueAsDate)
|
|
59
|
+
] })
|
|
60
|
+
] })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
) }),
|
|
64
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
"input",
|
|
66
|
+
{
|
|
67
|
+
className: components_datePicker_css.css("__input") + " " + components_datePicker_css.css(touched ? "__input--touched" : null),
|
|
68
|
+
value: formattedValue,
|
|
69
|
+
placeholder: localization.calendarPlaceholderFormat,
|
|
70
|
+
id: identifier,
|
|
71
|
+
disabled,
|
|
72
|
+
readOnly: readonly,
|
|
73
|
+
role,
|
|
74
|
+
required: required ? true : void 0,
|
|
75
|
+
"aria-autocomplete": "none",
|
|
76
|
+
"aria-describedby": describedBy,
|
|
77
|
+
onInput: (e) => onInput(e),
|
|
78
|
+
onFocus,
|
|
79
|
+
onBlur: handleBlur,
|
|
80
|
+
autoComplete: "off",
|
|
81
|
+
ref: inputRef,
|
|
82
|
+
onInvalid: handleInvalid,
|
|
83
|
+
form: formId
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value })
|
|
87
|
+
] });
|
|
88
|
+
};
|
|
89
|
+
module.exports = DatePickerInput;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DatePickerLocalizedText } from './date-picker-localization';
|
|
2
|
+
|
|
3
|
+
type DatePickerInputProps = {
|
|
4
|
+
value: string;
|
|
5
|
+
formattedValue: string;
|
|
6
|
+
valueAsDate: Date | undefined;
|
|
7
|
+
localization: DatePickerLocalizedText;
|
|
8
|
+
name: string | undefined;
|
|
9
|
+
identifier: string;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
readonly: boolean;
|
|
12
|
+
required: boolean;
|
|
13
|
+
role: string | undefined;
|
|
14
|
+
dateFormatter: Intl.DateTimeFormat | undefined;
|
|
15
|
+
describedBy: string;
|
|
16
|
+
touched: boolean;
|
|
17
|
+
onInput: (event: any) => void;
|
|
18
|
+
onBlur: (event: any) => void;
|
|
19
|
+
onFocus: (event: any) => void;
|
|
20
|
+
buttonLabel: string | undefined;
|
|
21
|
+
buttonRef: (element: HTMLButtonElement) => void;
|
|
22
|
+
inputRef: (element: HTMLInputElement) => void;
|
|
23
|
+
makeTouched: () => void;
|
|
24
|
+
formId?: string;
|
|
25
|
+
};
|
|
26
|
+
declare const DatePickerInput: React.FC<DatePickerInputProps>;
|
|
27
|
+
export default DatePickerInput;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import "../../assets/sprite.269ba410-teddy.svg";
|
|
3
|
+
import { Icon } from "../icon/icon.js";
|
|
4
|
+
import { css } from "./css.js";
|
|
5
|
+
const DatePickerInput = ({
|
|
6
|
+
dateFormatter,
|
|
7
|
+
describedBy,
|
|
8
|
+
localization,
|
|
9
|
+
name,
|
|
10
|
+
formattedValue,
|
|
11
|
+
valueAsDate,
|
|
12
|
+
value,
|
|
13
|
+
identifier,
|
|
14
|
+
disabled,
|
|
15
|
+
readonly,
|
|
16
|
+
required,
|
|
17
|
+
role,
|
|
18
|
+
touched,
|
|
19
|
+
buttonRef,
|
|
20
|
+
inputRef,
|
|
21
|
+
onInput,
|
|
22
|
+
onBlur,
|
|
23
|
+
onFocus,
|
|
24
|
+
makeTouched,
|
|
25
|
+
formId
|
|
26
|
+
}) => {
|
|
27
|
+
const handleBlur = (event) => {
|
|
28
|
+
makeTouched();
|
|
29
|
+
onBlur(event);
|
|
30
|
+
};
|
|
31
|
+
const handleInvalid = (event) => {
|
|
32
|
+
makeTouched();
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
};
|
|
35
|
+
const onCalendarIconClicked = (event) => {
|
|
36
|
+
var _a;
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
(_a = document.getElementById(identifier)) == null ? void 0 : _a.focus();
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx("div", { className: css("__input-icon-container"), children: /* @__PURE__ */ jsxs(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
className: css("__toggle-button"),
|
|
45
|
+
onClick: onCalendarIconClicked,
|
|
46
|
+
ref: buttonRef,
|
|
47
|
+
type: "button",
|
|
48
|
+
"aria-hidden": true,
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Icon, { name: "calendar", className: css("__toggle-icon") }),
|
|
51
|
+
/* @__PURE__ */ jsxs("span", { className: css("__vhidden"), children: [
|
|
52
|
+
localization.buttonLabel,
|
|
53
|
+
valueAsDate && /* @__PURE__ */ jsxs("span", { children: [
|
|
54
|
+
", ",
|
|
55
|
+
localization.selectedDateMessage,
|
|
56
|
+
" ",
|
|
57
|
+
dateFormatter == null ? void 0 : dateFormatter.format(valueAsDate)
|
|
58
|
+
] })
|
|
59
|
+
] })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
) }),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
"input",
|
|
65
|
+
{
|
|
66
|
+
className: css("__input") + " " + css(touched ? "__input--touched" : null),
|
|
67
|
+
value: formattedValue,
|
|
68
|
+
placeholder: localization.calendarPlaceholderFormat,
|
|
69
|
+
id: identifier,
|
|
70
|
+
disabled,
|
|
71
|
+
readOnly: readonly,
|
|
72
|
+
role,
|
|
73
|
+
required: required ? true : void 0,
|
|
74
|
+
"aria-autocomplete": "none",
|
|
75
|
+
"aria-describedby": describedBy,
|
|
76
|
+
onInput: (e) => onInput(e),
|
|
77
|
+
onFocus,
|
|
78
|
+
onBlur: handleBlur,
|
|
79
|
+
autoComplete: "off",
|
|
80
|
+
ref: inputRef,
|
|
81
|
+
onInvalid: handleInvalid,
|
|
82
|
+
form: formId
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsx("input", { type: "hidden", name, value })
|
|
86
|
+
] });
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
DatePickerInput as default
|
|
90
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const localization = {
|
|
3
|
+
buttonLabel: "Åpne kalender",
|
|
4
|
+
placeholder: "YYYY-MM-DD",
|
|
5
|
+
selectedDateMessage: "Valgt dato er",
|
|
6
|
+
prevMonthLabel: "Forrige",
|
|
7
|
+
nextMonthLabel: "Neste",
|
|
8
|
+
monthSelectLabel: "Måned",
|
|
9
|
+
yearSelectLabel: "År",
|
|
10
|
+
closeLabel: "Lukk",
|
|
11
|
+
calendarPlaceholderFormat: "dd.MM.yyyy",
|
|
12
|
+
calendarHeading: "Velg dato",
|
|
13
|
+
dayNames: ["Søndag", "Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag"],
|
|
14
|
+
monthNames: [
|
|
15
|
+
"Januar",
|
|
16
|
+
"Februar",
|
|
17
|
+
"Mars",
|
|
18
|
+
"April",
|
|
19
|
+
"Mai",
|
|
20
|
+
"Juni",
|
|
21
|
+
"Juli",
|
|
22
|
+
"August",
|
|
23
|
+
"September",
|
|
24
|
+
"Oktober",
|
|
25
|
+
"November",
|
|
26
|
+
"Desember"
|
|
27
|
+
],
|
|
28
|
+
monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des"],
|
|
29
|
+
locale: "no-NO"
|
|
30
|
+
};
|
|
31
|
+
module.exports = localization;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type MonthsNames = [string, string, string, string, string, string, string, string, string, string, string, string];
|
|
2
|
+
type DayNames = [string, string, string, string, string, string, string];
|
|
3
|
+
export type DatePickerLocalizedText = {
|
|
4
|
+
buttonLabel: string;
|
|
5
|
+
placeholder: string;
|
|
6
|
+
selectedDateMessage: string;
|
|
7
|
+
prevMonthLabel: string;
|
|
8
|
+
nextMonthLabel: string;
|
|
9
|
+
monthSelectLabel: string;
|
|
10
|
+
yearSelectLabel: string;
|
|
11
|
+
closeLabel: string;
|
|
12
|
+
calendarPlaceholderFormat: string;
|
|
13
|
+
calendarHeading: string;
|
|
14
|
+
dayNames: DayNames;
|
|
15
|
+
monthNames: MonthsNames;
|
|
16
|
+
monthNamesShort: MonthsNames;
|
|
17
|
+
locale: string | string[];
|
|
18
|
+
};
|
|
19
|
+
declare const localization: DatePickerLocalizedText;
|
|
20
|
+
export default localization;
|