@razorpay/blade 11.11.1 → 11.13.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/Box/BaseBox/baseBoxStyles.js +1 -1
- package/build/lib/native/components/Box/BaseBox/baseBoxStyles.js.map +1 -1
- package/build/lib/native/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/native/components/Button/BaseButton/StyledBaseButton.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/AnimatedBaseInputWrapper.native.js +1 -1
- package/build/lib/native/components/Input/BaseInput/AnimatedBaseInputWrapper.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js +2 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputTagSlot.native.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputTagSlot.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputWrapper.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputWrapper.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js +1 -1
- package/build/lib/native/components/Input/BaseInput/StyledBaseInput.native.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputStyles.js +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/useTaggedInput.js +13 -0
- package/build/lib/native/components/Input/BaseInput/useTaggedInput.js.map +1 -0
- package/build/lib/native/components/Input/TextArea/TextArea.js +2 -1
- package/build/lib/native/components/Input/TextArea/TextArea.js.map +1 -1
- package/build/lib/native/components/Input/TextInput/TextInput.js +2 -1
- package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/native/components/ProgressBar/CircularProgressBar.native.js +31 -0
- package/build/lib/native/components/ProgressBar/CircularProgressBar.native.js.map +1 -0
- package/build/lib/native/components/ProgressBar/CircularProgressLabel.js +17 -0
- package/build/lib/native/components/ProgressBar/CircularProgressLabel.js.map +1 -0
- package/build/lib/native/components/ProgressBar/ProgressBar.js +2 -1
- package/build/lib/native/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/native/components/ProgressBar/ProgressBarFilled.native.js +1 -1
- package/build/lib/native/components/ProgressBar/ProgressBarFilled.native.js.map +1 -1
- package/build/lib/native/components/ProgressBar/progressBarTokens.js +6 -2
- package/build/lib/native/components/ProgressBar/progressBarTokens.js.map +1 -1
- package/build/lib/native/components/Tag/AnimatedTag.native.js.map +1 -1
- package/build/lib/native/components/Tag/Tag.js +1 -1
- package/build/lib/native/components/Tag/Tag.js.map +1 -1
- package/build/lib/native/components/Tag/getTagsGroup.js +1 -1
- package/build/lib/native/components/Tag/getTagsGroup.js.map +1 -1
- package/build/lib/native/components/Tag/tagAnimationConfig.js +1 -2
- package/build/lib/native/components/Tag/tagAnimationConfig.js.map +1 -1
- package/build/lib/native/components/Typography/BaseText/getBaseTextStyles.js +1 -1
- package/build/lib/native/components/Typography/BaseText/getBaseTextStyles.js.map +1 -1
- package/build/lib/native/tokens/global/size.js +1 -1
- package/build/lib/native/tokens/global/size.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/baseBoxStyles.js +2 -1
- package/build/lib/web/development/components/Box/BaseBox/baseBoxStyles.js.map +1 -1
- package/build/lib/web/development/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +8 -2
- package/build/lib/web/development/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +13 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js +14 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputWrapper.js +4 -2
- package/build/lib/web/development/components/Input/BaseInput/BaseInputWrapper.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js +5 -2
- package/build/lib/web/development/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js +2 -2
- package/build/lib/web/development/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/useTaggedInput.js +172 -0
- package/build/lib/web/development/components/Input/BaseInput/useTaggedInput.js.map +1 -0
- package/build/lib/web/development/components/Input/TextArea/TextArea.js +54 -8
- package/build/lib/web/development/components/Input/TextArea/TextArea.js.map +1 -1
- package/build/lib/web/development/components/Input/TextInput/TextInput.js +51 -5
- package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/development/components/ProgressBar/CircularProgressBar.web.js +140 -0
- package/build/lib/web/development/components/ProgressBar/CircularProgressBar.web.js.map +1 -0
- package/build/lib/web/development/components/ProgressBar/CircularProgressLabel.js +38 -0
- package/build/lib/web/development/components/ProgressBar/CircularProgressLabel.js.map +1 -0
- package/build/lib/web/development/components/ProgressBar/ProgressBar.js +47 -10
- package/build/lib/web/development/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/web/development/components/ProgressBar/ProgressBarFilled.web.js +6 -6
- package/build/lib/web/development/components/ProgressBar/ProgressBarFilled.web.js.map +1 -1
- package/build/lib/web/development/components/ProgressBar/progressBarTokens.js +45 -1
- package/build/lib/web/development/components/ProgressBar/progressBarTokens.js.map +1 -1
- package/build/lib/web/development/components/Tag/AnimatedTag.web.js +2 -3
- package/build/lib/web/development/components/Tag/AnimatedTag.web.js.map +1 -1
- package/build/lib/web/development/components/Tag/Tag.js +5 -6
- package/build/lib/web/development/components/Tag/Tag.js.map +1 -1
- package/build/lib/web/development/components/Tag/getTagsGroup.js +1 -1
- package/build/lib/web/development/components/Tag/getTagsGroup.js.map +1 -1
- package/build/lib/web/development/components/Tag/tagAnimationConfig.js +4 -2
- package/build/lib/web/development/components/Tag/tagAnimationConfig.js.map +1 -1
- package/build/lib/web/development/components/Typography/BaseText/getBaseTextStyles.js +2 -1
- package/build/lib/web/development/components/Typography/BaseText/getBaseTextStyles.js.map +1 -1
- package/build/lib/web/development/tokens/global/size.js +4 -0
- package/build/lib/web/development/tokens/global/size.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/baseBoxStyles.js +2 -1
- package/build/lib/web/production/components/Box/BaseBox/baseBoxStyles.js.map +1 -1
- package/build/lib/web/production/components/Box/BaseBox/types/propsTypes.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js +8 -2
- package/build/lib/web/production/components/Input/BaseInput/AnimatedBaseInputWrapper.web.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +13 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js +14 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputTagSlot.web.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputWrapper.js +4 -2
- package/build/lib/web/production/components/Input/BaseInput/BaseInputWrapper.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js +5 -2
- package/build/lib/web/production/components/Input/BaseInput/StyledBaseInput.web.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js +2 -2
- package/build/lib/web/production/components/Input/BaseInput/baseInputStyles.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/useTaggedInput.js +172 -0
- package/build/lib/web/production/components/Input/BaseInput/useTaggedInput.js.map +1 -0
- package/build/lib/web/production/components/Input/TextArea/TextArea.js +54 -8
- package/build/lib/web/production/components/Input/TextArea/TextArea.js.map +1 -1
- package/build/lib/web/production/components/Input/TextInput/TextInput.js +51 -5
- package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/production/components/ProgressBar/CircularProgressBar.web.js +140 -0
- package/build/lib/web/production/components/ProgressBar/CircularProgressBar.web.js.map +1 -0
- package/build/lib/web/production/components/ProgressBar/CircularProgressLabel.js +38 -0
- package/build/lib/web/production/components/ProgressBar/CircularProgressLabel.js.map +1 -0
- package/build/lib/web/production/components/ProgressBar/ProgressBar.js +47 -10
- package/build/lib/web/production/components/ProgressBar/ProgressBar.js.map +1 -1
- package/build/lib/web/production/components/ProgressBar/ProgressBarFilled.web.js +6 -6
- package/build/lib/web/production/components/ProgressBar/ProgressBarFilled.web.js.map +1 -1
- package/build/lib/web/production/components/ProgressBar/progressBarTokens.js +45 -1
- package/build/lib/web/production/components/ProgressBar/progressBarTokens.js.map +1 -1
- package/build/lib/web/production/components/Tag/AnimatedTag.web.js +2 -3
- package/build/lib/web/production/components/Tag/AnimatedTag.web.js.map +1 -1
- package/build/lib/web/production/components/Tag/Tag.js +5 -6
- package/build/lib/web/production/components/Tag/Tag.js.map +1 -1
- package/build/lib/web/production/components/Tag/getTagsGroup.js +1 -1
- package/build/lib/web/production/components/Tag/getTagsGroup.js.map +1 -1
- package/build/lib/web/production/components/Tag/tagAnimationConfig.js +4 -2
- package/build/lib/web/production/components/Tag/tagAnimationConfig.js.map +1 -1
- package/build/lib/web/production/components/Typography/BaseText/getBaseTextStyles.js +2 -1
- package/build/lib/web/production/components/Typography/BaseText/getBaseTextStyles.js.map +1 -1
- package/build/lib/web/production/tokens/global/size.js +4 -0
- package/build/lib/web/production/tokens/global/size.js.map +1 -1
- package/build/types/components/index.d.ts +30 -8
- package/build/types/components/index.native.d.ts +22 -8
- package/build/types/tokens/index.d.ts +4 -0
- package/build/types/tokens/index.native.d.ts +4 -0
- package/codemods/migrate-progressbar/transformers/__test__/migrate-progressbar.test.ts +28 -0
- package/codemods/migrate-progressbar/transformers/index.ts +89 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","sources":["../../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type { BladeElementRef } from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leadingIcon` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n} & StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n ...styledProps\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRef>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? value)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n maxCharacters={maxCharacters}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n onChange?.({ name, value });\n }}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={maxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...styledProps}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","styledProps","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseInput","_objectSpread","id","componentName","MetaConstants","TextInput","hideLabelText","_ref2","length","trailingInteractionElement","trailingFooterSlot","_value$length","BaseBox","marginTop","hintMarginTop","marginRight","children","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,UAA2E,GAAG,SAA9EA,UAA2EA,CAAAC,IAAA,EAuC/EC,GAAG,EACc;AAAA,EAAA,IAtCfC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,kBAAkB,GAAAH,IAAA,CAAlBG,kBAAkB;IAAAC,kBAAA,GAAAJ,IAAA,CAClBK,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAN,IAAA,CAAXM,WAAW;IAAAC,SAAA,GAAAP,IAAA,CACXQ,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,MAAM,GAAAA,SAAA;IACbE,YAAY,GAAAT,IAAA,CAAZS,YAAY;IACZC,IAAI,GAAAV,IAAA,CAAJU,IAAI;IACJC,KAAK,GAAAX,IAAA,CAALW,KAAK;IACLC,aAAa,GAAAZ,IAAA,CAAbY,aAAa;IACbC,SAAQ,GAAAb,IAAA,CAARa,QAAQ;IACRC,OAAO,GAAAd,IAAA,CAAPc,OAAO;IACPC,OAAO,GAAAf,IAAA,CAAPe,OAAO;IACPC,MAAM,GAAAhB,IAAA,CAANgB,MAAM;IACNC,QAAQ,GAAAjB,IAAA,CAARiB,QAAQ;IACRC,UAAU,GAAAlB,IAAA,CAAVkB,UAAU;IACVC,kBAAkB,GAAAnB,IAAA,CAAlBmB,kBAAkB;IAClBC,eAAe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"file":"TextInput.js","sources":["../../../../../../../src/components/Input/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport type { TextInput as TextInputReactNative } from 'react-native';\nimport type { BaseInputProps } from '../BaseInput';\nimport { BaseInput } from '../BaseInput';\nimport { getKeyboardAndAutocompleteProps } from '../BaseInput/utils';\nimport type { TaggedInputProps } from '../BaseInput/useTaggedInput';\nimport { useTaggedInput } from '../BaseInput/useTaggedInput';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport type { IconComponent } from '~components/Icons';\nimport { CloseIcon } from '~components/Icons';\nimport { IconButton } from '~components/Button/IconButton';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { CharacterCounter } from '~components/Form/CharacterCounter';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Spinner } from '~components/Spinner';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType } from '~utils';\nimport { useMergeRefs } from '~utils/useMergeRefs';\nimport type { BladeElementRef, BladeElementRefWithValue } from '~utils/types';\nimport { hintMarginTop } from '~components/Form/formTokens';\n\n// Users should use PasswordInput for input type password\ntype Type = Exclude<BaseInputProps['type'], 'password'>;\n\ntype TextInputCommonProps = Pick<\n BaseInputProps,\n | 'label'\n | 'accessibilityLabel'\n | 'labelPosition'\n | 'necessityIndicator'\n | 'validationState'\n | 'helpText'\n | 'errorText'\n | 'successText'\n | 'placeholder'\n | 'defaultValue'\n | 'name'\n | 'onChange'\n | 'onFocus'\n | 'onBlur'\n | 'value'\n | 'isDisabled'\n | 'isRequired'\n | 'prefix'\n | 'suffix'\n | 'maxCharacters'\n | 'autoFocus'\n | 'keyboardReturnKeyType'\n | 'autoCompleteSuggestionType'\n | 'onSubmit'\n | 'autoCapitalize'\n | 'testID'\n | 'onClick'\n | 'size'\n | 'leadingIcon'\n | 'trailingButton'\n | 'trailingIcon'\n> & {\n /**\n * Decides whether to render a clear icon button\n */\n showClearButton?: boolean;\n\n /**\n * Event handler to handle the onClick event for clear button. Used when `showClearButton` is `true`\n */\n onClearButtonClick?: () => void;\n\n /**\n * Decides whether to show a loading spinner for the input field.\n */\n isLoading?: boolean;\n\n /**\n * Icon that will be rendered at the beginning of the input field\n * @deprecated Use `leadingIcon` instead. This prop will be removed in the next major version.\n */\n icon?: IconComponent;\n /**\n * Type of Input Field to be rendered. Use `PasswordInput` for type `password`\n *\n *\n * **Note on number type**\n *\n * `type=\"number\"` internally uses `inputMode=\"numeric\"` instead of HTML's `type=\"number\"` which also allows text characters.\n * If you have a usecase where you only want to support number input, you can handle it on validations end.\n *\n * Check out [Why the GOV.UK Design System team changed the input type for numbers](https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/) for reasoning\n *\n * @default text\n */\n type?: Type;\n} & TaggedInputProps &\n StyledPropsBlade;\n\n/*\n Mandatory accessibilityLabel prop when label is not provided\n*/\ntype TextInputPropsWithA11yLabel = {\n /**\n * Label to be shown for the input field\n */\n label?: undefined;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel: string;\n};\n\n/*\n Optional accessibilityLabel prop when label is provided\n*/\ntype TextInputPropsWithLabel = {\n /**\n * Label to be shown for the input field\n */\n label: string;\n /**\n * Accessibility label for the input\n */\n accessibilityLabel?: string;\n};\n\ntype TextInputProps = (TextInputPropsWithA11yLabel | TextInputPropsWithLabel) &\n TextInputCommonProps;\n\n// need to do this to tell TS to infer type as TextInput of React Native and make it believe that `ref.current.clear()` exists\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst isReactNative = (_textInputRef: any): _textInputRef is TextInputReactNative => {\n return getPlatformType() === 'react-native';\n};\n\nconst _TextInput: React.ForwardRefRenderFunction<BladeElementRef, TextInputProps> = (\n {\n label,\n accessibilityLabel,\n labelPosition = 'top',\n placeholder,\n type = 'text',\n defaultValue,\n name,\n value,\n maxCharacters,\n onChange,\n onClick,\n onFocus,\n onBlur,\n onSubmit,\n isDisabled,\n necessityIndicator,\n validationState,\n errorText,\n helpText,\n successText,\n isRequired,\n icon,\n prefix,\n showClearButton,\n onClearButtonClick,\n isLoading,\n suffix,\n autoFocus,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n testID,\n size = 'medium',\n leadingIcon,\n trailingIcon,\n isTaggedInput,\n tags,\n onTagChange,\n ...styledProps\n },\n ref,\n): ReactElement => {\n const textInputRef = React.useRef<BladeElementRefWithValue>(null);\n const mergedRef = useMergeRefs(ref, textInputRef);\n const [shouldShowClearButton, setShouldShowClearButton] = useState(false);\n const [isInputFocussed, setIsInputFocussed] = useState(autoFocus ?? false);\n const {\n activeTagIndex,\n setActiveTagIndex,\n getTags,\n handleTaggedInputKeydown,\n handleTaggedInputChange,\n handleTagsClear,\n } = useTaggedInput({\n isTaggedInput,\n tags,\n onTagChange,\n isDisabled,\n onChange,\n name,\n value,\n inputRef: textInputRef,\n });\n\n React.useEffect(() => {\n setShouldShowClearButton(Boolean(showClearButton && (defaultValue ?? value)));\n }, [showClearButton, defaultValue, value]);\n\n const renderInteractionElement = (): ReactNode => {\n if (isLoading) {\n return <Spinner accessibilityLabel=\"Loading Content\" color=\"primary\" />;\n }\n\n if (shouldShowClearButton) {\n return (\n <IconButton\n size=\"medium\"\n icon={CloseIcon}\n onClick={() => {\n if (isEmpty(value) && textInputRef.current) {\n // when the input field is uncontrolled take the ref and clear the input and then call the onClearButtonClick function\n if (isReactNative(textInputRef.current)) {\n textInputRef.current.clear();\n textInputRef.current.focus();\n } else if (textInputRef.current instanceof HTMLInputElement) {\n textInputRef.current.value = '';\n textInputRef.current.focus();\n }\n }\n handleTagsClear();\n // if the input field is controlled just call the click handler and the value change shall be left upto the consumer\n onClearButtonClick?.();\n textInputRef?.current?.focus();\n setShouldShowClearButton(false);\n }}\n isDisabled={isDisabled}\n accessibilityLabel=\"Clear Input Content\"\n />\n );\n }\n\n return null;\n };\n\n return (\n <BaseInput\n id=\"textinput\"\n componentName={MetaConstants.TextInput}\n ref={mergedRef}\n label={label as string}\n accessibilityLabel={accessibilityLabel}\n hideLabelText={!Boolean(label)}\n labelPosition={labelPosition}\n placeholder={placeholder}\n defaultValue={defaultValue}\n value={value}\n name={name}\n maxCharacters={maxCharacters}\n isDropdownTrigger={isTaggedInput}\n tags={isTaggedInput ? getTags({ size }) : undefined}\n showAllTags={isInputFocussed}\n maxTagRows=\"single\"\n activeTagIndex={activeTagIndex}\n setActiveTagIndex={setActiveTagIndex}\n onChange={({ name, value }) => {\n if (showClearButton && value?.length) {\n // show the clear button when the user starts typing in\n setShouldShowClearButton(true);\n }\n\n if (shouldShowClearButton && !value?.length) {\n // hide the clear button when the input field is empty\n setShouldShowClearButton(false);\n }\n\n handleTaggedInputChange({ name, value });\n onChange?.({ name, value });\n }}\n onClick={onClick}\n onFocus={(e) => {\n setIsInputFocussed(true);\n onFocus?.(e);\n }}\n onBlur={(e) => {\n setIsInputFocussed(false);\n onBlur?.(e);\n }}\n onKeyDown={(e) => {\n handleTaggedInputKeydown(e);\n }}\n onSubmit={onSubmit}\n isDisabled={isDisabled}\n necessityIndicator={necessityIndicator}\n isRequired={isRequired}\n leadingIcon={leadingIcon ?? icon}\n prefix={prefix}\n trailingInteractionElement={renderInteractionElement()}\n trailingIcon={trailingIcon}\n suffix={suffix}\n validationState={validationState}\n errorText={errorText}\n helpText={helpText}\n successText={successText}\n trailingFooterSlot={(value) => {\n return maxCharacters ? (\n <BaseBox marginTop={hintMarginTop[size]} marginRight=\"spacing.1\">\n <CharacterCounter\n currentCount={value?.length ?? 0}\n maxCount={maxCharacters}\n size={size}\n />\n </BaseBox>\n ) : null;\n }}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={autoFocus}\n testID={testID}\n {...getKeyboardAndAutocompleteProps({\n type,\n keyboardReturnKeyType,\n autoCompleteSuggestionType,\n autoCapitalize,\n })}\n size={size}\n {...styledProps}\n />\n );\n};\n\nconst TextInput = assignWithoutSideEffects(React.forwardRef(_TextInput), {\n displayName: 'TextInput',\n});\n\nexport type { TextInputProps };\nexport { TextInput };\n"],"names":["isReactNative","_textInputRef","getPlatformType","_TextInput","_ref","ref","label","accessibilityLabel","_ref$labelPosition","labelPosition","placeholder","_ref$type","type","defaultValue","name","value","maxCharacters","onChange","onClick","onFocus","onBlur","onSubmit","isDisabled","necessityIndicator","validationState","errorText","helpText","successText","isRequired","icon","prefix","showClearButton","onClearButtonClick","isLoading","suffix","autoFocus","keyboardReturnKeyType","autoCompleteSuggestionType","autoCapitalize","testID","_ref$size","size","leadingIcon","trailingIcon","isTaggedInput","tags","onTagChange","styledProps","_objectWithoutProperties","_excluded","textInputRef","React","useRef","mergedRef","useMergeRefs","_useState","useState","_useState2","_slicedToArray","shouldShowClearButton","setShouldShowClearButton","_useState3","_useState4","isInputFocussed","setIsInputFocussed","_useTaggedInput","useTaggedInput","inputRef","activeTagIndex","setActiveTagIndex","getTags","handleTaggedInputKeydown","handleTaggedInputChange","handleTagsClear","useEffect","Boolean","renderInteractionElement","_jsx","Spinner","color","IconButton","CloseIcon","_textInputRef$current","isEmpty","current","clear","focus","HTMLInputElement","BaseInput","_objectSpread","id","componentName","MetaConstants","TextInput","hideLabelText","isDropdownTrigger","undefined","showAllTags","maxTagRows","_ref2","length","e","onKeyDown","trailingInteractionElement","trailingFooterSlot","_value$length","BaseBox","marginTop","hintMarginTop","marginRight","children","CharacterCounter","currentCount","maxCount","getKeyboardAndAutocompleteProps","assignWithoutSideEffects","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgIA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,aAAkB,EAA4C;AACnF,EAAA,OAAOC,eAAe,EAAE,KAAK,cAAc,CAAA;AAC7C,CAAC,CAAA;AAED,IAAMC,UAA2E,GAAG,SAA9EA,UAA2EA,CAAAC,IAAA,EA0C/EC,GAAG,EACc;AAAA,EAAA,I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C,CAAC,CAAA,EAAA,EAAA,EAAA;AACFG,IAAAA,IAAI,EAAEA,IAAAA;GACFM,EAAAA,WAAW,CAChB,CAAC,CAAA;AAEN,CAAC,CAAA;AAEK8C,IAAAA,SAAS,gBAAGsB,wBAAwB,eAAChE,cAAK,CAACiE,UAAU,CAACjH,UAAU,CAAC,EAAE;AACvEkH,EAAAA,WAAW,EAAE,WAAA;AACf,CAAC;;;;"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import styled, { keyframes, css } from 'styled-components';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { pulseAnimation, getCircularProgressSVGTokens, circularProgressSizeTokens } from './progressBarTokens.js';
|
|
5
|
+
import { CircularProgressLabel } from './CircularProgressLabel.js';
|
|
6
|
+
import getIn from '../../utils/lodashButBetter/get.js';
|
|
7
|
+
import '../Box/BaseBox/index.js';
|
|
8
|
+
import '../../utils/index.js';
|
|
9
|
+
import '../../utils/makeMotionTime/index.web.js';
|
|
10
|
+
import '../Typography/index.js';
|
|
11
|
+
import '../Icons/_Svg/index.js';
|
|
12
|
+
import getBaseTextStyles from '../Typography/BaseText/getBaseTextStyles.js';
|
|
13
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
|
+
import { getTextProps } from '../Typography/Text/Text.js';
|
|
15
|
+
import { castWebType } from '../../utils/platform/castUtils.js';
|
|
16
|
+
import { makeMotionTime } from '../../utils/makeMotionTime/makeMotionTime.web.js';
|
|
17
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
18
|
+
import Svg from '../Icons/_Svg/Svg/Svg.web.js';
|
|
19
|
+
import Circle from '../Icons/_Svg/Circle/Circle.web.js';
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
var pulseKeyframes = /*#__PURE__*/keyframes(["0%{opacity:100;}50%{opacity:0.65;}100%{opacity:100;}"]);
|
|
24
|
+
var getPulseAnimationStyles = function getPulseAnimationStyles(_ref) {
|
|
25
|
+
var duration = _ref.duration,
|
|
26
|
+
easing = _ref.easing,
|
|
27
|
+
progressPercent = _ref.progressPercent,
|
|
28
|
+
isMeter = _ref.isMeter;
|
|
29
|
+
if (isMeter || progressPercent === 100) {
|
|
30
|
+
return css(["height:100%;width:100%;transition:stroke-dashoffset ", " ", ";"], duration, easing);
|
|
31
|
+
}
|
|
32
|
+
return css(["height:100%;width:100%;opacity:", ";background-color:", ";transition:stroke-dashoffset ", " ", ";animation:", " ", " ", " infinite;"], pulseAnimation.opacityInitial, pulseAnimation.backgroundColor, duration, easing, pulseKeyframes, duration, easing);
|
|
33
|
+
};
|
|
34
|
+
var StyledSVGText = /*#__PURE__*/styled.text.withConfig({
|
|
35
|
+
displayName: "CircularProgressBarweb__StyledSVGText",
|
|
36
|
+
componentId: "h4xj3g-0"
|
|
37
|
+
})(function (_ref2) {
|
|
38
|
+
var theme = _ref2.theme,
|
|
39
|
+
size = _ref2.size,
|
|
40
|
+
weight = _ref2.weight;
|
|
41
|
+
return getBaseTextStyles(_objectSpread({
|
|
42
|
+
theme: theme
|
|
43
|
+
}, getTextProps({
|
|
44
|
+
variant: 'body',
|
|
45
|
+
size: size,
|
|
46
|
+
weight: weight
|
|
47
|
+
})));
|
|
48
|
+
});
|
|
49
|
+
var DeterminatePulseAnimation = /*#__PURE__*/styled.circle.withConfig({
|
|
50
|
+
displayName: "CircularProgressBarweb__DeterminatePulseAnimation",
|
|
51
|
+
componentId: "h4xj3g-1"
|
|
52
|
+
})(function (_ref3) {
|
|
53
|
+
var theme = _ref3.theme,
|
|
54
|
+
pulseMotionDuration = _ref3.pulseMotionDuration,
|
|
55
|
+
motionEasing = _ref3.motionEasing,
|
|
56
|
+
progressPercent = _ref3.progressPercent,
|
|
57
|
+
isMeter = _ref3.isMeter;
|
|
58
|
+
var duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));
|
|
59
|
+
var easing = castWebType(getIn(theme.motion, motionEasing));
|
|
60
|
+
return getPulseAnimationStyles({
|
|
61
|
+
duration: duration,
|
|
62
|
+
easing: easing,
|
|
63
|
+
progressPercent: progressPercent,
|
|
64
|
+
isMeter: isMeter
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
var CircularProgressBarFilled = function CircularProgressBarFilled(_ref4) {
|
|
68
|
+
var progressPercent = _ref4.progressPercent,
|
|
69
|
+
fillColor = _ref4.fillColor,
|
|
70
|
+
backgroundColor = _ref4.backgroundColor,
|
|
71
|
+
_ref4$size = _ref4.size,
|
|
72
|
+
size = _ref4$size === void 0 ? 'small' : _ref4$size,
|
|
73
|
+
label = _ref4.label,
|
|
74
|
+
_ref4$showPercentage = _ref4.showPercentage,
|
|
75
|
+
showPercentage = _ref4$showPercentage === void 0 ? true : _ref4$showPercentage,
|
|
76
|
+
isMeter = _ref4.isMeter;
|
|
77
|
+
var _getCircularProgressS = getCircularProgressSVGTokens({
|
|
78
|
+
size: size,
|
|
79
|
+
progressPercent: progressPercent
|
|
80
|
+
}),
|
|
81
|
+
sqSize = _getCircularProgressS.sqSize,
|
|
82
|
+
strokeWidth = _getCircularProgressS.strokeWidth,
|
|
83
|
+
radius = _getCircularProgressS.radius,
|
|
84
|
+
viewBox = _getCircularProgressS.viewBox,
|
|
85
|
+
dashArray = _getCircularProgressS.dashArray,
|
|
86
|
+
dashOffset = _getCircularProgressS.dashOffset;
|
|
87
|
+
return /*#__PURE__*/jsxs(BaseBox, {
|
|
88
|
+
width: "fit-content",
|
|
89
|
+
textAlign: "center",
|
|
90
|
+
display: "flex",
|
|
91
|
+
flexDirection: "column",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
children: [/*#__PURE__*/jsxs(Svg, {
|
|
94
|
+
width: String(sqSize),
|
|
95
|
+
height: String(sqSize),
|
|
96
|
+
viewBox: viewBox,
|
|
97
|
+
children: [/*#__PURE__*/jsx(Circle, {
|
|
98
|
+
fill: "none",
|
|
99
|
+
stroke: backgroundColor,
|
|
100
|
+
cx: String(sqSize / 2),
|
|
101
|
+
cy: String(sqSize / 2),
|
|
102
|
+
r: String(radius),
|
|
103
|
+
strokeWidth: "".concat(strokeWidth, "px")
|
|
104
|
+
}), /*#__PURE__*/jsx(DeterminatePulseAnimation, {
|
|
105
|
+
progressPercent: progressPercent,
|
|
106
|
+
isMeter: isMeter,
|
|
107
|
+
fill: "none",
|
|
108
|
+
stroke: fillColor,
|
|
109
|
+
cx: sqSize / 2,
|
|
110
|
+
cy: sqSize / 2,
|
|
111
|
+
r: radius,
|
|
112
|
+
strokeWidth: "".concat(strokeWidth, "px")
|
|
113
|
+
// Start progress marker at 12 O'Clock
|
|
114
|
+
,
|
|
115
|
+
transform: "rotate(-90 ".concat(sqSize / 2, " ").concat(sqSize / 2, ")"),
|
|
116
|
+
strokeDasharray: dashArray,
|
|
117
|
+
strokeDashoffset: dashOffset,
|
|
118
|
+
pulseMotionDuration: "duration.2xgentle",
|
|
119
|
+
pulseMotionDelay: "delay.long",
|
|
120
|
+
motionEasing: "easing.standard.revealing"
|
|
121
|
+
}), showPercentage && size !== 'small' && /*#__PURE__*/jsxs(StyledSVGText, {
|
|
122
|
+
size: circularProgressSizeTokens[size].percentTextSize,
|
|
123
|
+
weight: "semibold",
|
|
124
|
+
x: "50%",
|
|
125
|
+
y: "50%",
|
|
126
|
+
textAnchor: "middle",
|
|
127
|
+
dy: ".4em",
|
|
128
|
+
children: [progressPercent, "%"]
|
|
129
|
+
})]
|
|
130
|
+
}), /*#__PURE__*/jsx(CircularProgressLabel, {
|
|
131
|
+
progressPercent: progressPercent,
|
|
132
|
+
size: size,
|
|
133
|
+
label: label,
|
|
134
|
+
showPercentage: showPercentage
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export { CircularProgressBarFilled };
|
|
140
|
+
//# sourceMappingURL=CircularProgressBar.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CircularProgressBar.web.js","sources":["../../../../../../src/components/ProgressBar/CircularProgressBar.web.tsx"],"sourcesContent":["import type { FlattenSimpleInterpolation } from 'styled-components';\nimport styled, { css, keyframes } from 'styled-components';\nimport React from 'react';\nimport type { CircularProgressBarFilledProps } from './types';\nimport {\n pulseAnimation,\n circularProgressSizeTokens,\n getCircularProgressSVGTokens,\n} from './progressBarTokens';\nimport { CircularProgressLabel } from './CircularProgressLabel';\nimport getIn from '~utils/lodashButBetter/get';\nimport BaseBox from '~components/Box/BaseBox';\nimport { castWebType } from '~utils';\nimport { makeMotionTime } from '~utils/makeMotionTime';\nimport type { TextProps } from '~components/Typography';\nimport { getTextProps } from '~components/Typography';\nimport { Svg, Circle } from '~components/Icons/_Svg';\nimport getBaseTextStyles from '~components/Typography/BaseText/getBaseTextStyles';\n\nconst pulseKeyframes = keyframes`\n 0% {\n opacity: 100;\n }\n 50% {\n opacity: 0.65;\n }\n 100% {\n opacity: 100;\n }\n`;\n\nconst getPulseAnimationStyles = ({\n duration,\n easing,\n progressPercent,\n isMeter,\n}: {\n duration: string;\n easing: string;\n progressPercent: number;\n isMeter: boolean;\n}): FlattenSimpleInterpolation => {\n if (isMeter || progressPercent === 100) {\n return css`\n height: 100%;\n width: 100%;\n transition: stroke-dashoffset ${duration} ${easing};\n `;\n }\n\n return css`\n height: 100%;\n width: 100%;\n opacity: ${pulseAnimation.opacityInitial};\n background-color: ${pulseAnimation.backgroundColor};\n transition: stroke-dashoffset ${duration} ${easing};\n animation: ${pulseKeyframes} ${duration} ${easing} infinite;\n `;\n};\n\nconst StyledSVGText = styled.text<Pick<TextProps<{ variant: 'body' }>, 'size' | 'weight'>>(\n ({ theme, size, weight }) => {\n return getBaseTextStyles({\n theme,\n ...getTextProps({ variant: 'body', size, weight }),\n });\n },\n);\n\nconst DeterminatePulseAnimation = styled.circle<\n Pick<\n CircularProgressBarFilledProps,\n 'pulseMotionDuration' | 'pulseMotionDelay' | 'motionEasing' | 'progressPercent' | 'isMeter'\n >\n>(({ theme, pulseMotionDuration, motionEasing, progressPercent, isMeter }) => {\n const duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));\n const easing = castWebType(getIn(theme.motion, motionEasing));\n\n return getPulseAnimationStyles({\n duration,\n easing,\n progressPercent,\n isMeter,\n });\n});\n\nconst CircularProgressBarFilled = ({\n progressPercent,\n fillColor,\n backgroundColor,\n size = 'small',\n label,\n showPercentage = true,\n isMeter,\n}: CircularProgressBarFilledProps): React.ReactElement => {\n const {\n sqSize,\n strokeWidth,\n radius,\n viewBox,\n dashArray,\n dashOffset,\n } = getCircularProgressSVGTokens({ size, progressPercent });\n\n return (\n <BaseBox\n width=\"fit-content\"\n textAlign=\"center\"\n display=\"flex\"\n flexDirection=\"column\"\n alignItems=\"center\"\n >\n <Svg width={String(sqSize)} height={String(sqSize)} viewBox={viewBox}>\n <Circle\n fill=\"none\"\n stroke={backgroundColor}\n cx={String(sqSize / 2)}\n cy={String(sqSize / 2)}\n r={String(radius)}\n strokeWidth={`${strokeWidth}px`}\n />\n\n <DeterminatePulseAnimation\n progressPercent={progressPercent}\n isMeter={isMeter}\n fill=\"none\"\n stroke={fillColor}\n cx={sqSize / 2}\n cy={sqSize / 2}\n r={radius}\n strokeWidth={`${strokeWidth}px`}\n // Start progress marker at 12 O'Clock\n transform={`rotate(-90 ${sqSize / 2} ${sqSize / 2})`}\n strokeDasharray={dashArray}\n strokeDashoffset={dashOffset}\n pulseMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n />\n {showPercentage && size !== 'small' && (\n <StyledSVGText\n size={circularProgressSizeTokens[size].percentTextSize}\n weight=\"semibold\"\n x=\"50%\"\n y=\"50%\"\n textAnchor=\"middle\"\n dy=\".4em\"\n >\n {progressPercent}%\n </StyledSVGText>\n )}\n </Svg>\n\n <CircularProgressLabel\n progressPercent={progressPercent}\n size={size}\n label={label}\n showPercentage={showPercentage}\n />\n </BaseBox>\n );\n};\n\nexport { CircularProgressBarFilled };\n"],"names":["pulseKeyframes","keyframes","getPulseAnimationStyles","_ref","duration","easing","progressPercent","isMeter","css","pulseAnimation","opacityInitial","backgroundColor","StyledSVGText","styled","text","withConfig","displayName","componentId","_ref2","theme","size","weight","getBaseTextStyles","_objectSpread","getTextProps","variant","DeterminatePulseAnimation","circle","_ref3","pulseMotionDuration","motionEasing","castWebType","makeMotionTime","getIn","motion","CircularProgressBarFilled","_ref4","fillColor","_ref4$size","label","_ref4$showPercentage","showPercentage","_getCircularProgressS","getCircularProgressSVGTokens","sqSize","strokeWidth","radius","viewBox","dashArray","dashOffset","_jsxs","BaseBox","width","textAlign","display","flexDirection","alignItems","children","Svg","String","height","_jsx","Circle","fill","stroke","cx","cy","r","concat","transform","strokeDasharray","strokeDashoffset","pulseMotionDelay","circularProgressSizeTokens","percentTextSize","x","y","textAnchor","dy","CircularProgressLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmBA,IAAMA,cAAc,gBAAGC,SAAS,CAU/B,CAAA,sDAAA,CAAA,CAAA,CAAA;AAED,IAAMC,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAAC,IAAA,EAUK;AAAA,EAAA,IAThCC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,eAAe,GAAA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c,EAAEA,cAAAA;AAAe,KAChC,CAAC,CAAA;AAAA,GACK,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../Box/BaseBox/index.js';
|
|
3
|
+
import '../Typography/index.js';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
6
|
+
import { Text } from '../Typography/Text/Text.js';
|
|
7
|
+
|
|
8
|
+
var CircularProgressLabel = function CircularProgressLabel(_ref) {
|
|
9
|
+
var _label$trim;
|
|
10
|
+
var progressPercent = _ref.progressPercent,
|
|
11
|
+
_ref$size = _ref.size,
|
|
12
|
+
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
13
|
+
label = _ref.label,
|
|
14
|
+
_ref$showPercentage = _ref.showPercentage,
|
|
15
|
+
showPercentage = _ref$showPercentage === void 0 ? true : _ref$showPercentage;
|
|
16
|
+
var hasLabel = label && ((_label$trim = label.trim()) === null || _label$trim === void 0 ? void 0 : _label$trim.length) > 0;
|
|
17
|
+
return /*#__PURE__*/jsxs(BaseBox, {
|
|
18
|
+
display: "flex",
|
|
19
|
+
flexDirection: "column",
|
|
20
|
+
alignItems: "center",
|
|
21
|
+
children: [hasLabel && /*#__PURE__*/jsx(Text, {
|
|
22
|
+
marginTop: "spacing.3",
|
|
23
|
+
variant: "body",
|
|
24
|
+
weight: "regular",
|
|
25
|
+
size: "small",
|
|
26
|
+
children: label
|
|
27
|
+
}), showPercentage && size === 'small' && /*#__PURE__*/jsxs(Text, {
|
|
28
|
+
marginTop: hasLabel ? 'spacing.0' : 'spacing.3',
|
|
29
|
+
variant: "body",
|
|
30
|
+
weight: "semibold",
|
|
31
|
+
size: "small",
|
|
32
|
+
children: [progressPercent, "%"]
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { CircularProgressLabel };
|
|
38
|
+
//# sourceMappingURL=CircularProgressLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CircularProgressLabel.js","sources":["../../../../../../src/components/ProgressBar/CircularProgressLabel.tsx"],"sourcesContent":["import React from 'react';\nimport type { CircularProgressBarFilledProps } from './types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\n\nconst CircularProgressLabel = ({\n progressPercent,\n size = 'small',\n label,\n showPercentage = true,\n}: Pick<\n CircularProgressBarFilledProps,\n 'progressPercent' | 'size' | 'label' | 'showPercentage'\n>): React.ReactElement => {\n const hasLabel = label && label.trim()?.length > 0;\n\n return (\n <BaseBox display=\"flex\" flexDirection=\"column\" alignItems=\"center\">\n {hasLabel && (\n <Text marginTop=\"spacing.3\" variant=\"body\" weight=\"regular\" size=\"small\">\n {label}\n </Text>\n )}\n\n {showPercentage && size === 'small' && (\n <Text\n marginTop={hasLabel ? 'spacing.0' : 'spacing.3'}\n variant=\"body\"\n weight=\"semibold\"\n size=\"small\"\n >\n {progressPercent}%\n </Text>\n )}\n </BaseBox>\n );\n};\n\nexport { CircularProgressLabel };\n"],"names":["CircularProgressLabel","_ref","_label$trim","progressPercent","_ref$size","size","label","_ref$showPercentage","showPercentage","hasLabel","trim","length","_jsxs","BaseBox","display","flexDirection","alignItems","children","_jsx","Text","marginTop","variant","weight"],"mappings":";;;;;;;AAKA,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,EAQD;AAAA,EAAA,IAAAC,WAAA,CAAA;AAAA,EAAA,IAPxBC,eAAe,GAAAF,IAAA,CAAfE,eAAe;IAAAC,SAAA,GAAAH,IAAA,CACfI,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,SAAA;IACdE,KAAK,GAAAL,IAAA,CAALK,KAAK;IAAAC,mBAAA,GAAAN,IAAA,CACLO,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA,CAAA;AAKrB,EAAA,IAAME,QAAQ,GAAGH,KAAK,IAAI,CAAAJ,CAAAA,WAAA,GAAAI,KAAK,CAACI,IAAI,EAAE,cAAAR,WAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAZA,WAAA,CAAcS,MAAM,IAAG,CAAC,CAAA;EAElD,oBACEC,IAAA,CAACC,OAAO,EAAA;AAACC,IAAAA,OAAO,EAAC,MAAM;AAACC,IAAAA,aAAa,EAAC,QAAQ;AAACC,IAAAA,UAAU,EAAC,QAAQ;AAAAC,IAAAA,QAAA,EAC/DR,CAAAA,QAAQ,iBACPS,GAAA,CAACC,IAAI,EAAA;AAACC,MAAAA,SAAS,EAAC,WAAW;AAACC,MAAAA,OAAO,EAAC,MAAM;AAACC,MAAAA,MAAM,EAAC,SAAS;AAACjB,MAAAA,IAAI,EAAC,OAAO;AAAAY,MAAAA,QAAA,EACrEX,KAAAA;KACG,CACP,EAEAE,cAAc,IAAIH,IAAI,KAAK,OAAO,iBACjCO,IAAA,CAACO,IAAI,EAAA;AACHC,MAAAA,SAAS,EAAEX,QAAQ,GAAG,WAAW,GAAG,WAAY;AAChDY,MAAAA,OAAO,EAAC,MAAM;AACdC,MAAAA,MAAM,EAAC,UAAU;AACjBjB,MAAAA,IAAI,EAAC,OAAO;MAAAY,QAAA,EAAA,CAEXd,eAAe,EAAC,GACnB,CAAA;AAAA,KAAM,CACP,CAAA;AAAA,GACM,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
3
|
import { ProgressBarFilled } from './ProgressBarFilled.web.js';
|
|
4
|
+
import { CircularProgressBarFilled } from './CircularProgressBar.web.js';
|
|
4
5
|
import clamp from '../../utils/lodashButBetter/clamp.js';
|
|
5
6
|
import '../../utils/metaAttribute/index.js';
|
|
6
7
|
import '../Typography/Text/index.js';
|
|
@@ -24,17 +25,20 @@ import { Text } from '../Typography/Text/Text.js';
|
|
|
24
25
|
import { makeAccessible } from '../../utils/makeAccessible/makeAccessible.web.js';
|
|
25
26
|
import { makeSize } from '../../utils/makeSize/makeSize.js';
|
|
26
27
|
|
|
27
|
-
var _excluded = ["accessibilityLabel", "color", "isIndeterminate", "label", "showPercentage", "size", "value", "variant", "min", "max", "testID"];
|
|
28
|
+
var _excluded = ["accessibilityLabel", "color", "type", "isIndeterminate", "label", "showPercentage", "size", "value", "variant", "min", "max", "testID"];
|
|
28
29
|
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; }
|
|
29
30
|
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; }
|
|
30
31
|
var progressBarHeight = {
|
|
31
32
|
small: size[2],
|
|
32
|
-
medium: size[4]
|
|
33
|
+
medium: size[4],
|
|
34
|
+
// Large size isn't available when variant is 'linear'
|
|
35
|
+
large: size[0]
|
|
33
36
|
};
|
|
34
37
|
var ProgressBar = function ProgressBar(_ref) {
|
|
35
38
|
var _label$trim;
|
|
36
39
|
var accessibilityLabel = _ref.accessibilityLabel,
|
|
37
40
|
color = _ref.color,
|
|
41
|
+
type = _ref.type,
|
|
38
42
|
_ref$isIndeterminate = _ref.isIndeterminate,
|
|
39
43
|
isIndeterminate = _ref$isIndeterminate === void 0 ? false : _ref$isIndeterminate,
|
|
40
44
|
label = _ref.label,
|
|
@@ -54,19 +58,40 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
54
58
|
styledProps = _objectWithoutProperties(_ref, _excluded);
|
|
55
59
|
var _useTheme = useTheme(),
|
|
56
60
|
theme = _useTheme.theme;
|
|
57
|
-
var
|
|
61
|
+
var progressType = !type && (variant === 'meter' || variant === 'progress') ? variant : type;
|
|
62
|
+
var progressVariant = variant === 'meter' || variant === 'progress' ? 'linear' : variant;
|
|
63
|
+
var id = useId("".concat(progressType, "-").concat(progressVariant));
|
|
58
64
|
if (true) {
|
|
59
|
-
if (
|
|
65
|
+
if (progressType === 'meter' && isIndeterminate) {
|
|
60
66
|
throwBladeError({
|
|
61
67
|
moduleName: 'ProgressBar',
|
|
62
|
-
message: "Cannot set 'isIndeterminate' when 'variant' is 'meter'."
|
|
68
|
+
message: "Cannot set 'isIndeterminate' when 'type' or 'variant' is 'meter'."
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (progressVariant === 'circular' && isIndeterminate) {
|
|
72
|
+
throwBladeError({
|
|
73
|
+
moduleName: 'ProgressBar',
|
|
74
|
+
message: "Cannot set 'isIndeterminate' when 'variant' is 'circular'."
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (progressVariant === 'linear' && size === 'large') {
|
|
78
|
+
throwBladeError({
|
|
79
|
+
moduleName: 'ProgressBar',
|
|
80
|
+
message: "Large size isn't available when 'variant' is 'linear'."
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (type && (variant === 'progress' || variant === 'meter')) {
|
|
84
|
+
throwBladeError({
|
|
85
|
+
moduleName: 'ProgressBar',
|
|
86
|
+
message: "variant can only be 'linear' or 'circular' when 'type=".concat(type, "'.")
|
|
63
87
|
});
|
|
64
88
|
}
|
|
65
89
|
}
|
|
66
90
|
var unfilledBackgroundColor = theme.colors.feedback.background.neutral.subtle;
|
|
67
91
|
var filledBackgroundColor = color ? theme.colors.feedback.background[color].intense : theme.colors.surface.background.primary.intense;
|
|
68
92
|
var hasLabel = label && ((_label$trim = label.trim()) === null || _label$trim === void 0 ? void 0 : _label$trim.length) > 0;
|
|
69
|
-
var isMeter =
|
|
93
|
+
var isMeter = progressType === 'meter';
|
|
94
|
+
var isCircular = progressVariant === 'circular';
|
|
70
95
|
var progressValue = clamp(value, min, max);
|
|
71
96
|
var percentageProgressValue = Math.floor((progressValue - min) * 100 / (max - min));
|
|
72
97
|
var shouldShowPercentage = showPercentage && !isMeter && !isIndeterminate;
|
|
@@ -97,7 +122,7 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
97
122
|
display: "flex",
|
|
98
123
|
flexDirection: "column",
|
|
99
124
|
width: "100%",
|
|
100
|
-
children: [/*#__PURE__*/jsxs(BaseBox, {
|
|
125
|
+
children: [!isCircular ? /*#__PURE__*/jsxs(BaseBox, {
|
|
101
126
|
display: "flex",
|
|
102
127
|
flexDirection: "row",
|
|
103
128
|
justifyContent: hasLabel ? 'space-between' : 'flex-end',
|
|
@@ -116,7 +141,7 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
116
141
|
children: "".concat(percentageProgressValue, "%")
|
|
117
142
|
})
|
|
118
143
|
}) : null]
|
|
119
|
-
}), /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({
|
|
144
|
+
}) : null, /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread({
|
|
120
145
|
id: id
|
|
121
146
|
}, makeAccessible({
|
|
122
147
|
role: accessibilityProps.role,
|
|
@@ -126,7 +151,19 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
126
151
|
valueMin: accessibilityProps.valueMin,
|
|
127
152
|
valueMax: accessibilityProps.valueMax
|
|
128
153
|
})), {}, {
|
|
129
|
-
children: /*#__PURE__*/jsx(
|
|
154
|
+
children: isCircular ? /*#__PURE__*/jsx(CircularProgressBarFilled, {
|
|
155
|
+
size: size,
|
|
156
|
+
label: label,
|
|
157
|
+
progressPercent: percentageProgressValue,
|
|
158
|
+
isMeter: isMeter,
|
|
159
|
+
showPercentage: shouldShowPercentage,
|
|
160
|
+
backgroundColor: unfilledBackgroundColor,
|
|
161
|
+
fillColor: filledBackgroundColor,
|
|
162
|
+
pulseMotionDuration: "duration.2xgentle",
|
|
163
|
+
fillMotionDuration: "duration.2xgentle",
|
|
164
|
+
pulseMotionDelay: "delay.long",
|
|
165
|
+
motionEasing: "easing.standard.revealing"
|
|
166
|
+
}) : /*#__PURE__*/jsx(BaseBox, {
|
|
130
167
|
backgroundColor: unfilledBackgroundColor,
|
|
131
168
|
height: makeSize(progressBarHeight[size]),
|
|
132
169
|
overflow: "hidden",
|
|
@@ -139,7 +176,7 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
139
176
|
indeterminateMotionDuration: "duration.2xgentle",
|
|
140
177
|
pulseMotionDelay: "delay.long",
|
|
141
178
|
motionEasing: "easing.standard.revealing",
|
|
142
|
-
|
|
179
|
+
type: progressType,
|
|
143
180
|
isIndeterminate: isIndeterminate
|
|
144
181
|
})
|
|
145
182
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sources":["../../../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { ProgressBarFilled } from './ProgressBarFilled';\nimport clamp from '~utils/lodashButBetter/clamp';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { Text } from '~components/Typography/Text';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useId } from '~utils/useId';\nimport { useTheme } from '~components/BladeProvider';\nimport type { BaseBoxProps } from '~components/Box/BaseBox';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { size } from '~tokens/global';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\ntype ProgressBarCommonProps = {\n /**\n * Sets aria-label to help users know what the progress bar is for. Default value is the same as the `label` passed.\n */\n accessibilityLabel?: string;\n /**\n * Sets the color of the progress bar which changes the feedback color.\n */\n color?: FeedbackColors;\n /**\n * Sets the label to be rendered for the progress bar. This value will also be used as default for `accessibilityLabel`.\n */\n label?: string;\n /**\n * Sets the size of the progress bar.\n * @default 'small'\n */\n size?: 'small' | 'medium';\n /**\n * Sets the progress value of the progress bar.\n * @default 'small'\n */\n value?: number;\n /**\n * Sets the minimum value for the progress bar.\n * @default 0\n */\n min?: number;\n /**\n * Sets the maximum value for the progress bar.\n * @default 100\n */\n max?: number;\n} & TestID &\n StyledPropsBlade;\n\ntype ProgressBarVariant = 'progress' | 'meter';\n\ntype ProgressBarProgressProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for the progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'progress'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default true\n */\n showPercentage?: boolean;\n};\n\ntype ProgressBarMeterProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for thr progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'meter'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: undefined;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default false\n */\n showPercentage?: undefined;\n};\n\ntype ProgressBarProps = ProgressBarProgressProps | ProgressBarMeterProps;\n\nconst progressBarHeight: Record<NonNullable<ProgressBarCommonProps['size']>, 2 | 4> = {\n small: size[2],\n medium: size[4],\n};\n\nconst ProgressBar = ({\n accessibilityLabel,\n color,\n isIndeterminate = false,\n label,\n showPercentage = true,\n size = 'small',\n value = 0,\n variant = 'progress',\n min = 0,\n max = 100,\n testID,\n ...styledProps\n}: ProgressBarProps): ReactElement => {\n const { theme } = useTheme();\n const id = useId(variant);\n\n if (__DEV__) {\n if (variant === 'meter' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'variant' is 'meter'.`,\n });\n }\n }\n\n const unfilledBackgroundColor = theme.colors.feedback.background.neutral\n .subtle as BaseBoxProps['backgroundColor'];\n const filledBackgroundColor = color\n ? theme.colors.feedback.background[color].intense\n : theme.colors.surface.background.primary.intense;\n const hasLabel = label && label.trim()?.length > 0;\n const isMeter = variant === 'meter';\n const progressValue = clamp(value, min, max);\n const percentageProgressValue = Math.floor(((progressValue - min) * 100) / (max - min));\n const shouldShowPercentage = showPercentage && !isMeter && !isIndeterminate;\n const accessibilityProps: Pick<\n AccessibilityProps,\n 'role' | 'label' | 'valueMax' | 'valueNow' | 'valueMin' | 'valueText'\n > = {\n role: 'progressbar',\n label: accessibilityLabel ?? label,\n valueNow: percentageProgressValue,\n valueText: `${percentageProgressValue}%`,\n valueMin: min,\n valueMax: max,\n };\n\n if (isMeter) {\n accessibilityProps.role = 'meter';\n accessibilityProps.valueNow = progressValue;\n accessibilityProps.valueText = `${progressValue}`;\n }\n\n if (isIndeterminate) {\n accessibilityProps.valueNow = undefined;\n accessibilityProps.valueMin = undefined;\n accessibilityProps.valueMax = undefined;\n accessibilityProps.valueText = undefined;\n }\n\n return (\n <BaseBox\n {...getStyledProps(styledProps)}\n {...metaAttribute({ name: MetaConstants.ProgressBar, testID })}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\" width=\"100%\">\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent={hasLabel ? 'space-between' : 'flex-end'}\n >\n {hasLabel ? (\n <Text as=\"label\" variant=\"body\" size=\"small\" color=\"surface.text.gray.subtle\">\n {label}\n </Text>\n ) : null}\n {shouldShowPercentage ? (\n <BaseBox marginBottom=\"spacing.2\">\n <Text\n variant=\"body\"\n size=\"small\"\n color=\"surface.text.gray.subtle\"\n >{`${percentageProgressValue}%`}</Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n <BaseBox\n id={id}\n {...makeAccessible({\n role: accessibilityProps.role,\n label: accessibilityProps.label,\n valueNow: accessibilityProps.valueNow,\n valueText: accessibilityProps.valueText,\n valueMin: accessibilityProps.valueMin,\n valueMax: accessibilityProps.valueMax,\n })}\n >\n <BaseBox\n backgroundColor={unfilledBackgroundColor}\n height={makeSize(progressBarHeight[size])}\n overflow=\"hidden\"\n position=\"relative\"\n >\n <ProgressBarFilled\n backgroundColor={filledBackgroundColor}\n progress={percentageProgressValue}\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDuration=\"duration.2xgentle\"\n indeterminateMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n variant={variant}\n isIndeterminate={isIndeterminate}\n />\n </BaseBox>\n </BaseBox>\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport type { ProgressBarProps, ProgressBarVariant };\nexport { ProgressBar };\n"],"names":["progressBarHeight","small","size","medium","ProgressBar","_ref","_label$trim","accessibilityLabel","color","_ref$isIndeterminate","isIndeterminate","label","_ref$showPercentage","showPercentage","_ref$size","_ref$value","value","_ref$variant","variant","_ref$min","min","_ref$max","max","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","id","useId","throwBladeError","moduleName","message","unfilledBackgroundColor","colors","feedback","background","neutral","subtle","filledBackgroundColor","intense","surface","primary","hasLabel","trim","length","isMeter","progressValue","clamp","percentageProgressValue","Math","floor","shouldShowPercentage","accessibilityProps","role","valueNow","valueText","concat","valueMin","valueMax","undefined","_jsx","BaseBox","_objectSpread","getStyledProps","metaAttribute","name","MetaConstants","children","_jsxs","display","flexDirection","width","justifyContent","Text","as","marginBottom","makeAccessible","backgroundColor","height","makeSize","overflow","position","ProgressBarFilled","progress","fillM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AQ,EAAEF,kBAAkB,CAACE,QAAQ;QACrCC,SAAS,EAAEH,kBAAkB,CAACG,SAAS;QACvCE,QAAQ,EAAEL,kBAAkB,CAACK,QAAQ;QACrCC,QAAQ,EAAEN,kBAAkB,CAACM,QAAAA;AAC/B,OAAC,CAAC,CAAA,EAAA,EAAA,EAAA;QAAAS,QAAA,eAEFP,GAAA,CAACC,OAAO,EAAA;AACNgB,UAAAA,eAAe,EAAE7C,uBAAwB;AACzC8C,UAAAA,MAAM,EAAEC,QAAQ,CAAClF,iBAAiB,CAACE,IAAI,CAAC,CAAE;AAC1CiF,UAAAA,QAAQ,EAAC,QAAQ;AACjBC,UAAAA,QAAQ,EAAC,UAAU;UAAAd,QAAA,eAEnBP,GAAA,CAACsB,iBAAiB,EAAA;AAChBL,YAAAA,eAAe,EAAEvC,qBAAsB;AACvC6C,YAAAA,QAAQ,EAAEnC,uBAAwB;AAClCoC,YAAAA,kBAAkB,EAAC,mBAAmB;AACtCC,YAAAA,mBAAmB,EAAC,mBAAmB;AACvCC,YAAAA,2BAA2B,EAAC,mBAAmB;AAC/CC,YAAAA,gBAAgB,EAAC,YAAY;AAC7BC,YAAAA,YAAY,EAAC,2BAA2B;AACxCzE,YAAAA,OAAO,EAAEA,OAAQ;AACjBR,YAAAA,eAAe,EAAEA,eAAAA;WAClB,CAAA;SACM,CAAA;AAAC,OAAA,CACH,CAAC,CAAA;KACH,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd;;;;"}
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sources":["../../../../../../src/components/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport { ProgressBarFilled } from './ProgressBarFilled';\nimport { CircularProgressBarFilled } from './CircularProgressBar';\nimport clamp from '~utils/lodashButBetter/clamp';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { Text } from '~components/Typography/Text';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport { useId } from '~utils/useId';\nimport { useTheme } from '~components/BladeProvider';\nimport type { BaseBoxProps } from '~components/Box/BaseBox';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors } from '~tokens/theme/theme';\nimport { size } from '~tokens/global';\nimport type { TestID } from '~utils/types';\nimport { makeSize } from '~utils/makeSize';\nimport type { AccessibilityProps } from '~utils/makeAccessible';\nimport { makeAccessible } from '~utils/makeAccessible';\nimport { throwBladeError } from '~utils/logger';\n\ntype ProgressBarCommonProps = {\n /**\n * Sets aria-label to help users know what the progress bar is for. Default value is the same as the `label` passed.\n */\n accessibilityLabel?: string;\n /**\n * Sets the color of the progress bar which changes the feedback color.\n */\n color?: FeedbackColors;\n /**\n * Sets the type of the progress bar.\n * @default 'progress'\n */\n type?: 'meter' | 'progress';\n /**\n * Sets the label to be rendered for the progress bar. This value will also be used as default for `accessibilityLabel`.\n */\n label?: string;\n /**\n * Sets the size of the progress bar.\n * Note: 'large' size isn't available when the variant is 'linear'.\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Sets the progress value of the progress bar.\n * @default 'small'\n */\n value?: number;\n /**\n * Sets the minimum value for the progress bar.\n * @default 0\n */\n min?: number;\n /**\n * Sets the maximum value for the progress bar.\n * @default 100\n */\n max?: number;\n} & TestID &\n StyledPropsBlade;\n\ntype ProgressBarVariant = 'progress' | 'meter' | 'linear' | 'circular';\n\ntype ProgressBarProgressProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for the progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'progress' | 'linear' | 'circular'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: boolean;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default true\n */\n showPercentage?: boolean;\n};\n\ntype ProgressBarMeterProps = ProgressBarCommonProps & {\n /**\n * Sets the variant to be rendered for thr progress bar.\n * @default 'progress'\n */\n variant?: Extract<ProgressBarVariant, 'meter' | 'linear' | 'circular'>;\n /**\n * Sets whether the progress bar is in an indeterminate state.\n * @default false\n */\n isIndeterminate?: undefined;\n /**\n * Sets whether or not to show the progress percentage for the progress bar. Percentage is hidden by default for the `meter` variant.\n * @default false\n */\n showPercentage?: undefined;\n};\n\ntype ProgressBarProps = ProgressBarProgressProps | ProgressBarMeterProps;\n\nconst progressBarHeight: Record<NonNullable<ProgressBarProps['size']>, 2 | 4 | 0> = {\n small: size[2],\n medium: size[4],\n // Large size isn't available when variant is 'linear'\n large: size[0],\n};\n\nconst ProgressBar = ({\n accessibilityLabel,\n color,\n type,\n isIndeterminate = false,\n label,\n showPercentage = true,\n size = 'small',\n value = 0,\n variant = 'progress',\n min = 0,\n max = 100,\n testID,\n ...styledProps\n}: ProgressBarProps): ReactElement => {\n const { theme } = useTheme();\n const progressType = !type && (variant === 'meter' || variant === 'progress') ? variant : type;\n const progressVariant = variant === 'meter' || variant === 'progress' ? 'linear' : variant;\n const id = useId(`${progressType}-${progressVariant}`);\n\n if (__DEV__) {\n if (progressType === 'meter' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'type' or 'variant' is 'meter'.`,\n });\n }\n\n if (progressVariant === 'circular' && isIndeterminate) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Cannot set 'isIndeterminate' when 'variant' is 'circular'.`,\n });\n }\n\n if (progressVariant === 'linear' && size === 'large') {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `Large size isn't available when 'variant' is 'linear'.`,\n });\n }\n\n if (type && (variant === 'progress' || variant === 'meter')) {\n throwBladeError({\n moduleName: 'ProgressBar',\n message: `variant can only be 'linear' or 'circular' when 'type=${type}'.`,\n });\n }\n }\n\n const unfilledBackgroundColor = theme.colors.feedback.background.neutral\n .subtle as BaseBoxProps['backgroundColor'];\n const filledBackgroundColor = color\n ? theme.colors.feedback.background[color].intense\n : theme.colors.surface.background.primary.intense;\n const hasLabel = label && label.trim()?.length > 0;\n const isMeter = progressType === 'meter';\n const isCircular = progressVariant === 'circular';\n const progressValue = clamp(value, min, max);\n const percentageProgressValue = Math.floor(((progressValue - min) * 100) / (max - min));\n const shouldShowPercentage = showPercentage && !isMeter && !isIndeterminate;\n const accessibilityProps: Pick<\n AccessibilityProps,\n 'role' | 'label' | 'valueMax' | 'valueNow' | 'valueMin' | 'valueText'\n > = {\n role: 'progressbar',\n label: accessibilityLabel ?? label,\n valueNow: percentageProgressValue,\n valueText: `${percentageProgressValue}%`,\n valueMin: min,\n valueMax: max,\n };\n\n if (isMeter) {\n accessibilityProps.role = 'meter';\n accessibilityProps.valueNow = progressValue;\n accessibilityProps.valueText = `${progressValue}`;\n }\n\n if (isIndeterminate) {\n accessibilityProps.valueNow = undefined;\n accessibilityProps.valueMin = undefined;\n accessibilityProps.valueMax = undefined;\n accessibilityProps.valueText = undefined;\n }\n\n return (\n <BaseBox\n {...getStyledProps(styledProps)}\n {...metaAttribute({ name: MetaConstants.ProgressBar, testID })}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\" width=\"100%\">\n {!isCircular ? (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent={hasLabel ? 'space-between' : 'flex-end'}\n >\n {hasLabel ? (\n <Text as=\"label\" variant=\"body\" size=\"small\" color=\"surface.text.gray.subtle\">\n {label}\n </Text>\n ) : null}\n {shouldShowPercentage ? (\n <BaseBox marginBottom=\"spacing.2\">\n <Text\n variant=\"body\"\n size=\"small\"\n color=\"surface.text.gray.subtle\"\n >{`${percentageProgressValue}%`}</Text>\n </BaseBox>\n ) : null}\n </BaseBox>\n ) : null}\n\n <BaseBox\n id={id}\n {...makeAccessible({\n role: accessibilityProps.role,\n label: accessibilityProps.label,\n valueNow: accessibilityProps.valueNow,\n valueText: accessibilityProps.valueText,\n valueMin: accessibilityProps.valueMin,\n valueMax: accessibilityProps.valueMax,\n })}\n >\n {isCircular ? (\n <CircularProgressBarFilled\n size={size}\n label={label}\n progressPercent={percentageProgressValue}\n isMeter={isMeter}\n showPercentage={shouldShowPercentage}\n backgroundColor={unfilledBackgroundColor as string}\n fillColor={filledBackgroundColor}\n pulseMotionDuration=\"duration.2xgentle\"\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n />\n ) : (\n <BaseBox\n backgroundColor={unfilledBackgroundColor}\n height={makeSize(progressBarHeight[size])}\n overflow=\"hidden\"\n position=\"relative\"\n >\n <ProgressBarFilled\n backgroundColor={filledBackgroundColor}\n progress={percentageProgressValue}\n fillMotionDuration=\"duration.2xgentle\"\n pulseMotionDuration=\"duration.2xgentle\"\n indeterminateMotionDuration=\"duration.2xgentle\"\n pulseMotionDelay=\"delay.long\"\n motionEasing=\"easing.standard.revealing\"\n type={progressType}\n isIndeterminate={isIndeterminate}\n />\n </BaseBox>\n )}\n </BaseBox>\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport type { ProgressBarProps, ProgressBarVariant };\nexport { ProgressBar };\n"],"names":["progressBarHeight","small","size","medium","large","ProgressBar","_ref","_label$trim","accessibilityLabel","color","type","_ref$isIndeterminate","isIndeterminate","label","_ref$showPercentage","showPercentage","_ref$size","_ref$value","value","_ref$variant","variant","_ref$min","min","_ref$max","max","testID","styledProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","progressType","progressVariant","id","useId","concat","throwBladeError","moduleName","message","unfilledBackgroundColor","colors","feedback","background","neutral","subtle","filledBackgroundColor","intense","surface","primary","hasLabel","trim","length","isMeter","isCircular","progressValue","clamp","percentageProgressValue","Math","floor","shouldShowPercentage","accessibilityProps","role","valueNow","valueText","valueMin","valueMax","undefined","_jsx","BaseBox","_objectSpread","getStyledProps","metaAttribute","name","MetaConstants","children","_jsxs","display","flexDirection","width","justifyContent","Text","as","marginBottom","makeAccessible","CircularProgressBarFilled","progressPercent","backgroundColor","fillColor","pulseMotionDuration","fillMotionDuration","pulseMotionDelay","motionEasing","height","makeSize","overflow","position","ProgressBarFilled","progress","indeterminateMotionDuration"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsGA,IAAMA,iBAA2E,GAAG;AAClFC,EAAAA,KAAK,EAAEC,IAAI,CAAC,CAAC,CAAC;AACdC,EAAAA,MAAM,EAAED,IAAI,CAAC,CAAC,CAAC;AACf;EACAE,KAAK,EAAEF,IAAI,CAAC,CAAC,CAAA;AACf,CAAC,CAAA;AAED,IAAMG,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAcqB;AAAA,EAAA,IAAAC,WAAA,CAAA;AAAA,EAAA,IAbpCC,kBAAkB,GAAAF,IAAA,CAAlBE,kBAAkB;IAClBC,KAAK,GAAAH,IAAA,CAALG,KAAK;IACLC,IAAI,GAAAJ,IAAA,CAAJI,IAAI;IAAAC,oBAAA,GAAAL,IAAA,CACJM,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,oBAAA;IACvBE,KAAK,GAAAP,IAAA,CAALO,KAAK;IAAAC,mBAAA,GAAAR,IAAA,CACLS,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,mBAAA;IAAAE,SAAA,GAAAV,IAAA,CACrBJ,IAAI;AAAJA,IAAAA,IAAI,GAAAc,SAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,SAAA;IAAAC,UAAA,GAAAX,IAAA,CACdY,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,UAAA;IAAAE,YAAA,GAAAb,IAAA,CACTc,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,YAAA;IAAAE,QAAA,GAAAf,IAAA,CACpBgB,GAAG;AAAHA,IAAAA,GAAG,GAAAD,QAA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,CAAA;SACM,CAAA;AACV,OAAA,CACM,CAAC,CAAA;KACH,CAAA;AAAC,GAAA,CACH,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -46,11 +46,11 @@ var IndeterminatePulseAnimation = /*#__PURE__*/styled(BoxWithIndeterminateAnimat
|
|
|
46
46
|
pulseMotionDuration = _ref4.pulseMotionDuration,
|
|
47
47
|
pulseMotionDelay = _ref4.pulseMotionDelay,
|
|
48
48
|
motionEasing = _ref4.motionEasing,
|
|
49
|
-
|
|
49
|
+
type = _ref4.type;
|
|
50
50
|
var duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));
|
|
51
51
|
var easing = castWebType(getIn(theme.motion, motionEasing));
|
|
52
52
|
var delay = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDelay)));
|
|
53
|
-
return
|
|
53
|
+
return type === 'progress' ? getPulseAnimationStyles({
|
|
54
54
|
duration: duration,
|
|
55
55
|
easing: easing,
|
|
56
56
|
delay: delay
|
|
@@ -89,11 +89,11 @@ var DeterminatePulseAnimation = /*#__PURE__*/styled(BoxWithProgressFillTransitio
|
|
|
89
89
|
pulseMotionDuration = _ref7.pulseMotionDuration,
|
|
90
90
|
pulseMotionDelay = _ref7.pulseMotionDelay,
|
|
91
91
|
motionEasing = _ref7.motionEasing,
|
|
92
|
-
|
|
92
|
+
type = _ref7.type;
|
|
93
93
|
var duration = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDuration)));
|
|
94
94
|
var easing = castWebType(getIn(theme.motion, motionEasing));
|
|
95
95
|
var delay = castWebType(makeMotionTime(getIn(theme.motion, pulseMotionDelay)));
|
|
96
|
-
return
|
|
96
|
+
return type === 'progress' ? getPulseAnimationStyles({
|
|
97
97
|
duration: duration,
|
|
98
98
|
easing: easing,
|
|
99
99
|
delay: delay
|
|
@@ -107,7 +107,7 @@ var ProgressBarFilled = function ProgressBarFilled(_ref8) {
|
|
|
107
107
|
pulseMotionDelay = _ref8.pulseMotionDelay,
|
|
108
108
|
pulseMotionDuration = _ref8.pulseMotionDuration,
|
|
109
109
|
indeterminateMotionDuration = _ref8.indeterminateMotionDuration,
|
|
110
|
-
|
|
110
|
+
type = _ref8.type,
|
|
111
111
|
isIndeterminate = _ref8.isIndeterminate;
|
|
112
112
|
var ProgressBarFilledContainer = isIndeterminate ? IndeterminateFilledContainer : DeterminateFilledContainer;
|
|
113
113
|
var ProgressBarPulseAnimation = isIndeterminate ? IndeterminatePulseAnimation : DeterminatePulseAnimation;
|
|
@@ -119,7 +119,7 @@ var ProgressBarFilled = function ProgressBarFilled(_ref8) {
|
|
|
119
119
|
children: /*#__PURE__*/jsx(ProgressBarPulseAnimation, {
|
|
120
120
|
fillMotionDuration: fillMotionDuration,
|
|
121
121
|
motionEasing: motionEasing,
|
|
122
|
-
|
|
122
|
+
type: type,
|
|
123
123
|
pulseMotionDelay: pulseMotionDelay,
|
|
124
124
|
pulseMotionDuration: pulseMotionDuration
|
|
125
125
|
})
|