@kaizen/components 1.35.0 → 1.35.2

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.
Files changed (42) hide show
  1. package/dist/cjs/Button/GenericButton/GenericButton.cjs +1 -1
  2. package/dist/cjs/Button/GenericButton/GenericButton.cjs.map +1 -1
  3. package/dist/cjs/MultiSelect/subcomponents/Popover/Popover.cjs +1 -1
  4. package/dist/cjs/MultiSelect/subcomponents/Popover/Popover.cjs.map +1 -1
  5. package/dist/cjs/__future__/Select/Select.cjs +10 -1
  6. package/dist/cjs/__future__/Select/Select.cjs.map +1 -1
  7. package/dist/cjs/dts/MultiSelect/MultiSelect.d.ts +4 -2
  8. package/dist/cjs/dts/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.d.ts +3 -0
  9. package/dist/cjs/dts/MultiSelect/types.d.ts +6 -0
  10. package/dist/cjs/dts/TitleBlockZen/index.d.ts +1 -0
  11. package/dist/cjs/index.css +5 -5
  12. package/dist/esm/Button/GenericButton/GenericButton.mjs +1 -1
  13. package/dist/esm/Button/GenericButton/GenericButton.mjs.map +1 -1
  14. package/dist/esm/MultiSelect/subcomponents/Popover/Popover.mjs +1 -1
  15. package/dist/esm/MultiSelect/subcomponents/Popover/Popover.mjs.map +1 -1
  16. package/dist/esm/__future__/Select/Select.mjs +10 -1
  17. package/dist/esm/__future__/Select/Select.mjs.map +1 -1
  18. package/dist/esm/dts/MultiSelect/MultiSelect.d.ts +4 -2
  19. package/dist/esm/dts/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.d.ts +3 -0
  20. package/dist/esm/dts/MultiSelect/types.d.ts +6 -0
  21. package/dist/esm/dts/TitleBlockZen/index.d.ts +1 -0
  22. package/dist/esm/index.css +4 -4
  23. package/dist/index.d.ts +1 -1
  24. package/dist/styles.css +1 -1
  25. package/package.json +1 -1
  26. package/src/Button/Button/_docs/Button.mdx +5 -0
  27. package/src/Button/Button/_docs/Button.stories.tsx +27 -1
  28. package/src/Button/GenericButton/GenericButton.spec.tsx +69 -0
  29. package/src/Button/GenericButton/GenericButton.tsx +1 -1
  30. package/src/MultiSelect/MultiSelect.spec.tsx +56 -1
  31. package/src/MultiSelect/MultiSelect.tsx +10 -3
  32. package/src/MultiSelect/_docs/MultiSelect.mdx +10 -0
  33. package/src/MultiSelect/_docs/MultiSelect.stickersheet.stories.tsx +81 -43
  34. package/src/MultiSelect/_docs/MultiSelect.stories.tsx +21 -0
  35. package/src/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.module.scss +9 -0
  36. package/src/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.tsx +8 -1
  37. package/src/MultiSelect/subcomponents/MultiSelectToggle/_docs/MultiSelectToggle.stickersheet.stories.tsx +17 -0
  38. package/src/MultiSelect/subcomponents/Popover/Popover.tsx +1 -1
  39. package/src/MultiSelect/types.ts +7 -0
  40. package/src/TitleBlockZen/index.ts +1 -0
  41. package/src/__future__/Select/Select.spec.tsx +31 -12
  42. package/src/__future__/Select/Select.tsx +14 -1
@@ -44,7 +44,7 @@ const GenericButton = /*#__PURE__*/function () {
44
44
  };
45
45
  return React.createElement("span", {
46
46
  className: classnames(GenericButton_module.container, props.fullWidth && GenericButton_module.fullWidth),
47
- "aria-live": "polite"
47
+ "aria-live": "workingLabel" in props ? "polite" : undefined
48
48
  }, determineButtonRenderer());
49
49
  });
50
50
  GenericButton.defaultProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"GenericButton.cjs","sources":["../../../../src/Button/GenericButton/GenericButton.tsx"],"sourcesContent":["import React, {\n ComponentType,\n forwardRef,\n Ref,\n useImperativeHandle,\n useRef,\n MouseEvent,\n FocusEvent,\n} from \"react\"\nimport classnames from \"classnames\"\nimport { Badge, BadgeAnimated } from \"~components/Badge\"\nimport { LoadingSpinner } from \"~components/Loading\"\nimport styles from \"./GenericButton.module.scss\"\n\nexport type CustomButtonProps = {\n id?: string\n className: string\n href?: string\n disabled?: boolean\n onClick?: (e: MouseEvent<any>) => void\n onFocus?: (e: FocusEvent<HTMLElement>) => void\n onBlur?: (e: FocusEvent<HTMLElement>) => void\n children?: React.ReactNode\n \"data-testid\"?: string\n}\n\nexport type ButtonFormAttributes = Pick<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n | \"form\"\n | \"formAction\"\n | \"formMethod\"\n | \"formEncType\"\n | \"formTarget\"\n | \"formNoValidate\"\n>\n\nexport type GenericProps = {\n id?: string\n reversed?: boolean\n onClick?: (e: MouseEvent) => void\n onMouseDown?: (e: MouseEvent) => void\n href?: string\n newTabAndIUnderstandTheAccessibilityImplications?: boolean\n disableTabFocusAndIUnderstandTheAccessibilityImplications?: boolean\n onFocus?: (e: FocusEvent<HTMLElement>) => void\n onBlur?: (e: FocusEvent<HTMLElement>) => void\n component?: ComponentType<CustomButtonProps>\n classNameOverride?: string\n}\n\nexport type WorkingProps = {\n working: true\n workingLabel: string\n workingLabelHidden?: boolean\n}\n\nexport type WorkingUndefinedProps = {\n working?: false\n}\n\nexport type ButtonBadgeProps = {\n text: string\n animateChange?: boolean\n variant?: \"default\" | \"dark\" | \"active\"\n reversed?: boolean\n}\n\nexport type RenderProps = GenericButtonProps & {\n additionalContent?: React.ReactNode\n iconButton?: boolean\n directionalLink?: boolean\n paginationLink?: boolean\n isActive?: boolean\n}\n\nexport type ButtonRef = { focus: () => void }\n\nexport type GenericButtonProps = GenericProps &\n ButtonFormAttributes &\n (WorkingProps | WorkingUndefinedProps) & {\n label: string\n primary?: boolean\n destructive?: boolean\n secondary?: boolean\n /** @default \"regular\" */\n size?: \"small\" | \"regular\"\n badge?: ButtonBadgeProps\n type?: \"submit\" | \"reset\" | \"button\"\n fullWidth?: boolean\n iconPosition?: \"start\" | \"end\"\n icon?: JSX.Element\n disabled?: boolean\n }\n\n// We're treating custom props as anything that is kebab cased.\n// This is so we can support properties like aria-* or data-*\nconst getCustomProps = (props: Record<string, any>): Record<string, string> => {\n const keys = Object.keys(props).filter(k => k.indexOf(\"-\") !== -1)\n return keys.reduce<Record<string, any>>((acc, val) => {\n acc[val] = props[val]\n return acc\n }, {})\n}\n\nexport const GenericButton = forwardRef(\n (props: RenderProps, ref: Ref<ButtonRef | undefined>) => {\n const buttonRef = useRef<HTMLButtonElement | HTMLAnchorElement>()\n useImperativeHandle(ref, () => ({\n focus: (): void => {\n buttonRef.current?.focus()\n },\n }))\n\n const determineButtonRenderer = (): JSX.Element => {\n if (props.component) {\n return renderCustomComponent(props.component, props)\n }\n\n if (props.href && !props.disabled && !props.working) {\n return renderLink(props, buttonRef as Ref<HTMLAnchorElement>)\n }\n\n return renderButton(props, buttonRef as Ref<HTMLButtonElement>)\n }\n\n return (\n <span\n className={classnames(\n styles.container,\n props.fullWidth && styles.fullWidth\n )}\n aria-live=\"polite\"\n >\n {determineButtonRenderer()}\n </span>\n )\n }\n)\n\nGenericButton.defaultProps = {\n iconPosition: \"start\",\n iconButton: false,\n primary: false,\n secondary: false,\n newTabAndIUnderstandTheAccessibilityImplications: false,\n disableTabFocusAndIUnderstandTheAccessibilityImplications: false,\n type: \"button\",\n}\n\nGenericButton.displayName = \"GenericButton\"\n\nconst renderCustomComponent = (\n CustomComponent: ComponentType<CustomButtonProps>,\n props: RenderProps\n): JSX.Element => {\n const { id, disabled, href, onClick, onFocus, onBlur, ...rest } = props\n const customProps = getCustomProps(rest)\n return (\n <CustomComponent\n id={id}\n className={buttonClass(props)}\n disabled={disabled}\n href={href}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n aria-label={generateAriaLabel(props)}\n {...customProps}\n >\n {renderContent(props)}\n </CustomComponent>\n )\n}\n\nconst renderButton = (\n props: RenderProps,\n ref: Ref<HTMLButtonElement>\n): JSX.Element => {\n const {\n id,\n disabled,\n onClick,\n onMouseDown,\n type,\n disableTabFocusAndIUnderstandTheAccessibilityImplications,\n onFocus,\n onBlur,\n form,\n formAction,\n formMethod,\n formEncType,\n formTarget,\n formNoValidate,\n ...rest\n } = props\n const customProps = getCustomProps(rest)\n\n return (\n <button\n // eslint-disable-next-line react/button-has-type\n type={type}\n id={id}\n disabled={disabled}\n className={buttonClass(props)}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n onMouseDown={(e): void => onMouseDown && onMouseDown(e)}\n aria-label={generateAriaLabel(props)}\n aria-disabled={disabled || props.working ? true : undefined}\n form={form}\n formAction={formAction}\n formMethod={formMethod}\n formEncType={formEncType}\n formTarget={formTarget}\n formNoValidate={formNoValidate}\n tabIndex={\n disableTabFocusAndIUnderstandTheAccessibilityImplications\n ? -1\n : undefined\n }\n ref={ref}\n {...customProps}\n >\n {renderContent(props)}\n </button>\n )\n}\n\nconst renderLink = (\n props: RenderProps,\n ref: Ref<HTMLAnchorElement>\n): JSX.Element => {\n const {\n id,\n href,\n onClick,\n newTabAndIUnderstandTheAccessibilityImplications,\n onFocus,\n onBlur,\n ...rest\n } = props\n const customProps = getCustomProps(rest)\n\n const target = newTabAndIUnderstandTheAccessibilityImplications\n ? \"_blank\"\n : \"_self\"\n\n return (\n <a\n id={id}\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n className={buttonClass(props)}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n ref={ref}\n aria-label={generateAriaLabel(props)}\n {...customProps}\n >\n {renderContent(props)}\n </a>\n )\n}\n\nconst buttonClass = (props: RenderProps): string => {\n const isDefault = !props.primary && !props.destructive && !props.secondary\n return classnames(\n styles.button,\n isDefault && styles.default,\n props.primary && styles.primary,\n props.destructive && styles.destructive,\n props.secondary && styles.secondary,\n props.size && styles[props.size],\n props.reversed && styles.reversed,\n props.iconButton && styles.iconButton,\n props.working && styles.working,\n (props.directionalLink || props.paginationLink) && styles.circleButton,\n props.directionalLink && styles.directionalLink,\n props.paginationLink && styles.paginationLink,\n props.isActive && styles.isPaginationLinkActive,\n props.classNameOverride\n )\n}\n\nconst renderLoadingSpinner = (): JSX.Element => (\n <div className={styles.loadingSpinner}>\n <LoadingSpinner accessibilityLabel=\"\" size=\"sm\" />\n </div>\n)\n\nconst renderWorkingContent = (\n props: Extract<RenderProps, { working: true }>\n): JSX.Element => {\n if (props.workingLabelHidden) {\n return (\n <>\n {/* This is to ensure the button stays at the correct width */}\n <span className={styles.hidden} aria-hidden=\"true\">\n {renderDefaultContent(props)}\n </span>\n <span className={styles.centeredLoadingSpinner}>\n {renderLoadingSpinner()}\n </span>\n </>\n )\n }\n\n return (\n <>\n {props.iconPosition !== \"end\" && renderLoadingSpinner()}\n <span className={styles.label}>{props.workingLabel}</span>\n {props.additionalContent && (\n <span className={styles.additionalContentWrapper}>\n {props.additionalContent}\n </span>\n )}\n {props.iconPosition === \"end\" && renderLoadingSpinner()}\n </>\n )\n}\n\nconst renderDefaultContent = (props: RenderProps): JSX.Element => (\n <>\n {props.icon && props.iconPosition !== \"end\" && renderIcon(props.icon)}\n {(!props.icon || !props.iconButton) && (\n <span className={styles.label}>{props.label}</span>\n )}\n {props.additionalContent && (\n <span className={styles.additionalContentWrapper}>\n {props.additionalContent}\n </span>\n )}\n {renderBadge(props)}\n {props.icon && props.iconPosition === \"end\" && renderIcon(props.icon)}\n </>\n)\n\nconst renderBadge = (props: RenderProps): JSX.Element | null => {\n if (!props.badge) return null\n\n const { text, animateChange, reversed, variant } = props.badge\n\n if (animateChange) {\n return (\n <BadgeAnimated variant={variant} reversed={reversed}>\n {text}\n </BadgeAnimated>\n )\n }\n return (\n <Badge variant={variant} reversed={reversed}>\n {text}\n </Badge>\n )\n}\n\nconst renderContent = (props: RenderProps): JSX.Element => (\n <span className={styles.content}>\n {props.working ? renderWorkingContent(props) : renderDefaultContent(props)}\n </span>\n)\n\nconst renderIcon = (icon: JSX.Element): JSX.Element => (\n <span className={styles.iconWrapper}>{icon}</span>\n)\n\n// We only want an aria-label in the case that the button has just an icon and no text\n// This can happen when the button is working and workingLabelHidden is true,\n// or when this is an IconButton\nconst generateAriaLabel = (props: RenderProps): string | undefined => {\n if (props.working && props.workingLabelHidden) {\n return props.workingLabel\n }\n\n if (props.iconButton) {\n return props.label\n }\n\n return undefined\n}\n"],"names":["getCustomProps","props","keys","Object","filter","k","indexOf","reduce","acc","val","GenericButton","forwardRef","ref","buttonRef","useRef","useImperativeHandle","focus","_a","current","determineButtonRenderer","component","renderCustomComponent","href","disabled","working","renderLink","renderButton","React","createElement","className","classnames","styles","container","fullWidth","defaultProps","iconPosition","iconButton","primary","secondary","newTabAndIUnderstandTheAccessibilityImplications","disableTabFocusAndIUnderstandTheAccessibilityImplications","type","displayName","CustomComponent","id","onClick","onFocus","onBlur","rest","__rest","customProps","__assign","buttonClass","generateAriaLabel","renderContent","onMouseDown","form","formAction","formMethod","formEncType","formTarget","formNoValidate","e","undefined","tabIndex","target","rel","isDefault","destructive","button","size","reversed","directionalLink","paginationLink","circleButton","isActive","isPaginationLinkActive","classNameOverride","renderLoadingSpinner","loadingSpinner","LoadingSpinner","accessibilityLabel","renderWorkingContent","workingLabelHidden","Fragment","hidden","renderDefaultContent","centeredLoadingSpinner","label","workingLabel","additionalContent","additionalContentWrapper","icon","renderIcon","renderBadge","badge","text","animateChange","variant","BadgeAnimated","Badge","content","iconWrapper"],"mappings":";;;;;;;;;;;;;AA8FA;AACA;AACA,IAAMA,cAAc,GAAG,SAAAA,CAACC,KAA0B,EAAA;EAChD,IAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,KAAK,CAAC,CAACG,MAAM,CAAC,UAAAC,CAAC,EAAI;IAAA,OAAAA,CAAC,CAACC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;EAAA,CAAA,CAAC;EAClE,OAAOJ,IAAI,CAACK,MAAM,CAAsB,UAACC,GAAG,EAAEC,GAAG,EAAA;IAC/CD,GAAG,CAACC,GAAG,CAAC,GAAGR,KAAK,CAACQ,GAAG,CAAC;IACrB,OAAOD,GAAG;EACX,CAAA,EAAE,CAAE,CAAA,CAAC;AACR,CAAC;AAAA,MAEYE,aAAa;EAAA,MAAbA,aAA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AAQ,EACxCyB,IAAI,CACC;AAEZ,CAAC;AAED,IAAM1C,aAAa,GAAG,SAAAA,CAACrD,KAAkB;EAAkB,OACzD0B,KAAM,CAAAC,aAAA,CAAA,MAAA,EAAA;IAAAC,SAAS,EAAEE,oBAAM,CAACsE;EAAO,CAAA,EAC5BpG,KAAK,CAACuB,OAAO,GAAG0D,oBAAoB,CAACjF,KAAK,CAAC,GAAGqF,oBAAoB,CAACrF,KAAK,CAAC,CACrE;CACR;AAED,IAAM4F,UAAU,GAAG,SAAAA,CAACD,IAAiB,EAAkB;EAAA,OACrDjE,KAAM,CAAAC,aAAA,CAAA,MAAA,EAAA;IAAAC,SAAS,EAAEE,oBAAM,CAACuE;EAAc,CAAA,EAAAV,IAAI,CAAQ;AACnD,CAAA;AAED;AACA;AACA;AACA,IAAMvC,iBAAiB,GAAG,SAAAA,CAACpD,KAAkB,EAAA;EAC3C,IAAIA,KAAK,CAACuB,OAAO,IAAIvB,KAAK,CAACkF,kBAAkB,EAAE;IAC7C,OAAOlF,KAAK,CAACwF,YAAY;EAC1B;EAED,IAAIxF,KAAK,CAACmC,UAAU,EAAE;IACpB,OAAOnC,KAAK,CAACuF,KAAK;EACnB;EAED,OAAOzB,SAAS;AAClB,CAAC;"}
1
+ {"version":3,"file":"GenericButton.cjs","sources":["../../../../src/Button/GenericButton/GenericButton.tsx"],"sourcesContent":["import React, {\n ComponentType,\n forwardRef,\n Ref,\n useImperativeHandle,\n useRef,\n MouseEvent,\n FocusEvent,\n} from \"react\"\nimport classnames from \"classnames\"\nimport { Badge, BadgeAnimated } from \"~components/Badge\"\nimport { LoadingSpinner } from \"~components/Loading\"\nimport styles from \"./GenericButton.module.scss\"\n\nexport type CustomButtonProps = {\n id?: string\n className: string\n href?: string\n disabled?: boolean\n onClick?: (e: MouseEvent<any>) => void\n onFocus?: (e: FocusEvent<HTMLElement>) => void\n onBlur?: (e: FocusEvent<HTMLElement>) => void\n children?: React.ReactNode\n \"data-testid\"?: string\n}\n\nexport type ButtonFormAttributes = Pick<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n | \"form\"\n | \"formAction\"\n | \"formMethod\"\n | \"formEncType\"\n | \"formTarget\"\n | \"formNoValidate\"\n>\n\nexport type GenericProps = {\n id?: string\n reversed?: boolean\n onClick?: (e: MouseEvent) => void\n onMouseDown?: (e: MouseEvent) => void\n href?: string\n newTabAndIUnderstandTheAccessibilityImplications?: boolean\n disableTabFocusAndIUnderstandTheAccessibilityImplications?: boolean\n onFocus?: (e: FocusEvent<HTMLElement>) => void\n onBlur?: (e: FocusEvent<HTMLElement>) => void\n component?: ComponentType<CustomButtonProps>\n classNameOverride?: string\n}\n\nexport type WorkingProps = {\n working: true\n workingLabel: string\n workingLabelHidden?: boolean\n}\n\nexport type WorkingUndefinedProps = {\n working?: false\n}\n\nexport type ButtonBadgeProps = {\n text: string\n animateChange?: boolean\n variant?: \"default\" | \"dark\" | \"active\"\n reversed?: boolean\n}\n\nexport type RenderProps = GenericButtonProps & {\n additionalContent?: React.ReactNode\n iconButton?: boolean\n directionalLink?: boolean\n paginationLink?: boolean\n isActive?: boolean\n}\n\nexport type ButtonRef = { focus: () => void }\n\nexport type GenericButtonProps = GenericProps &\n ButtonFormAttributes &\n (WorkingProps | WorkingUndefinedProps) & {\n label: string\n primary?: boolean\n destructive?: boolean\n secondary?: boolean\n /** @default \"regular\" */\n size?: \"small\" | \"regular\"\n badge?: ButtonBadgeProps\n type?: \"submit\" | \"reset\" | \"button\"\n fullWidth?: boolean\n iconPosition?: \"start\" | \"end\"\n icon?: JSX.Element\n disabled?: boolean\n }\n\n// We're treating custom props as anything that is kebab cased.\n// This is so we can support properties like aria-* or data-*\nconst getCustomProps = (props: Record<string, any>): Record<string, string> => {\n const keys = Object.keys(props).filter(k => k.indexOf(\"-\") !== -1)\n return keys.reduce<Record<string, any>>((acc, val) => {\n acc[val] = props[val]\n return acc\n }, {})\n}\n\nexport const GenericButton = forwardRef(\n (props: RenderProps, ref: Ref<ButtonRef | undefined>) => {\n const buttonRef = useRef<HTMLButtonElement | HTMLAnchorElement>()\n useImperativeHandle(ref, () => ({\n focus: (): void => {\n buttonRef.current?.focus()\n },\n }))\n\n const determineButtonRenderer = (): JSX.Element => {\n if (props.component) {\n return renderCustomComponent(props.component, props)\n }\n\n if (props.href && !props.disabled && !props.working) {\n return renderLink(props, buttonRef as Ref<HTMLAnchorElement>)\n }\n\n return renderButton(props, buttonRef as Ref<HTMLButtonElement>)\n }\n\n return (\n <span\n className={classnames(\n styles.container,\n props.fullWidth && styles.fullWidth\n )}\n aria-live={\"workingLabel\" in props ? \"polite\" : undefined}\n >\n {determineButtonRenderer()}\n </span>\n )\n }\n)\n\nGenericButton.defaultProps = {\n iconPosition: \"start\",\n iconButton: false,\n primary: false,\n secondary: false,\n newTabAndIUnderstandTheAccessibilityImplications: false,\n disableTabFocusAndIUnderstandTheAccessibilityImplications: false,\n type: \"button\",\n}\n\nGenericButton.displayName = \"GenericButton\"\n\nconst renderCustomComponent = (\n CustomComponent: ComponentType<CustomButtonProps>,\n props: RenderProps\n): JSX.Element => {\n const { id, disabled, href, onClick, onFocus, onBlur, ...rest } = props\n const customProps = getCustomProps(rest)\n return (\n <CustomComponent\n id={id}\n className={buttonClass(props)}\n disabled={disabled}\n href={href}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n aria-label={generateAriaLabel(props)}\n {...customProps}\n >\n {renderContent(props)}\n </CustomComponent>\n )\n}\n\nconst renderButton = (\n props: RenderProps,\n ref: Ref<HTMLButtonElement>\n): JSX.Element => {\n const {\n id,\n disabled,\n onClick,\n onMouseDown,\n type,\n disableTabFocusAndIUnderstandTheAccessibilityImplications,\n onFocus,\n onBlur,\n form,\n formAction,\n formMethod,\n formEncType,\n formTarget,\n formNoValidate,\n ...rest\n } = props\n const customProps = getCustomProps(rest)\n\n return (\n <button\n // eslint-disable-next-line react/button-has-type\n type={type}\n id={id}\n disabled={disabled}\n className={buttonClass(props)}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n onMouseDown={(e): void => onMouseDown && onMouseDown(e)}\n aria-label={generateAriaLabel(props)}\n aria-disabled={disabled || props.working ? true : undefined}\n form={form}\n formAction={formAction}\n formMethod={formMethod}\n formEncType={formEncType}\n formTarget={formTarget}\n formNoValidate={formNoValidate}\n tabIndex={\n disableTabFocusAndIUnderstandTheAccessibilityImplications\n ? -1\n : undefined\n }\n ref={ref}\n {...customProps}\n >\n {renderContent(props)}\n </button>\n )\n}\n\nconst renderLink = (\n props: RenderProps,\n ref: Ref<HTMLAnchorElement>\n): JSX.Element => {\n const {\n id,\n href,\n onClick,\n newTabAndIUnderstandTheAccessibilityImplications,\n onFocus,\n onBlur,\n ...rest\n } = props\n const customProps = getCustomProps(rest)\n\n const target = newTabAndIUnderstandTheAccessibilityImplications\n ? \"_blank\"\n : \"_self\"\n\n return (\n <a\n id={id}\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n className={buttonClass(props)}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n ref={ref}\n aria-label={generateAriaLabel(props)}\n {...customProps}\n >\n {renderContent(props)}\n </a>\n )\n}\n\nconst buttonClass = (props: RenderProps): string => {\n const isDefault = !props.primary && !props.destructive && !props.secondary\n return classnames(\n styles.button,\n isDefault && styles.default,\n props.primary && styles.primary,\n props.destructive && styles.destructive,\n props.secondary && styles.secondary,\n props.size && styles[props.size],\n props.reversed && styles.reversed,\n props.iconButton && styles.iconButton,\n props.working && styles.working,\n (props.directionalLink || props.paginationLink) && styles.circleButton,\n props.directionalLink && styles.directionalLink,\n props.paginationLink && styles.paginationLink,\n props.isActive && styles.isPaginationLinkActive,\n props.classNameOverride\n )\n}\n\nconst renderLoadingSpinner = (): JSX.Element => (\n <div className={styles.loadingSpinner}>\n <LoadingSpinner accessibilityLabel=\"\" size=\"sm\" />\n </div>\n)\n\nconst renderWorkingContent = (\n props: Extract<RenderProps, { working: true }>\n): JSX.Element => {\n if (props.workingLabelHidden) {\n return (\n <>\n {/* This is to ensure the button stays at the correct width */}\n <span className={styles.hidden} aria-hidden=\"true\">\n {renderDefaultContent(props)}\n </span>\n <span className={styles.centeredLoadingSpinner}>\n {renderLoadingSpinner()}\n </span>\n </>\n )\n }\n\n return (\n <>\n {props.iconPosition !== \"end\" && renderLoadingSpinner()}\n <span className={styles.label}>{props.workingLabel}</span>\n {props.additionalContent && (\n <span className={styles.additionalContentWrapper}>\n {props.additionalContent}\n </span>\n )}\n {props.iconPosition === \"end\" && renderLoadingSpinner()}\n </>\n )\n}\n\nconst renderDefaultContent = (props: RenderProps): JSX.Element => (\n <>\n {props.icon && props.iconPosition !== \"end\" && renderIcon(props.icon)}\n {(!props.icon || !props.iconButton) && (\n <span className={styles.label}>{props.label}</span>\n )}\n {props.additionalContent && (\n <span className={styles.additionalContentWrapper}>\n {props.additionalContent}\n </span>\n )}\n {renderBadge(props)}\n {props.icon && props.iconPosition === \"end\" && renderIcon(props.icon)}\n </>\n)\n\nconst renderBadge = (props: RenderProps): JSX.Element | null => {\n if (!props.badge) return null\n\n const { text, animateChange, reversed, variant } = props.badge\n\n if (animateChange) {\n return (\n <BadgeAnimated variant={variant} reversed={reversed}>\n {text}\n </BadgeAnimated>\n )\n }\n return (\n <Badge variant={variant} reversed={reversed}>\n {text}\n </Badge>\n )\n}\n\nconst renderContent = (props: RenderProps): JSX.Element => (\n <span className={styles.content}>\n {props.working ? renderWorkingContent(props) : renderDefaultContent(props)}\n </span>\n)\n\nconst renderIcon = (icon: JSX.Element): JSX.Element => (\n <span className={styles.iconWrapper}>{icon}</span>\n)\n\n// We only want an aria-label in the case that the button has just an icon and no text\n// This can happen when the button is working and workingLabelHidden is true,\n// or when this is an IconButton\nconst generateAriaLabel = (props: RenderProps): string | undefined => {\n if (props.working && props.workingLabelHidden) {\n return props.workingLabel\n }\n\n if (props.iconButton) {\n return props.label\n }\n\n return undefined\n}\n"],"names":["getCustomProps","props","keys","Object","filter","k","indexOf","reduce","acc","val","GenericButton","forwardRef","ref","buttonRef","useRef","useImperativeHandle","focus","_a","current","determineButtonRenderer","component","renderCustomComponent","href","disabled","working","renderLink","renderButton","React","createElement","className","classnames","styles","container","fullWidth","undefined","defaultProps","iconPosition","iconButton","primary","secondary","newTabAndIUnderstandTheAccessibilityImplications","disableTabFocusAndIUnderstandTheAccessibilityImplications","type","displayName","CustomComponent","id","onClick","onFocus","onBlur","rest","__rest","customProps","__assign","buttonClass","generateAriaLabel","renderContent","onMouseDown","form","formAction","formMethod","formEncType","formTarget","formNoValidate","e","tabIndex","target","rel","isDefault","destructive","button","size","reversed","directionalLink","paginationLink","circleButton","isActive","isPaginationLinkActive","classNameOverride","renderLoadingSpinner","loadingSpinner","LoadingSpinner","accessibilityLabel","renderWorkingContent","workingLabelHidden","Fragment","hidden","renderDefaultContent","centeredLoadingSpinner","label","workingLabel","additionalContent","additionalContentWrapper","icon","renderIcon","renderBadge","badge","text","animateChange","variant","BadgeAnimated","Badge","content","iconWrapper"],"mappings":";;;;;;;;;;;;;AA8FA;AACA;AACA,IAAMA,cAAc,GAAG,SAAAA,CAACC,KAA0B,EAAA;EAChD,IAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,KAAK,CAAC,CAACG,MAAM,CAAC,UAAAC,CAAC,EAAI;IAAA,OAAAA,CAAC,CAACC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;EAAA,CAAA,CAAC;EAClE,OAAOJ,IAAI,CAACK,MAAM,CAAsB,UAACC,GAAG,EAAEC,GAAG,EAAA;IAC/CD,GAAG,CAACC,GAAG,CAAC,GAAGR,KAAK,CAACQ,GAAG,CAAC;IACrB,OAAOD,GAAG;EACX,CAAA,EAAE,CAAE,CAAA,CAAC;AACR,CAAC;AAAA,MAEYE,aAAa;EAAA,MAAbA,aAAa,GAAGC,KAAU,CAAAA,UAAA,CACrC,UAACV,KAAkB,EAAEW,GAA+B,EAAA;IAClD,IAAMC,SAAS,GAAGC,KAAAA,CAAA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SAAAA,CAACtD,KAAkB;EAAkB,OACzD0B,KAAM,CAAAC,aAAA,CAAA,MAAA,EAAA;IAAAC,SAAS,EAAEE,oBAAM,CAACsE;EAAO,CAAA,EAC5BpG,KAAK,CAACuB,OAAO,GAAG0D,oBAAoB,CAACjF,KAAK,CAAC,GAAGqF,oBAAoB,CAACrF,KAAK,CAAC,CACrE;CACR;AAED,IAAM4F,UAAU,GAAG,SAAAA,CAACD,IAAiB,EAAkB;EAAA,OACrDjE,KAAM,CAAAC,aAAA,CAAA,MAAA,EAAA;IAAAC,SAAS,EAAEE,oBAAM,CAACuE;EAAc,CAAA,EAAAV,IAAI,CAAQ;AACnD,CAAA;AAED;AACA;AACA;AACA,IAAMtC,iBAAiB,GAAG,SAAAA,CAACrD,KAAkB,EAAA;EAC3C,IAAIA,KAAK,CAACuB,OAAO,IAAIvB,KAAK,CAACkF,kBAAkB,EAAE;IAC7C,OAAOlF,KAAK,CAACwF,YAAY;EAC1B;EAED,IAAIxF,KAAK,CAACoC,UAAU,EAAE;IACpB,OAAOpC,KAAK,CAACuF,KAAK;EACnB;EAED,OAAOtD,SAAS;AAClB,CAAC;"}
@@ -22,7 +22,7 @@ const Popover = /*#__PURE__*/function () {
22
22
  floating: refs.floating.current
23
23
  },
24
24
  placement: "bottom-start",
25
- middleware: [reactDom.offset(15), reactDom.flip(), reactDom.size({
25
+ middleware: [reactDom.offset(6), reactDom.flip(), reactDom.size({
26
26
  apply: function (_a) {
27
27
  var availableWidth = _a.availableWidth,
28
28
  availableHeight = _a.availableHeight,
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.cjs","sources":["../../../../../src/MultiSelect/subcomponents/Popover/Popover.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport {\n autoUpdate,\n flip,\n offset,\n ReferenceType,\n useFloating,\n UseFloatingReturn,\n UseFloatingOptions,\n size,\n} from \"@floating-ui/react-dom\"\nimport classnames from \"classnames\"\nimport { FocusOn } from \"react-focus-on\"\nimport { ReactFocusOnProps } from \"react-focus-on/dist/es5/types\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport styles from \"./Popover.module.scss\"\n\nexport type PopoverProps<RT extends ReferenceType = ReferenceType> = {\n children: React.ReactNode\n refs: UseFloatingReturn<RT>[\"refs\"]\n /**\n * passes in additional options / override for https://floating-ui.com/docs/tooltip#usefloating-hook\n */\n floatingOptions?: Omit<UseFloatingOptions, \"elements\">\n focusOnProps?: Omit<ReactFocusOnProps, \"children\">\n portalContainer?: Element | DocumentFragment\n} & OverrideClassName<HTMLAttributes<HTMLDivElement>>\n\nexport const Popover = <RT extends ReferenceType>({\n children,\n refs,\n floatingOptions,\n focusOnProps,\n portalContainer,\n classNameOverride,\n ...restProps\n}: PopoverProps<RT>): JSX.Element => {\n const { floatingStyles } = useFloating({\n elements: {\n reference: refs.reference.current,\n floating: refs.floating.current,\n },\n placement: \"bottom-start\",\n middleware: [\n offset(15),\n flip(),\n size({\n apply({ availableWidth, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n maxWidth: `${Math.min(availableWidth, 400)}px`,\n minWidth: `${Math.min(availableWidth, 196)}px`,\n maxHeight: `${Math.min(availableHeight, 352)}px`,\n })\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n ...floatingOptions,\n })\n\n return createPortal(\n <FocusOn scrollLock={false} {...focusOnProps}>\n <div\n ref={refs.setFloating}\n style={floatingStyles}\n className={classnames(styles.popover, classNameOverride)}\n role=\"dialog\"\n aria-modal=\"true\"\n {...restProps}\n >\n {children}\n </div>\n </FocusOn>,\n portalContainer ?? document.body\n )\n}\n\nPopover.displayName = \"Popover\"\n"],"names":["Popover","_a","children","refs","floatingOptions","focusOnProps","portalContainer","classNameOverride","restProps","__rest","floatingStyles","useFloating","__assign","elements","reference","current","floating","placement","middleware","offset","flip","size","apply","availableWidth","availableHeight","Object","assign","style","maxWidth","concat","Math","min","minWidth","maxHeight","whileElementsMounted","autoUpdate","createPortal","React","createElement","FocusOn","scrollLock","ref","setFloating","className","classnames","styles","popover","role","document","body","displayName"],"mappings":";;;;;;;;;MA6BaA,OAAO;EAAA,MAAPA,OAAO,GAAG,SAAAA,CAA2BC,EAQ/B,EAAA;IAPjB,IAAAC,QAAQ,cAAA;MACRC,IAAI,UAAA;MACJC,eAAe,qBAAA;MACfC,YAAY,kBAAA;MACZC,eAAe,qBAAA;MACfC,iBAAiB,uBAAA;MACdC,SAAS,GAPoCC,KAAA,CAAAA,MAAA,CAAAR,EAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,iBAAA,EAAA,cAAA,EAAA,iBAAA,EAAA,mBAAA,CAQjD,CADa;IAEJ,IAAAS,cAAc,GAAKC,QAAAA,CAAAA,WAAW,CAAAC,KAAA,CAAAA,QAAA,CAAA;MACpCC,QAAQ,EAAE;QACRC,SAAS,EAAEX,IAAI,CAACW,SAAS,CAACC,OAAO;QACjCC,QAAQ,EAAEb,IAAI,CAACa,QAAQ,CAACD;MACzB,CAAA;MACDE,SAAS,EAAE,cAAc;MACzBC,UAAU,EAAE,CACVC,QAAAA,CAAAA,MAAM,CAAC,EAAE,CAAC,EACVC,aAAI,CAAE,CAAA,EACNC,aAAI,CAAC;QACHC,KAAK,YAACrB,EAA6C,EAAA;UAA3C,IAAAsB,cAAc,oBAAA;YAAEC,eAAe,GAAAvB,EAAA,CAAAuB,eAAA;YAAEX,QAAQ,GAAAZ,EAAA,CAAAY,QAAA;UAC/CY,MAAM,CAACC,MAAM,CAACb,QAAQ,CAACG,QAAQ,CAACW,KAAK,EAAE;YACrCC,QAAQ,EAAE,EAAG,CAAAC,MAAA,CAAAC,IAAI,CAACC,GAAG,CAACR,cAAc,EAAE,GAAG,CAAC,EAAI,IAAA,CAAA;YAC9CS,QAAQ,EAAE,EAAG,CAAAH,MAAA,CAAAC,IAAI,CAACC,GAAG,CAACR,cAAc,EAAE,GAAG,CAAC,EAAI,IAAA,CAAA;YAC9CU,SAAS,EAAE,EAAG,CAAAJ,MAAA,CAAAC,IAAI,CAACC,GAAG,CAACP,eAAe,EAAE,GAAG,CAAC,EAAI,IAAA;UACjD,CAAA,CAAC;QACH;OACF,CAAC,CACH;MACDU,oBAAoB,EAAEC,QAAU,CAAAA;IAAA,GAC7B/B,eAAe,CAAA,CAClB,eArBoB;IAuBtB,OAAOgC,QAAY,CAAAA,YAAA,CACjBC,KAAC,CAAAC,aAAA,CAAAC,YAAO,CAAAA,OAAA;MAACC,UAAU,EAAE;IAAK,CAAA,EAAMnC,YAAY,CAAA,EAC1CgC,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA1B,KAAA,CAAAA,QAAA,CAAA;MACE6B,GAAG,EAAEtC,IAAI,CAACuC,WAAW;MACrBf,KAAK,EAAEjB,cAAc;MACrBiC,SAAS,EAAEC,UAAU,CAACC,cAAM,CAACC,OAAO,EAAEvC,iBAAiB,CAAC;MACxDwC,IAAI,EAAC,QAAQ;oBACF;IAAM,CAAA,EACbvC,SAAS,CAEZ,EAAAN,QAAQ,CACL,CACE,EACVI,eAAe,KAAf,IAAA,IAAAA,eAAe,cAAfA,eAAe,GAAI0C,QAAQ,CAACC,IAAI,CACjC;EACH,CAAC;EAEDjD,OAAO,CAACkD,WAAW,GAAG,SAAS;EAAA,OAjDlBlD,OAAO;AAAA;"}
1
+ {"version":3,"file":"Popover.cjs","sources":["../../../../../src/MultiSelect/subcomponents/Popover/Popover.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport {\n autoUpdate,\n flip,\n offset,\n ReferenceType,\n useFloating,\n UseFloatingReturn,\n UseFloatingOptions,\n size,\n} from \"@floating-ui/react-dom\"\nimport classnames from \"classnames\"\nimport { FocusOn } from \"react-focus-on\"\nimport { ReactFocusOnProps } from \"react-focus-on/dist/es5/types\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport styles from \"./Popover.module.scss\"\n\nexport type PopoverProps<RT extends ReferenceType = ReferenceType> = {\n children: React.ReactNode\n refs: UseFloatingReturn<RT>[\"refs\"]\n /**\n * passes in additional options / override for https://floating-ui.com/docs/tooltip#usefloating-hook\n */\n floatingOptions?: Omit<UseFloatingOptions, \"elements\">\n focusOnProps?: Omit<ReactFocusOnProps, \"children\">\n portalContainer?: Element | DocumentFragment\n} & OverrideClassName<HTMLAttributes<HTMLDivElement>>\n\nexport const Popover = <RT extends ReferenceType>({\n children,\n refs,\n floatingOptions,\n focusOnProps,\n portalContainer,\n classNameOverride,\n ...restProps\n}: PopoverProps<RT>): JSX.Element => {\n const { floatingStyles } = useFloating({\n elements: {\n reference: refs.reference.current,\n floating: refs.floating.current,\n },\n placement: \"bottom-start\",\n middleware: [\n offset(6),\n flip(),\n size({\n apply({ availableWidth, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n maxWidth: `${Math.min(availableWidth, 400)}px`,\n minWidth: `${Math.min(availableWidth, 196)}px`,\n maxHeight: `${Math.min(availableHeight, 352)}px`,\n })\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n ...floatingOptions,\n })\n\n return createPortal(\n <FocusOn scrollLock={false} {...focusOnProps}>\n <div\n ref={refs.setFloating}\n style={floatingStyles}\n className={classnames(styles.popover, classNameOverride)}\n role=\"dialog\"\n aria-modal=\"true\"\n {...restProps}\n >\n {children}\n </div>\n </FocusOn>,\n portalContainer ?? document.body\n )\n}\n\nPopover.displayName = \"Popover\"\n"],"names":["Popover","_a","children","refs","floatingOptions","focusOnProps","portalContainer","classNameOverride","restProps","__rest","floatingStyles","useFloating","__assign","elements","reference","current","floating","placement","middleware","offset","flip","size","apply","availableWidth","availableHeight","Object","assign","style","maxWidth","concat","Math","min","minWidth","maxHeight","whileElementsMounted","autoUpdate","createPortal","React","createElement","FocusOn","scrollLock","ref","setFloating","className","classnames","styles","popover","role","document","body","displayName"],"mappings":";;;;;;;;;MA6BaA,OAAO;EAAA,MAAPA,OAAO,GAAG,SAAAA,CAA2BC,EAQ/B,EAAA;IAPjB,IAAAC,QAAQ,c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Ae,CAAA,CAClB,eArBoB;IAuBtB,OAAOgC,QAAY,CAAAA,YAAA,CACjBC,KAAC,CAAAC,aAAA,CAAAC,YAAO,CAAAA,OAAA;MAACC,UAAU,EAAE;IAAK,CAAA,EAAMnC,YAAY,CAAA,EAC1CgC,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA1B,KAAA,CAAAA,QAAA,CAAA;MACE6B,GAAG,EAAEtC,IAAI,CAACuC,WAAW;MACrBf,KAAK,EAAEjB,cAAc;MACrBiC,SAAS,EAAEC,UAAU,CAACC,cAAM,CAACC,OAAO,EAAEvC,iBAAiB,CAAC;MACxDwC,IAAI,EAAC,QAAQ;oBACF;IAAM,CAAA,EACbvC,SAAS,CAEZ,EAAAN,QAAQ,CACL,CACE,EACVI,eAAe,KAAf,IAAA,IAAAA,eAAe,cAAfA,eAAe,GAAI0C,QAAQ,CAACC,IAAI,CACjC;EACH,CAAC;EAEDjD,OAAO,CAACkD,WAAW,GAAG,SAAS;EAAA,OAjDlBlD,OAAO;AAAA;"}
@@ -64,11 +64,20 @@ const Select = /*#__PURE__*/function () {
64
64
  var state = select.useSelectState(ariaSelectProps);
65
65
  var _c = select$1.useSelect(ariaSelectProps, state, triggerRef),
66
66
  labelProps = _c.labelProps,
67
- triggerProps = _c.triggerProps,
67
+ reactAriaTriggerProps = _c.triggerProps,
68
68
  valueProps = _c.valueProps,
69
69
  menuProps = _c.menuProps,
70
70
  errorMessageProps = _c.errorMessageProps,
71
71
  descriptionProps = _c.descriptionProps;
72
+ // Hack incoming:
73
+ // react-aria/useSelect wants to prefix the combobox's accessible name with the value of the select.
74
+ // We use role=combobox, meaning screen readers will read the value.
75
+ // So we're modifying the `aria-labelledby` property to remove the value element id.
76
+ // Issue: https://github.com/adobe/react-spectrum/issues/4091
77
+ var reactAriaLabelledBy = reactAriaTriggerProps["aria-labelledby"];
78
+ var triggerProps = tslib.__assign(tslib.__assign({}, reactAriaTriggerProps), {
79
+ "aria-labelledby": reactAriaLabelledBy === null || reactAriaLabelledBy === void 0 ? void 0 : reactAriaLabelledBy.substring(reactAriaLabelledBy.indexOf(" ") + 1)
80
+ });
72
81
  var buttonProps = button.useButton(triggerProps, triggerRef).buttonProps;
73
82
  var selectToggleProps = tslib.__assign(tslib.__assign({}, buttonProps), {
74
83
  label: label,
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs","sources":["../../../../src/__future__/Select/Select.tsx"],"sourcesContent":["import React, { useId } from \"react\"\nimport { UseFloatingReturn } from \"@floating-ui/react-dom\"\nimport { useButton } from \"@react-aria/button\"\nimport { HiddenSelect, useSelect } from \"@react-aria/select\"\nimport {\n useSelectState,\n SelectProps as AriaSelectProps,\n} from \"@react-stately/select\"\nimport { Key } from \"@react-types/shared\"\nimport classnames from \"classnames\"\nimport { FieldMessage } from \"~components/FieldMessage\"\nimport {\n Popover,\n useFloating,\n} from \"~components/MultiSelect/subcomponents/Popover\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport { SelectProvider } from \"./context\"\nimport {\n ListBox,\n ListBoxSection,\n ListItem,\n Option,\n SectionDivider,\n SelectPopoverContents,\n SelectPopoverContentsProps,\n SelectToggle,\n SelectToggleProps,\n} from \"./subcomponents\"\nimport { SelectItem, SelectOption } from \"./types\"\nimport { getDisabledKeysFromItems } from \"./utils/getDisabledKeysFromItems\"\nimport { transformSelectItemToCollectionElement } from \"./utils/transformSelectItemToCollectionElement\"\nimport styles from \"./Select.module.scss\"\n\ntype OmittedAriaSelectProps = \"children\" | \"items\"\n\nexport type SelectProps<Option extends SelectOption = SelectOption> = {\n /**\n * Item objects in the collection.\n */\n items: Array<SelectItem<Option>>\n id?: string\n trigger?: (\n selectToggleProps: SelectToggleProps & {\n ref: UseFloatingReturn<HTMLButtonElement>[\"refs\"][\"setReference\"]\n },\n // @deprecated: This arg is unnecessary now, but provided for legacy usages\n ref: UseFloatingReturn<HTMLButtonElement>[\"refs\"][\"setReference\"]\n ) => JSX.Element\n children?: SelectPopoverContentsProps<Option>[\"children\"]\n /**\n * Updates the styling of the validation FieldMessage.\n */\n status?: \"error\" | \"caution\"\n /**\n * A descriptive message for the 'status' states.\n */\n validationMessage?: React.ReactNode | undefined\n /**\n * Use the `reversed` styles.\n */\n isReversed?: boolean\n /**\n * Use the `fullWidth` styles.\n */\n isFullWidth?: boolean\n /**\n * @deprecated: Either define `disabled` in your `Option` (in `items`), or use `disabledKeys`\n */\n disabledValues?: Key[]\n} & OverrideClassName<Omit<AriaSelectProps<Option>, OmittedAriaSelectProps>>\n\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896474/Select Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-select--docs Storybook}\n */\nexport const Select = <Option extends SelectOption = SelectOption>({\n label,\n items,\n id: propsId,\n trigger,\n children,\n status,\n validationMessage,\n isReversed,\n isFullWidth,\n disabledValues,\n classNameOverride,\n selectedKey,\n description,\n placeholder,\n isDisabled,\n ...restProps\n}: SelectProps<Option>): JSX.Element => {\n const { refs } = useFloating<HTMLButtonElement>()\n const triggerRef = refs.reference\n\n const id = propsId ?? useId()\n const descriptionId = `${id}--description`\n\n const disabledKeys = getDisabledKeysFromItems(items)\n\n const ariaSelectProps: AriaSelectProps<SelectItem<Option>> = {\n label,\n items,\n children: transformSelectItemToCollectionElement,\n disabledKeys: disabledValues ?? disabledKeys,\n selectedKey:\n typeof selectedKey === \"number\" ? selectedKey.toString() : selectedKey,\n description,\n placeholder,\n isDisabled,\n ...restProps,\n }\n\n const state = useSelectState(ariaSelectProps)\n\n const {\n labelProps,\n triggerProps,\n valueProps,\n menuProps,\n errorMessageProps,\n descriptionProps,\n } = useSelect(ariaSelectProps, state, triggerRef)\n\n const { buttonProps } = useButton(triggerProps, triggerRef)\n const selectToggleProps = {\n ...buttonProps,\n label,\n labelProps,\n value: state?.selectedItem?.rendered,\n valueProps,\n isOpen: state.isOpen,\n placeholder,\n status,\n isDisabled: triggerProps.isDisabled,\n isReversed,\n ref: refs.setReference,\n }\n\n return (\n <div\n className={classnames(\n !isFullWidth && styles.notFullWidth,\n classNameOverride\n )}\n >\n <HiddenSelect\n label={label}\n name={id}\n state={state}\n triggerRef={triggerRef}\n />\n\n <div className={styles.container}>\n {trigger === undefined ? (\n <SelectToggle {...selectToggleProps} />\n ) : (\n trigger(selectToggleProps, selectToggleProps.ref)\n )}\n {state.isOpen && (\n <Popover\n refs={refs}\n focusOnProps={{\n onEscapeKey: state.close,\n onClickOutside: state.close,\n noIsolation: true,\n }}\n >\n <SelectProvider<Option> state={state}>\n <SelectPopoverContents menuProps={menuProps}>\n {children}\n </SelectPopoverContents>\n </SelectProvider>\n </Popover>\n )}\n </div>\n\n {validationMessage && (\n <FieldMessage\n {...errorMessageProps}\n message={validationMessage}\n status={status}\n reversed={isReversed}\n />\n )}\n\n {description && (\n <FieldMessage\n {...descriptionProps}\n id={descriptionId}\n message={description}\n reversed={isReversed}\n />\n )}\n </div>\n )\n}\n\nSelect.displayName = \"Select\"\n\nSelect.Section = ListBoxSection\nSelect.SectionDivider = SectionDivider\nSelect.Option = Option\nSelect.ItemDefaultRender = ListItem\n\n// @deprecated Legacy exported aliases\nSelect.TriggerButton = SelectToggle\nSelect.ListBox = ListBox\n"],"names":["Select","_a","label","items","propsId","id","trigger","children","status","validationMessage","isReversed","isFullWidth","disabledValues","classNameOverride","selectedKey","description","placeholder","isDisabled","restProps","__rest","refs","useFloating","triggerRef","reference","useId","descriptionId","concat","disabledKeys","getDisabledKeysFromItems","ariaSelectProps","transformSelectItemToCollectionElement","toString","state","useSelectState","_c","useSelect","labelProps","triggerProps","valueProps","menuProps","errorMessageProps","descriptionProps","buttonProps","useButton","selectToggleProps","__assign","value","selectedItem","_b","rendered","isOpen","ref","setReference","React","createElement","className","classnames","styles","notFullWidth","HiddenSelect","name","container","undefined","SelectToggle","Popover","focusOnProps","onEscapeKey","close","onClickOutside","noIsolation","SelectProvider","SelectPopoverContents","FieldMessage","message","reversed","displayName","Section","ListBoxSection","SectionDivider","Option","Item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K,CAAA,EAClCqB,KAAC,CAAAC,aAAA,CAAAiB,qBAAAA,CAAAA,qBAAqB,EAAC;MAAAhC,SAAS,EAAEA;KAC/B,EAAAhC,QAAQ,CACa,CACT,CAEpB,CACG,EAELE,iBAAiB,IAChB4C,KAAA,CAAAC,aAAA,CAACkB,YAAY,CAAAA,YAAA,EACP3B,KAAA,CAAAA,QAAA,CAAA,CAAA,CAAA,EAAAL,iBAAiB;MACrBiC,OAAO,EAAEhE,iBAAiB;MAC1BD,MAAM,EAAEA,MAAM;MACdkE,QAAQ,EAAEhE;OAEb,EAEAK,WAAW,IACVsC,KAAC,CAAAC,aAAA,CAAAkB,YAAY,CAAAA,YAAA,qBACP/B,gBAAgB,EAAA;MACpBpC,EAAE,EAAEoB,aAAa;MACjBgD,OAAO,EAAE1D,WAAW;MACpB2D,QAAQ,EAAEhE;IACV,CAAA,CAAA,CACH,CACG;EAEV,CAAC;EAEDV,MAAM,CAAC2E,WAAW,GAAG,QAAQ;EAE7B3E,MAAM,CAAC4E,OAAO,GAAGC,cAAAA,CAAAA,cAAc;EAC/B7E,MAAM,CAAC8E,cAAc,GAAGA,cAAAA,CAAAA,cAAc;EACtC9E,MAAM,CAAC+E,MAAM,GAAGA,MAAAA,CAAAA,MAAM;EACtB/E,MAAM,CAACgF,iBAAiB,GAAGC,QAAAA,CAAAA,QAAQ;EAEnC;EACAjF,MAAM,CAACkF,aAAa,GAAGnB,YAAAA,CAAAA,YAAY;EACnC/D,MAAM,CAACmF,OAAO,GAAGA,OAAO,CAAAA,OAAA;EAAA,OArIXnF,MAAM;AAAA;"}
1
+ {"version":3,"file":"Select.cjs","sources":["../../../../src/__future__/Select/Select.tsx"],"sourcesContent":["import React, { useId } from \"react\"\nimport { UseFloatingReturn } from \"@floating-ui/react-dom\"\nimport { useButton } from \"@react-aria/button\"\nimport { HiddenSelect, useSelect } from \"@react-aria/select\"\nimport {\n useSelectState,\n SelectProps as AriaSelectProps,\n} from \"@react-stately/select\"\nimport { Key } from \"@react-types/shared\"\nimport classnames from \"classnames\"\nimport { FieldMessage } from \"~components/FieldMessage\"\nimport {\n Popover,\n useFloating,\n} from \"~components/MultiSelect/subcomponents/Popover\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport { SelectProvider } from \"./context\"\nimport {\n ListBox,\n ListBoxSection,\n ListItem,\n Option,\n SectionDivider,\n SelectPopoverContents,\n SelectPopoverContentsProps,\n SelectToggle,\n SelectToggleProps,\n} from \"./subcomponents\"\nimport { SelectItem, SelectOption } from \"./types\"\nimport { getDisabledKeysFromItems } from \"./utils/getDisabledKeysFromItems\"\nimport { transformSelectItemToCollectionElement } from \"./utils/transformSelectItemToCollectionElement\"\nimport styles from \"./Select.module.scss\"\n\ntype OmittedAriaSelectProps = \"children\" | \"items\"\n\nexport type SelectProps<Option extends SelectOption = SelectOption> = {\n /**\n * Item objects in the collection.\n */\n items: Array<SelectItem<Option>>\n id?: string\n trigger?: (\n selectToggleProps: SelectToggleProps & {\n ref: UseFloatingReturn<HTMLButtonElement>[\"refs\"][\"setReference\"]\n },\n // @deprecated: This arg is unnecessary now, but provided for legacy usages\n ref: UseFloatingReturn<HTMLButtonElement>[\"refs\"][\"setReference\"]\n ) => JSX.Element\n children?: SelectPopoverContentsProps<Option>[\"children\"]\n /**\n * Updates the styling of the validation FieldMessage.\n */\n status?: \"error\" | \"caution\"\n /**\n * A descriptive message for the 'status' states.\n */\n validationMessage?: React.ReactNode | undefined\n /**\n * Use the `reversed` styles.\n */\n isReversed?: boolean\n /**\n * Use the `fullWidth` styles.\n */\n isFullWidth?: boolean\n /**\n * @deprecated: Either define `disabled` in your `Option` (in `items`), or use `disabledKeys`\n */\n disabledValues?: Key[]\n} & OverrideClassName<Omit<AriaSelectProps<Option>, OmittedAriaSelectProps>>\n\n/**\n * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896474/Select Guidance} |\n * {@link https://cultureamp.design/?path=/docs/components-select--docs Storybook}\n */\nexport const Select = <Option extends SelectOption = SelectOption>({\n label,\n items,\n id: propsId,\n trigger,\n children,\n status,\n validationMessage,\n isReversed,\n isFullWidth,\n disabledValues,\n classNameOverride,\n selectedKey,\n description,\n placeholder,\n isDisabled,\n ...restProps\n}: SelectProps<Option>): JSX.Element => {\n const { refs } = useFloating<HTMLButtonElement>()\n const triggerRef = refs.reference\n\n const id = propsId ?? useId()\n const descriptionId = `${id}--description`\n\n const disabledKeys = getDisabledKeysFromItems(items)\n\n const ariaSelectProps: AriaSelectProps<SelectItem<Option>> = {\n label,\n items,\n children: transformSelectItemToCollectionElement,\n disabledKeys: disabledValues ?? disabledKeys,\n selectedKey:\n typeof selectedKey === \"number\" ? selectedKey.toString() : selectedKey,\n description,\n placeholder,\n isDisabled,\n ...restProps,\n }\n\n const state = useSelectState(ariaSelectProps)\n\n const {\n labelProps,\n triggerProps: reactAriaTriggerProps,\n valueProps,\n menuProps,\n errorMessageProps,\n descriptionProps,\n } = useSelect(ariaSelectProps, state, triggerRef)\n\n // Hack incoming:\n // react-aria/useSelect wants to prefix the combobox's accessible name with the value of the select.\n // We use role=combobox, meaning screen readers will read the value.\n // So we're modifying the `aria-labelledby` property to remove the value element id.\n // Issue: https://github.com/adobe/react-spectrum/issues/4091\n const reactAriaLabelledBy = reactAriaTriggerProps[\"aria-labelledby\"]\n const triggerProps = {\n ...reactAriaTriggerProps,\n \"aria-labelledby\": reactAriaLabelledBy?.substring(\n reactAriaLabelledBy.indexOf(\" \") + 1\n ),\n }\n\n const { buttonProps } = useButton(triggerProps, triggerRef)\n const selectToggleProps = {\n ...buttonProps,\n label,\n labelProps,\n value: state?.selectedItem?.rendered,\n valueProps,\n isOpen: state.isOpen,\n placeholder,\n status,\n isDisabled: triggerProps.isDisabled,\n isReversed,\n ref: refs.setReference,\n }\n\n return (\n <div\n className={classnames(\n !isFullWidth && styles.notFullWidth,\n classNameOverride\n )}\n >\n <HiddenSelect\n label={label}\n name={id}\n state={state}\n triggerRef={triggerRef}\n />\n\n <div className={styles.container}>\n {trigger === undefined ? (\n <SelectToggle {...selectToggleProps} />\n ) : (\n trigger(selectToggleProps, selectToggleProps.ref)\n )}\n {state.isOpen && (\n <Popover\n refs={refs}\n focusOnProps={{\n onEscapeKey: state.close,\n onClickOutside: state.close,\n noIsolation: true,\n }}\n >\n <SelectProvider<Option> state={state}>\n <SelectPopoverContents menuProps={menuProps}>\n {children}\n </SelectPopoverContents>\n </SelectProvider>\n </Popover>\n )}\n </div>\n\n {validationMessage && (\n <FieldMessage\n {...errorMessageProps}\n message={validationMessage}\n status={status}\n reversed={isReversed}\n />\n )}\n\n {description && (\n <FieldMessage\n {...descriptionProps}\n id={descriptionId}\n message={description}\n reversed={isReversed}\n />\n )}\n </div>\n )\n}\n\nSelect.displayName = \"Select\"\n\nSelect.Section = ListBoxSection\nSelect.SectionDivider = SectionDivider\nSelect.Option = Option\nSelect.ItemDefaultRender = ListItem\n\n// @deprecated Legacy exported aliases\nSelect.TriggerButton = SelectToggle\nSelect.ListBox = ListBox\n"],"names":["Select","_a","label","items","propsId","id","trigger","children","status","validationMessage","isReversed","isFullWidth","disabledValues","classNameOverride","selectedKey","description","placeholder","isDisabled","restProps","__rest","refs","useFloating","triggerRef","reference","useId","descriptionId","concat","disabledKeys","getDisabledKeysFromItems","ariaSelectProps","transformSelectItemToCollectionElement","toString","state","useSelectState","_c","useSelect","labelProps","reactAriaTriggerProps","triggerProps","valueProps","menuProps","errorMessageProps","descriptionProps","reactAriaLabelledBy","__assign","substring","indexOf","buttonProps","useButton","selectToggleProps","value","selectedItem","_b","rendered","isOpen","ref","setReference","React","createElement","className","classnames","styles","notFullWidth","HiddenSelect","name","container","undefined","SelectToggle","Popover","focusOnProps","onEscapeKey","close","onClickOutside","noIsolation","SelectProvider","SelectPopoverContents","FieldMessage","message","reversed","displayName","Section","ListBoxSection","SectionDivider","Option","ItemDefaultRender","ListItem","TriggerButton","ListBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuEA;;;AAGG;AAHH,M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OAAA;EAAA,OAlJXvF,MAAM;AAAA;"}
@@ -2,7 +2,7 @@ import { HTMLAttributes } from "react";
2
2
  import { FieldMessageProps } from "../FieldMessage";
3
3
  import { OverrideClassName } from "../types/OverrideClassName";
4
4
  import { MultiSelectOptionsProps } from "./subcomponents/MultiSelectOptions";
5
- import { MultiSelectOption } from "./types";
5
+ import { MultiSelectOption, ValidationMessage } from "./types";
6
6
  export type MultiSelectProps = {
7
7
  label: string;
8
8
  items: MultiSelectOptionsProps["options"];
@@ -14,8 +14,10 @@ export type MultiSelectProps = {
14
14
  onSelectedValuesChange: MultiSelectOptionsProps["onChange"];
15
15
  isOpen: boolean;
16
16
  onOpenChange: (isOpen: boolean) => void;
17
+ /** A status and message to provide context to the validation issue */
18
+ validationMessage?: ValidationMessage;
17
19
  } & OverrideClassName<HTMLAttributes<HTMLDivElement>>;
18
20
  export declare const MultiSelect: {
19
- ({ id: propsId, label, items, selectedValues, description, onSelectedValuesChange, isOpen, onOpenChange, classNameOverride, ...restProps }: MultiSelectProps): JSX.Element;
21
+ ({ id: propsId, label, items, selectedValues, description, onSelectedValuesChange, isOpen, onOpenChange, classNameOverride, validationMessage, ...restProps }: MultiSelectProps): JSX.Element;
20
22
  displayName: string;
21
23
  };
@@ -1,4 +1,5 @@
1
1
  import React, { HTMLAttributes } from "react";
2
+ import { FieldMessageProps } from "../../../FieldMessage";
2
3
  import { OverrideClassName } from "../../../types/OverrideClassName";
3
4
  import { MultiSelectOption } from "../../types";
4
5
  export type MultiSelectToggleProps = {
@@ -7,6 +8,7 @@ export type MultiSelectToggleProps = {
7
8
  ["aria-controls"]: string;
8
9
  selectedOptions: MultiSelectOption[];
9
10
  isOpen?: boolean;
11
+ status?: FieldMessageProps["status"];
10
12
  onRemoveOption: (optionValue: MultiSelectOption["value"]) => void;
11
13
  onRemoveAllOptions: () => void;
12
14
  } & OverrideClassName<HTMLAttributes<HTMLDivElement>>;
@@ -16,6 +18,7 @@ export declare const MultiSelectToggle: React.ForwardRefExoticComponent<{
16
18
  "aria-controls": string;
17
19
  selectedOptions: MultiSelectOption[];
18
20
  isOpen?: boolean | undefined;
21
+ status?: FieldMessageProps["status"];
19
22
  onRemoveOption: (optionValue: MultiSelectOption["value"]) => void;
20
23
  onRemoveAllOptions: () => void;
21
24
  } & Omit<React.HTMLAttributes<HTMLDivElement>, "className"> & {
@@ -1,4 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { FieldMessageStatus } from "../FieldMessage";
1
3
  export type MultiSelectOption = {
2
4
  label: string;
3
5
  value: string | number;
4
6
  };
7
+ export type ValidationMessage = {
8
+ status?: Extract<FieldMessageStatus, "error" | "caution">;
9
+ message: string | React.ReactElement;
10
+ };
@@ -1,2 +1,3 @@
1
1
  export * from "./TitleBlockZen";
2
2
  export * from "./subcomponents/NavigationTabs";
3
+ export * from "./types";
@@ -1,17 +1,17 @@
1
1
  .Select-module_container__TaMKg{position:relative;width:100%}.Select-module_notFullWidth__Mr-3G{width:180px}
2
- .Tag-module_tag__Ef8Iu{align-items:center;border-radius:28px;display:inline-flex;font-family:var(--typography-paragraph-intro-lede-font-family,"Inter","Noto Sans",Helvetica,Arial,sans-serif);font-size:var(--typography-paragraph-small-font-size,.875rem);font-weight:var(--typography-paragraph-small-font-weight,400);gap:var(--spacing-4,.25rem);line-height:var(--typography-paragraph-small-line-height,1.125rem);padding:var(--spacing-4,.25rem) var(--spacing-8,.5rem);white-space:nowrap}.Tag-module_iconContainer__tEPTW{display:inline-flex}.Tag-module_gray__4YmDZ{background-color:var(--color-gray-300,#eaeaec);color:var(--color-purple-800,#2f2438)}.Tag-module_blue__CjyTI{background-color:var(--color-blue-100,#e6f6ff);color:var(--color-blue-700,#003157)}.Tag-module_blue__CjyTI .Tag-module_iconContainer__tEPTW{color:var(--color-blue-500,#0168b3)}.Tag-module_green__uC0TU{background-color:var(--color-green-100,#e8f8f4);color:var(--color-green-700,#22594a)}.Tag-module_green__uC0TU .Tag-module_iconContainer__tEPTW{color:var(--color-green-500,#44a289)}.Tag-module_yellow__wEk5Z{background-color:var(--color-yellow-100,#fff9e4);color:var(--color-yellow-700,#876400)}.Tag-module_yellow__wEk5Z .Tag-module_iconContainer__tEPTW{color:var(--color-yellow-500,#ffb600)}.Tag-module_orange__V-KdG{background-color:var(--color-orange-100,#fff0e8);color:var(--color-orange-700,#903c00)}.Tag-module_orange__V-KdG .Tag-module_iconContainer__tEPTW{color:var(--color-orange-500,#e96c2f)}.Tag-module_red__cg1Rf{background-color:var(--color-red-100,#fdeaee);color:var(--color-red-700,#6c1e20)}.Tag-module_red__cg1Rf .Tag-module_iconContainer__tEPTW{color:var(--color-red-500,#c93b55)}.Tag-module_purple__OR2Jt{background-color:var(--color-purple-100,#f4edf8);color:var(--color-purple-700,#4a234d)}.Tag-module_purple__OR2Jt .Tag-module_iconContainer__tEPTW{color:var(--color-purple-500,#844587)}
3
2
  .RemovableTag-module_removableTag__IwJHj{padding:var(--spacing-4,.25rem) var(--spacing-4,.25rem) var(--spacing-4,.25rem) var(--spacing-8,.5rem);padding-block:var(--spacing-4,.25rem);padding-inline:var(--spacing-8,.5rem) var(--spacing-4,.25rem)}
3
+ .Tag-module_tag__Ef8Iu{align-items:center;border-radius:28px;display:inline-flex;font-family:var(--typography-paragraph-intro-lede-font-family,"Inter","Noto Sans",Helvetica,Arial,sans-serif);font-size:var(--typography-paragraph-small-font-size,.875rem);font-weight:var(--typography-paragraph-small-font-weight,400);gap:var(--spacing-4,.25rem);line-height:var(--typography-paragraph-small-line-height,1.125rem);padding:var(--spacing-4,.25rem) var(--spacing-8,.5rem);white-space:nowrap}.Tag-module_iconContainer__tEPTW{display:inline-flex}.Tag-module_gray__4YmDZ{background-color:var(--color-gray-300,#eaeaec);color:var(--color-purple-800,#2f2438)}.Tag-module_blue__CjyTI{background-color:var(--color-blue-100,#e6f6ff);color:var(--color-blue-700,#003157)}.Tag-module_blue__CjyTI .Tag-module_iconContainer__tEPTW{color:var(--color-blue-500,#0168b3)}.Tag-module_green__uC0TU{background-color:var(--color-green-100,#e8f8f4);color:var(--color-green-700,#22594a)}.Tag-module_green__uC0TU .Tag-module_iconContainer__tEPTW{color:var(--color-green-500,#44a289)}.Tag-module_yellow__wEk5Z{background-color:var(--color-yellow-100,#fff9e4);color:var(--color-yellow-700,#876400)}.Tag-module_yellow__wEk5Z .Tag-module_iconContainer__tEPTW{color:var(--color-yellow-500,#ffb600)}.Tag-module_orange__V-KdG{background-color:var(--color-orange-100,#fff0e8);color:var(--color-orange-700,#903c00)}.Tag-module_orange__V-KdG .Tag-module_iconContainer__tEPTW{color:var(--color-orange-500,#e96c2f)}.Tag-module_red__cg1Rf{background-color:var(--color-red-100,#fdeaee);color:var(--color-red-700,#6c1e20)}.Tag-module_red__cg1Rf .Tag-module_iconContainer__tEPTW{color:var(--color-red-500,#c93b55)}.Tag-module_purple__OR2Jt{background-color:var(--color-purple-100,#f4edf8);color:var(--color-purple-700,#4a234d)}.Tag-module_purple__OR2Jt .Tag-module_iconContainer__tEPTW{color:var(--color-purple-500,#844587)}
4
4
  .Popover-module_popover__B7k5I{background:var(--color-white,#fff);border-radius:var(--border-solid-border-radius,7px);box-shadow:var(--shadow-large-box-shadow,0 8px 40px rgba(0,0,0,.08),0 3px 9px rgba(0,0,0,.1));box-sizing:border-box;overflow:auto}
5
5
  .RemoveButton-module_removeButton__9yzxJ{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:none;border-radius:50%;color:inherit;color:rgba(var(--color-purple-800-rgb,47,36,56),.7);display:inline;display:inline-flex;font:inherit;margin:0;padding:0;position:relative}.RemoveButton-module_removeButton__9yzxJ:focus,.RemoveButton-module_removeButton__9yzxJ:focus-visible{outline:none}.RemoveButton-module_removeButton__9yzxJ:focus-visible:after,.RemoveButton-module_removeButton__9yzxJ:focus:after{background:transparent;border-color:var(--color-blue-500,#0168b3);border-radius:50%;border-style:var(--border-focus-ring-border-style,solid);border-width:var(--border-focus-ring-border-width,2px);content:"";inset:-3px;position:absolute}.RemoveButton-module_removeButton__9yzxJ:before{border-radius:50%;content:"";inset:-5px;position:absolute}.RemoveButton-module_removeButton__9yzxJ:focus,.RemoveButton-module_removeButton__9yzxJ:focus-visible,.RemoveButton-module_removeButton__9yzxJ:hover{background-color:rgba(var(--color-gray-600-rgb,82,78,86),.2);color:var(--color-purple-800,#2f2438);cursor:pointer}
6
6
  .Main-module_main__hMyB1{z-index:0}
7
7
  .Wrapper-module_wrapper__89WmC{background:var(--color-gray-100,#f9f9f9);display:grid;grid-template-rows:min-content 1fr min-content;min-height:100vh;position:relative}
8
- .FooterActions-module_footerAction__v7eL-{display:flex;flex-basis:auto;flex-grow:1}.FooterActions-module_footerActionPrevious__2XByZ{grid-area:"prev";justify-content:start}.FooterActions-module_footerActionNext__IKRta{grid-area:"next";justify-content:end}
8
+ .Titles-module_titles__JYwU0{align-items:center;flex-grow:1;grid-area:titles;justify-content:center}.Titles-module_pageTitle__YDp9S,.Titles-module_titles__JYwU0{display:flex;flex-direction:column}.Titles-module_prefix__40x8n{margin-bottom:var(--spacing-4,.25rem)}.Titles-module_status__huuP7{margin-top:var(--spacing-8,.5rem)}
9
+ .Actions-module_actions__Prrp0{align-items:center;display:flex;flex-direction:column;flex-grow:1;grid-area:actions;justify-content:center}@media (min-width:768px){.Actions-module_actions__Prrp0{align-items:flex-start;flex-direction:row;justify-content:flex-end;margin-top:calc(var(--spacing-12, .75rem)*-1)}}
9
10
  .Branding-module_branding__4h-rD{display:flex;flex-grow:1;grid-area:branding;justify-content:center;padding-top:var(--spacing-4,.25rem)}@media (min-width:768px){.Branding-module_branding__4h-rD{justify-content:unset}}.Branding-module_logo__vqqec{flex-basis:7.5rem}
11
+ .FooterActions-module_footerAction__v7eL-{display:flex;flex-basis:auto;flex-grow:1}.FooterActions-module_footerActionPrevious__2XByZ{grid-area:"prev";justify-content:start}.FooterActions-module_footerActionNext__IKRta{grid-area:"next";justify-content:end}
10
12
  .FooterRoot-module_footerRoot__N-6nQ{align-items:center;background:var(--color-blue-500,#0168b3);display:grid;flex-grow:1;gap:var(--spacing-16,1rem);grid-template-areas:"prev stepper next";grid-template-columns:1fr 2fr 1fr;justify-content:center;padding:var(--spacing-24,1.5rem) var(--spacing-12,.75rem)}@media (min-width:768px){.FooterRoot-module_footerRoot__N-6nQ{bottom:0;grid-template-columns:1fr 5fr 1fr;padding:var(--spacing-24,1.5rem) var(--spacing-32,2rem);position:sticky;z-index:1}}
11
- .Actions-module_actions__Prrp0{align-items:center;display:flex;flex-direction:column;flex-grow:1;grid-area:actions;justify-content:center}@media (min-width:768px){.Actions-module_actions__Prrp0{align-items:flex-start;flex-direction:row;justify-content:flex-end;margin-top:calc(var(--spacing-12, .75rem)*-1)}}
12
- .Titles-module_titles__JYwU0{align-items:center;flex-grow:1;grid-area:titles;justify-content:center}.Titles-module_pageTitle__YDp9S,.Titles-module_titles__JYwU0{display:flex;flex-direction:column}.Titles-module_prefix__40x8n{margin-bottom:var(--spacing-4,.25rem)}.Titles-module_status__huuP7{margin-top:var(--spacing-8,.5rem)}
13
- .ProgressStepper-module_stepsContainer__WMxXN{grid-area:stepper;width:100%}.ProgressStepper-module_stepList__b1wWX{align-items:flex-end;display:none;justify-content:center;list-style:none;margin:0;padding:0}@media (min-width:768px){.ProgressStepper-module_stepList__b1wWX{display:flex}}.ProgressStepper-module_step__-Ep19{container:step/inline-size;display:flex;flex-basis:100%;flex-grow:1;justify-content:center;max-width:var(--spacing-96,6rem);overflow-wrap:break-word;position:relative}.ProgressStepper-module_stepContent__B4uFS{align-items:center;display:flex;flex-direction:column}.ProgressStepper-module_stepIndicator__-qEWT{height:1.25rem;position:relative;width:1.25rem}.ProgressStepper-module_stepName__hS4lp{display:none;font-weight:var(--typography-paragraph-bold-font-weight,600);margin-bottom:var(--spacing-12,.75rem);text-align:center}.ProgressStepper-module_stepIcon__0Kh4y{color:var(--color-white,#fff);height:1.25rem;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:1.25rem}.ProgressStepper-module_stepDivider__KEZPU{border:var(--spacing-1,.0625rem) solid var(--color-white,#fff);border-radius:var(--border-solid-border-radius,7px);display:flex;flex-grow:1;height:0;left:100%;margin:0;min-width:calc(100% - var(--spacing-24, 1.5rem));position:absolute;top:calc(100% - .625rem);transform:translateX(-50%)}[dir=rtl] .ProgressStepper-module_stepDivider__KEZPU{left:unset;right:100%;transform:translateX(50%)}.ProgressStepper-module_stepperDescription__B00hX{display:flex;justify-content:center}@media (min-width:768px){.ProgressStepper-module_stepperDescription__B00hX{height:0;overflow:hidden;position:absolute;width:0}}@container step (min-width: 4.5rem){.ProgressStepper-module_stepName__hS4lp{display:inline}}
14
13
  .Root-module_root__7DVw5{align-items:center;background-color:var(--color-white,#fff);box-shadow:var(--shadow-small-box-shadow,0 3px 16px rgba(0,0,0,.06),0 1px 3px rgba(0,0,0,.1));display:grid;flex-grow:1;gap:var(--spacing-16,1rem);grid-template:"branding" min-content "titles" max-content "actions" min-content/1fr;justify-content:center;padding:var(--spacing-24,1.5rem);text-align:center}@media (min-width:768px){.Root-module_root__7DVw5{align-items:start;grid-template:"branding titles actions" min-content/1fr max-content 1fr;position:sticky;top:0;z-index:1}}
14
+ .ProgressStepper-module_stepsContainer__WMxXN{grid-area:stepper;width:100%}.ProgressStepper-module_stepList__b1wWX{align-items:flex-end;display:none;justify-content:center;list-style:none;margin:0;padding:0}@media (min-width:768px){.ProgressStepper-module_stepList__b1wWX{display:flex}}.ProgressStepper-module_step__-Ep19{container:step/inline-size;display:flex;flex-basis:100%;flex-grow:1;justify-content:center;max-width:var(--spacing-96,6rem);overflow-wrap:break-word;position:relative}.ProgressStepper-module_stepContent__B4uFS{align-items:center;display:flex;flex-direction:column}.ProgressStepper-module_stepIndicator__-qEWT{height:1.25rem;position:relative;width:1.25rem}.ProgressStepper-module_stepName__hS4lp{display:none;font-weight:var(--typography-paragraph-bold-font-weight,600);margin-bottom:var(--spacing-12,.75rem);text-align:center}.ProgressStepper-module_stepIcon__0Kh4y{color:var(--color-white,#fff);height:1.25rem;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:1.25rem}.ProgressStepper-module_stepDivider__KEZPU{border:var(--spacing-1,.0625rem) solid var(--color-white,#fff);border-radius:var(--border-solid-border-radius,7px);display:flex;flex-grow:1;height:0;left:100%;margin:0;min-width:calc(100% - var(--spacing-24, 1.5rem));position:absolute;top:calc(100% - .625rem);transform:translateX(-50%)}[dir=rtl] .ProgressStepper-module_stepDivider__KEZPU{left:unset;right:100%;transform:translateX(50%)}.ProgressStepper-module_stepperDescription__B00hX{display:flex;justify-content:center}@media (min-width:768px){.ProgressStepper-module_stepperDescription__B00hX{height:0;overflow:hidden;position:absolute;width:0}}@container step (min-width: 4.5rem){.ProgressStepper-module_stepName__hS4lp{display:inline}}
15
15
  .SVG-module_icon__8J5Ev{display:inline-block;height:20px;width:20px}.SVG-module_icon__8J5Ev>use{pointer-events:none}@media screen and (-ms-high-contrast:active){.SVG-module_icon__8J5Ev{color:#000}}@media screen and (-ms-high-contrast:white-on-black){.SVG-module_icon__8J5Ev{color:#fff}}@media screen and (-ms-high-contrast:black-on-white){.SVG-module_icon__8J5Ev{color:#000}}.SVG-module_inheritSize__Q8iam{display:block;height:inherit;width:inherit}
16
16
  .Avatar-module_wrapper__LY2q2{align-items:center;background:var(--color-gray-300,#eaeaec);border-radius:100%;box-sizing:border-box;display:flex;justify-content:center;overflow:hidden}.Avatar-module_wrapper__LY2q2:not(.Avatar-module_small__PeksS){border:3px solid var(--color-white,#fff);box-shadow:var(--shadow-small-box-shadow,0 3px 16px rgba(0,0,0,.06),0 1px 3px rgba(0,0,0,.1))}.Avatar-module_wrapper__LY2q2.Avatar-module_personal__2U7--{background:var(--color-orange-100,#fff0e8)}.Avatar-module_wrapper__LY2q2.Avatar-module_otherUser__b-drl{background:var(--color-gray-300,#eaeaec)}.Avatar-module_wrapper__LY2q2.Avatar-module_company__2qtJE{background:var(--color-white,#fff);border:0;border-radius:var(--border-solid-border-radius,7px);padding:6px}.Avatar-module_wrapper__LY2q2.Avatar-module_small__PeksS{height:1.25rem;width:1.25rem}.Avatar-module_wrapper__LY2q2.Avatar-module_small__PeksS .Avatar-module_initials__VDY2Q{margin-bottom:-1px}.Avatar-module_wrapper__LY2q2.Avatar-module_small__PeksS.Avatar-module_company__2qtJE{padding:0}.Avatar-module_wrapper__LY2q2.Avatar-module_medium__Vy3V8{height:3rem;width:3rem}.Avatar-module_wrapper__LY2q2.Avatar-module_medium__Vy3V8 .Avatar-module_initials__VDY2Q{margin-bottom:-1px}.Avatar-module_wrapper__LY2q2.Avatar-module_large__qiNWs{height:4.5rem;width:4.5rem}.Avatar-module_wrapper__LY2q2.Avatar-module_xlarge__Vx4IG{height:6rem;width:6rem}.Avatar-module_wrapper__LY2q2.Avatar-module_xxlarge__oOoGq{height:7.75rem;width:7.75rem}.Avatar-module_wrapper__LY2q2 .Avatar-module_initials__VDY2Q{speak-as:spell-out;border-bottom:none;text-decoration:none}.Avatar-module_avatarImage__FuULy{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.Avatar-module_loading__i9V-D .Avatar-module_avatarImage__FuULy{display:none}.Avatar-module_companyAvatarImage__7rlfG{border-radius:4px;box-sizing:border-box;-o-object-fit:contain;object-fit:contain}.Avatar-module_fallbackIcon__MPWxq{color:rgba(var(--color-purple-800-rgb,47,36,56),.7);width:28px}.Avatar-module_xxlarge__oOoGq .Avatar-module_fallbackIcon__MPWxq{width:75px}.Avatar-module_xlarge__Vx4IG .Avatar-module_fallbackIcon__MPWxq{width:60px}.Avatar-module_large__qiNWs .Avatar-module_fallbackIcon__MPWxq{width:35px}.Avatar-module_medium__Vy3V8 .Avatar-module_fallbackIcon__MPWxq{margin-bottom:-1px;width:25px}.Avatar-module_small__PeksS .Avatar-module_fallbackIcon__MPWxq{margin-bottom:-1px;width:10px}.Avatar-module_initials__VDY2Q{box-sizing:border-box;color:var(--color-purple-800,#2f2438);font-family:var(--typography-heading-1-font-family,"Inter","Noto Sans",Helvetica,Arial,sans-serif);font-size:22px;font-weight:var(--typography-heading-1-font-weight,700);letter-spacing:var(--typography-heading-3-letter-spacing,normal);padding-left:5px;padding-right:5px;text-align:center;width:100%}.Avatar-module_initials__VDY2Q:not(.Avatar-module_longName__31Yuf):before{content:"";display:block;margin-top:-.001em}.Avatar-module_xlarge__Vx4IG .Avatar-module_initials__VDY2Q,.Avatar-module_xxlarge__oOoGq .Avatar-module_initials__VDY2Q{font-size:34px;letter-spacing:var(--typography-heading-1-letter-spacing,normal)}.Avatar-module_medium__Vy3V8 .Avatar-module_initials__VDY2Q{font-size:16px}.Avatar-module_medium__Vy3V8 .Avatar-module_initials__VDY2Q,.Avatar-module_small__PeksS .Avatar-module_initials__VDY2Q{font-weight:var(--typography-heading-5-font-weight,600);letter-spacing:var(--typography-heading-5-letter-spacing,normal)}.Avatar-module_small__PeksS .Avatar-module_initials__VDY2Q{font-size:8px}
17
17
  .AvatarGroup-module_AvatarGroup__bdL0o{display:inline-flex;list-style:none;margin:0;padding:0}.AvatarGroup-module_small__7uv8k .AvatarGroup-module_AvatarGroupItem__xQol-+.AvatarGroup-module_AvatarGroupItem__xQol-{margin-inline-start:-.625rem}[dir=rtl] .AvatarGroup-module_small__7uv8k .AvatarGroup-module_AvatarGroupItem__xQol-+.AvatarGroup-module_AvatarGroupItem__xQol-{margin-left:0}.AvatarGroup-module_medium__af52y .AvatarGroup-module_AvatarGroupItem__xQol-+.AvatarGroup-module_AvatarGroupItem__xQol-{margin-inline-start:-1.5rem}[dir=rtl] .AvatarGroup-module_medium__af52y .AvatarGroup-module_AvatarGroupItem__xQol-+.AvatarGroup-module_AvatarGroupItem__xQol-{margin-left:0}.AvatarGroup-module_large__HN9Yy .AvatarGroup-module_AvatarGroupItem__xQol-+.AvatarGroup-module_AvatarGroupItem__xQol-{margin-inline-start:-2.25rem}[dir=rtl] .AvatarGroup-module_large__HN9Yy .AvatarGroup-module_AvatarGroupItem__xQol-+.AvatarGroup-module_AvatarGroupItem__xQol-{margin-left:0}.AvatarGroup-module_AvatarCounter__PKFzl{align-items:center;background:var(--color-gray-300,#eaeaec);border:3px solid var(--color-white,#fff);border-radius:100%;box-shadow:var(--shadow-small-box-shadow,0 3px 16px rgba(0,0,0,.06),0 1px 3px rgba(0,0,0,.1));box-sizing:border-box;display:flex;justify-content:center;overflow:hidden}.AvatarGroup-module_small__7uv8k .AvatarGroup-module_AvatarCounter__PKFzl{border:none;box-shadow:none;font-size:.5rem;height:1.25rem;width:1.25rem}.AvatarGroup-module_medium__af52y .AvatarGroup-module_AvatarCounter__PKFzl,.AvatarGroup-module_small__7uv8k .AvatarGroup-module_AvatarCounter__PKFzl{font-family:var(--typography-heading-5-font-family,"Inter","Noto Sans",Helvetica,Arial,sans-serif);font-weight:var(--typography-heading-5-font-weight,600);letter-spacing:var(--typography-heading-5-letter-spacing,normal)}.AvatarGroup-module_medium__af52y .AvatarGroup-module_AvatarCounter__PKFzl{font-size:var(--typography-heading-5-font-size,1rem);height:3rem;width:3rem}.AvatarGroup-module_large__HN9Yy .AvatarGroup-module_AvatarCounter__PKFzl{font-family:var(--typography-heading-3-font-family,"Inter","Noto Sans",Helvetica,Arial,sans-serif);font-size:var(--typography-heading-3-font-size,1.375rem);font-weight:var(--typography-heading-3-font-weight,700);height:4.5rem;letter-spacing:var(--typography-heading-3-letter-spacing,normal);width:4.5rem}[dir=rtl] .AvatarGroup-module_AvatarCounter__PKFzl{direction:ltr;margin-left:0}
@@ -42,7 +42,7 @@ const GenericButton = /*#__PURE__*/function () {
42
42
  };
43
43
  return /*#__PURE__*/React.createElement("span", {
44
44
  className: classnames(styles.container, props.fullWidth && styles.fullWidth),
45
- "aria-live": "polite"
45
+ "aria-live": "workingLabel" in props ? "polite" : undefined
46
46
  }, determineButtonRenderer());
47
47
  });
48
48
  GenericButton.defaultProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"GenericButton.mjs","sources":["../../../../src/Button/GenericButton/GenericButton.tsx"],"sourcesContent":["import React, {\n ComponentType,\n forwardRef,\n Ref,\n useImperativeHandle,\n useRef,\n MouseEvent,\n FocusEvent,\n} from \"react\"\nimport classnames from \"classnames\"\nimport { Badge, BadgeAnimated } from \"~components/Badge\"\nimport { LoadingSpinner } from \"~components/Loading\"\nimport styles from \"./GenericButton.module.scss\"\n\nexport type CustomButtonProps = {\n id?: string\n className: string\n href?: string\n disabled?: boolean\n onClick?: (e: MouseEvent<any>) => void\n onFocus?: (e: FocusEvent<HTMLElement>) => void\n onBlur?: (e: FocusEvent<HTMLElement>) => void\n children?: React.ReactNode\n \"data-testid\"?: string\n}\n\nexport type ButtonFormAttributes = Pick<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n | \"form\"\n | \"formAction\"\n | \"formMethod\"\n | \"formEncType\"\n | \"formTarget\"\n | \"formNoValidate\"\n>\n\nexport type GenericProps = {\n id?: string\n reversed?: boolean\n onClick?: (e: MouseEvent) => void\n onMouseDown?: (e: MouseEvent) => void\n href?: string\n newTabAndIUnderstandTheAccessibilityImplications?: boolean\n disableTabFocusAndIUnderstandTheAccessibilityImplications?: boolean\n onFocus?: (e: FocusEvent<HTMLElement>) => void\n onBlur?: (e: FocusEvent<HTMLElement>) => void\n component?: ComponentType<CustomButtonProps>\n classNameOverride?: string\n}\n\nexport type WorkingProps = {\n working: true\n workingLabel: string\n workingLabelHidden?: boolean\n}\n\nexport type WorkingUndefinedProps = {\n working?: false\n}\n\nexport type ButtonBadgeProps = {\n text: string\n animateChange?: boolean\n variant?: \"default\" | \"dark\" | \"active\"\n reversed?: boolean\n}\n\nexport type RenderProps = GenericButtonProps & {\n additionalContent?: React.ReactNode\n iconButton?: boolean\n directionalLink?: boolean\n paginationLink?: boolean\n isActive?: boolean\n}\n\nexport type ButtonRef = { focus: () => void }\n\nexport type GenericButtonProps = GenericProps &\n ButtonFormAttributes &\n (WorkingProps | WorkingUndefinedProps) & {\n label: string\n primary?: boolean\n destructive?: boolean\n secondary?: boolean\n /** @default \"regular\" */\n size?: \"small\" | \"regular\"\n badge?: ButtonBadgeProps\n type?: \"submit\" | \"reset\" | \"button\"\n fullWidth?: boolean\n iconPosition?: \"start\" | \"end\"\n icon?: JSX.Element\n disabled?: boolean\n }\n\n// We're treating custom props as anything that is kebab cased.\n// This is so we can support properties like aria-* or data-*\nconst getCustomProps = (props: Record<string, any>): Record<string, string> => {\n const keys = Object.keys(props).filter(k => k.indexOf(\"-\") !== -1)\n return keys.reduce<Record<string, any>>((acc, val) => {\n acc[val] = props[val]\n return acc\n }, {})\n}\n\nexport const GenericButton = forwardRef(\n (props: RenderProps, ref: Ref<ButtonRef | undefined>) => {\n const buttonRef = useRef<HTMLButtonElement | HTMLAnchorElement>()\n useImperativeHandle(ref, () => ({\n focus: (): void => {\n buttonRef.current?.focus()\n },\n }))\n\n const determineButtonRenderer = (): JSX.Element => {\n if (props.component) {\n return renderCustomComponent(props.component, props)\n }\n\n if (props.href && !props.disabled && !props.working) {\n return renderLink(props, buttonRef as Ref<HTMLAnchorElement>)\n }\n\n return renderButton(props, buttonRef as Ref<HTMLButtonElement>)\n }\n\n return (\n <span\n className={classnames(\n styles.container,\n props.fullWidth && styles.fullWidth\n )}\n aria-live=\"polite\"\n >\n {determineButtonRenderer()}\n </span>\n )\n }\n)\n\nGenericButton.defaultProps = {\n iconPosition: \"start\",\n iconButton: false,\n primary: false,\n secondary: false,\n newTabAndIUnderstandTheAccessibilityImplications: false,\n disableTabFocusAndIUnderstandTheAccessibilityImplications: false,\n type: \"button\",\n}\n\nGenericButton.displayName = \"GenericButton\"\n\nconst renderCustomComponent = (\n CustomComponent: ComponentType<CustomButtonProps>,\n props: RenderProps\n): JSX.Element => {\n const { id, disabled, href, onClick, onFocus, onBlur, ...rest } = props\n const customProps = getCustomProps(rest)\n return (\n <CustomComponent\n id={id}\n className={buttonClass(props)}\n disabled={disabled}\n href={href}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n aria-label={generateAriaLabel(props)}\n {...customProps}\n >\n {renderContent(props)}\n </CustomComponent>\n )\n}\n\nconst renderButton = (\n props: RenderProps,\n ref: Ref<HTMLButtonElement>\n): JSX.Element => {\n const {\n id,\n disabled,\n onClick,\n onMouseDown,\n type,\n disableTabFocusAndIUnderstandTheAccessibilityImplications,\n onFocus,\n onBlur,\n form,\n formAction,\n formMethod,\n formEncType,\n formTarget,\n formNoValidate,\n ...rest\n } = props\n const customProps = getCustomProps(rest)\n\n return (\n <button\n // eslint-disable-next-line react/button-has-type\n type={type}\n id={id}\n disabled={disabled}\n className={buttonClass(props)}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n onMouseDown={(e): void => onMouseDown && onMouseDown(e)}\n aria-label={generateAriaLabel(props)}\n aria-disabled={disabled || props.working ? true : undefined}\n form={form}\n formAction={formAction}\n formMethod={formMethod}\n formEncType={formEncType}\n formTarget={formTarget}\n formNoValidate={formNoValidate}\n tabIndex={\n disableTabFocusAndIUnderstandTheAccessibilityImplications\n ? -1\n : undefined\n }\n ref={ref}\n {...customProps}\n >\n {renderContent(props)}\n </button>\n )\n}\n\nconst renderLink = (\n props: RenderProps,\n ref: Ref<HTMLAnchorElement>\n): JSX.Element => {\n const {\n id,\n href,\n onClick,\n newTabAndIUnderstandTheAccessibilityImplications,\n onFocus,\n onBlur,\n ...rest\n } = props\n const customProps = getCustomProps(rest)\n\n const target = newTabAndIUnderstandTheAccessibilityImplications\n ? \"_blank\"\n : \"_self\"\n\n return (\n <a\n id={id}\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n className={buttonClass(props)}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n ref={ref}\n aria-label={generateAriaLabel(props)}\n {...customProps}\n >\n {renderContent(props)}\n </a>\n )\n}\n\nconst buttonClass = (props: RenderProps): string => {\n const isDefault = !props.primary && !props.destructive && !props.secondary\n return classnames(\n styles.button,\n isDefault && styles.default,\n props.primary && styles.primary,\n props.destructive && styles.destructive,\n props.secondary && styles.secondary,\n props.size && styles[props.size],\n props.reversed && styles.reversed,\n props.iconButton && styles.iconButton,\n props.working && styles.working,\n (props.directionalLink || props.paginationLink) && styles.circleButton,\n props.directionalLink && styles.directionalLink,\n props.paginationLink && styles.paginationLink,\n props.isActive && styles.isPaginationLinkActive,\n props.classNameOverride\n )\n}\n\nconst renderLoadingSpinner = (): JSX.Element => (\n <div className={styles.loadingSpinner}>\n <LoadingSpinner accessibilityLabel=\"\" size=\"sm\" />\n </div>\n)\n\nconst renderWorkingContent = (\n props: Extract<RenderProps, { working: true }>\n): JSX.Element => {\n if (props.workingLabelHidden) {\n return (\n <>\n {/* This is to ensure the button stays at the correct width */}\n <span className={styles.hidden} aria-hidden=\"true\">\n {renderDefaultContent(props)}\n </span>\n <span className={styles.centeredLoadingSpinner}>\n {renderLoadingSpinner()}\n </span>\n </>\n )\n }\n\n return (\n <>\n {props.iconPosition !== \"end\" && renderLoadingSpinner()}\n <span className={styles.label}>{props.workingLabel}</span>\n {props.additionalContent && (\n <span className={styles.additionalContentWrapper}>\n {props.additionalContent}\n </span>\n )}\n {props.iconPosition === \"end\" && renderLoadingSpinner()}\n </>\n )\n}\n\nconst renderDefaultContent = (props: RenderProps): JSX.Element => (\n <>\n {props.icon && props.iconPosition !== \"end\" && renderIcon(props.icon)}\n {(!props.icon || !props.iconButton) && (\n <span className={styles.label}>{props.label}</span>\n )}\n {props.additionalContent && (\n <span className={styles.additionalContentWrapper}>\n {props.additionalContent}\n </span>\n )}\n {renderBadge(props)}\n {props.icon && props.iconPosition === \"end\" && renderIcon(props.icon)}\n </>\n)\n\nconst renderBadge = (props: RenderProps): JSX.Element | null => {\n if (!props.badge) return null\n\n const { text, animateChange, reversed, variant } = props.badge\n\n if (animateChange) {\n return (\n <BadgeAnimated variant={variant} reversed={reversed}>\n {text}\n </BadgeAnimated>\n )\n }\n return (\n <Badge variant={variant} reversed={reversed}>\n {text}\n </Badge>\n )\n}\n\nconst renderContent = (props: RenderProps): JSX.Element => (\n <span className={styles.content}>\n {props.working ? renderWorkingContent(props) : renderDefaultContent(props)}\n </span>\n)\n\nconst renderIcon = (icon: JSX.Element): JSX.Element => (\n <span className={styles.iconWrapper}>{icon}</span>\n)\n\n// We only want an aria-label in the case that the button has just an icon and no text\n// This can happen when the button is working and workingLabelHidden is true,\n// or when this is an IconButton\nconst generateAriaLabel = (props: RenderProps): string | undefined => {\n if (props.working && props.workingLabelHidden) {\n return props.workingLabel\n }\n\n if (props.iconButton) {\n return props.label\n }\n\n return undefined\n}\n"],"names":["getCustomProps","props","keys","Object","filter","k","indexOf","reduce","acc","val","GenericButton","forwardRef","ref","buttonRef","useRef","useImperativeHandle","focus","_a","current","determineButtonRenderer","component","renderCustomComponent","href","disabled","working","renderLink","renderButton","React","createElement","className","classnames","styles","container","fullWidth","defaultProps","iconPosition","iconButton","primary","secondary","newTabAndIUnderstandTheAccessibilityImplications","disableTabFocusAndIUnderstandTheAccessibilityImplications","type","displayName","CustomComponent","id","onClick","onFocus","onBlur","rest","__rest","customProps","__assign","buttonClass","generateAriaLabel","renderContent","onMouseDown","form","formAction","formMethod","formEncType","formTarget","formNoValidate","e","undefined","tabIndex","target","rel","isDefault","destructive","button","size","reversed","directionalLink","paginationLink","circleButton","isActive","isPaginationLinkActive","classNameOverride","renderLoadingSpinner","loadingSpinner","LoadingSpinner","accessibilityLabel","renderWorkingContent","workingLabelHidden","Fragment","hidden","renderDefaultContent","centeredLoadingSpinner","label","workingLabel","additionalContent","additionalContentWrapper","icon","renderIcon","renderBadge","badge","text","animateChange","variant","BadgeAnimated","Badge","content","iconWrapper"],"mappings":";;;;;;;;;;;AA8FA;AACA;AACA,IAAMA,cAAc,GAAG,SAAAA,CAACC,KAA0B,EAAA;EAChD,IAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,KAAK,CAAC,CAACG,MAAM,CAAC,UAAAC,CAAC,EAAI;IAAA,OAAAA,CAAC,CAACC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;EAAA,CAAA,CAAC;EAClE,OAAOJ,IAAI,CAACK,MAAM,CAAsB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AA;IAACF,OAAO,EAAEA,OAAO;IAAE3B,QAAQ,EAAEA;GAAQ,EACxCyB,IAAI,CACC;AAEZ,CAAC;AAED,IAAM1C,aAAa,GAAG,SAAAA,CAACrD,KAAkB;EAAkB,oBACzD0B,KAAM,CAAAC,aAAA,CAAA,MAAA,EAAA;IAAAC,SAAS,EAAEE,MAAM,CAACsE;EAAO,CAAA,EAC5BpG,KAAK,CAACuB,OAAO,GAAG0D,oBAAoB,CAACjF,KAAK,CAAC,GAAGqF,oBAAoB,CAACrF,KAAK,CAAC,CACrE;CACR;AAED,IAAM4F,UAAU,GAAG,SAAAA,CAACD,IAAiB,EAAkB;EAAA,oBACrDjE,KAAM,CAAAC,aAAA,CAAA,MAAA,EAAA;IAAAC,SAAS,EAAEE,MAAM,CAACuE;EAAc,CAAA,EAAAV,IAAI,CAAQ;AACnD,CAAA;AAED;AACA;AACA;AACA,IAAMvC,iBAAiB,GAAG,SAAAA,CAACpD,KAAkB,EAAA;EAC3C,IAAIA,KAAK,CAACuB,OAAO,IAAIvB,KAAK,CAACkF,kBAAkB,EAAE;IAC7C,OAAOlF,KAAK,CAACwF,YAAY;EAC1B;EAED,IAAIxF,KAAK,CAACmC,UAAU,EAAE;IACpB,OAAOnC,KAAK,CAACuF,KAAK;EACnB;EAED,OAAOzB,SAAS;AAClB,CAAC;"}
1
+ {"version":3,"file":"GenericButton.mjs","sources":["../../../../src/Button/GenericButton/GenericButton.tsx"],"sourcesContent":["import React, {\n ComponentType,\n forwardRef,\n Ref,\n useImperativeHandle,\n useRef,\n MouseEvent,\n FocusEvent,\n} from \"react\"\nimport classnames from \"classnames\"\nimport { Badge, BadgeAnimated } from \"~components/Badge\"\nimport { LoadingSpinner } from \"~components/Loading\"\nimport styles from \"./GenericButton.module.scss\"\n\nexport type CustomButtonProps = {\n id?: string\n className: string\n href?: string\n disabled?: boolean\n onClick?: (e: MouseEvent<any>) => void\n onFocus?: (e: FocusEvent<HTMLElement>) => void\n onBlur?: (e: FocusEvent<HTMLElement>) => void\n children?: React.ReactNode\n \"data-testid\"?: string\n}\n\nexport type ButtonFormAttributes = Pick<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n | \"form\"\n | \"formAction\"\n | \"formMethod\"\n | \"formEncType\"\n | \"formTarget\"\n | \"formNoValidate\"\n>\n\nexport type GenericProps = {\n id?: string\n reversed?: boolean\n onClick?: (e: MouseEvent) => void\n onMouseDown?: (e: MouseEvent) => void\n href?: string\n newTabAndIUnderstandTheAccessibilityImplications?: boolean\n disableTabFocusAndIUnderstandTheAccessibilityImplications?: boolean\n onFocus?: (e: FocusEvent<HTMLElement>) => void\n onBlur?: (e: FocusEvent<HTMLElement>) => void\n component?: ComponentType<CustomButtonProps>\n classNameOverride?: string\n}\n\nexport type WorkingProps = {\n working: true\n workingLabel: string\n workingLabelHidden?: boolean\n}\n\nexport type WorkingUndefinedProps = {\n working?: false\n}\n\nexport type ButtonBadgeProps = {\n text: string\n animateChange?: boolean\n variant?: \"default\" | \"dark\" | \"active\"\n reversed?: boolean\n}\n\nexport type RenderProps = GenericButtonProps & {\n additionalContent?: React.ReactNode\n iconButton?: boolean\n directionalLink?: boolean\n paginationLink?: boolean\n isActive?: boolean\n}\n\nexport type ButtonRef = { focus: () => void }\n\nexport type GenericButtonProps = GenericProps &\n ButtonFormAttributes &\n (WorkingProps | WorkingUndefinedProps) & {\n label: string\n primary?: boolean\n destructive?: boolean\n secondary?: boolean\n /** @default \"regular\" */\n size?: \"small\" | \"regular\"\n badge?: ButtonBadgeProps\n type?: \"submit\" | \"reset\" | \"button\"\n fullWidth?: boolean\n iconPosition?: \"start\" | \"end\"\n icon?: JSX.Element\n disabled?: boolean\n }\n\n// We're treating custom props as anything that is kebab cased.\n// This is so we can support properties like aria-* or data-*\nconst getCustomProps = (props: Record<string, any>): Record<string, string> => {\n const keys = Object.keys(props).filter(k => k.indexOf(\"-\") !== -1)\n return keys.reduce<Record<string, any>>((acc, val) => {\n acc[val] = props[val]\n return acc\n }, {})\n}\n\nexport const GenericButton = forwardRef(\n (props: RenderProps, ref: Ref<ButtonRef | undefined>) => {\n const buttonRef = useRef<HTMLButtonElement | HTMLAnchorElement>()\n useImperativeHandle(ref, () => ({\n focus: (): void => {\n buttonRef.current?.focus()\n },\n }))\n\n const determineButtonRenderer = (): JSX.Element => {\n if (props.component) {\n return renderCustomComponent(props.component, props)\n }\n\n if (props.href && !props.disabled && !props.working) {\n return renderLink(props, buttonRef as Ref<HTMLAnchorElement>)\n }\n\n return renderButton(props, buttonRef as Ref<HTMLButtonElement>)\n }\n\n return (\n <span\n className={classnames(\n styles.container,\n props.fullWidth && styles.fullWidth\n )}\n aria-live={\"workingLabel\" in props ? \"polite\" : undefined}\n >\n {determineButtonRenderer()}\n </span>\n )\n }\n)\n\nGenericButton.defaultProps = {\n iconPosition: \"start\",\n iconButton: false,\n primary: false,\n secondary: false,\n newTabAndIUnderstandTheAccessibilityImplications: false,\n disableTabFocusAndIUnderstandTheAccessibilityImplications: false,\n type: \"button\",\n}\n\nGenericButton.displayName = \"GenericButton\"\n\nconst renderCustomComponent = (\n CustomComponent: ComponentType<CustomButtonProps>,\n props: RenderProps\n): JSX.Element => {\n const { id, disabled, href, onClick, onFocus, onBlur, ...rest } = props\n const customProps = getCustomProps(rest)\n return (\n <CustomComponent\n id={id}\n className={buttonClass(props)}\n disabled={disabled}\n href={href}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n aria-label={generateAriaLabel(props)}\n {...customProps}\n >\n {renderContent(props)}\n </CustomComponent>\n )\n}\n\nconst renderButton = (\n props: RenderProps,\n ref: Ref<HTMLButtonElement>\n): JSX.Element => {\n const {\n id,\n disabled,\n onClick,\n onMouseDown,\n type,\n disableTabFocusAndIUnderstandTheAccessibilityImplications,\n onFocus,\n onBlur,\n form,\n formAction,\n formMethod,\n formEncType,\n formTarget,\n formNoValidate,\n ...rest\n } = props\n const customProps = getCustomProps(rest)\n\n return (\n <button\n // eslint-disable-next-line react/button-has-type\n type={type}\n id={id}\n disabled={disabled}\n className={buttonClass(props)}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n onMouseDown={(e): void => onMouseDown && onMouseDown(e)}\n aria-label={generateAriaLabel(props)}\n aria-disabled={disabled || props.working ? true : undefined}\n form={form}\n formAction={formAction}\n formMethod={formMethod}\n formEncType={formEncType}\n formTarget={formTarget}\n formNoValidate={formNoValidate}\n tabIndex={\n disableTabFocusAndIUnderstandTheAccessibilityImplications\n ? -1\n : undefined\n }\n ref={ref}\n {...customProps}\n >\n {renderContent(props)}\n </button>\n )\n}\n\nconst renderLink = (\n props: RenderProps,\n ref: Ref<HTMLAnchorElement>\n): JSX.Element => {\n const {\n id,\n href,\n onClick,\n newTabAndIUnderstandTheAccessibilityImplications,\n onFocus,\n onBlur,\n ...rest\n } = props\n const customProps = getCustomProps(rest)\n\n const target = newTabAndIUnderstandTheAccessibilityImplications\n ? \"_blank\"\n : \"_self\"\n\n return (\n <a\n id={id}\n href={href}\n target={target}\n rel={target === \"_blank\" ? \"noopener noreferrer\" : undefined}\n className={buttonClass(props)}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n ref={ref}\n aria-label={generateAriaLabel(props)}\n {...customProps}\n >\n {renderContent(props)}\n </a>\n )\n}\n\nconst buttonClass = (props: RenderProps): string => {\n const isDefault = !props.primary && !props.destructive && !props.secondary\n return classnames(\n styles.button,\n isDefault && styles.default,\n props.primary && styles.primary,\n props.destructive && styles.destructive,\n props.secondary && styles.secondary,\n props.size && styles[props.size],\n props.reversed && styles.reversed,\n props.iconButton && styles.iconButton,\n props.working && styles.working,\n (props.directionalLink || props.paginationLink) && styles.circleButton,\n props.directionalLink && styles.directionalLink,\n props.paginationLink && styles.paginationLink,\n props.isActive && styles.isPaginationLinkActive,\n props.classNameOverride\n )\n}\n\nconst renderLoadingSpinner = (): JSX.Element => (\n <div className={styles.loadingSpinner}>\n <LoadingSpinner accessibilityLabel=\"\" size=\"sm\" />\n </div>\n)\n\nconst renderWorkingContent = (\n props: Extract<RenderProps, { working: true }>\n): JSX.Element => {\n if (props.workingLabelHidden) {\n return (\n <>\n {/* This is to ensure the button stays at the correct width */}\n <span className={styles.hidden} aria-hidden=\"true\">\n {renderDefaultContent(props)}\n </span>\n <span className={styles.centeredLoadingSpinner}>\n {renderLoadingSpinner()}\n </span>\n </>\n )\n }\n\n return (\n <>\n {props.iconPosition !== \"end\" && renderLoadingSpinner()}\n <span className={styles.label}>{props.workingLabel}</span>\n {props.additionalContent && (\n <span className={styles.additionalContentWrapper}>\n {props.additionalContent}\n </span>\n )}\n {props.iconPosition === \"end\" && renderLoadingSpinner()}\n </>\n )\n}\n\nconst renderDefaultContent = (props: RenderProps): JSX.Element => (\n <>\n {props.icon && props.iconPosition !== \"end\" && renderIcon(props.icon)}\n {(!props.icon || !props.iconButton) && (\n <span className={styles.label}>{props.label}</span>\n )}\n {props.additionalContent && (\n <span className={styles.additionalContentWrapper}>\n {props.additionalContent}\n </span>\n )}\n {renderBadge(props)}\n {props.icon && props.iconPosition === \"end\" && renderIcon(props.icon)}\n </>\n)\n\nconst renderBadge = (props: RenderProps): JSX.Element | null => {\n if (!props.badge) return null\n\n const { text, animateChange, reversed, variant } = props.badge\n\n if (animateChange) {\n return (\n <BadgeAnimated variant={variant} reversed={reversed}>\n {text}\n </BadgeAnimated>\n )\n }\n return (\n <Badge variant={variant} reversed={reversed}>\n {text}\n </Badge>\n )\n}\n\nconst renderContent = (props: RenderProps): JSX.Element => (\n <span className={styles.content}>\n {props.working ? renderWorkingContent(props) : renderDefaultContent(props)}\n </span>\n)\n\nconst renderIcon = (icon: JSX.Element): JSX.Element => (\n <span className={styles.iconWrapper}>{icon}</span>\n)\n\n// We only want an aria-label in the case that the button has just an icon and no text\n// This can happen when the button is working and workingLabelHidden is true,\n// or when this is an IconButton\nconst generateAriaLabel = (props: RenderProps): string | undefined => {\n if (props.working && props.workingLabelHidden) {\n return props.workingLabel\n }\n\n if (props.iconButton) {\n return props.label\n }\n\n return undefined\n}\n"],"names":["getCustomProps","props","keys","Object","filter","k","indexOf","reduce","acc","val","GenericButton","forwardRef","ref","buttonRef","useRef","useImperativeHandle","focus","_a","current","determineButtonRenderer","component","renderCustomComponent","href","disabled","working","renderLink","renderButton","React","createElement","className","classnames","styles","container","fullWidth","undefined","defaultProps","iconPosition","iconButton","primary","secondary","newTabAndIUnderstandTheAccessibilityImplications","disableTabFocusAndIUnderstandTheAccessibilityImplications","type","displayName","CustomComponent","id","onClick","onFocus","onBlur","rest","__rest","customProps","__assign","buttonClass","generateAriaLabel","renderContent","onMouseDown","form","formAction","formMethod","formEncType","formTarget","formNoValidate","e","tabIndex","target","rel","isDefault","destructive","button","size","reversed","directionalLink","paginationLink","circleButton","isActive","isPaginationLinkActive","classNameOverride","renderLoadingSpinner","loadingSpinner","LoadingSpinner","accessibilityLabel","renderWorkingContent","workingLabelHidden","Fragment","hidden","renderDefaultContent","centeredLoadingSpinner","label","workingLabel","additionalContent","additionalContentWrapper","icon","renderIcon","renderBadge","badge","text","animateChange","variant","BadgeAnimated","Badge","content","iconWrapper"],"mappings":";;;;;;;;;;;AA8FA;AACA;AACA,IAAMA,cAAc,GAAG,SAAAA,CAACC,KAA0B,EAAA;EAChD,IAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,KAAK,CAAC,CAACG,MAAM,CAAC,UAAAC,CAAC,EAAI;IAAA,OAAAA,CAAC,CAACC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;EAAA,CAAA,CAAC;EAClE,OAAOJ,IAAI,CAACK,MAAM,CAAsB,UAACC,GAAG,EAAEC,GAAG,EAAA;IAC/CD,GAAG,CAACC,GAAG,CAAC,GAAGR,KAAK,CAACQ,GAAG,CAAC;IACrB,OAAOD,GAAG;EACX,CAAA,EAAE,CAAE,CAAA,CAAC;AACR,CAAC;AAAA,MAEYE,aAAa;EAAA,MAAbA,aAAa,gBAAGC,UAAU,CACrC,UAACV,KAAkB,EAAEW,GAA+B,EAAA;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,MAAM,CAACsE;EAAO,CAAA,EAC5BpG,KAAK,CAACuB,OAAO,GAAG0D,oBAAoB,CAACjF,KAAK,CAAC,GAAGqF,oBAAoB,CAACrF,KAAK,CAAC,CACrE;CACR;AAED,IAAM4F,UAAU,GAAG,SAAAA,CAACD,IAAiB,EAAkB;EAAA,oBACrDjE,KAAM,CAAAC,aAAA,CAAA,MAAA,EAAA;IAAAC,SAAS,EAAEE,MAAM,CAACuE;EAAc,CAAA,EAAAV,IAAI,CAAQ;AACnD,CAAA;AAED;AACA;AACA;AACA,IAAMtC,iBAAiB,GAAG,SAAAA,CAACrD,KAAkB,EAAA;EAC3C,IAAIA,KAAK,CAACuB,OAAO,IAAIvB,KAAK,CAACkF,kBAAkB,EAAE;IAC7C,OAAOlF,KAAK,CAACwF,YAAY;EAC1B;EAED,IAAIxF,KAAK,CAACoC,UAAU,EAAE;IACpB,OAAOpC,KAAK,CAACuF,KAAK;EACnB;EAED,OAAOtD,SAAS;AAClB,CAAC;"}
@@ -20,7 +20,7 @@ const Popover = /*#__PURE__*/function () {
20
20
  floating: refs.floating.current
21
21
  },
22
22
  placement: "bottom-start",
23
- middleware: [offset(15), flip(), size({
23
+ middleware: [offset(6), flip(), size({
24
24
  apply: function (_a) {
25
25
  var availableWidth = _a.availableWidth,
26
26
  availableHeight = _a.availableHeight,
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.mjs","sources":["../../../../../src/MultiSelect/subcomponents/Popover/Popover.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport {\n autoUpdate,\n flip,\n offset,\n ReferenceType,\n useFloating,\n UseFloatingReturn,\n UseFloatingOptions,\n size,\n} from \"@floating-ui/react-dom\"\nimport classnames from \"classnames\"\nimport { FocusOn } from \"react-focus-on\"\nimport { ReactFocusOnProps } from \"react-focus-on/dist/es5/types\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport styles from \"./Popover.module.scss\"\n\nexport type PopoverProps<RT extends ReferenceType = ReferenceType> = {\n children: React.ReactNode\n refs: UseFloatingReturn<RT>[\"refs\"]\n /**\n * passes in additional options / override for https://floating-ui.com/docs/tooltip#usefloating-hook\n */\n floatingOptions?: Omit<UseFloatingOptions, \"elements\">\n focusOnProps?: Omit<ReactFocusOnProps, \"children\">\n portalContainer?: Element | DocumentFragment\n} & OverrideClassName<HTMLAttributes<HTMLDivElement>>\n\nexport const Popover = <RT extends ReferenceType>({\n children,\n refs,\n floatingOptions,\n focusOnProps,\n portalContainer,\n classNameOverride,\n ...restProps\n}: PopoverProps<RT>): JSX.Element => {\n const { floatingStyles } = useFloating({\n elements: {\n reference: refs.reference.current,\n floating: refs.floating.current,\n },\n placement: \"bottom-start\",\n middleware: [\n offset(15),\n flip(),\n size({\n apply({ availableWidth, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n maxWidth: `${Math.min(availableWidth, 400)}px`,\n minWidth: `${Math.min(availableWidth, 196)}px`,\n maxHeight: `${Math.min(availableHeight, 352)}px`,\n })\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n ...floatingOptions,\n })\n\n return createPortal(\n <FocusOn scrollLock={false} {...focusOnProps}>\n <div\n ref={refs.setFloating}\n style={floatingStyles}\n className={classnames(styles.popover, classNameOverride)}\n role=\"dialog\"\n aria-modal=\"true\"\n {...restProps}\n >\n {children}\n </div>\n </FocusOn>,\n portalContainer ?? document.body\n )\n}\n\nPopover.displayName = \"Popover\"\n"],"names":["Popover","_a","children","refs","floatingOptions","focusOnProps","portalContainer","classNameOverride","restProps","__rest","floatingStyles","useFloating","__assign","elements","reference","current","floating","placement","middleware","offset","flip","size","apply","availableWidth","availableHeight","Object","assign","style","maxWidth","concat","Math","min","minWidth","maxHeight","whileElementsMounted","autoUpdate","createPortal","React","createElement","FocusOn","scrollLock","ref","setFloating","className","classnames","styles","popover","role","document","body","displayName"],"mappings":";;;;;;;MA6BaA,OAAO;EAAA,MAAPA,OAAO,GAAG,SAAAA,CAA2BC,EAQ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OgC,YAAY,eACjBC,KAAC,CAAAC,aAAA,CAAAC,OAAO;MAACC,UAAU,EAAE;IAAK,CAAA,EAAMnC,YAAY,CAAA,eAC1CgC,KAAA,CAAAC,aAAA,CAAA,KAAA,EAAA1B,QAAA,CAAA;MACE6B,GAAG,EAAEtC,IAAI,CAACuC,WAAW;MACrBf,KAAK,EAAEjB,cAAc;MACrBiC,SAAS,EAAEC,UAAU,CAACC,MAAM,CAACC,OAAO,EAAEvC,iBAAiB,CAAC;MACxDwC,IAAI,EAAC,QAAQ;oBACF;IAAM,CAAA,EACbvC,SAAS,CAEZ,EAAAN,QAAQ,CACL,CACE,EACVI,eAAe,KAAf,IAAA,IAAAA,eAAe,cAAfA,eAAe,GAAI0C,QAAQ,CAACC,IAAI,CACjC;EACH,CAAC;EAEDjD,OAAO,CAACkD,WAAW,GAAG,SAAS;EAAA,OAjDlBlD,OAAO;AAAA;"}
1
+ {"version":3,"file":"Popover.mjs","sources":["../../../../../src/MultiSelect/subcomponents/Popover/Popover.tsx"],"sourcesContent":["import React, { HTMLAttributes } from \"react\"\nimport { createPortal } from \"react-dom\"\nimport {\n autoUpdate,\n flip,\n offset,\n ReferenceType,\n useFloating,\n UseFloatingReturn,\n UseFloatingOptions,\n size,\n} from \"@floating-ui/react-dom\"\nimport classnames from \"classnames\"\nimport { FocusOn } from \"react-focus-on\"\nimport { ReactFocusOnProps } from \"react-focus-on/dist/es5/types\"\nimport { OverrideClassName } from \"~types/OverrideClassName\"\nimport styles from \"./Popover.module.scss\"\n\nexport type PopoverProps<RT extends ReferenceType = ReferenceType> = {\n children: React.ReactNode\n refs: UseFloatingReturn<RT>[\"refs\"]\n /**\n * passes in additional options / override for https://floating-ui.com/docs/tooltip#usefloating-hook\n */\n floatingOptions?: Omit<UseFloatingOptions, \"elements\">\n focusOnProps?: Omit<ReactFocusOnProps, \"children\">\n portalContainer?: Element | DocumentFragment\n} & OverrideClassName<HTMLAttributes<HTMLDivElement>>\n\nexport const Popover = <RT extends ReferenceType>({\n children,\n refs,\n floatingOptions,\n focusOnProps,\n portalContainer,\n classNameOverride,\n ...restProps\n}: PopoverProps<RT>): JSX.Element => {\n const { floatingStyles } = useFloating({\n elements: {\n reference: refs.reference.current,\n floating: refs.floating.current,\n },\n placement: \"bottom-start\",\n middleware: [\n offset(6),\n flip(),\n size({\n apply({ availableWidth, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n maxWidth: `${Math.min(availableWidth, 400)}px`,\n minWidth: `${Math.min(availableWidth, 196)}px`,\n maxHeight: `${Math.min(availableHeight, 352)}px`,\n })\n },\n }),\n ],\n whileElementsMounted: autoUpdate,\n ...floatingOptions,\n })\n\n return createPortal(\n <FocusOn scrollLock={false} {...focusOnProps}>\n <div\n ref={refs.setFloating}\n style={floatingStyles}\n className={classnames(styles.popover, classNameOverride)}\n role=\"dialog\"\n aria-modal=\"true\"\n {...restProps}\n >\n {children}\n </div>\n </FocusOn>,\n portalContainer ?? document.body\n )\n}\n\nPopover.displayName = \"Popover\"\n"],"names":["Popover","_a","children","refs","floatingOptions","focusOnProps","portalContainer","classNameOverride","restProps","__rest","floatingStyles","useFloating","__assign","elements","reference","current","floating","placement","middleware","offset","flip","size","apply","availableWidth","availableHeight","Object","assign","style","maxWidth","concat","Math","min","minWidth","maxHeight","whileElementsMounted","autoUpdate","createPortal","React","createElement","FocusOn","scrollLock","ref","setFloating","className","classnames","styles","popover","role","document","body","displayName"],"mappings":";;;;;;;MA6BaA,OAAO;EAAA,MAAPA,OAAO,GAAG,SAAAA,CAA2BC,EAQ/B,EAAA;IAPjB,IAAAC,QAAQ,cAAA;MACRC,IAAI,UAAA;MACJC,eAAe,qBAAA;MACfC,YAAY,kBAAA;MACZC,eAAe,qBAAA;MACfC,iBAAiB,uBAAA;MACdC,SAAS,GAPoCC,MAAA,CAAAR,EAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,iBAAA,EAAA,cAAA,EAAA,iBAAA,EAAA,mBAAA,CAQjD,CADa;IAEJ,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,OAAO,EAAEvC,iBAAiB,CAAC;MACxDwC,IAAI,EAAC,QAAQ;oBACF;IAAM,CAAA,EACbvC,SAAS,CAEZ,EAAAN,QAAQ,CACL,CACE,EACVI,eAAe,KAAf,IAAA,IAAAA,eAAe,cAAfA,eAAe,GAAI0C,QAAQ,CAACC,IAAI,CACjC;EACH,CAAC;EAEDjD,OAAO,CAACkD,WAAW,GAAG,SAAS;EAAA,OAjDlBlD,OAAO;AAAA;"}
@@ -62,11 +62,20 @@ const Select = /*#__PURE__*/function () {
62
62
  var state = useSelectState(ariaSelectProps);
63
63
  var _c = useSelect(ariaSelectProps, state, triggerRef),
64
64
  labelProps = _c.labelProps,
65
- triggerProps = _c.triggerProps,
65
+ reactAriaTriggerProps = _c.triggerProps,
66
66
  valueProps = _c.valueProps,
67
67
  menuProps = _c.menuProps,
68
68
  errorMessageProps = _c.errorMessageProps,
69
69
  descriptionProps = _c.descriptionProps;
70
+ // Hack incoming:
71
+ // react-aria/useSelect wants to prefix the combobox's accessible name with the value of the select.
72
+ // We use role=combobox, meaning screen readers will read the value.
73
+ // So we're modifying the `aria-labelledby` property to remove the value element id.
74
+ // Issue: https://github.com/adobe/react-spectrum/issues/4091
75
+ var reactAriaLabelledBy = reactAriaTriggerProps["aria-labelledby"];
76
+ var triggerProps = __assign(__assign({}, reactAriaTriggerProps), {
77
+ "aria-labelledby": reactAriaLabelledBy === null || reactAriaLabelledBy === void 0 ? void 0 : reactAriaLabelledBy.substring(reactAriaLabelledBy.indexOf(" ") + 1)
78
+ });
70
79
  var buttonProps = useButton(triggerProps, triggerRef).buttonProps;
71
80
  var selectToggleProps = __assign(__assign({}, buttonProps), {
72
81
  label: label,