@pismo/marola 0.0.1-alpha.9 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{Button-B1umG8kJ.js → Button-2b1peDFT.js} +25 -26
- package/dist/{ClickAwayListener-BKznXF1d.js → ClickAwayListener-BSW-Nd-y.js} +3 -2
- package/dist/Dialog.module-DFEmFdYT.js +30 -0
- package/dist/Group-B3p31ftp.js +26 -0
- package/dist/Popup-B6ZSGIEI.js +1248 -0
- package/dist/{Portal-BcdMtRGF.js → Portal-DIeBsWdL.js} +2 -2
- package/dist/SelectButton-C8JQKaf4.js +61 -0
- package/dist/Tabs.module-jkH1Qjn7.js +22 -0
- package/dist/Toggle-BCgIItCc.js +142 -0
- package/dist/assets/Advice.css +1 -1
- package/dist/assets/Button.css +1 -1
- package/dist/assets/Checkbox.css +1 -1
- package/dist/assets/Dialog.css +1 -1
- package/dist/assets/EllipsisTooltip.css +1 -0
- package/dist/assets/Group.css +1 -0
- package/dist/assets/IconButton.css +1 -1
- package/dist/assets/Input.css +1 -1
- package/dist/assets/InputSearch.css +1 -1
- package/dist/assets/PageHeader.css +1 -1
- package/dist/assets/Pagination.css +1 -1
- package/dist/assets/SelectButton.css +1 -0
- package/dist/assets/Skeleton.css +1 -1
- package/dist/assets/Snackbar.css +1 -1
- package/dist/assets/SortTooltip.css +1 -1
- package/dist/assets/Stepper.css +1 -1
- package/dist/assets/Table.css +1 -1
- package/dist/assets/TextDisplay.css +1 -0
- package/dist/assets/Toggle.css +1 -1
- package/dist/assets/Toggle2.css +1 -0
- package/dist/assets/Typography.css +1 -1
- package/dist/combineHooksSlotProps-DVjg9PRh.js +80 -0
- package/dist/components/Advice/Advice.d.ts +17 -3
- package/dist/components/Advice/Advice.js +39 -17
- package/dist/components/Advice/Advice.stories.d.ts +18 -0
- package/dist/components/Button/Button.d.ts +6 -3
- package/dist/components/Button/Button.js +60 -65
- package/dist/components/Button/Button.stories.d.ts +3 -1
- package/dist/components/Checkbox/Checkbox.d.ts +19 -2
- package/dist/components/Checkbox/Checkbox.js +63 -40
- package/dist/components/Checkbox/Checkbox.stories.d.ts +31 -0
- package/dist/components/Chip/Chip.d.ts +39 -0
- package/dist/components/Chip/Chip.js +19 -0
- package/dist/components/Chip/Chip.stories.d.ts +42 -0
- package/dist/components/Chip/chip.test.d.ts +1 -0
- package/dist/components/Dialog/Actions.js +1 -1
- package/dist/components/Dialog/Backdrop.js +1 -1
- package/dist/components/Dialog/CloseIconButton.js +2 -2
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Dialog/Dialog.js +13 -13
- package/dist/components/Dialog/Dialog.stories.d.ts +10 -10
- package/dist/components/Dialog/{Title.d.ts → DialogTitle.d.ts} +3 -3
- package/dist/components/Dialog/DialogTitle.js +29 -0
- package/dist/components/EllipsisTooltip/EllipsisTooltip.d.ts +7 -0
- package/dist/components/EllipsisTooltip/EllipsisTooltip.js +23 -0
- package/dist/components/EllipsisTooltip/EllipsisTooltip.stories.d.ts +31 -0
- package/dist/components/Icon/Icon.d.ts +8 -15
- package/dist/components/Icon/Icon.js +108 -57
- package/dist/components/Icon/Icon.stories.d.ts +14 -0
- package/dist/components/Icon/types.d.ts +5 -0
- package/dist/components/Icon/types.js +1 -0
- package/dist/components/IconButton/Icon.stories.d.ts +15 -0
- package/dist/components/IconButton/IconButton.d.ts +18 -2
- package/dist/components/IconButton/IconButton.js +58 -63
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +241 -230
- package/dist/components/InputSearch/InputSearch.d.ts +7 -9
- package/dist/components/InputSearch/InputSearch.js +30 -25
- package/dist/components/InputSearch/InputSearch.stories.d.ts +21 -4
- package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +36 -6
- package/dist/components/PageHeader/PageHeader.js +83 -47
- package/dist/components/PageHeader/PageHeader.stories.d.ts +2 -31
- package/dist/components/Pagination/Pagination.d.ts +24 -5
- package/dist/components/Pagination/Pagination.js +127 -109
- package/dist/components/Pagination/Pagination.stories.d.ts +17 -0
- package/dist/components/Select/Select.d.ts +26 -0
- package/dist/components/Select/Select.js +857 -0
- package/dist/components/Select/Select.stories.d.ts +22 -0
- package/dist/components/Select/SelectButton.d.ts +12 -0
- package/dist/components/Select/SelectButton.js +8 -0
- package/dist/components/Skeleton/Skeleton.d.ts +10 -3
- package/dist/components/Skeleton/Skeleton.js +16 -19
- package/dist/components/Skeleton/Skeleton.stories.d.ts +14 -0
- package/dist/components/Skeleton/SkeletonCircle.stories.d.ts +14 -0
- package/dist/components/Skeleton/SkeletonTable.stories.d.ts +16 -0
- package/dist/components/Snackbar/Snackbar.d.ts +19 -5
- package/dist/components/Snackbar/Snackbar.js +247 -230
- package/dist/components/Snackbar/Snackbar.stories.d.ts +319 -0
- package/dist/components/SortTooltip/SortTooltip.d.ts +3 -1
- package/dist/components/SortTooltip/SortTooltip.js +55 -29
- package/dist/components/Stepper/Stepper.d.ts +11 -1
- package/dist/components/Stepper/Stepper.js +37 -22
- package/dist/components/Stepper/Stepper.stories.d.ts +16 -0
- package/dist/components/Table/Table.d.ts +33 -16
- package/dist/components/Table/Table.js +106 -91
- package/dist/components/Table/Table.stories.d.ts +29 -0
- package/dist/components/Table/_Table.TBody.stories.d.ts +14 -0
- package/dist/components/Table/_Table.THead.stories.d.ts +14 -0
- package/dist/components/Table/_Table.Td.stories.d.ts +16 -0
- package/dist/components/Table/_Table.Th.stories.d.ts +15 -0
- package/dist/components/Table/_Table.Tr.stories.d.ts +15 -0
- package/dist/components/Tabs/Tab.d.ts +5 -0
- package/dist/components/Tabs/Tab.js +179 -6
- package/dist/components/Tabs/Tab.stories.d.ts +15 -0
- package/dist/components/Tabs/TabPanel.d.ts +4 -0
- package/dist/components/Tabs/TabPanel.js +12 -12
- package/dist/components/Tabs/TabPanel.stories.d.ts +14 -0
- package/dist/components/Tabs/Tabs.d.ts +5 -1
- package/dist/components/Tabs/Tabs.js +242 -668
- package/dist/components/Tabs/Tabs.stories.d.ts +14 -0
- package/dist/components/TextDisplay/TextDisplay.d.ts +23 -0
- package/dist/components/TextDisplay/TextDisplay.js +37 -0
- package/dist/components/TextDisplay/TextDisplay.stories.d.ts +13 -0
- package/dist/components/TextDisplay/textDisplay.test.d.ts +1 -0
- package/dist/components/Toggle/Toggle.js +143 -129
- package/dist/components/ToggleGroup/Group.d.ts +18 -0
- package/dist/components/ToggleGroup/Group.js +7 -0
- package/dist/components/ToggleGroup/Group.test.d.ts +1 -0
- package/dist/components/ToggleGroup/Toggle.d.ts +15 -0
- package/dist/components/ToggleGroup/Toggle.js +17 -0
- package/dist/components/ToggleGroup/Toggle.test.d.ts +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +6 -0
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +25 -0
- package/dist/components/Tooltip/Tooltip.d.ts +22 -6
- package/dist/components/Tooltip/Tooltip.js +114 -1339
- package/dist/components/Tooltip/Tooltip.stories.d.ts +35 -0
- package/dist/components/Typography/Typography.d.ts +5 -2
- package/dist/components/Typography/Typography.js +58 -74
- package/dist/components/Typography/Typography.stories.d.ts +1 -0
- package/dist/contexts/SnackbarProvider/SnackbarProvider.d.ts +11 -0
- package/dist/contexts/SnackbarProvider/SnackbarProvider.js +50 -0
- package/dist/contexts/SnackbarProvider/SnackbarProvider.stories.d.ts +21 -0
- package/dist/{index-CqjC7P5Y.js → index-CH45lKw7.js} +333 -307
- package/dist/{index-BNWbc5Kh.js → index-CjW42-M-.js} +3108 -3152
- package/dist/main.d.ts +10 -1
- package/dist/main.js +74 -55
- package/dist/marola.css +1 -0
- package/dist/{useButton-Bc8IAgyk.js → useButton-DNk3wrQp.js} +3 -4
- package/dist/useCompoundItem-D1iRfg8D.js +84 -0
- package/dist/useEventCallback-xTG9piMa.js +45 -0
- package/dist/useList-B0hog_3-.js +436 -0
- package/dist/utils/styleStrings.d.ts +1 -1
- package/dist/utils/styleStrings.js +7 -7
- package/package.json +4 -4
- package/dist/Dialog.module-CGVM5V_D.js +0 -15
- package/dist/Tab-CRwnhsj5.js +0 -254
- package/dist/Tabs.module-yYcTJnj6.js +0 -103
- package/dist/_commonjsHelpers-CT_km90n.js +0 -30
- package/dist/assets/global.css +0 -1
- package/dist/components/Button/Button.stories.js +0 -40
- package/dist/components/Dialog/Dialog.stories.js +0 -59
- package/dist/components/Dialog/Title.js +0 -29
- package/dist/components/Input/Input.stories.js +0 -106
- package/dist/components/InputSearch/InputSearch.stories.js +0 -36
- package/dist/components/LoadingSpinner/LoadingSpinner.stories.js +0 -38
- package/dist/components/PageHeader/PageHeader.stories.js +0 -49
- package/dist/components/Toggle/Toggle.stories.js +0 -33
- package/dist/components/Typography/Typography.stories.js +0 -30
- package/dist/components/Typography/typography.test.js +0 -11357
- package/dist/magic-string.es-O_8lTkE3.js +0 -738
- package/dist/objectWithoutPropertiesLoose-D7Cp0Pg_.js +0 -26
- package/dist/utils/styleStrings.test.js +0 -41
- package/dist/vi.Y_w82WR8-Df0JUamG.js +0 -9860
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TooltipProps } from './Tooltip.tsx';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: ({ arialRole, children: childrenProp, className, disableHoverListener, onClose, padding, position, open: openProp, theme, title, onTargetCreated, ...rest }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
tags: string[];
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: string;
|
|
10
|
+
};
|
|
11
|
+
decorators: ((Story: import('@storybook/types').PartialStoryFn<import('@storybook/react').ReactRenderer, {
|
|
12
|
+
children: import('react').ReactNode;
|
|
13
|
+
title: import('react').ReactNode;
|
|
14
|
+
open?: boolean | undefined;
|
|
15
|
+
disableHoverListener?: boolean | undefined;
|
|
16
|
+
onClose?: (() => void) | undefined;
|
|
17
|
+
theme?: "black" | "white" | undefined;
|
|
18
|
+
padding?: "small" | "normal" | undefined;
|
|
19
|
+
position?: import('@floating-ui/utils').Placement | undefined;
|
|
20
|
+
arialRole?: import('react').AriaRole | undefined;
|
|
21
|
+
className?: string | undefined;
|
|
22
|
+
style?: import('react').CSSProperties | undefined;
|
|
23
|
+
'data-testid'?: string | undefined;
|
|
24
|
+
onTargetCreated?: ((e: HTMLElement) => void) | undefined;
|
|
25
|
+
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
26
|
+
};
|
|
27
|
+
export default meta;
|
|
28
|
+
type Story = StoryObj<typeof meta>;
|
|
29
|
+
export declare const Simple: Story;
|
|
30
|
+
export declare const Onclose: Story;
|
|
31
|
+
export declare const InitialOpen: Story;
|
|
32
|
+
export declare const WhiteTheme: Story;
|
|
33
|
+
export declare const DisabledHover: Story;
|
|
34
|
+
export declare const NormalPadding: Story;
|
|
35
|
+
export declare const Positioning: Story;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentType, ElementType, HTMLAttributes, LabelHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
export type VariantType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | '
|
|
3
|
+
export type VariantType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'base-lg' | 'base-xl' | 'base-xxl' | 'base' | 'base-sm';
|
|
4
4
|
export type CommonTypographyHTMLAttributes = HTMLAttributes<HTMLParagraphElement> & HTMLAttributes<HTMLHeadingElement> & HTMLAttributes<HTMLSpanElement> & HTMLAttributes<HTMLTableCellElement>;
|
|
5
5
|
export type TypographyProps = {
|
|
6
6
|
/** Text or children to display */
|
|
@@ -9,8 +9,10 @@ export type TypographyProps = {
|
|
|
9
9
|
element?: ElementType;
|
|
10
10
|
/** Style to be visually displayed as */
|
|
11
11
|
variant?: VariantType;
|
|
12
|
-
/** Space
|
|
12
|
+
/** Space separated list of CSS classes to apply */
|
|
13
13
|
className?: string;
|
|
14
|
+
/** Color to apply */
|
|
15
|
+
color?: string;
|
|
14
16
|
/** Whether to apply underline text decoration */
|
|
15
17
|
underline?: boolean;
|
|
16
18
|
/** Whether to apply strikethrough text decoration */
|
|
@@ -29,3 +31,4 @@ export type TypographyProps = {
|
|
|
29
31
|
*/
|
|
30
32
|
export declare const Typography: import('react').ForwardRefExoticComponent<TypographyProps & import('react').RefAttributes<ElementType | ComponentType>>;
|
|
31
33
|
export default Typography;
|
|
34
|
+
export declare const Text: import('react').ForwardRefExoticComponent<TypographyProps & import('react').RefAttributes<ElementType | ComponentType>>;
|
|
@@ -1,81 +1,65 @@
|
|
|
1
1
|
import '../../assets/Typography.css';
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { bemify as
|
|
2
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as m, useMemo as c } from "react";
|
|
4
|
+
import { bemify as f, getBEMBase as x, getBEMBlock as k } from "../../utils/styleStrings.js";
|
|
5
5
|
import { c as B } from "../../clsx-DB4S2d7J.js";
|
|
6
|
-
const
|
|
7
|
-
h1:
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"quote--strikethrough": "_quote--strikethrough_13r5p_88",
|
|
28
|
-
"quote--underlined": "_quote--underlined_13r5p_91",
|
|
29
|
-
"quote--strikethrough-underlined": "_quote--strikethrough-underlined_13r5p_94",
|
|
30
|
-
form__input: N,
|
|
31
|
-
form__hint: T,
|
|
32
|
-
form__label: j,
|
|
33
|
-
form__dropdown: P,
|
|
34
|
-
"form--bold": "_form--bold_13r5p_118",
|
|
35
|
-
"form--strikethrough": "_form--strikethrough_13r5p_121",
|
|
36
|
-
"form--underlined": "_form--underlined_13r5p_124",
|
|
37
|
-
"form--strikethrough-underlined": "_form--strikethrough-underlined_13r5p_127",
|
|
38
|
-
table__header: R,
|
|
39
|
-
table__body: S,
|
|
40
|
-
"table__body--secondary": "_table__body--secondary_13r5p_141",
|
|
41
|
-
"table--bold": "_table--bold_13r5p_146",
|
|
42
|
-
"table--strikethrough": "_table--strikethrough_13r5p_149",
|
|
43
|
-
"table--underlined": "_table--underlined_13r5p_152",
|
|
44
|
-
"table--strikethrough-underlined": "_table--strikethrough-underlined_13r5p_155",
|
|
45
|
-
button: U,
|
|
46
|
-
"button--bold": "_button--bold_13r5p_165",
|
|
47
|
-
"button--strikethrough": "_button--strikethrough_13r5p_168",
|
|
48
|
-
"button--underlined": "_button--underlined_13r5p_171",
|
|
49
|
-
"button--strikethrough-underlined": "_button--strikethrough-underlined_13r5p_174"
|
|
50
|
-
}, V = ["form", "table"], W = (e) => {
|
|
51
|
-
const r = e.toString();
|
|
52
|
-
let t = "body";
|
|
53
|
-
return r.match(/^h[1-4]/) ? t = r : r.match(/^h[5-6]/) && (t = "h4"), r === "th" && (t = "table-header"), r === "td" && (t = "table-body"), t;
|
|
54
|
-
}, F = c((e, r) => {
|
|
6
|
+
const t = {
|
|
7
|
+
"u-typography-h1": "_u-typography-h1_zizdh_1",
|
|
8
|
+
"u-typography-h2": "_u-typography-h2_zizdh_8",
|
|
9
|
+
"u-typography-h3": "_u-typography-h3_zizdh_15",
|
|
10
|
+
"u-typography-h4": "_u-typography-h4_zizdh_22",
|
|
11
|
+
"u-typography-h5": "_u-typography-h5_zizdh_29",
|
|
12
|
+
"u-typography-h6": "_u-typography-h6_zizdh_36",
|
|
13
|
+
"u-typography-base": "_u-typography-base_zizdh_43",
|
|
14
|
+
"u-typography-base--xxl": "_u-typography-base--xxl_zizdh_48",
|
|
15
|
+
"u-typography-base--xl": "_u-typography-base--xl_zizdh_52",
|
|
16
|
+
"u-typography-base--lg": "_u-typography-base--lg_zizdh_56",
|
|
17
|
+
"u-typography-base--sm": "_u-typography-base--sm_zizdh_60",
|
|
18
|
+
"u-typography-base--bold": "_u-typography-base--bold_zizdh_64",
|
|
19
|
+
"u-typography-base--strikethrough": "_u-typography-base--strikethrough_zizdh_67",
|
|
20
|
+
"u-typography-base--underlined": "_u-typography-base--underlined_zizdh_70",
|
|
21
|
+
"u-typography-base--strikethrough-underlined": "_u-typography-base--strikethrough-underlined_zizdh_73"
|
|
22
|
+
}, $ = (e) => {
|
|
23
|
+
const a = e.toString();
|
|
24
|
+
let r = "base";
|
|
25
|
+
return a.match(/^h[1-6]/) && (r = a), r;
|
|
26
|
+
}, E = m((e, a) => {
|
|
55
27
|
const {
|
|
56
|
-
children:
|
|
57
|
-
className:
|
|
58
|
-
underline:
|
|
59
|
-
element:
|
|
60
|
-
bold:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
28
|
+
children: r,
|
|
29
|
+
className: s,
|
|
30
|
+
underline: y = !1,
|
|
31
|
+
element: u = "span",
|
|
32
|
+
bold: i = !1,
|
|
33
|
+
color: d,
|
|
34
|
+
variant: _ = $(u),
|
|
35
|
+
strikethrough: h = !1,
|
|
36
|
+
elementProps: n
|
|
37
|
+
} = e, l = u, z = c(() => {
|
|
38
|
+
const o = `u-typography-${f(_)}`, g = x(o), p = k(o);
|
|
66
39
|
return B(
|
|
67
|
-
|
|
68
|
-
{ [
|
|
69
|
-
|
|
70
|
-
{ [
|
|
71
|
-
{ [
|
|
72
|
-
{ [
|
|
73
|
-
{ [
|
|
40
|
+
t[g],
|
|
41
|
+
{ [t[`${o}`]]: o !== g },
|
|
42
|
+
s,
|
|
43
|
+
{ [t[`${p}--bold`]]: i },
|
|
44
|
+
{ [t[`${p}--underlined`]]: y },
|
|
45
|
+
{ [t[`${p}--strikethrough`]]: h },
|
|
46
|
+
{ [t[`${p}--strikethrough-underlined`]]: h && h && y }
|
|
74
47
|
);
|
|
75
|
-
}, [
|
|
76
|
-
return /* @__PURE__ */
|
|
77
|
-
|
|
48
|
+
}, [i, s, h, y, _]);
|
|
49
|
+
return /* @__PURE__ */ b(
|
|
50
|
+
l,
|
|
51
|
+
{
|
|
52
|
+
style: { color: d },
|
|
53
|
+
ref: a,
|
|
54
|
+
"data-testid": e["data-testid"],
|
|
55
|
+
...n ?? {},
|
|
56
|
+
className: z,
|
|
57
|
+
children: r
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}), j = E;
|
|
78
61
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
j as Text,
|
|
63
|
+
E as Typography,
|
|
64
|
+
E as default
|
|
81
65
|
};
|
|
@@ -17,6 +17,7 @@ declare const meta: {
|
|
|
17
17
|
element?: import('react').ElementType | undefined;
|
|
18
18
|
variant?: import('./Typography').VariantType | undefined;
|
|
19
19
|
className?: string | undefined;
|
|
20
|
+
color?: string | undefined;
|
|
20
21
|
underline?: boolean | undefined;
|
|
21
22
|
strikethrough?: boolean | undefined;
|
|
22
23
|
bold?: boolean | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SnackbarProps } from '../../components/Snackbar/Snackbar';
|
|
2
|
+
|
|
3
|
+
export type SnackbarContextProps = {
|
|
4
|
+
showMessage: (message: string, variant?: SnackbarProps['variant'], duration?: number) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const SnackbarContext: import('react').Context<SnackbarContextProps>;
|
|
7
|
+
export type SnackbarProviderProps = {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare const SnackbarProvider: ({ children }: SnackbarProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const useSnackbar: () => SnackbarContextProps;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as n, jsxs as l, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as m, useState as p, useCallback as f, useContext as C } from "react";
|
|
3
|
+
import { Snackbar as b } from "../../components/Snackbar/Snackbar.js";
|
|
4
|
+
const o = m({
|
|
5
|
+
showMessage: () => {
|
|
6
|
+
}
|
|
7
|
+
}), s = { message: "", variant: "success", duration: 5e3, open: !1 }, h = ({ children: r }) => {
|
|
8
|
+
const [e, t] = p(s), i = f(
|
|
9
|
+
(a = s.message, u = s.variant, d = s.duration) => {
|
|
10
|
+
t({
|
|
11
|
+
id: `${(/* @__PURE__ */ new Date()).getTime()}-${a}`,
|
|
12
|
+
message: a,
|
|
13
|
+
variant: u,
|
|
14
|
+
duration: d,
|
|
15
|
+
open: !0
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
[t]
|
|
19
|
+
), c = () => {
|
|
20
|
+
t((a) => ({ ...a, open: !1 }));
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ n(
|
|
23
|
+
o.Provider,
|
|
24
|
+
{
|
|
25
|
+
value: {
|
|
26
|
+
showMessage: i
|
|
27
|
+
},
|
|
28
|
+
children: /* @__PURE__ */ l(g, { children: [
|
|
29
|
+
r,
|
|
30
|
+
/* @__PURE__ */ n(
|
|
31
|
+
b,
|
|
32
|
+
{
|
|
33
|
+
autoHideDuration: e.duration,
|
|
34
|
+
variant: e.variant,
|
|
35
|
+
open: e.open,
|
|
36
|
+
snackbarMessage: e.message,
|
|
37
|
+
onClose: c,
|
|
38
|
+
"data-testid": "snackbar"
|
|
39
|
+
},
|
|
40
|
+
e.id
|
|
41
|
+
)
|
|
42
|
+
] })
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}, S = () => C(o);
|
|
46
|
+
export {
|
|
47
|
+
o as SnackbarContext,
|
|
48
|
+
h as SnackbarProvider,
|
|
49
|
+
S as useSnackbar
|
|
50
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SnackbarProviderProps } from './SnackbarProvider';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
declare const meta: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: ({ children }: SnackbarProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
tags: string[];
|
|
15
|
+
decorators: ((Story: import('@storybook/types').PartialStoryFn<import('@storybook/react').ReactRenderer, {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof meta>;
|
|
21
|
+
export declare const Provider: Story;
|