@bitrise/bitkit-v2 0.3.462-beta.2927 → 0.3.463
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/AGENTS.md +1 -1
- package/dist/components/BitkitCombobox/BitkitCombobox.d.ts +3 -3
- package/dist/components/BitkitCombobox/BitkitCombobox.js +2 -6
- package/dist/components/BitkitCombobox/BitkitCombobox.js.map +1 -1
- package/dist/components/BitkitDefinitionTooltip/BitkitDefinitionTooltip.d.ts +12 -12
- package/dist/components/BitkitDefinitionTooltip/BitkitDefinitionTooltip.js +20 -22
- package/dist/components/BitkitDefinitionTooltip/BitkitDefinitionTooltip.js.map +1 -1
- package/dist/components/BitkitLabeledData/BitkitLabeledData.d.ts +3 -3
- package/dist/components/BitkitLabeledData/BitkitLabeledData.js +11 -2
- package/dist/components/BitkitLabeledData/BitkitLabeledData.js.map +1 -1
- package/dist/components/BitkitMultiselect/BitkitMultiselect.d.ts +3 -3
- package/dist/components/BitkitMultiselect/BitkitMultiselect.js +1 -4
- package/dist/components/BitkitMultiselect/BitkitMultiselect.js.map +1 -1
- package/dist/components/BitkitMultiselectMenu/BitkitMultiselectMenu.d.ts +3 -3
- package/dist/components/BitkitMultiselectMenu/BitkitMultiselectMenu.js.map +1 -1
- package/dist/components/BitkitSelect/BitkitSelect.d.ts +3 -3
- package/dist/components/BitkitSelect/BitkitSelect.js +1 -4
- package/dist/components/BitkitSelect/BitkitSelect.js.map +1 -1
- package/dist/components/BitkitSelectMenu/BitkitSelectMenu.d.ts +2 -7
- package/dist/components/BitkitSelectMenu/BitkitSelectMenu.js.map +1 -1
- package/dist/components/BitkitSelectMenu/SelectMenuShell.d.ts +3 -3
- package/dist/components/BitkitSelectMenu/SelectMenuShell.js +4 -22
- package/dist/components/BitkitSelectMenu/SelectMenuShell.js.map +1 -1
- package/dist/components/BitkitTable/BitkitDefinitionColumnHeader.d.ts +1 -1
- package/dist/components/BitkitTable/BitkitDefinitionColumnHeader.js +16 -19
- package/dist/components/BitkitTable/BitkitDefinitionColumnHeader.js.map +1 -1
- package/dist/components/BitkitToggletip/BitkitToggletip.d.ts +59 -0
- package/dist/components/BitkitToggletip/BitkitToggletip.js +107 -0
- package/dist/components/BitkitToggletip/BitkitToggletip.js.map +1 -0
- package/dist/components/BitkitTooltip/BitkitTooltip.d.ts +7 -23
- package/dist/components/BitkitTooltip/BitkitTooltip.js +14 -45
- package/dist/components/BitkitTooltip/BitkitTooltip.js.map +1 -1
- package/dist/components/BitkitTreeView/BitkitTreeView.js +4 -1
- package/dist/components/BitkitTreeView/BitkitTreeView.js.map +1 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/main.js +2 -4
- package/dist/theme/common/TooltipAndToggletip.common.d.ts +90 -0
- package/dist/theme/common/TooltipAndToggletip.common.js +72 -0
- package/dist/theme/common/TooltipAndToggletip.common.js.map +1 -0
- package/dist/theme/slot-recipes/DatePickerSelect.recipe.d.ts +2 -14
- package/dist/theme/slot-recipes/Select.recipe.d.ts +5 -23
- package/dist/theme/slot-recipes/Select.recipe.js +3 -37
- package/dist/theme/slot-recipes/Select.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/Toggletip.recipe.d.ts +60 -0
- package/dist/theme/slot-recipes/Toggletip.recipe.js +31 -0
- package/dist/theme/slot-recipes/Toggletip.recipe.js.map +1 -0
- package/dist/theme/slot-recipes/Tooltip.recipe.d.ts +34 -34
- package/dist/theme/slot-recipes/Tooltip.recipe.js +4 -61
- package/dist/theme/slot-recipes/Tooltip.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/TreeView.recipe.js +9 -6
- package/dist/theme/slot-recipes/TreeView.recipe.js.map +1 -1
- package/dist/theme/slot-recipes/index.d.ts +96 -184
- package/dist/theme/slot-recipes/index.js +3 -3
- package/dist/theme/slot-recipes/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/BitkitUISideNav/BitkitUISideNav.d.ts +0 -37
- package/dist/components/BitkitUISideNav/BitkitUISideNav.js +0 -167
- package/dist/components/BitkitUISideNav/BitkitUISideNav.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavBody.d.ts +0 -7
- package/dist/components/BitkitUISideNav/UISideNavBody.js +0 -20
- package/dist/components/BitkitUISideNav/UISideNavBody.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavContext.d.ts +0 -32
- package/dist/components/BitkitUISideNav/UISideNavContext.js +0 -28
- package/dist/components/BitkitUISideNav/UISideNavContext.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavFooter.d.ts +0 -16
- package/dist/components/BitkitUISideNav/UISideNavFooter.js +0 -28
- package/dist/components/BitkitUISideNav/UISideNavFooter.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavFooterHeading.d.ts +0 -12
- package/dist/components/BitkitUISideNav/UISideNavFooterHeading.js +0 -26
- package/dist/components/BitkitUISideNav/UISideNavFooterHeading.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavItem.d.ts +0 -26
- package/dist/components/BitkitUISideNav/UISideNavItem.js +0 -33
- package/dist/components/BitkitUISideNav/UISideNavItem.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavLink.d.ts +0 -30
- package/dist/components/BitkitUISideNav/UISideNavLink.js +0 -58
- package/dist/components/BitkitUISideNav/UISideNavLink.js.map +0 -1
- package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.d.ts +0 -45
- package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.js +0 -119
- package/dist/components/BitkitUISideNav/UISideNavWorkspaceSelector.js.map +0 -1
- package/dist/theme/slot-recipes/UISideNav.recipe.d.ts +0 -119
- package/dist/theme/slot-recipes/UISideNav.recipe.js +0 -416
- package/dist/theme/slot-recipes/UISideNav.recipe.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SelectRootProps, SelectTriggerProps } from '@chakra-ui/react/select';
|
|
2
2
|
import { BitkitFieldProps } from '../BitkitField/BitkitField.tsx';
|
|
3
|
-
import { BitkitSelectMenuEmptyStateProps,
|
|
3
|
+
import { BitkitSelectMenuEmptyStateProps, BitkitSelectMenuItemProps, BitkitSelectMenuScrollProps, BitkitSelectMenuSearchProps } from '../BitkitSelectMenu/BitkitSelectMenu.tsx';
|
|
4
4
|
import { BitkitSelectMenuActionChild } from '../BitkitSelectMenu/BitkitSelectMenuAction.tsx';
|
|
5
5
|
export type BitkitSelectTriggerProps = SelectTriggerProps;
|
|
6
6
|
export type BitkitSelectProps = Omit<BitkitFieldProps, 'children' | 'onChange' | 'state'> & {
|
|
@@ -16,7 +16,7 @@ export type BitkitSelectProps = Omit<BitkitFieldProps, 'children' | 'onChange' |
|
|
|
16
16
|
state?: 'disabled' | 'error' | 'readOnly' | 'warning';
|
|
17
17
|
triggerProps?: BitkitSelectTriggerProps;
|
|
18
18
|
value?: string;
|
|
19
|
-
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps
|
|
19
|
+
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps;
|
|
20
20
|
declare const _default: import('react').ForwardRefExoticComponent<Omit<BitkitFieldProps, "children" | "onChange" | "state"> & {
|
|
21
21
|
children?: BitkitSelectMenuActionChild;
|
|
22
22
|
defaultValue?: string;
|
|
@@ -30,7 +30,7 @@ declare const _default: import('react').ForwardRefExoticComponent<Omit<BitkitFie
|
|
|
30
30
|
state?: "disabled" | "error" | "readOnly" | "warning";
|
|
31
31
|
triggerProps?: BitkitSelectTriggerProps;
|
|
32
32
|
value?: string;
|
|
33
|
-
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps &
|
|
33
|
+
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps & import('react').RefAttributes<HTMLDivElement>> & {
|
|
34
34
|
Action: {
|
|
35
35
|
(props: import('../index.ts').BitkitSelectMenuActionProps): import('react').JSX.Element;
|
|
36
36
|
displayName: string;
|
|
@@ -57,7 +57,7 @@ var SelectValue = ({ placeholder, state, size }) => {
|
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
var BitkitSelect = forwardRef((props, ref) => {
|
|
60
|
-
const { children, defaultValue, emptyHelperText, emptyLabel,
|
|
60
|
+
const { children, defaultValue, emptyHelperText, emptyLabel, isLoading, items, onScrolledToBottom, onSearchChange, onValueChange, placeholder, disablePortal, searchValue, selectProps, size = "lg", state, triggerProps, value, ...fieldProps } = props;
|
|
61
61
|
const collection = createListCollection({
|
|
62
62
|
items,
|
|
63
63
|
groupBy: (item) => item.group || "",
|
|
@@ -112,12 +112,9 @@ var BitkitSelect = forwardRef((props, ref) => {
|
|
|
112
112
|
collection,
|
|
113
113
|
emptyHelperText,
|
|
114
114
|
emptyLabel,
|
|
115
|
-
errorHelperText,
|
|
116
|
-
errorLabel,
|
|
117
115
|
isLoading,
|
|
118
116
|
onScrolledToBottom,
|
|
119
117
|
onSearchChange,
|
|
120
|
-
searchPlaceholder,
|
|
121
118
|
searchValue,
|
|
122
119
|
size,
|
|
123
120
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitSelect.js","names":[],"sources":["../../../lib/components/BitkitSelect/BitkitSelect.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { createListCollection } from '@chakra-ui/react/collection';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { Select, type SelectRootProps, type SelectTriggerProps, useSelectContext } from '@chakra-ui/react/select';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { forwardRef, useContext } from 'react';\n\nimport { IconErrorCircleFilled, IconWarningYellow } from '../../icons';\nimport AssetSelectChevron from '../../utilities/AssetSelectChevron.tsx';\nimport BitkitPortalContext from '../../utilities/BitkitPortalContext';\nimport { withSubComponents } from '../../utilities/withSubComponents.ts';\nimport BitkitAvatar from '../BitkitAvatar/BitkitAvatar';\nimport BitkitField, { type BitkitFieldProps } from '../BitkitField/BitkitField.tsx';\nimport BitkitSelectMenu, {\n type BitkitSelectMenuEmptyStateProps,\n type BitkitSelectMenuErrorStateProps,\n type BitkitSelectMenuItemProps,\n type BitkitSelectMenuScrollProps,\n type BitkitSelectMenuSearchProps,\n} from '../BitkitSelectMenu/BitkitSelectMenu.tsx';\nimport BitkitSelectMenuAction, {\n type BitkitSelectMenuActionChild,\n} from '../BitkitSelectMenu/BitkitSelectMenuAction.tsx';\nimport { selectSizeMap } from '../BitkitSelectMenu/SelectMenuShell.tsx';\n\nexport type BitkitSelectTriggerProps = SelectTriggerProps;\n\nexport type BitkitSelectProps = Omit<BitkitFieldProps, 'children' | 'onChange' | 'state'> & {\n children?: BitkitSelectMenuActionChild;\n defaultValue?: string;\n isLoading?: boolean;\n items: Array<BitkitSelectMenuItemProps>;\n onValueChange?: (newVal: string) => void;\n placeholder?: string;\n disablePortal?: boolean;\n selectProps?: Omit<SelectRootProps, 'collection' | 'defaultValue' | 'onValueChange' | 'size' | 'value'>;\n size?: 'md' | 'lg';\n state?: 'disabled' | 'error' | 'readOnly' | 'warning';\n triggerProps?: BitkitSelectTriggerProps;\n value?: string;\n} & BitkitSelectMenuSearchProps &\n BitkitSelectMenuScrollProps &\n BitkitSelectMenuEmptyStateProps &\n BitkitSelectMenuErrorStateProps;\n\ntype SelectValueProps = {\n placeholder?: string;\n size: NonNullable<BitkitSelectProps['size']>;\n state?: BitkitSelectProps['state'];\n};\n\nconst SelectValue = ({ placeholder, state, size }: SelectValueProps) => {\n const select = useSelectContext();\n const items = select.selectedItems as Array<BitkitSelectMenuItemProps>;\n\n const Icon = items[0]?.icon;\n const avatar = items[0]?.avatar;\n const label = items[0]?.label;\n const showAvatar = avatar !== undefined;\n\n const { avatarSize, iconSize } = selectSizeMap[size];\n\n const recipe = useSlotRecipe({ key: 'select' });\n const styles = recipe({ size });\n\n return items[0] ? (\n <Select.ValueText placeholder={placeholder ?? (state === 'readOnly' ? '(not selected)' : 'Select an option')}>\n {showAvatar ? (\n // Same avatar handling as the menu item (see BitkitSelectMenu.tsx). The `data-slot`\n // lets the trigger recipe shrink its vertical padding so the avatar row keeps the\n // 48/40 trigger height (see the `&:has([data-slot=\"avatar\"])` rule in Select.recipe.ts).\n <Box data-slot=\"avatar\" css={styles.avatar}>\n <BitkitAvatar variant=\"image\" src={avatar ?? ''} name={label} size={avatarSize} />\n </Box>\n ) : (\n Icon && <Icon css={styles.valueIcon} size={iconSize} flexShrink={0} />\n )}\n <Text as=\"span\" overflow=\"hidden\" textOverflow=\"ellipsis\" whiteSpace=\"nowrap\" minWidth=\"0\">\n {label}\n </Text>\n </Select.ValueText>\n ) : (\n <Select.ValueText\n placeholder={placeholder ?? (state === 'readOnly' ? '(not selected)' : 'Select an option')}\n display=\"block\"\n overflow=\"hidden\"\n textOverflow=\"ellipsis\"\n whiteSpace=\"nowrap\"\n />\n );\n};\n\nconst BitkitSelect = forwardRef<HTMLDivElement, BitkitSelectProps>((props: BitkitSelectProps, ref) => {\n const {\n children,\n defaultValue,\n emptyHelperText,\n emptyLabel,\n errorHelperText,\n errorLabel,\n isLoading,\n items,\n onScrolledToBottom,\n onSearchChange,\n onValueChange,\n placeholder,\n disablePortal,\n searchPlaceholder,\n searchValue,\n selectProps,\n size = 'lg',\n state,\n triggerProps,\n value,\n ...fieldProps\n } = props;\n\n const collection = createListCollection({\n items,\n groupBy: (item) => item.group || '',\n isItemDisabled: (item) => !!item.disabled,\n });\n\n const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);\n const isInvalid = state === 'error' || !!fieldProps.errorText;\n\n return (\n <BitkitField ref={ref} state={state} {...fieldProps}>\n <Select.Root\n collection={collection}\n size={size}\n {...selectProps}\n defaultValue={defaultValue ? [defaultValue] : undefined}\n disabled={state === 'disabled'}\n hasStatusIcon={state === 'error' || state === 'warning'}\n invalid={isInvalid}\n onValueChange={(newVal) => onValueChange?.(newVal.value[0])}\n readOnly={state === 'readOnly'}\n // Bypass Zag's isScrollable(contentEl) gate — our Content is overflow:hidden flex\n // column, so the real scroll container is itemList. See BitkitMultiselect for why.\n scrollToIndexFn={({ getElement }) => getElement()?.scrollIntoView({ block: 'nearest' })}\n // Stay controlled whenever `value` is provided — including `''` (\"nothing selected\"). A\n // truthiness check (`value ? … : undefined`) passes `undefined` for `''`, which flips\n // Select.Root to uncontrolled: it then ignores `value`, so resets don't take and\n // onValueChange stops firing when the same option is re-selected.\n value={value === undefined ? undefined : value ? [value] : []}\n >\n <Select.Control className=\"group\">\n <Select.HiddenSelect />\n <Select.Trigger {...triggerProps} aria-readonly={state === 'readOnly' || undefined}>\n <SelectValue placeholder={placeholder} size={size} state={state} />\n </Select.Trigger>\n <Select.IndicatorGroup>\n {state === 'error' && (\n <Select.Indicator>\n <IconErrorCircleFilled size={size === 'lg' ? '24' : '16'} color=\"icon/negative\" />\n </Select.Indicator>\n )}\n {state === 'warning' && (\n <Select.Indicator>\n <IconWarningYellow size={size === 'lg' ? '24' : '16'} />\n </Select.Indicator>\n )}\n <Select.Indicator asChild>\n <AssetSelectChevron />\n </Select.Indicator>\n </Select.IndicatorGroup>\n </Select.Control>\n <Portal disabled={disablePortal || disablePortalFromContext}>\n <Select.Positioner>\n <BitkitSelectMenu\n collection={collection}\n emptyHelperText={emptyHelperText}\n emptyLabel={emptyLabel}\n errorHelperText={errorHelperText}\n errorLabel={errorLabel}\n isLoading={isLoading}\n onScrolledToBottom={onScrolledToBottom}\n onSearchChange={onSearchChange}\n searchPlaceholder={searchPlaceholder}\n searchValue={searchValue}\n size={size}\n >\n {children}\n </BitkitSelectMenu>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </BitkitField>\n );\n});\n\nBitkitSelect.displayName = 'BitkitSelect';\n\nexport default withSubComponents(BitkitSelect, { Action: BitkitSelectMenuAction });\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoDA,IAAM,eAAe,EAAE,aAAa,OAAO,WAA6B;CAEtE,MAAM,QADS,iBACD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KACN;KACP;KAEL;IACe,CAAA,EACD,CAAA;GACb,CAAA,CACG;;CACF,CAAA;AAEjB,CAAC;AAED,aAAa,cAAc;AAE3B,IAAA,uBAAe,kBAAkB,cAAc,EAAE,QAAQ,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"BitkitSelect.js","names":[],"sources":["../../../lib/components/BitkitSelect/BitkitSelect.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { createListCollection } from '@chakra-ui/react/collection';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { Select, type SelectRootProps, type SelectTriggerProps, useSelectContext } from '@chakra-ui/react/select';\nimport { useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { forwardRef, useContext } from 'react';\n\nimport { IconErrorCircleFilled, IconWarningYellow } from '../../icons';\nimport AssetSelectChevron from '../../utilities/AssetSelectChevron.tsx';\nimport BitkitPortalContext from '../../utilities/BitkitPortalContext';\nimport { withSubComponents } from '../../utilities/withSubComponents.ts';\nimport BitkitAvatar from '../BitkitAvatar/BitkitAvatar';\nimport BitkitField, { type BitkitFieldProps } from '../BitkitField/BitkitField.tsx';\nimport BitkitSelectMenu, {\n type BitkitSelectMenuEmptyStateProps,\n type BitkitSelectMenuItemProps,\n type BitkitSelectMenuScrollProps,\n type BitkitSelectMenuSearchProps,\n} from '../BitkitSelectMenu/BitkitSelectMenu.tsx';\nimport BitkitSelectMenuAction, {\n type BitkitSelectMenuActionChild,\n} from '../BitkitSelectMenu/BitkitSelectMenuAction.tsx';\nimport { selectSizeMap } from '../BitkitSelectMenu/SelectMenuShell.tsx';\n\nexport type BitkitSelectTriggerProps = SelectTriggerProps;\n\nexport type BitkitSelectProps = Omit<BitkitFieldProps, 'children' | 'onChange' | 'state'> & {\n children?: BitkitSelectMenuActionChild;\n defaultValue?: string;\n isLoading?: boolean;\n items: Array<BitkitSelectMenuItemProps>;\n onValueChange?: (newVal: string) => void;\n placeholder?: string;\n disablePortal?: boolean;\n selectProps?: Omit<SelectRootProps, 'collection' | 'defaultValue' | 'onValueChange' | 'size' | 'value'>;\n size?: 'md' | 'lg';\n state?: 'disabled' | 'error' | 'readOnly' | 'warning';\n triggerProps?: BitkitSelectTriggerProps;\n value?: string;\n} & BitkitSelectMenuSearchProps &\n BitkitSelectMenuScrollProps &\n BitkitSelectMenuEmptyStateProps;\n\ntype SelectValueProps = {\n placeholder?: string;\n size: NonNullable<BitkitSelectProps['size']>;\n state?: BitkitSelectProps['state'];\n};\n\nconst SelectValue = ({ placeholder, state, size }: SelectValueProps) => {\n const select = useSelectContext();\n const items = select.selectedItems as Array<BitkitSelectMenuItemProps>;\n\n const Icon = items[0]?.icon;\n const avatar = items[0]?.avatar;\n const label = items[0]?.label;\n const showAvatar = avatar !== undefined;\n\n const { avatarSize, iconSize } = selectSizeMap[size];\n\n const recipe = useSlotRecipe({ key: 'select' });\n const styles = recipe({ size });\n\n return items[0] ? (\n <Select.ValueText placeholder={placeholder ?? (state === 'readOnly' ? '(not selected)' : 'Select an option')}>\n {showAvatar ? (\n // Same avatar handling as the menu item (see BitkitSelectMenu.tsx). The `data-slot`\n // lets the trigger recipe shrink its vertical padding so the avatar row keeps the\n // 48/40 trigger height (see the `&:has([data-slot=\"avatar\"])` rule in Select.recipe.ts).\n <Box data-slot=\"avatar\" css={styles.avatar}>\n <BitkitAvatar variant=\"image\" src={avatar ?? ''} name={label} size={avatarSize} />\n </Box>\n ) : (\n Icon && <Icon css={styles.valueIcon} size={iconSize} flexShrink={0} />\n )}\n <Text as=\"span\" overflow=\"hidden\" textOverflow=\"ellipsis\" whiteSpace=\"nowrap\" minWidth=\"0\">\n {label}\n </Text>\n </Select.ValueText>\n ) : (\n <Select.ValueText\n placeholder={placeholder ?? (state === 'readOnly' ? '(not selected)' : 'Select an option')}\n display=\"block\"\n overflow=\"hidden\"\n textOverflow=\"ellipsis\"\n whiteSpace=\"nowrap\"\n />\n );\n};\n\nconst BitkitSelect = forwardRef<HTMLDivElement, BitkitSelectProps>((props: BitkitSelectProps, ref) => {\n const {\n children,\n defaultValue,\n emptyHelperText,\n emptyLabel,\n isLoading,\n items,\n onScrolledToBottom,\n onSearchChange,\n onValueChange,\n placeholder,\n disablePortal,\n searchValue,\n selectProps,\n size = 'lg',\n state,\n triggerProps,\n value,\n ...fieldProps\n } = props;\n\n const collection = createListCollection({\n items,\n groupBy: (item) => item.group || '',\n isItemDisabled: (item) => !!item.disabled,\n });\n\n const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);\n const isInvalid = state === 'error' || !!fieldProps.errorText;\n\n return (\n <BitkitField ref={ref} state={state} {...fieldProps}>\n <Select.Root\n collection={collection}\n size={size}\n {...selectProps}\n defaultValue={defaultValue ? [defaultValue] : undefined}\n disabled={state === 'disabled'}\n hasStatusIcon={state === 'error' || state === 'warning'}\n invalid={isInvalid}\n onValueChange={(newVal) => onValueChange?.(newVal.value[0])}\n readOnly={state === 'readOnly'}\n // Bypass Zag's isScrollable(contentEl) gate — our Content is overflow:hidden flex\n // column, so the real scroll container is itemList. See BitkitMultiselect for why.\n scrollToIndexFn={({ getElement }) => getElement()?.scrollIntoView({ block: 'nearest' })}\n // Stay controlled whenever `value` is provided — including `''` (\"nothing selected\"). A\n // truthiness check (`value ? … : undefined`) passes `undefined` for `''`, which flips\n // Select.Root to uncontrolled: it then ignores `value`, so resets don't take and\n // onValueChange stops firing when the same option is re-selected.\n value={value === undefined ? undefined : value ? [value] : []}\n >\n <Select.Control className=\"group\">\n <Select.HiddenSelect />\n <Select.Trigger {...triggerProps} aria-readonly={state === 'readOnly' || undefined}>\n <SelectValue placeholder={placeholder} size={size} state={state} />\n </Select.Trigger>\n <Select.IndicatorGroup>\n {state === 'error' && (\n <Select.Indicator>\n <IconErrorCircleFilled size={size === 'lg' ? '24' : '16'} color=\"icon/negative\" />\n </Select.Indicator>\n )}\n {state === 'warning' && (\n <Select.Indicator>\n <IconWarningYellow size={size === 'lg' ? '24' : '16'} />\n </Select.Indicator>\n )}\n <Select.Indicator asChild>\n <AssetSelectChevron />\n </Select.Indicator>\n </Select.IndicatorGroup>\n </Select.Control>\n <Portal disabled={disablePortal || disablePortalFromContext}>\n <Select.Positioner>\n <BitkitSelectMenu\n collection={collection}\n emptyHelperText={emptyHelperText}\n emptyLabel={emptyLabel}\n isLoading={isLoading}\n onScrolledToBottom={onScrolledToBottom}\n onSearchChange={onSearchChange}\n searchValue={searchValue}\n size={size}\n >\n {children}\n </BitkitSelectMenu>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </BitkitField>\n );\n});\n\nBitkitSelect.displayName = 'BitkitSelect';\n\nexport default withSubComponents(BitkitSelect, { Action: BitkitSelectMenuAction });\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkDA,IAAM,eAAe,EAAE,aAAa,OAAO,WAA6B;CAEtE,MAAM,QADS,iBACD,CAAA,CAAO;CAErB,MAAM,OAAO,MAAM,EAAE,EAAE;CACvB,MAAM,SAAS,MAAM,EAAE,EAAE;CACzB,MAAM,QAAQ,MAAM,EAAE,EAAE;CACxB,MAAM,aAAa,WAAW,KAAA;CAE9B,MAAM,EAAE,YAAY,aAAa,cAAc;CAG/C,MAAM,SADS,cAAc,EAAE,KAAK,SAAS,CAC9B,CAAA,CAAO,EAAE,KAAK,CAAC;CAE9B,OAAO,MAAM,KACX,qBAAC,OAAO,WAAR;EAAkB,aAAa,gBAAgB,UAAU,aAAa,mBAAmB;EAAzF,UAAA,CACG,aAIC,oBAAC,KAAD;GAAK,aAAU;GAAS,KAAK,OAAO;GAClC,UAAA,oBAAC,cAAD;IAAc,SAAQ;IAAQ,KAAK,UAAU;IAAI,MAAM;IAAO,MAAM;GAAa,CAAA;EAC9E,CAAA,IAEL,QAAQ,oBAAC,MAAD;GAAM,KAAK,OAAO;GAAW,MAAM;GAAU,YAAY;EAAI,CAAA,GAEvE,oBAAC,MAAD;GAAM,IAAG;GAAO,UAAS;GAAS,cAAa;GAAW,YAAW;GAAS,UAAS;GACpF,UA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AA;MACG,UAAU,WACT,oBAAC,OAAO,WAAR,EAAA,UACE,oBAAC,uBAAD;OAAuB,MAAM,SAAS,OAAO,OAAO;OAAM,OAAM;MAAiB,CAAA,EACjE,CAAA;MAEnB,UAAU,aACT,oBAAC,OAAO,WAAR,EAAA,UACE,oBAAC,mBAAD,EAAmB,MAAM,SAAS,OAAO,OAAO,KAAO,CAAA,EACvC,CAAA;MAEpB,oBAAC,OAAO,WAAR;OAAkB,SAAA;OAChB,UAAA,oBAAC,oBAAD,CAAqB,CAAA;MACL,CAAA;KACG,EAAA,CAAA;IACT;GAChB,CAAA,GAAA,oBAAC,QAAD;IAAQ,UAAU,iBAAiB;IACjC,UAAA,oBAAC,OAAO,YAAR,EAAA,UACE,oBAAC,kBAAD;KACc;KACK;KACL;KACD;KACS;KACJ;KACH;KACP;KAEL;IACe,CAAA,EACD,CAAA;GACb,CAAA,CACG;;CACF,CAAA;AAEjB,CAAC;AAED,aAAa,cAAc;AAE3B,IAAA,uBAAe,kBAAkB,cAAc,EAAE,QAAQ,uBAAuB,CAAC"}
|
|
@@ -8,7 +8,6 @@ export { type BitkitSelectMenuActionProps } from './BitkitSelectMenuAction';
|
|
|
8
8
|
export type BitkitSelectMenuSearchProps = {
|
|
9
9
|
/** When provided, a search input is rendered above the menu items. `searchValue` is required alongside. */
|
|
10
10
|
onSearchChange?: (searchText: string) => void;
|
|
11
|
-
searchPlaceholder?: string;
|
|
12
11
|
searchValue?: string;
|
|
13
12
|
};
|
|
14
13
|
export type BitkitSelectMenuScrollProps = {
|
|
@@ -34,10 +33,6 @@ export type BitkitSelectMenuEmptyStateProps = {
|
|
|
34
33
|
emptyLabel?: string;
|
|
35
34
|
emptyHelperText?: string;
|
|
36
35
|
};
|
|
37
|
-
export type BitkitSelectMenuErrorStateProps = {
|
|
38
|
-
errorLabel?: string;
|
|
39
|
-
errorHelperText?: string;
|
|
40
|
-
};
|
|
41
36
|
export type BitkitSelectMenuProps = {
|
|
42
37
|
children?: BitkitSelectMenuActionChild;
|
|
43
38
|
collection: ListCollection<BitkitSelectMenuItemProps>;
|
|
@@ -48,7 +43,7 @@ export type BitkitSelectMenuProps = {
|
|
|
48
43
|
isLoading?: boolean;
|
|
49
44
|
size?: 'md' | 'lg';
|
|
50
45
|
variant?: 'select' | 'combobox';
|
|
51
|
-
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps
|
|
46
|
+
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps;
|
|
52
47
|
declare const BitkitSelectMenu: import('react').ForwardRefExoticComponent<{
|
|
53
48
|
children?: BitkitSelectMenuActionChild;
|
|
54
49
|
collection: ListCollection<BitkitSelectMenuItemProps>;
|
|
@@ -59,5 +54,5 @@ declare const BitkitSelectMenu: import('react').ForwardRefExoticComponent<{
|
|
|
59
54
|
isLoading?: boolean;
|
|
60
55
|
size?: "md" | "lg";
|
|
61
56
|
variant?: "select" | "combobox";
|
|
62
|
-
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps &
|
|
57
|
+
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
63
58
|
export default BitkitSelectMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitSelectMenu.js","names":[],"sources":["../../../lib/components/BitkitSelectMenu/BitkitSelectMenu.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { type ListCollection } from '@chakra-ui/react/collection';\nimport { Combobox } from '@chakra-ui/react/combobox';\nimport { Select, type SelectContentProps } from '@chakra-ui/react/select';\nimport { Spinner } from '@chakra-ui/react/spinner';\nimport { type SystemStyleObject, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { cloneElement, forwardRef, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent, IconCheck } from '../../icons';\nimport BitkitAvatar from '../BitkitAvatar/BitkitAvatar';\nimport { type BitkitBadgeProps } from '../BitkitBadge/BitkitBadge';\nimport { type BitkitSelectMenuActionChild } from './BitkitSelectMenuAction';\nimport { SelectMenuShell, selectSizeMap, type SelectSizes } from './SelectMenuShell';\n\nexport { type BitkitSelectMenuActionProps } from './BitkitSelectMenuAction';\n\nexport type BitkitSelectMenuSearchProps = {\n /** When provided, a search input is rendered above the menu items. `searchValue` is required alongside. */\n onSearchChange?: (searchText: string) => void;\n
|
|
1
|
+
{"version":3,"file":"BitkitSelectMenu.js","names":[],"sources":["../../../lib/components/BitkitSelectMenu/BitkitSelectMenu.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { type ListCollection } from '@chakra-ui/react/collection';\nimport { Combobox } from '@chakra-ui/react/combobox';\nimport { Select, type SelectContentProps } from '@chakra-ui/react/select';\nimport { Spinner } from '@chakra-ui/react/spinner';\nimport { type SystemStyleObject, useSlotRecipe } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { cloneElement, forwardRef, type ReactElement, type ReactNode } from 'react';\n\nimport { type BitkitIconComponent, IconCheck } from '../../icons';\nimport BitkitAvatar from '../BitkitAvatar/BitkitAvatar';\nimport { type BitkitBadgeProps } from '../BitkitBadge/BitkitBadge';\nimport { type BitkitSelectMenuActionChild } from './BitkitSelectMenuAction';\nimport { SelectMenuShell, selectSizeMap, type SelectSizes } from './SelectMenuShell';\n\nexport { type BitkitSelectMenuActionProps } from './BitkitSelectMenuAction';\n\nexport type BitkitSelectMenuSearchProps = {\n /** When provided, a search input is rendered above the menu items. `searchValue` is required alongside. */\n onSearchChange?: (searchText: string) => void;\n searchValue?: string;\n};\n\nexport type BitkitSelectMenuScrollProps = {\n /** Fires when the item list reaches its end. Position only: keep your own loading and end-of-list guards. */\n onScrolledToBottom?: () => void;\n};\n\nexport type BitkitSelectMenuItemProps = {\n value: string;\n label: string;\n group?: string;\n icon?: BitkitIconComponent;\n /** The item's avatar. A URL renders that image; `null` renders the avatar with the initials\n * of `label`; omitting the prop renders no avatar and leaves the row's leading slot to\n * `icon`. */\n avatar?: string | null;\n helperText?: ReactNode;\n /** A `BitkitBadge` after the label. Forced to `colorVariant=\"neutral\"` on a disabled item. */\n badge?: ReactElement<BitkitBadgeProps>;\n disabled?: boolean;\n loading?: boolean;\n};\n\nexport type BitkitSelectMenuEmptyStateProps = {\n emptyLabel?: string;\n emptyHelperText?: string;\n};\n\nexport type BitkitSelectMenuProps = {\n children?: BitkitSelectMenuActionChild;\n collection: ListCollection<BitkitSelectMenuItemProps>;\n /** Forwarded to the underlying Select/Combobox.Content. Kept for internal callers\n * (e.g. BitkitCalendar's in-grid selects that need to tweak max-height / width). The\n * public components (BitkitSelect, BitkitCombobox) do not expose this escape hatch. */\n contentProps?: SelectContentProps;\n isLoading?: boolean;\n size?: 'md' | 'lg';\n variant?: 'select' | 'combobox';\n} & BitkitSelectMenuSearchProps &\n BitkitSelectMenuScrollProps &\n BitkitSelectMenuEmptyStateProps;\n\nconst BitkitSelectMenu = forwardRef<HTMLDivElement, BitkitSelectMenuProps>((props, ref) => {\n const { children, collection, variant = 'select', size, ...shellProps } = props;\n const NS = variant === 'combobox' ? Combobox : Select;\n const recipe = useSlotRecipe({ key: 'select' });\n const styles = recipe({ size });\n const { avatarSize, iconSize, spinnerSize } = selectSizeMap[size ?? 'lg'];\n\n return (\n <SelectMenuShell\n NS={NS}\n collection={collection}\n contentRef={ref}\n iconSize={iconSize}\n renderItem={(item) => (\n <SelectMenuItem\n key={item.value}\n NS={NS}\n avatarSize={avatarSize}\n item={item}\n iconSize={iconSize}\n spinnerSize={spinnerSize}\n styles={styles}\n />\n )}\n spinnerSize={spinnerSize}\n styles={styles}\n {...shellProps}\n >\n {children}\n </SelectMenuShell>\n );\n});\n\nBitkitSelectMenu.displayName = 'BitkitSelectMenu';\n\ntype SelectMenuItemRenderProps = {\n NS: typeof Select | typeof Combobox;\n avatarSize: SelectSizes['avatarSize'];\n item: BitkitSelectMenuItemProps;\n iconSize: SelectSizes['iconSize'];\n spinnerSize: SelectSizes['spinnerSize'];\n styles: Record<string, SystemStyleObject>;\n};\n\nconst SelectMenuItem = ({ NS, avatarSize, item, iconSize, spinnerSize, styles }: SelectMenuItemRenderProps) => {\n const Icon = item.icon;\n const showAvatar = item.avatar !== undefined;\n\n if (item.loading) {\n // Rendered as a plain Box, not NS.Item — Zag's state machine won't track it as\n // an option, so keyboard nav skips it and it can't be selected.\n return (\n <Box css={styles.item}>\n <Spinner variant=\"purple\" size={spinnerSize} css={styles.itemLoading} />\n <Text css={styles.itemLoadingLabel}>Loading...</Text>\n </Box>\n );\n }\n\n return (\n <NS.Item css={styles.item} item={item}>\n {showAvatar && (\n <Box data-slot=\"avatar\" css={styles.avatar}>\n <BitkitAvatar variant=\"image\" src={item.avatar ?? ''} name={item.label} size={avatarSize} />\n </Box>\n )}\n <Box css={styles.itemContent}>\n <Box display=\"flex\" alignItems=\"center\" gap=\"8\">\n {Icon && !showAvatar && <Icon css={styles.itemIcon} size={iconSize} />}\n <Text css={styles.itemLabel}>{item.label}</Text>\n </Box>\n {item.helperText && <Text css={styles.itemHelperText}>{item.helperText}</Text>}\n </Box>\n {item.badge && (\n <Box css={styles.itemBadge}>\n {item.disabled ? cloneElement(item.badge, { colorVariant: 'neutral' }) : item.badge}\n </Box>\n )}\n <NS.ItemIndicator asChild>\n <IconCheck size={iconSize} css={styles.itemIndicator} />\n </NS.ItemIndicator>\n </NS.Item>\n );\n};\n\nexport default BitkitSelectMenu;\n"],"mappings":";;;;;;;;;;;;AA+DA,IAAM,mBAAmB,YAAmD,OAAO,QAAQ;CACzF,MAAM,EAAE,UAAU,YAAY,UAAU,UAAU,MAAM,GAAG,eAAe;CAC1E,MAAM,KAAK,YAAY,aAAa,WAAW;CAE/C,MAAM,SADS,cAAc,EAAE,KAAK,SAAS,CAC9B,CAAA,CAAO,EAAE,KAAK,CA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AAK,SACJ,oBAAC,KAAD;IAAK,KAAK,OAAO;IACd,UAAA,KAAK,WAAW,aAAa,KAAK,OAAO,EAAE,cAAc,UAAU,CAAC,IAAI,KAAK;GAC3E,CAAA;GAEP,oBAAC,GAAG,eAAJ;IAAkB,SAAA;IAChB,UAAA,oBAAC,WAAD;KAAW,MAAM;KAAU,KAAK,OAAO;IAAgB,CAAA;GACvC,CAAA;EACX;;AAEb"}
|
|
@@ -3,7 +3,7 @@ import { Combobox } from '@chakra-ui/react/combobox';
|
|
|
3
3
|
import { Select, SelectContentProps } from '@chakra-ui/react/select';
|
|
4
4
|
import { SystemStyleObject } from '@chakra-ui/react/styled-system';
|
|
5
5
|
import { ReactNode, Ref } from 'react';
|
|
6
|
-
import { BitkitSelectMenuEmptyStateProps,
|
|
6
|
+
import { BitkitSelectMenuEmptyStateProps, BitkitSelectMenuScrollProps, BitkitSelectMenuSearchProps } from './BitkitSelectMenu';
|
|
7
7
|
import { BitkitSelectMenuActionChild } from './BitkitSelectMenuAction';
|
|
8
8
|
export declare const selectSizeMap: {
|
|
9
9
|
readonly lg: {
|
|
@@ -38,8 +38,8 @@ export type SelectMenuShellProps<T extends {
|
|
|
38
38
|
renderItem: (item: T) => ReactNode;
|
|
39
39
|
spinnerSize: SelectSizes['spinnerSize'];
|
|
40
40
|
styles: Record<string, SystemStyleObject>;
|
|
41
|
-
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps
|
|
41
|
+
} & BitkitSelectMenuSearchProps & BitkitSelectMenuScrollProps & BitkitSelectMenuEmptyStateProps;
|
|
42
42
|
export declare const SelectMenuShell: <T extends {
|
|
43
43
|
value: string;
|
|
44
44
|
group?: string;
|
|
45
|
-
}>({ NS, children, collection, contentProps, contentRef, emptyHelperText, emptyLabel,
|
|
45
|
+
}>({ NS, children, collection, contentProps, contentRef, emptyHelperText, emptyLabel, iconSize, isLoading, onScrolledToBottom, onSearchChange, renderItem, searchValue, spinnerSize, styles, }: SelectMenuShellProps<T>) => import('react').JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import IconCross from "../../icons/IconCross.js";
|
|
2
|
-
import IconCrossCircle from "../../icons/IconCrossCircle.js";
|
|
3
2
|
import IconMagnifier from "../../icons/IconMagnifier.js";
|
|
4
3
|
import BitkitGroupHeading from "../BitkitGroupHeading/BitkitGroupHeading.js";
|
|
5
4
|
import { SelectMenuShellContextProvider } from "./BitkitSelectMenuAction.js";
|
|
@@ -22,10 +21,9 @@ var selectSizeMap = {
|
|
|
22
21
|
spinnerSize: "md"
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
|
-
var SelectMenuShell = ({ NS, children, collection, contentProps, contentRef, emptyHelperText, emptyLabel = "No matching options",
|
|
24
|
+
var SelectMenuShell = ({ NS, children, collection, contentProps, contentRef, emptyHelperText, emptyLabel = "No matching options", iconSize, isLoading = false, onScrolledToBottom, onSearchChange, renderItem, searchValue, spinnerSize, styles }) => {
|
|
26
25
|
const { css: contentCss, ...restContentProps } = contentProps ?? {};
|
|
27
26
|
const isEmpty = collection.size === 0;
|
|
28
|
-
const hasError = !isLoading && !!errorLabel;
|
|
29
27
|
const hasAction = isValidElement(children);
|
|
30
28
|
const wasAtBottom = useRef(false);
|
|
31
29
|
const handleItemListScroll = (event) => {
|
|
@@ -51,27 +49,11 @@ var SelectMenuShell = ({ NS, children, collection, contentProps, contentRef, emp
|
|
|
51
49
|
}),
|
|
52
50
|
onSearchChange && /* @__PURE__ */ jsx(SelectMenuSearch, {
|
|
53
51
|
iconSize,
|
|
54
|
-
placeholder: searchPlaceholder,
|
|
55
52
|
styles,
|
|
56
53
|
value: searchValue ?? "",
|
|
57
54
|
onSearchChange
|
|
58
55
|
}),
|
|
59
|
-
|
|
60
|
-
css: styles.errorState,
|
|
61
|
-
children: [/* @__PURE__ */ jsx(IconCrossCircle, {
|
|
62
|
-
css: styles.errorIcon,
|
|
63
|
-
size: iconSize
|
|
64
|
-
}), /* @__PURE__ */ jsxs(Box, {
|
|
65
|
-
css: styles.errorTextBlock,
|
|
66
|
-
children: [/* @__PURE__ */ jsx(Text, {
|
|
67
|
-
css: styles.errorLabel,
|
|
68
|
-
children: errorLabel
|
|
69
|
-
}), errorHelperText && /* @__PURE__ */ jsx(Text, {
|
|
70
|
-
css: styles.itemHelperText,
|
|
71
|
-
children: errorHelperText
|
|
72
|
-
})]
|
|
73
|
-
})]
|
|
74
|
-
}) : /* @__PURE__ */ jsxs(Box, {
|
|
56
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
75
57
|
css: styles.itemList,
|
|
76
58
|
onScroll: handleItemListScroll,
|
|
77
59
|
children: [
|
|
@@ -111,7 +93,7 @@ var SelectMenuShell = ({ NS, children, collection, contentProps, contentRef, emp
|
|
|
111
93
|
})
|
|
112
94
|
});
|
|
113
95
|
};
|
|
114
|
-
var SelectMenuSearch = ({ iconSize, onSearchChange,
|
|
96
|
+
var SelectMenuSearch = ({ iconSize, onSearchChange, styles, value }) => /* @__PURE__ */ jsxs(Box, {
|
|
115
97
|
css: styles.searchInputGroup,
|
|
116
98
|
children: [
|
|
117
99
|
/* @__PURE__ */ jsx(IconMagnifier, {
|
|
@@ -121,7 +103,7 @@ var SelectMenuSearch = ({ iconSize, onSearchChange, placeholder = "Search...", s
|
|
|
121
103
|
/* @__PURE__ */ jsx(chakra.input, {
|
|
122
104
|
"aria-label": "Search",
|
|
123
105
|
css: styles.searchInput,
|
|
124
|
-
placeholder,
|
|
106
|
+
placeholder: "Search...",
|
|
125
107
|
value,
|
|
126
108
|
onChange: (event) => onSearchChange(event.target.value),
|
|
127
109
|
onKeyDown: (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenuShell.js","names":[],"sources":["../../../lib/components/BitkitSelectMenu/SelectMenuShell.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { type ListCollection } from '@chakra-ui/react/collection';\nimport { type Combobox } from '@chakra-ui/react/combobox';\nimport { type Select, type SelectContentProps } from '@chakra-ui/react/select';\nimport { Spinner } from '@chakra-ui/react/spinner';\nimport { chakra, type SystemStyleObject } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { type ChangeEvent, isValidElement, type ReactNode, type Ref, type UIEvent, useRef } from 'react';\n\nimport { IconCross,
|
|
1
|
+
{"version":3,"file":"SelectMenuShell.js","names":[],"sources":["../../../lib/components/BitkitSelectMenu/SelectMenuShell.tsx"],"sourcesContent":["import { Box } from '@chakra-ui/react/box';\nimport { type ListCollection } from '@chakra-ui/react/collection';\nimport { type Combobox } from '@chakra-ui/react/combobox';\nimport { type Select, type SelectContentProps } from '@chakra-ui/react/select';\nimport { Spinner } from '@chakra-ui/react/spinner';\nimport { chakra, type SystemStyleObject } from '@chakra-ui/react/styled-system';\nimport { Text } from '@chakra-ui/react/text';\nimport { type ChangeEvent, isValidElement, type ReactNode, type Ref, type UIEvent, useRef } from 'react';\n\nimport { IconCross, IconMagnifier } from '../../icons';\nimport BitkitGroupHeading from '../BitkitGroupHeading/BitkitGroupHeading';\nimport {\n type BitkitSelectMenuEmptyStateProps,\n type BitkitSelectMenuScrollProps,\n type BitkitSelectMenuSearchProps,\n} from './BitkitSelectMenu';\nimport { type BitkitSelectMenuActionChild, SelectMenuShellContextProvider } from './BitkitSelectMenuAction';\n\nexport const selectSizeMap = {\n lg: { avatarSize: '32', iconSize: '24', spinnerSize: 'lg' },\n md: { avatarSize: '24', iconSize: '16', spinnerSize: 'md' },\n} as const;\n\nexport type SelectSizes = (typeof selectSizeMap)[keyof typeof selectSizeMap];\n\n/**\n * Internal shared shell for BitkitSelectMenu and BitkitMultiselectMenu.\n * Handles Content wrapper, search, loading, empty state, groups, and the action slot —\n * the caller only provides per-item rendering via renderItem and any sub-components\n * (e.g. <BitkitSelectMenu.Action />) via children.\n */\nexport type SelectMenuShellProps<T extends { value: string; group?: string }> = {\n NS: typeof Select | typeof Combobox;\n children?: BitkitSelectMenuActionChild;\n collection: ListCollection<T>;\n contentProps?: SelectContentProps;\n contentRef?: Ref<HTMLDivElement>;\n iconSize: SelectSizes['iconSize'];\n isLoading?: boolean;\n renderItem: (item: T) => ReactNode;\n spinnerSize: SelectSizes['spinnerSize'];\n styles: Record<string, SystemStyleObject>;\n} & BitkitSelectMenuSearchProps &\n BitkitSelectMenuScrollProps &\n BitkitSelectMenuEmptyStateProps;\n\nexport const SelectMenuShell = <T extends { value: string; group?: string }>({\n NS,\n children,\n collection,\n contentProps,\n contentRef,\n emptyHelperText,\n emptyLabel = 'No matching options',\n iconSize,\n isLoading = false,\n onScrolledToBottom,\n onSearchChange,\n renderItem,\n searchValue,\n spinnerSize,\n styles,\n}: SelectMenuShellProps<T>) => {\n const { css: contentCss, ...restContentProps } = contentProps ?? {};\n const isEmpty = collection.size === 0;\n const hasAction = isValidElement(children);\n\n const wasAtBottom = useRef(false);\n const handleItemListScroll = (event: UIEvent<HTMLDivElement>) => {\n const list = event.currentTarget;\n const atBottom = list.scrollTop >= list.scrollHeight - list.offsetHeight - 1;\n // Only the transition into \"at the end\", so resting at the bottom doesn't keep asking.\n if (atBottom && !wasAtBottom.current) onScrolledToBottom?.();\n wasAtBottom.current = atBottom;\n };\n\n return (\n <SelectMenuShellContextProvider value={{ iconSize, styles }}>\n <NS.Content css={[styles.content, contentCss]} ref={contentRef} {...restContentProps}>\n {/*\n Without a search input, Zag's getInitialFocus (see @zag-js/dom-query) picks the first\n tabbable descendant as the menu's initial focus target — which would be the action\n slot, visually confusing. A hidden [data-autofocus] span wins over tabbables in\n getInitialFocus's querySelector, so we focus an invisible element instead and Zag's\n aria-activedescendant drives the highlight like a normal Select would.\n */}\n {!onSearchChange && hasAction && <span data-autofocus=\"\" tabIndex={-1} aria-hidden=\"true\" />}\n {onSearchChange && (\n <SelectMenuSearch\n iconSize={iconSize}\n styles={styles}\n value={searchValue ?? ''}\n onSearchChange={onSearchChange}\n />\n )}\n <Box css={styles.itemList} onScroll={handleItemListScroll}>\n {isLoading && (\n <Box css={styles.item}>\n <Spinner variant=\"purple\" size={spinnerSize} css={styles.itemLoading} />\n <Text css={styles.itemLoadingLabel}>Loading...</Text>\n </Box>\n )}\n {!isLoading && isEmpty && (\n <Box css={styles.emptyState}>\n <Text css={styles.itemLabel}>{emptyLabel}</Text>\n {emptyHelperText && <Text css={styles.itemHelperText}>{emptyHelperText}</Text>}\n </Box>\n )}\n {!isLoading &&\n !isEmpty &&\n collection.group().map(([type, group]) => (\n <NS.ItemGroup key={type}>\n {type && (\n <NS.ItemGroupLabel asChild>\n <BitkitGroupHeading label={type} paddingBlock=\"12\" paddingInline=\"16\" />\n </NS.ItemGroupLabel>\n )}\n {group.map(renderItem)}\n </NS.ItemGroup>\n ))}\n </Box>\n {children}\n </NS.Content>\n </SelectMenuShellContextProvider>\n );\n};\n\ntype SelectMenuSearchProps = {\n iconSize: '16' | '24';\n onSearchChange: (searchText: string) => void;\n styles: Record<string, SystemStyleObject>;\n value: string;\n};\n\nconst SelectMenuSearch = ({ iconSize, onSearchChange, styles, value }: SelectMenuSearchProps) => (\n <Box css={styles.searchInputGroup}>\n <IconMagnifier size={iconSize} color=\"icon/tertiary\" />\n <chakra.input\n aria-label=\"Search\"\n css={styles.searchInput}\n placeholder=\"Search...\"\n value={value}\n onChange={(event: ChangeEvent<HTMLInputElement>) => onSearchChange(event.target.value)}\n onKeyDown={(event) => {\n // Zag's Select.Content keyDown listener fires ITEM.CLICK + preventDefault on Space\n // regardless of which descendant is focused. That would eat the space before the\n // input can type it. Enter is left alone so \"type-then-Enter-to-select\" still works.\n if (event.key === ' ') event.stopPropagation();\n }}\n />\n {value && (\n <chakra.button\n type=\"button\"\n css={styles.searchClear}\n aria-label=\"Clear search\"\n onClick={() => onSearchChange('')}\n >\n <IconCross size={iconSize} />\n </chakra.button>\n )}\n </Box>\n);\n"],"mappings":";;;;;;;;;;;AAkBA,IAAa,gBAAgB;CAC3B,IAAI;EAAE,YAAY;EAAM,UAAU;EAAM,aAAa;CAAK;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,mBAAmB,oBAAC,MAAD;QAAM,KAAK,OAAO;QAAiB,UAAA;OAAsB,CAAA,CAC1E;;MAEN,CAAC,aACA,CAAC,WACD,WAAW,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,WAC7B,qBAAC,GAAG,WAAJ,EAAA,UAAA,CACG,QACC,oBAAC,GAAG,gBAAJ;OAAmB,SAAA;OACjB,UAAA,oBAAC,oBAAD;QAAoB,OAAO;QAAM,cAAa;QAAK,eAAc;OAAM,CAAA;MACtD,CAAA,GAEpB,MAAM,IAAI,UAAU,CACT,EAAA,GAPK,IAOL,CACf;KACA;;IACJ;GACS;;CACkB,CAAA;AAEpC;AASA,IAAM,oBAAoB,EAAE,UAAU,gBAAgB,QAAQ,YAC5D,qBAAC,KAAD;CAAK,KAAK,OAAO;CAAjB,UAAA;EACE,oBAAC,eAAD;GAAe,MAAM;GAAU,OAAM;EAAiB,CAAA;EACtD,oBAAC,OAAO,OAAR;GACE,cAAW;GACX,KAAK,OAAO;GACZ,aAAY;GACL;GACP,WAAW,UAAyC,eAAe,MAAM,OAAO,KAAK;GACrF,YAAY,UAAU;IAIpB,IAAI,MAAM,QAAQ,KAAK,MAAM,gBAAgB;GAC/C;EACD,CAAA;EACA,SACC,oBAAC,OAAO,QAAR;GACE,MAAK;GACL,KAAK,OAAO;GACZ,cAAW;GACX,eAAe,eAAe,EAAE;GAEhC,UAAA,oBAAC,WAAD,EAAW,MAAM,SAAW,CAAA;EACf,CAAA;CAEd"}
|
|
@@ -13,7 +13,7 @@ export interface BitkitDefinitionColumnHeaderProps extends Omit<Table.ColumnHead
|
|
|
13
13
|
* demand. It is `BitkitDefinitionTooltip` for a table header — same props, same behaviour, except the
|
|
14
14
|
* title keeps the header's own type (`heading/h5`) instead of the body type that component pins.
|
|
15
15
|
*
|
|
16
|
-
* That type is also why it composes `BitkitTooltip` rather than rendering a `BitkitDefinitionTooltip`:
|
|
16
|
+
* That type is also why it composes `BitkitToggletip` / `BitkitTooltip` rather than rendering a `BitkitDefinitionTooltip`:
|
|
17
17
|
* the latter's recipe always applies a `textSize`, and there is no value for it that means "inherit".
|
|
18
18
|
*
|
|
19
19
|
* Only the title is the trigger, so the rest of the header stays inert. Everything else a
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import BitkitTooltip from "../BitkitTooltip/BitkitTooltip.js";
|
|
2
|
+
import BitkitToggletip from "../BitkitToggletip/BitkitToggletip.js";
|
|
2
3
|
import { chakra } from "@chakra-ui/react/styled-system";
|
|
3
|
-
import { forwardRef
|
|
4
|
+
import { forwardRef } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
5
6
|
import { Table, useTableStyles } from "@chakra-ui/react/table";
|
|
6
7
|
//#region lib/components/BitkitTable/BitkitDefinitionColumnHeader.tsx
|
|
@@ -9,7 +10,7 @@ import { Table, useTableStyles } from "@chakra-ui/react/table";
|
|
|
9
10
|
* demand. It is `BitkitDefinitionTooltip` for a table header — same props, same behaviour, except the
|
|
10
11
|
* title keeps the header's own type (`heading/h5`) instead of the body type that component pins.
|
|
11
12
|
*
|
|
12
|
-
* That type is also why it composes `BitkitTooltip` rather than rendering a `BitkitDefinitionTooltip`:
|
|
13
|
+
* That type is also why it composes `BitkitToggletip` / `BitkitTooltip` rather than rendering a `BitkitDefinitionTooltip`:
|
|
13
14
|
* the latter's recipe always applies a `textSize`, and there is no value for it that means "inherit".
|
|
14
15
|
*
|
|
15
16
|
* Only the title is the trigger, so the rest of the header stays inert. Everything else a
|
|
@@ -17,32 +18,28 @@ import { Table, useTableStyles } from "@chakra-ui/react/table";
|
|
|
17
18
|
*/
|
|
18
19
|
var BitkitDefinitionColumnHeader = forwardRef(({ button, children, disablePortal, learnMoreTarget, learnMoreUrl, method = "click", placement, text, ...rest }, ref) => {
|
|
19
20
|
const styles = useTableStyles();
|
|
20
|
-
const
|
|
21
|
-
|
|
21
|
+
const title = /* @__PURE__ */ jsx(chakra.button, {
|
|
22
|
+
css: styles.definitionTrigger,
|
|
23
|
+
truncate: true,
|
|
24
|
+
type: "button",
|
|
25
|
+
children
|
|
26
|
+
});
|
|
22
27
|
return /* @__PURE__ */ jsx(Table.ColumnHeader, {
|
|
23
28
|
ref,
|
|
24
29
|
...rest,
|
|
25
|
-
children: /* @__PURE__ */ jsx(BitkitTooltip, {
|
|
30
|
+
children: method === "hover" ? /* @__PURE__ */ jsx(BitkitTooltip, {
|
|
31
|
+
disablePortal,
|
|
32
|
+
placement,
|
|
33
|
+
text,
|
|
34
|
+
children: title
|
|
35
|
+
}) : /* @__PURE__ */ jsx(BitkitToggletip, {
|
|
26
36
|
button,
|
|
27
|
-
closeOnClick: isClick ? false : void 0,
|
|
28
37
|
disablePortal,
|
|
29
38
|
learnMoreTarget,
|
|
30
39
|
learnMoreUrl,
|
|
31
|
-
onOpenChange: isClick ? ({ open: nextOpen }) => {
|
|
32
|
-
if (!nextOpen) setOpen(false);
|
|
33
|
-
} : void 0,
|
|
34
|
-
open: isClick ? open : void 0,
|
|
35
|
-
openDelay: isClick ? Infinity : void 0,
|
|
36
40
|
placement,
|
|
37
41
|
text,
|
|
38
|
-
children:
|
|
39
|
-
"aria-expanded": isClick ? open : void 0,
|
|
40
|
-
css: styles.definitionTrigger,
|
|
41
|
-
onClick: isClick ? () => setOpen(!open) : void 0,
|
|
42
|
-
truncate: true,
|
|
43
|
-
type: "button",
|
|
44
|
-
children
|
|
45
|
-
})
|
|
42
|
+
children: title
|
|
46
43
|
})
|
|
47
44
|
});
|
|
48
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitkitDefinitionColumnHeader.js","names":[],"sources":["../../../lib/components/BitkitTable/BitkitDefinitionColumnHeader.tsx"],"sourcesContent":["import { chakra } from '@chakra-ui/react/styled-system';\nimport { Table, useTableStyles } from '@chakra-ui/react/table';\nimport { forwardRef
|
|
1
|
+
{"version":3,"file":"BitkitDefinitionColumnHeader.js","names":[],"sources":["../../../lib/components/BitkitTable/BitkitDefinitionColumnHeader.tsx"],"sourcesContent":["import { chakra } from '@chakra-ui/react/styled-system';\nimport { Table, useTableStyles } from '@chakra-ui/react/table';\nimport { forwardRef } from 'react';\n\nimport { type BitkitDefinitionTooltipProps } from '../BitkitDefinitionTooltip/BitkitDefinitionTooltip';\nimport BitkitToggletip from '../BitkitToggletip/BitkitToggletip';\nimport BitkitTooltip from '../BitkitTooltip/BitkitTooltip';\n\n/**\n * Everything `BitkitDefinitionTooltip` takes — `children` is the column title, `text` the definition\n * — on top of everything a `BitkitTable.ColumnHeader` takes. The two the header owns are gone: `textSize`,\n * because the point is to keep the header's own type, and the tooltip's `truncate`, because the title\n * always truncates and `truncate` stays the header cell's own style prop.\n */\nexport interface BitkitDefinitionColumnHeaderProps\n extends Omit<Table.ColumnHeaderProps, 'children'>, Omit<BitkitDefinitionTooltipProps, 'textSize' | 'truncate'> {}\n\n/**\n * A column header whose title is a glossary term: underlined, and revealing what the column means on\n * demand. It is `BitkitDefinitionTooltip` for a table header — same props, same behaviour, except the\n * title keeps the header's own type (`heading/h5`) instead of the body type that component pins.\n *\n * That type is also why it composes `BitkitToggletip` / `BitkitTooltip` rather than rendering a `BitkitDefinitionTooltip`:\n * the latter's recipe always applies a `textSize`, and there is no value for it that means \"inherit\".\n *\n * Only the title is the trigger, so the rest of the header stays inert. Everything else a\n * `BitkitTable.ColumnHeader` takes — `textAlign`, `width`, `colSpan` — still applies.\n */\nconst BitkitDefinitionColumnHeader = forwardRef<HTMLTableCellElement, BitkitDefinitionColumnHeaderProps>(\n (\n { button, children, disablePortal, learnMoreTarget, learnMoreUrl, method = 'click', placement, text, ...rest },\n ref,\n ) => {\n const styles = useTableStyles();\n\n const title = (\n // chakra.button: no named primitive attaches a recipe slot to a bare trigger button\n <chakra.button css={styles.definitionTrigger} truncate type=\"button\">\n {children}\n </chakra.button>\n );\n\n return (\n <Table.ColumnHeader ref={ref} {...rest}>\n {method === 'hover' ? (\n <BitkitTooltip disablePortal={disablePortal} placement={placement} text={text}>\n {title}\n </BitkitTooltip>\n ) : (\n <BitkitToggletip\n button={button}\n disablePortal={disablePortal}\n learnMoreTarget={learnMoreTarget}\n learnMoreUrl={learnMoreUrl}\n placement={placement}\n text={text}\n >\n {title}\n </BitkitToggletip>\n )}\n </Table.ColumnHeader>\n );\n },\n);\n\nBitkitDefinitionColumnHeader.displayName = 'BitkitTable.DefinitionColumnHeader';\n\nexport default BitkitDefinitionColumnHeader;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,IAAM,+BAA+B,YAEjC,EAAE,QAAQ,UAAU,eAAe,iBAAiB,cAAc,SAAS,SAAS,WAAW,MAAM,GAAG,QACxG,QACG;CACH,MAAM,SAAS,eAAe;CAE9B,MAAM,QAEJ,oBAAC,OAAO,QAAR;EAAe,KAAK,OAAO;EAAmB,UAAA;EAAS,MAAK;EACzD;CACY,CAAA;CAGjB,OACE,oBAAC,MAAM,cAAP;EAAyB;EAAK,GAAI;EAC/B,UAAA,WAAW,UACV,oBAAC,eAAD;GAA8B;GAA0B;GAAiB;GACtE,UAAA;EACY,CAAA,IAEf,oBAAC,iBAAD;GACU;GACO;GACE;GACH;GACH;GACL;GAEL,UAAA;EACc,CAAA;CAED,CAAA;AAExB,CACF;AAEA,6BAA6B,cAAc"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { PopoverRootProps } from '@ark-ui/react/popover';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BitkitIconComponent } from '../../icons';
|
|
4
|
+
import { BitkitColorButtonProps } from '../BitkitColorButton/BitkitColorButton';
|
|
5
|
+
export type BitkitToggletipProps = {
|
|
6
|
+
/** Action button at the end of the toggletip. Defaults to the `white` colour variant, the one that reads on its dark background. */
|
|
7
|
+
button?: BitkitColorButtonProps;
|
|
8
|
+
/**
|
|
9
|
+
* The trigger the toggletip opens from. Rendered via `asChild`, so it must be a focusable control
|
|
10
|
+
* that accepts a ref — unless `wrapTrigger` puts a button in between.
|
|
11
|
+
*/
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/** Open on first render, for an uncontrolled toggletip. */
|
|
14
|
+
defaultOpen?: PopoverRootProps['defaultOpen'];
|
|
15
|
+
/**
|
|
16
|
+
* Render the toggletip inline instead of in a portal. Only needed when it must stay inside its
|
|
17
|
+
* parent's DOM subtree — a dialog already sets this for you.
|
|
18
|
+
*/
|
|
19
|
+
disablePortal?: boolean;
|
|
20
|
+
/** Render the trigger without a toggletip — for hints that only apply in some states. */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Icon after the text — `IconArrowNortheast` when the trigger opens something in a new tab, for instance. */
|
|
23
|
+
icon?: BitkitIconComponent;
|
|
24
|
+
/** Target for the "Learn more" link. `_blank` also sets `rel="noopener noreferrer"`. */
|
|
25
|
+
learnMoreTarget?: HTMLAnchorElement['target'];
|
|
26
|
+
/** Adds a "Learn more" link pointing here, for the fuller explanation. */
|
|
27
|
+
learnMoreUrl?: string;
|
|
28
|
+
/** Called when the toggletip opens or closes. */
|
|
29
|
+
onOpenChange?: PopoverRootProps['onOpenChange'];
|
|
30
|
+
/** Controls the open state. */
|
|
31
|
+
open?: PopoverRootProps['open'];
|
|
32
|
+
/** Where the toggletip sits relative to the trigger (default `top`). It flips if space is short. */
|
|
33
|
+
placement?: NonNullable<PopoverRootProps['positioning']>['placement'];
|
|
34
|
+
/** The toggletip's text. */
|
|
35
|
+
text: string;
|
|
36
|
+
/** Accessible name of the `wrapTrigger` button, for a trigger with no text of its own, like an icon. */
|
|
37
|
+
triggerAriaLabel?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Put the trigger inside a button instead of rendering on it — for a trigger that is not a control
|
|
40
|
+
* itself, like a badge or an icon. The button takes the click, the tap and the keyboard.
|
|
41
|
+
*/
|
|
42
|
+
wrapTrigger?: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A tooltip's bubble that opens on click, tap or Enter and stays open, so what it carries — a "Learn
|
|
46
|
+
* more" link, an action button — can be reached by pointer, touch and keyboard alike. It is a
|
|
47
|
+
* popover, not a tooltip: a tooltip closes as soon as focus leaves its trigger and ignores touch, so
|
|
48
|
+
* anything clickable inside one can't be reached.
|
|
49
|
+
*
|
|
50
|
+
* Reach for `BitkitTooltip` when the hint is text only; this component when it links or acts.
|
|
51
|
+
*
|
|
52
|
+
* The content renders in a portal, so it escapes any ancestor that traps stacking or clips overflow.
|
|
53
|
+
* Dialogs turn that off through `BitkitPortalContext`; `disablePortal` is the manual override.
|
|
54
|
+
*/
|
|
55
|
+
declare const BitkitToggletip: {
|
|
56
|
+
({ button, children, defaultOpen, disablePortal, disabled, icon: Icon, learnMoreTarget, learnMoreUrl, onOpenChange, open, placement, text, triggerAriaLabel, wrapTrigger, }: BitkitToggletipProps): import('react').JSX.Element;
|
|
57
|
+
displayName: string;
|
|
58
|
+
};
|
|
59
|
+
export default BitkitToggletip;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import BitkitPortalContext from "../../utilities/BitkitPortalContext.js";
|
|
2
|
+
import BitkitColorButton from "../BitkitColorButton/BitkitColorButton.js";
|
|
3
|
+
import { Box } from "@chakra-ui/react/box";
|
|
4
|
+
import { createSlotRecipeContext } from "@chakra-ui/react/styled-system";
|
|
5
|
+
import { isValidElement, useContext } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Portal } from "@chakra-ui/react/portal";
|
|
8
|
+
import { Popover } from "@ark-ui/react/popover";
|
|
9
|
+
import { Link } from "@chakra-ui/react/link";
|
|
10
|
+
//#region lib/components/BitkitToggletip/BitkitToggletip.tsx
|
|
11
|
+
var { withRootProvider, withContext } = createSlotRecipeContext({ key: "toggletip" });
|
|
12
|
+
var Root = withRootProvider(Popover.Root);
|
|
13
|
+
var Trigger = withContext(Popover.Trigger, "trigger", { forwardAsChild: true });
|
|
14
|
+
var Positioner = withContext(Popover.Positioner, "positioner", { forwardAsChild: true });
|
|
15
|
+
var Content = withContext(Popover.Content, "content", { forwardAsChild: true });
|
|
16
|
+
var Title = withContext(Popover.Title, "title", { forwardAsChild: true });
|
|
17
|
+
var Arrow = withContext(Popover.Arrow, "arrow", { forwardAsChild: true });
|
|
18
|
+
var ArrowTip = withContext(Popover.ArrowTip, "arrowTip", { forwardAsChild: true });
|
|
19
|
+
/**
|
|
20
|
+
* A tooltip's bubble that opens on click, tap or Enter and stays open, so what it carries — a "Learn
|
|
21
|
+
* more" link, an action button — can be reached by pointer, touch and keyboard alike. It is a
|
|
22
|
+
* popover, not a tooltip: a tooltip closes as soon as focus leaves its trigger and ignores touch, so
|
|
23
|
+
* anything clickable inside one can't be reached.
|
|
24
|
+
*
|
|
25
|
+
* Reach for `BitkitTooltip` when the hint is text only; this component when it links or acts.
|
|
26
|
+
*
|
|
27
|
+
* The content renders in a portal, so it escapes any ancestor that traps stacking or clips overflow.
|
|
28
|
+
* Dialogs turn that off through `BitkitPortalContext`; `disablePortal` is the manual override.
|
|
29
|
+
*/
|
|
30
|
+
var BitkitToggletip = ({ button, children, defaultOpen, disablePortal, disabled, icon: Icon, learnMoreTarget, learnMoreUrl, onOpenChange, open, placement = "top", text, triggerAriaLabel, wrapTrigger }) => {
|
|
31
|
+
const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);
|
|
32
|
+
const hasActions = !!learnMoreUrl || !!button;
|
|
33
|
+
if (disabled) return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
34
|
+
return /* @__PURE__ */ jsxs(Root, {
|
|
35
|
+
defaultOpen,
|
|
36
|
+
onOpenChange,
|
|
37
|
+
open,
|
|
38
|
+
positioning: {
|
|
39
|
+
placement,
|
|
40
|
+
offset: {
|
|
41
|
+
mainAxis: 4,
|
|
42
|
+
crossAxis: 0
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
children: [wrapTrigger || !isValidElement(children) ? /* @__PURE__ */ jsx(Trigger, {
|
|
46
|
+
"aria-label": triggerAriaLabel,
|
|
47
|
+
css: {
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
appearance: "none",
|
|
50
|
+
background: "none",
|
|
51
|
+
border: 0,
|
|
52
|
+
color: "inherit",
|
|
53
|
+
display: "inline-flex",
|
|
54
|
+
font: "inherit",
|
|
55
|
+
padding: 0,
|
|
56
|
+
_focusVisible: {
|
|
57
|
+
outline: "none",
|
|
58
|
+
"& > *": {
|
|
59
|
+
outlineColor: "var(--focus-ring-color)",
|
|
60
|
+
outlineOffset: "var(--focus-ring-offset, 2px)",
|
|
61
|
+
outlineStyle: "var(--focus-ring-style, solid)",
|
|
62
|
+
outlineWidth: "var(--focus-ring-width, 2px)"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
children
|
|
67
|
+
}) : /* @__PURE__ */ jsx(Trigger, {
|
|
68
|
+
asChild: true,
|
|
69
|
+
children
|
|
70
|
+
}), /* @__PURE__ */ jsx(Portal, {
|
|
71
|
+
disabled: disablePortal || disablePortalFromContext,
|
|
72
|
+
children: /* @__PURE__ */ jsx(Positioner, { children: /* @__PURE__ */ jsxs(Content, { children: [
|
|
73
|
+
/* @__PURE__ */ jsx(Arrow, { children: /* @__PURE__ */ jsx(ArrowTip, {}) }),
|
|
74
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
75
|
+
display: "flex",
|
|
76
|
+
gap: "8",
|
|
77
|
+
children: [/* @__PURE__ */ jsx(Title, { children: text }), Icon && /* @__PURE__ */ jsx(Icon, {
|
|
78
|
+
flexShrink: "0",
|
|
79
|
+
size: "16"
|
|
80
|
+
})]
|
|
81
|
+
}),
|
|
82
|
+
hasActions && /* @__PURE__ */ jsxs(Box, {
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
display: "flex",
|
|
85
|
+
gap: "16",
|
|
86
|
+
marginBlockStart: "16",
|
|
87
|
+
children: [learnMoreUrl && /* @__PURE__ */ jsx(Link, {
|
|
88
|
+
color: "color/purple/highlight",
|
|
89
|
+
href: learnMoreUrl,
|
|
90
|
+
rel: learnMoreTarget === "_blank" ? "noopener noreferrer" : void 0,
|
|
91
|
+
target: learnMoreTarget,
|
|
92
|
+
children: "Learn more"
|
|
93
|
+
}), button && /* @__PURE__ */ jsx(BitkitColorButton, {
|
|
94
|
+
colorVariant: "white",
|
|
95
|
+
marginInlineStart: "auto",
|
|
96
|
+
...button
|
|
97
|
+
})]
|
|
98
|
+
})
|
|
99
|
+
] }) })
|
|
100
|
+
})]
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
BitkitToggletip.displayName = "BitkitToggletip";
|
|
104
|
+
//#endregion
|
|
105
|
+
export { BitkitToggletip as default };
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=BitkitToggletip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitkitToggletip.js","names":[],"sources":["../../../lib/components/BitkitToggletip/BitkitToggletip.tsx"],"sourcesContent":["import { Popover as ArkPopover, type PopoverRootProps } from '@ark-ui/react/popover';\nimport { Box } from '@chakra-ui/react/box';\nimport { Link } from '@chakra-ui/react/link';\nimport {\n type PopoverArrowProps,\n type PopoverArrowTipProps,\n type PopoverContentProps,\n type PopoverPositionerProps,\n type PopoverTitleProps,\n type PopoverTriggerProps,\n} from '@chakra-ui/react/popover';\nimport { Portal } from '@chakra-ui/react/portal';\nimport { createSlotRecipeContext } from '@chakra-ui/react/styled-system';\nimport { isValidElement, type ReactNode, useContext } from 'react';\n\nimport { type BitkitIconComponent } from '../../icons';\nimport BitkitPortalContext from '../../utilities/BitkitPortalContext';\nimport BitkitColorButton, { type BitkitColorButtonProps } from '../BitkitColorButton/BitkitColorButton';\n\n// Chakra's own Popover is Ark's popover under the `popover` recipe; this is the same composition\n// under `toggletip`, so the bubble can share the tooltip's surface instead of the popover's card.\nconst { withRootProvider, withContext } = createSlotRecipeContext({ key: 'toggletip' });\nconst Root = withRootProvider<PopoverRootProps>(ArkPopover.Root);\nconst Trigger = withContext<HTMLButtonElement, PopoverTriggerProps>(ArkPopover.Trigger, 'trigger', {\n forwardAsChild: true,\n});\nconst Positioner = withContext<HTMLDivElement, PopoverPositionerProps>(ArkPopover.Positioner, 'positioner', {\n forwardAsChild: true,\n});\nconst Content = withContext<HTMLDivElement, PopoverContentProps>(ArkPopover.Content, 'content', {\n forwardAsChild: true,\n});\n// The text is the popover's title, which is what names its dialog for assistive technology.\nconst Title = withContext<HTMLDivElement, PopoverTitleProps>(ArkPopover.Title, 'title', { forwardAsChild: true });\nconst Arrow = withContext<HTMLDivElement, PopoverArrowProps>(ArkPopover.Arrow, 'arrow', { forwardAsChild: true });\nconst ArrowTip = withContext<HTMLDivElement, PopoverArrowTipProps>(ArkPopover.ArrowTip, 'arrowTip', {\n forwardAsChild: true,\n});\n\nexport type BitkitToggletipProps = {\n /** Action button at the end of the toggletip. Defaults to the `white` colour variant, the one that reads on its dark background. */\n button?: BitkitColorButtonProps;\n /**\n * The trigger the toggletip opens from. Rendered via `asChild`, so it must be a focusable control\n * that accepts a ref — unless `wrapTrigger` puts a button in between.\n */\n children: ReactNode;\n /** Open on first render, for an uncontrolled toggletip. */\n defaultOpen?: PopoverRootProps['defaultOpen'];\n /**\n * Render the toggletip inline instead of in a portal. Only needed when it must stay inside its\n * parent's DOM subtree — a dialog already sets this for you.\n */\n disablePortal?: boolean;\n /** Render the trigger without a toggletip — for hints that only apply in some states. */\n disabled?: boolean;\n /** Icon after the text — `IconArrowNortheast` when the trigger opens something in a new tab, for instance. */\n icon?: BitkitIconComponent;\n /** Target for the \"Learn more\" link. `_blank` also sets `rel=\"noopener noreferrer\"`. */\n learnMoreTarget?: HTMLAnchorElement['target'];\n /** Adds a \"Learn more\" link pointing here, for the fuller explanation. */\n learnMoreUrl?: string;\n /** Called when the toggletip opens or closes. */\n onOpenChange?: PopoverRootProps['onOpenChange'];\n /** Controls the open state. */\n open?: PopoverRootProps['open'];\n /** Where the toggletip sits relative to the trigger (default `top`). It flips if space is short. */\n placement?: NonNullable<PopoverRootProps['positioning']>['placement'];\n /** The toggletip's text. */\n text: string;\n /** Accessible name of the `wrapTrigger` button, for a trigger with no text of its own, like an icon. */\n triggerAriaLabel?: string;\n /**\n * Put the trigger inside a button instead of rendering on it — for a trigger that is not a control\n * itself, like a badge or an icon. The button takes the click, the tap and the keyboard.\n */\n wrapTrigger?: boolean;\n};\n\n/**\n * A tooltip's bubble that opens on click, tap or Enter and stays open, so what it carries — a \"Learn\n * more\" link, an action button — can be reached by pointer, touch and keyboard alike. It is a\n * popover, not a tooltip: a tooltip closes as soon as focus leaves its trigger and ignores touch, so\n * anything clickable inside one can't be reached.\n *\n * Reach for `BitkitTooltip` when the hint is text only; this component when it links or acts.\n *\n * The content renders in a portal, so it escapes any ancestor that traps stacking or clips overflow.\n * Dialogs turn that off through `BitkitPortalContext`; `disablePortal` is the manual override.\n */\nconst BitkitToggletip = ({\n button,\n children,\n defaultOpen,\n disablePortal,\n disabled,\n icon: Icon,\n learnMoreTarget,\n learnMoreUrl,\n onOpenChange,\n open,\n placement = 'top',\n text,\n triggerAriaLabel,\n wrapTrigger,\n}: BitkitToggletipProps) => {\n const { disablePortal: disablePortalFromContext } = useContext(BitkitPortalContext);\n const hasActions = !!learnMoreUrl || !!button;\n\n if (disabled) {\n return <>{children}</>;\n }\n\n return (\n <Root\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n open={open}\n positioning={{ placement, offset: { mainAxis: 4, crossAxis: 0 } }}\n >\n {wrapTrigger || !isValidElement(children) ? (\n <Trigger\n aria-label={triggerAriaLabel}\n css={{\n alignItems: 'center',\n appearance: 'none',\n background: 'none',\n border: 0,\n color: 'inherit',\n display: 'inline-flex',\n font: 'inherit',\n padding: 0,\n // The button owns the tab stop, but the focus ring belongs on the trigger inside it: an\n // outline follows the border-radius of the element it is drawn on, and the button has\n // none — so leaving it here squares off a pill or a round trigger.\n _focusVisible: {\n outline: 'none',\n '& > *': {\n outlineColor: 'var(--focus-ring-color)',\n outlineOffset: 'var(--focus-ring-offset, 2px)',\n outlineStyle: 'var(--focus-ring-style, solid)',\n outlineWidth: 'var(--focus-ring-width, 2px)',\n },\n },\n }}\n >\n {children}\n </Trigger>\n ) : (\n <Trigger asChild>{children}</Trigger>\n )}\n <Portal disabled={disablePortal || disablePortalFromContext}>\n <Positioner>\n <Content>\n <Arrow>\n <ArrowTip />\n </Arrow>\n <Box display=\"flex\" gap=\"8\">\n <Title>{text}</Title>\n {Icon && <Icon flexShrink=\"0\" size=\"16\" />}\n </Box>\n {hasActions && (\n <Box alignItems=\"center\" display=\"flex\" gap=\"16\" marginBlockStart=\"16\">\n {learnMoreUrl && (\n <Link\n color=\"color/purple/highlight\"\n href={learnMoreUrl}\n rel={learnMoreTarget === '_blank' ? 'noopener noreferrer' : undefined}\n target={learnMoreTarget}\n >\n Learn more\n </Link>\n )}\n {button && <BitkitColorButton colorVariant=\"white\" marginInlineStart=\"auto\" {...button} />}\n </Box>\n )}\n </Content>\n </Positioner>\n </Portal>\n </Root>\n );\n};\n\nBitkitToggletip.displayName = 'BitkitToggletip';\n\nexport default BitkitToggletip;\n"],"mappings":";;;;;;;;;;AAqBA,IAAM,EAAE,kBAAkB,gBAAgB,wBAAwB,EAAE,KAAK,YAAY,CAAC;AACtF,IAAM,OAAO,iBAAmC,QAAW,IAAI;AAC/D,IAAM,UAAU,YAAoD,QAAW,SAAS,WAAW,EACjG,gBAAgB,KAClB,CAAC;AACD,IAAM,aAAa,YAAoD,QAAW,YAAY,cAAc,EAC1G,gBAAgB,KAClB,CAAC;AACD,IAAM,UAAU,YAAiD,QAAW,SAAS,WAAW,EAC9F,gBAAgB,KAClB,CAAC;AAED,IAAM,QAAQ,YAA+C,QAAW,OAAO,SAAS,EAAE,gBAAgB,KAAK,CAAC;AAChH,IAAM,QAAQ,YAA+C,QAAW,OAAO,SAAS,EAAE,gBAAgB,KAAK,CAAC;AAChH,IAAM,WAAW,YAAkD,QAAW,UAAU,YAAY,EAClG,gBAAgB,KAClB,CAAC;;;;;;;;;;;;AAqDD,IAAM,mBAAmB,EACvB,QACA,UACA,aACA,eAC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