@wonderflow/react-components 10.19.0 → 10.20.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.
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAC+B,yBAAyB,EAG7D,SAAS,EAEV,MAAM,OAAO,CAAC;AAMf,OAAO,EACmC,cAAc,EACvD,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAiB,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,aAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,oBAAY,iBAAiB,GAAG,cAAc,CAAC,cAAc,CAAC;IAC5D;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC,CAAC;AAEJ,aAAK,qBAAqB,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,GAAG;IAC1E,MAAM,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAA;AAqBD,eAAO,MAAM,YAAY,uBAsKE,CAAC"}
1
+ {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAC+B,yBAAyB,EAG7D,SAAS,EAEV,MAAM,OAAO,CAAC;AAMf,OAAO,EACmC,cAAc,EACvD,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAiB,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,aAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,oBAAY,iBAAiB,GAAG,cAAc,CAAC,cAAc,CAAC;IAC5D;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC,CAAC;AAEJ,aAAK,qBAAqB,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,GAAG;IAC1E,MAAM,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAA;AAqBD,eAAO,MAAM,YAAY,uBAyKE,CAAC"}
@@ -14,7 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { useDebounce, useFocusWithin, useKeyPress, useSize, } from 'ahooks';
17
+ import { useClickAway, useDebounce, useFocusWithin, useKeyPress, useSize, } from 'ahooks';
18
18
  import { AnimatePresence, domMax, LazyMotion, m, } from 'framer-motion';
19
19
  import { Children, cloneElement, forwardRef, isValidElement, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
20
20
  import { createPortal } from 'react-dom';
@@ -65,7 +65,8 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
65
65
  }, [debounceQuery, children]);
66
66
  const isFocusWithin = useFocusWithin(autocompleteRef, {
67
67
  onChange: (isFocusWithin) => {
68
- if (isFocusWithin) {
68
+ const m = document.getElementById(seedID('autocomplete-menu'));
69
+ if (isFocusWithin || m) {
69
70
  setIsOpen(true);
70
71
  }
71
72
  else {
@@ -73,6 +74,7 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
73
74
  }
74
75
  },
75
76
  });
77
+ useClickAway(() => setIsOpen(false), autocompleteRef);
76
78
  useKeyPress('esc', () => setIsOpen(false));
77
79
  const { getTooltipProps, setTooltipRef, setTriggerRef, triggerRef,
78
80
  // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
@@ -1 +1 @@
1
- @layer components{.MenuItem{--padding:2.50rem;background:none;border:0;box-sizing:border-box;color:var(--dimmed-6);cursor:pointer;font:inherit;font-size:1rem;font-weight:600;inline-size:100%;padding:0;position:relative;text-align:start}.MenuItem:hover{color:var(--global-foreground)}.MenuItem[aria-checked=true]{color:var(--global-interactive-text)}.MenuItem:before{border-radius:.25rem;bottom:0;content:"";left:.5rem;opacity:.6;position:absolute;right:.5rem;top:0;z-index:0}.MenuItem:is(:hover,:focus-visible,[aria-pressed=true]):not([aria-disabled=true]){outline:none}.MenuItem:is(:hover,:focus-visible,[aria-pressed=true]):not([aria-disabled=true]):before{background-color:var(--dimmed-1)}.MenuItem[data-menu-item-dimension=small]{--padding:2.25rem;font-size:.88rem}.MenuItem>*{position:relative}.MenuItem[aria-disabled=true]{color:var(--global-disabled-foreground);cursor:not-allowed}.MenuItem [data-menu-item-padding=true][data-menu-item-has-icon=false][data-menu-item-icon-right=false]{padding-left:var(--padding)}.MenuItem [data-menu-item-padding=true][data-menu-item-has-icon=false][data-menu-item-icon-right=true]{padding-right:var(--padding)}.ItemContent{position:relative}.DecorationContent{flex-grow:1}.Icon{align-self:flex-start;flex-grow:0;flex-shrink:0;margin-top:4px}}
1
+ @layer components{.MenuItem{--padding:2.50rem;background:none;border:0;box-sizing:border-box;color:var(--dimmed-6);cursor:pointer;font:inherit;font-size:1rem;font-weight:600;inline-size:100%;padding:0;position:relative;text-align:start}.MenuItem:hover{color:var(--global-foreground)}.MenuItem[aria-checked=true]{color:var(--global-interactive-text)}.MenuItem:before{border-radius:0;bottom:0;content:"";left:0;opacity:.6;position:absolute;right:0;top:0;z-index:0}.MenuItem:is(:hover,:focus-visible,[aria-pressed=true]):not([aria-disabled=true]){outline:none}.MenuItem:is(:hover,:focus-visible,[aria-pressed=true]):not([aria-disabled=true]):before{background-color:var(--dimmed-1)}.MenuItem[data-menu-item-dimension=small]{--padding:2.25rem;font-size:.88rem}.MenuItem>*{position:relative}.MenuItem[aria-disabled=true]{color:var(--global-disabled-foreground);cursor:not-allowed}.MenuItem [data-menu-item-padding=true][data-menu-item-has-icon=false][data-menu-item-icon-right=false]{padding-left:var(--padding)}.MenuItem [data-menu-item-padding=true][data-menu-item-has-icon=false][data-menu-item-icon-right=true]{padding-right:var(--padding)}.ItemContent{position:relative}.DecorationContent{flex-grow:1}.Icon{align-self:flex-start;flex-grow:0;flex-shrink:0;margin-top:4px}}
@@ -1 +1 @@
1
- @layer components{.Menu{background-color:var(--global-background);border:1px solid var(--dimmed-1);border-radius:.5rem;list-style-type:none;overflow:hidden;position:relative}.Menu hr{margin:0 .5rem}.Menu[data-menu-should-scroll=true]{-webkit-overflow-scrolling:touch;max-height:var(--max-height);overflow:auto;overscroll-behavior:contain}}
1
+ @layer components{.Menu{background-color:var(--global-background);border:1px solid var(--dimmed-1);border-radius:.5rem;list-style-type:none;overflow:hidden;position:relative}.Menu hr{margin:0}.Menu[data-menu-should-scroll=true]{-webkit-overflow-scrolling:touch;max-height:var(--max-height);overflow:auto;overscroll-behavior:contain}}
@@ -1 +1 @@
1
- {"version":3,"file":"menu.stories.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CAGrC,CAAC;AAEF,eAAe,KAAK,CAAC;AAkBrB,eAAO,MAAM,OAAO;;;;;;EAAoB,CAAC;AAEzC,eAAO,MAAM,aAAa;;;;;;EAAoB,CAAC;AAe/C,eAAO,MAAM,SAAS;;;;;;EAA6B,CAAC;AA0BpD,eAAO,MAAM,cAAc;;;;;;EAAgC,CAAC;AAY5D,eAAO,MAAM,MAAM;;;;;;EAAyB,CAAC"}
1
+ {"version":3,"file":"menu.stories.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CAGrC,CAAC;AAEF,eAAe,KAAK,CAAC;AAoBrB,eAAO,MAAM,OAAO;;;;;;EAAoB,CAAC;AAEzC,eAAO,MAAM,aAAa;;;;;;EAAoB,CAAC;AAe/C,eAAO,MAAM,SAAS;;;;;;EAA6B,CAAC;AA0BpD,eAAO,MAAM,cAAc;;;;;;EAAgC,CAAC;AAY5D,eAAO,MAAM,MAAM;;;;;;EAAyB,CAAC"}
@@ -7,7 +7,7 @@ const story = {
7
7
  component: Menu,
8
8
  };
9
9
  export default story;
10
- const Template = args => (_jsxs(Menu, { ...args, children: [_jsx(Menu.Item, { value: "1", padding: false, children: "List item text" }), _jsx(Menu.Item, { value: "2", padding: false, children: "List item text" }), _jsx(Menu.Item, { value: "3", padding: false, children: "List item text List item textList item textList item textList item text" }), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { value: "4", padding: false, children: "List item text" }), _jsx(Menu.Item, { value: "5", padding: false, children: _jsxs("span", { children: [_jsx(Title, { level: "6", children: "Cutom item" }), _jsx(Text, { size: 14, dimmed: 5, children: "Sub text example" })] }) })] }));
10
+ const Template = args => (_jsxs(Menu, { ...args, children: [_jsx(Menu.Item, { value: "1", padding: false, children: "List item text" }), _jsx(Menu.Item, { value: "2", padding: false, children: "List item text" }), _jsx(Menu.Item, { value: "3", padding: false, children: "List item text List item text List item text List item text List item text" }), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { value: "4", padding: false, children: "List item text" }), _jsx(Menu.Item, { value: "5", padding: false, subtext: "Hint text", children: "List item text with subtext" }), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { value: "6", padding: false, children: _jsxs("span", { children: [_jsx(Title, { level: "6", children: "Cutom item" }), _jsx(Text, { size: 14, dimmed: 5, children: "Custom sub text example" })] }) })] }));
11
11
  export const Default = Template.bind({});
12
12
  export const WithMaxHeight = Template.bind({});
13
13
  WithMaxHeight.args = {
@@ -20,5 +20,5 @@ const WithCheckboxTemplate = (args) => {
20
20
  return (_jsxs(Menu, { ...args, children: [_jsx(Menu.ItemCheckbox, { value: "1", checked: isChecked, icon: isChecked ? 'check' : undefined, onClick: () => setIsChecked(val => !val), children: "Checkable item" }), _jsx(Menu.Item, { value: "2", icon: "compass", decoration: _jsx(Chip, { dimension: "small", color: "blue", children: "Decoration" }), children: "List item text" })] }));
21
21
  };
22
22
  export const WithCheckboxes = WithCheckboxTemplate.bind({});
23
- const LinksTemplate = args => (_jsxs(Menu, { ...args, children: [_jsx(Menu.Item, { value: "1", as: "a", href: "https://design.wonderflow.ai", icon: "user", children: "List item text" }), _jsx(Menu.Item, { value: "2", icon: "message", children: "List item text List item" }), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { value: "3", children: "List item text" }), _jsx(Menu.Item, { value: "4", as: "a", href: "https://design.wonderflow.ai", icon: "bell", children: "List item text" })] }));
23
+ const LinksTemplate = args => (_jsxs(Menu, { ...args, children: [_jsx(Menu.Item, { value: "1", as: "a", href: "https://design.wonderflow.ai", target: "_blank", icon: "user", children: "List item text as Link in new Tab" }), _jsx(Menu.Item, { value: "2", icon: "message", children: "List item text" }), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { value: "3", children: "List item text" }), _jsx(Menu.Item, { value: "4", as: "a", href: "https://design.wonderflow.ai", icon: "bell", children: "List item text as Link" })] }));
24
24
  export const AsLink = LinksTemplate.bind({});
@@ -79,7 +79,7 @@ export const Popover = forwardRef(({ children, trigger, offset = 8, placement =
79
79
  },
80
80
  ],
81
81
  });
82
- const isFocusWithin = useFocusWithin(popoverContainerRef, {
82
+ const isFocusWithin = useFocusWithin(document.getElementById(seedID('tooltip-content')), {
83
83
  onBlur: (e) => {
84
84
  if (e.relatedTarget && visible) {
85
85
  setIsOpen(false);
@@ -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;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,OAAO,CAOxC,CAAC;AAEF,eAAe,KAAK,CAAC;AA4CrB,eAAO,MAAM,OAAO;;;4EAA2B,CAAC;AAyBhD,eAAO,MAAM,aAAa;;;4EAA0B,CAAC;AAuBrD,eAAO,MAAM,SAAS;;;4EAA6B,CAAC;AAoCpD,eAAO,MAAM,UAAU;;;4EAA8B,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;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,OAAO,CAgBxC,CAAC;AAEF,eAAe,KAAK,CAAC;AA4CrB,eAAO,MAAM,OAAO;;;4EAA2B,CAAC;AAyBhD,eAAO,MAAM,aAAa;;;4EAA0B,CAAC;AAuBrD,eAAO,MAAM,SAAS;;;4EAA6B,CAAC;AAwCpD,eAAO,MAAM,UAAU;;;4EAA8B,CAAC"}
@@ -1,14 +1,23 @@
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, Menu, Textfield, Title, } from '../..';
3
+ import { Button, Menu, Stack, Textfield, Title, } from '../..';
4
4
  import { Popover } from './popover';
5
5
  const story = {
6
6
  title: 'Dialogs/Popover',
7
7
  component: Popover,
8
8
  args: {
9
9
  placement: 'auto-start',
10
+ offset: 8,
11
+ closeOnOutsideClick: true,
12
+ matchTriggerWidth: false,
10
13
  trigger: _jsx(Button, { children: "Open Popover" }),
11
14
  },
15
+ argTypes: {
16
+ placement: {
17
+ options: ['auto', 'auto-start', 'auto-end', 'top', 'bottom', 'right', 'left', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'right-start', 'right-end', 'left-start', 'left-end'],
18
+ control: { type: 'select' },
19
+ },
20
+ },
12
21
  };
13
22
  export default story;
14
23
  const DefaultTemplate = (args) => {
@@ -16,7 +25,7 @@ const DefaultTemplate = (args) => {
16
25
  return (_jsx(Popover, { ...args, children: _jsxs(Menu, { children: [_jsx(Menu.Item, { icon: "arrow-right", description: _jsx(_Fragment, { children: "Description for this item" }), 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, { icon: "user", value: "3", description: (_jsxs(_Fragment, { children: [_jsx(Title, { as: "h2", level: "5", children: "Sample H2 Title longlonglonglonglonglonglonglonglonglonglong" }), _jsx("p", { children: "long text content placeholder to test wrapping and sizes" }), _jsx("img", { style: { width: '100%' }, alt: "", src: "https://images.unsplash.com/photo-1593963171957-d87a6279226d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80" })] })), children: "Short menu label" }), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { value: "4", icon: "arrow-down-to-bracket", children: "Even shorter" }), _jsx(Menu.Item, { value: "5", disabled: true, children: "Really?" })] }) }));
17
26
  };
18
27
  export const Default = DefaultTemplate.bind({});
19
- const CustomTemplate = args => (_jsxs(_Fragment, { children: [_jsx(Popover, { ...args, children: _jsx("div", { style: {
28
+ const CustomTemplate = args => (_jsxs(Stack, { direction: "row", columnGap: 8, children: [_jsx(Popover, { ...args, children: _jsx("div", { style: {
20
29
  background: 'var(--global-vibrancy-background)', backdropFilter: 'blur(10px)', border: '2px solid black', padding: 24,
21
30
  }, children: "Lorem." }) }), _jsx(Popover, { ...args, children: _jsx("div", { style: {
22
31
  background: 'var(--global-vibrancy-background)', backdropFilter: 'blur(10px)', border: '2px solid black', padding: 24,
@@ -38,7 +47,11 @@ WithField.args = {
38
47
  const ControlledTemplate = (args) => {
39
48
  const [isOpen, setIsOpen] = useState(false);
40
49
  return (_jsx(Popover, { ...args, trigger: (_jsx(Button, { onClick: () => setIsOpen(val => !val), children: `${isOpen ? 'Close' : 'Open'} Popover` })), onOpenChange: state => setIsOpen(state), open: isOpen, children: _jsxs("div", { style: {
41
- background: 'var(--global-vibrancy-background)', backdropFilter: 'blur(10px)', border: '2px solid black', padding: 24,
50
+ background: 'var(--global-vibrancy-background)',
51
+ backdropFilter: 'blur(10px)',
52
+ border: '2px solid black',
53
+ padding: 24,
54
+ maxWidth: '300px',
42
55
  }, 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" })] }) }));
43
56
  };
44
57
  export const Controlled = ControlledTemplate.bind({});
@@ -2,6 +2,8 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
2
2
  import { Tooltip } from './tooltip';
3
3
  declare const story: ComponentMeta<typeof Tooltip>;
4
4
  export default story;
5
- export declare const Default: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
5
+ export declare const Interactive: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
6
+ export declare const NonInteractive: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
7
+ export declare const Open: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
6
8
  export declare const WithButtons: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
7
9
  //# sourceMappingURL=tooltip.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,OAAO,CAOxC,CAAC;AAEF,eAAe,KAAK,CAAC;AAmBrB,eAAO,MAAM,OAAO,mEAAoB,CAAC;AAKzC,eAAO,MAAM,WAAW,mEAAoB,CAAC"}
1
+ {"version":3,"file":"tooltip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,OAAO,CAiBxC,CAAC;AAEF,eAAe,KAAK,CAAC;AAoCrB,eAAO,MAAM,WAAW,mEAAoB,CAAC;AAK7C,eAAO,MAAM,cAAc,mEAAqB,CAAC;AAMjD,eAAO,MAAM,IAAI,mEAAoB,CAAC;AAMtC,eAAO,MAAM,WAAW,mEAAoB,CAAC"}
@@ -1,19 +1,47 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button, Text } from '../..';
2
+ import { Button, Symbol, Text } from '../..';
3
3
  import { Tooltip } from './tooltip';
4
4
  const story = {
5
5
  title: 'Dialogs/Tooltip',
6
6
  component: Tooltip,
7
7
  args: {
8
- trigger: _jsx(Text, { as: "span", children: "HTML" }),
9
8
  interactive: true,
9
+ placement: 'auto',
10
+ delay: 500,
11
+ maxWidth: '40ch',
12
+ fill: false,
13
+ trigger: _jsx(Text, { as: "span", style: { margin: '1rem' }, children: "HTML" }),
14
+ },
15
+ argTypes: {
16
+ placement: {
17
+ options: ['auto', 'auto-start', 'auto-end', 'top', 'bottom', 'right', 'left', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'right-start', 'right-end', 'left-start', 'left-end'],
18
+ control: { type: 'select' },
19
+ },
10
20
  },
11
21
  };
12
22
  export default story;
13
- const Template = args => (_jsxs(_Fragment, { children: [_jsxs(Tooltip, { ...args, children: [_jsx("button", { type: "button", children: "test" }), "HTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup Language", _jsx("button", { type: "button", children: "test" })] }), _jsxs(Tooltip, { ...args, children: [_jsx("button", { type: "button", children: "test" }), "HTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup Language", _jsx("button", { type: "button", children: "test" })] })] }));
14
- export const Default = Template.bind({});
15
- Default.args = {
23
+ const Template = args => (_jsx(_Fragment, { children: _jsxs(Tooltip, { ...args, children: [_jsx("p", { children: "Lorem ipsum dolor sit, amet consectetur adipisicing elit. Totam, ullam. Totam veniam dignissimos ducimus illo ipsa tempora corrupti enim quidem, ad odit molestias deleniti in." }), _jsxs("div", { style: {
24
+ display: 'flex',
25
+ flexDirection: 'row',
26
+ justifyContent: 'flex-end',
27
+ alignItems: 'flex-end',
28
+ gap: '0.5rem',
29
+ marginTop: '0.5rem',
30
+ }, children: [_jsx("button", { type: "button", onClick: () => console.debug('Reset!'), children: "Reset" }), _jsx("button", { type: "button", onClick: () => console.debug('Confirm!'), children: "Confirm" })] })] }) }));
31
+ const Template2 = args => (_jsx(_Fragment, { children: _jsx(Tooltip, { ...args, children: _jsx("p", { children: "Lorem ipsum dolor sit, amet consectetur adipisicing elit. Totam, ullam. Totam veniam dignissimos ducimus illo ipsa tempora corrupti enim quidem, ad odit molestias deleniti in." }) }) }));
32
+ export const Interactive = Template.bind({});
33
+ Interactive.args = {
34
+ interactive: true,
35
+ };
36
+ export const NonInteractive = Template2.bind({});
37
+ NonInteractive.args = {
38
+ trigger: _jsx(Symbol, { source: "bell", "aria-hidden": "false", style: { marginLeft: '1rem' } }),
39
+ interactive: false,
40
+ };
41
+ export const Open = Template.bind({});
42
+ Open.args = {
16
43
  interactive: true,
44
+ open: true,
17
45
  };
18
46
  export const WithButtons = Template.bind({});
19
47
  WithButtons.args = {
@@ -1 +1 @@
1
- {"version":3,"file":"usePopupWrapper.d.ts","sourceRoot":"","sources":["../../src/hooks/usePopupWrapper.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe,OAAQ,MAAM;;CA8BzC,CAAC"}
1
+ {"version":3,"file":"usePopupWrapper.d.ts","sourceRoot":"","sources":["../../src/hooks/usePopupWrapper.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe,OAAQ,MAAM;;CAgCzC,CAAC"}
@@ -21,6 +21,8 @@ export const usePopUpWrapper = (id) => {
21
21
  if (!w) {
22
22
  w = document.createElement('div');
23
23
  w.setAttribute('id', id);
24
+ w.style.position = 'relative';
25
+ w.style.zIndex = '999';
24
26
  document.body.appendChild(w);
25
27
  }
26
28
  setWrapper(w);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
- "version": "10.19.0",
3
+ "version": "10.20.0",
4
4
  "description": "UI components from Wonderflow's Wanda design system",
5
5
  "author": "Wonderflow",
6
6
  "license": "Apache-2.0",
@@ -81,8 +81,8 @@
81
81
  "@types/react": "17.0.43",
82
82
  "@types/react-dom": "17.0.14",
83
83
  "@types/react-table": "7.7.12",
84
- "@wonderflow/config": "10.19.0",
85
- "@wonderflow/tokens": "10.19.0",
84
+ "@wonderflow/config": "10.20.0",
85
+ "@wonderflow/tokens": "10.20.0",
86
86
  "babel-loader": "8.2.5",
87
87
  "cpy-cli": "3.1.1",
88
88
  "postcss": "8.4.17",