@wonderflow/react-components 12.7.0 → 12.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/card/card.module.css +1 -1
- package/dist/components/modal/header/modal-header.js +2 -2
- package/dist/components/popover/popover.d.ts +4 -0
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +13 -7
- package/dist/components/popover/popover.module.css +1 -1
- package/dist/components/popover/popover.stories.d.ts +8 -0
- package/dist/components/popover/popover.stories.d.ts.map +1 -1
- package/dist/components/popover/popover.stories.js +15 -2
- package/dist/components/popover/popover.test.js +13 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/spinner/spinner.js +2 -2
- package/dist/components/split-button/split-button.stories.d.ts +1 -1
- package/dist/examples/charts/mock-data/channels.d.ts +45 -0
- package/dist/examples/charts/mock-data/channels.d.ts.map +1 -0
- package/dist/examples/charts/mock-data/channels.js +393 -0
- package/dist/examples/charts/mock-data/feedbackCount.d.ts +28 -0
- package/dist/examples/charts/mock-data/feedbackCount.d.ts.map +1 -0
- package/dist/examples/charts/mock-data/feedbackCount.js +283 -0
- package/dist/examples/charts/mock-data/index.d.ts +5 -0
- package/dist/examples/charts/mock-data/index.d.ts.map +1 -0
- package/dist/examples/charts/mock-data/index.js +19 -0
- package/dist/examples/charts/mock-data/products.d.ts +17 -0
- package/dist/examples/charts/mock-data/products.d.ts.map +1 -0
- package/dist/examples/charts/mock-data/products.js +337 -0
- package/dist/examples/charts/mock-data/prosCons.d.ts +7 -0
- package/dist/examples/charts/mock-data/prosCons.d.ts.map +1 -0
- package/dist/examples/charts/mock-data/prosCons.js +83 -0
- package/dist/examples/charts/storybook/cartesian-base.stories.d.ts +9 -0
- package/dist/examples/charts/storybook/cartesian-base.stories.d.ts.map +1 -0
- package/dist/examples/charts/storybook/cartesian-base.stories.js +183 -0
- package/dist/examples/charts/storybook/line-chart.stories.d.ts +231 -0
- package/dist/examples/charts/storybook/line-chart.stories.d.ts.map +1 -0
- package/dist/examples/charts/storybook/line-chart.stories.js +275 -0
- package/dist/examples/charts/storybook/sb-charts.module.css +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/package.json +18 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Card{background-color:var(--global-background);border-radius:var(--radius);padding:var(--padding);position:relative}.Card[data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--dimmed-0)}.Card[data-card-bordered=true]{border:1px solid var(--dimmed-1)}.Card[data-card-dimmed="0"]{background-color:var(--dimmed-0)}.Card[data-card-dimmed="0"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-background)}.Card[data-card-dimmed="1"]{background-color:var(--dimmed-1)}.Card[data-card-dimmed="1"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--dimmed-0)}.Card[data-card-dimmed="1"][data-card-bordered=true]{border:1px solid var(--dimmed-2)}.Card[data-card-dimmed="2"]{background-color:var(--dimmed-2)}.Card[data-card-dimmed="2"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--dimmed-1)}.Card[data-card-dimmed="2"][data-card-bordered=true]{border:1px solid var(--dimmed-3)}.Card[data-card-vibrant=true]{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background)}.Card[data-card-vibrant=true][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-vibrancy-background-soft)}.Card[data-card-vibrant=true][data-card-dimmed="0"]{background-color:var(--global-vibrancy-background-soft)}.Card[data-card-vibrant=true][data-card-dimmed="0"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-background)}.Card[data-card-vibrant=true][data-card-dimmed="1"]{background-color:var(--global-vibrancy-background)}.Card[data-card-vibrant=true][data-card-dimmed="1"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-vibrancy-background-soft)}.Card[data-card-vibrant=true][data-card-dimmed="2"]{background-color:var(--global-vibrancy-background-hard)}.Card[data-card-vibrant=true][data-card-dimmed="2"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-vibrancy-background)}.Row{height:100%}.Left{flex-shrink:0}.Content{flex-grow:1;height:100%}.Right{flex-shrink:0}}
|
|
1
|
+
@layer components{.Card{background-color:var(--global-background);border-radius:var(--radius);padding:var(--padding);position:relative}.Card[data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--dimmed-0)}.Card[data-card-bordered=true]{border:1px solid var(--dimmed-1)}.Card[data-card-dimmed="0"]{background-color:var(--dimmed-0)}.Card[data-card-dimmed="0"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-background)}.Card[data-card-dimmed="1"]{background-color:var(--dimmed-1)}.Card[data-card-dimmed="1"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--dimmed-0)}.Card[data-card-dimmed="1"][data-card-bordered=true]{border:1px solid var(--dimmed-2)}.Card[data-card-dimmed="2"]{background-color:var(--dimmed-2)}.Card[data-card-dimmed="2"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--dimmed-1)}.Card[data-card-dimmed="2"][data-card-bordered=true]{border:1px solid var(--dimmed-3)}.Card[data-card-vibrant=true]{-webkit-backdrop-filter:saturate(180%) blur(62px);backdrop-filter:saturate(180%) blur(62px);background-color:var(--global-vibrancy-background)}.Card[data-card-vibrant=true][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-vibrancy-background-soft)}.Card[data-card-vibrant=true][data-card-dimmed="0"]{background-color:var(--global-vibrancy-background-soft)}.Card[data-card-vibrant=true][data-card-dimmed="0"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-background)}.Card[data-card-vibrant=true][data-card-dimmed="1"]{background-color:var(--global-vibrancy-background)}.Card[data-card-vibrant=true][data-card-dimmed="1"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-vibrancy-background-soft)}.Card[data-card-vibrant=true][data-card-dimmed="2"]{background-color:var(--global-vibrancy-background-hard)}.Card[data-card-vibrant=true][data-card-dimmed="2"][data-card-highlight-hover=true]:is(:hover,:focus-visible){background-color:var(--global-vibrancy-background)}.Row{height:100%}.Left{flex-shrink:0}.Content{flex-grow:1;height:100%;overflow:auto;width:100%}.Right{flex-shrink:0}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022-
|
|
3
|
+
* Copyright 2022-2024 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -21,6 +21,6 @@ import * as styles from './modal-header.module.css';
|
|
|
21
21
|
export const ModalHeader = forwardRef(({ children, className, hideCloseButton = false, hideBorder = false, theme = 'light', ...otherProps }, forwardedRef) => {
|
|
22
22
|
const { onClose } = useOverlayContext();
|
|
23
23
|
const isBorderHidden = useMemo(() => hideBorder || !children, [hideBorder, children]);
|
|
24
|
-
return (_jsx("div", { "aria-label": "Header", className: clsx(styles.HeaderWrapper, className), ref: forwardedRef, "data-theme": theme, ...otherProps, children: _jsxs(Stack, { vAlign: "center", fill: false, hAlign: "space-between", direction: "row", className: styles.Header, "data-border-hidden": isBorderHidden, children: [_jsx("div", { children: children }), (onClose && !hideCloseButton) && (_jsx(IconButton, { "aria-label": "Close Button", onClick: onClose, className: styles.CloseButton, icon: "xmark", kind: "flat" }))] }) }));
|
|
24
|
+
return (_jsx("div", { "aria-label": "Header", className: clsx(styles.HeaderWrapper, className), ref: forwardedRef, "data-theme": theme, ...otherProps, children: _jsxs(Stack, { vAlign: "center", fill: false, hAlign: "space-between", direction: "row", className: styles.Header, "data-border-hidden": isBorderHidden, children: [_jsx("div", { children: children }), (onClose && !hideCloseButton) && (_jsx(IconButton, { "aria-label": "Close Button", onClick: onClose, autoFocus: true, className: styles.CloseButton, icon: "xmark", kind: "flat" }))] }) }));
|
|
25
25
|
});
|
|
26
26
|
ModalHeader.displayName = 'Modal.Header';
|
|
@@ -46,6 +46,10 @@ export declare type PopoverProps = {
|
|
|
46
46
|
* Set the popover element the same with of the trigger element.
|
|
47
47
|
*/
|
|
48
48
|
matchTriggerWidth?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Auto close the popover when clicking inside of it.
|
|
51
|
+
*/
|
|
52
|
+
closeOnInsideClick?: boolean;
|
|
49
53
|
/**
|
|
50
54
|
* Set the root element to render the Popover into.
|
|
51
55
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EAAE,aAAa,EAAY,kBAAkB,EAC3D,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.tsx"],"names":[],"mappings":"AAgBA,OAAO,EACL,aAAa,EAAE,aAAa,EAAY,kBAAkB,EAC3D,MAAM,gBAAgB,CAAC;AASxB,OAAO,EAML,SAAS,EAKV,MAAM,OAAO,CAAC;AASf,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAA;AA0BD,eAAO,MAAM,OAAO;;;iEAyIlB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import tkns from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
3
3
|
import { useFocusWithin, useKeyPress } from 'ahooks';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import {
|
|
5
|
+
import { domMax, LazyMotion, m, } from 'framer-motion';
|
|
6
6
|
import { Children, cloneElement, forwardRef, isValidElement, useEffect, useMemo, useRef, useState, } from 'react';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
import { mergeRefs } from 'react-merge-refs';
|
|
@@ -32,7 +32,7 @@ const PopoverAnimation = {
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
|
-
export const Popover = forwardRef(({ children, trigger, offset = 8, placement = 'auto-start', open, disabled, closeOnOutsideClick = true, className, matchTriggerWidth, onOpenChange, root, ...otherProps }, forwardedRef) => {
|
|
35
|
+
export const Popover = forwardRef(({ children, trigger, offset = 8, placement = 'auto-start', open, disabled, closeOnOutsideClick = true, closeOnInsideClick = false, className, matchTriggerWidth, onOpenChange, root, ...otherProps }, forwardedRef) => {
|
|
36
36
|
const seedID = useUIDSeed();
|
|
37
37
|
const [isOpen, setIsOpen] = useState(false);
|
|
38
38
|
const popoverContainerRef = useRef(null);
|
|
@@ -53,7 +53,13 @@ export const Popover = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
53
53
|
s.elements.popper.style.width = `${referenceElement.offsetWidth ?? 0}px`;
|
|
54
54
|
},
|
|
55
55
|
}), [matchTriggerWidth]);
|
|
56
|
-
const
|
|
56
|
+
const handleCloseOnClickInside = (e) => {
|
|
57
|
+
e.stopPropagation();
|
|
58
|
+
if (isOpen && closeOnInsideClick) {
|
|
59
|
+
setIsOpen(false);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const { getTooltipProps, setTooltipRef, setTriggerRef,
|
|
57
63
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
58
64
|
visible, } = usePopperTooltip({
|
|
59
65
|
delayShow: 0,
|
|
@@ -78,8 +84,8 @@ export const Popover = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
78
84
|
},
|
|
79
85
|
],
|
|
80
86
|
});
|
|
81
|
-
const isFocusWithin = useFocusWithin(
|
|
82
|
-
|
|
87
|
+
const isFocusWithin = useFocusWithin(popoverContainerRef, {
|
|
88
|
+
onBlur: (e) => {
|
|
83
89
|
if (e.relatedTarget && visible) {
|
|
84
90
|
setIsOpen(true);
|
|
85
91
|
}
|
|
@@ -98,9 +104,9 @@ export const Popover = forwardRef(({ children, trigger, offset = 8, placement =
|
|
|
98
104
|
'aria-controls': seedID('popover-dialog'),
|
|
99
105
|
'aria-expanded': isOpen,
|
|
100
106
|
...otherProps,
|
|
101
|
-
}), isBrowser() && visible && createPortal(_jsx(
|
|
107
|
+
}), isBrowser() && visible && createPortal(_jsx("div", { "aria-hidden": true, "data-testid": "tooltip", ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), ...getTooltipProps({ className: styles.PopUp }), onClick: e => handleCloseOnClickInside(e), children: _jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(m.div, { variants: PopoverAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: _jsx("div", { children: Children.map(children, child => isValidElement(child) && cloneElement(child, {
|
|
102
108
|
id: seedID('popover-dialog'),
|
|
103
109
|
'aria-labelledby': seedID('popover-trigger'),
|
|
104
|
-
})) }) }) }, seedID('tooltip-content'))
|
|
110
|
+
})) }) }) }) }, seedID('tooltip-content')), root ?? document.body)] }));
|
|
105
111
|
});
|
|
106
112
|
Popover.displayName = 'Popover';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Popover{display:contents}.PopUp{inline-size:max-content;z-index:
|
|
1
|
+
@layer components{.Popover{display:contents}.PopUp{inline-size:max-content;z-index:4}}
|
|
@@ -27,4 +27,12 @@ export declare const WithCode: ComponentStory<import("react").ForwardRefExoticCo
|
|
|
27
27
|
style?: Record<string, any> | undefined;
|
|
28
28
|
className?: string | undefined;
|
|
29
29
|
} & import("./popover").PopoverProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
30
|
+
export declare const closeOnInsideClick: ComponentStory<import("react").ForwardRefExoticComponent<{
|
|
31
|
+
style?: Record<string, any> | undefined;
|
|
32
|
+
className?: string | undefined;
|
|
33
|
+
} & import("./popover").PopoverProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
34
|
+
export declare const withLoader: ComponentStory<import("react").ForwardRefExoticComponent<{
|
|
35
|
+
style?: Record<string, any> | undefined;
|
|
36
|
+
className?: string | undefined;
|
|
37
|
+
} & import("./popover").PopoverProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
30
38
|
//# sourceMappingURL=popover.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.stories.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"popover.stories.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,OAAO,CAiBxC,CAAC;AAEF,eAAe,KAAK,CAAC;AAmCrB,eAAO,MAAM,OAAO;;;sFAA2B,CAAC;AAyBhD,eAAO,MAAM,aAAa;;;sFAA0B,CAAC;AAuBrD,eAAO,MAAM,SAAS;;;sFAA6B,CAAC;AAwCpD,eAAO,MAAM,UAAU;;;sFAA8B,CAAC;AActD,eAAO,MAAM,YAAY;;;sFAAgC,CAAC;AAkC1D,eAAO,MAAM,QAAQ;;;sFAA4B,CAAC;AA+ElD,eAAO,MAAM,kBAAkB;;;sFAA6B,CAAC;AAoD7D,eAAO,MAAM,UAAU;;;sFAA4B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { Button, Card, Elevator, IconButton, Menu, Stack, Textfield, } from '../..';
|
|
3
|
+
import { Button, Card, Elevator, IconButton, Menu, Modal, ResponsiveProvider, Skeleton, Stack, Textfield, Tooltip, } from '../..';
|
|
4
4
|
import { Popover } from './popover';
|
|
5
5
|
const story = {
|
|
6
6
|
title: 'Dialogs/Popover',
|
|
@@ -9,6 +9,7 @@ const story = {
|
|
|
9
9
|
placement: 'auto-start',
|
|
10
10
|
offset: 8,
|
|
11
11
|
closeOnOutsideClick: true,
|
|
12
|
+
closeOnInsideClick: false,
|
|
12
13
|
matchTriggerWidth: false,
|
|
13
14
|
trigger: _jsx(Button, { children: "Open Popover" }),
|
|
14
15
|
},
|
|
@@ -55,7 +56,6 @@ const ControlledTemplate = (args) => {
|
|
|
55
56
|
}, children: ["Lorem ipsum dolor, sit amet consectetur adipisicing elit. Magni error unde sapiente beatae! Nostrum praesentium similique veniam non ut nulla, incidunt velit et, placeat cupiditate, aliquid saepe. Atque, provident perferendis?", _jsx("button", { type: "button", onClick: () => setIsOpen(val => !val), children: "Close popover" })] }) }));
|
|
56
57
|
};
|
|
57
58
|
export const Controlled = ControlledTemplate.bind({});
|
|
58
|
-
Controlled.args = {};
|
|
59
59
|
const WithElevatorTemplate = args => (_jsx(Popover, { ...args, children: _jsx(Elevator, { resting: 2, children: _jsxs(Card, { dimmed: 0, bordered: true, children: ["Lorem ipsum dolor sit.", ' ', _jsx("a", { href: "https://design.wonderflow.ai/get-started/components/dialogs/popover", target: "_blank", rel: "noreferrer", children: "More Popover info." })] }) }) }));
|
|
60
60
|
export const WithElevator = WithElevatorTemplate.bind({});
|
|
61
61
|
WithElevator.args = {
|
|
@@ -78,3 +78,16 @@ WithCode.args = {
|
|
|
78
78
|
placement: 'auto-end',
|
|
79
79
|
trigger: _jsx(IconButton, { kind: "secondary", icon: "circle-info", dimension: "big", "aria-label": "Show some formatted code" }),
|
|
80
80
|
};
|
|
81
|
+
const WithModalTemplate = (args) => {
|
|
82
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
83
|
+
return (_jsxs(ResponsiveProvider, { children: [_jsx(Popover, { ...args, closeOnInsideClick: true, trigger: _jsx(Button, { children: "Open Menu" }), children: _jsx(Menu, { children: _jsx(Menu.Item, { autoFocus: true, icon: "arrow-right", value: "1", onClick: () => setIsOpen(true), children: "Open Modal" }) }) }), _jsx(Modal, { title: "A Modal ", subtitle: "opened from a Popover Menu", overlayColor: "dark", hideCloseButton: false, hideHeaderBorder: false, hideFooterBorder: false, alignActionCenter: false, alignContentCenter: false, size: "medium", theme: "auto", isLoading: false, preventCloseOnClickOutside: false, content: (_jsx("div", { children: _jsxs("p", { children: ["When", ' ', _jsx("b", { children: "closeOnInsideClick" }), ' ', "is set to `true`, the Popover will automatically close clicking on it.", _jsx(Tooltip, { placement: "right-start", delay: 500, trigger: (_jsx(IconButton, { kind: "flat", icon: "circle-info", dimension: "small", "aria-label": "Show some formatted code" })), children: _jsx("p", { children: "some extra info in a Tooltip." }) })] }) })), primaryAction: _jsx(Button, { onClick: () => setIsOpen(false), children: "Confirm" }), secondaryAction: _jsx(Button, { onClick: () => setIsOpen(false), children: "Cancel" }), isVisible: isOpen, onCloseModal: () => setIsOpen(false) })] }));
|
|
84
|
+
};
|
|
85
|
+
export const closeOnInsideClick = WithModalTemplate.bind({});
|
|
86
|
+
const SkeletonTemplate = (args) => {
|
|
87
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
88
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
89
|
+
return (_jsx(Popover, { ...args, placement: "right-end", children: _jsxs(Menu, { style: { minWidth: '250px' }, children: [isLoading
|
|
90
|
+
? (_jsx(Stack, { hPadding: 8, children: _jsx(Skeleton, { count: 3, height: "36px" }) }))
|
|
91
|
+
: (_jsxs(_Fragment, { children: [_jsx(Menu.Item, { autoFocus: true, icon: "arrow-right", value: "1", children: "Sample long menu item" }), _jsx(Menu.ItemCheckbox, { onClick: () => setIsChecked(val => !val), checked: isChecked, icon: isChecked ? 'check' : undefined, value: "2", children: "Checkbox item" }), _jsx(Menu.Item, { value: "3", icon: "right-from-bracket", children: "Item option 3" })] })), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { icon: isLoading ? 'minus' : 'plus', value: "4", onClick: () => setIsLoading(val => !val), children: isLoading ? 'Switch Off Loader' : 'Switch On Loader' })] }) }));
|
|
92
|
+
};
|
|
93
|
+
export const withLoader = SkeletonTemplate.bind({});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { fireEvent, render } from '@testing-library/react';
|
|
3
3
|
import { Button } from '../button';
|
|
4
|
+
import { Menu } from '../menu';
|
|
4
5
|
import { Popover } from './popover';
|
|
5
6
|
describe('<Popover>', () => {
|
|
6
7
|
test(' it should render properly', () => {
|
|
@@ -23,4 +24,16 @@ describe('<Popover>', () => {
|
|
|
23
24
|
const { container } = render(_jsx(Popover, { placement: "bottom-start", trigger: _jsx(Button, { kind: "flat", children: "Open popover" }), disabled: true, children: _jsx("div", { children: "Some Content" }) }));
|
|
24
25
|
expect(container).not.toBeNull();
|
|
25
26
|
});
|
|
27
|
+
test(' it should open/close properly', () => {
|
|
28
|
+
const handleClickSpy = jest.fn();
|
|
29
|
+
const { getByTestId } = render(_jsx(Popover, { open: true, placement: "bottom-start", trigger: _jsx(Button, { kind: "flat", children: "Open popover" }), closeOnInsideClick: true, children: _jsx(Menu, { children: _jsx(Menu.Item, { autoFocus: true, icon: "arrow-right", value: "1", onClick: handleClickSpy, "data-testid": "menu-item", children: "menu item" }) }) }));
|
|
30
|
+
const btn = getByTestId('Button');
|
|
31
|
+
const item = getByTestId('menu-item');
|
|
32
|
+
fireEvent.click(btn);
|
|
33
|
+
const tooltip = getByTestId('tooltip');
|
|
34
|
+
expect(item).toBeDefined();
|
|
35
|
+
expect(tooltip).toBeDefined();
|
|
36
|
+
fireEvent.click(item);
|
|
37
|
+
expect(handleClickSpy).toHaveBeenCalledTimes(1);
|
|
38
|
+
});
|
|
26
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/spinner/spinner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/spinner/spinner.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAc,aAAa,EAAE,MAAM,OAAO,CAAC;AAElD,oBAAY,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,OAAO;IAVlB;;OAEG;;IAEH;;OAEG;;iDA8DH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*
|
|
3
|
-
* Copyright 2022-
|
|
3
|
+
* Copyright 2022-2024 Wonderflow Design Team
|
|
4
4
|
*
|
|
5
5
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
* you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
import clsx from 'clsx';
|
|
18
|
-
import { domMax, LazyMotion, m } from 'framer-motion';
|
|
18
|
+
import { domMax, LazyMotion, m, } from 'framer-motion';
|
|
19
19
|
import { forwardRef } from 'react';
|
|
20
20
|
export const Spinner = forwardRef(({ className, style, color, dimension = 'big', }, forwardedRef) => {
|
|
21
21
|
const attributes = {
|
|
@@ -2,7 +2,7 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
|
2
2
|
import { SplitButton } from './split-button';
|
|
3
3
|
declare const story: ComponentMeta<typeof SplitButton>;
|
|
4
4
|
export default story;
|
|
5
|
-
export declare const Default: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"button", import("type-fest").Except<import("../..").ButtonProps, "iconPosition" | "iconColor" | "pressed"> & Pick<import("../..").PopoverProps, "offset" | "placement"> & {
|
|
5
|
+
export declare const Default: ComponentStory<import("../../types/polymorphic").ForwardRefComponent<"button", import("type-fest/source/except").Except<import("../..").ButtonProps, "iconPosition" | "iconColor" | "pressed"> & Pick<import("../..").PopoverProps, "offset" | "placement"> & {
|
|
6
6
|
label: string;
|
|
7
7
|
}>>;
|
|
8
8
|
//# sourceMappingURL=split-button.stories.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const channels: {
|
|
2
|
+
channel: string;
|
|
3
|
+
'1 star': number;
|
|
4
|
+
'2 stars': number;
|
|
5
|
+
'3 stars': number;
|
|
6
|
+
'4 stars': number;
|
|
7
|
+
'5 stars': number;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const channelsB: {
|
|
10
|
+
channel: string;
|
|
11
|
+
'1 star': {
|
|
12
|
+
value: number;
|
|
13
|
+
percentage: number;
|
|
14
|
+
};
|
|
15
|
+
'2 stars': {
|
|
16
|
+
value: number;
|
|
17
|
+
percentage: number;
|
|
18
|
+
};
|
|
19
|
+
'3 stars': {
|
|
20
|
+
value: number;
|
|
21
|
+
percentage: number;
|
|
22
|
+
};
|
|
23
|
+
'4 stars': {
|
|
24
|
+
value: number;
|
|
25
|
+
percentage: number;
|
|
26
|
+
};
|
|
27
|
+
'5 stars': {
|
|
28
|
+
value: number;
|
|
29
|
+
percentage: number;
|
|
30
|
+
};
|
|
31
|
+
overlay: {
|
|
32
|
+
value: number;
|
|
33
|
+
percentage: number;
|
|
34
|
+
};
|
|
35
|
+
}[];
|
|
36
|
+
export declare const nestedChannels: {
|
|
37
|
+
name: string;
|
|
38
|
+
values: {
|
|
39
|
+
value: number;
|
|
40
|
+
valueInfo: number;
|
|
41
|
+
label: string;
|
|
42
|
+
label2: number;
|
|
43
|
+
}[];
|
|
44
|
+
}[];
|
|
45
|
+
//# sourceMappingURL=channels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../../../src/examples/charts/mock-data/channels.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,QAAQ;;;;;;;GAyJpB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CrB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;GAgL1B,CAAC"}
|