@razorpay/blade 12.110.0 → 12.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/native/components/AnimateInteractions/AnimateInteractions.native.js +5 -5
- package/build/lib/native/components/AnimateInteractions/AnimateInteractions.native.js.map +1 -1
- package/build/lib/native/components/AnimateInteractions/AnimateInteractionsProvider.js +6 -0
- package/build/lib/native/components/AnimateInteractions/AnimateInteractionsProvider.js.map +1 -0
- package/build/lib/native/components/BaseMotion/BaseMotion.native.js +22 -0
- package/build/lib/native/components/BaseMotion/BaseMotion.native.js.map +1 -0
- package/build/lib/native/components/BaseMotion/baseMotionInterpreter.native.js +11 -0
- package/build/lib/native/components/BaseMotion/baseMotionInterpreter.native.js.map +1 -0
- package/build/lib/native/components/BaseMotion/baseMotionUtils.js +4 -0
- package/build/lib/native/components/BaseMotion/baseMotionUtils.js.map +1 -0
- package/build/lib/native/components/BaseMotion/index.js +3 -0
- package/build/lib/native/components/BaseMotion/index.js.map +1 -0
- package/build/lib/native/components/BaseMotion/types.js +2 -0
- package/build/lib/native/components/BaseMotion/types.js.map +1 -0
- package/build/lib/native/components/Dropdown/FilterChipSelectInput.native.js +2 -1
- package/build/lib/native/components/Dropdown/FilterChipSelectInput.native.js.map +1 -1
- package/build/lib/native/components/Dropdown/filterChipSelectInputUtils.js +4 -0
- package/build/lib/native/components/Dropdown/filterChipSelectInputUtils.js.map +1 -0
- package/build/lib/native/components/Fade/Fade.native.js +7 -5
- package/build/lib/native/components/Fade/Fade.native.js.map +1 -1
- package/build/lib/native/components/FilterChip/BaseFilterChip.native.js +2 -2
- package/build/lib/native/components/FilterChip/BaseFilterChip.native.js.map +1 -1
- package/build/lib/native/components/Morph/Morph.native.js +9 -5
- package/build/lib/native/components/Morph/Morph.native.js.map +1 -1
- package/build/lib/native/components/Move/Move.native.js +8 -5
- package/build/lib/native/components/Move/Move.native.js.map +1 -1
- package/build/lib/native/components/Scale/Scale.native.js +7 -5
- package/build/lib/native/components/Scale/Scale.native.js.map +1 -1
- package/build/lib/native/components/SegmentedControl/SegmentedControl.native.js +27 -0
- package/build/lib/native/components/SegmentedControl/SegmentedControl.native.js.map +1 -0
- package/build/lib/native/components/SegmentedControl/SegmentedControlContext.js +8 -0
- package/build/lib/native/components/SegmentedControl/SegmentedControlContext.js.map +1 -0
- package/build/lib/native/components/SegmentedControl/SegmentedControlItem.native.js +18 -0
- package/build/lib/native/components/SegmentedControl/SegmentedControlItem.native.js.map +1 -0
- package/build/lib/native/components/SegmentedControl/index.js +3 -0
- package/build/lib/native/components/SegmentedControl/index.js.map +1 -0
- package/build/lib/native/components/SegmentedControl/segmentedControlTokens.js +4 -0
- package/build/lib/native/components/SegmentedControl/segmentedControlTokens.js.map +1 -0
- package/build/lib/native/components/Slide/Slide.native.js +7 -5
- package/build/lib/native/components/Slide/Slide.native.js.map +1 -1
- package/build/lib/native/components/Stagger/Stagger.native.js +10 -5
- package/build/lib/native/components/Stagger/Stagger.native.js.map +1 -1
- package/build/lib/native/components/Stagger/StaggerProvider.js +6 -0
- package/build/lib/native/components/Stagger/StaggerProvider.js.map +1 -0
- package/build/lib/native/components/index.js +3 -0
- package/build/lib/native/components/index.js.map +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js +1 -1
- package/build/lib/native/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/native/utils/msToSeconds.js +4 -0
- package/build/lib/native/utils/msToSeconds.js.map +1 -0
- package/build/lib/web/development/_virtual/flatten.js +1 -1
- package/build/lib/web/development/_virtual/flatten3.js +1 -1
- package/build/lib/web/development/components/AnimateInteractions/AnimateInteractions.web.js +1 -1
- package/build/lib/web/development/components/AnimateInteractions/AnimateInteractionsProvider.js +2 -1
- package/build/lib/web/development/components/AnimateInteractions/AnimateInteractionsProvider.js.map +1 -1
- package/build/lib/web/development/components/AnimateInteractions/{useFocusWithin.js → useFocusWithin.web.js} +1 -1
- package/build/lib/web/development/components/AnimateInteractions/useFocusWithin.web.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +8 -1
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js +4 -1
- package/build/lib/web/development/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js +40 -5
- package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js +11 -21
- package/build/lib/web/development/components/Dropdown/FilterChipSelectInput.web.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/filterChipSelectInputUtils.js +46 -0
- package/build/lib/web/development/components/Dropdown/filterChipSelectInputUtils.js.map +1 -0
- package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js +35 -11
- package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js.map +1 -1
- package/build/lib/web/development/components/SegmentedControl/SegmentedControl.web.js +196 -0
- package/build/lib/web/development/components/SegmentedControl/SegmentedControl.web.js.map +1 -0
- package/build/lib/web/development/components/SegmentedControl/SegmentedControlContext.js +18 -0
- package/build/lib/web/development/components/SegmentedControl/SegmentedControlContext.js.map +1 -0
- package/build/lib/web/development/components/SegmentedControl/SegmentedControlIndicator.web.js +109 -0
- package/build/lib/web/development/components/SegmentedControl/SegmentedControlIndicator.web.js.map +1 -0
- package/build/lib/web/development/components/SegmentedControl/SegmentedControlItem.web.js +170 -0
- package/build/lib/web/development/components/SegmentedControl/SegmentedControlItem.web.js.map +1 -0
- package/build/lib/web/development/components/SegmentedControl/index.js +3 -0
- package/build/lib/web/development/components/SegmentedControl/index.js.map +1 -0
- package/build/lib/web/development/components/SegmentedControl/segmentedControlTokens.js +53 -0
- package/build/lib/web/development/components/SegmentedControl/segmentedControlTokens.js.map +1 -0
- package/build/lib/web/development/components/Stagger/StaggerProvider.js.map +1 -1
- package/build/lib/web/development/components/index.js +3 -0
- package/build/lib/web/development/components/index.js.map +1 -1
- package/build/lib/web/development/node_modules/es-toolkit/dist/array/flatten.js +1 -1
- package/build/lib/web/development/node_modules/es-toolkit/dist/compat/array/flatten.js +1 -1
- package/build/lib/web/development/node_modules/es-toolkit/dist/compat/array/sortBy.js +2 -2
- package/build/lib/web/development/node_modules/es-toolkit/dist/compat/object/omit.js +2 -2
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js +3 -1
- package/build/lib/web/development/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/lib/web/production/components/AnimateInteractions/AnimateInteractions.web.js +1 -1
- package/build/lib/web/production/components/AnimateInteractions/AnimateInteractionsProvider.js +2 -1
- package/build/lib/web/production/components/AnimateInteractions/AnimateInteractionsProvider.js.map +1 -1
- package/build/lib/web/production/components/AnimateInteractions/{useFocusWithin.js → useFocusWithin.web.js} +1 -1
- package/build/lib/web/production/components/AnimateInteractions/useFocusWithin.web.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +8 -1
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js +4 -1
- package/build/lib/web/production/components/DatePicker/FilterChipDatePicker/DatePickerFilterChip.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js +40 -5
- package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js +11 -21
- package/build/lib/web/production/components/Dropdown/FilterChipSelectInput.web.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/filterChipSelectInputUtils.js +46 -0
- package/build/lib/web/production/components/Dropdown/filterChipSelectInputUtils.js.map +1 -0
- package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js +35 -11
- package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js.map +1 -1
- package/build/lib/web/production/components/SegmentedControl/SegmentedControl.web.js +196 -0
- package/build/lib/web/production/components/SegmentedControl/SegmentedControl.web.js.map +1 -0
- package/build/lib/web/production/components/SegmentedControl/SegmentedControlContext.js +18 -0
- package/build/lib/web/production/components/SegmentedControl/SegmentedControlContext.js.map +1 -0
- package/build/lib/web/production/components/SegmentedControl/SegmentedControlIndicator.web.js +109 -0
- package/build/lib/web/production/components/SegmentedControl/SegmentedControlIndicator.web.js.map +1 -0
- package/build/lib/web/production/components/SegmentedControl/SegmentedControlItem.web.js +170 -0
- package/build/lib/web/production/components/SegmentedControl/SegmentedControlItem.web.js.map +1 -0
- package/build/lib/web/production/components/SegmentedControl/index.js +3 -0
- package/build/lib/web/production/components/SegmentedControl/index.js.map +1 -0
- package/build/lib/web/production/components/SegmentedControl/segmentedControlTokens.js +53 -0
- package/build/lib/web/production/components/SegmentedControl/segmentedControlTokens.js.map +1 -0
- package/build/lib/web/production/components/Stagger/StaggerProvider.js.map +1 -1
- package/build/lib/web/production/components/index.js +3 -0
- package/build/lib/web/production/components/index.js.map +1 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js +3 -1
- package/build/lib/web/production/utils/metaAttribute/metaConstants.js.map +1 -1
- package/build/types/components/index.d.ts +238 -8
- package/build/types/components/index.native.d.ts +410 -14
- package/package.json +1 -1
- package/build/lib/web/development/components/AnimateInteractions/useFocusWithin.js.map +0 -1
- package/build/lib/web/production/components/AnimateInteractions/useFocusWithin.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseFilterChip.web.js","sources":["../../../../../../src/components/FilterChip/BaseFilterChip.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { CSSObject } from 'styled-components';\nimport styled from 'styled-components';\nimport { FILTER_CHIP_HEIGHT } from './tokens';\nimport type { BaseFilterChipProps } from './types';\nimport { makeBorderSize, makeSpace } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { BladeElementRef } from '~utils/types';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { Box } from '~components/Box';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Counter } from '~components/Counter';\nimport { Divider } from '~components/Divider';\nimport { ChevronDownIcon, CloseIcon } from '~components/Icons';\nimport { Text } from '~components/Typography';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\nconst getInteractiveFilterItemStyles = ({ theme }: { theme: Theme }): CSSObject => {\n return {\n display: 'flex',\n height: '100%',\n alignItems: 'center',\n border: 'none',\n cursor: 'pointer',\n color: 'currentcolor',\n '&:not([disabled]):hover': {\n backgroundColor: theme.colors.interactive.background.gray.faded,\n },\n '&[disabled]': {\n cursor: 'not-allowed',\n },\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n outlineOffset: makeSpace(theme.spacing[1]),\n },\n };\n};\n\nconst StyledFilterChip = styled(BaseBox)<{ $isSelected?: boolean; $isDisabled?: boolean }>(\n ({ theme, $isDisabled, $isSelected }) => {\n return {\n borderWidth: makeBorderSize(theme.border.width.thin),\n borderColor: theme.colors.interactive.border.gray[$isDisabled ? 'disabled' : 'faded'],\n height: FILTER_CHIP_HEIGHT,\n borderRadius: theme.border.radius.small,\n display: 'flex',\n borderStyle: $isSelected ? 'solid' : 'dashed',\n backgroundColor: theme.colors.surface.background.gray.intense,\n color: theme.colors.interactive.text.gray[$isDisabled ? 'disabled' : 'muted'],\n width: 'fit-content',\n };\n },\n);\n\nconst StyledFilterTrigger = styled.button<{ $isSelected?: boolean }>(({ theme, $isSelected }) => {\n const { spacing } = theme;\n return {\n backgroundColor: theme.colors.transparent,\n borderRadius: $isSelected ? theme.border.radius.none : theme.border.radius.small,\n borderTopLeftRadius: theme.border.radius.small,\n borderBottomLeftRadius: theme.border.radius.small,\n paddingLeft: makeSpace(spacing[4]),\n paddingRight: $isSelected ? makeSpace(spacing[2]) : makeSpace(spacing[3]),\n gap: makeSpace(spacing[2]),\n ...getInteractiveFilterItemStyles({ theme }),\n };\n});\n\nconst StyledFilterCloseButton = styled.button(({ theme }) => {\n return {\n backgroundColor: theme.colors.transparent,\n borderTopRightRadius: theme.border.radius.small,\n borderBottomRightRadius: theme.border.radius.small,\n paddingLeft: makeSpace(theme.spacing[2] + theme.spacing[1]),\n paddingRight: makeSpace(theme.spacing[2] + theme.spacing[1]),\n justifyContent: 'center',\n alignItems: 'center',\n ...getInteractiveFilterItemStyles({ theme }),\n };\n});\n\nconst renderValue = (\n selectionType: BaseFilterChipProps['selectionType'],\n value: BaseFilterChipProps['value'],\n isDisabled?: boolean,\n): React.ReactElement => {\n if (selectionType === 'multiple' && Array.isArray(value)) {\n return (\n <Box display=\"flex\" alignItems=\"center\">\n <Counter value={value.length} color=\"neutral\" size=\"small\" />\n </Box>\n );\n }\n\n return (\n <Text\n as=\"span\"\n size=\"small\"\n weight=\"medium\"\n color={isDisabled ? 'interactive.text.gray.disabled' : 'interactive.text.gray.normal'}\n >\n {value}\n </Text>\n );\n};\n\nconst _BaseFilterChip: React.ForwardRefRenderFunction<BladeElementRef, BaseFilterChipProps> = (\n {\n value,\n onClearButtonClick,\n label,\n isDisabled,\n selectionType = 'single',\n onClick,\n onKeyDown,\n accessibilityProps,\n id,\n ...rest\n }: BaseFilterChipProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const isSelected =\n selectionType === 'multiple' ? Array.isArray(value) && value.length > 0 : !!value;\n\n return (\n <StyledFilterChip\n $isDisabled={isDisabled}\n $isSelected={isSelected}\n ref={ref as React.Ref<HTMLDivElement>}\n >\n <StyledFilterTrigger\n $isSelected={isSelected}\n disabled={isDisabled}\n id={id}\n onClick={(e) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClick?.(e as any);\n }}\n onKeyDown={(e) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onKeyDown?.(e as any);\n }}\n {...makeAccessible({\n ...accessibilityProps,\n role: accessibilityProps?.role ?? 'button',\n })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n {...metaAttribute({ name: 'filter-chip-trigger', testID: rest.testID })}\n >\n <Box display=\"flex\" gap=\"spacing.2\" whiteSpace=\"nowrap\" alignItems=\"center\">\n <Text\n size=\"small\"\n weight=\"medium\"\n color=\"interactive.text.gray.subtle\"\n truncateAfterLines={1}\n >\n {label}\n {isSelected ? ':' : null}\n </Text>\n {isSelected ? renderValue(selectionType, value, isDisabled) : null}\n </Box>\n <Box display=\"flex\" alignItems=\"center\" paddingRight=\"spacing.1\">\n <ChevronDownIcon size=\"small\" color=\"interactive.icon.gray.muted\" />\n </Box>\n </StyledFilterTrigger>\n {isSelected ? (\n <>\n <Divider orientation=\"vertical\" variant={isDisabled ? 'muted' : 'subtle'} />\n <StyledFilterCloseButton\n aria-label={`Clear ${label} value`}\n // value can never be undefined because when it's undefined the button itself doesn't render/\n onClick={() => onClearButtonClick?.({ value: value ?? '' })}\n disabled={isDisabled}\n {...metaAttribute({ name: 'filter-chip-close-button' })}\n >\n <CloseIcon size=\"small\" color=\"interactive.icon.gray.muted\" />\n </StyledFilterCloseButton>\n </>\n ) : null}\n </StyledFilterChip>\n );\n};\n\nconst BaseFilterChip = assignWithoutSideEffects(React.forwardRef(_BaseFilterChip), {\n componentId: MetaConstants.BaseFilterChip,\n});\n\nexport { BaseFilterChip };\n"],"names":["getInteractiveFilterItemStyles","_ref","theme","display","height","alignItems","border","cursor","color","backgroundColor","colors","interactive","background","gray","faded","_objectSpread","getFocusRingStyles","outlineOffset","makeSpace","spacing","StyledFilterChip","styled","BaseBox","withConfig","displayName","componentId","_ref2","$isDisabled","$isSelected","borderWidth","makeBorderSize","width","thin","borderColor","FILTER_CHIP_HEIGHT","borderRadius","radius","small","borderStyle","surface","intense","text","StyledFilterTrigger","button","_ref3","transparent","none","borderTopLeftRadius","borderBottomLeftRadius","paddingLeft","paddingRight","gap","StyledFilterCloseButton","_ref4","borderTopRightRadius","borderBottomRightRadius","justifyContent","renderValue","selectionType","value","isDisabled","Array","isArray","_jsx","Box","children","Counter","length","size","Text","as","weight","_BaseFilterChip","_ref5","ref","_accessibilityProps$r","onClearButtonClick","label","_ref5$selectionType","onClick","onKeyDown","accessibilityProps","id","rest","_objectWithoutProperties","_excluded","isSelected","_jsxs","disabled","e","makeAccessible","role","getStyledProps","makeAnalyticsAttribute","metaAttribute","name","testID","whiteSpace","truncateAfterLines","ChevronDownIcon","_Fragment","Divider","orientation","variant","concat","CloseIcon","BaseFilterChip","assignWithoutSideEffects","React","forwardRef","MetaConstants"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAMA,8BAA8B,GAAG,SAAjCA,8BAA8BA,CAAAC,IAAA,EAA+C;AAAA,EAAA,IAAzCC,KAAK,GAAAD,IAAA,CAALC,KAAK,CAAA;EAC7C,OAAO;AACLC,IAAAA,OAAO,EAAE,MAAM;AACfC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,UAAU,EAAE,QAAQ;AACpBC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,MAAM,EAAE,SAAS;AACjBC,IAAAA,KAAK,EAAE,cAAc;AACrB,IAAA,yBAAyB,EAAE;MACzBC,eAAe,EAAEP,KAAK,CAACQ,MAAM,CAACC,WAAW,CAACC,UAAU,CAACC,IAAI,CAACC,KAAAA;KAC3D;AACD,IAAA,aAAa,EAAE;AACbP,MAAAA,MAAM,EAAE,aAAA;KACT;AACD,IAAA,iBAAiB,EAAAQ,aAAA,CAAAA,aAAA,CAAA,EAAA,EACZC,kBAAkB,CAAC;AAAEd,MAAAA,KAAK,EAALA,KAAAA;AAAM,KAAC,CAAC,CAAA,EAAA,EAAA,EAAA;MAChCe,aAAa,EAAEC,SAAS,CAAChB,KAAK,CAACiB,OAAO,CA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AAA,IAALA,KAAK,KAAA,KAAA,CAAA,GAALA,KAAK,GAAI,EAAA;AAAG,WAAC,CAAC,CAAA;SAAC;AAC5D6B,QAAAA,QAAQ,EAAE5B,UAAAA;AAAW,OAAA,EACjBkC,aAAa,CAAC;AAAEC,QAAAA,IAAI,EAAE,0BAAA;AAA2B,OAAC,CAAC,CAAA,EAAA,EAAA,EAAA;QAAA9B,QAAA,eAEvDF,GAAA,CAAC0C,SAAS,EAAA;AAACrC,UAAAA,IAAI,EAAC,OAAO;AAAC5D,UAAAA,KAAK,EAAC,6BAAA;SAA+B,CAAA;AAAC,OAAA,CACvC,CAAC,CAAA;KAC1B,CAAC,GACD,IAAI,CAAA;AAAA,GACQ,CAAC,CAAA;AAEvB,CAAC,CAAA;AAEKkG,IAAAA,cAAc,gBAAGC,wBAAwB,cAACC,cAAK,CAACC,UAAU,CAACrC,eAAe,CAAC,EAAE;EACjF/C,WAAW,EAAEqF,aAAa,CAACJ,cAAAA;AAC7B,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"BaseFilterChip.web.js","sources":["../../../../../../src/components/FilterChip/BaseFilterChip.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { CSSObject } from 'styled-components';\nimport styled from 'styled-components';\nimport { FILTER_CHIP_HEIGHT } from './tokens';\nimport type { BaseFilterChipProps } from './types';\nimport { makeBorderSize, makeSpace } from '~utils';\nimport type { Theme } from '~components/BladeProvider';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport type { BladeElementRef } from '~utils/types';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { Box } from '~components/Box';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Counter } from '~components/Counter';\nimport { Divider } from '~components/Divider';\nimport { ChevronDownIcon, CloseIcon } from '~components/Icons';\nimport { Text } from '~components/Typography';\nimport { getFocusRingStyles } from '~utils/getFocusRingStyles';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\nconst getInteractiveFilterItemStyles = ({ theme }: { theme: Theme }): CSSObject => {\n return {\n display: 'flex',\n height: '100%',\n alignItems: 'center',\n border: 'none',\n cursor: 'pointer',\n color: 'currentcolor',\n '&:not([disabled]):hover': {\n backgroundColor: theme.colors.interactive.background.gray.faded,\n },\n '&[disabled]': {\n cursor: 'not-allowed',\n },\n '&:focus-visible': {\n ...getFocusRingStyles({ theme }),\n outlineOffset: makeSpace(theme.spacing[1]),\n },\n };\n};\n\nconst StyledFilterChip = styled(BaseBox)<{ $isSelected?: boolean; $isDisabled?: boolean }>(\n ({ theme, $isDisabled, $isSelected }) => {\n return {\n borderWidth: makeBorderSize(theme.border.width.thin),\n borderColor: theme.colors.interactive.border.gray[$isDisabled ? 'disabled' : 'faded'],\n height: FILTER_CHIP_HEIGHT,\n borderRadius: theme.border.radius.small,\n display: 'flex',\n borderStyle: $isSelected ? 'solid' : 'dashed',\n backgroundColor: theme.colors.surface.background.gray.intense,\n color: theme.colors.interactive.text.gray[$isDisabled ? 'disabled' : 'muted'],\n width: 'fit-content',\n };\n },\n);\n\nconst StyledFilterTrigger = styled.button<{ $hasClearButton?: boolean }>(\n ({ theme, $hasClearButton }) => {\n const { spacing } = theme;\n return {\n backgroundColor: theme.colors.transparent,\n // When a clear button follows the trigger its right corners butt against the divider,\n // so they're squared off. Without a clear button the trigger is a self-contained pill.\n borderRadius: $hasClearButton ? theme.border.radius.none : theme.border.radius.small,\n borderTopLeftRadius: theme.border.radius.small,\n borderBottomLeftRadius: theme.border.radius.small,\n paddingLeft: makeSpace(spacing[4]),\n paddingRight: $hasClearButton ? makeSpace(spacing[2]) : makeSpace(spacing[3]),\n gap: makeSpace(spacing[2]),\n ...getInteractiveFilterItemStyles({ theme }),\n };\n },\n);\n\nconst StyledFilterCloseButton = styled.button(({ theme }) => {\n return {\n backgroundColor: theme.colors.transparent,\n borderTopRightRadius: theme.border.radius.small,\n borderBottomRightRadius: theme.border.radius.small,\n paddingLeft: makeSpace(theme.spacing[2] + theme.spacing[1]),\n paddingRight: makeSpace(theme.spacing[2] + theme.spacing[1]),\n justifyContent: 'center',\n alignItems: 'center',\n ...getInteractiveFilterItemStyles({ theme }),\n };\n});\n\nconst renderValue = (\n selectionType: BaseFilterChipProps['selectionType'],\n value: BaseFilterChipProps['value'],\n isDisabled?: boolean,\n): React.ReactElement => {\n const valueColor = isDisabled ? 'interactive.text.gray.disabled' : 'interactive.text.gray.normal';\n\n // For multiple selection: when a single option is selected we show its name (no redundant\n // \"1\" counter); once more than one is selected we collapse to a compact counter.\n // Use an explicit type guard so a non-array value (e.g. a plain string returned by\n // getFilterChipDisplayValue) never enters the array branch where .length would be\n // misinterpreted as character count.\n if (selectionType === 'multiple') {\n const valueArray = Array.isArray(value) ? value : value != null ? [value] : [];\n if (valueArray.length === 1) {\n return (\n <Text as=\"span\" size=\"small\" weight=\"medium\" color={valueColor} truncateAfterLines={1}>\n {String(valueArray[0] ?? '')}\n </Text>\n );\n }\n return (\n <Box display=\"flex\" alignItems=\"center\">\n <Counter value={valueArray.length} color=\"neutral\" size=\"small\" />\n </Box>\n );\n }\n\n return (\n <Text as=\"span\" size=\"small\" weight=\"medium\" color={valueColor}>\n {value != null ? String(value) : ''}\n </Text>\n );\n};\n\nconst _BaseFilterChip: React.ForwardRefRenderFunction<BladeElementRef, BaseFilterChipProps> = (\n {\n value,\n onClearButtonClick,\n label,\n isDisabled,\n selectionType = 'single',\n showClearButton = true,\n onClick,\n onKeyDown,\n accessibilityProps,\n id,\n ...rest\n }: BaseFilterChipProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const isSelected =\n selectionType === 'multiple' ? Array.isArray(value) && value.length > 0 : !!value;\n const shouldShowClearButton = isSelected && showClearButton;\n\n return (\n <StyledFilterChip\n $isDisabled={isDisabled}\n $isSelected={isSelected}\n ref={ref as React.Ref<HTMLDivElement>}\n >\n <StyledFilterTrigger\n $hasClearButton={shouldShowClearButton}\n disabled={isDisabled}\n id={id}\n onClick={(e) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onClick?.(e as any);\n }}\n onKeyDown={(e) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onKeyDown?.(e as any);\n }}\n {...makeAccessible({\n ...accessibilityProps,\n role: accessibilityProps?.role ?? 'button',\n })}\n {...getStyledProps(rest)}\n {...makeAnalyticsAttribute(rest)}\n {...metaAttribute({ name: 'filter-chip-trigger', testID: rest.testID })}\n >\n <Box display=\"flex\" gap=\"spacing.2\" whiteSpace=\"nowrap\" alignItems=\"center\">\n <Text\n size=\"small\"\n weight=\"medium\"\n color=\"interactive.text.gray.subtle\"\n truncateAfterLines={1}\n >\n {label}\n {isSelected ? ':' : null}\n </Text>\n {isSelected ? renderValue(selectionType, value, isDisabled) : null}\n </Box>\n <Box display=\"flex\" alignItems=\"center\" paddingRight=\"spacing.1\">\n <ChevronDownIcon size=\"small\" color=\"interactive.icon.gray.muted\" />\n </Box>\n </StyledFilterTrigger>\n {shouldShowClearButton ? (\n <>\n <Divider orientation=\"vertical\" variant={isDisabled ? 'muted' : 'subtle'} />\n <StyledFilterCloseButton\n aria-label={`Clear ${label} value`}\n // value can never be undefined because when it's undefined the button itself doesn't render/\n onClick={() => onClearButtonClick?.({ value: value ?? '' })}\n disabled={isDisabled}\n {...metaAttribute({ name: 'filter-chip-close-button' })}\n >\n <CloseIcon size=\"small\" color=\"interactive.icon.gray.muted\" />\n </StyledFilterCloseButton>\n </>\n ) : null}\n </StyledFilterChip>\n );\n};\n\nconst BaseFilterChip = assignWithoutSideEffects(React.forwardRef(_BaseFilterChip), {\n componentId: MetaConstants.BaseFilterChip,\n});\n\nexport { BaseFilterChip };\n"],"names":["getInteractiveFilterItemStyles","_ref","theme","display","height","alignItems","border","cursor","color","backgroundColor","colors","interactive","background","gray","faded","_objectSpread","getFocusRingStyles","outlineOffset","makeSpace","spacing","StyledFilterChip","styled","BaseBox","withConfig","displayName","componentId","_ref2","$isDisabled","$isSelected","borderWidth","makeBorderSize","width","thin","borderColor","FILTER_CHIP_HEIGHT","borderRadius","radius","small","borderStyle","surface","intense","text","StyledFilterTrigger","button","_ref3","$hasClearButton","transparent","none","borderTopLeftRadius","borderBottomLeftRadius","paddingLeft","paddingRight","gap","StyledFilterCloseButton","_ref4","borderTopRightRadius","borderBottomRightRadius","justifyContent","renderValue","selectionType","value","isDisabled","valueColor","valueArray","Array","isArray","length","_valueArray$","_jsx","Text","as","size","weight","truncateAfterLines","children","String","Box","Counter","_BaseFilterChip","_ref5","ref","_accessibilityProps$r","onClearButtonClick","label","_ref5$selectionType","_ref5$showClearButton","showClearButton","onClick","onKeyDown","accessibilityProps","id","rest","_objectWithoutProperties","_excluded","isSelected","shouldShowClearButton","_jsxs","disabled","e","makeAccessible","role","getStyledProps","makeAnalyticsAttribute","metaAttribute","name","testID","whiteSpace","ChevronDownIcon","_Fragment","Divider","orientation","variant","concat","CloseIcon","BaseFilterChip","assignWithoutSideEffects","React","forwardRef","MetaConstants"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAMA,8BAA8B,GAAG,SAAjCA,8BAA8BA,CAAAC,IAAA,EAA+C;AAAA,EAAA,IAAzCC,KAAK,GAAAD,IAAA,CAALC,KAAK,CAAA;EAC7C,OAAO;AACLC,IAAAA,OAAO,EAAE,MAAM;AACfC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,UAAU,EAAE,QAAQ;AACpBC,IAAAA,MAAM,EAAE,MAAM;AACdC,IAAAA,MAAM,EAAE,SAAS;AACjBC,IAAAA,KAAK,EAAE,cAAc;AACrB,IAAA,yBAAyB,EAAE;MACzBC,eAAe,EAAEP,KAAK,CAACQ,MAAM,CAACC,WAAW,CAACC,UAAU,CAACC,IAAI,CAACC,KAAAA;KAC3D;AACD,IAAA,aAAa,EAAE;AACbP,MAAAA,MAAM,EAAE,aAAA;KACT;AACD,IAAA,iBA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UAAAA;AAAW,OAAA,EACjB0C,aAAa,CAAC;AAAEC,QAAAA,IAAI,EAAE,0BAAA;AAA2B,OAAC,CAAC,CAAA,EAAA,EAAA,EAAA;QAAA9B,QAAA,eAEvDN,GAAA,CAAC6C,SAAS,EAAA;AAAC1C,UAAAA,IAAI,EAAC,OAAO;AAAC/D,UAAAA,KAAK,EAAC,6BAAA;SAA+B,CAAA;AAAC,OAAA,CACvC,CAAC,CAAA;KAC1B,CAAC,GACD,IAAI,CAAA;AAAA,GACQ,CAAC,CAAA;AAEvB,CAAC,CAAA;AAEK0G,IAAAA,cAAc,gBAAGC,wBAAwB,cAACC,cAAK,CAACC,UAAU,CAACvC,eAAe,CAAC,EAAE;EACjFrD,WAAW,EAAE6F,aAAa,CAACJ,cAAAA;AAC7B,CAAC;;;;"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
|
+
import React__default from 'react';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import { SegmentedControlContext } from './SegmentedControlContext.js';
|
|
7
|
+
import { SegmentedControlIndicator } from './SegmentedControlIndicator.web.js';
|
|
8
|
+
import { containerHeight, gap, containerPadding, containerBorderRadius } from './segmentedControlTokens.js';
|
|
9
|
+
import { useControllableState } from '../../utils/useControllable.js';
|
|
10
|
+
import { useId } from '../../utils/useId.js';
|
|
11
|
+
import { useMergeRefs } from '../../utils/useMergeRefs.js';
|
|
12
|
+
import '../../utils/makeAccessible/index.js';
|
|
13
|
+
import '../../utils/metaAttribute/index.js';
|
|
14
|
+
import '../../utils/makeAnalyticsAttribute/index.js';
|
|
15
|
+
import '../Box/styledProps/index.js';
|
|
16
|
+
import '../../utils/index.js';
|
|
17
|
+
import getIn from '../../utils/lodashButBetter/get.js';
|
|
18
|
+
import '../Form/index.js';
|
|
19
|
+
import '../Box/BaseBox/index.js';
|
|
20
|
+
import '../BladeProvider/index.js';
|
|
21
|
+
import { formHintLeftLabelMarginLeft } from '../Input/BaseInput/baseInputTokens.js';
|
|
22
|
+
import '../../utils/makeSize/index.js';
|
|
23
|
+
import { getHintType } from '../Input/BaseInput/BaseInput.js';
|
|
24
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
25
|
+
import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
|
|
26
|
+
import useTheme from '../BladeProvider/useTheme.js';
|
|
27
|
+
import { useBreakpoint } from '../../utils/useBreakpoint/useBreakpoint.js';
|
|
28
|
+
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
29
|
+
import { metaAttribute } from '../../utils/metaAttribute/metaAttribute.web.js';
|
|
30
|
+
import { MetaConstants } from '../../utils/metaAttribute/metaConstants.js';
|
|
31
|
+
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
32
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
33
|
+
import { getStyledProps } from '../Box/styledProps/getStyledProps.js';
|
|
34
|
+
import { FormLabel } from '../Form/FormLabel.js';
|
|
35
|
+
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
36
|
+
import { FormHint } from '../Form/FormHint.js';
|
|
37
|
+
|
|
38
|
+
var _excluded = ["children", "defaultValue", "value", "onChange", "size", "isDisabled", "isRequired", "name", "label", "accessibilityLabel", "labelPosition", "helpText", "errorText", "validationState", "necessityIndicator", "testID"];
|
|
39
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
40
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
41
|
+
var StyledSegmentedControlContainer = /*#__PURE__*/styled.div.withConfig({
|
|
42
|
+
displayName: "SegmentedControlweb__StyledSegmentedControlContainer",
|
|
43
|
+
componentId: "ngewlz-0"
|
|
44
|
+
})(function (_ref) {
|
|
45
|
+
var theme = _ref.theme,
|
|
46
|
+
$size = _ref.$size;
|
|
47
|
+
return {
|
|
48
|
+
display: 'flex',
|
|
49
|
+
width: '100%',
|
|
50
|
+
height: makeSpace(containerHeight[$size]),
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
gap: makeSpace(getIn(theme, gap[$size])),
|
|
53
|
+
padding: makeSpace(getIn(theme, containerPadding[$size])),
|
|
54
|
+
backgroundColor: theme.colors.interactive.background.gray.faded,
|
|
55
|
+
borderRadius: makeSpace(theme.border.radius[containerBorderRadius[$size]]),
|
|
56
|
+
position: 'relative'
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
var _SegmentedControl = function _SegmentedControl(_ref2, ref) {
|
|
60
|
+
var children = _ref2.children,
|
|
61
|
+
defaultValue = _ref2.defaultValue,
|
|
62
|
+
value = _ref2.value,
|
|
63
|
+
_onChange = _ref2.onChange,
|
|
64
|
+
_ref2$size = _ref2.size,
|
|
65
|
+
size = _ref2$size === void 0 ? 'medium' : _ref2$size,
|
|
66
|
+
_ref2$isDisabled = _ref2.isDisabled,
|
|
67
|
+
isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
|
|
68
|
+
_ref2$isRequired = _ref2.isRequired,
|
|
69
|
+
isRequired = _ref2$isRequired === void 0 ? false : _ref2$isRequired,
|
|
70
|
+
name = _ref2.name,
|
|
71
|
+
label = _ref2.label,
|
|
72
|
+
accessibilityLabel = _ref2.accessibilityLabel,
|
|
73
|
+
_ref2$labelPosition = _ref2.labelPosition,
|
|
74
|
+
labelPosition = _ref2$labelPosition === void 0 ? 'top' : _ref2$labelPosition,
|
|
75
|
+
helpText = _ref2.helpText,
|
|
76
|
+
errorText = _ref2.errorText,
|
|
77
|
+
_ref2$validationState = _ref2.validationState,
|
|
78
|
+
validationState = _ref2$validationState === void 0 ? 'none' : _ref2$validationState,
|
|
79
|
+
_ref2$necessityIndica = _ref2.necessityIndicator,
|
|
80
|
+
necessityIndicator = _ref2$necessityIndica === void 0 ? 'none' : _ref2$necessityIndica,
|
|
81
|
+
testID = _ref2.testID,
|
|
82
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
83
|
+
var _useControllableState = useControllableState({
|
|
84
|
+
defaultValue: defaultValue,
|
|
85
|
+
value: value,
|
|
86
|
+
onChange: function onChange(val) {
|
|
87
|
+
_onChange === null || _onChange === void 0 || _onChange({
|
|
88
|
+
name: name,
|
|
89
|
+
value: val
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}),
|
|
93
|
+
_useControllableState2 = _slicedToArray(_useControllableState, 2),
|
|
94
|
+
selectedValue = _useControllableState2[0],
|
|
95
|
+
setSelectedValue = _useControllableState2[1];
|
|
96
|
+
var baseId = useId('segmented-control');
|
|
97
|
+
var containerRef = React__default.useRef(null);
|
|
98
|
+
var mergedRef = useMergeRefs(containerRef, ref);
|
|
99
|
+
var itemRefs = React__default.useRef(new Map());
|
|
100
|
+
var labelId = "".concat(baseId, "-label");
|
|
101
|
+
var totalItems = React__default.Children.count(children);
|
|
102
|
+
var firstEnabledValue = React__default.useMemo(function () {
|
|
103
|
+
var first;
|
|
104
|
+
React__default.Children.forEach(children, function (child) {
|
|
105
|
+
if (first !== undefined) return;
|
|
106
|
+
if (/*#__PURE__*/React__default.isValidElement(child) && !child.props.isDisabled) {
|
|
107
|
+
first = child.props.value;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return first;
|
|
111
|
+
}, [children]);
|
|
112
|
+
var contextValue = React__default.useMemo(function () {
|
|
113
|
+
return {
|
|
114
|
+
selectedValue: selectedValue,
|
|
115
|
+
setSelectedValue: setSelectedValue,
|
|
116
|
+
size: size,
|
|
117
|
+
isDisabled: isDisabled,
|
|
118
|
+
name: name,
|
|
119
|
+
baseId: baseId,
|
|
120
|
+
totalItems: totalItems,
|
|
121
|
+
firstEnabledValue: firstEnabledValue,
|
|
122
|
+
itemRefs: itemRefs
|
|
123
|
+
};
|
|
124
|
+
}, [selectedValue, setSelectedValue, size, isDisabled, name, baseId, totalItems, firstEnabledValue]);
|
|
125
|
+
var _useTheme = useTheme(),
|
|
126
|
+
theme = _useTheme.theme;
|
|
127
|
+
var _useBreakpoint = useBreakpoint({
|
|
128
|
+
breakpoints: theme.breakpoints
|
|
129
|
+
}),
|
|
130
|
+
matchedDeviceType = _useBreakpoint.matchedDeviceType;
|
|
131
|
+
var isLabelLeftPositioned = labelPosition === 'left' && matchedDeviceType === 'desktop';
|
|
132
|
+
var willRenderHintText = Boolean(helpText) || validationState === 'error' && Boolean(errorText);
|
|
133
|
+
var showError = validationState === 'error' && errorText;
|
|
134
|
+
var showHelpText = !showError && helpText;
|
|
135
|
+
var accessibilityText = "".concat(showError ? errorText : '', " ").concat(showHelpText ? helpText : '').trim();
|
|
136
|
+
var ariaLabel = label ? undefined : accessibilityLabel || name;
|
|
137
|
+
var segmentedControlElement = /*#__PURE__*/jsxs(StyledSegmentedControlContainer, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
138
|
+
ref: mergedRef,
|
|
139
|
+
$size: size
|
|
140
|
+
}, makeAccessible({
|
|
141
|
+
role: 'radiogroup',
|
|
142
|
+
labelledBy: label ? labelId : undefined,
|
|
143
|
+
label: ariaLabel,
|
|
144
|
+
required: isRequired
|
|
145
|
+
})), metaAttribute({
|
|
146
|
+
name: MetaConstants.SegmentedControl,
|
|
147
|
+
testID: testID
|
|
148
|
+
})), makeAnalyticsAttribute(rest)), {}, {
|
|
149
|
+
children: [children, /*#__PURE__*/jsx(SegmentedControlIndicator, {
|
|
150
|
+
containerRef: containerRef
|
|
151
|
+
})]
|
|
152
|
+
}));
|
|
153
|
+
return /*#__PURE__*/jsx(SegmentedControlContext.Provider, {
|
|
154
|
+
value: contextValue,
|
|
155
|
+
children: /*#__PURE__*/jsxs(BaseBox, _objectSpread(_objectSpread({
|
|
156
|
+
display: "flex",
|
|
157
|
+
flexDirection: "column",
|
|
158
|
+
width: "100%"
|
|
159
|
+
}, getStyledProps(rest)), {}, {
|
|
160
|
+
children: [/*#__PURE__*/jsxs(BaseBox, {
|
|
161
|
+
display: "flex",
|
|
162
|
+
flexDirection: isLabelLeftPositioned ? 'row' : 'column',
|
|
163
|
+
alignItems: isLabelLeftPositioned ? 'center' : undefined,
|
|
164
|
+
children: [label ? /*#__PURE__*/jsx(FormLabel, {
|
|
165
|
+
as: "span",
|
|
166
|
+
necessityIndicator: necessityIndicator,
|
|
167
|
+
position: labelPosition,
|
|
168
|
+
id: labelId,
|
|
169
|
+
accessibilityText: accessibilityText && ",".concat(accessibilityText),
|
|
170
|
+
size: size,
|
|
171
|
+
children: label
|
|
172
|
+
}) : null, /*#__PURE__*/jsx(BaseBox, {
|
|
173
|
+
display: "flex",
|
|
174
|
+
flexDirection: "column",
|
|
175
|
+
flex: "1",
|
|
176
|
+
children: segmentedControlElement
|
|
177
|
+
})]
|
|
178
|
+
}), willRenderHintText && /*#__PURE__*/jsx(BaseBox, {
|
|
179
|
+
marginLeft: makeSize(label && isLabelLeftPositioned ? formHintLeftLabelMarginLeft[size] : 0),
|
|
180
|
+
children: /*#__PURE__*/jsx(FormHint, {
|
|
181
|
+
type: getHintType({
|
|
182
|
+
validationState: validationState,
|
|
183
|
+
hasHelpText: Boolean(helpText)
|
|
184
|
+
}),
|
|
185
|
+
helpText: helpText,
|
|
186
|
+
errorText: errorText,
|
|
187
|
+
size: size
|
|
188
|
+
})
|
|
189
|
+
})]
|
|
190
|
+
}))
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
var SegmentedControl = /*#__PURE__*/React__default.forwardRef(_SegmentedControl);
|
|
194
|
+
|
|
195
|
+
export { SegmentedControl };
|
|
196
|
+
//# sourceMappingURL=SegmentedControl.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControl.web.js","sources":["../../../../../../src/components/SegmentedControl/SegmentedControl.web.tsx"],"sourcesContent":["import React from 'react';\nimport styled from 'styled-components';\nimport type { SegmentedControlProps } from './types';\nimport { SegmentedControlContext } from './SegmentedControlContext';\nimport { SegmentedControlIndicator } from './SegmentedControlIndicator.web';\nimport {\n containerPadding,\n containerBorderRadius,\n containerHeight,\n gap,\n} from './segmentedControlTokens';\nimport { useControllableState } from '~utils/useControllable';\nimport { useId } from '~utils/useId';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport { makeSpace, useBreakpoint } from '~utils';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { BladeElementRef } from '~utils/types';\nimport { FormLabel, FormHint } from '~components/Form';\nimport BaseBox from '~components/Box/BaseBox';\nimport { useTheme } from '~components/BladeProvider';\nimport { formHintLeftLabelMarginLeft } from '~components/Input/BaseInput/baseInputTokens';\nimport { makeSize } from '~utils/makeSize';\nimport { getHintType } from '~components/Input/BaseInput/BaseInput';\n\nconst StyledSegmentedControlContainer = styled.div<{\n $size: NonNullable<SegmentedControlProps['size']>;\n}>(({ theme, $size }) => ({\n display: 'flex',\n width: '100%',\n height: makeSpace(containerHeight[$size]),\n alignItems: 'center',\n gap: makeSpace(getIn(theme, gap[$size])),\n padding: makeSpace(getIn(theme, containerPadding[$size])),\n backgroundColor: theme.colors.interactive.background.gray.faded,\n borderRadius: makeSpace(theme.border.radius[containerBorderRadius[$size]]),\n position: 'relative',\n}));\n\nconst _SegmentedControl = (\n {\n children,\n defaultValue,\n value,\n onChange,\n size = 'medium',\n isDisabled = false,\n isRequired = false,\n name,\n label,\n accessibilityLabel,\n labelPosition = 'top',\n helpText,\n errorText,\n validationState = 'none',\n necessityIndicator = 'none',\n testID,\n ...rest\n }: SegmentedControlProps,\n ref: React.Ref<BladeElementRef>,\n): React.ReactElement => {\n const [selectedValue, setSelectedValue] = useControllableState({\n defaultValue,\n value,\n onChange: (val) => {\n onChange?.({ name, value: val });\n },\n });\n\n const baseId = useId('segmented-control');\n const containerRef = React.useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(containerRef, ref as React.Ref<HTMLDivElement>);\n const itemRefs = React.useRef<Map<string, HTMLElement>>(new Map());\n const labelId = `${baseId}-label`;\n const totalItems = React.Children.count(children);\n\n const firstEnabledValue = React.useMemo(() => {\n let first: string | undefined;\n React.Children.forEach(children, (child) => {\n if (first !== undefined) return;\n if (React.isValidElement(child) && !child.props.isDisabled) {\n first = child.props.value;\n }\n });\n return first;\n }, [children]);\n\n const contextValue = React.useMemo(\n () => ({\n selectedValue,\n setSelectedValue,\n size,\n isDisabled,\n name,\n baseId,\n totalItems,\n firstEnabledValue,\n itemRefs,\n }),\n [\n selectedValue,\n setSelectedValue,\n size,\n isDisabled,\n name,\n baseId,\n totalItems,\n firstEnabledValue,\n ],\n );\n\n const { theme } = useTheme();\n const { matchedDeviceType } = useBreakpoint({ breakpoints: theme.breakpoints });\n const isLabelLeftPositioned = labelPosition === 'left' && matchedDeviceType === 'desktop';\n\n const willRenderHintText =\n Boolean(helpText) || (validationState === 'error' && Boolean(errorText));\n\n const showError = validationState === 'error' && errorText;\n const showHelpText = !showError && helpText;\n const accessibilityText = `${showError ? errorText : ''} ${showHelpText ? helpText : ''}`.trim();\n const ariaLabel = label ? undefined : accessibilityLabel || name;\n\n const segmentedControlElement = (\n <StyledSegmentedControlContainer\n ref={mergedRef}\n $size={size}\n {...makeAccessible({\n role: 'radiogroup',\n labelledBy: label ? labelId : undefined,\n label: ariaLabel,\n required: isRequired,\n })}\n {...metaAttribute({ name: MetaConstants.SegmentedControl, testID })}\n {...makeAnalyticsAttribute(rest)}\n >\n {children}\n <SegmentedControlIndicator containerRef={containerRef} />\n </StyledSegmentedControlContainer>\n );\n\n return (\n <SegmentedControlContext.Provider value={contextValue}>\n <BaseBox display=\"flex\" flexDirection=\"column\" width=\"100%\" {...getStyledProps(rest)}>\n <BaseBox\n display=\"flex\"\n flexDirection={isLabelLeftPositioned ? 'row' : 'column'}\n alignItems={isLabelLeftPositioned ? 'center' : undefined}\n >\n {label ? (\n <FormLabel\n as=\"span\"\n necessityIndicator={necessityIndicator}\n position={labelPosition}\n id={labelId}\n accessibilityText={accessibilityText && `,${accessibilityText}`}\n size={size}\n >\n {label}\n </FormLabel>\n ) : null}\n\n <BaseBox display=\"flex\" flexDirection=\"column\" flex=\"1\">\n {segmentedControlElement}\n </BaseBox>\n </BaseBox>\n\n {willRenderHintText && (\n <BaseBox\n marginLeft={makeSize(\n label && isLabelLeftPositioned ? formHintLeftLabelMarginLeft[size] : 0,\n )}\n >\n <FormHint\n type={getHintType({ validationState, hasHelpText: Boolean(helpText) })}\n helpText={helpText}\n errorText={errorText}\n size={size}\n />\n </BaseBox>\n )}\n </BaseBox>\n </SegmentedControlContext.Provider>\n );\n};\n\nconst SegmentedControl = React.forwardRef(_SegmentedControl);\n\nexport { SegmentedControl };\n"],"names":["StyledSegmentedControlContainer","styled","div","withConfig","displayName","componentId","_ref","theme","$size","display","width","height","makeSpace","containerHeight","alignItems","gap","getIn","padding","containerPadding","backgroundColor","colors","interactive","background","gray","faded","borderRadius","border","radius","containerBorderRadius","position","_SegmentedControl","_ref2","ref","children","defaultValue","value","onChange","_ref2$size","size","_ref2$isDisabled","isDisabled","_ref2$isRequired","isRequired","name","label","accessibilityLabel","_ref2$labelPosition","labelPosition","helpText","errorText","_ref2$validationState","validationState","_ref2$necessityIndica","necessityIndicator","testID","rest","_objectWithoutProperties","_excluded","_useControllableState","useControllableState","val","_useControllableState2","_slicedToArray","selectedValue","setSelectedValue","baseId","useId","containerRef","React","useRef","mergedRef","useMergeRefs","itemRefs","Map","labelId","concat","totalItems","Children","count","firstEnabledValue","useMemo","first","forEach","child","undefined","isValidElement","props","contextValue","_useTheme","useTheme","_useBreakpoint","useBreakpoint","breakpoints","matchedDeviceType","isLabelLeftPositioned","willRenderHintText","Boolean","showError","showHelpText","accessibilityText","trim","ariaLabel","segmentedControlElement","_jsxs","_objectSpread","makeAccessible","role","labelledBy","required","metaAttribute","MetaConstants","SegmentedControl","makeAnalyticsAttribute","_jsx","SegmentedControlIndicator","SegmentedControlContext","Provider","BaseBox","flexDirection","getStyledProps","FormLabel","as","id","flex","marginLeft","makeSize","formHintLeftLabelMarginLeft","FormHint","type","getHintType","hasHelpText","forwardRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAMA,+BAA+B,gBAAGC,MAAM,CAACC,GAAG,CAAAC,UAAA,CAAA;EAAAC,WAAA,EAAA,sDAAA;EAAAC,WAAA,EAAA,UAAA;AAAA,CAAA,CAAA,CAE/C,UAAAC,IAAA,EAAA;AAAA,EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK,CAAA;EAAA,OAAQ;AACxBC,IAAAA,OAAO,EAAE,MAAM;AACfC,IAAAA,KAAK,EAAE,MAAM;AACbC,IAAAA,MAAM,EAAEC,SAAS,CAACC,eAAe,CAACL,KAAK,CAAC,CAAC;AACzCM,IAAAA,UAAU,EAAE,QAAQ;AACpBC,IAAAA,GAAG,EAAEH,SAAS,CAACI,KAAK,CAACT,KAAK,EAAEQ,GAAG,CAACP,KAAK,CAAC,CAAC,CAAC;AACxCS,IAAAA,OAAO,EAAEL,SAAS,CAACI,KAAK,CAACT,KAAK,EAAEW,gBAAgB,CA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AAA,CAAQwB,iBAAiB,CAAG;AAChE7D,UAAAA,IAAI,EAAEA,IAAK;AAAAL,UAAAA,QAAA,EAEVW,KAAAA;AAAK,SACG,CAAC,GACV,IAAI,eAERqE,GAAA,CAACI,OAAO,EAAA;AAAC5G,UAAAA,OAAO,EAAC,MAAM;AAAC6G,UAAAA,aAAa,EAAC,QAAQ;AAACK,UAAAA,IAAI,EAAC,GAAG;AAAA1F,UAAAA,QAAA,EACpDqE,uBAAAA;AAAuB,SACjB,CAAC,CAAA;AAAA,OACH,CAAC,EAETP,kBAAkB,iBACjBkB,GAAA,CAACI,OAAO,EAAA;AACNO,QAAAA,UAAU,EAAEC,QAAQ,CAClBjF,KAAK,IAAIkD,qBAAqB,GAAGgC,2BAA2B,CAACxF,IAAI,CAAC,GAAG,CACvE,CAAE;QAAAL,QAAA,eAEFgF,GAAA,CAACc,QAAQ,EAAA;UACPC,IAAI,EAAEC,WAAW,CAAC;AAAE9E,YAAAA,eAAe,EAAfA,eAAe;YAAE+E,WAAW,EAAElC,OAAO,CAAChD,QAAQ,CAAA;AAAE,WAAC,CAAE;AACvEA,UAAAA,QAAQ,EAAEA,QAAS;AACnBC,UAAAA,SAAS,EAAEA,SAAU;AACrBX,UAAAA,IAAI,EAAEA,IAAAA;SACP,CAAA;AAAC,OACK,CACV,CAAA;KACM,CAAA,CAAA;AAAC,GACsB,CAAC,CAAA;AAEvC,CAAC,CAAA;AAED,IAAMyE,gBAAgB,gBAAG3C,cAAK,CAAC+D,UAAU,CAACrG,iBAAiB;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import '../../utils/logger/index.js';
|
|
3
|
+
import { throwBladeError } from '../../utils/logger/logger.js';
|
|
4
|
+
|
|
5
|
+
var SegmentedControlContext = /*#__PURE__*/React__default.createContext(null);
|
|
6
|
+
var useSegmentedControlContext = function useSegmentedControlContext() {
|
|
7
|
+
var context = React__default.useContext(SegmentedControlContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throwBladeError({
|
|
10
|
+
moduleName: 'SegmentedControl',
|
|
11
|
+
message: 'useSegmentedControlContext must be used within SegmentedControl'
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return context;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { SegmentedControlContext, useSegmentedControlContext };
|
|
18
|
+
//# sourceMappingURL=SegmentedControlContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControlContext.js","sources":["../../../../../../src/components/SegmentedControl/SegmentedControlContext.ts"],"sourcesContent":["import React from 'react';\nimport type { SegmentedControlSize } from './types';\nimport { throwBladeError } from '~utils/logger';\nimport type { ControllableStateSetter } from '~utils/useControllable';\n\ntype SegmentedControlContextProps = {\n selectedValue: string | undefined;\n setSelectedValue: ControllableStateSetter<string>;\n size: SegmentedControlSize;\n isDisabled: boolean;\n name?: string;\n baseId: string;\n totalItems: number;\n firstEnabledValue?: string;\n itemRefs?: React.MutableRefObject<Map<string, HTMLElement>>;\n} | null;\n\nconst SegmentedControlContext = React.createContext<SegmentedControlContextProps>(null);\n\nconst useSegmentedControlContext = (): NonNullable<SegmentedControlContextProps> => {\n const context = React.useContext(SegmentedControlContext);\n\n if (!context) {\n throwBladeError({\n moduleName: 'SegmentedControl',\n message: 'useSegmentedControlContext must be used within SegmentedControl',\n });\n }\n\n return context!;\n};\n\nexport { SegmentedControlContext, useSegmentedControlContext };\n"],"names":["SegmentedControlContext","React","createContext","useSegmentedControlContext","context","useContext","throwBladeError","moduleName","message"],"mappings":";;;;AAiBA,IAAMA,uBAAuB,gBAAGC,cAAK,CAACC,aAAa,CAA+B,IAAI,EAAC;AAEvF,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,GAAoD;AAClF,EAAA,IAAMC,OAAO,GAAGH,cAAK,CAACI,UAAU,CAACL,uBAAuB,CAAC,CAAA;EAEzD,IAAI,CAACI,OAAO,EAAE;AACZE,IAAAA,eAAe,CAAC;AACdC,MAAAA,UAAU,EAAE,kBAAkB;AAC9BC,MAAAA,OAAO,EAAE,iEAAA;AACX,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,OAAOJ,OAAO,CAAA;AAChB;;;;"}
|
package/build/lib/web/development/components/SegmentedControl/SegmentedControlIndicator.web.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { useSegmentedControlContext } from './SegmentedControlContext.js';
|
|
5
|
+
import { itemBorderRadius } from './segmentedControlTokens.js';
|
|
6
|
+
import '../../utils/index.js';
|
|
7
|
+
import '../BladeProvider/index.js';
|
|
8
|
+
import { useIsomorphicLayoutEffect } from '../../utils/useIsomorphicLayoutEffect.js';
|
|
9
|
+
import { useResize } from '../../utils/useResize.js';
|
|
10
|
+
import '../Box/BaseBox/index.js';
|
|
11
|
+
import { jsx } from 'react/jsx-runtime';
|
|
12
|
+
import useTheme from '../BladeProvider/useTheme.js';
|
|
13
|
+
import { castWebType } from '../../utils/platform/castUtils.js';
|
|
14
|
+
import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.web.js';
|
|
15
|
+
import { makeSpace } from '../../utils/makeSpace/makeSpace.js';
|
|
16
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
17
|
+
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
var SegmentedControlIndicator = function SegmentedControlIndicator(_ref) {
|
|
21
|
+
var containerRef = _ref.containerRef;
|
|
22
|
+
var _useTheme = useTheme(),
|
|
23
|
+
theme = _useTheme.theme;
|
|
24
|
+
var _useSegmentedControlC = useSegmentedControlContext(),
|
|
25
|
+
selectedValue = _useSegmentedControlC.selectedValue,
|
|
26
|
+
size = _useSegmentedControlC.size,
|
|
27
|
+
itemRefs = _useSegmentedControlC.itemRefs;
|
|
28
|
+
var _React$useState = React__default.useState(false),
|
|
29
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
30
|
+
shouldAnimate = _React$useState2[0],
|
|
31
|
+
setShouldAnimate = _React$useState2[1];
|
|
32
|
+
var _React$useState3 = React__default.useState({
|
|
33
|
+
width: 0,
|
|
34
|
+
height: 0,
|
|
35
|
+
x: 0,
|
|
36
|
+
y: 0
|
|
37
|
+
}),
|
|
38
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
39
|
+
dimensions = _React$useState4[0],
|
|
40
|
+
setDimensions = _React$useState4[1];
|
|
41
|
+
var updateDimensions = React__default.useCallback(function () {
|
|
42
|
+
if (!selectedValue || !itemRefs) return;
|
|
43
|
+
var activeItem = itemRefs.current.get(selectedValue);
|
|
44
|
+
var container = containerRef.current;
|
|
45
|
+
if (!activeItem || !container || activeItem.offsetWidth === 0) return;
|
|
46
|
+
var containerRect = container.getBoundingClientRect();
|
|
47
|
+
var itemRect = activeItem.getBoundingClientRect();
|
|
48
|
+
setDimensions({
|
|
49
|
+
width: activeItem.offsetWidth,
|
|
50
|
+
height: activeItem.offsetHeight,
|
|
51
|
+
x: itemRect.left - containerRect.left,
|
|
52
|
+
y: itemRect.top - containerRect.top
|
|
53
|
+
});
|
|
54
|
+
}, [selectedValue, itemRefs, containerRef]);
|
|
55
|
+
useIsomorphicLayoutEffect(function () {
|
|
56
|
+
if (!selectedValue) return;
|
|
57
|
+
updateDimensions();
|
|
58
|
+
}, [selectedValue, updateDimensions]);
|
|
59
|
+
var updateDimensionsRef = React__default.useRef(updateDimensions);
|
|
60
|
+
updateDimensionsRef.current = updateDimensions;
|
|
61
|
+
React__default.useEffect(function () {
|
|
62
|
+
if ('fonts' in document) {
|
|
63
|
+
try {
|
|
64
|
+
void document.fonts.ready.then(function () {
|
|
65
|
+
updateDimensionsRef.current();
|
|
66
|
+
});
|
|
67
|
+
} catch (_unused) {
|
|
68
|
+
/* empty */
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Runs once on mount — document.fonts.ready only needs to be awaited a single time.
|
|
72
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
+
}, []);
|
|
74
|
+
useResize(containerRef, updateDimensions);
|
|
75
|
+
|
|
76
|
+
// Enable animation only after the first paint with real dimensions.
|
|
77
|
+
// useEffect fires after the browser paints, guaranteeing the initial
|
|
78
|
+
// position is committed before transitions are turned on.
|
|
79
|
+
React__default.useEffect(function () {
|
|
80
|
+
if (dimensions.width > 0) {
|
|
81
|
+
setShouldAnimate(true);
|
|
82
|
+
}
|
|
83
|
+
}, [dimensions.width]);
|
|
84
|
+
|
|
85
|
+
// Nothing to show until dimensions are measured — avoids a 0×0 flash.
|
|
86
|
+
if (!dimensions.width) return null;
|
|
87
|
+
var transitionProps = {
|
|
88
|
+
transitionProperty: 'transform',
|
|
89
|
+
transitionDuration: shouldAnimate ? castWebType(makeMotionTime(theme.motion.duration.moderate)) : '0ms',
|
|
90
|
+
transitionTimingFunction: castWebType(theme.motion.easing.standard)
|
|
91
|
+
};
|
|
92
|
+
var borderRadiusValue = makeSpace(theme.border.radius[itemBorderRadius[size]]);
|
|
93
|
+
return /*#__PURE__*/jsx(BaseBox, {
|
|
94
|
+
pointerEvents: "none",
|
|
95
|
+
position: "absolute",
|
|
96
|
+
left: "0px",
|
|
97
|
+
top: "0px",
|
|
98
|
+
backgroundColor: "surface.background.gray.intense",
|
|
99
|
+
style: _objectSpread(_objectSpread({}, transitionProps), {}, {
|
|
100
|
+
borderRadius: borderRadiusValue,
|
|
101
|
+
width: "".concat(dimensions.width, "px"),
|
|
102
|
+
height: "".concat(dimensions.height, "px"),
|
|
103
|
+
transform: "translate(".concat(dimensions.x, "px, ").concat(dimensions.y, "px)")
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export { SegmentedControlIndicator };
|
|
109
|
+
//# sourceMappingURL=SegmentedControlIndicator.web.js.map
|
package/build/lib/web/development/components/SegmentedControl/SegmentedControlIndicator.web.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SegmentedControlIndicator.web.js","sources":["../../../../../../src/components/SegmentedControl/SegmentedControlIndicator.web.tsx"],"sourcesContent":["import React from 'react';\nimport { useSegmentedControlContext } from './SegmentedControlContext';\nimport { itemBorderRadius } from './segmentedControlTokens';\nimport { castWebType, makeMotionTime, makeSpace } from '~utils';\nimport { useTheme } from '~components/BladeProvider';\nimport { useIsomorphicLayoutEffect } from '~utils/useIsomorphicLayoutEffect';\nimport { useResize } from '~utils/useResize';\nimport BaseBox from '~components/Box/BaseBox';\n\nconst SegmentedControlIndicator = ({\n containerRef,\n}: {\n containerRef: React.RefObject<HTMLElement | null>;\n}): React.ReactElement | null => {\n const { theme } = useTheme();\n const { selectedValue, size, itemRefs } = useSegmentedControlContext();\n const [shouldAnimate, setShouldAnimate] = React.useState(false);\n const [dimensions, setDimensions] = React.useState({ width: 0, height: 0, x: 0, y: 0 });\n\n const updateDimensions = React.useCallback(() => {\n if (!selectedValue || !itemRefs) return;\n const activeItem = itemRefs.current.get(selectedValue);\n const container = containerRef.current;\n if (!activeItem || !container || activeItem.offsetWidth === 0) return;\n\n const containerRect = container.getBoundingClientRect();\n const itemRect = activeItem.getBoundingClientRect();\n\n setDimensions({\n width: activeItem.offsetWidth,\n height: activeItem.offsetHeight,\n x: itemRect.left - containerRect.left,\n y: itemRect.top - containerRect.top,\n });\n }, [selectedValue, itemRefs, containerRef]);\n\n useIsomorphicLayoutEffect(() => {\n if (!selectedValue) return;\n updateDimensions();\n }, [selectedValue, updateDimensions]);\n\n const updateDimensionsRef = React.useRef(updateDimensions);\n updateDimensionsRef.current = updateDimensions;\n\n React.useEffect(() => {\n if ('fonts' in document) {\n try {\n void document.fonts.ready.then(() => {\n updateDimensionsRef.current();\n });\n } catch {\n /* empty */\n }\n }\n // Runs once on mount — document.fonts.ready only needs to be awaited a single time.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useResize(containerRef, updateDimensions);\n\n // Enable animation only after the first paint with real dimensions.\n // useEffect fires after the browser paints, guaranteeing the initial\n // position is committed before transitions are turned on.\n React.useEffect(() => {\n if (dimensions.width > 0) {\n setShouldAnimate(true);\n }\n }, [dimensions.width]);\n\n // Nothing to show until dimensions are measured — avoids a 0×0 flash.\n if (!dimensions.width) return null;\n\n const transitionProps = {\n transitionProperty: 'transform',\n transitionDuration: shouldAnimate\n ? castWebType(makeMotionTime(theme.motion.duration.moderate))\n : '0ms',\n transitionTimingFunction: castWebType(theme.motion.easing.standard),\n };\n\n const borderRadiusValue = makeSpace(theme.border.radius[itemBorderRadius[size]]);\n\n return (\n <BaseBox\n pointerEvents=\"none\"\n position=\"absolute\"\n left=\"0px\"\n top=\"0px\"\n backgroundColor=\"surface.background.gray.intense\"\n style={{\n ...transitionProps,\n borderRadius: borderRadiusValue,\n width: `${dimensions.width}px`,\n height: `${dimensions.height}px`,\n transform: `translate(${dimensions.x}px, ${dimensions.y}px)`,\n }}\n />\n );\n};\n\nexport { SegmentedControlIndicator };\n"],"names":["SegmentedControlIndicator","_ref","containerRef","_useTheme","useTheme","theme","_useSegmentedControlC","useSegmentedControlContext","selectedValue","size","itemRefs","_React$useState","React","useState","_React$useState2","_slicedToArray","shouldAnimate","setShouldAnimate","_React$useState3","width","height","x","y","_React$useState4","dimensions","setDimensions","updateDimensions","useCallback","activeItem","current","get","container","offsetWidth","containerRect","getBoundingClientRect","itemRect","offsetHeight","left","top","useIsomorphicLayoutEffect","updateDimensionsRef","useRef","useEffect","document","fonts","ready","then","_unused","useResize","transitionProps","transitionProperty","transitionDuration","castWebType","makeMotionTime","motion","duration","moderate","transitionTimingFunction","easing","standard","borderRadiusValue","makeSpace","border","radius","itemBorderRadius","_jsx","BaseBox","pointerEvents","position","backgroundColor","style","_objectSpread","borderRadius","concat","transform"],"mappings":";;;;;;;;;;;;;;;;;;;AASA,IAAMA,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAAC,IAAA,EAIE;AAAA,EAAA,IAH/BC,YAAY,GAAAD,IAAA,CAAZC,YAAY,CAAA;AAIZ,EAAA,IAAAC,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;AACb,EAAA,IAAAC,qBAAA,GAA0CC,0BAA0B,EAAE;IAA9DC,aAAa,GAAAF,qBAAA,CAAbE,aAAa;IAAEC,IAAI,GAAAH,qBAAA,CAAJG,IAAI;IAAEC,QAAQ,GAAAJ,qBAAA,CAARI,QAAQ,CAAA;AACrC,EAAA,IAAAC,eAAA,GAA0CC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;IAAAC,gBAAA,GAAAC,cAAA,CAAAJ,eAAA,EAAA,CAAA,CAAA;AAAxDK,IAAAA,aAAa,GAAAF,gBAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,gBAAgB,GAAAH,gBAAA,CAAA,CAAA,CAAA,CAAA;AACtC,EAAA,IAAAI,gBAAA,GAAoCN,cAAK,CAACC,QAAQ,CAAC;AAAEM,MAAAA,KAAK,EAAE,CAAC;AAAEC,MAAAA,MAAM,EAAE,CAAC;AAAEC,MAAAA,CAAC,EAAE,CAAC;AAAEC,MAAAA,CAAC,EAAE,CAAA;AAAE,KAAC,CAAC;I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