@webiny/admin-ui 6.3.0-beta.2 → 6.3.0-beta.3
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/Accordion/components/AccordionItemAction.d.ts +1 -1
- package/Accordion/components/AccordionItemAction.js.map +1 -1
- package/Calendar/Calendar.d.ts +25 -0
- package/Calendar/Calendar.js +45 -0
- package/Calendar/Calendar.js.map +1 -0
- package/Calendar/calendarClassNames.d.ts +2 -0
- package/Calendar/calendarClassNames.js +33 -0
- package/Calendar/calendarClassNames.js.map +1 -0
- package/Calendar/index.d.ts +1 -0
- package/Calendar/index.js +3 -0
- package/Calendar/index.js.map +1 -0
- package/CodeEditor/CodeEditorPrimitive.js +1 -1
- package/CodeEditor/CodeEditorPrimitive.js.map +1 -1
- package/DatePicker/DatePicker.d.ts +24 -0
- package/DatePicker/DatePicker.js +46 -0
- package/DatePicker/DatePicker.js.map +1 -0
- package/DatePicker/DatePicker.mdx +153 -0
- package/DatePicker/DatePicker.stories.d.ts +25 -0
- package/DatePicker/DatePicker.stories.js +365 -0
- package/DatePicker/DatePicker.stories.js.map +1 -0
- package/DatePicker/index.d.ts +2 -0
- package/DatePicker/index.js +4 -0
- package/DatePicker/index.js.map +1 -0
- package/DatePicker/primitives/DateOnlyPicker.d.ts +4 -0
- package/DatePicker/primitives/DateOnlyPicker.js +78 -0
- package/DatePicker/primitives/DateOnlyPicker.js.map +1 -0
- package/DatePicker/primitives/DatePickerPrimitive.d.ts +22 -0
- package/DatePicker/primitives/DatePickerPrimitive.js +46 -0
- package/DatePicker/primitives/DatePickerPrimitive.js.map +1 -0
- package/DatePicker/primitives/DateRangePicker.d.ts +4 -0
- package/DatePicker/primitives/DateRangePicker.js +69 -0
- package/DatePicker/primitives/DateRangePicker.js.map +1 -0
- package/DatePicker/primitives/DateTimePicker.d.ts +7 -0
- package/DatePicker/primitives/DateTimePicker.js +129 -0
- package/DatePicker/primitives/DateTimePicker.js.map +1 -0
- package/DatePicker/primitives/MonthPicker.d.ts +4 -0
- package/DatePicker/primitives/MonthPicker.js +60 -0
- package/DatePicker/primitives/MonthPicker.js.map +1 -0
- package/DatePicker/primitives/MultipleDatesPicker.d.ts +4 -0
- package/DatePicker/primitives/MultipleDatesPicker.js +73 -0
- package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -0
- package/DatePicker/primitives/MultipleMonthsPicker.d.ts +4 -0
- package/DatePicker/primitives/MultipleMonthsPicker.js +85 -0
- package/DatePicker/primitives/MultipleMonthsPicker.js.map +1 -0
- package/DatePicker/primitives/MultipleYearsPicker.d.ts +4 -0
- package/DatePicker/primitives/MultipleYearsPicker.js +75 -0
- package/DatePicker/primitives/MultipleYearsPicker.js.map +1 -0
- package/DatePicker/primitives/TimeOnlyPicker.d.ts +4 -0
- package/DatePicker/primitives/TimeOnlyPicker.js +24 -0
- package/DatePicker/primitives/TimeOnlyPicker.js.map +1 -0
- package/DatePicker/primitives/WeekPicker.d.ts +4 -0
- package/DatePicker/primitives/WeekPicker.js +97 -0
- package/DatePicker/primitives/WeekPicker.js.map +1 -0
- package/DatePicker/primitives/YearPicker.d.ts +4 -0
- package/DatePicker/primitives/YearPicker.js +54 -0
- package/DatePicker/primitives/YearPicker.js.map +1 -0
- package/DatePicker/primitives/components/DatePickerTrigger.d.ts +13 -0
- package/DatePicker/primitives/components/DatePickerTrigger.js +45 -0
- package/DatePicker/primitives/components/DatePickerTrigger.js.map +1 -0
- package/DatePicker/primitives/components/MonthGrid.d.ts +7 -0
- package/DatePicker/primitives/components/MonthGrid.js +23 -0
- package/DatePicker/primitives/components/MonthGrid.js.map +1 -0
- package/DatePicker/primitives/components/SelectedTagsList.d.ts +11 -0
- package/DatePicker/primitives/components/SelectedTagsList.js +23 -0
- package/DatePicker/primitives/components/SelectedTagsList.js.map +1 -0
- package/DatePicker/primitives/components/TimePicker.d.ts +13 -0
- package/DatePicker/primitives/components/TimePicker.js +33 -0
- package/DatePicker/primitives/components/TimePicker.js.map +1 -0
- package/DatePicker/primitives/components/YearGrid.d.ts +8 -0
- package/DatePicker/primitives/components/YearGrid.js +46 -0
- package/DatePicker/primitives/components/YearGrid.js.map +1 -0
- package/DatePicker/primitives/components/YearStepper.d.ts +7 -0
- package/DatePicker/primitives/components/YearStepper.js +36 -0
- package/DatePicker/primitives/components/YearStepper.js.map +1 -0
- package/DatePicker/primitives/components/index.d.ts +6 -0
- package/DatePicker/primitives/components/index.js +8 -0
- package/DatePicker/primitives/components/index.js.map +1 -0
- package/DatePicker/primitives/index.d.ts +1 -0
- package/DatePicker/primitives/index.js +3 -0
- package/DatePicker/primitives/index.js.map +1 -0
- package/DatePicker/utils/constants.d.ts +3 -0
- package/DatePicker/utils/constants.js +5 -0
- package/DatePicker/utils/constants.js.map +1 -0
- package/DatePicker/utils/dateHelpers.d.ts +24 -0
- package/DatePicker/utils/dateHelpers.js +184 -0
- package/DatePicker/utils/dateHelpers.js.map +1 -0
- package/DatePicker/utils/index.d.ts +3 -0
- package/DatePicker/utils/index.js +5 -0
- package/DatePicker/utils/index.js.map +1 -0
- package/DatePicker/utils/types.d.ts +81 -0
- package/DatePicker/utils/types.js +3 -0
- package/DatePicker/utils/types.js.map +1 -0
- package/Dialog/Dialog.d.ts +1 -0
- package/Dialog/Dialog.js +9 -3
- package/Dialog/Dialog.js.map +1 -1
- package/Dialog/components/DialogBody.d.ts +2 -2
- package/Dialog/components/DialogBody.js +10 -3
- package/Dialog/components/DialogBody.js.map +1 -1
- package/Dialog/components/DialogContent.d.ts +3 -0
- package/Dialog/components/DialogContent.js +11 -4
- package/Dialog/components/DialogContent.js.map +1 -1
- package/FilePicker/FilePicker.d.ts +1 -1
- package/FilePicker/FilePicker.js.map +1 -1
- package/FilePicker/FilePicker.stories.js +4 -5
- package/FilePicker/FilePicker.stories.js.map +1 -1
- package/FilePicker/domains/FileItem.js +2 -0
- package/FilePicker/domains/FileItem.js.map +1 -1
- package/List/components/ListItemAction.d.ts +1 -1
- package/List/components/ListItemAction.js.map +1 -1
- package/List/components/ListItemHandle.d.ts +1 -1
- package/List/components/ListItemHandle.js.map +1 -1
- package/MultiFilePicker/MultiFilePicker.stories.js +4 -5
- package/MultiFilePicker/MultiFilePicker.stories.js.map +1 -1
- package/RangeSlider/primitives/RangeSliderPrimitive.js +1 -1
- package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
- package/Sidebar/Sidebar.js +1 -1
- package/Sidebar/Sidebar.js.map +1 -1
- package/Sidebar/components/SidebarContent.js +1 -1
- package/Sidebar/components/SidebarContent.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuRootButton.js +1 -1
- package/Sidebar/components/items/SidebarMenuRootButton.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuRootItem.js +2 -1
- package/Sidebar/components/items/SidebarMenuRootItem.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuSubButton.js +1 -1
- package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
- package/Tabs/Tabs.js +1 -1
- package/Tabs/Tabs.js.map +1 -1
- package/exports/admin/ui.d.ts +1 -0
- package/exports/admin/ui.js +2 -0
- package/exports/admin/ui.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +19 -15
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { IconButtonProps
|
|
2
|
+
import type { IconButtonProps } from "../../Button/index.js";
|
|
3
3
|
type AccordionItemActionProps = IconButtonProps;
|
|
4
4
|
declare const AccordionItemAction: (({ onClick, ...props }: AccordionItemActionProps) => React.JSX.Element) & {
|
|
5
5
|
original: ({ onClick, ...props }: AccordionItemActionProps) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","makeDecoratable","withStaticProps","IconButton","AccordionItemSeparator","AccordionItemActionBase","onClick","props","onClickCallback","useCallback","e","stopPropagation","createElement","Object","assign","variant","size","DecoratableAccordionItemAction","AccordionItemAction","Separator"],"sources":["AccordionItemAction.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport type { IconButtonProps
|
|
1
|
+
{"version":3,"names":["React","makeDecoratable","withStaticProps","IconButton","AccordionItemSeparator","AccordionItemActionBase","onClick","props","onClickCallback","useCallback","e","stopPropagation","createElement","Object","assign","variant","size","DecoratableAccordionItemAction","AccordionItemAction","Separator"],"sources":["AccordionItemAction.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport type { IconButtonProps } from \"~/Button/index.js\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { AccordionItemSeparator } from \"./AccordionItemSeparator.js\";\n\ntype AccordionItemActionProps = IconButtonProps;\n\nconst AccordionItemActionBase = ({ onClick, ...props }: AccordionItemActionProps) => {\n // We need to stop the event propagation to prevent the accordion from opening/closing when the action is clicked.\n const onClickCallback = React.useCallback(\n (e: React.MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n\n if (onClick) {\n onClick(e);\n }\n },\n [onClick]\n );\n\n return <IconButton variant={\"ghost\"} size={\"sm\"} {...props} onClick={onClickCallback} />;\n};\n\nconst DecoratableAccordionItemAction = makeDecoratable(\n \"AccordionItemAction\",\n AccordionItemActionBase\n);\n\nconst AccordionItemAction = withStaticProps(DecoratableAccordionItemAction, {\n Separator: AccordionItemSeparator\n});\n\nexport { AccordionItemAction, type AccordionItemActionProps };\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,eAAe,EAAEC,eAAe;AAEzC,SAASC,UAAU;AACnB,SAASC,sBAAsB;AAI/B,MAAMC,uBAAuB,GAAGA,CAAC;EAAEC,OAAO;EAAE,GAAGC;AAAgC,CAAC,KAAK;EACjF;EACA,MAAMC,eAAe,GAAGR,KAAK,CAACS,WAAW,CACpCC,CAAsC,IAAK;IACxCA,CAAC,CAACC,eAAe,CAAC,CAAC;IAEnB,IAAIL,OAAO,EAAE;MACTA,OAAO,CAACI,CAAC,CAAC;IACd;EACJ,CAAC,EACD,CAACJ,OAAO,CACZ,CAAC;EAED,oBAAON,KAAA,CAAAY,aAAA,CAACT,UAAU,EAAAU,MAAA,CAAAC,MAAA;IAACC,OAAO,EAAE,OAAQ;IAACC,IAAI,EAAE;EAAK,GAAKT,KAAK;IAAED,OAAO,EAAEE;EAAgB,EAAE,CAAC;AAC5F,CAAC;AAED,MAAMS,8BAA8B,GAAGhB,eAAe,CAClD,qBAAqB,EACrBI,uBACJ,CAAC;AAED,MAAMa,mBAAmB,GAAGhB,eAAe,CAACe,8BAA8B,EAAE;EACxEE,SAAS,EAAEf;AACf,CAAC,CAAC;AAEF,SAASc,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type DayPickerProps } from "react-day-picker";
|
|
3
|
+
type CalendarProps = DayPickerProps & {
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const Calendar: (({ className, classNames, components, ...props }: CalendarProps) => React.JSX.Element) & {
|
|
7
|
+
original: ({ className, classNames, components, ...props }: CalendarProps) => React.JSX.Element;
|
|
8
|
+
originalName: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
} & {
|
|
11
|
+
original: (({ className, classNames, components, ...props }: CalendarProps) => React.JSX.Element) & {
|
|
12
|
+
original: ({ className, classNames, components, ...props }: CalendarProps) => React.JSX.Element;
|
|
13
|
+
originalName: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
originalName: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
} & {
|
|
19
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, classNames, components, ...props }: CalendarProps) => React.JSX.Element) & {
|
|
20
|
+
original: ({ className, classNames, components, ...props }: CalendarProps) => React.JSX.Element;
|
|
21
|
+
originalName: string;
|
|
22
|
+
displayName: string;
|
|
23
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
24
|
+
};
|
|
25
|
+
export { Calendar, type CalendarProps };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DayPicker } from "react-day-picker";
|
|
3
|
+
import { ReactComponent as ChevronLeftIcon } from "@webiny/icons/chevron_left.svg";
|
|
4
|
+
import { ReactComponent as ChevronRightIcon } from "@webiny/icons/chevron_right.svg";
|
|
5
|
+
import { Icon } from "../Icon/index.js";
|
|
6
|
+
import { cn, makeDecoratable } from "../utils.js";
|
|
7
|
+
import { calendarClassNames } from "./calendarClassNames.js";
|
|
8
|
+
function CalendarChevron(props) {
|
|
9
|
+
if (props.orientation === "left") {
|
|
10
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
11
|
+
icon: /*#__PURE__*/React.createElement(ChevronLeftIcon, null),
|
|
12
|
+
label: "Previous",
|
|
13
|
+
size: "sm",
|
|
14
|
+
color: "inherit"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
18
|
+
icon: /*#__PURE__*/React.createElement(ChevronRightIcon, null),
|
|
19
|
+
label: "Next",
|
|
20
|
+
size: "sm",
|
|
21
|
+
color: "inherit"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const DecoratableCalendar = ({
|
|
25
|
+
className,
|
|
26
|
+
classNames,
|
|
27
|
+
components,
|
|
28
|
+
...props
|
|
29
|
+
}) => {
|
|
30
|
+
return /*#__PURE__*/React.createElement(DayPicker, Object.assign({}, props, {
|
|
31
|
+
classNames: {
|
|
32
|
+
...calendarClassNames,
|
|
33
|
+
...classNames
|
|
34
|
+
},
|
|
35
|
+
components: {
|
|
36
|
+
Chevron: CalendarChevron,
|
|
37
|
+
...components
|
|
38
|
+
},
|
|
39
|
+
className: cn(className)
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
const Calendar = makeDecoratable("Calendar", DecoratableCalendar);
|
|
43
|
+
export { Calendar };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=Calendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","DayPicker","ReactComponent","ChevronLeftIcon","ChevronRightIcon","Icon","cn","makeDecoratable","calendarClassNames","CalendarChevron","props","orientation","createElement","icon","label","size","color","DecoratableCalendar","className","classNames","components","Object","assign","Chevron","Calendar"],"sources":["Calendar.tsx"],"sourcesContent":["import React from \"react\";\nimport { DayPicker, type DayPickerProps } from \"react-day-picker\";\nimport { ReactComponent as ChevronLeftIcon } from \"@webiny/icons/chevron_left.svg\";\nimport { ReactComponent as ChevronRightIcon } from \"@webiny/icons/chevron_right.svg\";\nimport { Icon } from \"~/Icon/index.js\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\nimport { calendarClassNames } from \"./calendarClassNames.js\";\n\ntype CalendarProps = DayPickerProps & {\n className?: string;\n};\n\nfunction CalendarChevron(props: { orientation?: \"left\" | \"right\" | \"up\" | \"down\" }) {\n if (props.orientation === \"left\") {\n return <Icon icon={<ChevronLeftIcon />} label=\"Previous\" size=\"sm\" color=\"inherit\" />;\n }\n return <Icon icon={<ChevronRightIcon />} label=\"Next\" size=\"sm\" color=\"inherit\" />;\n}\n\nconst DecoratableCalendar = ({ className, classNames, components, ...props }: CalendarProps) => {\n return (\n <DayPicker\n {...props}\n classNames={{ ...calendarClassNames, ...classNames }}\n components={{ Chevron: CalendarChevron, ...components }}\n className={cn(className)}\n />\n );\n};\n\nconst Calendar = makeDecoratable(\"Calendar\", DecoratableCalendar);\n\nexport { Calendar, type CalendarProps };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,QAA6B,kBAAkB;AACjE,SAASC,cAAc,IAAIC,eAAe,QAAQ,gCAAgC;AAClF,SAASD,cAAc,IAAIE,gBAAgB,QAAQ,iCAAiC;AACpF,SAASC,IAAI;AACb,SAASC,EAAE,EAAEC,eAAe;AAC5B,SAASC,kBAAkB;AAM3B,SAASC,eAAeA,CAACC,KAAyD,EAAE;EAChF,IAAIA,KAAK,CAACC,WAAW,KAAK,MAAM,EAAE;IAC9B,oBAAOX,KAAA,CAAAY,aAAA,CAACP,IAAI;MAACQ,IAAI,eAAEb,KAAA,CAAAY,aAAA,CAACT,eAAe,MAAE,CAAE;MAACW,KAAK,EAAC,UAAU;MAACC,IAAI,EAAC,IAAI;MAACC,KAAK,EAAC;IAAS,CAAE,CAAC;EACzF;EACA,oBAAOhB,KAAA,CAAAY,aAAA,CAACP,IAAI;IAACQ,IAAI,eAAEb,KAAA,CAAAY,aAAA,CAACR,gBAAgB,MAAE,CAAE;IAACU,KAAK,EAAC,MAAM;IAACC,IAAI,EAAC,IAAI;IAACC,KAAK,EAAC;EAAS,CAAE,CAAC;AACtF;AAEA,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,SAAS;EAAEC,UAAU;EAAEC,UAAU;EAAE,GAAGV;AAAqB,CAAC,KAAK;EAC5F,oBACIV,KAAA,CAAAY,aAAA,CAACX,SAAS,EAAAoB,MAAA,CAAAC,MAAA,KACFZ,KAAK;IACTS,UAAU,EAAE;MAAE,GAAGX,kBAAkB;MAAE,GAAGW;IAAW,CAAE;IACrDC,UAAU,EAAE;MAAEG,OAAO,EAAEd,eAAe;MAAE,GAAGW;IAAW,CAAE;IACxDF,SAAS,EAAEZ,EAAE,CAACY,SAAS;EAAE,EAC5B,CAAC;AAEV,CAAC;AAED,MAAMM,QAAQ,GAAGjB,eAAe,CAAC,UAAU,EAAEU,mBAAmB,CAAC;AAEjE,SAASO,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const calendarClassNames = {
|
|
2
|
+
root: "p-md",
|
|
3
|
+
months: "relative flex gap-md",
|
|
4
|
+
month: "flex flex-col gap-sm",
|
|
5
|
+
month_caption: "flex items-center justify-center h-8 relative",
|
|
6
|
+
caption_label: "text-md font-semibold text-neutral-strong",
|
|
7
|
+
nav: "absolute inset-x-0 flex items-center justify-between",
|
|
8
|
+
button_previous: "inline-flex items-center justify-center size-8 rounded-sm cursor-pointer text-neutral-strong hover:bg-neutral-light",
|
|
9
|
+
button_next: "inline-flex items-center justify-center size-8 rounded-sm cursor-pointer text-neutral-strong hover:bg-neutral-light",
|
|
10
|
+
month_grid: "border-collapse",
|
|
11
|
+
weekdays: "",
|
|
12
|
+
weekday: "text-xs font-medium text-neutral-dimmed size-9 text-center",
|
|
13
|
+
weeks: "",
|
|
14
|
+
week: "",
|
|
15
|
+
day: "size-9 text-center text-sm p-0 relative",
|
|
16
|
+
day_button: "inline-flex items-center justify-center size-9 rounded-sm font-normal cursor-pointer hover:bg-neutral-light transition-colors",
|
|
17
|
+
selected: "[&>button]:bg-primary [&>button]:text-neutral-base [&>button]:hover:bg-primary-strong [&>button]:font-medium",
|
|
18
|
+
today: "[&>button]:border-sm [&>button]:border-primary",
|
|
19
|
+
outside: "[&>button]:text-neutral-dimmed [&>button]:opacity-50",
|
|
20
|
+
disabled: "[&>button]:text-neutral-disabled [&>button]:cursor-not-allowed",
|
|
21
|
+
hidden: "invisible",
|
|
22
|
+
range_start: "[&>button]:bg-primary [&>button]:text-neutral-base [&>button]:hover:bg-primary-strong [&>button]:rounded-r-none",
|
|
23
|
+
range_end: "[&>button]:bg-primary [&>button]:text-neutral-base [&>button]:hover:bg-primary-strong [&>button]:rounded-l-none",
|
|
24
|
+
range_middle: "bg-primary-subtle [&>button]:bg-transparent [&>button]:text-primary-strong [&>button]:rounded-none [&>button]:hover:bg-primary-subtle/70",
|
|
25
|
+
focused: "[&>button]:ring-2 [&>button]:ring-primary-dimmed",
|
|
26
|
+
dropdowns: "flex items-center gap-sm",
|
|
27
|
+
dropdown: "appearance-none border-sm border-neutral-muted rounded-sm px-sm py-xs text-sm cursor-pointer bg-neutral-base",
|
|
28
|
+
dropdown_root: "relative",
|
|
29
|
+
chevron: "size-md fill-current",
|
|
30
|
+
footer: "pt-sm text-sm text-neutral-dimmed"
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=calendarClassNames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["calendarClassNames","root","months","month","month_caption","caption_label","nav","button_previous","button_next","month_grid","weekdays","weekday","weeks","week","day","day_button","selected","today","outside","disabled","hidden","range_start","range_end","range_middle","focused","dropdowns","dropdown","dropdown_root","chevron","footer"],"sources":["calendarClassNames.ts"],"sourcesContent":["import type { ClassNames } from \"react-day-picker\";\n\nexport const calendarClassNames: Partial<ClassNames> = {\n root: \"p-md\",\n months: \"relative flex gap-md\",\n month: \"flex flex-col gap-sm\",\n month_caption: \"flex items-center justify-center h-8 relative\",\n caption_label: \"text-md font-semibold text-neutral-strong\",\n nav: \"absolute inset-x-0 flex items-center justify-between\",\n button_previous:\n \"inline-flex items-center justify-center size-8 rounded-sm cursor-pointer text-neutral-strong hover:bg-neutral-light\",\n button_next:\n \"inline-flex items-center justify-center size-8 rounded-sm cursor-pointer text-neutral-strong hover:bg-neutral-light\",\n month_grid: \"border-collapse\",\n weekdays: \"\",\n weekday: \"text-xs font-medium text-neutral-dimmed size-9 text-center\",\n weeks: \"\",\n week: \"\",\n day: \"size-9 text-center text-sm p-0 relative\",\n day_button:\n \"inline-flex items-center justify-center size-9 rounded-sm font-normal cursor-pointer hover:bg-neutral-light transition-colors\",\n selected:\n \"[&>button]:bg-primary [&>button]:text-neutral-base [&>button]:hover:bg-primary-strong [&>button]:font-medium\",\n today: \"[&>button]:border-sm [&>button]:border-primary\",\n outside: \"[&>button]:text-neutral-dimmed [&>button]:opacity-50\",\n disabled: \"[&>button]:text-neutral-disabled [&>button]:cursor-not-allowed\",\n hidden: \"invisible\",\n range_start:\n \"[&>button]:bg-primary [&>button]:text-neutral-base [&>button]:hover:bg-primary-strong [&>button]:rounded-r-none\",\n range_end:\n \"[&>button]:bg-primary [&>button]:text-neutral-base [&>button]:hover:bg-primary-strong [&>button]:rounded-l-none\",\n range_middle:\n \"bg-primary-subtle [&>button]:bg-transparent [&>button]:text-primary-strong [&>button]:rounded-none [&>button]:hover:bg-primary-subtle/70\",\n focused: \"[&>button]:ring-2 [&>button]:ring-primary-dimmed\",\n dropdowns: \"flex items-center gap-sm\",\n dropdown:\n \"appearance-none border-sm border-neutral-muted rounded-sm px-sm py-xs text-sm cursor-pointer bg-neutral-base\",\n dropdown_root: \"relative\",\n chevron: \"size-md fill-current\",\n footer: \"pt-sm text-sm text-neutral-dimmed\"\n};\n"],"mappings":"AAEA,OAAO,MAAMA,kBAAuC,GAAG;EACnDC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,sBAAsB;EAC9BC,KAAK,EAAE,sBAAsB;EAC7BC,aAAa,EAAE,+CAA+C;EAC9DC,aAAa,EAAE,2CAA2C;EAC1DC,GAAG,EAAE,sDAAsD;EAC3DC,eAAe,EACX,qHAAqH;EACzHC,WAAW,EACP,qHAAqH;EACzHC,UAAU,EAAE,iBAAiB;EAC7BC,QAAQ,EAAE,EAAE;EACZC,OAAO,EAAE,4DAA4D;EACrEC,KAAK,EAAE,EAAE;EACTC,IAAI,EAAE,EAAE;EACRC,GAAG,EAAE,yCAAyC;EAC9CC,UAAU,EACN,+HAA+H;EACnIC,QAAQ,EACJ,8GAA8G;EAClHC,KAAK,EAAE,gDAAgD;EACvDC,OAAO,EAAE,sDAAsD;EAC/DC,QAAQ,EAAE,gEAAgE;EAC1EC,MAAM,EAAE,WAAW;EACnBC,WAAW,EACP,iHAAiH;EACrHC,SAAS,EACL,iHAAiH;EACrHC,YAAY,EACR,0IAA0I;EAC9IC,OAAO,EAAE,kDAAkD;EAC3DC,SAAS,EAAE,0BAA0B;EACrCC,QAAQ,EACJ,8GAA8G;EAClHC,aAAa,EAAE,UAAU;EACzBC,OAAO,EAAE,sBAAsB;EAC/BC,MAAM,EAAE;AACZ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Calendar.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Calendar.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ const DecoratableCodeEditorPrimitive = ({
|
|
|
25
25
|
return /*#__PURE__*/React.createElement(MonacoEditor, Object.assign({
|
|
26
26
|
height: "calc(100vh - 400px)"
|
|
27
27
|
}, rest, {
|
|
28
|
-
language: "json",
|
|
28
|
+
language: rest.language ?? "json",
|
|
29
29
|
defaultValue: value,
|
|
30
30
|
options: options
|
|
31
31
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","MonacoEditor","makeDecoratable","monacoOptions","domReadOnly","readOnly","minimap","enabled","DecoratableCodeEditorPrimitive","value","disabled","options","optionsInput","rest","undefined","createElement","Object","assign","height","language","defaultValue","CodeEditorPrimitive"],"sources":["CodeEditorPrimitive.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport type { EditorProps } from \"@monaco-editor/react\";\nimport MonacoEditor from \"@monaco-editor/react\";\nimport type { editor } from \"monaco-editor\";\nimport { makeDecoratable } from \"~/utils.js\";\n\ninterface CodeEditorPrimitiveProps extends Partial<EditorProps> {\n disabled?: boolean;\n}\n\nconst monacoOptions: editor.IEditorConstructionOptions = {\n domReadOnly: true,\n readOnly: true,\n minimap: {\n enabled: false\n }\n};\n\nconst DecoratableCodeEditorPrimitive = ({\n value,\n disabled,\n options: optionsInput,\n ...rest\n}: CodeEditorPrimitiveProps) => {\n const options = useMemo((): editor.IDiffEditorConstructionOptions => {\n return {\n ...monacoOptions,\n ...optionsInput,\n domReadOnly: disabled === undefined ? monacoOptions.domReadOnly : disabled,\n readOnly: disabled === undefined ? monacoOptions.readOnly : disabled\n };\n }, [disabled]);\n return (\n <MonacoEditor\n height={\"calc(100vh - 400px)\"}\n {...rest}\n language={\"json\"}\n defaultValue={value}\n options={options}\n />\n );\n};\n\nconst CodeEditorPrimitive = makeDecoratable(\"CodeEditorPrimitive\", DecoratableCodeEditorPrimitive);\n\nexport { CodeEditorPrimitive, type CodeEditorPrimitiveProps };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AAEtC,OAAOC,YAAY,MAAM,sBAAsB;AAE/C,SAASC,eAAe;AAMxB,MAAMC,aAAgD,GAAG;EACrDC,WAAW,EAAE,IAAI;EACjBC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE;IACLC,OAAO,EAAE;EACb;AACJ,CAAC;AAED,MAAMC,8BAA8B,GAAGA,CAAC;EACpCC,KAAK;EACLC,QAAQ;EACRC,OAAO,EAAEC,YAAY;EACrB,GAAGC;AACmB,CAAC,KAAK;EAC5B,MAAMF,OAAO,GAAGX,OAAO,CAAC,MAA6C;IACjE,OAAO;MACH,GAAGG,aAAa;MAChB,GAAGS,YAAY;MACfR,WAAW,EAAEM,QAAQ,KAAKI,SAAS,GAAGX,aAAa,CAACC,WAAW,GAAGM,QAAQ;MAC1EL,QAAQ,EAAEK,QAAQ,KAAKI,SAAS,GAAGX,aAAa,CAACE,QAAQ,GAAGK;IAChE,CAAC;EACL,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EACd,oBACIX,KAAA,CAAAgB,aAAA,CAACd,YAAY,EAAAe,MAAA,CAAAC,MAAA;IACTC,MAAM,EAAE;EAAsB,GAC1BL,IAAI;IACRM,QAAQ,
|
|
1
|
+
{"version":3,"names":["React","useMemo","MonacoEditor","makeDecoratable","monacoOptions","domReadOnly","readOnly","minimap","enabled","DecoratableCodeEditorPrimitive","value","disabled","options","optionsInput","rest","undefined","createElement","Object","assign","height","language","defaultValue","CodeEditorPrimitive"],"sources":["CodeEditorPrimitive.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport type { EditorProps } from \"@monaco-editor/react\";\nimport MonacoEditor from \"@monaco-editor/react\";\nimport type { editor } from \"monaco-editor\";\nimport { makeDecoratable } from \"~/utils.js\";\n\ninterface CodeEditorPrimitiveProps extends Partial<EditorProps> {\n disabled?: boolean;\n}\n\nconst monacoOptions: editor.IEditorConstructionOptions = {\n domReadOnly: true,\n readOnly: true,\n minimap: {\n enabled: false\n }\n};\n\nconst DecoratableCodeEditorPrimitive = ({\n value,\n disabled,\n options: optionsInput,\n ...rest\n}: CodeEditorPrimitiveProps) => {\n const options = useMemo((): editor.IDiffEditorConstructionOptions => {\n return {\n ...monacoOptions,\n ...optionsInput,\n domReadOnly: disabled === undefined ? monacoOptions.domReadOnly : disabled,\n readOnly: disabled === undefined ? monacoOptions.readOnly : disabled\n };\n }, [disabled]);\n return (\n <MonacoEditor\n height={\"calc(100vh - 400px)\"}\n {...rest}\n language={rest.language ?? \"json\"}\n defaultValue={value}\n options={options}\n />\n );\n};\n\nconst CodeEditorPrimitive = makeDecoratable(\"CodeEditorPrimitive\", DecoratableCodeEditorPrimitive);\n\nexport { CodeEditorPrimitive, type CodeEditorPrimitiveProps };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AAEtC,OAAOC,YAAY,MAAM,sBAAsB;AAE/C,SAASC,eAAe;AAMxB,MAAMC,aAAgD,GAAG;EACrDC,WAAW,EAAE,IAAI;EACjBC,QAAQ,EAAE,IAAI;EACdC,OAAO,EAAE;IACLC,OAAO,EAAE;EACb;AACJ,CAAC;AAED,MAAMC,8BAA8B,GAAGA,CAAC;EACpCC,KAAK;EACLC,QAAQ;EACRC,OAAO,EAAEC,YAAY;EACrB,GAAGC;AACmB,CAAC,KAAK;EAC5B,MAAMF,OAAO,GAAGX,OAAO,CAAC,MAA6C;IACjE,OAAO;MACH,GAAGG,aAAa;MAChB,GAAGS,YAAY;MACfR,WAAW,EAAEM,QAAQ,KAAKI,SAAS,GAAGX,aAAa,CAACC,WAAW,GAAGM,QAAQ;MAC1EL,QAAQ,EAAEK,QAAQ,KAAKI,SAAS,GAAGX,aAAa,CAACE,QAAQ,GAAGK;IAChE,CAAC;EACL,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;EACd,oBACIX,KAAA,CAAAgB,aAAA,CAACd,YAAY,EAAAe,MAAA,CAAAC,MAAA;IACTC,MAAM,EAAE;EAAsB,GAC1BL,IAAI;IACRM,QAAQ,EAAEN,IAAI,CAACM,QAAQ,IAAI,MAAO;IAClCC,YAAY,EAAEX,KAAM;IACpBE,OAAO,EAAEA;EAAQ,EACpB,CAAC;AAEV,CAAC;AAED,MAAMU,mBAAmB,GAAGnB,eAAe,CAAC,qBAAqB,EAAEM,8BAA8B,CAAC;AAElG,SAASa,mBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { DatePickerPrimitiveProps } from "./primitives/index.js";
|
|
3
|
+
import type { FormComponentProps } from "../FormComponent/index.js";
|
|
4
|
+
type DatePickerProps = DatePickerPrimitiveProps & FormComponentProps;
|
|
5
|
+
declare const DatePicker: (({ label, description, note, hint, required, disabled, validation, ...props }: DatePickerProps) => React.JSX.Element) & {
|
|
6
|
+
original: ({ label, description, note, hint, required, disabled, validation, ...props }: DatePickerProps) => React.JSX.Element;
|
|
7
|
+
originalName: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
} & {
|
|
10
|
+
original: (({ label, description, note, hint, required, disabled, validation, ...props }: DatePickerProps) => React.JSX.Element) & {
|
|
11
|
+
original: ({ label, description, note, hint, required, disabled, validation, ...props }: DatePickerProps) => React.JSX.Element;
|
|
12
|
+
originalName: string;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
originalName: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
} & {
|
|
18
|
+
createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ label, description, note, hint, required, disabled, validation, ...props }: DatePickerProps) => React.JSX.Element) & {
|
|
19
|
+
original: ({ label, description, note, hint, required, disabled, validation, ...props }: DatePickerProps) => React.JSX.Element;
|
|
20
|
+
originalName: string;
|
|
21
|
+
displayName: string;
|
|
22
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
23
|
+
};
|
|
24
|
+
export { DatePicker, type DatePickerProps };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { makeDecoratable } from "../utils.js";
|
|
3
|
+
import { DatePickerPrimitive } from "./primitives/index.js";
|
|
4
|
+
import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
|
|
5
|
+
const DecoratableDatePicker = ({
|
|
6
|
+
label,
|
|
7
|
+
description,
|
|
8
|
+
note,
|
|
9
|
+
hint,
|
|
10
|
+
required,
|
|
11
|
+
disabled,
|
|
12
|
+
validation,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
isValid: validationIsValid,
|
|
17
|
+
message: validationMessage
|
|
18
|
+
} = validation || {};
|
|
19
|
+
const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "w-full"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(FormComponentLabel, {
|
|
23
|
+
text: label,
|
|
24
|
+
hint: hint,
|
|
25
|
+
required: required,
|
|
26
|
+
disabled: disabled,
|
|
27
|
+
invalid: invalid
|
|
28
|
+
}), /*#__PURE__*/React.createElement(FormComponentDescription, {
|
|
29
|
+
text: description,
|
|
30
|
+
disabled: disabled
|
|
31
|
+
}), /*#__PURE__*/React.createElement(DatePickerPrimitive, Object.assign({}, props, {
|
|
32
|
+
disabled: disabled,
|
|
33
|
+
invalid: invalid
|
|
34
|
+
})), /*#__PURE__*/React.createElement(FormComponentErrorMessage, {
|
|
35
|
+
text: validationMessage,
|
|
36
|
+
invalid: invalid,
|
|
37
|
+
disabled: disabled
|
|
38
|
+
}), /*#__PURE__*/React.createElement(FormComponentNote, {
|
|
39
|
+
text: note,
|
|
40
|
+
disabled: disabled
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
const DatePicker = makeDecoratable("DatePicker", DecoratableDatePicker);
|
|
44
|
+
export { DatePicker };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","makeDecoratable","DatePickerPrimitive","FormComponentDescription","FormComponentErrorMessage","FormComponentLabel","FormComponentNote","DecoratableDatePicker","label","description","note","hint","required","disabled","validation","props","isValid","validationIsValid","message","validationMessage","invalid","createElement","className","text","Object","assign","DatePicker"],"sources":["DatePicker.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { DatePickerPrimitiveProps } from \"./primitives/index.js\";\nimport { DatePickerPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype DatePickerProps = DatePickerPrimitiveProps & FormComponentProps;\n\nconst DecoratableDatePicker = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: DatePickerProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n\n return (\n <div className=\"w-full\">\n <FormComponentLabel\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={disabled} />\n <DatePickerPrimitive\n {...(props as DatePickerPrimitiveProps)}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\n\nconst DatePicker = makeDecoratable(\"DatePicker\", DecoratableDatePicker);\n\nexport { DatePicker, type DatePickerProps };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,eAAe;AAExB,SAASC,mBAAmB;AAE5B,SACIC,wBAAwB,EACxBC,yBAAyB,EACzBC,kBAAkB,EAClBC,iBAAiB;AAKrB,MAAMC,qBAAqB,GAAGA,CAAC;EAC3BC,KAAK;EACLC,WAAW;EACXC,IAAI;EACJC,IAAI;EACJC,QAAQ;EACRC,QAAQ;EACRC,UAAU;EACV,GAAGC;AACU,CAAC,KAAK;EACnB,MAAM;IAAEC,OAAO,EAAEC,iBAAiB;IAAEC,OAAO,EAAEC;EAAkB,CAAC,GAAGL,UAAU,IAAI,CAAC,CAAC;EACnF,MAAMM,OAAO,GAAGpB,OAAO,CAAC,MAAMiB,iBAAiB,KAAK,KAAK,EAAE,CAACA,iBAAiB,CAAC,CAAC;EAE/E,oBACIlB,KAAA,CAAAsB,aAAA;IAAKC,SAAS,EAAC;EAAQ,gBACnBvB,KAAA,CAAAsB,aAAA,CAAChB,kBAAkB;IACfkB,IAAI,EAAEf,KAAM;IACZG,IAAI,EAAEA,IAAK;IACXC,QAAQ,EAAEA,QAAS;IACnBC,QAAQ,EAAEA,QAAS;IACnBO,OAAO,EAAEA;EAAQ,CACpB,CAAC,eACFrB,KAAA,CAAAsB,aAAA,CAAClB,wBAAwB;IAACoB,IAAI,EAAEd,WAAY;IAACI,QAAQ,EAAEA;EAAS,CAAE,CAAC,eACnEd,KAAA,CAAAsB,aAAA,CAACnB,mBAAmB,EAAAsB,MAAA,CAAAC,MAAA,KACXV,KAAK;IACVF,QAAQ,EAAEA,QAAS;IACnBO,OAAO,EAAEA;EAAQ,EACpB,CAAC,eACFrB,KAAA,CAAAsB,aAAA,CAACjB,yBAAyB;IACtBmB,IAAI,EAAEJ,iBAAkB;IACxBC,OAAO,EAAEA,OAAQ;IACjBP,QAAQ,EAAEA;EAAS,CACtB,CAAC,eACFd,KAAA,CAAAsB,aAAA,CAACf,iBAAiB;IAACiB,IAAI,EAAEb,IAAK;IAACG,QAAQ,EAAEA;EAAS,CAAE,CACnD,CAAC;AAEd,CAAC;AAED,MAAMa,UAAU,GAAGzB,eAAe,CAAC,YAAY,EAAEM,qBAAqB,CAAC;AAEvE,SAASmB,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from "@storybook/addon-docs/blocks";
|
|
2
|
+
|
|
3
|
+
import * as DatePickerStories from "./DatePicker.stories";
|
|
4
|
+
|
|
5
|
+
<Meta of={DatePickerStories} />
|
|
6
|
+
|
|
7
|
+
# DatePicker
|
|
8
|
+
|
|
9
|
+
The DatePicker component is a form control for selecting dates, times, months, years, date ranges, and multiple selections. It supports 10 variant types and includes built-in validation support.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
<Canvas of={DatePickerStories.Documentation} source={ { code: `
|
|
14
|
+
import React, { useState } from "react";
|
|
15
|
+
|
|
16
|
+
import { DatePicker } from "@webiny/admin-ui";
|
|
17
|
+
|
|
18
|
+
const DatePickerExample = () => {
|
|
19
|
+
const [value, setValue] = useState(undefined);
|
|
20
|
+
const [validation, setValidation] = useState({ isValid: true, message: "" });
|
|
21
|
+
|
|
22
|
+
const handleChange = (newValue) => {
|
|
23
|
+
setValue(newValue);
|
|
24
|
+
if (!newValue) {
|
|
25
|
+
setValidation({ isValid: false, message: "Please select a date" });
|
|
26
|
+
} else {
|
|
27
|
+
setValidation({ isValid: true, message: "" });
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<DatePicker
|
|
33
|
+
type="date"
|
|
34
|
+
label="Event Date"
|
|
35
|
+
required={true}
|
|
36
|
+
description="Select the date for your event"
|
|
37
|
+
note="Choose a date that works for all participants"
|
|
38
|
+
placeholder="Pick a date"
|
|
39
|
+
value={value}
|
|
40
|
+
onChange={handleChange}
|
|
41
|
+
validation={validation}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default DatePickerExample;
|
|
48
|
+
|
|
49
|
+
` } }
|
|
50
|
+
additionalActions={[
|
|
51
|
+
{
|
|
52
|
+
title: 'Open in GitHub',
|
|
53
|
+
onClick: () => {
|
|
54
|
+
window.open(
|
|
55
|
+
'https://github.com/webiny/webiny-js/blob/next/packages/admin-ui/src/DatePicker/DatePicker.tsx',
|
|
56
|
+
'_blank'
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
]}
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<Controls of={DatePickerStories.Documentation} />
|
|
64
|
+
|
|
65
|
+
## Examples
|
|
66
|
+
|
|
67
|
+
### Date
|
|
68
|
+
|
|
69
|
+
The default date picker for selecting a single date.
|
|
70
|
+
|
|
71
|
+
<Canvas of={DatePickerStories.WithLabel} />
|
|
72
|
+
|
|
73
|
+
### With Presets
|
|
74
|
+
|
|
75
|
+
Date picker with preset buttons (Today, Tomorrow, In a week, etc.) displayed alongside the calendar.
|
|
76
|
+
|
|
77
|
+
<Canvas of={DatePickerStories.WithPresets} />
|
|
78
|
+
|
|
79
|
+
### Time
|
|
80
|
+
|
|
81
|
+
A time-only picker using a native time input.
|
|
82
|
+
|
|
83
|
+
<Canvas of={DatePickerStories.TypeTime} />
|
|
84
|
+
|
|
85
|
+
### Date & Time (local)
|
|
86
|
+
|
|
87
|
+
Combines a calendar with a time input, storing the value as a local Date object.
|
|
88
|
+
|
|
89
|
+
<Canvas of={DatePickerStories.TypeDateTimeLocal} />
|
|
90
|
+
|
|
91
|
+
### Date & Time (with timezone)
|
|
92
|
+
|
|
93
|
+
Combines a calendar with a time input, storing the value as an ISO string with timezone offset.
|
|
94
|
+
|
|
95
|
+
<Canvas of={DatePickerStories.TypeDateTimeTz} />
|
|
96
|
+
|
|
97
|
+
### Month
|
|
98
|
+
|
|
99
|
+
Select a month and year. Value is stored as `"YYYY-MM"`.
|
|
100
|
+
|
|
101
|
+
<Canvas of={DatePickerStories.TypeMonth} />
|
|
102
|
+
|
|
103
|
+
### Week
|
|
104
|
+
|
|
105
|
+
Select an ISO week. Value is stored as `"YYYY-Www"` (e.g. `"2026-W18"`). The selected week is highlighted as a range on the calendar.
|
|
106
|
+
|
|
107
|
+
<Canvas of={DatePickerStories.TypeWeek} />
|
|
108
|
+
|
|
109
|
+
### Year
|
|
110
|
+
|
|
111
|
+
Select a year from a scrollable grid. Use the `yearRange` prop to control the available range.
|
|
112
|
+
|
|
113
|
+
<Canvas of={DatePickerStories.TypeYear} />
|
|
114
|
+
|
|
115
|
+
### Date Range
|
|
116
|
+
|
|
117
|
+
Select a start and end date using a two-month calendar.
|
|
118
|
+
|
|
119
|
+
<Canvas of={DatePickerStories.TypeDateRange} />
|
|
120
|
+
|
|
121
|
+
### Multiple Dates
|
|
122
|
+
|
|
123
|
+
Select multiple individual dates. Selected dates appear as dismissable tags.
|
|
124
|
+
|
|
125
|
+
<Canvas of={DatePickerStories.TypeMultipleDates} />
|
|
126
|
+
|
|
127
|
+
### Multiple Months
|
|
128
|
+
|
|
129
|
+
Select multiple months. Selected months appear as dismissable tags.
|
|
130
|
+
|
|
131
|
+
<Canvas of={DatePickerStories.TypeMultipleMonths} />
|
|
132
|
+
|
|
133
|
+
### Multiple Years
|
|
134
|
+
|
|
135
|
+
Select multiple years. Selected years appear as dismissable tags.
|
|
136
|
+
|
|
137
|
+
<Canvas of={DatePickerStories.TypeMultipleYears} />
|
|
138
|
+
|
|
139
|
+
## Form States
|
|
140
|
+
|
|
141
|
+
### With Validation Error
|
|
142
|
+
|
|
143
|
+
<Canvas of={DatePickerStories.WithErrors} />
|
|
144
|
+
|
|
145
|
+
### Disabled
|
|
146
|
+
|
|
147
|
+
<Canvas of={DatePickerStories.Disabled} />
|
|
148
|
+
|
|
149
|
+
### Full Example
|
|
150
|
+
|
|
151
|
+
Shows all form component features together: label, required indicator, description, validation error, and note.
|
|
152
|
+
|
|
153
|
+
<Canvas of={DatePickerStories.FullExample} />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-webpack5";
|
|
2
|
+
import { DatePicker } from "./DatePicker.js";
|
|
3
|
+
declare const meta: Meta<typeof DatePicker>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof DatePicker>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithLabel: Story;
|
|
8
|
+
export declare const WithLabelRequired: Story;
|
|
9
|
+
export declare const WithDescription: Story;
|
|
10
|
+
export declare const WithNotes: Story;
|
|
11
|
+
export declare const WithErrors: Story;
|
|
12
|
+
export declare const Disabled: Story;
|
|
13
|
+
export declare const FullExample: Story;
|
|
14
|
+
export declare const WithPresets: Story;
|
|
15
|
+
export declare const TypeTime: Story;
|
|
16
|
+
export declare const TypeDateTimeLocal: Story;
|
|
17
|
+
export declare const TypeDateTimeTz: Story;
|
|
18
|
+
export declare const TypeMonth: Story;
|
|
19
|
+
export declare const TypeWeek: Story;
|
|
20
|
+
export declare const TypeYear: Story;
|
|
21
|
+
export declare const TypeDateRange: Story;
|
|
22
|
+
export declare const TypeMultipleDates: Story;
|
|
23
|
+
export declare const TypeMultipleMonths: Story;
|
|
24
|
+
export declare const TypeMultipleYears: Story;
|
|
25
|
+
export declare const Documentation: Story;
|