@frontify/fondue-components 19.2.0 → 19.3.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/fondue-components.js +10 -8
- package/dist/fondue-components.js.map +1 -1
- package/dist/fondue-components10.js +3 -3
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +3 -3
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components13.js +3 -3
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +2 -2
- package/dist/fondue-components14.js.map +1 -1
- package/dist/fondue-components15.js +2 -2
- package/dist/fondue-components15.js.map +1 -1
- package/dist/fondue-components16.js +1 -1
- package/dist/fondue-components16.js.map +1 -1
- package/dist/fondue-components17.js +1 -1
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +1 -1
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components19.js +1 -1
- package/dist/fondue-components19.js.map +1 -1
- package/dist/fondue-components20.js +2 -2
- package/dist/fondue-components20.js.map +1 -1
- package/dist/fondue-components21.js +2 -2
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components22.js +8 -8
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components23.js +1 -1
- package/dist/fondue-components23.js.map +1 -1
- package/dist/fondue-components24.js +2 -2
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +63 -62
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +77 -70
- package/dist/fondue-components26.js.map +1 -1
- package/dist/fondue-components27.js +2 -2
- package/dist/fondue-components27.js.map +1 -1
- package/dist/fondue-components28.js +3 -12
- package/dist/fondue-components28.js.map +1 -1
- package/dist/fondue-components29.js +101 -10
- package/dist/fondue-components29.js.map +1 -1
- package/dist/fondue-components3.js +93 -73
- package/dist/fondue-components3.js.map +1 -1
- package/dist/fondue-components30.js +12 -55
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +55 -14
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +20 -7
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components33.js +7 -6
- package/dist/fondue-components33.js.map +1 -1
- package/dist/fondue-components34.js +7 -32
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +32 -5
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +5 -12
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +10 -153
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +59 -22
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +17 -17
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +33 -32
- package/dist/fondue-components4.js.map +1 -1
- package/dist/fondue-components40.js +112 -15
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +19 -30
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +32 -62
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +53 -121
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +129 -20
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +21 -45
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +45 -8
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +8 -13
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +13 -15
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +14 -4
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components5.js.map +1 -1
- package/dist/fondue-components50.js +5 -60
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +59 -17
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +18 -19
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +18 -4
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +3 -13
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +13 -3
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +3 -17
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +19 -35
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +35 -5
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +4 -12
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +4 -4
- package/dist/fondue-components6.js.map +1 -1
- package/dist/fondue-components60.js +12 -4
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +4 -24
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +24 -16
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +16 -150
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +151 -19
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +19 -77
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +77 -8
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +8 -35
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +34 -70
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +70 -10
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +36 -30
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components70.js +8 -10
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +12 -12
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +12 -20
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +21 -29
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +33 -55
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +55 -14
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +14 -25
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +24 -13
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +14 -6
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +21 -5
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components8.js.map +1 -1
- package/dist/fondue-components80.js +6 -4
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +6 -4
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +5 -2
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +4 -16
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +2 -40
- package/dist/fondue-components84.js.map +1 -1
- package/dist/fondue-components85.js +43 -0
- package/dist/fondue-components85.js.map +1 -0
- package/dist/fondue-components86.js +20 -0
- package/dist/fondue-components86.js.map +1 -0
- package/dist/fondue-components9.js +37 -32
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +125 -50
- package/dist/style.css +1 -1
- package/package.json +60 -60
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components9.js","sources":["../src/components/Dialog/Dialog.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport * as RadixDialog from '@radix-ui/react-dialog';\nimport {\n createContext,\n forwardRef,\n useContext,\n useRef,\n type CSSProperties,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/dialog.module.scss';\n\nexport type DialogRootProps = {\n /**\n * Disable interaction with the rest of the page\n * @default false\n */\n modal?: boolean;\n /**\n * The controlled `open` state of the dialog\n * @default false\n */\n open?: boolean;\n /**\n * Event handler called when the `open` state changes\n */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\nexport type DialogContentProps = {\n /**\n * Add rounded corners to the dialog\n * @default true\n */\n rounded?: boolean;\n /**\n * Define the padding of the dialog\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * The vertical alignment of the divider\n * @default \"center\"\n */\n verticalAlign?: 'top' | 'center';\n\n /**\n * Define a maximum width for the dialog\n * @default \"800px\"\n */\n maxWidth?: string;\n /**\n * Define a minimum width for the dialog\n * @default \"400px\"\n */\n minWidth?: string;\n /**\n * Define a minimum height for the dialog\n * @default \"200px\"\n */\n minHeight?: string;\n /**\n * Show a dark underlay behind the dialog\n * @default false\n */\n showUnderlay?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default true\n */\n asChild?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogHeaderProps = {\n /**\n * Define the padding for the dialog header\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the bottom of the header\n * @default true\n */\n showBorder?: boolean;\n /**\n * Show a close button in the header\n * @default true\n */\n showCloseButton?: boolean;\n closeProps?: CommonAriaProps;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogFooterProps = {\n /**\n * Define the padding for the dialog footer\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the top of the footer\n * @default true\n */\n showBorder?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogBodyProps = {\n /**\n * Define the padding for the dialog body\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogSideContentProps = { children?: ReactNode; 'data-test-id'?: string };\n\nexport type DialogCloseProps = { children?: ReactNode };\n\nexport type DialogAnnouncementProps = { children?: ReactNode; asChild?: boolean };\n\ntype DialogContextType = {\n isModal: boolean;\n};\n\nconst DialogContext = createContext<DialogContextType>({ isModal: false });\n\nexport const DialogRoot = ({ children, ...props }: DialogRootProps) => {\n return (\n <DialogContext.Provider value={{ isModal: props.modal ?? false }}>\n <RadixDialog.Root {...props}>{children}</RadixDialog.Root>\n </DialogContext.Provider>\n );\n};\nDialogRoot.displayName = 'Dialog.Root';\n\nexport const DialogTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-dialog-trigger', ...props }: DialogTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDialog.Trigger\n onMouseDown={addAutoFocusAttribute}\n data-auto-focus-visible=\"true\"\n data-auto-focus-trigger\n data-test-id={dataTestId}\n asChild={asChild}\n ref={ref}\n {...props}\n >\n {children}\n </RadixDialog.Trigger>\n );\n};\nDialogTrigger.displayName = 'Dialog.Trigger';\n\nconst DialogUnderlay = ({ children, showUnderlay }: { children: ReactNode; showUnderlay: boolean }) => {\n const { isModal } = useContext(DialogContext);\n if (isModal) {\n return (\n <RadixDialog.Overlay data-visible={showUnderlay} className={styles.underlay}>\n {children}\n </RadixDialog.Overlay>\n );\n }\n return (\n <div className={styles.underlay} data-visible={showUnderlay}>\n {children}\n </div>\n );\n};\n\nexport const DialogContent = (\n {\n maxWidth = '800px',\n minWidth = '400px',\n minHeight = '200px',\n padding = 'compact',\n verticalAlign = 'center',\n 'data-test-id': dataTestId = 'fondue-dialog-content',\n showUnderlay = false,\n rounded = true,\n children,\n ...props\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const theme = useFondueTheme();\n const contentRef = useRef<HTMLDivElement>(null);\n\n useSyncRefs<HTMLDivElement>(contentRef, ref);\n\n const handleOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n\n const dialogBody = contentRef.current?.querySelector('[data-dialog-layout-component=\"body\"]');\n\n const firstFocusable = dialogBody?.querySelector(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (firstFocusable instanceof HTMLElement) {\n firstFocusable.focus();\n }\n };\n\n return (\n <RadixDialog.Portal>\n <ThemeProvider theme={theme}>\n <DialogUnderlay showUnderlay={showUnderlay}>\n <RadixDialog.Content\n style={\n {\n '--dialog-max-width': maxWidth,\n '--dialog-min-width': minWidth,\n '--dialog-min-height': minHeight,\n } as CSSProperties\n }\n ref={contentRef}\n className={styles.content}\n onFocus={addShowFocusRing}\n onOpenAutoFocus={handleOpenAutoFocus}\n data-dialog-padding={padding}\n data-dialog-rounded={rounded}\n data-test-id={dataTestId}\n data-dialog-vertical-align={verticalAlign}\n {...props}\n >\n {children}\n </RadixDialog.Content>\n </DialogUnderlay>\n </ThemeProvider>\n </RadixDialog.Portal>\n );\n};\nDialogContent.displayName = 'Dialog.Content';\n\nexport const DialogHeader = (\n {\n padding,\n showBorder = true,\n showCloseButton = true,\n closeProps,\n children,\n 'data-test-id': dataTestId = 'fondue-dialog-header',\n }: DialogHeaderProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.header}\n data-dialog-header-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"header\"\n >\n <div>{children}</div>\n {showCloseButton && (\n <RadixDialog.Close\n role=\"button\"\n data-test-id={`${dataTestId}-close`}\n className=\"tw-cursor-pointer\"\n aria-label=\"Close\"\n {...closeProps}\n >\n <IconCross size={20} />\n </RadixDialog.Close>\n )}\n </div>\n );\n};\nDialogHeader.displayName = 'Dialog.Header';\n\nexport const DialogFooter = (\n { padding, showBorder = true, children, 'data-test-id': dataTestId = 'fondue-dialog-footer' }: DialogFooterProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.footer}\n data-dialog-footer-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"footer\"\n >\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'Dialog.Footer';\n\nexport const DialogBody = (\n { padding, children, 'data-test-id': dataTestId = 'fondue-dialog-body' }: DialogBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.body}\n data-dialog-body-padding={padding}\n data-dialog-layout-component=\"body\"\n >\n {children}\n </div>\n );\n};\nDialogBody.displayName = 'Dialog.Body';\n\nexport const DialogSideContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dialog-side-content' }: DialogSideContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.sideContent} data-dialog-layout-component>\n {children}\n </div>\n );\n};\nDialogSideContent.displayName = 'Dialog.SideContent';\n\nexport const DialogClose = ({ children }: DialogCloseProps) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>;\n};\nDialogClose.displayName = 'Dialog.Close';\n\nexport const DialogTitle = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Title asChild={asChild}>{children}</RadixDialog.Title>;\n};\nDialogTitle.displayName = 'Dialog.Title';\n\nexport const DialogDescription = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Description asChild={asChild}>{children}</RadixDialog.Description>;\n};\nDialogDescription.displayName = 'Dialog.Description';\n\nexport const Dialog = {\n Root: DialogRoot,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n Trigger: forwardRef<HTMLButtonElement, DialogTriggerProps>(DialogTrigger),\n Content: forwardRef<HTMLDivElement, DialogContentProps>(DialogContent),\n Header: forwardRef<HTMLDivElement, DialogHeaderProps>(DialogHeader),\n Footer: forwardRef<HTMLDivElement, DialogFooterProps>(DialogFooter),\n Body: forwardRef<HTMLDivElement, DialogBodyProps>(DialogBody),\n SideContent: forwardRef<HTMLDivElement, DialogSideContentProps>(DialogSideContent),\n};\n"],"names":["DialogContext","createContext","DialogRoot","children","props","RadixDialog","DialogTrigger","asChild","dataTestId","ref","jsx","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","theme","useFondueTheme","contentRef","useRef","useSyncRefs","handleOpenAutoFocus","event","dialogBody","_a","firstFocusable","ThemeProvider","addShowFocusRing","DialogHeader","showBorder","showCloseButton","closeProps","jsxs","IconCross","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;;;AAgJA,MAAMA,IAAgBC,EAAiC,EAAE,SAAS,IAAO,GAE5DC,IAAa,CAAC,EAAE,UAAAC,GAAU,GAAGC,0BAEjCJ,EAAc,UAAd,EAAuB,OAAO,EAAE,SAASI,EAAM,SAAS,GAAM,GAC3D,4BAACC,EAAY,MAAZ,EAAkB,GAAGD,GAAQ,UAAAD,EAAS,CAAA,GAC3C;AAGRD,EAAW,cAAc;AAElB,MAAMI,IAAgB,CACzB,EAAE,SAAAC,IAAU,IAAM,UAAAJ,GAAU,gBAAgBK,IAAa,yBAAyB,GAAGJ,EAAM,GAC3FK,MAGI,gBAAAC;AAAA,EAACL,EAAY;AAAA,EAAZ;AAAA,IACG,aAAaM;AAAA,IACb,2BAAwB;AAAA,IACxB,2BAAuB;AAAA,IACvB,gBAAcH;AAAA,IACd,SAAAD;AAAA,IACA,KAAAE;AAAA,IACC,GAAGL;AAAA,IAEH,UAAAD;AAAA,EAAA;AACL;AAGRG,EAAc,cAAc;AAE5B,MAAMM,IAAiB,CAAC,EAAE,UAAAT,GAAU,cAAAU,QAAmE;AACnG,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAWf,CAAa;AAC5C,SAAIc,IAEI,gBAAAJ,EAACL,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AAAA,IACG,gBAAcF;AAAA,IACd,KAAAC;AAAA,IACA,WAAWO,EAAO;AAAA,IAClB,4BAA0BK;AAAA,IAC1B,gCAA6B;AAAA,IAE5B,UAAAlB;AAAA,EAAA;AACL;AAGRwC,EAAW,cAAc;AAEZ,MAAAC,IAAoB,CAC7B,EAAE,UAAAzC,GAAU,gBAAgBK,IAAa,gCACzCC,MAGI,gBAAAC,EAAC,OAAI,EAAA,gBAAcF,GAAY,KAAAC,GAAU,WAAWO,EAAO,aAAa,gCAA4B,IAC/F,UAAAb,EACL,CAAA;AAGRyC,EAAkB,cAAc;AAEzB,MAAMC,IAAc,CAAC,EAAE,UAAA1C,0BAClBE,EAAY,OAAZ,EAAkB,SAAO,IAAE,UAAAF,GAAS;AAEhD0C,EAAY,cAAc;AAEnB,MAAMC,IAAc,CAAC,EAAE,UAAA3C,GAAU,SAAAI,QAC5B,gBAAAG,EAAAL,EAAY,OAAZ,EAAkB,SAAAE,GAAmB,UAAAJ,EAAS,CAAA;AAE1D2C,EAAY,cAAc;AAEnB,MAAMC,IAAoB,CAAC,EAAE,UAAA5C,GAAU,SAAAI,QAClC,gBAAAG,EAAAL,EAAY,aAAZ,EAAwB,SAAAE,GAAmB,UAAAJ,EAAS,CAAA;AAEhE4C,EAAkB,cAAc;AAEzB,MAAMC,IAAS;AAAA,EAClB,MAAM9C;AAAA,EACN,OAAO4C;AAAA,EACP,aAAaC;AAAA,EACb,OAAOF;AAAA,EACP,SAASI,EAAkD3C,CAAa;AAAA,EACxE,SAAS2C,EAA+ChC,CAAa;AAAA,EACrE,QAAQgC,EAA8Cb,CAAY;AAAA,EAClE,QAAQa,EAA8CP,CAAY;AAAA,EAClE,MAAMO,EAA4CN,CAAU;AAAA,EAC5D,aAAaM,EAAmDL,CAAiB;AACrF;"}
|
|
1
|
+
{"version":3,"file":"fondue-components9.js","sources":["../src/components/Dialog/Dialog.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport * as RadixDialog from '@radix-ui/react-dialog';\nimport {\n createContext,\n forwardRef,\n useContext,\n useMemo,\n useRef,\n type CSSProperties,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/dialog.module.scss';\n\nexport type DialogRootProps = {\n /**\n * Disable interaction with the rest of the page\n * @default false\n */\n modal?: boolean;\n /**\n * The controlled `open` state of the dialog\n * @default false\n */\n open?: boolean;\n /**\n * Event handler called when the `open` state changes\n */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\nexport type DialogContentProps = {\n /**\n * Add rounded corners to the dialog\n * @default true\n */\n rounded?: boolean;\n /**\n * Define the padding of the dialog\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * The vertical alignment of the divider\n * @default \"center\"\n */\n verticalAlign?: 'top' | 'center';\n\n /**\n * Define a maximum width for the dialog\n * @default \"800px\"\n */\n maxWidth?: string;\n /**\n * Define a minimum width for the dialog\n * @default \"400px\"\n */\n minWidth?: string;\n /**\n * Define a minimum height for the dialog\n * @default \"200px\"\n */\n minHeight?: string;\n /**\n * Show a dark underlay behind the dialog\n * @default false\n */\n showUnderlay?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default true\n */\n asChild?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogHeaderProps = {\n /**\n * Define the padding for the dialog header\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the bottom of the header\n * @default true\n */\n showBorder?: boolean;\n /**\n * Show a close button in the header\n * @default true\n */\n showCloseButton?: boolean;\n closeProps?: CommonAriaProps;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogFooterProps = {\n /**\n * Define the padding for the dialog footer\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the top of the footer\n * @default true\n */\n showBorder?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogBodyProps = {\n /**\n * Define the padding for the dialog body\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogSideContentProps = { children?: ReactNode; 'data-test-id'?: string };\n\nexport type DialogCloseProps = { children?: ReactNode };\n\nexport type DialogAnnouncementProps = { children?: ReactNode; asChild?: boolean };\n\ntype DialogContextType = {\n isModal: boolean;\n};\n\nconst DialogContext = createContext<DialogContextType>({ isModal: false });\nDialogContext.displayName = 'DialogContext';\n\nexport const DialogRoot = ({ children, ...props }: DialogRootProps) => {\n const value = useMemo(() => ({ isModal: props.modal ?? false }), [props.modal]);\n return (\n <DialogContext.Provider value={value}>\n <RadixDialog.Root {...props}>{children}</RadixDialog.Root>\n </DialogContext.Provider>\n );\n};\nDialogRoot.displayName = 'Dialog.Root';\n\nexport const DialogTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-dialog-trigger', ...props }: DialogTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDialog.Trigger\n onMouseDown={addAutoFocusAttribute}\n data-auto-focus-visible=\"true\"\n data-auto-focus-trigger\n data-test-id={dataTestId}\n asChild={asChild}\n ref={ref}\n {...props}\n >\n {children}\n </RadixDialog.Trigger>\n );\n};\nDialogTrigger.displayName = 'Dialog.Trigger';\n\nconst DialogUnderlay = ({ children, showUnderlay }: { children: ReactNode; showUnderlay: boolean }) => {\n const { isModal } = useContext(DialogContext);\n if (isModal) {\n return (\n <RadixDialog.Overlay data-visible={showUnderlay} className={styles.underlay}>\n {children}\n </RadixDialog.Overlay>\n );\n }\n return (\n <div className={styles.underlay} data-visible={showUnderlay}>\n {children}\n </div>\n );\n};\n\nexport const DialogContent = (\n {\n maxWidth = '800px',\n minWidth = '400px',\n minHeight = '200px',\n padding = 'compact',\n verticalAlign = 'center',\n 'data-test-id': dataTestId = 'fondue-dialog-content',\n showUnderlay = false,\n rounded = true,\n children,\n ...props\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const theme = useFondueTheme();\n const contentRef = useRef<HTMLDivElement>(null);\n\n useSyncRefs<HTMLDivElement>(contentRef, ref);\n\n const handleOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n\n const dialogBody = contentRef.current?.querySelector('[data-dialog-layout-component=\"body\"]');\n\n const firstFocusable = dialogBody?.querySelector(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (firstFocusable instanceof HTMLElement) {\n firstFocusable.focus();\n }\n };\n\n return (\n <RadixDialog.Portal>\n <ThemeProvider theme={theme}>\n <DialogUnderlay showUnderlay={showUnderlay}>\n <RadixDialog.Content\n style={\n {\n '--dialog-max-width': maxWidth,\n '--dialog-min-width': minWidth,\n '--dialog-min-height': minHeight,\n } as CSSProperties\n }\n ref={contentRef}\n className={styles.content}\n onFocus={addShowFocusRing}\n onOpenAutoFocus={handleOpenAutoFocus}\n data-dialog-padding={padding}\n data-dialog-rounded={rounded}\n data-test-id={dataTestId}\n data-dialog-vertical-align={verticalAlign}\n {...props}\n >\n {children}\n </RadixDialog.Content>\n </DialogUnderlay>\n </ThemeProvider>\n </RadixDialog.Portal>\n );\n};\nDialogContent.displayName = 'Dialog.Content';\n\nexport const DialogHeader = (\n {\n padding,\n showBorder = true,\n showCloseButton = true,\n closeProps,\n children,\n 'data-test-id': dataTestId = 'fondue-dialog-header',\n }: DialogHeaderProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.header}\n data-dialog-header-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"header\"\n >\n <div>{children}</div>\n {showCloseButton && (\n <RadixDialog.Close\n role=\"button\"\n data-test-id={`${dataTestId}-close`}\n className=\"tw-cursor-pointer\"\n aria-label=\"Close\"\n {...closeProps}\n >\n <IconCross size={20} />\n </RadixDialog.Close>\n )}\n </div>\n );\n};\nDialogHeader.displayName = 'Dialog.Header';\n\nexport const DialogFooter = (\n { padding, showBorder = true, children, 'data-test-id': dataTestId = 'fondue-dialog-footer' }: DialogFooterProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.footer}\n data-dialog-footer-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"footer\"\n >\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'Dialog.Footer';\n\nexport const DialogBody = (\n { padding, children, 'data-test-id': dataTestId = 'fondue-dialog-body' }: DialogBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.body}\n data-dialog-body-padding={padding}\n data-dialog-layout-component=\"body\"\n >\n {children}\n </div>\n );\n};\nDialogBody.displayName = 'Dialog.Body';\n\nexport const DialogSideContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dialog-side-content' }: DialogSideContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.sideContent} data-dialog-layout-component>\n {children}\n </div>\n );\n};\nDialogSideContent.displayName = 'Dialog.SideContent';\n\nexport const DialogClose = ({ children }: DialogCloseProps) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>;\n};\nDialogClose.displayName = 'Dialog.Close';\n\nexport const DialogTitle = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Title asChild={asChild}>{children}</RadixDialog.Title>;\n};\nDialogTitle.displayName = 'Dialog.Title';\n\nexport const DialogDescription = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Description asChild={asChild}>{children}</RadixDialog.Description>;\n};\nDialogDescription.displayName = 'Dialog.Description';\n\nexport const Dialog = {\n Root: DialogRoot,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n Trigger: forwardRef<HTMLButtonElement, DialogTriggerProps>(DialogTrigger),\n Content: forwardRef<HTMLDivElement, DialogContentProps>(DialogContent),\n Header: forwardRef<HTMLDivElement, DialogHeaderProps>(DialogHeader),\n Footer: forwardRef<HTMLDivElement, DialogFooterProps>(DialogFooter),\n Body: forwardRef<HTMLDivElement, DialogBodyProps>(DialogBody),\n SideContent: forwardRef<HTMLDivElement, DialogSideContentProps>(DialogSideContent),\n};\n"],"names":["DialogContext","createContext","DialogRoot","children","props","value","useMemo","jsx","RadixDialog","DialogTrigger","asChild","dataTestId","ref","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","theme","useFondueTheme","contentRef","useRef","useSyncRefs","handleOpenAutoFocus","event","dialogBody","_a","firstFocusable","ThemeProvider","addShowFocusRing","DialogHeader","showBorder","showCloseButton","closeProps","jsxs","IconCross","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;;;AAiJA,MAAMA,IAAgBC,EAAiC,EAAE,SAAS,IAAO;AACzED,EAAc,cAAc;AAErB,MAAME,IAAa,CAAC,EAAE,UAAAC,GAAU,GAAGC,QAA6B;AACnE,QAAMC,IAAQC,EAAQ,OAAO,EAAE,SAASF,EAAM,SAAS,OAAU,CAACA,EAAM,KAAK,CAAC;AAC9E,SACI,gBAAAG,EAACP,EAAc,UAAd,EAAuB,OAAAK,GACpB,UAAA,gBAAAE,EAACC,EAAY,MAAZ,EAAkB,GAAGJ,GAAQ,UAAAD,EAAA,CAAS,EAAA,CAC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gBAAAH,EAACC,EAAY,aAAZ,EAAwB,SAAAE,GAAmB,UAAAP,EAAA,CAAS;AAEhE8C,EAAkB,cAAc;AAEzB,MAAMC,IAAS;AAAA,EAClB,MAAMhD;AAAA,EACN,OAAO8C;AAAA,EACP,aAAaC;AAAA,EACb,OAAOF;AAAA,EACP,SAASI,EAAkD1C,CAAa;AAAA,EACxE,SAAS0C,EAA+ChC,CAAa;AAAA,EACrE,QAAQgC,EAA8Cb,CAAY;AAAA,EAClE,QAAQa,EAA8CP,CAAY;AAAA,EAClE,MAAMO,EAA4CN,CAAU;AAAA,EAC5D,aAAaM,EAAmDL,CAAiB;AACrF;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { AriaAttributes } from 'react';
|
|
2
2
|
import { ChangeEvent } from 'react';
|
|
3
|
+
import { ChangeEventHandler } from 'react';
|
|
3
4
|
import { CommonAriaAttrs } from '../../utilities/types';
|
|
4
5
|
import { Context } from 'react';
|
|
5
6
|
import { CSSProperties } from 'react';
|
|
6
7
|
import { default as default_2 } from '@frontify/fondue-tokens/theme-tokens';
|
|
7
8
|
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
9
|
+
import { FocusEventHandler } from 'react';
|
|
8
10
|
import { FormEvent } from 'react';
|
|
9
11
|
import { ForwardedRef } from 'react';
|
|
10
12
|
import { ForwardRefExoticComponent } from 'react';
|
|
11
13
|
import { HTMLAttributeAnchorTarget } from 'react';
|
|
12
14
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
13
15
|
import { KeyboardEvent as KeyboardEvent_2 } from 'react';
|
|
16
|
+
import { KeyboardEventHandler } from 'react';
|
|
14
17
|
import { MouseEvent as MouseEvent_2 } from 'react';
|
|
15
18
|
import { MouseEventHandler } from 'react';
|
|
16
19
|
import { ReactElement } from 'react';
|
|
@@ -20,7 +23,7 @@ import { SyntheticEvent } from 'react';
|
|
|
20
23
|
|
|
21
24
|
export declare const Accordion: {
|
|
22
25
|
Root: {
|
|
23
|
-
({ "data-test-id": dataTestId, border, children, defaultValue, disabled, value, }: AccordionRootProps): JSX_2.Element;
|
|
26
|
+
({ "data-test-id": dataTestId, border, children, defaultValue, disabled, value, padding, }: AccordionRootProps): JSX_2.Element;
|
|
24
27
|
displayName: string;
|
|
25
28
|
};
|
|
26
29
|
Item: {
|
|
@@ -28,17 +31,20 @@ export declare const Accordion: {
|
|
|
28
31
|
displayName: string;
|
|
29
32
|
};
|
|
30
33
|
Header: {
|
|
31
|
-
({ onClick, children }: AccordionHeaderProps): JSX_2.Element;
|
|
32
|
-
displayName: string;
|
|
33
|
-
};
|
|
34
|
-
Trigger: {
|
|
35
|
-
({ "data-test-id": dataTestId, asChild, children, }: AccordionTriggerProps): JSX_2.Element;
|
|
34
|
+
({ "data-test-id": dataTestId, asChild, onClick, children, }: AccordionHeaderProps): JSX_2.Element;
|
|
36
35
|
displayName: string;
|
|
37
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use `Accordion.Header` instead.
|
|
39
|
+
*/
|
|
40
|
+
Trigger: ({ children }: {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
}) => ReactNode;
|
|
38
43
|
Content: {
|
|
39
44
|
({ "data-test-id": dataTestId, children, divider, onClick, padding, }: AccordionContentProps): JSX_2.Element;
|
|
40
45
|
displayName: string;
|
|
41
46
|
};
|
|
47
|
+
Slot: ForwardRefExoticComponent<AccordionSlotProps & RefAttributes<HTMLDivElement>>;
|
|
42
48
|
};
|
|
43
49
|
|
|
44
50
|
declare type AccordionContentProps = {
|
|
@@ -63,12 +69,18 @@ declare type AccordionContentProps = {
|
|
|
63
69
|
};
|
|
64
70
|
|
|
65
71
|
declare type AccordionHeaderProps = {
|
|
72
|
+
'data-test-id'?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
asChild?: boolean;
|
|
66
78
|
/**
|
|
67
79
|
* Click callback for this item.
|
|
68
80
|
*/
|
|
69
81
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
70
82
|
/**
|
|
71
|
-
* Children of the Accordion header.
|
|
83
|
+
* Children of the Accordion header.
|
|
72
84
|
*/
|
|
73
85
|
children?: ReactNode;
|
|
74
86
|
};
|
|
@@ -117,19 +129,17 @@ declare type AccordionRootProps = {
|
|
|
117
129
|
* The controlled stateful value of the accordion items whose contents are expanded.
|
|
118
130
|
*/
|
|
119
131
|
value?: string[];
|
|
132
|
+
/**
|
|
133
|
+
* Controls if we show paddings around the header.
|
|
134
|
+
* @default 'large'
|
|
135
|
+
*/
|
|
136
|
+
padding?: AccordionPadding;
|
|
120
137
|
};
|
|
121
138
|
|
|
122
|
-
declare type
|
|
139
|
+
declare type AccordionSlotProps = {
|
|
140
|
+
children: ReactNode;
|
|
141
|
+
name?: 'action';
|
|
123
142
|
'data-test-id'?: string;
|
|
124
|
-
/**
|
|
125
|
-
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
126
|
-
* @default false
|
|
127
|
-
*/
|
|
128
|
-
asChild?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Children of the Accordion trigger. This contains the actually clickable and visible header content
|
|
131
|
-
*/
|
|
132
|
-
children?: ReactNode;
|
|
133
143
|
};
|
|
134
144
|
|
|
135
145
|
declare type AriaLabelAttrs = Pick<AriaAttributes, 'aria-label'> & Pick<AriaAttributes, 'aria-labelledby'>;
|
|
@@ -366,16 +376,6 @@ declare type CheckboxProps = {
|
|
|
366
376
|
'aria-describedby'?: string;
|
|
367
377
|
};
|
|
368
378
|
|
|
369
|
-
declare type ClickableTableRowProps = BaseTableRowProps & {
|
|
370
|
-
/**
|
|
371
|
-
* Handler called when the row is clicked or activated via keyboard
|
|
372
|
-
* If provided, the row will be hoverable and interactive
|
|
373
|
-
*/
|
|
374
|
-
onClick: (selected: boolean) => void;
|
|
375
|
-
onNavigate?: never;
|
|
376
|
-
href?: never;
|
|
377
|
-
};
|
|
378
|
-
|
|
379
379
|
declare type ColorFormat = 'HEX' | 'RGBA';
|
|
380
380
|
|
|
381
381
|
export declare const ColorPicker: {
|
|
@@ -797,6 +797,12 @@ declare type DropdownTriggerProps = {
|
|
|
797
797
|
|
|
798
798
|
declare type DropdownViewportCollisionPadding = 'compact' | 'spacious';
|
|
799
799
|
|
|
800
|
+
declare type ExtraAction = {
|
|
801
|
+
icon: ReactElement;
|
|
802
|
+
title: string;
|
|
803
|
+
callback: () => void;
|
|
804
|
+
};
|
|
805
|
+
|
|
800
806
|
export declare const Flex: ForwardRefExoticComponent<LayoutComponentProps & {
|
|
801
807
|
/**
|
|
802
808
|
* The element to render the Flex component as.
|
|
@@ -1294,26 +1300,6 @@ declare type LoadingCircleProps = {
|
|
|
1294
1300
|
'data-test-id'?: string;
|
|
1295
1301
|
};
|
|
1296
1302
|
|
|
1297
|
-
declare type NavigableTableRowProps = BaseTableRowProps & {
|
|
1298
|
-
onClick?: never;
|
|
1299
|
-
/**
|
|
1300
|
-
* Handler called when the row is clicked or activated via keyboard for navigation
|
|
1301
|
-
* Must be provided together with href
|
|
1302
|
-
*/
|
|
1303
|
-
onNavigate: (href: string) => void;
|
|
1304
|
-
/**
|
|
1305
|
-
* URL associated with this row for navigation
|
|
1306
|
-
* Must be provided together with onNavigate
|
|
1307
|
-
*/
|
|
1308
|
-
href: string;
|
|
1309
|
-
};
|
|
1310
|
-
|
|
1311
|
-
declare type NonInteractiveTableRowProps = BaseTableRowProps & {
|
|
1312
|
-
onClick?: never;
|
|
1313
|
-
onNavigate?: never;
|
|
1314
|
-
href?: never;
|
|
1315
|
-
};
|
|
1316
|
-
|
|
1317
1303
|
declare type OverflowValue = 'visible' | 'hidden' | 'clip' | 'scroll' | 'auto';
|
|
1318
1304
|
|
|
1319
1305
|
declare type PositionValue = 'static' | 'fixed' | 'absolute' | 'relative' | 'sticky';
|
|
@@ -1621,6 +1607,8 @@ declare type SortDirection = 'ascending' | 'descending' | undefined;
|
|
|
1621
1607
|
|
|
1622
1608
|
declare type SpacingValue = (string & {}) | (number & {}) | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64;
|
|
1623
1609
|
|
|
1610
|
+
declare type Status = 'default' | 'loading' | 'success' | 'error';
|
|
1611
|
+
|
|
1624
1612
|
export declare const Switch: ForwardRefExoticComponent<SwitchProps & RefAttributes<HTMLButtonElement>>;
|
|
1625
1613
|
|
|
1626
1614
|
declare type SwitchProps = {
|
|
@@ -1677,7 +1665,13 @@ export declare const Table: {
|
|
|
1677
1665
|
Header: ForwardRefExoticComponent<TableHeaderProps & RefAttributes<HTMLTableSectionElement>>;
|
|
1678
1666
|
HeaderCell: ForwardRefExoticComponent<TableHeaderCellProps & RefAttributes<HTMLTableCellElement>>;
|
|
1679
1667
|
Body: ForwardRefExoticComponent<TableBodyProps & RefAttributes<HTMLTableSectionElement>>;
|
|
1680
|
-
Row: ForwardRefExoticComponent<
|
|
1668
|
+
Row: ForwardRefExoticComponent<BaseTableRowProps & {
|
|
1669
|
+
/**
|
|
1670
|
+
* Handler called when the row is clicked or activated via keyboard
|
|
1671
|
+
* If provided, the row will be hoverable and interactive
|
|
1672
|
+
*/
|
|
1673
|
+
onClick?: (selected: boolean) => void;
|
|
1674
|
+
} & RefAttributes<HTMLTableRowElement>>;
|
|
1681
1675
|
RowCell: ForwardRefExoticComponent<TableRowCellProps & RefAttributes<HTMLTableCellElement>>;
|
|
1682
1676
|
};
|
|
1683
1677
|
|
|
@@ -1787,8 +1781,6 @@ declare type TableRowCellProps = {
|
|
|
1787
1781
|
'aria-label'?: string;
|
|
1788
1782
|
};
|
|
1789
1783
|
|
|
1790
|
-
declare type TableRowProps = ClickableTableRowProps | NavigableTableRowProps | NonInteractiveTableRowProps;
|
|
1791
|
-
|
|
1792
1784
|
export declare const Tabs: {
|
|
1793
1785
|
Root: ForwardRefExoticComponent<TabsRootProps & RefAttributes<HTMLDivElement>>;
|
|
1794
1786
|
Tab: ForwardRefExoticComponent<TabsTabProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -1798,6 +1790,7 @@ export declare const Tabs: {
|
|
|
1798
1790
|
|
|
1799
1791
|
declare type TabsContentProps = {
|
|
1800
1792
|
children: ReactNode;
|
|
1793
|
+
asChild?: boolean;
|
|
1801
1794
|
};
|
|
1802
1795
|
|
|
1803
1796
|
declare type TabsRootProps = {
|
|
@@ -1882,6 +1875,88 @@ declare const Text_2: (<TTag extends TagType_2 = "span">(props: TextProps<TTag>
|
|
|
1882
1875
|
};
|
|
1883
1876
|
export { Text_2 as Text }
|
|
1884
1877
|
|
|
1878
|
+
export declare const Textarea: ({ "data-test-id": dataTestId, autocomplete, autosize, clearable, decorator, defaultValue, disabled, extraActions, focusOnMount, minRows: rows, maxRows, onEnterPressed, readOnly, resizable, selectable, status, value: inputValue, ...props }: TextareaProps) => JSX_2.Element;
|
|
1879
|
+
|
|
1880
|
+
declare type TextareaProps = {
|
|
1881
|
+
'data-test-id'?: string;
|
|
1882
|
+
/**
|
|
1883
|
+
* If `true`, Textarea will have `autoComplete` functionality
|
|
1884
|
+
*/
|
|
1885
|
+
autocomplete?: boolean;
|
|
1886
|
+
/**
|
|
1887
|
+
* If `true`, component rendered is a auto sizing Textarea
|
|
1888
|
+
*/
|
|
1889
|
+
autosize?: boolean;
|
|
1890
|
+
/**
|
|
1891
|
+
* Render `clear` button to clear input on click
|
|
1892
|
+
*/
|
|
1893
|
+
clearable?: boolean;
|
|
1894
|
+
/**
|
|
1895
|
+
* A `ReactElement` that will be rendered at the start of the `Textarea`
|
|
1896
|
+
*/
|
|
1897
|
+
decorator?: ReactElement;
|
|
1898
|
+
/**
|
|
1899
|
+
* Initial value
|
|
1900
|
+
*/
|
|
1901
|
+
defaultValue?: string;
|
|
1902
|
+
disabled?: boolean;
|
|
1903
|
+
/**
|
|
1904
|
+
* Collection of extra actions the input can preform
|
|
1905
|
+
*/
|
|
1906
|
+
extraActions?: ExtraAction[];
|
|
1907
|
+
/**
|
|
1908
|
+
* If `true`, Textarea will be focused on mount
|
|
1909
|
+
*/
|
|
1910
|
+
focusOnMount?: boolean;
|
|
1911
|
+
/**
|
|
1912
|
+
* If autosize is false, this is used as rows property for default textarea
|
|
1913
|
+
* @default 1
|
|
1914
|
+
*/
|
|
1915
|
+
minRows?: number;
|
|
1916
|
+
/**
|
|
1917
|
+
* If `autosize` is `false`, this property is ignored
|
|
1918
|
+
*/
|
|
1919
|
+
maxRows?: number;
|
|
1920
|
+
/**
|
|
1921
|
+
* Event handler called when the textarea value changes
|
|
1922
|
+
*/
|
|
1923
|
+
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
1924
|
+
/**
|
|
1925
|
+
* Event handler called when the text input is blurred
|
|
1926
|
+
*/
|
|
1927
|
+
onBlur?: FocusEventHandler<HTMLTextAreaElement>;
|
|
1928
|
+
/**
|
|
1929
|
+
* Event handler called when the text input is focused
|
|
1930
|
+
*/
|
|
1931
|
+
onFocus?: FocusEventHandler<HTMLTextAreaElement>;
|
|
1932
|
+
/**
|
|
1933
|
+
* Event handler called when a key is pressed
|
|
1934
|
+
*/
|
|
1935
|
+
onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
1936
|
+
/**
|
|
1937
|
+
* Event handler called when Enter is pressed
|
|
1938
|
+
*/
|
|
1939
|
+
onEnterPressed?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
1940
|
+
/**
|
|
1941
|
+
* Event handler called when a key is released
|
|
1942
|
+
*/
|
|
1943
|
+
onKeyUp?: KeyboardEventHandler<HTMLTextAreaElement>;
|
|
1944
|
+
/**
|
|
1945
|
+
* Event handler called when the text inside of text input is selected
|
|
1946
|
+
*/
|
|
1947
|
+
onSelect?: (event: SyntheticEvent<HTMLTextAreaElement>) => void;
|
|
1948
|
+
placeholder?: string;
|
|
1949
|
+
readOnly?: boolean;
|
|
1950
|
+
resizable?: boolean;
|
|
1951
|
+
selectable?: boolean;
|
|
1952
|
+
/**
|
|
1953
|
+
* The current status of the input. It will trigger the corresponding icon to be appended to the Textarea.
|
|
1954
|
+
* @default 'default'
|
|
1955
|
+
*/
|
|
1956
|
+
status?: Status;
|
|
1957
|
+
value?: string;
|
|
1958
|
+
};
|
|
1959
|
+
|
|
1885
1960
|
declare type TextColor = 'default' | 'weak' | 'x-weak' | 'disabled' | 'negative' | 'positive' | 'warning' | 'interactive';
|
|
1886
1961
|
|
|
1887
1962
|
declare type TextElementMap = {
|