@pega/cosmos-react-core 9.0.0-build.21.3 → 9.0.0-build.21.4

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 (30) hide show
  1. package/lib/components/Card/Card.d.ts +2 -2
  2. package/lib/components/Card/Card.d.ts.map +1 -1
  3. package/lib/components/Card/Card.js +25 -25
  4. package/lib/components/Card/Card.js.map +1 -1
  5. package/lib/components/Card/Card.test-ids.d.ts +2 -0
  6. package/lib/components/Card/Card.test-ids.d.ts.map +1 -0
  7. package/lib/components/Card/Card.test-ids.js +3 -0
  8. package/lib/components/Card/Card.test-ids.js.map +1 -0
  9. package/lib/components/CheckboxGroup/CheckboxGroup.d.ts +2 -3
  10. package/lib/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
  11. package/lib/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
  12. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts +1 -3
  13. package/lib/components/PageTemplates/CategorySubPage.styles.d.ts.map +1 -1
  14. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +2 -3
  15. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts.map +1 -1
  16. package/lib/components/RadioButtonGroup/RadioButtonGroup.js.map +1 -1
  17. package/lib/components/Select/Select.d.ts.map +1 -1
  18. package/lib/components/Select/Select.js +1 -1
  19. package/lib/components/Select/Select.js.map +1 -1
  20. package/lib/components/Tabs/Tab.d.ts +1 -4
  21. package/lib/components/Tabs/Tab.d.ts.map +1 -1
  22. package/lib/components/Tabs/Tab.js +109 -104
  23. package/lib/components/Tabs/Tab.js.map +1 -1
  24. package/lib/components/Tabs/Tabs.d.ts.map +1 -1
  25. package/lib/components/Tabs/Tabs.js +23 -0
  26. package/lib/components/Tabs/Tabs.js.map +1 -1
  27. package/lib/components/Tabs/Tabs.styles.d.ts.map +1 -1
  28. package/lib/components/Tabs/Tabs.styles.js +102 -7
  29. package/lib/components/Tabs/Tabs.styles.js.map +1 -1
  30. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import type { Ref, ReactNode, MouseEventHandler } from 'react';
2
- import type { ForwardRefForwardPropsComponent, BaseProps, AsProp } from '../../types';
3
- export interface CardProps extends BaseProps, AsProp {
2
+ import type { ForwardRefForwardPropsComponent, BaseProps, AsProp, TestIdProp } from '../../types';
3
+ export interface CardProps extends BaseProps, AsProp, TestIdProp {
4
4
  /** Components and content for the Card. */
5
5
  children?: ReactNode;
6
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAmB,SAAS,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKhF,OAAO,KAAK,EAAE,+BAA+B,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAMtF,MAAM,WAAW,SAAU,SAAQ,SAAS,EAAE,MAAM;IAClD,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAClC,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACzC,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,eAAO,MAAM,UAAU,iPAoDrB,CAAC;AAIH,QAAA,MAAM,IAAI,EAAE,+BAA+B,CAAC,SAAS,CA6BnD,CAAC;AAEH,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAmB,SAAS,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKhF,OAAO,KAAK,EAAE,+BAA+B,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAOlG,MAAM,WAAW,SAAU,SAAQ,SAAS,EAAE,MAAM,EAAE,UAAU;IAC9D,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAClC,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACzC,6CAA6C;IAC7C,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,eAAO,MAAM,UAAU,iPAkDrB,CAAC;AAIH,QAAA,MAAM,IAAI,EAAE,+BAA+B,CAAC,SAAS,CA+BnD,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -3,9 +3,10 @@ import { forwardRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { defaultThemeProp } from '../../theme';
5
5
  import Flex from '../Flex';
6
- import { StyledPopover } from '../Popover';
7
6
  import { useFullscreenContext } from '../Fullscreen';
7
+ import useTestIds from '../../hooks/useTestIds';
8
8
  import { StyledCardMedia } from './CardMedia';
9
+ import { getCardTestIds } from './Card.test-ids';
9
10
  export const StyledCard = styled.article(props => {
10
11
  const fullscreen = useFullscreenContext();
11
12
  const { 'border-radius': borderRadius, 'border-color': borderColor, background } = props.theme.components.card;
@@ -22,39 +23,38 @@ export const StyledCard = styled.article(props => {
22
23
  `
23
24
  : undefined;
24
25
  return css `
25
- ${StyledPopover} &, &:not(& &) {
26
- background: ${background};
26
+ background: ${background};
27
27
 
28
- &:focus {
29
- outline: none;
30
- }
28
+ &:focus {
29
+ outline: none;
30
+ }
31
31
 
32
- ${interactive}
32
+ ${interactive}
33
33
 
34
- ${StyledCardMedia} {
35
- &:first-child img {
36
- border-radius: var(--container-border-radius, ${borderRadius})
37
- var(--container-border-radius, ${borderRadius}) 0 0;
38
- }
34
+ ${StyledCardMedia} {
35
+ &:first-child img {
36
+ border-radius: var(--container-border-radius, ${borderRadius})
37
+ var(--container-border-radius, ${borderRadius}) 0 0;
39
38
  }
39
+ }
40
40
 
41
- ${fullscreen?.[0]
41
+ ${fullscreen?.[0]
42
42
  ? css `
43
- block-size: 100%;
44
- border-radius: 0;
45
- `
43
+ block-size: 100%;
44
+ border-radius: 0;
45
+ `
46
46
  : css `
47
- border-radius: var(--border-radius, ${borderRadius});
48
- --container-border-radius: var(--border-radius, ${borderRadius});
49
- * {
50
- --border-radius: calc(var(--container-border-radius) * 0.5);
51
- }
52
- `}
53
- }
47
+ border-radius: var(--border-radius, var(--container-border-radius));
48
+ --container-border-radius: ${borderRadius};
49
+ * {
50
+ --border-radius: calc(var(--container-border-radius) * 0.5);
51
+ }
52
+ `}
54
53
  `;
55
54
  });
56
55
  StyledCard.defaultProps = defaultThemeProp;
57
- const Card = forwardRef(function Card({ children, as, onClick, interactive = false, ...restProps }, ref) {
56
+ const Card = forwardRef(function Card({ children, as, onClick, interactive = false, testId, ...restProps }, ref) {
57
+ const testIds = useTestIds(testId, getCardTestIds);
58
58
  const interactiveProps = {
59
59
  ...(onClick && {
60
60
  onClick,
@@ -66,7 +66,7 @@ const Card = forwardRef(function Card({ children, as, onClick, interactive = fal
66
66
  }),
67
67
  interactive
68
68
  };
69
- return (_jsx(Flex, { role: 'none', container: { direction: 'column' }, as: StyledCard, forwardedAs: as, ref: ref, ...interactiveProps, ...restProps, children: children }));
69
+ return (_jsx(Flex, { "data-testid": testIds.root, role: 'none', container: { direction: 'column' }, as: StyledCard, forwardedAs: as, ref: ref, ...interactiveProps, ...restProps, children: children }));
70
70
  });
71
71
  export default Card;
72
72
  //# sourceMappingURL=Card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EA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F,GAAG,CAAC,WAAW,IAAI;YACjB,QAAQ,EAAE,CAAC;SACZ,CAAC;QACF,WAAW;KACZ,CAAC;IAEF,OAAO,CACL,KAAC,IAAI,IACH,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAClC,EAAE,EAAE,UAAU,EACd,WAAW,EAAE,EAAE,EACf,GAAG,EAAE,GAAG,KACJ,gBAAgB,KAChB,SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { Ref, PropsWithoutRef, ReactNode, MouseEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport type { ForwardRefForwardPropsComponent, BaseProps, AsProp } from '../../types';\nimport { StyledPopover } from '../Popover';\nimport { useFullscreenContext } from '../Fullscreen';\n\nimport { StyledCardMedia } from './CardMedia';\n\nexport interface CardProps extends BaseProps, AsProp {\n /** Components and content for the Card. */\n children?: ReactNode;\n /**\n * Enables the focus, hover, and active styles.\n * @default false\n * @deprecated\n */\n interactive?: boolean;\n /** Callback for onClick event. */\n onClick?: MouseEventHandler<HTMLElement>;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nexport const StyledCard = styled.article<Partial<CardProps>>(props => {\n const fullscreen = useFullscreenContext();\n\n const {\n 'border-radius': borderRadius,\n 'border-color': borderColor,\n background\n } = props.theme.components.card;\n const interactive = props.interactive\n ? css`\n &:hover {\n border: 0;\n box-shadow: 0 0 0 0.0625rem ${borderColor};\n }\n &:focus {\n border: 0;\n box-shadow: 0 0 0 0.125rem ${borderColor};\n }\n `\n : undefined;\n\n return css`\n ${StyledPopover} &, &:not(& &) {\n background: ${background};\n\n &:focus {\n outline: none;\n }\n\n ${interactive}\n\n ${StyledCardMedia} {\n &:first-child img {\n border-radius: var(--container-border-radius, ${borderRadius})\n var(--container-border-radius, ${borderRadius}) 0 0;\n }\n }\n\n ${fullscreen?.[0]\n ? css`\n block-size: 100%;\n border-radius: 0;\n `\n : css`\n border-radius: var(--border-radius, ${borderRadius});\n --container-border-radius: var(--border-radius, ${borderRadius});\n * {\n --border-radius: calc(var(--container-border-radius) * 0.5);\n }\n `}\n }\n `;\n});\n\nStyledCard.defaultProps = defaultThemeProp;\n\nconst Card: ForwardRefForwardPropsComponent<CardProps> = forwardRef(function Card(\n { children, as, onClick, interactive = false, ...restProps }: PropsWithoutRef<CardProps>,\n ref: CardProps['ref']\n) {\n const interactiveProps = {\n ...(onClick && {\n onClick,\n tabIndex: 0,\n role: 'button'\n }),\n ...(interactive && {\n tabIndex: 0\n }),\n interactive\n };\n\n return (\n <Flex\n role='none'\n container={{ direction: 'column' }}\n as={StyledCard}\n forwardedAs={as}\n ref={ref}\n {...interactiveProps}\n {...restProps}\n >\n {children}\n </Flex>\n );\n});\n\nexport default Card;\n"]}
1
+ {"version":3,"file":"Card.js","sourceRoot":"","sources":["../../../src/components/Card/Card.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAiBjD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAqB,KAAK,CAAC,EAAE;IACnE,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAC;IAE1C,MAAM,EACJ,eAAe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SAAS,YAEZ,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { Ref, PropsWithoutRef, ReactNode, MouseEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport Flex from '../Flex';\nimport type { ForwardRefForwardPropsComponent, BaseProps, AsProp, TestIdProp } from '../../types';\nimport { useFullscreenContext } from '../Fullscreen';\nimport useTestIds from '../../hooks/useTestIds';\n\nimport { StyledCardMedia } from './CardMedia';\nimport { getCardTestIds } from './Card.test-ids';\n\nexport interface CardProps extends BaseProps, AsProp, TestIdProp {\n /** Components and content for the Card. */\n children?: ReactNode;\n /**\n * Enables the focus, hover, and active styles.\n * @default false\n * @deprecated\n */\n interactive?: boolean;\n /** Callback for onClick event. */\n onClick?: MouseEventHandler<HTMLElement>;\n /** Ref forwarded to the wrapping element. */\n ref?: Ref<HTMLElement>;\n}\n\nexport const StyledCard = styled.article<Partial<CardProps>>(props => {\n const fullscreen = useFullscreenContext();\n\n const {\n 'border-radius': borderRadius,\n 'border-color': borderColor,\n background\n } = props.theme.components.card;\n const interactive = props.interactive\n ? css`\n &:hover {\n border: 0;\n box-shadow: 0 0 0 0.0625rem ${borderColor};\n }\n &:focus {\n border: 0;\n box-shadow: 0 0 0 0.125rem ${borderColor};\n }\n `\n : undefined;\n\n return css`\n background: ${background};\n\n &:focus {\n outline: none;\n }\n\n ${interactive}\n\n ${StyledCardMedia} {\n &:first-child img {\n border-radius: var(--container-border-radius, ${borderRadius})\n var(--container-border-radius, ${borderRadius}) 0 0;\n }\n }\n\n ${fullscreen?.[0]\n ? css`\n block-size: 100%;\n border-radius: 0;\n `\n : css`\n border-radius: var(--border-radius, var(--container-border-radius));\n --container-border-radius: ${borderRadius};\n * {\n --border-radius: calc(var(--container-border-radius) * 0.5);\n }\n `}\n `;\n});\n\nStyledCard.defaultProps = defaultThemeProp;\n\nconst Card: ForwardRefForwardPropsComponent<CardProps> = forwardRef(function Card(\n { children, as, onClick, interactive = false, testId, ...restProps }: PropsWithoutRef<CardProps>,\n ref: CardProps['ref']\n) {\n const testIds = useTestIds(testId, getCardTestIds);\n const interactiveProps = {\n ...(onClick && {\n onClick,\n tabIndex: 0,\n role: 'button'\n }),\n ...(interactive && {\n tabIndex: 0\n }),\n interactive\n };\n\n return (\n <Flex\n data-testid={testIds.root}\n role='none'\n container={{ direction: 'column' }}\n as={StyledCard}\n forwardedAs={as}\n ref={ref}\n {...interactiveProps}\n {...restProps}\n >\n {children}\n </Flex>\n );\n});\n\nexport default Card;\n"]}
@@ -0,0 +1,2 @@
1
+ export declare const getCardTestIds: (testIdProp?: import("../..").TestIdProp["testId"]) => import("../..").TestIdsRecord<readonly []>;
2
+ //# sourceMappingURL=Card.test-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Card/Card.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,mGAAqC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { createTestIds } from '../../utils';
2
+ export const getCardTestIds = createTestIds('card', []);
3
+ //# sourceMappingURL=Card.test-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.test-ids.js","sourceRoot":"","sources":["../../../src/components/Card/Card.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,EAAE,EAAW,CAAC,CAAC","sourcesContent":["import { createTestIds } from '../../utils';\n\nexport const getCardTestIds = createTestIds('card', [] as const);\n"]}
@@ -1,7 +1,6 @@
1
- import type { OmitStrict } from '../../types';
2
1
  import type { RadioCheckGroupProps } from '../RadioCheckGroup';
3
- export type CheckboxGroupProps = OmitStrict<RadioCheckGroupProps, 'arrowNavigation'>;
4
- declare const _default: import("react").ForwardRefExoticComponent<Omit<Pick<RadioCheckGroupProps, "hidden" | "color" | "content" | "style" | "inline" | "translate" | "disabled" | "form" | "label" | "slot" | "title" | "ref" | "suppressHydrationWarning" | "className" | "id" | "lang" | "name" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "inert" | "readOnly" | "required" | "status" | "testId" | "info" | "variant" | "additionalInfo" | "labelHidden" | "onClear" | "autoStack">, "ref"> & import("react").RefAttributes<HTMLElement>> & {
2
+ export type CheckboxGroupProps = Omit<RadioCheckGroupProps, 'arrowNavigation'>;
3
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<CheckboxGroupProps, "ref"> & import("react").RefAttributes<HTMLElement>> & {
5
4
  getTestIds: (testIdProp?: import("../../types").TestIdProp["testId"]) => import("../../types").TestIdsRecord<readonly ["label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
6
5
  };
7
6
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG/D,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;;;;AASrF,wBAAqE"}
1
+ {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAK/D,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;;;;AAS/E,wBAAqE"}
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.js","sourceRoot":"","sources":["../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAIxF,MAAM,aAAa,GAAG,UAAU,CAG9B,SAAS,aAAa,CAAC,KAAK,EAAE,GAAG;IACjC,OAAO,KAAC,eAAe,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,GAAI,CAAC;AAC1E,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,aAAa,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport type { OmitStrict, RefElement } from '../../types';\nimport { withTestIds } from '../../utils';\nimport RadioCheckGroup from '../RadioCheckGroup';\nimport type { RadioCheckGroupProps } from '../RadioCheckGroup';\nimport { getRadioCheckGroupTestIds } from '../RadioCheckGroup/RadioCheckGroup.test-ids';\n\nexport type CheckboxGroupProps = OmitStrict<RadioCheckGroupProps, 'arrowNavigation'>;\n\nconst CheckboxGroup = forwardRef<\n RefElement<CheckboxGroupProps>,\n PropsWithoutRef<CheckboxGroupProps>\n>(function CheckboxGroup(props, ref) {\n return <RadioCheckGroup {...props} ref={ref} arrowNavigation={false} />;\n});\n\nexport default withTestIds(CheckboxGroup, getRadioCheckGroupTestIds);\n"]}
1
+ {"version":3,"file":"CheckboxGroup.js","sourceRoot":"","sources":["../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAMxF,MAAM,aAAa,GAAG,UAAU,CAG9B,SAAS,aAAa,CAAC,KAAK,EAAE,GAAG;IACjC,OAAO,KAAC,eAAe,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,GAAI,CAAC;AAC1E,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,aAAa,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport type { RefElement } from '../../types';\nimport { withTestIds } from '../../utils';\nimport RadioCheckGroup from '../RadioCheckGroup';\nimport type { RadioCheckGroupProps } from '../RadioCheckGroup';\nimport { getRadioCheckGroupTestIds } from '../RadioCheckGroup/RadioCheckGroup.test-ids';\n\n// Using Omit instead of OmitStrict as workaround for downstream consumers without intert type augmentation.\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type CheckboxGroupProps = Omit<RadioCheckGroupProps, 'arrowNavigation'>;\n\nconst CheckboxGroup = forwardRef<\n RefElement<CheckboxGroupProps>,\n PropsWithoutRef<CheckboxGroupProps>\n>(function CheckboxGroup(props, ref) {\n return <RadioCheckGroup {...props} ref={ref} arrowNavigation={false} />;\n});\n\nexport default withTestIds(CheckboxGroup, getRadioCheckGroupTestIds);\n"]}
@@ -3,9 +3,7 @@ export declare const StyledSkipNavigation: import("styled-components/dist/types"
3
3
  }, never>> & string & Omit<import("../..").ForwardRefForwardPropsComponent<import("../Button").ButtonProps>, keyof import("react").Component<any, {}, any>>;
4
4
  export declare const StyledNavItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<Omit<Omit<import("../Button/BareButton").BareButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement> & import("../..").ForwardProps, "ref"> & {
5
5
  ref?: ((instance: HTMLAnchorElement | HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLAnchorElement | HTMLButtonElement> | null | undefined;
6
- }, "level" | keyof import("../Tabs/Tab").StyledTabProps> & import("../Tabs/Tab").StyledTabProps & {
7
- level?: import("../Tabs/TabsContext").TabsContextValue["level"];
8
- }, never>> & string;
6
+ }, keyof import("../Tabs/Tab").StyledTabProps> & import("../Tabs/Tab").StyledTabProps, never>> & string;
9
7
  export declare const StyledNavGroupHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("../Text").TextProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement | HTMLSpanElement> & import("../..").ForwardProps, "ref"> & {
10
8
  ref?: ((instance: HTMLHeadingElement | HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLHeadingElement | HTMLSpanElement> | null | undefined;
11
9
  }, never>> & string & Omit<import("../..").ForwardRefForwardPropsComponent<import("../Text").TextProps>, keyof import("react").Component<any, {}, any>>;
@@ -1 +1 @@
1
- {"version":3,"file":"CategorySubPage.styles.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/CategorySubPage.styles.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,oBAAoB;;2JAoB/B,CAAC;AAGH,eAAO,MAAM,aAAa;;;;mBAgExB,CAAC;AAGH,eAAO,MAAM,oBAAoB;;uJAa/B,CAAC;AAGH,eAAO,MAAM,kBAAkB,iOAAc,CAAC;AAE9C,eAAO,MAAM,cAAc,6NAazB,CAAC;AAGH,eAAO,MAAM,aAAa,iOAwBxB,CAAC;AAGH,eAAO,MAAM,SAAS,uNAAe,CAAC;AAEtC,eAAO,MAAM,uBAAuB,6NAsBlC,CAAC;AAGH,eAAO,MAAM,wBAAwB,6NAmBnC,CAAC;AAGH,eAAO,MAAM,gBAAgB,6NAuC3B,CAAC;AAGH,eAAO,MAAM,eAAe,qOAe1B,CAAC;AAGH,eAAO,MAAM,mBAAmB,6NAAe,CAAC;AAEhD,eAAO,MAAM,mBAAmB,uNAe9B,CAAC;AAGH,eAAO,MAAM,iBAAiB,uNA0B5B,CAAC;AAGH,eAAO,MAAM,iBAAiB,6NAe5B,CAAC;AAGH,eAAO,MAAM,cAAc,6NAG1B,CAAC"}
1
+ {"version":3,"file":"CategorySubPage.styles.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/CategorySubPage.styles.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,oBAAoB;;2JAoB/B,CAAC;AAGH,eAAO,MAAM,aAAa;;uGAgExB,CAAC;AAGH,eAAO,MAAM,oBAAoB;;uJAa/B,CAAC;AAGH,eAAO,MAAM,kBAAkB,iOAAc,CAAC;AAE9C,eAAO,MAAM,cAAc,6NAazB,CAAC;AAGH,eAAO,MAAM,aAAa,iOAwBxB,CAAC;AAGH,eAAO,MAAM,SAAS,uNAAe,CAAC;AAEtC,eAAO,MAAM,uBAAuB,6NAsBlC,CAAC;AAGH,eAAO,MAAM,wBAAwB,6NAmBnC,CAAC;AAGH,eAAO,MAAM,gBAAgB,6NAuC3B,CAAC;AAGH,eAAO,MAAM,eAAe,qOAe1B,CAAC;AAGH,eAAO,MAAM,mBAAmB,6NAAe,CAAC;AAEhD,eAAO,MAAM,mBAAmB,uNAe9B,CAAC;AAGH,eAAO,MAAM,iBAAiB,uNA0B5B,CAAC;AAGH,eAAO,MAAM,iBAAiB,6NAe5B,CAAC;AAGH,eAAO,MAAM,cAAc,6NAG1B,CAAC"}
@@ -1,7 +1,6 @@
1
- import type { OmitStrict } from '../../types';
2
1
  import type { RadioCheckGroupProps } from '../RadioCheckGroup';
3
- export type RadioButtonGroupProps = OmitStrict<RadioCheckGroupProps, 'arrowNavigation'>;
4
- declare const _default: import("react").ForwardRefExoticComponent<Omit<Pick<RadioCheckGroupProps, "hidden" | "color" | "content" | "style" | "inline" | "translate" | "disabled" | "form" | "label" | "slot" | "title" | "ref" | "suppressHydrationWarning" | "className" | "id" | "lang" | "name" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "inert" | "readOnly" | "required" | "status" | "testId" | "info" | "variant" | "additionalInfo" | "labelHidden" | "onClear" | "autoStack">, "ref"> & import("react").RefAttributes<HTMLElement>> & {
2
+ export type RadioButtonGroupProps = Omit<RadioCheckGroupProps, 'arrowNavigation'>;
3
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<RadioButtonGroupProps, "ref"> & import("react").RefAttributes<HTMLElement>> & {
5
4
  getTestIds: (testIdProp?: import("../../types").TestIdProp["testId"]) => import("../../types").TestIdsRecord<readonly ["label", "info", "additional-info", "suggestion-accept", "suggestion-reject"]>;
6
5
  };
7
6
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButtonGroup.d.ts","sourceRoot":"","sources":["../../../src/components/RadioButtonGroup/RadioButtonGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG/D,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;;;;AASxF,wBAAwE"}
1
+ {"version":3,"file":"RadioButtonGroup.d.ts","sourceRoot":"","sources":["../../../src/components/RadioButtonGroup/RadioButtonGroup.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAK/D,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;;;;AASlF,wBAAwE"}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButtonGroup.js","sourceRoot":"","sources":["../../../src/components/RadioButtonGroup/RadioButtonGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAIxF,MAAM,gBAAgB,GAAG,UAAU,CAGjC,SAAS,gBAAgB,CAAC,KAAK,EAAE,GAAG;IACpC,OAAO,KAAC,eAAe,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,eAAe,SAAG,CAAC;AAClE,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport type { OmitStrict, RefElement } from '../../types';\nimport { withTestIds } from '../../utils';\nimport RadioCheckGroup from '../RadioCheckGroup';\nimport type { RadioCheckGroupProps } from '../RadioCheckGroup';\nimport { getRadioCheckGroupTestIds } from '../RadioCheckGroup/RadioCheckGroup.test-ids';\n\nexport type RadioButtonGroupProps = OmitStrict<RadioCheckGroupProps, 'arrowNavigation'>;\n\nconst RadioButtonGroup = forwardRef<\n RefElement<RadioButtonGroupProps>,\n PropsWithoutRef<RadioButtonGroupProps>\n>(function RadioButtonGroup(props, ref) {\n return <RadioCheckGroup {...props} ref={ref} arrowNavigation />;\n});\n\nexport default withTestIds(RadioButtonGroup, getRadioCheckGroupTestIds);\n"]}
1
+ {"version":3,"file":"RadioButtonGroup.js","sourceRoot":"","sources":["../../../src/components/RadioButtonGroup/RadioButtonGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AAMxF,MAAM,gBAAgB,GAAG,UAAU,CAGjC,SAAS,gBAAgB,CAAC,KAAK,EAAE,GAAG;IACpC,OAAO,KAAC,eAAe,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,eAAe,SAAG,CAAC;AAClE,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,gBAAgB,EAAE,yBAAyB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport type { RefElement } from '../../types';\nimport { withTestIds } from '../../utils';\nimport RadioCheckGroup from '../RadioCheckGroup';\nimport type { RadioCheckGroupProps } from '../RadioCheckGroup';\nimport { getRadioCheckGroupTestIds } from '../RadioCheckGroup/RadioCheckGroup.test-ids';\n\n// Using Omit instead of OmitStrict as workaround for downstream consumers without intert type augmentation.\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type RadioButtonGroupProps = Omit<RadioCheckGroupProps, 'arrowNavigation'>;\n\nconst RadioButtonGroup = forwardRef<\n RefElement<RadioButtonGroupProps>,\n PropsWithoutRef<RadioButtonGroupProps>\n>(function RadioButtonGroup(props, ref) {\n return <RadioCheckGroup {...props} ref={ref} arrowNavigation />;\n});\n\nexport default withTestIds(RadioButtonGroup, getRadioCheckGroupTestIds);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,GAAG,EACH,SAAS,EACT,kBAAkB,EAGnB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,+BAA+B,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGlG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAWvD,MAAM,WAAW,WAAY,SAAQ,SAAS,EAAE,UAAU;IACxD,oFAAoF;IACpF,QAAQ,EAAE,SAAS,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;IACjD,6DAA6D;IAC7D,mBAAmB,CAAC,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IAC9D;;;OAGG;IACH,EAAE,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC5B,oDAAoD;IACpD,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC,uCAAuC;IACvC,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,6GAA6G;IAC7G,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,wEAAwE;IACx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gB,CAAC,IAAI,CAAC,CAAC;IAC5B,oDAAoD;IACpD,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACpC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC,uCAAuC;IACvC,WAAW,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAC9C,6GAA6G;IAC7G,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,qFAAqF;IACrF,QAAQ,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACxC,+FAA+F;IAC/F,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,kFAAkF;IAClF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IACpD,mCAAmC;IACnC,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY;eACZ,OAAO;cACR,OAAO;YAgEjB,CAAC;;;;AA4FH,wBAAqD"}
@@ -74,7 +74,7 @@ const Select = forwardRef(function Select(props, ref) {
74
74
  const t = useI18n();
75
75
  const { testId, additionalInfo, children, id = uid, label, labelHidden, info, status, required = false, disabled = false, readOnly = false, actions, onResolveSuggestion, ...restProps } = props;
76
76
  const testIds = useTestIds(testId, getSelectTestIds);
77
- const Comp = (_jsx(StyledFormControl, { "data-testid": testIds.control, autoComplete: '_off', ...restProps, as: StyledSelect, hasSuggestion: status === 'pending' && !!onResolveSuggestion, id: id, hasStatus: !!status, required: required, disabled: disabled, label: label, readOnly: readOnly, ref: ref, onMouseDown: readOnly
77
+ const Comp = (_jsx(StyledFormControl, { "data-testid": testIds.control, autoComplete: '_off', ...restProps, as: StyledSelect, hasSuggestion: status === 'pending' && !!onResolveSuggestion, id: id, hasStatus: !!status, status: status, required: required, disabled: disabled, label: label, readOnly: readOnly, ref: ref, onMouseDown: readOnly
78
78
  ? (e) => {
79
79
  e.preventDefault();
80
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AASnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,EAAE;AAC1C,2BAA2B;AAC3B,+FAA+F,kBAAkB,CAAC,KAAK,CAAC,wEAAwE,CAAC;AA2CnM,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAGtC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;IACpC,MAAM,EACJ,IAAI,EACJ,UAAU,EAAE,EACV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BACG,KAAK,EACL,QAAQ,IAAI,KAAC,kBAAkB,cAAE,IAAI,CAAC,CAAC,WAAW,CAAC,EAAE,GAAsB,IAC3E,EAEL,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,mBAAmB,EACxC,cAAc,EAAE,cAAc,YAE7B,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type {\n PropsWithoutRef,\n Ref,\n ReactNode,\n ChangeEventHandler,\n MouseEvent,\n KeyboardEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport type { Action, BaseProps, ForwardRefForwardPropsComponent, TestIdProp } from '../../types';\nimport FormField from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport { useDirection, useI18n, useTestIds, useUID } from '../../hooks';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { withTestIds } from '../../utils';\n\nimport { getSelectTestIds } from './Select.test-ids';\n\nconst getSelectArrowSvg = (color: string) =>\n // cspell:disable-next-line\n `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25' fill='${encodeURIComponent(color)}'%3E%3Cpath d='M21 8v2.75l-8.5 6.5-8.5-6.5V8l8.5 6.5z'/%3E%3C/svg%3E\")`;\n\nexport interface SelectProps extends BaseProps, TestIdProp {\n /** Pass Options components as children to render the options of the Select list. */\n children: ReactNode;\n /** Called when an Option is chosen within the list. */\n onChange?: ChangeEventHandler<HTMLSelectElement>;\n /** Callback fired when AI suggestion is accepted/rejected */\n onResolveSuggestion?: FormControlProps['onResolveSuggestion'];\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: FormControlProps['value'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: FormControlProps['readOnly'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Pass an array of Action objects to append button(s) inline with the Select. */\n actions?: Action[];\n /** Pass a heading and content to show additional information on the field. */\n additionalInfo?: FormControlProps['additionalInfo'];\n /** A ref to the select element. */\n ref?: Ref<HTMLSelectElement>;\n}\n\nexport const StyledSelect = styled.select<{\n hasStatus: boolean;\n readOnly: boolean;\n}>(({ theme, readOnly, hasStatus }) => {\n const {\n base,\n components: {\n 'form-control': { 'foreground-color': fg, 'background-color': backgroundColor },\n select,\n icon\n }\n } = theme;\n const { rtl } = useDirection();\n\n return css`\n appearance: none;\n -webkit-appearance: none;\n overflow-x: hidden;\n text-overflow: ellipsis;\n width: 100%;\n height: ${select.height};\n min-height: ${base['hit-area']['mouse-min']};\n padding-inline-start: ${select.padding};\n padding-inline-end: calc(4 * ${base.spacing});\n background-image: ${getSelectArrowSvg(fg)};\n background-repeat: no-repeat;\n background-size: ${icon.size.s} ${icon.size.s};\n background-position: ${rtl ? '0.375rem' : 'calc(100% - 0.375rem)'} 50%;\n border-width: ${select['border-width']};\n border-radius: calc(${base['border-radius']} * ${select['border-radius']});\n\n @media (forced-colors: active) {\n background-image: ${getSelectArrowSvg('CanvasText')};\n }\n\n ${readOnly &&\n css`\n background-image: none;\n `}\n\n ${!hasStatus &&\n css`\n border-color: ${select['border-color']};\n `}\n\n &:has(option[value='']:checked, option:not([value]):checked) {\n color: ${mix(base.transparency['transparent-3'], fg, backgroundColor)};\n }\n\n & option {\n color: ${fg};\n\n &[value=''],\n &:not([value]) {\n color: ${mix(base.transparency['transparent-3'], fg, backgroundColor)};\n }\n }\n\n &::-ms-expand {\n display: none;\n }\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n `;\n});\n\nStyledSelect.defaultProps = defaultThemeProp;\n\nconst Select: ForwardRefForwardPropsComponent<SelectProps> = forwardRef(function Select(\n props: PropsWithoutRef<SelectProps>,\n ref: SelectProps['ref']\n) {\n const uid = useUID();\n const t = useI18n();\n\n const {\n testId,\n additionalInfo,\n children,\n id = uid,\n label,\n labelHidden,\n info,\n status,\n required = false,\n disabled = false,\n readOnly = false,\n actions,\n onResolveSuggestion,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getSelectTestIds);\n\n const Comp = (\n <StyledFormControl\n data-testid={testIds.control}\n autoComplete='_off'\n {...restProps}\n as={StyledSelect}\n hasSuggestion={status === 'pending' && !!onResolveSuggestion}\n id={id}\n hasStatus={!!status}\n required={required}\n disabled={disabled}\n label={label}\n readOnly={readOnly}\n ref={ref}\n onMouseDown={\n readOnly\n ? (e: MouseEvent<HTMLSelectElement>) => {\n e.preventDefault();\n }\n : undefined\n }\n onKeyDown={\n readOnly\n ? (e: KeyboardEvent) => {\n // TODO: Consideration is needed for key modifiers, e.g. \"ctrl p\"\n if (!['Escape', 'Tab', 'Space'].includes(e.key)) e.preventDefault();\n }\n : undefined\n }\n >\n {children}\n </StyledFormControl>\n );\n\n return label ? (\n <FormField\n testId={testIds}\n label={\n <>\n {label}\n {readOnly && <VisuallyHiddenText>{` ${t('read_only')}`}</VisuallyHiddenText>}\n </>\n }\n labelHidden={labelHidden}\n id={id}\n info={info}\n status={status}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n actions={actions}\n onResolveSuggestion={onResolveSuggestion}\n additionalInfo={additionalInfo}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n});\n\nexport default withTestIds(Select, getSelectTestIds);\n"]}
1
+ {"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AASnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,EAAE;AAC1C,2BAA2B;AAC3B,+FAA+F,kBAAkB,CAAC,KAAK,CAAC,wEAAwE,CAAC;AA2CnM,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAGtC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,EAAE;IACpC,MAAM,EACJ,IAAI,EACJ,UAAU,EAAE,EACV,cAAc,EAAE,EAAE,kBAAkB,EAAE,EAAE,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AAQ,IAAI,KAAC,kBAAkB,cAAE,IAAI,CAAC,CAAC,WAAW,CAAC,EAAE,GAAsB,IAC3E,EAEL,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,mBAAmB,EACxC,cAAc,EAAE,cAAc,YAE7B,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type {\n PropsWithoutRef,\n Ref,\n ReactNode,\n ChangeEventHandler,\n MouseEvent,\n KeyboardEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport type { Action, BaseProps, ForwardRefForwardPropsComponent, TestIdProp } from '../../types';\nimport FormField from '../FormField';\nimport { StyledFormControl } from '../FormControl';\nimport type { FormControlProps } from '../FormControl';\nimport { useDirection, useI18n, useTestIds, useUID } from '../../hooks';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { withTestIds } from '../../utils';\n\nimport { getSelectTestIds } from './Select.test-ids';\n\nconst getSelectArrowSvg = (color: string) =>\n // cspell:disable-next-line\n `url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25' fill='${encodeURIComponent(color)}'%3E%3Cpath d='M21 8v2.75l-8.5 6.5-8.5-6.5V8l8.5 6.5z'/%3E%3C/svg%3E\")`;\n\nexport interface SelectProps extends BaseProps, TestIdProp {\n /** Pass Options components as children to render the options of the Select list. */\n children: ReactNode;\n /** Called when an Option is chosen within the list. */\n onChange?: ChangeEventHandler<HTMLSelectElement>;\n /** Callback fired when AI suggestion is accepted/rejected */\n onResolveSuggestion?: FormControlProps['onResolveSuggestion'];\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /** Visually hides the label region. */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /**\n * Creates a controlled input and sets the value. Requires an onChange handler to update value.\n * value + onChange is the recommended method per React team.\n */\n value?: FormControlProps['value'];\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Makes the input non editable and non clickable. The browser defaults to false. */\n readOnly?: FormControlProps['readOnly'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /** Pass an array of Action objects to append button(s) inline with the Select. */\n actions?: Action[];\n /** Pass a heading and content to show additional information on the field. */\n additionalInfo?: FormControlProps['additionalInfo'];\n /** A ref to the select element. */\n ref?: Ref<HTMLSelectElement>;\n}\n\nexport const StyledSelect = styled.select<{\n hasStatus: boolean;\n readOnly: boolean;\n}>(({ theme, readOnly, hasStatus }) => {\n const {\n base,\n components: {\n 'form-control': { 'foreground-color': fg, 'background-color': backgroundColor },\n select,\n icon\n }\n } = theme;\n const { rtl } = useDirection();\n\n return css`\n appearance: none;\n -webkit-appearance: none;\n overflow-x: hidden;\n text-overflow: ellipsis;\n width: 100%;\n height: ${select.height};\n min-height: ${base['hit-area']['mouse-min']};\n padding-inline-start: ${select.padding};\n padding-inline-end: calc(4 * ${base.spacing});\n background-image: ${getSelectArrowSvg(fg)};\n background-repeat: no-repeat;\n background-size: ${icon.size.s} ${icon.size.s};\n background-position: ${rtl ? '0.375rem' : 'calc(100% - 0.375rem)'} 50%;\n border-width: ${select['border-width']};\n border-radius: calc(${base['border-radius']} * ${select['border-radius']});\n\n @media (forced-colors: active) {\n background-image: ${getSelectArrowSvg('CanvasText')};\n }\n\n ${readOnly &&\n css`\n background-image: none;\n `}\n\n ${!hasStatus &&\n css`\n border-color: ${select['border-color']};\n `}\n\n &:has(option[value='']:checked, option:not([value]):checked) {\n color: ${mix(base.transparency['transparent-3'], fg, backgroundColor)};\n }\n\n & option {\n color: ${fg};\n\n &[value=''],\n &:not([value]) {\n color: ${mix(base.transparency['transparent-3'], fg, backgroundColor)};\n }\n }\n\n &::-ms-expand {\n display: none;\n }\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n `;\n});\n\nStyledSelect.defaultProps = defaultThemeProp;\n\nconst Select: ForwardRefForwardPropsComponent<SelectProps> = forwardRef(function Select(\n props: PropsWithoutRef<SelectProps>,\n ref: SelectProps['ref']\n) {\n const uid = useUID();\n const t = useI18n();\n\n const {\n testId,\n additionalInfo,\n children,\n id = uid,\n label,\n labelHidden,\n info,\n status,\n required = false,\n disabled = false,\n readOnly = false,\n actions,\n onResolveSuggestion,\n ...restProps\n } = props;\n\n const testIds = useTestIds(testId, getSelectTestIds);\n\n const Comp = (\n <StyledFormControl\n data-testid={testIds.control}\n autoComplete='_off'\n {...restProps}\n as={StyledSelect}\n hasSuggestion={status === 'pending' && !!onResolveSuggestion}\n id={id}\n hasStatus={!!status}\n status={status}\n required={required}\n disabled={disabled}\n label={label}\n readOnly={readOnly}\n ref={ref}\n onMouseDown={\n readOnly\n ? (e: MouseEvent<HTMLSelectElement>) => {\n e.preventDefault();\n }\n : undefined\n }\n onKeyDown={\n readOnly\n ? (e: KeyboardEvent) => {\n // TODO: Consideration is needed for key modifiers, e.g. \"ctrl p\"\n if (!['Escape', 'Tab', 'Space'].includes(e.key)) e.preventDefault();\n }\n : undefined\n }\n >\n {children}\n </StyledFormControl>\n );\n\n return label ? (\n <FormField\n testId={testIds}\n label={\n <>\n {label}\n {readOnly && <VisuallyHiddenText>{` ${t('read_only')}`}</VisuallyHiddenText>}\n </>\n }\n labelHidden={labelHidden}\n id={id}\n info={info}\n status={status}\n required={required}\n disabled={disabled}\n readOnly={readOnly}\n actions={actions}\n onResolveSuggestion={onResolveSuggestion}\n additionalInfo={additionalInfo}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n});\n\nexport default withTestIds(Select, getSelectTestIds);\n"]}
@@ -1,6 +1,5 @@
1
1
  import type { Ref } from 'react';
2
2
  import type { ForwardRefForwardPropsComponent } from '../../types';
3
- import type { TabsContextValue } from './TabsContext';
4
3
  import type { TabsProps, Tab as TabType } from './Tabs.types';
5
4
  export interface TabProps {
6
5
  /** Indicates if this Tab is active. */
@@ -24,9 +23,7 @@ export interface StyledTabProps {
24
23
  }
25
24
  export declare const StyledTab: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<import("../Button/BareButton").BareButtonProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement> & import("../../types").ForwardProps, "ref"> & {
26
25
  ref?: ((instance: HTMLAnchorElement | HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLAnchorElement | HTMLButtonElement> | null | undefined;
27
- }, StyledTabProps & {
28
- level?: TabsContextValue["level"];
29
- }>> & string & Omit<ForwardRefForwardPropsComponent<import("../Button/BareButton").BareButtonProps>, keyof import("react").Component<any, {}, any>>;
26
+ }, StyledTabProps>> & string & Omit<ForwardRefForwardPropsComponent<import("../Button/BareButton").BareButtonProps>, keyof import("react").Component<any, {}, any>>;
30
27
  declare const Tab: ForwardRefForwardPropsComponent<TabProps>;
31
28
  export default Tab;
32
29
  //# sourceMappingURL=Tab.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAalD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAKnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAK9D,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACzB,6DAA6D;IAC7D,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACxB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,8BAA8B;IAC9B,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC/B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC3B;AAsQD,eAAO,MAAM,SAAS;;;YAEV,gBAAgB,CAAC,OAAO,CAAC;mJAmCpC,CAAC;AAIF,QAAA,MAAM,GAAG,EAAE,+BAA+B,CAAC,QAAQ,CAiDjD,CAAC;AAEH,eAAe,GAAG,CAAC"}
1
+ {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAalD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAInE,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC;AAK9D,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,QAAQ,EAAE,OAAO,CAAC;IAClB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACzB,6DAA6D;IAC7D,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACxB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,8BAA8B;IAC9B,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC;CAClD;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC/B,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC3B;AAmPD,eAAO,MAAM,SAAS;;mKA6CrB,CAAC;AAIF,QAAA,MAAM,GAAG,EAAE,+BAA+B,CAAC,QAAQ,CA+CjD,CAAC;AAEH,eAAe,GAAG,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useContext } from 'react';
2
+ import { forwardRef } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { meetsContrastGuidelines, mix, readableColor, transparentize } from 'polished';
5
5
  import { calculateForegroundColor, isSolidColor, readableHue } from '../../styles';
@@ -12,42 +12,15 @@ import { tryCatch } from '../../utils';
12
12
  import Count, { StyledCount } from '../Badges/Count';
13
13
  import BareButton from '../Button/BareButton';
14
14
  import HiddenText from '../HiddenText';
15
- import TabsContext from './TabsContext';
16
15
  import { StyledErrorIcon } from './Tabs.styles';
17
16
  registerIcon(warnSolidIcon);
18
- const activeStyle = (color) => css `
19
- &::after {
20
- display: block;
21
- background-color: ${color};
22
- }
23
- `;
24
- const getHorizontalUnselectedHoverStyle = ({ detached, level, opacity, color }) => level && level > 1 && !detached
25
- ? css `
26
- &::before {
27
- content: '';
28
- position: absolute;
29
- top: 0;
30
- bottom: 0;
31
- left: 0;
32
- right: 0;
33
- border-radius: inherit;
34
- background-color: currentColor;
35
- opacity: ${opacity};
36
- }
37
- `
38
- : css `
39
- background-color: ${color};
40
- border-start-start-radius: ${detached ? 0 : 'calc(0.5rem * 0.5)'};
41
- border-start-end-radius: ${detached ? 0 : 'calc(0.5rem * 0.5)'};
42
- `;
43
- const getHorizontalStyles = ({ selected, level, theme }) => {
17
+ const getHorizontalStyles = ({ selected, theme }) => {
44
18
  const color = theme.components.button.color;
45
19
  const foreground = theme.base.palette['foreground-color'];
46
20
  const { detached: tabsDetached } = theme.components.tabs;
47
21
  const secondaryColor = tabsDetached
48
22
  ? theme.base.palette['primary-background']
49
23
  : theme.base.palette['secondary-background'];
50
- const lightenedColor = tryCatch(() => transparentize(0.3, color)) ?? '';
51
24
  // If the secondary color is not a solid color, use the readable color as the fallback background.
52
25
  const fallbackBackground = isSolidColor(secondaryColor) ? secondaryColor : readableColor(color);
53
26
  const backgroundUsable = tryCatch(() => meetsContrastGuidelines(color, fallbackBackground).AA);
@@ -71,6 +44,9 @@ const getHorizontalStyles = ({ selected, level, theme }) => {
71
44
  padding: 0 calc(1.5 * ${spacing});
72
45
  border: none;
73
46
  text-decoration: none;
47
+ transition-property: background-color;
48
+ transition-duration: max(${theme.base.animation.speed}, 1ms);
49
+ transition-timing-function: ${theme.base.animation.timing.ease};
74
50
 
75
51
  @media (pointer: coarse) {
76
52
  height: ${theme.base['hit-area']['finger-min']};
@@ -79,6 +55,9 @@ const getHorizontalStyles = ({ selected, level, theme }) => {
79
55
  span:first-of-type {
80
56
  color: ${selected ? color : foreground};
81
57
  display: inline-block;
58
+ transition-property: color;
59
+ transition-duration: ${selected ? `max(${theme.base.animation.speed}, 1ms)` : '0s'};
60
+ transition-timing-function: ${theme.base.animation.timing.ease};
82
61
 
83
62
  &::before {
84
63
  content: attr(data-content) / '';
@@ -91,61 +70,45 @@ const getHorizontalStyles = ({ selected, level, theme }) => {
91
70
  }
92
71
 
93
72
  &:first-child {
94
- margin-left: 0;
95
- }
96
- &::after {
97
- background: ${selected ? color : lightenedColor};
98
- display: ${selected ? 'block' : 'none'};
99
- content: '';
100
- position: absolute;
101
- height: 0.125rem;
102
- bottom: 0;
103
- left: calc(1.5 * ${spacing});
104
- right: calc(1.5 * ${spacing});
73
+ margin-inline-start: 0;
105
74
  }
106
75
 
107
- ${!selected
108
- ? css `
109
- @media (hover: hover) {
110
- &:not(:disabled):hover {
111
- text-decoration: none;
112
- ${getHorizontalUnselectedHoverStyle({
113
- detached: tabsDetached,
114
- level,
115
- opacity: 0.1,
116
- color: hoverBackgroundColor
117
- })}
118
- }
76
+ ${!selected &&
77
+ css `
78
+ @media (hover: hover) {
79
+ &:not(:disabled):hover {
80
+ text-decoration: none;
81
+ background-color: ${hoverBackgroundColor};
82
+ }
119
83
 
120
- &:not(:disabled):active {
121
- text-decoration: none;
122
- ${getHorizontalUnselectedHoverStyle({
123
- detached: tabsDetached,
124
- level,
125
- opacity: 0.2,
126
- color: activeBackgroundColor
127
- })}
128
- }
129
- }
130
- `
131
- : css `
132
- ${level &&
133
- level > 1 &&
134
- css `
135
- background-color: ${theme.base.palette['primary-background']};
136
- `}
137
- `}
84
+ &:not(:disabled):active {
85
+ text-decoration: none;
86
+ background-color: ${activeBackgroundColor};
87
+ }
88
+ }
89
+ `}
138
90
 
139
- &:focus,
140
- &:not([disabled]):focus {
141
- border-radius: calc(0.5rem * 0.5);
142
- box-shadow: ${theme.base.shadow['focus-inset']};
91
+ &:focus-visible,
92
+ &:not(:disabled):focus-visible {
143
93
  text-decoration: none;
94
+ outline: none;
95
+
144
96
  &::after {
145
- display: none;
97
+ content: '';
98
+ position: absolute;
99
+ inset: 0;
100
+ border-radius: calc(0.5rem * 0.5);
101
+ box-shadow: ${theme.base.shadow['focus-inset']};
102
+ pointer-events: none;
103
+ z-index: 3;
146
104
  }
147
105
  }
148
106
 
107
+ &:first-child:focus-visible::after,
108
+ &:first-child:not(:disabled):focus-visible::after {
109
+ border-start-start-radius: var(--border-radius, ${theme.base['border-radius']});
110
+ }
111
+
149
112
  @media (pointer: coarse) {
150
113
  min-block-size: ${theme.base['hit-area'].finger};
151
114
  }
@@ -157,8 +120,8 @@ const getHorizontalStyles = ({ selected, level, theme }) => {
157
120
  ${tabsDetached &&
158
121
  css `
159
122
  &[aria-selected='true'],
160
- &:focus,
161
- &:not([disabled]):focus {
123
+ &:focus-visible,
124
+ &:not([disabled]):focus-visible {
162
125
  color: ${activeTabColor};
163
126
  span:first-of-type {
164
127
  color: ${activeTabColor};
@@ -176,18 +139,18 @@ const getHorizontalStyles = ({ selected, level, theme }) => {
176
139
  `}
177
140
  `;
178
141
  };
179
- const getVerticalStyles = ({ selected, theme }) => {
142
+ const getVerticalStyles = ({ theme, selected }) => {
180
143
  const { detached: tabsDetached } = theme.components.tabs;
181
- const borderColor = theme.base.palette['border-line'];
182
144
  const interactive = theme.base.palette.interactive;
183
145
  const foreground = theme.base.palette['foreground-color'];
184
146
  const secondary = theme.base.palette['secondary-background'];
185
- const lightenedColor = tryCatch(() => transparentize(tabsDetached ? 0.95 : 0.5, tabsDetached ? foreground : interactive)) ?? '';
186
147
  const { spacing } = theme.base;
148
+ const lightenedColor = tryCatch(() => transparentize(tabsDetached ? 0.95 : 0.5, tabsDetached ? foreground : interactive)) ?? '';
187
149
  const activeTabBg = tabsDetached ? secondary : transparentize(0.75, interactive);
188
150
  const activeTabColor = tabsDetached
189
151
  ? interactive
190
152
  : calculateForegroundColor(activeTabBg, foreground);
153
+ const borderColor = theme.base.palette['border-line'];
191
154
  return css `
192
155
  display: flex;
193
156
  justify-content: space-between;
@@ -200,66 +163,109 @@ const getVerticalStyles = ({ selected, theme }) => {
200
163
  margin-top: -0.0625rem;
201
164
  padding: 0 calc(2 * ${spacing});
202
165
  text-decoration: none;
166
+ transition-property: ${selected ? 'color, font-weight, background-color' : 'background-color'};
167
+ transition-duration: max(${theme.base.animation.speed}, 1ms);
168
+ transition-timing-function: ${theme.base.animation.timing.ease};
203
169
 
204
170
  &:first-child {
205
171
  border-top: 0.0625rem solid ${tabsDetached ? 'transparent' : borderColor};
206
172
  }
207
- &::after {
173
+
174
+ &::before {
208
175
  content: '';
209
176
  position: absolute;
210
- display: ${selected ? 'block' : 'none'};
211
- top: 0;
212
- bottom: 0;
213
- ${tabsDetached ? 'left: 0;' : 'right: 0;'}
177
+ ${tabsDetached ? 'inset-inline-start: 0;' : 'inset-inline-end: 0;'}
178
+ inset-block-start: 0;
179
+ inset-block-end: 0;
214
180
  width: 0.25rem;
215
- background: ${interactive};
181
+ background: ${lightenedColor};
182
+ pointer-events: none;
183
+ z-index: 2;
184
+ opacity: 0;
185
+ transition-property: opacity;
186
+ transition-duration: max(${theme.base.animation.speed}, 1ms);
187
+ transition-timing-function: ${theme.base.animation.timing.ease};
216
188
  }
217
- &:hover&:not(:disabled) {
218
- ${activeStyle(lightenedColor)}
219
- text-decoration: none;
189
+
190
+ &:active {
191
+ background: none;
220
192
  }
221
193
 
222
- &:focus,
223
- &:not([disabled]):focus {
224
- ${activeStyle(interactive)}
225
- box-shadow: inset 0 0 0 0.0625rem ${interactive};
194
+ &:active::before {
195
+ opacity: 1;
196
+ }
197
+
198
+ &:hover:not(:disabled)::before {
199
+ opacity: 1;
200
+ }
201
+
202
+ &:focus-visible,
203
+ &:not(:disabled):focus-visible {
226
204
  text-decoration: none;
205
+ outline: none;
206
+
207
+ &::after {
208
+ content: '';
209
+ position: absolute;
210
+ inset: 0;
211
+ box-shadow: inset 0 0 0 0.0625rem ${interactive};
212
+ pointer-events: none;
213
+ z-index: 3;
214
+ }
227
215
  }
228
216
 
229
217
  ${tabsDetached &&
230
218
  css `
231
219
  border-radius: calc(0.5 * ${theme.base['border-radius']});
232
- border-top-left-radius: 0;
233
- border-bottom-left-radius: 0;
220
+ border-start-start-radius: 0;
221
+ border-end-start-radius: 0;
234
222
  margin: calc(0.125 * ${spacing}) calc(2 * ${spacing});
235
223
 
236
- &:not([disabled]):focus,
224
+ &:focus-visible::after,
225
+ &:not(:disabled):focus-visible::after {
226
+ border-radius: calc(0.5 * ${theme.base['border-radius']});
227
+ border-start-start-radius: 0;
228
+ border-end-start-radius: 0;
229
+ }
230
+
231
+ &:not(:disabled):focus-visible,
237
232
  &[aria-selected='true'] {
238
- background: ${activeTabBg};
239
233
  color: ${activeTabColor};
240
234
  }
241
- &:hover&:not(:disabled):not([aria-selected='true']) {
235
+ &:hover:not(:disabled):not([aria-selected='true']) {
242
236
  background: ${lightenedColor};
243
237
  }
244
238
  `}
245
239
  `;
246
240
  };
247
- export const StyledTab = styled(BareButton)(({ theme, tabType, selected, level }) => css `
241
+ export const StyledTab = styled(BareButton)(({ theme, tabType, selected }) => css `
248
242
  position: relative;
249
- background: none;
250
243
  cursor: pointer;
251
244
  white-space: nowrap;
252
245
 
246
+ > * {
247
+ position: relative;
248
+ z-index: 1;
249
+ }
250
+
253
251
  ${selected &&
254
252
  css `
255
253
  font-weight: bold;
254
+ transition-property: font-weight;
255
+ transition-duration: max(${theme.base.animation.speed}, 1ms);
256
+ transition-timing-function: ${theme.base.animation.timing.ease};
257
+ `}
258
+
259
+ ${!selected &&
260
+ css `
261
+ transition: font-weight 0s;
256
262
  `}
257
263
 
258
264
  & + & {
259
265
  margin-inline-start: 0;
260
266
  }
261
267
 
262
- &:focus {
268
+ &:focus-visible {
263
269
  outline: none;
264
270
  }
265
271
 
@@ -269,7 +275,7 @@ export const StyledTab = styled(BareButton)(({ theme, tabType, selected, level }
269
275
  }
270
276
 
271
277
  ${tabType === 'horizontal'
272
- ? getHorizontalStyles({ theme, selected, level })
278
+ ? getHorizontalStyles({ theme, selected })
273
279
  : getVerticalStyles({ theme, selected })}
274
280
 
275
281
  ${StyledErrorIcon} {
@@ -281,7 +287,6 @@ const Tab = forwardRef(function Tab({ selected, content, count, type, disabled,
281
287
  const t = useI18n();
282
288
  const [tabEl, setTabEl] = useElement();
283
289
  const tabRef = useConsolidatedRef(ref, setTabEl);
284
- const { level } = useContext(TabsContext);
285
290
  const countDescID = useUID();
286
291
  const errorDescID = useUID();
287
292
  const commaDescID = useUID();
@@ -295,7 +300,7 @@ const Tab = forwardRef(function Tab({ selected, content, count, type, disabled,
295
300
  if (errors) {
296
301
  describedBy.push(errorDescID);
297
302
  }
298
- return (_jsxs(StyledTab, { ref: tabRef, selected: selected, tabType: type, disabled: disabled, level: level, "aria-describedby": describedBy.length > 0 ? describedBy.join(' ') : undefined, ...restProps, children: [_jsxs("span", { children: [!!errors && (_jsxs(_Fragment, { children: [_jsx(StyledErrorIcon, { name: 'warn-solid' }), _jsx(Tooltip, { target: tabEl, hideDelay: 'none', showDelay: 'none', describeTarget: false, children: t('tab_error_tooltip', [content]) }), _jsx(HiddenText, { id: errorDescID, children: t('tab_error_description') })] })), _jsx("span", { "data-content": content, children: content })] }), typeof count === 'number' && _jsx(Count, { id: countDescID, children: count }), typeof count === 'number' && errors && _jsx(HiddenText, { id: commaDescID, children: "," })] }));
303
+ return (_jsxs(StyledTab, { ref: tabRef, selected: selected, tabType: type, disabled: disabled, "aria-describedby": describedBy.length > 0 ? describedBy.join(' ') : undefined, ...restProps, children: [_jsxs("span", { children: [!!errors && (_jsxs(_Fragment, { children: [_jsx(StyledErrorIcon, { name: 'warn-solid' }), _jsx(Tooltip, { target: tabEl, hideDelay: 'none', showDelay: 'none', describeTarget: false, children: t('tab_error_tooltip', [content]) }), _jsx(HiddenText, { id: errorDescID, children: t('tab_error_description') })] })), _jsx("span", { "data-content": content, children: content })] }), typeof count === 'number' && _jsx(Count, { id: countDescID, children: count }), typeof count === 'number' && errors && _jsx(HiddenText, { id: commaDescID, children: "," })] }));
299
304
  });
300
305
  export default Tab;
301
306
  //# sourceMappingURL=Tab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,uBAAuB,EAAE,GAAG,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEvF,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,OAAO,WAAW,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,YAAY,CAAC,aAAa,CAAC,CAAC;AAwB5B,MAAM,WAAW,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,GAAG,CAAA;;;wBAGlB,KAAK;;CAE5B,CAAC;AAEF,MAAM,iCAAiC,GAAG,CAAC,EACzC,QAAQ,EACR,KAAK,EACL,OAAO,EACP,KAAK,EAKN,EAAE,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AAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,CACL,MAAC,SAAS,IACR,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,sBACM,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KACxE,SAAS,aAEb,2BACG,CAAC,CAAC,MAAM,IAAI,CACX,8BACE,KAAC,eAAe,IAAC,IAAI,EAAC,YAAY,GAAG,EACrC,KAAC,OAAO,IAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,EAAC,cAAc,EAAE,KAAK,YAC5E,CAAC,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC,GAC1B,EACV,KAAC,UAAU,IAAC,EAAE,EAAE,WAAW,YAAG,CAAC,CAAC,uBAAuB,CAAC,GAAc,IACrE,CACJ,EACD,+BAAoB,OAAO,YAAG,OAAO,GAAQ,IACxC,EACN,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAC,KAAK,IAAC,EAAE,EAAE,WAAW,YAAG,KAAK,GAAS,EACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAC,UAAU,IAAC,EAAE,EAAE,WAAW,kBAAgB,IACzE,CACb,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC","sourcesContent":["import { forwardRef, useContext } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { meetsContrastGuidelines, mix, readableColor, transparentize } from 'polished';\n\nimport { calculateForegroundColor, isSolidColor, readableHue } from '../../styles';\nimport * as warnSolidIcon from '../Icon/icons/warn-solid.icon';\nimport { registerIcon } from '../Icon';\nimport { useConsolidatedRef, useElement, useI18n, useUID } from '../../hooks';\nimport Tooltip from '../Tooltip';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport Count, { StyledCount } from '../Badges/Count';\nimport type { ForwardRefForwardPropsComponent } from '../../types';\nimport BareButton from '../Button/BareButton';\nimport HiddenText from '../HiddenText';\n\nimport TabsContext from './TabsContext';\nimport type { TabsContextValue } from './TabsContext';\nimport type { TabsProps, Tab as TabType } from './Tabs.types';\nimport { StyledErrorIcon } from './Tabs.styles';\n\nregisterIcon(warnSolidIcon);\n\nexport interface TabProps {\n /** Indicates if this Tab is active. */\n selected: boolean;\n /** The text to display as the name of the Tab. */\n content: string;\n /** A number to associate with the Tab. */\n count?: TabType['count'];\n /** Determines the direction in which the Tab will render. */\n type: TabsProps['type'];\n /** Disables the tab if true */\n disabled?: boolean;\n /** An error to associate with the Tab. */\n errors?: number | boolean;\n /** Ref to the tab element. */\n ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;\n}\n\nexport interface StyledTabProps {\n selected: TabProps['selected'];\n tabType: TabProps['type'];\n}\n\nconst activeStyle = (color: string) => css`\n &::after {\n display: block;\n background-color: ${color};\n }\n`;\n\nconst getHorizontalUnselectedHoverStyle = ({\n detached,\n level,\n opacity,\n color\n}: { level?: TabsContextValue['level'] } & {\n detached?: boolean;\n color?: string;\n opacity: number;\n}) =>\n level && level > 1 && !detached\n ? css`\n &::before {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n border-radius: inherit;\n background-color: currentColor;\n opacity: ${opacity};\n }\n `\n : css`\n background-color: ${color};\n border-start-start-radius: ${detached ? 0 : 'calc(0.5rem * 0.5)'};\n border-start-end-radius: ${detached ? 0 : 'calc(0.5rem * 0.5)'};\n `;\n\nconst getHorizontalStyles = ({\n selected,\n level,\n theme\n}: { theme: DefaultTheme } & Pick<StyledTabProps, 'selected'> & {\n level?: TabsContextValue['level'];\n }) => {\n const color = theme.components.button.color;\n const foreground = theme.base.palette['foreground-color'];\n const { detached: tabsDetached } = theme.components.tabs;\n const secondaryColor = tabsDetached\n ? theme.base.palette['primary-background']\n : theme.base.palette['secondary-background'];\n const lightenedColor = tryCatch(() => transparentize(0.3, color)) ?? '';\n\n // If the secondary color is not a solid color, use the readable color as the fallback background.\n const fallbackBackground = isSolidColor(secondaryColor) ? secondaryColor : readableColor(color);\n const backgroundUsable = tryCatch(() => meetsContrastGuidelines(color, fallbackBackground).AA);\n const usableColor = backgroundUsable ? color : readableHue(color, fallbackBackground);\n const hoverBackgroundColor = tabsDetached\n ? tryCatch(() => transparentize(0.95, foreground))\n : tryCatch(() => mix(0.9, fallbackBackground, usableColor));\n const activeBackgroundColor = tabsDetached\n ? theme.base.palette['secondary-background']\n : tryCatch(() => mix(0.8, fallbackBackground, usableColor));\n\n const { spacing } = theme.base;\n\n let activeTabColor = theme.base.palette.interactive;\n if (!meetsContrastGuidelines(activeTabColor, fallbackBackground).AA) {\n activeTabColor = readableHue(activeTabColor, fallbackBackground);\n }\n\n return css`\n align-items: center;\n display: flex;\n flex-direction: row;\n height: calc(4 * ${spacing});\n padding: 0 calc(1.5 * ${spacing});\n border: none;\n text-decoration: none;\n\n @media (pointer: coarse) {\n height: ${theme.base['hit-area']['finger-min']};\n }\n\n span:first-of-type {\n color: ${selected ? color : foreground};\n display: inline-block;\n\n &::before {\n content: attr(data-content) / '';\n display: block;\n font-weight: bold;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n }\n\n &:first-child {\n margin-left: 0;\n }\n &::after {\n background: ${selected ? color : lightenedColor};\n display: ${selected ? 'block' : 'none'};\n content: '';\n position: absolute;\n height: 0.125rem;\n bottom: 0;\n left: calc(1.5 * ${spacing});\n right: calc(1.5 * ${spacing});\n }\n\n ${!selected\n ? css`\n @media (hover: hover) {\n &:not(:disabled):hover {\n text-decoration: none;\n ${getHorizontalUnselectedHoverStyle({\n detached: tabsDetached,\n level,\n opacity: 0.1,\n color: hoverBackgroundColor\n })}\n }\n\n &:not(:disabled):active {\n text-decoration: none;\n ${getHorizontalUnselectedHoverStyle({\n detached: tabsDetached,\n level,\n opacity: 0.2,\n color: activeBackgroundColor\n })}\n }\n }\n `\n : css`\n ${level &&\n level > 1 &&\n css`\n background-color: ${theme.base.palette['primary-background']};\n `}\n `}\n\n &:focus,\n &:not([disabled]):focus {\n border-radius: calc(0.5rem * 0.5);\n box-shadow: ${theme.base.shadow['focus-inset']};\n text-decoration: none;\n &::after {\n display: none;\n }\n }\n\n @media (pointer: coarse) {\n min-block-size: ${theme.base['hit-area'].finger};\n }\n\n ${StyledCount} {\n margin-inline-start: calc(0.5 * ${spacing});\n }\n\n ${tabsDetached &&\n css`\n &[aria-selected='true'],\n &:focus,\n &:not([disabled]):focus {\n color: ${activeTabColor};\n span:first-of-type {\n color: ${activeTabColor};\n }\n background: ${activeBackgroundColor};\n }\n &:hover:not(:disabled):not([aria-selected='true']) {\n background: ${hoverBackgroundColor};\n border-radius: 0;\n color: ${foreground};\n span:first-of-type {\n color: ${foreground};\n }\n }\n `}\n `;\n};\n\nconst getVerticalStyles = ({\n selected,\n theme\n}: { theme: DefaultTheme } & Pick<StyledTabProps, 'selected'>) => {\n const { detached: tabsDetached } = theme.components.tabs;\n const borderColor = theme.base.palette['border-line'];\n const interactive = theme.base.palette.interactive;\n const foreground = theme.base.palette['foreground-color'];\n const secondary = theme.base.palette['secondary-background'];\n const lightenedColor =\n tryCatch(() =>\n transparentize(tabsDetached ? 0.95 : 0.5, tabsDetached ? foreground : interactive)\n ) ?? '';\n const { spacing } = theme.base;\n const activeTabBg = tabsDetached ? secondary : transparentize(0.75, interactive);\n const activeTabColor = tabsDetached\n ? interactive\n : calculateForegroundColor(activeTabBg, foreground);\n\n return css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-style: solid;\n color: ${foreground};\n border-width: 0.0625rem 0;\n border-color: ${tabsDetached ? 'transparent' : borderColor};\n height: calc(5.5 * ${spacing});\n margin-top: -0.0625rem;\n padding: 0 calc(2 * ${spacing});\n text-decoration: none;\n\n &:first-child {\n border-top: 0.0625rem solid ${tabsDetached ? 'transparent' : borderColor};\n }\n &::after {\n content: '';\n position: absolute;\n display: ${selected ? 'block' : 'none'};\n top: 0;\n bottom: 0;\n ${tabsDetached ? 'left: 0;' : 'right: 0;'}\n width: 0.25rem;\n background: ${interactive};\n }\n &:hover&:not(:disabled) {\n ${activeStyle(lightenedColor)}\n text-decoration: none;\n }\n\n &:focus,\n &:not([disabled]):focus {\n ${activeStyle(interactive)}\n box-shadow: inset 0 0 0 0.0625rem ${interactive};\n text-decoration: none;\n }\n\n ${tabsDetached &&\n css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n margin: calc(0.125 * ${spacing}) calc(2 * ${spacing});\n\n &:not([disabled]):focus,\n &[aria-selected='true'] {\n background: ${activeTabBg};\n color: ${activeTabColor};\n }\n &:hover&:not(:disabled):not([aria-selected='true']) {\n background: ${lightenedColor};\n }\n `}\n `;\n};\n\nexport const StyledTab = styled(BareButton)<\n StyledTabProps & {\n level?: TabsContextValue['level'];\n }\n>(\n ({ theme, tabType, selected, level }) => css`\n position: relative;\n background: none;\n cursor: pointer;\n white-space: nowrap;\n\n ${selected &&\n css`\n font-weight: bold;\n `}\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:focus {\n outline: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: ${theme.base['disabled-opacity']};\n }\n\n ${tabType === 'horizontal'\n ? getHorizontalStyles({ theme, selected, level })\n : getVerticalStyles({ theme, selected })}\n\n ${StyledErrorIcon} {\n margin-inline-end: calc(0.5 * ${theme.base.spacing});\n }\n `\n);\n\nStyledTab.defaultProps = defaultThemeProp;\n\nconst Tab: ForwardRefForwardPropsComponent<TabProps> = forwardRef(function Tab(\n { selected, content, count, type, disabled, errors, ...restProps }: PropsWithoutRef<TabProps>,\n ref: TabProps['ref']\n) {\n const t = useI18n();\n const [tabEl, setTabEl] = useElement<HTMLButtonElement | HTMLAnchorElement>();\n const tabRef = useConsolidatedRef(ref, setTabEl);\n const { level } = useContext(TabsContext);\n const countDescID = useUID();\n const errorDescID = useUID();\n const commaDescID = useUID();\n\n const describedBy: string[] = [];\n if (typeof count === 'number') {\n describedBy.push(countDescID);\n }\n if (typeof count === 'number' && errors) {\n describedBy.push(commaDescID);\n }\n if (errors) {\n describedBy.push(errorDescID);\n }\n\n return (\n <StyledTab\n ref={tabRef}\n selected={selected}\n tabType={type}\n disabled={disabled}\n level={level}\n aria-describedby={describedBy.length > 0 ? describedBy.join(' ') : undefined}\n {...restProps}\n >\n <span>\n {!!errors && (\n <>\n <StyledErrorIcon name='warn-solid' />\n <Tooltip target={tabEl} hideDelay='none' showDelay='none' describeTarget={false}>\n {t('tab_error_tooltip', [content])}\n </Tooltip>\n <HiddenText id={errorDescID}>{t('tab_error_description')}</HiddenText>\n </>\n )}\n <span data-content={content}>{content}</span>\n </span>\n {typeof count === 'number' && <Count id={countDescID}>{count}</Count>}\n {typeof count === 'number' && errors && <HiddenText id={commaDescID}>,</HiddenText>}\n </StyledTab>\n );\n});\n\nexport default Tab;\n"]}
1
+ {"version":3,"file":"Tab.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,uBAAuB,EAAE,GAAG,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEvF,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO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AC,CAAC;IAChC,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,EAAE,CAAC;QACxC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,CACL,MAAC,SAAS,IACR,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,QAAQ,sBACA,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KACxE,SAAS,aAEb,2BACG,CAAC,CAAC,MAAM,IAAI,CACX,8BACE,KAAC,eAAe,IAAC,IAAI,EAAC,YAAY,GAAG,EACrC,KAAC,OAAO,IAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,EAAC,cAAc,EAAE,KAAK,YAC5E,CAAC,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC,GAC1B,EACV,KAAC,UAAU,IAAC,EAAE,EAAE,WAAW,YAAG,CAAC,CAAC,uBAAuB,CAAC,GAAc,IACrE,CACJ,EACD,+BAAoB,OAAO,YAAG,OAAO,GAAQ,IACxC,EACN,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAC,KAAK,IAAC,EAAE,EAAE,WAAW,YAAG,KAAK,GAAS,EACpE,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAC,UAAU,IAAC,EAAE,EAAE,WAAW,kBAAgB,IACzE,CACb,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { DefaultTheme } from 'styled-components';\nimport { meetsContrastGuidelines, mix, readableColor, transparentize } from 'polished';\n\nimport { calculateForegroundColor, isSolidColor, readableHue } from '../../styles';\nimport * as warnSolidIcon from '../Icon/icons/warn-solid.icon';\nimport { registerIcon } from '../Icon';\nimport { useConsolidatedRef, useElement, useI18n, useUID } from '../../hooks';\nimport Tooltip from '../Tooltip';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport Count, { StyledCount } from '../Badges/Count';\nimport type { ForwardRefForwardPropsComponent } from '../../types';\nimport BareButton from '../Button/BareButton';\nimport HiddenText from '../HiddenText';\n\nimport type { TabsProps, Tab as TabType } from './Tabs.types';\nimport { StyledErrorIcon } from './Tabs.styles';\n\nregisterIcon(warnSolidIcon);\n\nexport interface TabProps {\n /** Indicates if this Tab is active. */\n selected: boolean;\n /** The text to display as the name of the Tab. */\n content: string;\n /** A number to associate with the Tab. */\n count?: TabType['count'];\n /** Determines the direction in which the Tab will render. */\n type: TabsProps['type'];\n /** Disables the tab if true */\n disabled?: boolean;\n /** An error to associate with the Tab. */\n errors?: number | boolean;\n /** Ref to the tab element. */\n ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;\n}\n\nexport interface StyledTabProps {\n selected: TabProps['selected'];\n tabType: TabProps['type'];\n}\n\nconst getHorizontalStyles = ({\n selected,\n theme\n}: Pick<StyledTabProps, 'selected'> & { theme: DefaultTheme }) => {\n const color = theme.components.button.color;\n const foreground = theme.base.palette['foreground-color'];\n const { detached: tabsDetached } = theme.components.tabs;\n const secondaryColor = tabsDetached\n ? theme.base.palette['primary-background']\n : theme.base.palette['secondary-background'];\n\n // If the secondary color is not a solid color, use the readable color as the fallback background.\n const fallbackBackground = isSolidColor(secondaryColor) ? secondaryColor : readableColor(color);\n const backgroundUsable = tryCatch(() => meetsContrastGuidelines(color, fallbackBackground).AA);\n const usableColor = backgroundUsable ? color : readableHue(color, fallbackBackground);\n const hoverBackgroundColor = tabsDetached\n ? tryCatch(() => transparentize(0.95, foreground))\n : tryCatch(() => mix(0.9, fallbackBackground, usableColor));\n const activeBackgroundColor = tabsDetached\n ? theme.base.palette['secondary-background']\n : tryCatch(() => mix(0.8, fallbackBackground, usableColor));\n\n const { spacing } = theme.base;\n\n let activeTabColor = theme.base.palette.interactive;\n if (!meetsContrastGuidelines(activeTabColor, fallbackBackground).AA) {\n activeTabColor = readableHue(activeTabColor, fallbackBackground);\n }\n\n return css`\n align-items: center;\n display: flex;\n flex-direction: row;\n height: calc(4 * ${spacing});\n padding: 0 calc(1.5 * ${spacing});\n border: none;\n text-decoration: none;\n transition-property: background-color;\n transition-duration: max(${theme.base.animation.speed}, 1ms);\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n @media (pointer: coarse) {\n height: ${theme.base['hit-area']['finger-min']};\n }\n\n span:first-of-type {\n color: ${selected ? color : foreground};\n display: inline-block;\n transition-property: color;\n transition-duration: ${selected ? `max(${theme.base.animation.speed}, 1ms)` : '0s'};\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n &::before {\n content: attr(data-content) / '';\n display: block;\n font-weight: bold;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n }\n\n &:first-child {\n margin-inline-start: 0;\n }\n\n ${!selected &&\n css`\n @media (hover: hover) {\n &:not(:disabled):hover {\n text-decoration: none;\n background-color: ${hoverBackgroundColor};\n }\n\n &:not(:disabled):active {\n text-decoration: none;\n background-color: ${activeBackgroundColor};\n }\n }\n `}\n\n &:focus-visible,\n &:not(:disabled):focus-visible {\n text-decoration: none;\n outline: none;\n\n &::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: calc(0.5rem * 0.5);\n box-shadow: ${theme.base.shadow['focus-inset']};\n pointer-events: none;\n z-index: 3;\n }\n }\n\n &:first-child:focus-visible::after,\n &:first-child:not(:disabled):focus-visible::after {\n border-start-start-radius: var(--border-radius, ${theme.base['border-radius']});\n }\n\n @media (pointer: coarse) {\n min-block-size: ${theme.base['hit-area'].finger};\n }\n\n ${StyledCount} {\n margin-inline-start: calc(0.5 * ${spacing});\n }\n\n ${tabsDetached &&\n css`\n &[aria-selected='true'],\n &:focus-visible,\n &:not([disabled]):focus-visible {\n color: ${activeTabColor};\n span:first-of-type {\n color: ${activeTabColor};\n }\n background: ${activeBackgroundColor};\n }\n &:hover:not(:disabled):not([aria-selected='true']) {\n background: ${hoverBackgroundColor};\n border-radius: 0;\n color: ${foreground};\n span:first-of-type {\n color: ${foreground};\n }\n }\n `}\n `;\n};\n\nconst getVerticalStyles = ({\n theme,\n selected\n}: Pick<StyledTabProps, 'selected'> & { theme: DefaultTheme }) => {\n const { detached: tabsDetached } = theme.components.tabs;\n const interactive = theme.base.palette.interactive;\n const foreground = theme.base.palette['foreground-color'];\n const secondary = theme.base.palette['secondary-background'];\n const { spacing } = theme.base;\n const lightenedColor =\n tryCatch(() =>\n transparentize(tabsDetached ? 0.95 : 0.5, tabsDetached ? foreground : interactive)\n ) ?? '';\n const activeTabBg = tabsDetached ? secondary : transparentize(0.75, interactive);\n const activeTabColor = tabsDetached\n ? interactive\n : calculateForegroundColor(activeTabBg, foreground);\n\n const borderColor = theme.base.palette['border-line'];\n\n return css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-style: solid;\n color: ${foreground};\n border-width: 0.0625rem 0;\n border-color: ${tabsDetached ? 'transparent' : borderColor};\n height: calc(5.5 * ${spacing});\n margin-top: -0.0625rem;\n padding: 0 calc(2 * ${spacing});\n text-decoration: none;\n transition-property: ${selected ? 'color, font-weight, background-color' : 'background-color'};\n transition-duration: max(${theme.base.animation.speed}, 1ms);\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n &:first-child {\n border-top: 0.0625rem solid ${tabsDetached ? 'transparent' : borderColor};\n }\n\n &::before {\n content: '';\n position: absolute;\n ${tabsDetached ? 'inset-inline-start: 0;' : 'inset-inline-end: 0;'}\n inset-block-start: 0;\n inset-block-end: 0;\n width: 0.25rem;\n background: ${lightenedColor};\n pointer-events: none;\n z-index: 2;\n opacity: 0;\n transition-property: opacity;\n transition-duration: max(${theme.base.animation.speed}, 1ms);\n transition-timing-function: ${theme.base.animation.timing.ease};\n }\n\n &:active {\n background: none;\n }\n\n &:active::before {\n opacity: 1;\n }\n\n &:hover:not(:disabled)::before {\n opacity: 1;\n }\n\n &:focus-visible,\n &:not(:disabled):focus-visible {\n text-decoration: none;\n outline: none;\n\n &::after {\n content: '';\n position: absolute;\n inset: 0;\n box-shadow: inset 0 0 0 0.0625rem ${interactive};\n pointer-events: none;\n z-index: 3;\n }\n }\n\n ${tabsDetached &&\n css`\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n margin: calc(0.125 * ${spacing}) calc(2 * ${spacing});\n\n &:focus-visible::after,\n &:not(:disabled):focus-visible::after {\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n\n &:not(:disabled):focus-visible,\n &[aria-selected='true'] {\n color: ${activeTabColor};\n }\n &:hover:not(:disabled):not([aria-selected='true']) {\n background: ${lightenedColor};\n }\n `}\n `;\n};\n\nexport const StyledTab = styled(BareButton)<StyledTabProps>(\n ({ theme, tabType, selected }) => css`\n position: relative;\n cursor: pointer;\n white-space: nowrap;\n\n > * {\n position: relative;\n z-index: 1;\n }\n\n ${selected &&\n css`\n font-weight: bold;\n transition-property: font-weight;\n transition-duration: max(${theme.base.animation.speed}, 1ms);\n transition-timing-function: ${theme.base.animation.timing.ease};\n `}\n\n ${!selected &&\n css`\n transition: font-weight 0s;\n `}\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:focus-visible {\n outline: none;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: ${theme.base['disabled-opacity']};\n }\n\n ${tabType === 'horizontal'\n ? getHorizontalStyles({ theme, selected })\n : getVerticalStyles({ theme, selected })}\n\n ${StyledErrorIcon} {\n margin-inline-end: calc(0.5 * ${theme.base.spacing});\n }\n `\n);\n\nStyledTab.defaultProps = defaultThemeProp;\n\nconst Tab: ForwardRefForwardPropsComponent<TabProps> = forwardRef(function Tab(\n { selected, content, count, type, disabled, errors, ...restProps }: PropsWithoutRef<TabProps>,\n ref: TabProps['ref']\n) {\n const t = useI18n();\n const [tabEl, setTabEl] = useElement<HTMLButtonElement | HTMLAnchorElement>();\n const tabRef = useConsolidatedRef(ref, setTabEl);\n const countDescID = useUID();\n const errorDescID = useUID();\n const commaDescID = useUID();\n\n const describedBy: string[] = [];\n if (typeof count === 'number') {\n describedBy.push(countDescID);\n }\n if (typeof count === 'number' && errors) {\n describedBy.push(commaDescID);\n }\n if (errors) {\n describedBy.push(errorDescID);\n }\n\n return (\n <StyledTab\n ref={tabRef}\n selected={selected}\n tabType={type}\n disabled={disabled}\n aria-describedby={describedBy.length > 0 ? describedBy.join(' ') : undefined}\n {...restProps}\n >\n <span>\n {!!errors && (\n <>\n <StyledErrorIcon name='warn-solid' />\n <Tooltip target={tabEl} hideDelay='none' showDelay='none' describeTarget={false}>\n {t('tab_error_tooltip', [content])}\n </Tooltip>\n <HiddenText id={errorDescID}>{t('tab_error_description')}</HiddenText>\n </>\n )}\n <span data-content={content}>{content}</span>\n </span>\n {typeof count === 'number' && <Count id={countDescID}>{count}</Count>}\n {typeof count === 'number' && errors && <HiddenText id={commaDescID}>,</HiddenText>}\n </StyledTab>\n );\n});\n\nexport default Tab;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAmD,MAAM,OAAO,CAAC;AAMhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAyBhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAwF9C;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAuJpD,CAAC;AAEH,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAmD,MAAM,OAAO,CAAC;AAMhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAyBhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAwF9C;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAgLpD,CAAC;AAEH,eAAe,IAAI,CAAC"}
@@ -106,6 +106,29 @@ const Tabs = forwardRef(function Tabs({ tabs = [], type = 'horizontal', currentT
106
106
  const currentTabEl = tabRefMap.get(currentTabId);
107
107
  currentTabEl?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
108
108
  }, [currentTabId]);
109
+ useEffect(() => {
110
+ const currentTabEl = tabRefMap.get(currentTabId);
111
+ if (!currentTabEl || !wrapper)
112
+ return;
113
+ // raf to ensure layout is stable before reading offset values
114
+ const rafId = requestAnimationFrame(() => {
115
+ if (type === 'horizontal') {
116
+ // Horizontal tabs need left position and width for sliding animation
117
+ const left = currentTabEl.offsetLeft;
118
+ const width = currentTabEl.offsetWidth;
119
+ wrapper.style.setProperty('--indicator-left', `${left}px`);
120
+ wrapper.style.setProperty('--indicator-width', `${width}px`);
121
+ }
122
+ else {
123
+ // Vertical tabs need height and top position for sliding animation
124
+ const height = currentTabEl.offsetHeight;
125
+ const top = currentTabEl.offsetTop;
126
+ wrapper.style.setProperty('--indicator-height', `${height}px`);
127
+ wrapper.style.setProperty('--indicator-top', `${top}px`);
128
+ }
129
+ });
130
+ return () => cancelAnimationFrame(rafId);
131
+ }, [currentTabId, type, tabRefMap, wrapper]);
109
132
  useEffect(() => {
110
133
  if (!wrapper)
111
134
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[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AAE,CAAC,EAClB,SAAS,EAAE,CAAC,CAAgB,EAAE,EAAE;4BAC9B,IAAI,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;gCACxE,CAAC,CAAC,cAAc,EAAE,CAAC;gCACnB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;4BACvB,CAAC;wBACH,CAAC,EACD,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAC3B,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,gBACvB,IAAI,EAChB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,GACd,KAlCW,EAAE,CAmCN,CACZ,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC;IAEF,OAAO,yBAAyB,CAAC,CAAC,CAAC,CACjC,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,KAAK,aAChF,KAAC,IAAI,IAAC,SAAS,QAAC,EAAE,EAAE,0BAA0B,YAC5C,KAAC,aAAa,IACZ,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,GACtB,GACG,EACN,OAAO,IACH,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import type { FunctionComponent, KeyboardEvent, MouseEvent, PropsWithoutRef, Ref } from 'react';\nimport { useContext, forwardRef, useEffect, useMemo, useRef, useState, Fragment } from 'react';\n\nimport SearchInput from '../SearchInput';\nimport Flex from '../Flex';\nimport Link from '../Link';\nimport type { ForwardProps } from '../../types';\nimport {\n useAfterInitialEffect,\n useConsolidatedRef,\n useElement,\n useEscape,\n useI18n,\n useTheme,\n useUID,\n useRefMap\n} from '../../hooks';\nimport * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';\nimport { registerIcon } from '../Icon/Icon';\nimport type { MenuItemProps, MenuProps } from '../Menu';\nimport { createStringMatcher, debounce } from '../../utils';\n\nimport TabsContext from './TabsContext';\nimport {\n StyledErrorIcon,\n StyledAllTabsButton,\n StyledTabs,\n StylesAllTabsButtonWrapper,\n StyledAllTabsWrapper,\n StyledSeparator\n} from './Tabs.styles';\nimport type { TabsProps } from './Tabs.types';\nimport Tab from './Tab';\n\nregisterIcon(arrowMicroDownIcon);\n\ntype TabItem = TabsProps['tabs'][number];\n\nconst AllTabsButton = ({\n tabs,\n tabRefMap,\n currentTabId,\n onTabClick\n}: Pick<TabsProps, 'tabs' | 'currentTabId' | 'onTabClick'> & {\n tabRefMap: Map<string, HTMLAnchorElement | HTMLButtonElement | null>;\n}) => {\n const menuId = useUID();\n const t = useI18n();\n const menuButtonRef = useRef<HTMLButtonElement>(null);\n const [search, setSearch] = useState('');\n const searchEleRef = useRef<HTMLInputElement>(null);\n const [focusControlEl, setFocusControlEl] = useState<MenuProps['focusControlEl']>();\n\n const searchRegex = createStringMatcher(search);\n\n const itemsToRender = useMemo(() => {\n return tabs\n .filter(({ name }) => searchRegex.test(name))\n .map(({ id, name, count, disabled, errors }) => {\n const selected = id === currentTabId;\n const item: MenuItemProps = { id, primary: name, selected, count, disabled };\n if (errors) {\n item.visual = <StyledErrorIcon name='warn-solid' />;\n }\n return item;\n });\n }, [tabs, search, currentTabId]);\n\n useEscape(() => {\n if (!search) {\n menuButtonRef.current?.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));\n menuButtonRef.current?.focus();\n }\n }, searchEleRef);\n\n return (\n <StyledAllTabsButton\n ref={menuButtonRef}\n text={t('all_tabs')}\n iconOnly\n variant='simple'\n icon='arrow-micro-down'\n menu={{\n listId: menuId,\n mode: 'single-select',\n items: itemsToRender,\n focusControlEl,\n accent: search ? searchRegex : undefined,\n onItemClick: (id: string, event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n onTabClick?.(id, event);\n setSearch('');\n tabRefMap.get(id)?.focus();\n },\n header: (\n <SearchInput\n ref={searchEleRef}\n onSearchChange={setSearch}\n value={search}\n role='searchbox'\n aria-controls={menuId}\n />\n )\n }}\n popover={{\n onHide: () => {\n setFocusControlEl(undefined);\n setSearch('');\n },\n onShow: () => {\n if (searchEleRef.current) {\n setFocusControlEl(searchEleRef.current);\n searchEleRef.current.focus();\n }\n }\n }}\n />\n );\n};\n\n/**\n * The tabs component will take a list of tab data objects and render out a list of tabs in either vertical or horizontal direction.\n * The tabs component handles which tab is active but will give you a callback function that allows you to make changes when a new tab is activated\n */\nconst Tabs: FunctionComponent<TabsProps & ForwardProps> = forwardRef(function Tabs(\n {\n tabs = [],\n type = 'horizontal',\n currentTabId,\n onTabClick,\n ...restProps\n }: PropsWithoutRef<TabsProps>,\n ref: Ref<HTMLElement>\n) {\n const [wrapper, setWrapper] = useElement<HTMLDivElement>();\n const wrapperRef = useConsolidatedRef(ref, setWrapper);\n const { level } = useContext(TabsContext);\n const [hasScrollBar, setHasScrollBar] = useState(false);\n const {\n components: {\n tabs: { detached: tabsDetached }\n }\n } = useTheme();\n\n // Used to keep a reference for every tab in order to focus them with key presses\n const [tabRefMap, getTabRef] = useRefMap<HTMLButtonElement | HTMLAnchorElement | null>();\n\n // Handles arrow keypresses for changing the focus\n const changeTabFocus = (event: KeyboardEvent, index: number): void => {\n if (tabs.length) {\n const { key } = event;\n if (key === 'ArrowRight' || key === 'ArrowDown') {\n const nextIndex = index + 1 < tabs.length ? index + 1 : 0;\n const nextTab = tabRefMap.get(tabs[nextIndex].id) as HTMLButtonElement;\n\n if (!nextTab?.disabled) {\n nextTab?.focus();\n } else {\n changeTabFocus(event, nextIndex);\n }\n } else if (key === 'ArrowLeft' || key === 'ArrowUp') {\n const prevIndex = index === 0 ? tabs.length - 1 : index - 1;\n const prevTab = tabRefMap.get(tabs[prevIndex].id) as HTMLButtonElement;\n if (!prevTab?.disabled) {\n prevTab?.focus();\n } else {\n changeTabFocus(event, prevIndex);\n }\n }\n }\n };\n\n useAfterInitialEffect(() => {\n const event = new Event('cosmos-tab-changed', { bubbles: true, composed: true });\n wrapperRef.current?.dispatchEvent(event);\n\n const currentTabEl = tabRefMap.get(currentTabId);\n currentTabEl?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n }, [currentTabId]);\n\n useEffect(() => {\n if (!wrapper) return;\n\n const ro = new ResizeObserver(\n debounce(([entry]) => {\n if (!entry?.target.isConnected || !(entry.target instanceof HTMLElement)) return;\n\n setHasScrollBar(entry.target.scrollWidth > entry.target.offsetWidth);\n }, 1)\n );\n\n ro.observe(wrapper);\n\n return () => {\n ro.disconnect();\n };\n }, [wrapper]);\n\n const shouldRenderAllTabsButton = type === 'horizontal' && hasScrollBar;\n\n const TabList = (\n <Flex\n {...restProps}\n container={{\n direction: type !== 'horizontal' ? 'column' : undefined\n }}\n item={{ shrink: 0 }}\n as={StyledTabs}\n ref={wrapperRef}\n role='tablist'\n aria-orientation={type}\n hasScrollBar={hasScrollBar}\n level={level}\n >\n {tabs.map((tab: TabItem, i) => {\n const { href, name, count, id, disabled, errors } = tab;\n const selected = id === currentTabId;\n\n return (\n <Fragment key={id}>\n {level > 1 && !tabsDetached && (\n <StyledSeparator\n transparent={\n selected ||\n (i === 0 ? !shouldRenderAllTabsButton : tabs[i - 1].id === currentTabId)\n }\n />\n )}\n <Tab\n id={id}\n aria-selected={selected}\n aria-controls={`${id}-panel`}\n content={name}\n count={count}\n href={href}\n selected={selected}\n onClick={(event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n onTabClick?.(id, event);\n }}\n role='tab'\n ref={getTabRef(id)}\n onKeyDown={(e: KeyboardEvent) => {\n if (['ArrowRight', 'ArrowDown', 'ArrowLeft', 'ArrowUp'].includes(e.key)) {\n e.preventDefault();\n changeTabFocus(e, i);\n }\n }}\n as={href ? Link : undefined}\n tabIndex={selected ? undefined : -1}\n aria-label={name}\n type={type}\n disabled={disabled}\n errors={errors}\n />\n </Fragment>\n );\n })}\n </Flex>\n );\n\n return shouldRenderAllTabsButton ? (\n <Flex container={{ alignItems: 'stretch' }} as={StyledAllTabsWrapper} level={level}>\n <Flex container as={StylesAllTabsButtonWrapper}>\n <AllTabsButton\n tabs={tabs}\n tabRefMap={tabRefMap}\n currentTabId={currentTabId}\n onTabClick={onTabClick}\n />\n </Flex>\n {TabList}\n </Flex>\n ) : (\n TabList\n );\n});\n\nexport default Tabs;\n"]}
1
+ {"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/F,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,kBAAkB,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB,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B,UAAU,EAAE,UAAU,GACtB,GACG,EACN,OAAO,IACH,CACR,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["import type { FunctionComponent, KeyboardEvent, MouseEvent, PropsWithoutRef, Ref } from 'react';\nimport { useContext, forwardRef, useEffect, useMemo, useRef, useState, Fragment } from 'react';\n\nimport SearchInput from '../SearchInput';\nimport Flex from '../Flex';\nimport Link from '../Link';\nimport type { ForwardProps } from '../../types';\nimport {\n useAfterInitialEffect,\n useConsolidatedRef,\n useElement,\n useEscape,\n useI18n,\n useTheme,\n useUID,\n useRefMap\n} from '../../hooks';\nimport * as arrowMicroDownIcon from '../Icon/icons/arrow-micro-down.icon';\nimport { registerIcon } from '../Icon/Icon';\nimport type { MenuItemProps, MenuProps } from '../Menu';\nimport { createStringMatcher, debounce } from '../../utils';\n\nimport TabsContext from './TabsContext';\nimport {\n StyledErrorIcon,\n StyledAllTabsButton,\n StyledTabs,\n StylesAllTabsButtonWrapper,\n StyledAllTabsWrapper,\n StyledSeparator\n} from './Tabs.styles';\nimport type { TabsProps } from './Tabs.types';\nimport Tab from './Tab';\n\nregisterIcon(arrowMicroDownIcon);\n\ntype TabItem = TabsProps['tabs'][number];\n\nconst AllTabsButton = ({\n tabs,\n tabRefMap,\n currentTabId,\n onTabClick\n}: Pick<TabsProps, 'tabs' | 'currentTabId' | 'onTabClick'> & {\n tabRefMap: Map<string, HTMLAnchorElement | HTMLButtonElement | null>;\n}) => {\n const menuId = useUID();\n const t = useI18n();\n const menuButtonRef = useRef<HTMLButtonElement>(null);\n const [search, setSearch] = useState('');\n const searchEleRef = useRef<HTMLInputElement>(null);\n const [focusControlEl, setFocusControlEl] = useState<MenuProps['focusControlEl']>();\n\n const searchRegex = createStringMatcher(search);\n\n const itemsToRender = useMemo(() => {\n return tabs\n .filter(({ name }) => searchRegex.test(name))\n .map(({ id, name, count, disabled, errors }) => {\n const selected = id === currentTabId;\n const item: MenuItemProps = { id, primary: name, selected, count, disabled };\n if (errors) {\n item.visual = <StyledErrorIcon name='warn-solid' />;\n }\n return item;\n });\n }, [tabs, search, currentTabId]);\n\n useEscape(() => {\n if (!search) {\n menuButtonRef.current?.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));\n menuButtonRef.current?.focus();\n }\n }, searchEleRef);\n\n return (\n <StyledAllTabsButton\n ref={menuButtonRef}\n text={t('all_tabs')}\n iconOnly\n variant='simple'\n icon='arrow-micro-down'\n menu={{\n listId: menuId,\n mode: 'single-select',\n items: itemsToRender,\n focusControlEl,\n accent: search ? searchRegex : undefined,\n onItemClick: (id: string, event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n onTabClick?.(id, event);\n setSearch('');\n tabRefMap.get(id)?.focus();\n },\n header: (\n <SearchInput\n ref={searchEleRef}\n onSearchChange={setSearch}\n value={search}\n role='searchbox'\n aria-controls={menuId}\n />\n )\n }}\n popover={{\n onHide: () => {\n setFocusControlEl(undefined);\n setSearch('');\n },\n onShow: () => {\n if (searchEleRef.current) {\n setFocusControlEl(searchEleRef.current);\n searchEleRef.current.focus();\n }\n }\n }}\n />\n );\n};\n\n/**\n * The tabs component will take a list of tab data objects and render out a list of tabs in either vertical or horizontal direction.\n * The tabs component handles which tab is active but will give you a callback function that allows you to make changes when a new tab is activated\n */\nconst Tabs: FunctionComponent<TabsProps & ForwardProps> = forwardRef(function Tabs(\n {\n tabs = [],\n type = 'horizontal',\n currentTabId,\n onTabClick,\n ...restProps\n }: PropsWithoutRef<TabsProps>,\n ref: Ref<HTMLElement>\n) {\n const [wrapper, setWrapper] = useElement<HTMLDivElement>();\n const wrapperRef = useConsolidatedRef(ref, setWrapper);\n const { level } = useContext(TabsContext);\n const [hasScrollBar, setHasScrollBar] = useState(false);\n const {\n components: {\n tabs: { detached: tabsDetached }\n }\n } = useTheme();\n\n // Used to keep a reference for every tab in order to focus them with key presses\n const [tabRefMap, getTabRef] = useRefMap<HTMLButtonElement | HTMLAnchorElement | null>();\n\n // Handles arrow keypresses for changing the focus\n const changeTabFocus = (event: KeyboardEvent, index: number): void => {\n if (tabs.length) {\n const { key } = event;\n if (key === 'ArrowRight' || key === 'ArrowDown') {\n const nextIndex = index + 1 < tabs.length ? index + 1 : 0;\n const nextTab = tabRefMap.get(tabs[nextIndex].id) as HTMLButtonElement;\n\n if (!nextTab?.disabled) {\n nextTab?.focus();\n } else {\n changeTabFocus(event, nextIndex);\n }\n } else if (key === 'ArrowLeft' || key === 'ArrowUp') {\n const prevIndex = index === 0 ? tabs.length - 1 : index - 1;\n const prevTab = tabRefMap.get(tabs[prevIndex].id) as HTMLButtonElement;\n if (!prevTab?.disabled) {\n prevTab?.focus();\n } else {\n changeTabFocus(event, prevIndex);\n }\n }\n }\n };\n\n useAfterInitialEffect(() => {\n const event = new Event('cosmos-tab-changed', { bubbles: true, composed: true });\n wrapperRef.current?.dispatchEvent(event);\n\n const currentTabEl = tabRefMap.get(currentTabId);\n currentTabEl?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });\n }, [currentTabId]);\n\n useEffect(() => {\n const currentTabEl = tabRefMap.get(currentTabId);\n\n if (!currentTabEl || !wrapper) return;\n\n // raf to ensure layout is stable before reading offset values\n const rafId = requestAnimationFrame(() => {\n if (type === 'horizontal') {\n // Horizontal tabs need left position and width for sliding animation\n const left = currentTabEl.offsetLeft;\n const width = currentTabEl.offsetWidth;\n wrapper.style.setProperty('--indicator-left', `${left}px`);\n wrapper.style.setProperty('--indicator-width', `${width}px`);\n } else {\n // Vertical tabs need height and top position for sliding animation\n const height = currentTabEl.offsetHeight;\n const top = currentTabEl.offsetTop;\n wrapper.style.setProperty('--indicator-height', `${height}px`);\n wrapper.style.setProperty('--indicator-top', `${top}px`);\n }\n });\n\n return () => cancelAnimationFrame(rafId);\n }, [currentTabId, type, tabRefMap, wrapper]);\n\n useEffect(() => {\n if (!wrapper) return;\n\n const ro = new ResizeObserver(\n debounce(([entry]) => {\n if (!entry?.target.isConnected || !(entry.target instanceof HTMLElement)) return;\n\n setHasScrollBar(entry.target.scrollWidth > entry.target.offsetWidth);\n }, 1)\n );\n\n ro.observe(wrapper);\n\n return () => {\n ro.disconnect();\n };\n }, [wrapper]);\n\n const shouldRenderAllTabsButton = type === 'horizontal' && hasScrollBar;\n\n const TabList = (\n <Flex\n {...restProps}\n container={{\n direction: type !== 'horizontal' ? 'column' : undefined\n }}\n item={{ shrink: 0 }}\n as={StyledTabs}\n ref={wrapperRef}\n role='tablist'\n aria-orientation={type}\n hasScrollBar={hasScrollBar}\n level={level}\n >\n {tabs.map((tab: TabItem, i) => {\n const { href, name, count, id, disabled, errors } = tab;\n const selected = id === currentTabId;\n\n return (\n <Fragment key={id}>\n {level > 1 && !tabsDetached && (\n <StyledSeparator\n transparent={\n selected ||\n (i === 0 ? !shouldRenderAllTabsButton : tabs[i - 1].id === currentTabId)\n }\n />\n )}\n <Tab\n id={id}\n aria-selected={selected}\n aria-controls={`${id}-panel`}\n content={name}\n count={count}\n href={href}\n selected={selected}\n onClick={(event: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n onTabClick?.(id, event);\n }}\n role='tab'\n ref={getTabRef(id)}\n onKeyDown={(e: KeyboardEvent) => {\n if (['ArrowRight', 'ArrowDown', 'ArrowLeft', 'ArrowUp'].includes(e.key)) {\n e.preventDefault();\n changeTabFocus(e, i);\n }\n }}\n as={href ? Link : undefined}\n tabIndex={selected ? undefined : -1}\n aria-label={name}\n type={type}\n disabled={disabled}\n errors={errors}\n />\n </Fragment>\n );\n })}\n </Flex>\n );\n\n return shouldRenderAllTabsButton ? (\n <Flex container={{ alignItems: 'stretch' }} as={StyledAllTabsWrapper} level={level}>\n <Flex container as={StylesAllTabsButtonWrapper}>\n <AllTabsButton\n tabs={tabs}\n tabRefMap={tabRefMap}\n currentTabId={currentTabId}\n onTabClick={onTabClick}\n />\n </Flex>\n {TabList}\n </Flex>\n ) : (\n TabList\n );\n});\n\nexport default Tabs;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.styles.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,0BAA0B,6NAmBtC,CAAC;AAIF,eAAO,MAAM,UAAU;kBACP,OAAO;WACd,MAAM;YAqIb,CAAC;AAIH,eAAO,MAAM,mBAAmB;;;;iDAI/B,CAAC;AAIF,eAAO,MAAM,eAAe,kYAI3B,CAAC;AAIF,eAAO,MAAM,oBAAoB;WACxB,MAAM;YAoCd,CAAC;AAIF,eAAO,MAAM,eAAe;iBAA8B,OAAO;YAOhE,CAAC"}
1
+ {"version":3,"file":"Tabs.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.styles.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,0BAA0B,6NAmBtC,CAAC;AAIF,eAAO,MAAM,UAAU;kBACP,OAAO;WACd,MAAM;YAwOb,CAAC;AAIH,eAAO,MAAM,mBAAmB;;;;iDAI/B,CAAC;AAIF,eAAO,MAAM,eAAe,kYAI3B,CAAC;AAIF,eAAO,MAAM,oBAAoB;WACxB,MAAM;YAoCd,CAAC;AAIF,eAAO,MAAM,eAAe;iBAA8B,OAAO;YAOhE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import styled, { css } from 'styled-components';
2
+ import { transparentize } from 'polished';
2
3
  import Icon from '../Icon';
3
4
  import MenuButton from '../MenuButton';
4
5
  import { defaultThemeProp } from '../../theme';
@@ -23,9 +24,103 @@ export const StylesAllTabsButtonWrapper = styled.div(({ theme }) => css `
23
24
  `);
24
25
  StylesAllTabsButtonWrapper.defaultProps = defaultThemeProp;
25
26
  export const StyledTabs = styled.div(({ theme, hasScrollBar, level }) => {
27
+ const { detached: tabsDetached } = theme.components.tabs;
28
+ const { spacing } = theme.base;
29
+ const color = theme.components.button.color;
30
+ const secondary = theme.base.palette['secondary-background'];
31
+ const interactive = theme.base.palette.interactive;
32
+ const shouldShowBackground = tabsDetached || (level && level > 1);
33
+ let verticalBackground = 'transparent';
34
+ if (shouldShowBackground) {
35
+ verticalBackground = tabsDetached ? secondary : transparentize(0.75, interactive);
36
+ }
37
+ const horizontalBackground = shouldShowBackground
38
+ ? theme.base.palette['primary-background']
39
+ : 'transparent';
40
+ const indicatorTransition = css `
41
+ transition-property: transform, width, height;
42
+ transition-duration: max(${theme.base.animation.speed}, 1ms);
43
+ transition-timing-function: ${theme.base.animation.timing.ease};
44
+ `;
26
45
  return css `
27
46
  position: relative;
28
47
 
48
+ &::before {
49
+ content: '';
50
+ position: absolute;
51
+ ${indicatorTransition};
52
+ pointer-events: none;
53
+ z-index: 0;
54
+ }
55
+
56
+ &::after {
57
+ content: '';
58
+ position: absolute;
59
+ ${indicatorTransition};
60
+ pointer-events: none;
61
+ z-index: 2;
62
+ }
63
+
64
+ &[aria-orientation='horizontal']::before {
65
+ inset-block-start: 0;
66
+ inset-block-end: 0;
67
+ inset-inline-start: 0;
68
+ width: var(--indicator-width);
69
+ transform: translateX(var(--indicator-left));
70
+ background: ${horizontalBackground};
71
+ }
72
+
73
+ &[aria-orientation='horizontal']::after {
74
+ inset-block-end: 0;
75
+ inset-inline-start: calc(1.5 * ${spacing});
76
+ width: calc(var(--indicator-width) - 3 * ${spacing});
77
+ height: 0.125rem;
78
+ background: ${color};
79
+ transform: translateX(var(--indicator-left));
80
+ }
81
+
82
+ &[aria-orientation='vertical']::before {
83
+ inset-block-start: 0;
84
+ height: var(--indicator-height);
85
+ transform: translateY(var(--indicator-top));
86
+ background: ${verticalBackground};
87
+
88
+ ${!tabsDetached &&
89
+ css `
90
+ inset-inline-start: 0;
91
+ width: 100%;
92
+ `}
93
+
94
+ ${tabsDetached &&
95
+ css `
96
+ inset-inline-start: calc(2 * ${spacing});
97
+ inset-inline-end: calc(2 * ${spacing});
98
+ border-radius: calc(0.5 * ${theme.base['border-radius']});
99
+ border-start-start-radius: 0;
100
+ border-end-start-radius: 0;
101
+ `}
102
+ }
103
+
104
+ &[aria-orientation='vertical']::after {
105
+ width: 0.25rem;
106
+ background: ${interactive};
107
+ transform: translateY(var(--indicator-top));
108
+
109
+ ${!tabsDetached &&
110
+ css `
111
+ inset-block-start: 0;
112
+ height: var(--indicator-height);
113
+ inset-inline-end: 0;
114
+ `}
115
+
116
+ ${tabsDetached &&
117
+ css `
118
+ inset-block-start: 0.0625rem;
119
+ height: calc(var(--indicator-height) - 0.125rem);
120
+ inset-inline-start: calc(2 * ${spacing});
121
+ `}
122
+ }
123
+
29
124
  ${theme.components.tabs.detached &&
30
125
  css `
31
126
  ${StyledTab} + ${StyledTab} {
@@ -47,14 +142,14 @@ export const StyledTabs = styled.div(({ theme, hasScrollBar, level }) => {
47
142
 
48
143
  ${!hasScrollBar &&
49
144
  css `
50
- :first-child {
51
- border-top-left-radius: var(--border-radius, ${theme.base['border-radius']});
145
+ &:first-child {
146
+ border-start-start-radius: var(--border-radius, ${theme.base['border-radius']});
52
147
  }
53
148
  `}
54
149
  ${hasScrollBar &&
55
150
  css `
56
- :last-child {
57
- border-top-right-radius: var(--border-radius, ${theme.base['border-radius']});
151
+ &:last-child {
152
+ border-start-end-radius: var(--border-radius, ${theme.base['border-radius']});
58
153
  }
59
154
  `}
60
155
  }
@@ -70,6 +165,9 @@ export const StyledTabs = styled.div(({ theme, hasScrollBar, level }) => {
70
165
  100% - ${theme.base['hit-area']['mouse-min']} -
71
166
  ${level > 1 ? '0px' : `calc(0.5 * ${theme.base.spacing}) - 0.0625rem `}
72
167
  );
168
+ border-block-end: ${theme.components.tabs.detached
169
+ ? 'none'
170
+ : `0.0625rem solid ${theme.base.palette['border-line']}`};
73
171
 
74
172
  @media (pointer: coarse) {
75
173
  max-width: calc(
@@ -79,9 +177,6 @@ export const StyledTabs = styled.div(({ theme, hasScrollBar, level }) => {
79
177
  }
80
178
 
81
179
  ${StyledTab} {
82
- border-block-end: ${theme.components.tabs.detached
83
- ? 'none'
84
- : `0.0625rem solid ${theme.base.palette['border-line']}`};
85
180
  height: calc(${theme.base['hit-area']['mouse-min']} + 0.0625rem);
86
181
 
87
182
  @media (pointer: coarse) {
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.styles.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAClD,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;wBACI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;IAChD,CAAC,CAAC,MAAM;IACR,CAAC,CAAC,mBAAmB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;yBACrC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;IACjD,CAAC,CAAC,MAAM;IACR,CAAC,CAAC,mBAAmB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;mBAC3C,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC;;MAEhD,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;IAChC,GAAG,CAAA;;KAEF;;;qBAGgB,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC;;GAEtD,CACF,CAAC;AAEF,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAGjC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,EAAE;IACpC,OA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CAAC;gCAClC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;wDACT,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;sDAC7B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;;;QAGzE,UAAU;;;;QAIV,0BAA0B;;;KAG7B;GACF,CACF,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CACxC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;;wBAIT,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;GACpF,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport Icon from '../Icon';\nimport MenuButton from '../MenuButton';\nimport { defaultThemeProp } from '../../theme';\n\nimport { StyledTab } from './Tab';\n\nexport const StylesAllTabsButtonWrapper = styled.div(\n ({ theme }) => css`\n border-block-end: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n border-inline-end: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n height: calc(${theme.base['hit-area']['mouse-min']} + 0.0625rem);\n\n ${theme.components.tabs.detached &&\n css`\n padding: 0;\n `};\n\n @media (pointer: coarse) {\n height: calc(${theme.base['hit-area']['finger-min']} + 0.0625rem);\n }\n `\n);\n\nStylesAllTabsButtonWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledTabs = styled.div<{\n hasScrollBar: boolean;\n level: number;\n}>(({ theme, hasScrollBar, level }) => {\n return css`\n position: relative;\n\n ${theme.components.tabs.detached &&\n css`\n ${StyledTab} + ${StyledTab} {\n margin-inline-start: calc(2 * ${theme.base.spacing});\n }\n\n &[aria-orientation='horizontal'] {\n background-color: ${theme.base.palette['secondary-background']};\n border-radius: var(--border-radius, ${theme.base['border-radius']});\n border-end-end-radius: 0;\n border-end-start-radius: 0;\n\n > ${StyledTab} {\n background-color: ${theme.base.palette['secondary-background']};\n\n &[aria-selected='true'] {\n background-color: ${theme.base.palette['primary-background']};\n }\n\n ${!hasScrollBar &&\n css`\n :first-child {\n border-top-left-radius: var(--border-radius, ${theme.base['border-radius']});\n }\n `}\n ${hasScrollBar &&\n css`\n :last-child {\n border-top-right-radius: var(--border-radius, ${theme.base['border-radius']});\n }\n `}\n }\n }\n `}\n &[aria-orientation='horizontal'] {\n height: max-content;\n overflow: auto;\n\n ${hasScrollBar\n ? css`\n max-width: calc(\n 100% - ${theme.base['hit-area']['mouse-min']} -\n ${level > 1 ? '0px' : `calc(0.5 * ${theme.base.spacing}) - 0.0625rem `}\n );\n\n @media (pointer: coarse) {\n max-width: calc(\n 100% - ${theme.base['hit-area']['finger-min']} -\n ${level > 1 ? '0px' : `calc(0.5 * ${theme.base.spacing}) - 0.0625rem `}\n );\n }\n\n ${StyledTab} {\n border-block-end: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n height: calc(${theme.base['hit-area']['mouse-min']} + 0.0625rem);\n\n @media (pointer: coarse) {\n height: calc(${theme.base['hit-area']['finger-min']} + 0.0625rem);\n }\n\n &:disabled {\n opacity: 1;\n\n > * {\n opacity: ${theme.base['disabled-opacity']};\n }\n }\n }\n `\n : css`\n border-block-end: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n ${level > 1 &&\n css`\n background-color: ${theme.base.palette['secondary-background']};\n border: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n border-block-end: none;\n border-radius: 0;\n border-start-start-radius: ${theme.components.tabs.detached\n ? `var(--border-radius, ${theme.base['border-radius']})`\n : 'calc(0.5rem * 0.5)'};\n border-start-end-radius: ${theme.components.tabs.detached\n ? `var(--border-radius, ${theme.base['border-radius']})`\n : 'calc(0.5rem * 0.5)'};\n `}\n `}\n ${theme.components.tabs.detached &&\n css`\n padding-block: 0;\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-block-end: none;\n\n ${StylesAllTabsButtonWrapper} + & {\n padding-inline-start: calc(0.25 * ${theme.base.spacing});\n }\n\n ${StyledTab} + ${StyledTab} {\n margin-inline-start: 0;\n }\n\n ${hasScrollBar &&\n css`\n border: none;\n border-inline-start: none;\n max-width: calc(100% - ${theme.base['hit-area']['mouse-min']});\n\n @media (pointer: coarse) {\n max-width: calc(100% - ${theme.base['hit-area']['finger-min']});\n }\n `}\n `}\n }\n\n &:has(:focus-visible) {\n &[aria-orientation='vertical'] {\n box-shadow: ${theme.base.shadow['focus-group-inset']};\n }\n\n &[aria-orientation='horizontal'] {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n }\n `;\n});\n\nStyledTabs.defaultProps = defaultThemeProp;\n\nexport const StyledAllTabsButton = styled(MenuButton)`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n`;\n\nStyledAllTabsButton.defaultProps = defaultThemeProp;\n\nexport const StyledErrorIcon = styled(Icon)(\n ({ theme }) => css`\n color: ${theme.base.palette.urgent};\n `\n);\n\nStyledErrorIcon.defaultProps = defaultThemeProp;\n\nexport const StyledAllTabsWrapper = styled.div<{\n level: number;\n}>(\n ({ theme, level }) => css`\n ${level > 1 &&\n css`\n background-color: ${theme.base.palette['secondary-background']};\n border-start-start-radius: var(--border-radius, ${theme.base['border-radius']});\n border-start-end-radius: var(--border-radius, ${theme.base['border-radius']});\n\n ${!theme.components.tabs.detached &&\n css`\n border-inline: 0.0625rem solid ${theme.base.palette['border-line']};\n border-block-start: 0.0625rem solid ${theme.base.palette['border-line']};\n `}\n ${StylesAllTabsButtonWrapper}, ${StyledTab} {\n border-block-end: none;\n border-inline-end: none;\n }\n `}\n ${theme.components.tabs.detached &&\n css`\n background-color: ${theme.base.palette['primary-background']};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-start-start-radius: var(--border-radius, ${theme.base['border-radius']});\n border-start-end-radius: var(--border-radius, ${theme.base['border-radius']});\n border-block-end: none;\n\n ${StyledTabs}[aria-orientation='horizontal'] {\n border-start-start-radius: 0;\n }\n\n ${StylesAllTabsButtonWrapper} {\n border-radius: 0;\n }\n `}\n `\n);\n\nStyledAllTabsWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledSeparator = styled.span<{ transparent: boolean }>(\n ({ theme, transparent }) => css`\n align-self: center;\n height: 1em;\n min-width: 0.0625rem;\n background-color: ${transparent ? 'transparent' : theme.base.palette['border-line']};\n `\n);\n\nStyledSeparator.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"Tabs.styles.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAClD,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;wBACI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;IAChD,CAAC,CAAC,MAAM;IACR,CAAC,CAAC,mBAAmB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;yBACrC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;IACjD,CAAC,CAAC,MAAM;IACR,CAAC,CAAC,mBAAmB,KAAK,CAAC,IA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AE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;MACrB,KAAK,GAAG,CAAC;IACX,GAAG,CAAA;0BACmB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC;wDACZ,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;sDAC7B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;;QAEzE,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;QACjC,GAAG,CAAA;yCACgC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;8CAC5B,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;OACxE;QACC,0BAA0B,KAAK,SAAS;;;;KAI3C;MACC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ;IAChC,GAAG,CAAA;0BACmB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;gCAClC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;wDACT,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;sDAC7B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC;;;QAGzE,UAAU;;;;QAIV,0BAA0B;;;KAG7B;GACF,CACF,CAAC;AAEF,oBAAoB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CACxC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;;;wBAIT,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;GACpF,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { transparentize } from 'polished';\n\nimport Icon from '../Icon';\nimport MenuButton from '../MenuButton';\nimport { defaultThemeProp } from '../../theme';\n\nimport { StyledTab } from './Tab';\n\nexport const StylesAllTabsButtonWrapper = styled.div(\n ({ theme }) => css`\n border-block-end: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n border-inline-end: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n height: calc(${theme.base['hit-area']['mouse-min']} + 0.0625rem);\n\n ${theme.components.tabs.detached &&\n css`\n padding: 0;\n `};\n\n @media (pointer: coarse) {\n height: calc(${theme.base['hit-area']['finger-min']} + 0.0625rem);\n }\n `\n);\n\nStylesAllTabsButtonWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledTabs = styled.div<{\n hasScrollBar: boolean;\n level: number;\n}>(({ theme, hasScrollBar, level }) => {\n const { detached: tabsDetached } = theme.components.tabs;\n const { spacing } = theme.base;\n const color = theme.components.button.color;\n const secondary = theme.base.palette['secondary-background'];\n const interactive = theme.base.palette.interactive;\n\n const shouldShowBackground = tabsDetached || (level && level > 1);\n\n let verticalBackground = 'transparent';\n if (shouldShowBackground) {\n verticalBackground = tabsDetached ? secondary : transparentize(0.75, interactive);\n }\n\n const horizontalBackground = shouldShowBackground\n ? theme.base.palette['primary-background']\n : 'transparent';\n\n const indicatorTransition = css`\n transition-property: transform, width, height;\n transition-duration: max(${theme.base.animation.speed}, 1ms);\n transition-timing-function: ${theme.base.animation.timing.ease};\n `;\n\n return css`\n position: relative;\n\n &::before {\n content: '';\n position: absolute;\n ${indicatorTransition};\n pointer-events: none;\n z-index: 0;\n }\n\n &::after {\n content: '';\n position: absolute;\n ${indicatorTransition};\n pointer-events: none;\n z-index: 2;\n }\n\n &[aria-orientation='horizontal']::before {\n inset-block-start: 0;\n inset-block-end: 0;\n inset-inline-start: 0;\n width: var(--indicator-width);\n transform: translateX(var(--indicator-left));\n background: ${horizontalBackground};\n }\n\n &[aria-orientation='horizontal']::after {\n inset-block-end: 0;\n inset-inline-start: calc(1.5 * ${spacing});\n width: calc(var(--indicator-width) - 3 * ${spacing});\n height: 0.125rem;\n background: ${color};\n transform: translateX(var(--indicator-left));\n }\n\n &[aria-orientation='vertical']::before {\n inset-block-start: 0;\n height: var(--indicator-height);\n transform: translateY(var(--indicator-top));\n background: ${verticalBackground};\n\n ${!tabsDetached &&\n css`\n inset-inline-start: 0;\n width: 100%;\n `}\n\n ${tabsDetached &&\n css`\n inset-inline-start: calc(2 * ${spacing});\n inset-inline-end: calc(2 * ${spacing});\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n `}\n }\n\n &[aria-orientation='vertical']::after {\n width: 0.25rem;\n background: ${interactive};\n transform: translateY(var(--indicator-top));\n\n ${!tabsDetached &&\n css`\n inset-block-start: 0;\n height: var(--indicator-height);\n inset-inline-end: 0;\n `}\n\n ${tabsDetached &&\n css`\n inset-block-start: 0.0625rem;\n height: calc(var(--indicator-height) - 0.125rem);\n inset-inline-start: calc(2 * ${spacing});\n `}\n }\n\n ${theme.components.tabs.detached &&\n css`\n ${StyledTab} + ${StyledTab} {\n margin-inline-start: calc(2 * ${theme.base.spacing});\n }\n\n &[aria-orientation='horizontal'] {\n background-color: ${theme.base.palette['secondary-background']};\n border-radius: var(--border-radius, ${theme.base['border-radius']});\n border-end-end-radius: 0;\n border-end-start-radius: 0;\n\n > ${StyledTab} {\n background-color: ${theme.base.palette['secondary-background']};\n\n &[aria-selected='true'] {\n background-color: ${theme.base.palette['primary-background']};\n }\n\n ${!hasScrollBar &&\n css`\n &:first-child {\n border-start-start-radius: var(--border-radius, ${theme.base['border-radius']});\n }\n `}\n ${hasScrollBar &&\n css`\n &:last-child {\n border-start-end-radius: var(--border-radius, ${theme.base['border-radius']});\n }\n `}\n }\n }\n `}\n &[aria-orientation='horizontal'] {\n height: max-content;\n overflow: auto;\n\n ${hasScrollBar\n ? css`\n max-width: calc(\n 100% - ${theme.base['hit-area']['mouse-min']} -\n ${level > 1 ? '0px' : `calc(0.5 * ${theme.base.spacing}) - 0.0625rem `}\n );\n border-block-end: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n\n @media (pointer: coarse) {\n max-width: calc(\n 100% - ${theme.base['hit-area']['finger-min']} -\n ${level > 1 ? '0px' : `calc(0.5 * ${theme.base.spacing}) - 0.0625rem `}\n );\n }\n\n ${StyledTab} {\n height: calc(${theme.base['hit-area']['mouse-min']} + 0.0625rem);\n\n @media (pointer: coarse) {\n height: calc(${theme.base['hit-area']['finger-min']} + 0.0625rem);\n }\n\n &:disabled {\n opacity: 1;\n\n > * {\n opacity: ${theme.base['disabled-opacity']};\n }\n }\n }\n `\n : css`\n border-block-end: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n ${level > 1 &&\n css`\n background-color: ${theme.base.palette['secondary-background']};\n border: ${theme.components.tabs.detached\n ? 'none'\n : `0.0625rem solid ${theme.base.palette['border-line']}`};\n border-block-end: none;\n border-radius: 0;\n border-start-start-radius: ${theme.components.tabs.detached\n ? `var(--border-radius, ${theme.base['border-radius']})`\n : 'calc(0.5rem * 0.5)'};\n border-start-end-radius: ${theme.components.tabs.detached\n ? `var(--border-radius, ${theme.base['border-radius']})`\n : 'calc(0.5rem * 0.5)'};\n `}\n `}\n ${theme.components.tabs.detached &&\n css`\n padding-block: 0;\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-block-end: none;\n\n ${StylesAllTabsButtonWrapper} + & {\n padding-inline-start: calc(0.25 * ${theme.base.spacing});\n }\n\n ${StyledTab} + ${StyledTab} {\n margin-inline-start: 0;\n }\n\n ${hasScrollBar &&\n css`\n border: none;\n border-inline-start: none;\n max-width: calc(100% - ${theme.base['hit-area']['mouse-min']});\n\n @media (pointer: coarse) {\n max-width: calc(100% - ${theme.base['hit-area']['finger-min']});\n }\n `}\n `}\n }\n\n &:has(:focus-visible) {\n &[aria-orientation='vertical'] {\n box-shadow: ${theme.base.shadow['focus-group-inset']};\n }\n\n &[aria-orientation='horizontal'] {\n box-shadow: ${theme.base.shadow['focus-group']};\n }\n }\n `;\n});\n\nStyledTabs.defaultProps = defaultThemeProp;\n\nexport const StyledAllTabsButton = styled(MenuButton)`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n`;\n\nStyledAllTabsButton.defaultProps = defaultThemeProp;\n\nexport const StyledErrorIcon = styled(Icon)(\n ({ theme }) => css`\n color: ${theme.base.palette.urgent};\n `\n);\n\nStyledErrorIcon.defaultProps = defaultThemeProp;\n\nexport const StyledAllTabsWrapper = styled.div<{\n level: number;\n}>(\n ({ theme, level }) => css`\n ${level > 1 &&\n css`\n background-color: ${theme.base.palette['secondary-background']};\n border-start-start-radius: var(--border-radius, ${theme.base['border-radius']});\n border-start-end-radius: var(--border-radius, ${theme.base['border-radius']});\n\n ${!theme.components.tabs.detached &&\n css`\n border-inline: 0.0625rem solid ${theme.base.palette['border-line']};\n border-block-start: 0.0625rem solid ${theme.base.palette['border-line']};\n `}\n ${StylesAllTabsButtonWrapper}, ${StyledTab} {\n border-block-end: none;\n border-inline-end: none;\n }\n `}\n ${theme.components.tabs.detached &&\n css`\n background-color: ${theme.base.palette['primary-background']};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-start-start-radius: var(--border-radius, ${theme.base['border-radius']});\n border-start-end-radius: var(--border-radius, ${theme.base['border-radius']});\n border-block-end: none;\n\n ${StyledTabs}[aria-orientation='horizontal'] {\n border-start-start-radius: 0;\n }\n\n ${StylesAllTabsButtonWrapper} {\n border-radius: 0;\n }\n `}\n `\n);\n\nStyledAllTabsWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledSeparator = styled.span<{ transparent: boolean }>(\n ({ theme, transparent }) => css`\n align-self: center;\n height: 1em;\n min-width: 0.0625rem;\n background-color: ${transparent ? 'transparent' : theme.base.palette['border-line']};\n `\n);\n\nStyledSeparator.defaultProps = defaultThemeProp;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-core",
3
- "version": "9.0.0-build.21.3",
3
+ "version": "9.0.0-build.21.4",
4
4
  "description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Pegasystems",