@neo4j-ndl/react 4.9.38 → 4.9.40
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/lib/cjs/time-picker/TimePicker.js +5 -2
- package/lib/cjs/time-picker/TimePicker.js.map +1 -1
- package/lib/cjs/timezone-picker/TimeZonePicker.js +7 -4
- package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/cjs/tooltip/Tooltip.js +57 -5
- package/lib/cjs/tooltip/Tooltip.js.map +1 -1
- package/lib/cjs/tooltip/stories/index.js +6 -2
- package/lib/cjs/tooltip/stories/index.js.map +1 -1
- package/lib/cjs/tooltip/stories/tooltip-rich-actions.story.js +30 -0
- package/lib/cjs/tooltip/stories/tooltip-rich-actions.story.js.map +1 -0
- package/lib/cjs/tooltip/stories/tooltip-rich.story.js +1 -1
- package/lib/cjs/tooltip/stories/tooltip-rich.story.js.map +1 -1
- package/lib/cjs/tooltip/use-tooltip.js +18 -3
- package/lib/cjs/tooltip/use-tooltip.js.map +1 -1
- package/lib/esm/time-picker/TimePicker.js +5 -2
- package/lib/esm/time-picker/TimePicker.js.map +1 -1
- package/lib/esm/timezone-picker/TimeZonePicker.js +7 -4
- package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -1
- package/lib/esm/tooltip/Tooltip.js +24 -5
- package/lib/esm/tooltip/Tooltip.js.map +1 -1
- package/lib/esm/tooltip/stories/index.js +4 -1
- package/lib/esm/tooltip/stories/index.js.map +1 -1
- package/lib/esm/tooltip/stories/tooltip-rich-actions.story.js +28 -0
- package/lib/esm/tooltip/stories/tooltip-rich-actions.story.js.map +1 -0
- package/lib/esm/tooltip/stories/tooltip-rich.story.js +2 -2
- package/lib/esm/tooltip/stories/tooltip-rich.story.js.map +1 -1
- package/lib/esm/tooltip/use-tooltip.js +19 -4
- package/lib/esm/tooltip/use-tooltip.js.map +1 -1
- package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
- package/lib/types/timezone-picker/TimeZonePicker.d.ts.map +1 -1
- package/lib/types/tooltip/Tooltip.d.ts +5 -2
- package/lib/types/tooltip/Tooltip.d.ts.map +1 -1
- package/lib/types/tooltip/stories/index.d.ts +3 -1
- package/lib/types/tooltip/stories/index.d.ts.map +1 -1
- package/lib/types/tooltip/stories/tooltip-rich-actions.story.d.ts +24 -0
- package/lib/types/tooltip/stories/tooltip-rich-actions.story.d.ts.map +1 -0
- package/lib/types/tooltip/stories/tooltip-rich.story.d.ts.map +1 -1
- package/lib/types/tooltip/use-tooltip.d.ts +5 -0
- package/lib/types/tooltip/use-tooltip.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeZonePicker.js","sourceRoot":"","sources":["../../../src/timezone-picker/TimeZonePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,oBAAoB,EACpB,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EACL,SAAS,EACT,KAAK,EACL,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA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AC,CAC5B,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CACjC,aAEE,IAAI,EAAC,QAAQ,mBACE,KAAK,KAAK,MAAM,CAAC,KAAK,EACrC,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;wCACb,CAAC,CAAC,eAAe,EAAE,CAAC;wCACpB,CAAC,CAAC,cAAc,EAAE,CAAC;wCACnB,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;wCAC5B,gBAAgB,CAAC,KAAK,CAAC,CAAC;oCAC1B,CAAC,EACD,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;wCACjB,CAAC,CAAC,eAAe,EAAE,CAAC;wCACpB,CAAC,CAAC,cAAc,EAAE,CAAC;oCACrB,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EACZ,SAAS,EAAE,UAAU,CACnB,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EACnC,kCAAkC,CACnC,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;wCACf,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;4CACtB,CAAC,CAAC,eAAe,EAAE,CAAC;4CACpB,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;wCAC9B,CAAC;oCACH,CAAC,YAEA,MAAM,CAAC,KAAK,IA1BR,MAAM,CAAC,KAAK,CA2Bd,CACN,CAAC,CACH,CAAC,CAAC,CAAC,CACF,aAAI,SAAS,EAAC,iEAAiE,mCAE1E,CACN,GACA,CACJ,GACE,IACD,GACe,GACP,CACnB,IACA,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingPortal,\n offset,\n shift,\n useDismiss,\n useFloating,\n useInteractions,\n useMergeRefs,\n useTransitionStyles,\n} from '@floating-ui/react';\nimport { ChevronDownIcon } from '@heroicons/react/24/outline';\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport {\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { ExclamationCircleIconSolid } from '../icons';\nimport { useNeedleTheme } from '../theme';\nimport { Typography } from '../typography';\nimport {\n formatTimeZone,\n generateTimeZoneOptions,\n generateUTCTimeZoneOptions,\n isValidUTCFormat,\n parseCustomUTCOffset,\n} from './generate-timezone-options';\nimport {\n useKeyboardNavigation,\n useTimeZonePickerPopover,\n} from './timezone-picker-hooks';\n\nexport type TimeZonePickerProps = {\n /** The value of the timezone picker (IANA timezone identifier) */\n value?: string;\n /** Whether the timezone picker is fluid */\n isFluid?: boolean;\n /** Whether the timezone picker is read only */\n isReadOnly?: boolean;\n /** Whether the timezone picker is required */\n isRequired?: boolean;\n /** Whether the timezone picker is disabled */\n isDisabled?: boolean;\n /** The label of the timezone picker */\n label?: string;\n /** The size of the timezone picker */\n size?: 'small' | 'medium' | 'large';\n /** Manually set the error text */\n errorText?: string;\n /** Callback function triggered when the timezone picker value changes */\n onChange?: (timezone: string) => void;\n /** Callback function triggered when the timezone picker encounters an error */\n onError?: (error: string, timezone: string) => void;\n /**\n * Strategy for the dropdown floating element.\n * By default it is absolute, but if the component is inside of a needle Dialog, it is set to fixed.\n * If this prop is set, no auto-detection of Dialog is done.\n */\n floatingStrategy?: 'absolute' | 'fixed';\n /** Whether the dropdown element is rendered in a portal. */\n isPortaled?: boolean;\n /** Reference date for calculating timezone offsets (useful for DST-aware offset display) */\n referenceDate?: Date;\n /**\n * Display mode: 'city', 'utc', or 'both'\n * 'city' - shows city-based timezones, This should be used when the user needs to select a timezone for themselves or if they are selecting a timezone that's related to a date.\n * 'utc' - shows UTC timezones, This should be used when the user needs to select a timezone for a database entry or a technical application.\n * 'both' - shows both city-based and UTC timezones in separate sections, This should be used when the user needs to select a timezone for a database entry or a technical application, but also wants to see the city-based timezones for context for example a zoned date time.\n * @default 'city'\n * @example\n * <TimeZonePicker mode=\"city\" />\n * <TimeZonePicker mode=\"utc\" />\n * <TimeZonePicker mode=\"both\" />\n */\n mode?: 'city' | 'utc' | 'both';\n};\n\nexport const TimeZonePicker = ({\n isDisabled,\n isFluid,\n isReadOnly,\n isRequired,\n value,\n label,\n onChange,\n className,\n onError,\n style,\n size = 'medium',\n errorText,\n htmlAttributes,\n floatingStrategy,\n isPortaled: isPortaledProp,\n referenceDate,\n mode = 'city',\n ref,\n ...restProps\n}: CommonProps<'input', TimeZonePickerProps>) => {\n const [inputValue, setInputValue] = useState<string>(\n value\n ? formatTimeZone(value, referenceDate)\n : formatTimeZone(\n new Date().toISOString().split('T')[1].split('.')[0],\n referenceDate,\n ),\n );\n const [searchQuery, setSearchQuery] = useState<string>('');\n const listRef = useRef<HTMLUListElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);\n const [error, setError] = useState<string | undefined>(undefined);\n const errorTextId = useId();\n\n const timezoneOptions = useMemo(() => {\n if (mode === 'utc') {\n return generateUTCTimeZoneOptions(referenceDate);\n } else if (mode === 'city') {\n return generateTimeZoneOptions(referenceDate);\n } else {\n // 'both' mode - combine both lists, excluding UTC from city list to avoid duplication\n return [\n ...generateUTCTimeZoneOptions(referenceDate),\n ...generateTimeZoneOptions(referenceDate, true), // excludeUTC = true\n ];\n }\n }, [referenceDate, mode]);\n\n const { themeClassName } = useNeedleTheme();\n const { isPopoverOpen, setIsPopoverOpen } = useTimeZonePickerPopover(false);\n\n // Filter options based on search query\n const filteredOptions = useMemo(() => {\n if (!searchQuery) {\n return timezoneOptions;\n }\n\n const query = searchQuery.toLowerCase();\n return timezoneOptions.filter(\n (option) =>\n option.label.toLowerCase().includes(query) ||\n option.value.toLowerCase().includes(query),\n );\n }, [timezoneOptions, searchQuery]);\n\n // Split options into UTC and city-based sections for 'both' mode\n const { utcOptions, cityOptions } = useMemo(() => {\n if (mode !== 'both') {\n return { cityOptions: filteredOptions, utcOptions: [] };\n }\n\n const utc: typeof filteredOptions = [];\n const city: typeof filteredOptions = [];\n\n filteredOptions.forEach((option) => {\n // UTC options are those that start with \"UTC\" in their value or label\n if (\n option.value.toUpperCase().startsWith('UTC') ||\n option.label.toUpperCase().startsWith('UTC')\n ) {\n utc.push(option);\n } else {\n city.push(option);\n }\n });\n\n return { cityOptions: city, utcOptions: utc };\n }, [filteredOptions, mode]);\n\n const { focusedIndex, setFocusedIndex, handleArrowNavigation } =\n useKeyboardNavigation(filteredOptions.length);\n\n const errorToShow =\n errorText !== undefined && errorText !== '' ? errorText : error;\n\n const classes = {\n 'ndl-disabled': isDisabled,\n 'ndl-error': errorToShow !== undefined,\n 'ndl-fluid': isFluid,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-read-only': isReadOnly,\n 'ndl-small': size === 'small',\n };\n\n const inputWidth = isFluid === true ? '100%' : '16rem';\n\n useEffect(() => {\n if (error !== undefined) {\n onError?.(error, inputValue);\n }\n }, [error, inputValue, onError]);\n\n useEffect(() => {\n setInputValue(value ? formatTimeZone(value, referenceDate) : '');\n }, [value, referenceDate]);\n\n useEffect(() => {\n if (isPopoverOpen) {\n setTimeout(() => {\n listRef.current?.children[focusedIndex]?.scrollIntoView({\n block: 'center',\n inline: 'nearest',\n });\n }, 0);\n } else {\n setTimeout(() => {\n inputRef.current?.blur();\n const selectedIndex =\n filteredOptions.findIndex((opt) => opt.value === value) ?? 0;\n setFocusedIndex(selectedIndex >= 0 ? selectedIndex : 0);\n setSearchQuery('');\n }, 0);\n }\n }, [focusedIndex, isPopoverOpen, value, setFocusedIndex, filteredOptions]);\n\n const handleOnClick = (timezone: string) => {\n if (onChange) {\n onChange(timezone);\n }\n setError(undefined);\n setInputValue(formatTimeZone(timezone, referenceDate));\n setIsPopoverOpen(false);\n setSearchQuery('');\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const query = e.target.value;\n setSearchQuery(query);\n setInputValue(query);\n\n // In UTC mode (utc or both), validate custom UTC input\n if (\n (mode === 'utc' || mode === 'both') &&\n query.trim().toUpperCase().startsWith('UTC')\n ) {\n if (isValidUTCFormat(query.trim())) {\n setError(undefined);\n } else {\n setError('Invalid UTC format. Use UTC+H:MM or UTC-H:MM');\n }\n return;\n }\n\n // Try to find a matching timezone\n const matchingOption = timezoneOptions.find(\n (opt) =>\n opt.label.toLowerCase().includes(query.toLowerCase()) ||\n opt.value.toLowerCase().includes(query.toLowerCase()),\n );\n\n if (matchingOption) {\n setError(undefined);\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (isReadOnly === true || isDisabled === true) {\n e.preventDefault();\n return;\n }\n\n if (e.key === 'Escape') {\n setIsPopoverOpen(false);\n setSearchQuery('');\n setInputValue(value ? formatTimeZone(value, referenceDate) : '');\n }\n\n setIsPopoverOpen(true);\n\n if (e.key === 'Enter') {\n // In UTC mode (utc or both), allow custom UTC input\n if (\n (mode === 'utc' || mode === 'both') &&\n inputValue.trim().toUpperCase().startsWith('UTC')\n ) {\n const parsedOffset = parseCustomUTCOffset(inputValue.trim());\n if (parsedOffset) {\n handleOnClick(parsedOffset);\n return;\n }\n }\n\n if (filteredOptions.length > 0) {\n const selectedOption = filteredOptions[focusedIndex];\n if (selectedOption) {\n handleOnClick(selectedOption.value);\n }\n }\n } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n handleArrowNavigation(e.key);\n }\n };\n\n /** Custom floating ui solution */\n const isInsideDialog = useIsInsideDialog();\n const isPortaled = isPortaledProp ?? !isInsideDialog;\n const containerRef = useRef<HTMLDivElement>(null);\n const { refs, floatingStyles, context } = useFloating({\n elements: {\n reference: containerRef.current,\n },\n middleware: [\n offset(10),\n flip({\n fallbackPlacements: ['top'],\n fallbackStrategy: 'bestFit',\n }),\n shift({ padding: 5 }),\n ],\n onOpenChange: (open) => {\n setIsPopoverOpen(open);\n },\n open: isDisabled !== true && isReadOnly !== true && isPopoverOpen,\n placement: 'bottom',\n strategy: floatingStrategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n whileElementsMounted: autoUpdate,\n });\n const dismiss = useDismiss(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss]);\n const { styles: transitionStyles } = useTransitionStyles(context, {\n duration: Number.parseInt(tokens.motion.duration.quick) ?? 0,\n });\n\n const mergedRef = useMergeRefs([refs.setReference, containerRef]);\n\n return (\n <>\n <div\n className={classNames('ndl-timezone-picker', className, {\n ...classes,\n })}\n ref={mergedRef}\n {...getReferenceProps()}\n style={{\n width: isFluid === true ? '100%' : 'fit-content',\n }}\n >\n <label className=\"ndl-timezone-picker-label\">\n {label !== undefined && (\n <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n >\n {label}\n </Typography>\n )}\n <div\n className=\"ndl-timezone-picker-input-wrapper\"\n style={{\n width: inputWidth,\n ...style,\n }}\n >\n <input\n aria-label={label}\n aria-invalid={Boolean(errorToShow)}\n aria-describedby={errorToShow ? errorTextId : undefined}\n className=\"ndl-timezone-picker-input\"\n type=\"text\"\n ref={inputRef}\n value={inputValue}\n disabled={isDisabled}\n readOnly={isReadOnly}\n required={isRequired}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onClick={(e) => {\n if (isReadOnly === true || isDisabled === true) {\n return;\n }\n setIsPopoverOpen(true);\n // Select all text on click for easy searching\n e.currentTarget.select();\n }}\n onFocus={(e) => {\n if (isReadOnly === true || isDisabled === true) {\n return;\n }\n // Select all text on focus for easy searching\n e.currentTarget.select();\n }}\n onBlur={(e) => {\n if (isReadOnly === true || isDisabled === true) {\n return;\n }\n\n if (\n e.relatedTarget?.classList.contains(\n 'ndl-timezone-picker-popover-item',\n ) === true\n ) {\n return;\n }\n\n // In UTC mode (utc or both), try to parse custom input on blur\n if (\n (mode === 'utc' || mode === 'both') &&\n inputValue.trim().toUpperCase().startsWith('UTC')\n ) {\n const parsedOffset = parseCustomUTCOffset(inputValue.trim());\n if (parsedOffset) {\n handleOnClick(parsedOffset);\n setError(undefined);\n return;\n }\n }\n\n // Reset to the current value if no valid selection was made\n if (value) {\n setInputValue(formatTimeZone(value, referenceDate));\n } else {\n setInputValue('');\n }\n setSearchQuery('');\n setError(undefined);\n }}\n placeholder={\n mode === 'city'\n ? 'Select timezone'\n : mode === 'utc'\n ? 'Select or type UTC offset (e.g., UTC+5:30)'\n : 'Select timezone or type UTC offset'\n }\n {...htmlAttributes}\n {...restProps}\n />\n <ChevronDownIcon className=\"ndl-icon-svg ndl-timezone-picker-icon\" />\n </div>\n </label>\n {errorToShow !== undefined && (\n <div className=\"ndl-timezone-picker-error-wrapper\" role=\"status\">\n <ExclamationCircleIconSolid className=\"ndl-timezone-picker-error-icon\" />\n <Typography\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n className=\"ndl-timezone-picker-error-text\"\n htmlAttributes={{ id: errorTextId }}\n >\n {errorToShow}\n </Typography>\n </div>\n )}\n </div>\n\n {context.open && (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal>{wrapChildren}</FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={context}\n modal={false}\n initialFocus={-1}\n >\n <div\n ref={refs.setFloating}\n className={classNames(\n themeClassName,\n 'ndl-timezone-picker-popover',\n {\n ...classes,\n },\n )}\n style={{\n ...transitionStyles,\n ...floatingStyles,\n width:\n isFluid === true\n ? containerRef.current?.clientWidth\n : undefined,\n }}\n {...getFloatingProps()}\n >\n <ul ref={listRef} tabIndex={-1}>\n {mode === 'both' ? (\n <>\n {utcOptions.length > 0 && (\n <>\n <li className=\"ndl-timezone-picker-section-header\">\n UTC Offsets\n </li>\n {utcOptions.map((option, i) => (\n <li\n key={option.value}\n role=\"option\"\n aria-selected={value === option.value}\n value={option.value}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(option.value);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={classNames(\n focusedIndex === i ? 'focused' : '',\n 'ndl-timezone-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.stopPropagation();\n handleOnClick(option.value);\n }\n }}\n >\n {option.label}\n </li>\n ))}\n </>\n )}\n {cityOptions.length > 0 && (\n <>\n <li className=\"ndl-timezone-picker-section-header\">\n City-Based Timezones\n </li>\n {cityOptions.map((option, i) => {\n const adjustedIndex = i + utcOptions.length;\n return (\n <li\n key={option.value}\n role=\"option\"\n aria-selected={value === option.value}\n value={option.value}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(option.value);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={classNames(\n focusedIndex === adjustedIndex ? 'focused' : '',\n 'ndl-timezone-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.stopPropagation();\n handleOnClick(option.value);\n }\n }}\n >\n {option.label}\n </li>\n );\n })}\n </>\n )}\n {utcOptions.length === 0 && cityOptions.length === 0 && (\n <li className=\"ndl-timezone-picker-popover-item ndl-timezone-picker-no-results\">\n No timezones found\n </li>\n )}\n </>\n ) : (\n <>\n {filteredOptions.length > 0 ? (\n filteredOptions.map((option, i) => (\n <li\n key={option.value}\n role=\"option\"\n aria-selected={value === option.value}\n value={option.value}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(option.value);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={classNames(\n focusedIndex === i ? 'focused' : '',\n 'ndl-timezone-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.stopPropagation();\n handleOnClick(option.value);\n }\n }}\n >\n {option.label}\n </li>\n ))\n ) : (\n <li className=\"ndl-timezone-picker-popover-item ndl-timezone-picker-no-results\">\n No timezones found\n </li>\n )}\n </>\n )}\n </ul>\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n )}\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"TimeZonePicker.js","sourceRoot":"","sources":["../../../src/timezone-picker/TimeZonePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,oBAAoB,EACpB,cAAc,EACd,MAAM,EACN,KAAK,EACL,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EACL,SAAS,EACT,KAAK,EACL,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,i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EAAE,EACnC,kCAAkC,CACnC,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;wCACf,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;4CACtB,CAAC,CAAC,eAAe,EAAE,CAAC;4CACpB,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;wCAC9B,CAAC;oCACH,CAAC,YAEA,MAAM,CAAC,KAAK,IA1BR,MAAM,CAAC,KAAK,CA2Bd,CACN,CAAC,CACH,CAAC,CAAC,CAAC,CACF,aAAI,SAAS,EAAC,iEAAiE,mCAE1E,CACN,GACA,CACJ,GACE,IACD,GACe,GACP,CACnB,IACA,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n FloatingFocusManager,\n FloatingPortal,\n offset,\n shift,\n useDismiss,\n useFloating,\n useInteractions,\n useMergeRefs,\n useTransitionStyles,\n} from '@floating-ui/react';\nimport { ChevronDownIcon } from '@heroicons/react/24/outline';\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport {\n useEffect,\n useId,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { ExclamationCircleIconSolid } from '../icons';\nimport { useNeedleTheme } from '../theme';\nimport { Typography } from '../typography';\nimport {\n formatTimeZone,\n generateTimeZoneOptions,\n generateUTCTimeZoneOptions,\n isValidUTCFormat,\n parseCustomUTCOffset,\n} from './generate-timezone-options';\nimport {\n useKeyboardNavigation,\n useTimeZonePickerPopover,\n} from './timezone-picker-hooks';\n\nexport type TimeZonePickerProps = {\n /** The value of the timezone picker (IANA timezone identifier) */\n value?: string;\n /** Whether the timezone picker is fluid */\n isFluid?: boolean;\n /** Whether the timezone picker is read only */\n isReadOnly?: boolean;\n /** Whether the timezone picker is required */\n isRequired?: boolean;\n /** Whether the timezone picker is disabled */\n isDisabled?: boolean;\n /** The label of the timezone picker */\n label?: string;\n /** The size of the timezone picker */\n size?: 'small' | 'medium' | 'large';\n /** Manually set the error text */\n errorText?: string;\n /** Callback function triggered when the timezone picker value changes */\n onChange?: (timezone: string) => void;\n /** Callback function triggered when the timezone picker encounters an error */\n onError?: (error: string, timezone: string) => void;\n /**\n * Strategy for the dropdown floating element.\n * By default it is absolute, but if the component is inside of a needle Dialog, it is set to fixed.\n * If this prop is set, no auto-detection of Dialog is done.\n */\n floatingStrategy?: 'absolute' | 'fixed';\n /** Whether the dropdown element is rendered in a portal. */\n isPortaled?: boolean;\n /** Reference date for calculating timezone offsets (useful for DST-aware offset display) */\n referenceDate?: Date;\n /**\n * Display mode: 'city', 'utc', or 'both'\n * 'city' - shows city-based timezones, This should be used when the user needs to select a timezone for themselves or if they are selecting a timezone that's related to a date.\n * 'utc' - shows UTC timezones, This should be used when the user needs to select a timezone for a database entry or a technical application.\n * 'both' - shows both city-based and UTC timezones in separate sections, This should be used when the user needs to select a timezone for a database entry or a technical application, but also wants to see the city-based timezones for context for example a zoned date time.\n * @default 'city'\n * @example\n * <TimeZonePicker mode=\"city\" />\n * <TimeZonePicker mode=\"utc\" />\n * <TimeZonePicker mode=\"both\" />\n */\n mode?: 'city' | 'utc' | 'both';\n};\n\nexport const TimeZonePicker = ({\n isDisabled,\n isFluid,\n isReadOnly,\n isRequired,\n value,\n label,\n onChange,\n className,\n onError,\n style,\n size = 'medium',\n errorText,\n htmlAttributes,\n floatingStrategy,\n isPortaled: isPortaledProp,\n referenceDate,\n mode = 'city',\n ref,\n ...restProps\n}: CommonProps<'input', TimeZonePickerProps>) => {\n const [inputValue, setInputValue] = useState<string>(\n value\n ? formatTimeZone(value, referenceDate)\n : formatTimeZone(\n new Date().toISOString().split('T')[1].split('.')[0],\n referenceDate,\n ),\n );\n const [searchQuery, setSearchQuery] = useState<string>('');\n const listRef = useRef<HTMLUListElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => inputRef.current as HTMLInputElement, []);\n const [error, setError] = useState<string | undefined>(undefined);\n const errorTextId = useId();\n const listboxId = useId();\n\n const timezoneOptions = useMemo(() => {\n if (mode === 'utc') {\n return generateUTCTimeZoneOptions(referenceDate);\n } else if (mode === 'city') {\n return generateTimeZoneOptions(referenceDate);\n } else {\n // 'both' mode - combine both lists, excluding UTC from city list to avoid duplication\n return [\n ...generateUTCTimeZoneOptions(referenceDate),\n ...generateTimeZoneOptions(referenceDate, true), // excludeUTC = true\n ];\n }\n }, [referenceDate, mode]);\n\n const { themeClassName } = useNeedleTheme();\n const { isPopoverOpen, setIsPopoverOpen } = useTimeZonePickerPopover(false);\n\n // Filter options based on search query\n const filteredOptions = useMemo(() => {\n if (!searchQuery) {\n return timezoneOptions;\n }\n\n const query = searchQuery.toLowerCase();\n return timezoneOptions.filter(\n (option) =>\n option.label.toLowerCase().includes(query) ||\n option.value.toLowerCase().includes(query),\n );\n }, [timezoneOptions, searchQuery]);\n\n // Split options into UTC and city-based sections for 'both' mode\n const { utcOptions, cityOptions } = useMemo(() => {\n if (mode !== 'both') {\n return { cityOptions: filteredOptions, utcOptions: [] };\n }\n\n const utc: typeof filteredOptions = [];\n const city: typeof filteredOptions = [];\n\n filteredOptions.forEach((option) => {\n // UTC options are those that start with \"UTC\" in their value or label\n if (\n option.value.toUpperCase().startsWith('UTC') ||\n option.label.toUpperCase().startsWith('UTC')\n ) {\n utc.push(option);\n } else {\n city.push(option);\n }\n });\n\n return { cityOptions: city, utcOptions: utc };\n }, [filteredOptions, mode]);\n\n const { focusedIndex, setFocusedIndex, handleArrowNavigation } =\n useKeyboardNavigation(filteredOptions.length);\n\n const errorToShow =\n errorText !== undefined && errorText !== '' ? errorText : error;\n\n const classes = {\n 'ndl-disabled': isDisabled,\n 'ndl-error': errorToShow !== undefined,\n 'ndl-fluid': isFluid,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-read-only': isReadOnly,\n 'ndl-small': size === 'small',\n };\n\n const inputWidth = isFluid === true ? '100%' : '16rem';\n\n useEffect(() => {\n if (error !== undefined) {\n onError?.(error, inputValue);\n }\n }, [error, inputValue, onError]);\n\n useEffect(() => {\n setInputValue(value ? formatTimeZone(value, referenceDate) : '');\n }, [value, referenceDate]);\n\n useEffect(() => {\n if (isPopoverOpen) {\n setTimeout(() => {\n listRef.current?.children[focusedIndex]?.scrollIntoView({\n block: 'center',\n inline: 'nearest',\n });\n }, 0);\n } else {\n setTimeout(() => {\n inputRef.current?.blur();\n const selectedIndex =\n filteredOptions.findIndex((opt) => opt.value === value) ?? 0;\n setFocusedIndex(selectedIndex >= 0 ? selectedIndex : 0);\n setSearchQuery('');\n }, 0);\n }\n }, [focusedIndex, isPopoverOpen, value, setFocusedIndex, filteredOptions]);\n\n const handleOnClick = (timezone: string) => {\n if (onChange) {\n onChange(timezone);\n }\n setError(undefined);\n setInputValue(formatTimeZone(timezone, referenceDate));\n setIsPopoverOpen(false);\n setSearchQuery('');\n };\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const query = e.target.value;\n setSearchQuery(query);\n setInputValue(query);\n\n // In UTC mode (utc or both), validate custom UTC input\n if (\n (mode === 'utc' || mode === 'both') &&\n query.trim().toUpperCase().startsWith('UTC')\n ) {\n if (isValidUTCFormat(query.trim())) {\n setError(undefined);\n } else {\n setError('Invalid UTC format. Use UTC+H:MM or UTC-H:MM');\n }\n return;\n }\n\n // Try to find a matching timezone\n const matchingOption = timezoneOptions.find(\n (opt) =>\n opt.label.toLowerCase().includes(query.toLowerCase()) ||\n opt.value.toLowerCase().includes(query.toLowerCase()),\n );\n\n if (matchingOption) {\n setError(undefined);\n }\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (isReadOnly === true || isDisabled === true) {\n e.preventDefault();\n return;\n }\n\n if (e.key === 'Escape') {\n setIsPopoverOpen(false);\n setSearchQuery('');\n setInputValue(value ? formatTimeZone(value, referenceDate) : '');\n }\n\n setIsPopoverOpen(true);\n\n if (e.key === 'Enter') {\n // In UTC mode (utc or both), allow custom UTC input\n if (\n (mode === 'utc' || mode === 'both') &&\n inputValue.trim().toUpperCase().startsWith('UTC')\n ) {\n const parsedOffset = parseCustomUTCOffset(inputValue.trim());\n if (parsedOffset) {\n handleOnClick(parsedOffset);\n return;\n }\n }\n\n if (filteredOptions.length > 0) {\n const selectedOption = filteredOptions[focusedIndex];\n if (selectedOption) {\n handleOnClick(selectedOption.value);\n }\n }\n } else if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n handleArrowNavigation(e.key);\n }\n };\n\n /** Custom floating ui solution */\n const isInsideDialog = useIsInsideDialog();\n const isPortaled = isPortaledProp ?? !isInsideDialog;\n const containerRef = useRef<HTMLDivElement>(null);\n const { refs, floatingStyles, context } = useFloating({\n elements: {\n reference: containerRef.current,\n },\n middleware: [\n offset(10),\n flip({\n fallbackPlacements: ['top'],\n fallbackStrategy: 'bestFit',\n }),\n shift({ padding: 5 }),\n ],\n onOpenChange: (open) => {\n setIsPopoverOpen(open);\n },\n open: isDisabled !== true && isReadOnly !== true && isPopoverOpen,\n placement: 'bottom',\n strategy: floatingStrategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n whileElementsMounted: autoUpdate,\n });\n const dismiss = useDismiss(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([dismiss]);\n const { styles: transitionStyles } = useTransitionStyles(context, {\n duration: Number.parseInt(tokens.motion.duration.quick) ?? 0,\n });\n\n const mergedRef = useMergeRefs([refs.setReference, containerRef]);\n\n return (\n <>\n <div\n className={classNames('ndl-timezone-picker', className, {\n ...classes,\n })}\n ref={mergedRef}\n {...getReferenceProps()}\n style={{\n width: isFluid === true ? '100%' : 'fit-content',\n }}\n >\n <label className=\"ndl-timezone-picker-label\">\n {label !== undefined && (\n <Typography\n variant={size === 'large' ? 'body-large' : 'body-medium'}\n >\n {label}\n </Typography>\n )}\n <div\n className=\"ndl-timezone-picker-input-wrapper\"\n style={{\n width: inputWidth,\n ...style,\n }}\n >\n <input\n role=\"combobox\"\n aria-expanded={isPopoverOpen}\n aria-controls={listboxId}\n aria-activedescendant={\n isPopoverOpen && focusedIndex >= 0\n ? `${listboxId}-option-${focusedIndex}`\n : undefined\n }\n aria-label={label}\n aria-invalid={Boolean(errorToShow)}\n aria-describedby={errorToShow ? errorTextId : undefined}\n className=\"ndl-timezone-picker-input\"\n type=\"text\"\n ref={inputRef}\n value={inputValue}\n disabled={isDisabled}\n readOnly={isReadOnly}\n required={isRequired}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onClick={(e) => {\n if (isReadOnly === true || isDisabled === true) {\n return;\n }\n setIsPopoverOpen(true);\n // Select all text on click for easy searching\n e.currentTarget.select();\n }}\n onFocus={(e) => {\n if (isReadOnly === true || isDisabled === true) {\n return;\n }\n // Select all text on focus for easy searching\n e.currentTarget.select();\n }}\n onBlur={(e) => {\n if (isReadOnly === true || isDisabled === true) {\n return;\n }\n\n if (\n e.relatedTarget?.classList.contains(\n 'ndl-timezone-picker-popover-item',\n ) === true\n ) {\n return;\n }\n\n // In UTC mode (utc or both), try to parse custom input on blur\n if (\n (mode === 'utc' || mode === 'both') &&\n inputValue.trim().toUpperCase().startsWith('UTC')\n ) {\n const parsedOffset = parseCustomUTCOffset(inputValue.trim());\n if (parsedOffset) {\n handleOnClick(parsedOffset);\n setError(undefined);\n return;\n }\n }\n\n // Reset to the current value if no valid selection was made\n if (value) {\n setInputValue(formatTimeZone(value, referenceDate));\n } else {\n setInputValue('');\n }\n setSearchQuery('');\n setError(undefined);\n }}\n placeholder={\n mode === 'city'\n ? 'Select timezone'\n : mode === 'utc'\n ? 'Select or type UTC offset (e.g., UTC+5:30)'\n : 'Select timezone or type UTC offset'\n }\n {...htmlAttributes}\n {...restProps}\n />\n <ChevronDownIcon className=\"ndl-icon-svg ndl-timezone-picker-icon\" />\n </div>\n </label>\n {errorToShow !== undefined && (\n <div className=\"ndl-timezone-picker-error-wrapper\" role=\"status\">\n <ExclamationCircleIconSolid className=\"ndl-timezone-picker-error-icon\" />\n <Typography\n variant={size === 'large' ? 'body-medium' : 'body-small'}\n className=\"ndl-timezone-picker-error-text\"\n htmlAttributes={{ id: errorTextId }}\n >\n {errorToShow}\n </Typography>\n </div>\n )}\n </div>\n\n {context.open && (\n <ConditionalWrap\n shouldWrap={isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal>{wrapChildren}</FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={context}\n modal={false}\n initialFocus={-1}\n >\n <div\n ref={refs.setFloating}\n className={classNames(\n themeClassName,\n 'ndl-timezone-picker-popover',\n {\n ...classes,\n },\n )}\n style={{\n ...transitionStyles,\n ...floatingStyles,\n width:\n isFluid === true\n ? containerRef.current?.clientWidth\n : undefined,\n }}\n {...getFloatingProps()}\n >\n <ul ref={listRef} role=\"listbox\" id={listboxId} tabIndex={-1}>\n {mode === 'both' ? (\n <>\n {utcOptions.length > 0 && (\n <>\n <li className=\"ndl-timezone-picker-section-header\">\n UTC Offsets\n </li>\n {utcOptions.map((option, i) => (\n <li\n id={`${listboxId}-option-${i}`}\n key={option.value}\n role=\"option\"\n aria-selected={value === option.value}\n value={option.value}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(option.value);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={classNames(\n focusedIndex === i ? 'focused' : '',\n 'ndl-timezone-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.stopPropagation();\n handleOnClick(option.value);\n }\n }}\n >\n {option.label}\n </li>\n ))}\n </>\n )}\n {cityOptions.length > 0 && (\n <>\n <li className=\"ndl-timezone-picker-section-header\">\n City-Based Timezones\n </li>\n {cityOptions.map((option, i) => {\n const adjustedIndex = i + utcOptions.length;\n return (\n <li\n id={`${listboxId}-option-${adjustedIndex}`}\n key={option.value}\n role=\"option\"\n aria-selected={value === option.value}\n value={option.value}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(option.value);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={classNames(\n focusedIndex === adjustedIndex ? 'focused' : '',\n 'ndl-timezone-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.stopPropagation();\n handleOnClick(option.value);\n }\n }}\n >\n {option.label}\n </li>\n );\n })}\n </>\n )}\n {utcOptions.length === 0 && cityOptions.length === 0 && (\n <li className=\"ndl-timezone-picker-popover-item ndl-timezone-picker-no-results\">\n No timezones found\n </li>\n )}\n </>\n ) : (\n <>\n {filteredOptions.length > 0 ? (\n filteredOptions.map((option, i) => (\n <li\n id={`${listboxId}-option-${i}`}\n key={option.value}\n role=\"option\"\n aria-selected={value === option.value}\n value={option.value}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n handleOnClick(option.value);\n setIsPopoverOpen(false);\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n tabIndex={-1}\n className={classNames(\n focusedIndex === i ? 'focused' : '',\n 'ndl-timezone-picker-popover-item',\n )}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n e.stopPropagation();\n handleOnClick(option.value);\n }\n }}\n >\n {option.label}\n </li>\n ))\n ) : (\n <li className=\"ndl-timezone-picker-popover-item ndl-timezone-picker-no-results\">\n No timezones found\n </li>\n )}\n </>\n )}\n </ul>\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n )}\n </>\n );\n};\n"]}
|
|
@@ -32,7 +32,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
32
32
|
*/
|
|
33
33
|
import { FloatingFocusManager, FloatingPortal, useMergeRefs, } from '@floating-ui/react';
|
|
34
34
|
import classNames from 'classnames';
|
|
35
|
-
import {
|
|
35
|
+
import React, { useEffect } from 'react';
|
|
36
36
|
import { ConditionalWrap } from '../conditional-wrap';
|
|
37
37
|
import { useIsInsideDialog } from '../dialog/dialog-context';
|
|
38
38
|
import { useNeedleTheme } from '../theme';
|
|
@@ -75,17 +75,25 @@ const TooltipTrigger = (_a) => {
|
|
|
75
75
|
'ndl-open': context.isOpen,
|
|
76
76
|
}, 'ndl-tooltip-trigger', className);
|
|
77
77
|
// `hasButtonWrapper=true` allows the user to pass any element as the anchor
|
|
78
|
-
if (hasButtonWrapper && isValidElement(children)) {
|
|
78
|
+
if (hasButtonWrapper && React.isValidElement(children)) {
|
|
79
79
|
const props = Object.assign(Object.assign(Object.assign({ className: triggerClasses }, htmlAttributes), childrenProps), { ref: mergedRefs });
|
|
80
|
-
return cloneElement(children, context.getReferenceProps(props));
|
|
80
|
+
return React.cloneElement(children, context.getReferenceProps(props));
|
|
81
81
|
}
|
|
82
82
|
return (_jsx("button", Object.assign({ type: "button", className: triggerClasses, style: style, ref: mergedRefs }, context.getReferenceProps(htmlAttributes), restProps, { children: children })));
|
|
83
83
|
};
|
|
84
84
|
const TooltipContent = (_a) => {
|
|
85
|
+
var _b;
|
|
85
86
|
var { children, style, htmlAttributes, className, ref } = _a, restProps = __rest(_a, ["children", "style", "htmlAttributes", "className", "ref"]);
|
|
86
87
|
const context = useTooltipContext();
|
|
87
88
|
const mergedRef = useMergeRefs([context.refs.setFloating, ref]);
|
|
88
89
|
const { themeClassName } = useNeedleTheme();
|
|
90
|
+
const hasHeaderChild = React.useMemo(() => {
|
|
91
|
+
if (context.type !== 'rich') {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const childrenArray = React.Children.toArray(children);
|
|
95
|
+
return childrenArray.some((child) => React.isValidElement(child) && child.type === TooltipHeader);
|
|
96
|
+
}, [children, context.type]);
|
|
89
97
|
if (!context.isOpen) {
|
|
90
98
|
return null;
|
|
91
99
|
}
|
|
@@ -96,16 +104,26 @@ const TooltipContent = (_a) => {
|
|
|
96
104
|
if (context.type === 'simple') {
|
|
97
105
|
return (_jsx(ConditionalWrap, { shouldWrap: context.isPortaled, wrap: (wrapChildren) => _jsx(FloatingPortal, { children: wrapChildren }), children: _jsx("div", Object.assign({ ref: mergedRef, className: classes, style: Object.assign(Object.assign({}, context.floatingStyles), style) }, restProps, context.getFloatingProps(htmlAttributes), { children: _jsx(Typography, { variant: "body-medium", children: children }) })) }));
|
|
98
106
|
}
|
|
99
|
-
|
|
107
|
+
const ariaLabelledBy = (_b = htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes['aria-labelledby']) !== null && _b !== void 0 ? _b : (hasHeaderChild ? context.headerId : undefined);
|
|
108
|
+
if ((htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes['aria-label']) === undefined && !ariaLabelledBy) {
|
|
109
|
+
console.warn('The rich Tooltip is missing aria-label and Header. Please add one of them for accessibility.');
|
|
110
|
+
}
|
|
111
|
+
return (_jsx(ConditionalWrap, { shouldWrap: context.isPortaled, wrap: (wrapChildren) => _jsx(FloatingPortal, { children: wrapChildren }), children: _jsx(FloatingFocusManager, { context: context.context, returnFocus: true, modal: false, initialFocus: 0, closeOnFocusOut: true, children: _jsx("div", Object.assign({ ref: mergedRef, className: classes, style: Object.assign(Object.assign({}, context.floatingStyles), style) }, restProps, context.getFloatingProps(Object.assign(Object.assign({}, htmlAttributes), { 'aria-labelledby': ariaLabelledBy })), { children: children })) }) }));
|
|
100
112
|
};
|
|
101
113
|
const TooltipHeader = (_a) => {
|
|
102
114
|
var { children, passThroughProps, typographyVariant = 'subheading-medium', className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["children", "passThroughProps", "typographyVariant", "className", "style", "htmlAttributes", "ref"]);
|
|
103
115
|
const context = useTooltipContext();
|
|
104
116
|
const classes = classNames('ndl-tooltip-header', className);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
var _a;
|
|
119
|
+
if (Boolean(htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes.id) === true) {
|
|
120
|
+
(_a = context.setHeaderId) === null || _a === void 0 ? void 0 : _a.call(context, htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes.id);
|
|
121
|
+
}
|
|
122
|
+
}, [context, htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes.id]);
|
|
105
123
|
if (!context.isOpen) {
|
|
106
124
|
return null;
|
|
107
125
|
}
|
|
108
|
-
return (_jsx(Typography, Object.assign({ ref: ref, variant: typographyVariant, className: classes, style: style, htmlAttributes: htmlAttributes }, passThroughProps, restProps, { children: children })));
|
|
126
|
+
return (_jsx(Typography, Object.assign({ ref: ref, variant: typographyVariant, className: classes, style: style, htmlAttributes: Object.assign(Object.assign({}, htmlAttributes), { id: context.headerId }) }, passThroughProps, restProps, { children: children })));
|
|
109
127
|
};
|
|
110
128
|
const TooltipBody = (_a) => {
|
|
111
129
|
var { children, className, style, htmlAttributes, passThroughProps, ref } = _a, restProps = __rest(_a, ["children", "className", "style", "htmlAttributes", "passThroughProps", "ref"]);
|
|
@@ -126,6 +144,7 @@ const Actions = (_a) => {
|
|
|
126
144
|
const classes = classNames('ndl-tooltip-actions', className);
|
|
127
145
|
return (_jsx("div", Object.assign({ className: classes, ref: mergedRefs, style: style }, restProps, htmlAttributes, { children: children })));
|
|
128
146
|
};
|
|
147
|
+
Actions.displayName = 'Tooltip.Actions';
|
|
129
148
|
const Tooltip = Object.assign(TooltipComponent, {
|
|
130
149
|
Actions: Actions,
|
|
131
150
|
Body: TooltipBody,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/tooltip/Tooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAEL,oBAAoB,EACpB,cAAc,EAGd,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,UAAU,EAA2B,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA+B9E,MAAM,gBAAgB,GAAG,CAAC,EACxB,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,aAAa,EACb,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,YAAY,EAC9B,UAAU,EACV,2BAA2B,EAC3B,iBAAiB,GACJ,EAAE,EAAE;IACjB,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IACvD,MAAM,UAAU,GAAG,CAAC,cAAc,CAAC;IAEnC,MAAM,OAAO,GAAG,UAAU,CAAC;QACzB,iBAAiB;QACjB,UAAU;QACV,UAAU;QACV,aAAa;QACb,2HAA2H;QAC3H,MAAM,EAAE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AC,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAC9C,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;CACxB,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n type AutoUpdateOptions,\n FloatingFocusManager,\n FloatingPortal,\n type Placement,\n type UseFloatingOptions,\n useMergeRefs,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { cloneElement, isValidElement } from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { useNeedleTheme } from '../theme';\nimport { Typography, type TypographyVariants } from '../typography';\nimport { TooltipContext, useTooltip, useTooltipContext } from './use-tooltip';\n\nexport type TooltipProps = {\n /** Content displayed inside the tooltip. Wraps `Tooltip.Trigger`, `Tooltip.Content`, and optional parts */\n children: React.ReactNode;\n /** Whether the tooltip is disabled */\n isDisabled?: boolean;\n /** Whether the tooltip should be open on first render */\n isInitialOpen?: boolean;\n /** Placement of the tooltip content relative to the trigger */\n placement?: Placement;\n /** Controls the open state . If omitted, the tooltip manages its own state */\n isOpen?: boolean;\n /** Visual style of the tooltip content. `simple` renders plain text, `rich` renders a composable panel */\n type: 'simple' | 'rich';\n /** Whether the content is rendered in a portal. */\n isPortaled?: boolean;\n /** Callback fired when the open state changes, if omitted, the tooltip manages its own state using internal hooks */\n onOpenChange?: UseFloatingOptions['onOpenChange'];\n /** Positioning strategy of the tooltip. Defaults to `fixed` when inside a dialog, otherwise `absolute` */\n floatingStrategy?: 'absolute' | 'fixed';\n /** Hover open/close delays in milliseconds */\n hoverDelay?: {\n open: number;\n close: number;\n };\n /** Whether the tooltip should close when the reference element is clicked. Useful when the trigger moves after click. */\n shouldCloseOnReferenceClick?: boolean;\n autoUpdateOptions?: AutoUpdateOptions;\n};\n\nconst TooltipComponent = ({\n children,\n isDisabled = false,\n type,\n isInitialOpen,\n placement,\n isOpen,\n onOpenChange,\n isPortaled: isPortaledProp,\n floatingStrategy: strategyProp,\n hoverDelay,\n shouldCloseOnReferenceClick,\n autoUpdateOptions,\n}: TooltipProps) => {\n const isInsideDialog = useIsInsideDialog();\n const strategy = isInsideDialog ? 'fixed' : 'absolute';\n const isPortaled = !isInsideDialog;\n\n const tooltip = useTooltip({\n autoUpdateOptions,\n hoverDelay,\n isDisabled,\n isInitialOpen,\n // if isDisabled is true tooltip will not open otherwise either controlled or uncontrolled depending on if isOpen is passed\n isOpen: isDisabled === true ? false : isOpen,\n isPortaled: isPortaledProp ?? isPortaled,\n onOpenChange,\n placement,\n shouldCloseOnReferenceClick,\n strategy: strategyProp ?? strategy,\n type,\n });\n\n return (\n <TooltipContext.Provider value={tooltip}>\n {children}\n </TooltipContext.Provider>\n );\n};\n\nTooltipComponent.displayName = 'Tooltip';\n\ntype TooltipTriggerProps = {\n /** Content displayed inside the trigger element */\n children: React.ReactNode;\n /** Whether the trigger element can be any element without an extra button wrapper. The child element will be cloned with the necessary trigger props and merged refs */\n hasButtonWrapper?: boolean;\n};\n\nconst TooltipTrigger = ({\n children,\n hasButtonWrapper = false,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'button', TooltipTriggerProps>) => {\n const context = useTooltipContext();\n\n // Example from floating-ui\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const childrenProps = (children as any).props;\n const mergedRefs = useMergeRefs([\n context.refs.setReference,\n ref,\n childrenProps?.ref,\n ]);\n\n const triggerClasses = classNames(\n {\n 'ndl-closed': !context.isOpen,\n 'ndl-open': context.isOpen,\n },\n 'ndl-tooltip-trigger',\n className,\n );\n\n // `hasButtonWrapper=true` allows the user to pass any element as the anchor\n if (hasButtonWrapper && isValidElement(children)) {\n const props: Record<string, unknown> = {\n className: triggerClasses,\n ...htmlAttributes,\n ...childrenProps,\n ref: mergedRefs,\n };\n return cloneElement(children, context.getReferenceProps(props));\n }\n\n return (\n <button\n type=\"button\"\n className={triggerClasses}\n style={style}\n ref={mergedRefs}\n {...context.getReferenceProps(htmlAttributes)}\n {...restProps}\n >\n {children}\n </button>\n );\n};\n\ntype TooltipContentProps = {\n /** Content displayed inside the tooltip */\n children: React.ReactNode;\n};\n\nconst TooltipContent = ({\n children,\n style,\n htmlAttributes,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', TooltipContentProps>) => {\n const context = useTooltipContext();\n const mergedRef = useMergeRefs([context.refs.setFloating, ref]);\n const { themeClassName } = useNeedleTheme();\n if (!context.isOpen) {\n return null;\n }\n\n const classes = classNames('ndl-tooltip-content', themeClassName, className, {\n 'ndl-tooltip-content-rich': context.type === 'rich',\n 'ndl-tooltip-content-simple': context.type === 'simple',\n });\n\n if (context.type === 'simple') {\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => <FloatingPortal>{wrapChildren}</FloatingPortal>}\n >\n <div\n ref={mergedRef}\n className={classes}\n style={{\n ...context.floatingStyles,\n ...style,\n }}\n {...restProps}\n {...context.getFloatingProps(htmlAttributes)}\n >\n <Typography variant=\"body-medium\">{children}</Typography>\n </div>\n </ConditionalWrap>\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => <FloatingPortal>{wrapChildren}</FloatingPortal>}\n >\n <FloatingFocusManager\n context={context.context}\n returnFocus={true}\n modal={false}\n initialFocus={-1}\n closeOnFocusOut\n >\n <div\n ref={mergedRef}\n className={classes}\n style={{\n ...context.floatingStyles,\n ...style,\n }}\n {...restProps}\n {...context.getFloatingProps(htmlAttributes)}\n >\n {children}\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n );\n};\n\ntype TooltipHeaderProps = {\n /** Content displayed inside the header */\n children: React.ReactNode;\n /** @deprecated Use `typographyVariant` instead */\n passThroughProps?: Partial<React.ComponentPropsWithoutRef<typeof Typography>>;\n typographyVariant?: TypographyVariants;\n};\n\nconst TooltipHeader = ({\n children,\n passThroughProps,\n typographyVariant = 'subheading-medium',\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', TooltipHeaderProps>) => {\n const context = useTooltipContext();\n\n const classes = classNames('ndl-tooltip-header', className);\n\n if (!context.isOpen) {\n return null;\n }\n\n return (\n <Typography\n ref={ref}\n variant={typographyVariant}\n className={classes}\n style={style}\n htmlAttributes={htmlAttributes}\n {...passThroughProps}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nexport type TooltipBodyProps = {\n /** Content displayed inside the body */\n children: React.ReactNode;\n /** Additional props to pass to the Typography component */\n // TODO v5: Deprecate passThroughProps and use restProps instead\n passThroughProps?: Partial<React.ComponentPropsWithoutRef<typeof Typography>>;\n};\n\nconst TooltipBody = ({\n children,\n className,\n style,\n htmlAttributes,\n passThroughProps,\n ref,\n ...restProps\n}: CommonProps<'span', TooltipBodyProps>) => {\n const context = useTooltipContext();\n\n const classes = classNames('ndl-tooltip-body', className);\n if (!context.isOpen) {\n return null;\n }\n\n return (\n <Typography\n ref={ref}\n variant=\"body-medium\"\n className={classes}\n style={style}\n htmlAttributes={htmlAttributes}\n {...passThroughProps}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\ntype ToolTipActionsProps = {\n /** Content displayed inside the actions container */\n children: React.ReactNode;\n};\n\nconst Actions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ToolTipActionsProps>) => {\n const context = useTooltipContext();\n const mergedRefs = useMergeRefs([context.refs.setFloating, ref]);\n\n if (!context.isOpen) {\n return null;\n }\n\n const classes = classNames('ndl-tooltip-actions', className);\n\n return (\n <div\n className={classes}\n ref={mergedRefs}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\nconst Tooltip = Object.assign(TooltipComponent, {\n Actions: Actions,\n Body: TooltipBody,\n Content: TooltipContent,\n Header: TooltipHeader,\n Trigger: TooltipTrigger,\n});\n\nexport { Tooltip };\n"]}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/tooltip/Tooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAEL,oBAAoB,EACpB,cAAc,EAGd,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,UAAU,EAA2B,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA+B9E,MAAM,gBAAgB,GAAG,CAAC,EACxB,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,aAAa,EACb,SAAS,EACT,MAAM,EACN,YAAY,EACZ,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,YAAY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AAE,GAAG,CAAC,CAAC,CAAC;IAEjE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;IAE7D,OAAO,CACL,4BACE,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK,IACR,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAExC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAC9C,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;CACxB,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n type AutoUpdateOptions,\n FloatingFocusManager,\n FloatingPortal,\n type Placement,\n type UseFloatingOptions,\n useMergeRefs,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport React, { useEffect } from 'react';\n\nimport { type CommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { useNeedleTheme } from '../theme';\nimport { Typography, type TypographyVariants } from '../typography';\nimport { TooltipContext, useTooltip, useTooltipContext } from './use-tooltip';\n\nexport type TooltipProps = {\n /** Content displayed inside the tooltip. Wraps `Tooltip.Trigger`, `Tooltip.Content`, and optional parts */\n children: React.ReactNode;\n /** Whether the tooltip is disabled */\n isDisabled?: boolean;\n /** Whether the tooltip should be open on first render */\n isInitialOpen?: boolean;\n /** Placement of the tooltip content relative to the trigger */\n placement?: Placement;\n /** Controls the open state . If omitted, the tooltip manages its own state */\n isOpen?: boolean;\n /** Visual style of the tooltip content. `simple` renders plain text, `rich` renders a composable panel */\n type: 'simple' | 'rich';\n /** Whether the content is rendered in a portal. */\n isPortaled?: boolean;\n /** Callback fired when the open state changes, if omitted, the tooltip manages its own state using internal hooks */\n onOpenChange?: UseFloatingOptions['onOpenChange'];\n /** Positioning strategy of the tooltip. Defaults to `fixed` when inside a dialog, otherwise `absolute` */\n floatingStrategy?: 'absolute' | 'fixed';\n /** Hover open/close delays in milliseconds */\n hoverDelay?: {\n open: number;\n close: number;\n };\n /** Whether the tooltip should close when the reference element is clicked. Useful when the trigger moves after click. */\n shouldCloseOnReferenceClick?: boolean;\n autoUpdateOptions?: AutoUpdateOptions;\n};\n\nconst TooltipComponent = ({\n children,\n isDisabled = false,\n type,\n isInitialOpen,\n placement,\n isOpen,\n onOpenChange,\n isPortaled: isPortaledProp,\n floatingStrategy: strategyProp,\n hoverDelay,\n shouldCloseOnReferenceClick,\n autoUpdateOptions,\n}: TooltipProps) => {\n const isInsideDialog = useIsInsideDialog();\n const strategy = isInsideDialog ? 'fixed' : 'absolute';\n const isPortaled = !isInsideDialog;\n\n const tooltip = useTooltip({\n autoUpdateOptions,\n hoverDelay,\n isDisabled,\n isInitialOpen,\n // if isDisabled is true tooltip will not open otherwise either controlled or uncontrolled depending on if isOpen is passed\n isOpen: isDisabled === true ? false : isOpen,\n isPortaled: isPortaledProp ?? isPortaled,\n onOpenChange,\n placement,\n shouldCloseOnReferenceClick,\n strategy: strategyProp ?? strategy,\n type,\n });\n\n return (\n <TooltipContext.Provider value={tooltip}>\n {children}\n </TooltipContext.Provider>\n );\n};\n\nTooltipComponent.displayName = 'Tooltip';\n\ntype TooltipTriggerProps = {\n /** Content displayed inside the trigger element */\n children: React.ReactNode;\n /** Whether the trigger element can be any element without an extra button wrapper. The child element will be cloned with the necessary trigger props and merged refs */\n hasButtonWrapper?: boolean;\n};\n\nconst TooltipTrigger = ({\n children,\n hasButtonWrapper = false,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'button', TooltipTriggerProps>) => {\n const context = useTooltipContext();\n\n // Example from floating-ui\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const childrenProps = (children as any).props;\n const mergedRefs = useMergeRefs([\n context.refs.setReference,\n ref,\n childrenProps?.ref,\n ]);\n\n const triggerClasses = classNames(\n {\n 'ndl-closed': !context.isOpen,\n 'ndl-open': context.isOpen,\n },\n 'ndl-tooltip-trigger',\n className,\n );\n\n // `hasButtonWrapper=true` allows the user to pass any element as the anchor\n if (hasButtonWrapper && React.isValidElement(children)) {\n const props: Record<string, unknown> = {\n className: triggerClasses,\n ...htmlAttributes,\n ...childrenProps,\n ref: mergedRefs,\n };\n return React.cloneElement(children, context.getReferenceProps(props));\n }\n\n return (\n <button\n type=\"button\"\n className={triggerClasses}\n style={style}\n ref={mergedRefs}\n {...context.getReferenceProps(htmlAttributes)}\n {...restProps}\n >\n {children}\n </button>\n );\n};\n\ntype TooltipContentProps = {\n /** Content displayed inside the tooltip */\n children: React.ReactNode;\n};\n\nconst TooltipContent = ({\n children,\n style,\n htmlAttributes,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', TooltipContentProps>) => {\n const context = useTooltipContext();\n const mergedRef = useMergeRefs([context.refs.setFloating, ref]);\n const { themeClassName } = useNeedleTheme();\n\n const hasHeaderChild = React.useMemo(() => {\n if (context.type !== 'rich') {\n return false;\n }\n const childrenArray = React.Children.toArray(children);\n return childrenArray.some(\n (child) => React.isValidElement(child) && child.type === TooltipHeader,\n );\n }, [children, context.type]);\n\n if (!context.isOpen) {\n return null;\n }\n\n const classes = classNames('ndl-tooltip-content', themeClassName, className, {\n 'ndl-tooltip-content-rich': context.type === 'rich',\n 'ndl-tooltip-content-simple': context.type === 'simple',\n });\n\n if (context.type === 'simple') {\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => <FloatingPortal>{wrapChildren}</FloatingPortal>}\n >\n <div\n ref={mergedRef}\n className={classes}\n style={{\n ...context.floatingStyles,\n ...style,\n }}\n {...restProps}\n {...context.getFloatingProps(htmlAttributes)}\n >\n <Typography variant=\"body-medium\">{children}</Typography>\n </div>\n </ConditionalWrap>\n );\n }\n\n const ariaLabelledBy =\n htmlAttributes?.['aria-labelledby'] ??\n (hasHeaderChild ? context.headerId : undefined);\n\n if (htmlAttributes?.['aria-label'] === undefined && !ariaLabelledBy) {\n console.warn(\n 'The rich Tooltip is missing aria-label and Header. Please add one of them for accessibility.',\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => <FloatingPortal>{wrapChildren}</FloatingPortal>}\n >\n <FloatingFocusManager\n context={context.context}\n returnFocus={true}\n modal={false}\n initialFocus={0}\n closeOnFocusOut\n >\n <div\n ref={mergedRef}\n className={classes}\n style={{\n ...context.floatingStyles,\n ...style,\n }}\n {...restProps}\n {...context.getFloatingProps({\n ...htmlAttributes,\n 'aria-labelledby': ariaLabelledBy,\n })}\n >\n {children}\n </div>\n </FloatingFocusManager>\n </ConditionalWrap>\n );\n};\n\ntype TooltipHeaderProps = {\n /** Content displayed inside the header */\n children: React.ReactNode;\n /** @deprecated Use `typographyVariant` instead */\n passThroughProps?: Partial<React.ComponentPropsWithoutRef<typeof Typography>>;\n typographyVariant?: TypographyVariants;\n};\n\nconst TooltipHeader = ({\n children,\n passThroughProps,\n typographyVariant = 'subheading-medium',\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', TooltipHeaderProps>) => {\n const context = useTooltipContext();\n\n const classes = classNames('ndl-tooltip-header', className);\n\n useEffect(() => {\n if (Boolean(htmlAttributes?.id) === true) {\n context.setHeaderId?.(htmlAttributes?.id);\n }\n }, [context, htmlAttributes?.id]);\n\n if (!context.isOpen) {\n return null;\n }\n\n return (\n <Typography\n ref={ref}\n variant={typographyVariant}\n className={classes}\n style={style}\n htmlAttributes={{ ...htmlAttributes, id: context.headerId }}\n {...passThroughProps}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nexport type TooltipBodyProps = {\n /** Content displayed inside the body */\n children: React.ReactNode;\n /** Additional props to pass to the Typography component */\n // TODO v5: Deprecate passThroughProps and use restProps instead\n passThroughProps?: Partial<React.ComponentPropsWithoutRef<typeof Typography>>;\n};\n\nconst TooltipBody = ({\n children,\n className,\n style,\n htmlAttributes,\n passThroughProps,\n ref,\n ...restProps\n}: CommonProps<'span', TooltipBodyProps>) => {\n const context = useTooltipContext();\n\n const classes = classNames('ndl-tooltip-body', className);\n if (!context.isOpen) {\n return null;\n }\n\n return (\n <Typography\n ref={ref}\n variant=\"body-medium\"\n className={classes}\n style={style}\n htmlAttributes={htmlAttributes}\n {...passThroughProps}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\ntype ToolTipActionsProps = {\n /** Content displayed inside the actions container */\n children: React.ReactNode;\n};\n\nconst Actions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ToolTipActionsProps>) => {\n const context = useTooltipContext();\n const mergedRefs = useMergeRefs([context.refs.setFloating, ref]);\n\n if (!context.isOpen) {\n return null;\n }\n\n const classes = classNames('ndl-tooltip-actions', className);\n\n return (\n <div\n className={classes}\n ref={mergedRefs}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\nActions.displayName = 'Tooltip.Actions';\n\nconst Tooltip = Object.assign(TooltipComponent, {\n Actions: Actions,\n Body: TooltipBody,\n Content: TooltipContent,\n Header: TooltipHeader,\n Trigger: TooltipTrigger,\n});\n\nexport { Tooltip };\n"]}
|
|
@@ -27,6 +27,7 @@ export { default as TooltipInDialog } from './tooltip-in-dialog.story';
|
|
|
27
27
|
export { default as TooltipHoverDelay } from './tooltip-hover-delay.story';
|
|
28
28
|
export { default as TooltipTriggerButtonWrapper } from './tooltip-trigger-button-wrapper.story';
|
|
29
29
|
export { default as TooltipRich } from './tooltip-rich.story';
|
|
30
|
+
export { default as TooltipRichActions } from './tooltip-rich-actions.story';
|
|
30
31
|
export { default as TooltipRichLink } from './tooltip-rich-link.story';
|
|
31
32
|
export { default as TooltipWithKeyboardShortcut } from './tooltip-with-keyboard-shortcut.story';
|
|
32
33
|
import { removeLicenseHeader } from '../../_common/export-stories-utils';
|
|
@@ -38,6 +39,7 @@ import TooltipInDialogSourceRaw from './tooltip-in-dialog.story?raw';
|
|
|
38
39
|
import TooltipInitialOpenSourceRaw from './tooltip-initial-open.story?raw';
|
|
39
40
|
import TooltipPlacementsSourceRaw from './tooltip-placements.story?raw';
|
|
40
41
|
import TooltipRichSourceRaw from './tooltip-rich.story?raw';
|
|
42
|
+
import TooltipRichActionsSourceRaw from './tooltip-rich-actions.story?raw';
|
|
41
43
|
import TooltipRichLinkSourceRaw from './tooltip-rich-link.story?raw';
|
|
42
44
|
import TooltipTriggerButtonWrapperSourceRaw from './tooltip-trigger-button-wrapper.story?raw';
|
|
43
45
|
import TooltipWithKeyboardShortcutSourceRaw from './tooltip-with-keyboard-shortcut.story?raw';
|
|
@@ -48,8 +50,9 @@ export const TooltipInitialOpenSource = removeLicenseHeader(TooltipInitialOpenSo
|
|
|
48
50
|
export const TooltipPlacementsSource = removeLicenseHeader(TooltipPlacementsSourceRaw);
|
|
49
51
|
export const TooltipInDialogSource = removeLicenseHeader(TooltipInDialogSourceRaw);
|
|
50
52
|
export const TooltipHoverDelaySource = removeLicenseHeader(TooltipHoverDelaySourceRaw);
|
|
51
|
-
export const TooltipTriggerButtonWrapperSource = removeLicenseHeader(TooltipTriggerButtonWrapperSourceRaw);
|
|
52
53
|
export const TooltipRichSource = removeLicenseHeader(TooltipRichSourceRaw);
|
|
54
|
+
export const TooltipRichActionsSource = removeLicenseHeader(TooltipRichActionsSourceRaw);
|
|
53
55
|
export const TooltipRichLinkSource = removeLicenseHeader(TooltipRichLinkSourceRaw);
|
|
56
|
+
export const TooltipTriggerButtonWrapperSource = removeLicenseHeader(TooltipTriggerButtonWrapperSourceRaw);
|
|
54
57
|
export const TooltipWithKeyboardShortcutSource = removeLicenseHeader(TooltipWithKeyboardShortcutSourceRaw);
|
|
55
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tooltip/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAChG,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EA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,oCAAoC,MAAM,4CAA4C,CAAC;AAC9F,OAAO,oCAAoC,MAAM,4CAA4C,CAAC;AAE9F,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CACrD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CACxD,0BAA0B,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CACxD,0BAA0B,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CACxD,0BAA0B,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CACzD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC;AACF,MAAM,CAAC,MAAM,iCAAiC,GAAG,mBAAmB,CAClE,oCAAoC,CACrC,CAAC;AACF,MAAM,CAAC,MAAM,iCAAiC,GAAG,mBAAmB,CAClE,oCAAoC,CACrC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as TooltipDefault } from './tooltip-default.story';\nexport { default as TooltipDisabled } from './tooltip-disabled.story';\nexport { default as TooltipControlled } from './tooltip-controlled.story';\nexport { default as TooltipInitialOpen } from './tooltip-initial-open.story';\nexport { default as TooltipPlacements } from './tooltip-placements.story';\nexport { default as TooltipInDialog } from './tooltip-in-dialog.story';\nexport { default as TooltipHoverDelay } from './tooltip-hover-delay.story';\nexport { default as TooltipTriggerButtonWrapper } from './tooltip-trigger-button-wrapper.story';\nexport { default as TooltipRich } from './tooltip-rich.story';\nexport { default as TooltipRichActions } from './tooltip-rich-actions.story';\nexport { default as TooltipRichLink } from './tooltip-rich-link.story';\nexport { default as TooltipWithKeyboardShortcut } from './tooltip-with-keyboard-shortcut.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport TooltipControlledSourceRaw from './tooltip-controlled.story?raw';\nimport TooltipDefaultSourceRaw from './tooltip-default.story?raw';\nimport TooltipDisabledSourceRaw from './tooltip-disabled.story?raw';\nimport TooltipHoverDelaySourceRaw from './tooltip-hover-delay.story?raw';\nimport TooltipInDialogSourceRaw from './tooltip-in-dialog.story?raw';\nimport TooltipInitialOpenSourceRaw from './tooltip-initial-open.story?raw';\nimport TooltipPlacementsSourceRaw from './tooltip-placements.story?raw';\nimport TooltipRichSourceRaw from './tooltip-rich.story?raw';\nimport TooltipRichActionsSourceRaw from './tooltip-rich-actions.story?raw';\nimport TooltipRichLinkSourceRaw from './tooltip-rich-link.story?raw';\nimport TooltipTriggerButtonWrapperSourceRaw from './tooltip-trigger-button-wrapper.story?raw';\nimport TooltipWithKeyboardShortcutSourceRaw from './tooltip-with-keyboard-shortcut.story?raw';\n\nexport const TooltipDefaultSource = removeLicenseHeader(\n TooltipDefaultSourceRaw,\n);\nexport const TooltipDisabledSource = removeLicenseHeader(\n TooltipDisabledSourceRaw,\n);\nexport const TooltipControlledSource = removeLicenseHeader(\n TooltipControlledSourceRaw,\n);\nexport const TooltipInitialOpenSource = removeLicenseHeader(\n TooltipInitialOpenSourceRaw,\n);\nexport const TooltipPlacementsSource = removeLicenseHeader(\n TooltipPlacementsSourceRaw,\n);\nexport const TooltipInDialogSource = removeLicenseHeader(\n TooltipInDialogSourceRaw,\n);\nexport const TooltipHoverDelaySource = removeLicenseHeader(\n TooltipHoverDelaySourceRaw,\n);\nexport const TooltipRichSource = removeLicenseHeader(TooltipRichSourceRaw);\nexport const TooltipRichActionsSource = removeLicenseHeader(\n TooltipRichActionsSourceRaw,\n);\nexport const TooltipRichLinkSource = removeLicenseHeader(\n TooltipRichLinkSourceRaw,\n);\nexport const TooltipTriggerButtonWrapperSource = removeLicenseHeader(\n TooltipTriggerButtonWrapperSourceRaw,\n);\nexport const TooltipWithKeyboardShortcutSource = removeLicenseHeader(\n TooltipWithKeyboardShortcutSourceRaw,\n);\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
23
|
+
import { FilledButton, OutlinedButton, TextButton, Tooltip, } from '@neo4j-ndl/react';
|
|
24
|
+
const Component = () => {
|
|
25
|
+
return (_jsxs(Tooltip, { type: "rich", children: [_jsx(Tooltip.Trigger, { hasButtonWrapper: true, children: _jsx(FilledButton, { size: "medium", children: "Click me!" }) }), _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Header, { children: "Header" }), _jsx(Tooltip.Body, { children: "This rich tooltip demonstrates all the available subcomponents: Header, Body, and Actions." }), _jsxs(Tooltip.Actions, { children: [_jsx(OutlinedButton, { onClick: () => alert('Primary action'), children: "Action" }), _jsx(TextButton, { onClick: () => alert('Secondary action'), children: "Action" })] })] })] }));
|
|
26
|
+
};
|
|
27
|
+
export default Component;
|
|
28
|
+
//# sourceMappingURL=tooltip-rich-actions.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip-rich-actions.story.js","sourceRoot":"","sources":["../../../../src/tooltip/stories/tooltip-rich-actions.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,UAAU,EACV,OAAO,GACR,MAAM,kBAAkB,CAAC;AAE1B,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,MAAC,OAAO,IAAC,IAAI,EAAC,MAAM,aAClB,KAAC,OAAO,CAAC,OAAO,IAAC,gBAAgB,kBAC/B,KAAC,YAAY,IAAC,IAAI,EAAC,QAAQ,0BAAyB,GACpC,EAClB,MAAC,OAAO,CAAC,OAAO,eACd,KAAC,OAAO,CAAC,MAAM,yBAAwB,EACvC,KAAC,OAAO,CAAC,IAAI,6GAGE,EACf,MAAC,OAAO,CAAC,OAAO,eACd,KAAC,cAAc,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,uBAErC,EACjB,KAAC,UAAU,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,uBAEvC,IACG,IACF,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport {\n FilledButton,\n OutlinedButton,\n TextButton,\n Tooltip,\n} from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <Tooltip type=\"rich\">\n <Tooltip.Trigger hasButtonWrapper>\n <FilledButton size=\"medium\">Click me!</FilledButton>\n </Tooltip.Trigger>\n <Tooltip.Content>\n <Tooltip.Header>Header</Tooltip.Header>\n <Tooltip.Body>\n This rich tooltip demonstrates all the available subcomponents:\n Header, Body, and Actions.\n </Tooltip.Body>\n <Tooltip.Actions>\n <OutlinedButton onClick={() => alert('Primary action')}>\n Action\n </OutlinedButton>\n <TextButton onClick={() => alert('Secondary action')}>\n Action\n </TextButton>\n </Tooltip.Actions>\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -20,9 +20,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
20
20
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
21
|
*/
|
|
22
22
|
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
|
|
23
|
-
import { FilledButton,
|
|
23
|
+
import { FilledButton, Tooltip } from '@neo4j-ndl/react';
|
|
24
24
|
const Component = () => {
|
|
25
|
-
return (_jsxs(Tooltip, { type: "rich", children: [_jsx(Tooltip.Trigger, { hasButtonWrapper: true, children: _jsx(FilledButton, { size: "medium", children: "Click me!" }) }), _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Header, { children: "Header" }), _jsx(Tooltip.Body, { children: "This rich tooltip demonstrates all the available subcomponents: Header
|
|
25
|
+
return (_jsxs(Tooltip, { type: "rich", children: [_jsx(Tooltip.Trigger, { hasButtonWrapper: true, children: _jsx(FilledButton, { size: "medium", children: "Click me!" }) }), _jsxs(Tooltip.Content, { children: [_jsx(Tooltip.Header, { children: "Header" }), _jsx(Tooltip.Body, { children: "This rich tooltip demonstrates all the available subcomponents: Header and Body, without Actions." })] })] }));
|
|
26
26
|
};
|
|
27
27
|
export default Component;
|
|
28
28
|
//# sourceMappingURL=tooltip-rich.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-rich.story.js","sourceRoot":"","sources":["../../../../src/tooltip/stories/tooltip-rich.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,
|
|
1
|
+
{"version":3,"file":"tooltip-rich.story.js","sourceRoot":"","sources":["../../../../src/tooltip/stories/tooltip-rich.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,MAAC,OAAO,IAAC,IAAI,EAAC,MAAM,aAClB,KAAC,OAAO,CAAC,OAAO,IAAC,gBAAgB,kBAC/B,KAAC,YAAY,IAAC,IAAI,EAAC,QAAQ,0BAAyB,GACpC,EAClB,MAAC,OAAO,CAAC,OAAO,eACd,KAAC,OAAO,CAAC,MAAM,yBAAwB,EACvC,KAAC,OAAO,CAAC,IAAI,oHAGE,IACC,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { FilledButton, Tooltip } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <Tooltip type=\"rich\">\n <Tooltip.Trigger hasButtonWrapper>\n <FilledButton size=\"medium\">Click me!</FilledButton>\n </Tooltip.Trigger>\n <Tooltip.Content>\n <Tooltip.Header>Header</Tooltip.Header>\n <Tooltip.Body>\n This rich tooltip demonstrates all the available subcomponents: Header\n and Body, without Actions.\n </Tooltip.Body>\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -19,11 +19,14 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
import { autoUpdate, flip, offset, safePolygon, shift, useClick, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole, } from '@floating-ui/react';
|
|
22
|
-
import { createContext, useContext, useMemo, useState } from 'react';
|
|
22
|
+
import { createContext, useContext, useId, useMemo, useRef, useState, } from 'react';
|
|
23
23
|
export function useTooltip({ isInitialOpen = false, placement = 'top', isOpen: controlledOpen, onOpenChange: setControlledOpen, type = 'simple', isPortaled = true, strategy = 'absolute', hoverDelay = undefined, shouldCloseOnReferenceClick = false, autoUpdateOptions, isDisabled = false, } = {}) {
|
|
24
|
+
const id = useId();
|
|
25
|
+
const [headerId, setHeaderId] = useState(id);
|
|
24
26
|
const [isUncontrolledOpen, setIsUncontrolledOpen] = useState(isInitialOpen);
|
|
25
27
|
const isOpen = controlledOpen !== null && controlledOpen !== void 0 ? controlledOpen : isUncontrolledOpen;
|
|
26
28
|
const setOpen = setControlledOpen !== null && setControlledOpen !== void 0 ? setControlledOpen : setIsUncontrolledOpen;
|
|
29
|
+
const typeOpenedRef = useRef(null);
|
|
27
30
|
const data = useFloating({
|
|
28
31
|
middleware: [
|
|
29
32
|
offset(5),
|
|
@@ -66,10 +69,22 @@ export function useTooltip({ isInitialOpen = false, placement = 'top', isOpen: c
|
|
|
66
69
|
role: type === 'simple' ? 'tooltip' : 'dialog',
|
|
67
70
|
});
|
|
68
71
|
const interactions = useInteractions([hover, focus, dismiss, role, click]);
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
const setTypeOpened = (type) => {
|
|
73
|
+
typeOpenedRef.current = type;
|
|
74
|
+
};
|
|
75
|
+
return useMemo(() => (Object.assign(Object.assign({ headerId: type === 'rich' ? headerId : undefined, isOpen,
|
|
76
|
+
isPortaled, setHeaderId: type === 'rich' ? setHeaderId : undefined, setOpen,
|
|
77
|
+
setTypeOpened,
|
|
78
|
+
type, typeOpened: typeOpenedRef.current }, interactions), data)), [
|
|
79
|
+
headerId,
|
|
80
|
+
isOpen,
|
|
71
81
|
setOpen,
|
|
72
|
-
type
|
|
82
|
+
type,
|
|
83
|
+
typeOpenedRef,
|
|
84
|
+
isPortaled,
|
|
85
|
+
interactions,
|
|
86
|
+
data,
|
|
87
|
+
]);
|
|
73
88
|
}
|
|
74
89
|
export const TooltipContext = createContext(null);
|
|
75
90
|
export const useTooltipContext = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tooltip.js","sourceRoot":"","sources":["../../../src/tooltip/use-tooltip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EAEV,IAAI,EACJ,MAAM,EAGN,WAAW,EACX,KAAK,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EAGX,QAAQ,EACR,QAAQ,EACR,eAAe,EAEf,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"use-tooltip.js","sourceRoot":"","sources":["../../../src/tooltip/use-tooltip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EAEV,IAAI,EACJ,MAAM,EAGN,WAAW,EACX,KAAK,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EAGX,QAAQ,EACR,QAAQ,EACR,eAAe,EAEf,OAAO,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,UAAU,EACV,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAoBf,MAAM,UAAU,UAAU,CAAC,EACzB,aAAa,GAAG,KAAK,EACrB,SAAS,GAAG,KAAK,EACjB,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,iBAAiB,EAC/B,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,IAAI,EACjB,QAAQ,GAAG,UAAU,EACrB,UAAU,GAAG,SAAS,EACtB,2BAA2B,GAAG,KAAK,EACnC,iBAAiB,EACjB,UAAU,GAAG,KAAK,MACA,EAAE;IAWpB,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAqB,EAAE,CAAC,CAAC;IACjE,MAAM,CAAC,kBAAk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,UAAU,CAAC,cAAc,CAAC,CAAC;IAE3C,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n type AutoUpdateOptions,\n flip,\n offset,\n type Placement,\n type ReferenceType,\n safePolygon,\n shift,\n useClick,\n useDismiss,\n useFloating,\n type UseFloatingOptions,\n type UseFloatingReturn,\n useFocus,\n useHover,\n useInteractions,\n type UseInteractionsReturn,\n useRole,\n} from '@floating-ui/react';\nimport {\n createContext,\n useContext,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nexport interface TooltipOptions {\n isInitialOpen?: boolean;\n placement?: Placement;\n isOpen?: boolean;\n onOpenChange?: UseFloatingOptions['onOpenChange'];\n type?: 'simple' | 'rich';\n isPortaled?: boolean;\n strategy?: 'fixed' | 'absolute';\n hoverDelay?: {\n open: number;\n close: number;\n };\n shouldCloseOnReferenceClick?: boolean;\n autoUpdateOptions?: AutoUpdateOptions;\n isDisabled?: boolean;\n typeOpened?: 'keyboard' | 'mouse';\n}\n\nexport function useTooltip({\n isInitialOpen = false,\n placement = 'top',\n isOpen: controlledOpen,\n onOpenChange: setControlledOpen,\n type = 'simple',\n isPortaled = true,\n strategy = 'absolute',\n hoverDelay = undefined,\n shouldCloseOnReferenceClick = false,\n autoUpdateOptions,\n isDisabled = false,\n}: TooltipOptions = {}): {\n headerId?: string;\n setHeaderId?: (id: string | undefined) => void;\n isOpen: boolean;\n setOpen: (open: boolean) => void;\n type: 'simple' | 'rich';\n isPortaled: boolean;\n typeOpened: 'keyboard' | 'mouse' | null;\n setTypeOpened: (type: 'keyboard' | 'mouse' | null) => void;\n} & UseInteractionsReturn &\n UseFloatingReturn<ReferenceType> {\n const id = useId();\n const [headerId, setHeaderId] = useState<string | undefined>(id);\n const [isUncontrolledOpen, setIsUncontrolledOpen] = useState(isInitialOpen);\n const isOpen = controlledOpen ?? isUncontrolledOpen;\n const setOpen = setControlledOpen ?? setIsUncontrolledOpen;\n const typeOpenedRef = useRef<'keyboard' | 'mouse'>(null);\n\n const data = useFloating({\n middleware: [\n offset(5),\n flip({\n crossAxis: placement.includes('-'),\n fallbackAxisSideDirection: 'start',\n padding: 5,\n }),\n shift({ padding: 5 }),\n ],\n onOpenChange: setOpen,\n open: isOpen,\n placement,\n strategy,\n whileElementsMounted(referenceEl, floatingEl, update) {\n const cleanup = autoUpdate(referenceEl, floatingEl, update, {\n ...autoUpdateOptions,\n });\n return cleanup;\n },\n });\n\n const context = data.context;\n\n const hover = useHover(context, {\n delay: hoverDelay,\n enabled: type === 'simple' && !isDisabled,\n handleClose: safePolygon(),\n move: false,\n });\n const click = useClick(context, {\n enabled: type === 'rich' && !isDisabled,\n });\n const focus = useFocus(context, {\n enabled: type === 'simple' && !isDisabled,\n visibleOnly: true,\n });\n const dismiss = useDismiss(context, {\n escapeKey: true,\n outsidePress: true,\n referencePress: shouldCloseOnReferenceClick,\n });\n const role = useRole(context, {\n role: type === 'simple' ? 'tooltip' : 'dialog',\n });\n\n const interactions = useInteractions([hover, focus, dismiss, role, click]);\n\n const setTypeOpened = (type: 'keyboard' | 'mouse' | null) => {\n typeOpenedRef.current = type;\n };\n\n return useMemo(\n () => ({\n headerId: type === 'rich' ? headerId : undefined,\n isOpen,\n isPortaled,\n setHeaderId: type === 'rich' ? setHeaderId : undefined,\n setOpen,\n setTypeOpened,\n type,\n typeOpened: typeOpenedRef.current,\n ...interactions,\n ...data,\n }),\n [\n headerId,\n isOpen,\n setOpen,\n type,\n typeOpenedRef,\n isPortaled,\n interactions,\n data,\n ],\n );\n}\n\ntype ContextType = ReturnType<typeof useTooltip> | null;\nexport const TooltipContext = createContext<ContextType>(null);\n\nexport const useTooltipContext = (): ReturnType<typeof useTooltip> => {\n const context = useContext(TooltipContext);\n\n if (context === null) {\n throw new Error('Tooltip components must be wrapped in <Tooltip />');\n }\n\n return context;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimePicker.d.ts","sourceRoot":"","sources":["../../../src/time-picker/TimePicker.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAO/D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,mCAAmC;IACnC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,oCAAoC;IACpC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;I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