@q2devel/q2-storybook 1.0.61 → 1.0.63

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,8 +1,10 @@
1
1
  import { ReactNode } from 'react';
2
2
  interface ModalProps {
3
- title: ReactNode;
3
+ title?: ReactNode;
4
4
  description: ReactNode;
5
+ descriptionClassName?: string;
5
6
  buttonText?: ReactNode;
7
+ showIcon?: boolean;
6
8
  icon?: ReactNode;
7
9
  iconBackgroundColor?: string;
8
10
  iconColor?: string;
@@ -14,8 +16,6 @@ interface ModalProps {
14
16
  showCloseButton?: boolean;
15
17
  closeButtonClassName?: string;
16
18
  className?: string;
17
- showIcon?: boolean;
18
- descriptionClassName?: string;
19
19
  }
20
- export declare const Modal: ({ title, description, buttonText, icon, iconBackgroundColor, iconColor, buttonClassName, panelClassName, backdropClassName, onClose, isOpen, showCloseButton, closeButtonClassName, className, showIcon, descriptionClassName, }: ModalProps) => import("react/jsx-runtime").JSX.Element;
20
+ export declare const Modal: ({ title, description, descriptionClassName, buttonText, showIcon, icon, iconBackgroundColor, iconColor, buttonClassName, panelClassName, backdropClassName, onClose, isOpen, showCloseButton, closeButtonClassName, className, }: ModalProps) => import("react/jsx-runtime").JSX.Element;
21
21
  export default Modal;
@@ -3,10 +3,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Dialog, DialogBackdrop, DialogPanel, DialogTitle } from '@headlessui/react';
4
4
  import { CheckIcon, XMarkIcon } from '@heroicons/react/24/outline';
5
5
  import { buildClassesByJoining } from '../../../utils/StyleHelper';
6
- export const Modal = ({ title, description, buttonText, icon = _jsx(CheckIcon, { "aria-hidden": "true", className: "size-6" }), iconBackgroundColor = 'bg-green-100', iconColor = 'text-green-600', buttonClassName, panelClassName, backdropClassName, onClose, isOpen, showCloseButton = false, closeButtonClassName, className, showIcon = true, descriptionClassName, }) => {
6
+ export const Modal = ({ title, description, descriptionClassName, buttonText, showIcon = true, icon = _jsx(CheckIcon, { "aria-hidden": "true", className: "size-6" }), iconBackgroundColor = 'bg-green-100', iconColor = 'text-green-600', buttonClassName, panelClassName, backdropClassName, onClose, isOpen, showCloseButton = false, closeButtonClassName, className, }) => {
7
7
  const handleClose = (value) => {
8
8
  onClose?.();
9
9
  };
10
- return (_jsxs(Dialog, { open: isOpen, onClose: handleClose, className: buildClassesByJoining('relative z-10', className), children: [_jsx(DialogBackdrop, { transition: true, className: buildClassesByJoining('fixed inset-0 bg-gray-500/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in', backdropClassName) }), _jsx("div", { className: "fixed inset-0 z-10 w-screen overflow-y-auto", children: _jsx("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: _jsxs(DialogPanel, { transition: true, className: buildClassesByJoining('relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-sm sm:p-6 data-closed:sm:translate-y-0 data-closed:sm:scale-95', panelClassName), children: [showCloseButton && (_jsxs("button", { type: "button", className: buildClassesByJoining('absolute top-4 right-4 text-gray-400 hover:text-gray-500 focus:outline-none', closeButtonClassName), onClick: () => onClose?.(), children: [_jsx("span", { className: "sr-only", children: "Close" }), _jsx(XMarkIcon, { className: "h-6 w-6", "aria-hidden": "true" })] })), _jsxs("div", { children: [showIcon && (_jsx("div", { className: buildClassesByJoining('mx-auto flex size-12 items-center justify-center rounded-full', iconBackgroundColor), children: _jsx("div", { className: iconColor, children: icon }) })), _jsxs("div", { className: "mt-3 text-center sm:mt-5", children: [_jsx(DialogTitle, { as: "h3", className: "text-base font-semibold text-gray-900", children: title }), _jsx("div", { className: buildClassesByJoining("mt-2", descriptionClassName), children: _jsx("p", { className: "text-sm text-gray-500", children: description }) })] })] }), buttonText && (_jsx("div", { className: "mt-5 sm:mt-6", children: _jsx("button", { type: "button", onClick: () => onClose?.(), className: buildClassesByJoining('inline-flex w-full justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-green-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600', buttonClassName), children: buttonText }) }))] }) }) })] }));
10
+ return (_jsxs(Dialog, { open: isOpen, onClose: handleClose, className: buildClassesByJoining('relative z-10', className), children: [_jsx(DialogBackdrop, { transition: true, className: buildClassesByJoining('fixed inset-0 bg-gray-500/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in', backdropClassName) }), _jsx("div", { className: "fixed inset-0 z-10 w-screen overflow-y-auto", children: _jsx("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: _jsxs(DialogPanel, { transition: true, className: buildClassesByJoining('relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-sm sm:p-6 data-closed:sm:translate-y-0 data-closed:sm:scale-95', panelClassName), children: [showCloseButton && (_jsxs("button", { type: "button", className: buildClassesByJoining('absolute top-4 right-4 text-gray-400 hover:text-gray-500 focus:outline-none', closeButtonClassName), onClick: () => onClose?.(), children: [_jsx("span", { className: "sr-only", children: "Close" }), _jsx(XMarkIcon, { className: "h-6 w-6", "aria-hidden": "true" })] })), _jsxs("div", { children: [showIcon && (_jsx("div", { className: buildClassesByJoining('mx-auto flex size-12 items-center justify-center rounded-full', iconBackgroundColor), children: _jsx("div", { className: iconColor, children: icon }) })), _jsxs("div", { className: "mt-3 text-center sm:mt-5", children: [title && (_jsx(DialogTitle, { as: "h3", className: "text-base font-semibold text-gray-900", children: title })), _jsx("div", { className: buildClassesByJoining('mt-2', descriptionClassName), children: description })] })] }), buttonText && (_jsx("div", { className: "mt-5 sm:mt-6", children: _jsx("button", { type: "button", onClick: () => onClose?.(), className: buildClassesByJoining('inline-flex w-full justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-green-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600', buttonClassName), children: buttonText }) }))] }) }) })] }));
11
11
  };
12
12
  export default Modal;
@@ -45,7 +45,10 @@ function CategoryNode({ term, allTerms, level, activeTerm, parentIds, onTermClic
45
45
  if (hasChildren)
46
46
  setIsOpen((prev) => !prev);
47
47
  onTermClick?.(term);
48
- }, children: [_jsx(Button, { asLink: true, unstyled: true, href: term.href, className: "flex-1", children: term.name }), hasChildren && (_jsxs("span", { className: "ml-2 flex items-center", children: [_jsx(PlusIcon, { className: `w-5 h-5 text-gray-400 ${isOpen ? 'hidden' : 'block'}` }), _jsx(MinusIcon, { className: `w-5 h-5 text-gray-400 ${isOpen ? 'block' : 'hidden'}` })] }))] }), hasChildren && isOpen && (_jsx("div", { className: "mt-1 space-y-0.5", children: children.map((child) => (_jsx(CategoryNode, { term: child, allTerms: allTerms, level: level + 1, activeTerm: activeTerm, parentIds: parentIds, onTermClick: onTermClick, colorClassName: colorClassName }, child.id))) }))] }));
48
+ }, children: [_jsx(Button, { unstyled: true, className: "flex-1", onClick: (e) => {
49
+ e.stopPropagation();
50
+ onTermClick?.(term);
51
+ }, children: term.name }), hasChildren && (_jsxs("span", { className: "ml-2 flex items-center", children: [_jsx(PlusIcon, { className: `w-5 h-5 text-gray-400 ${isOpen ? 'hidden' : 'block'}` }), _jsx(MinusIcon, { className: `w-5 h-5 text-gray-400 ${isOpen ? 'block' : 'hidden'}` })] }))] }), hasChildren && isOpen && (_jsx("div", { className: "mt-1 space-y-0.5", children: children.map((child) => (_jsx(CategoryNode, { term: child, allTerms: allTerms, level: level + 1, activeTerm: activeTerm, parentIds: parentIds, onTermClick: onTermClick, colorClassName: colorClassName }, child.id))) }))] }));
49
52
  }
50
53
  export default function CategoryTree({ terms, activeTerm, labels, onTermClick, colorClassName, }) {
51
54
  const parentIds = findParentTerm(activeTerm, terms).map((term) => term.id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@q2devel/q2-storybook",
3
- "version": "1.0.61",
3
+ "version": "1.0.63",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",