@pega/cosmos-react-core 2.0.0-dev.16.1 → 2.0.0-dev.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppShell.js +8 -1
  3. package/lib/components/AppShell/AppShell.js.map +1 -1
  4. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppShellList.js +4 -1
  6. package/lib/components/AppShell/AppShellList.js.map +1 -1
  7. package/lib/components/AppShell/Drawer.d.ts.map +1 -1
  8. package/lib/components/AppShell/Drawer.js +3 -1
  9. package/lib/components/AppShell/Drawer.js.map +1 -1
  10. package/lib/components/AppShell/SkipNavigation.d.ts.map +1 -1
  11. package/lib/components/AppShell/SkipNavigation.js +39 -31
  12. package/lib/components/AppShell/SkipNavigation.js.map +1 -1
  13. package/lib/components/Badges/Selection.d.ts.map +1 -1
  14. package/lib/components/Badges/Selection.js +3 -1
  15. package/lib/components/Badges/Selection.js.map +1 -1
  16. package/lib/components/Banner/Banner.d.ts.map +1 -1
  17. package/lib/components/Banner/Banner.js +3 -1
  18. package/lib/components/Banner/Banner.js.map +1 -1
  19. package/lib/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  20. package/lib/components/Breadcrumbs/Breadcrumbs.js +4 -1
  21. package/lib/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
  22. package/lib/components/Card/CollapsibleCard.d.ts.map +1 -1
  23. package/lib/components/Card/CollapsibleCard.js +3 -1
  24. package/lib/components/Card/CollapsibleCard.js.map +1 -1
  25. package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
  26. package/lib/components/ComboBox/ComboBox.js +4 -1
  27. package/lib/components/ComboBox/ComboBox.js.map +1 -1
  28. package/lib/components/Configuration/Configuration.js +1 -1
  29. package/lib/components/Configuration/Configuration.js.map +1 -1
  30. package/lib/components/Currency/CurrencyDisplay.d.ts +2 -0
  31. package/lib/components/Currency/CurrencyDisplay.d.ts.map +1 -1
  32. package/lib/components/Currency/CurrencyDisplay.js +3 -2
  33. package/lib/components/Currency/CurrencyDisplay.js.map +1 -1
  34. package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
  35. package/lib/components/Currency/CurrencyInput.js +2 -2
  36. package/lib/components/Currency/CurrencyInput.js.map +1 -1
  37. package/lib/components/Currency/CurrencyInput.types.d.ts +2 -0
  38. package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
  39. package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
  40. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  41. package/lib/components/DateTime/Input/DateInput.js +4 -1
  42. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  43. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  44. package/lib/components/DateTime/Input/DateTimeInput.js +4 -1
  45. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  46. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  47. package/lib/components/DateTime/Input/TimeInput.js +4 -1
  48. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  49. package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
  50. package/lib/components/DateTime/Input/WeekInput.js +4 -1
  51. package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
  52. package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
  53. package/lib/components/DateTime/Picker/DatePicker.js +4 -1
  54. package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
  55. package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
  56. package/lib/components/DateTime/Picker/DateRangePicker.js +4 -1
  57. package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
  58. package/lib/components/EmptyState/EmptyState.d.ts.map +1 -1
  59. package/lib/components/EmptyState/EmptyState.js +3 -1
  60. package/lib/components/EmptyState/EmptyState.js.map +1 -1
  61. package/lib/components/ErrorState/ErrorState.d.ts.map +1 -1
  62. package/lib/components/ErrorState/ErrorState.js +3 -1
  63. package/lib/components/ErrorState/ErrorState.js.map +1 -1
  64. package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
  65. package/lib/components/FieldGroup/FieldGroup.js +3 -1
  66. package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
  67. package/lib/components/FieldGroup/FieldGroupList.d.ts.map +1 -1
  68. package/lib/components/FieldGroup/FieldGroupList.js +3 -1
  69. package/lib/components/FieldGroup/FieldGroupList.js.map +1 -1
  70. package/lib/components/File/FileInput.d.ts.map +1 -1
  71. package/lib/components/File/FileInput.js +3 -1
  72. package/lib/components/File/FileInput.js.map +1 -1
  73. package/lib/components/Location/CurrentLocationButton.d.ts.map +1 -1
  74. package/lib/components/Location/CurrentLocationButton.js +3 -1
  75. package/lib/components/Location/CurrentLocationButton.js.map +1 -1
  76. package/lib/components/Menu/MenuItem.d.ts.map +1 -1
  77. package/lib/components/Menu/MenuItem.js +5 -2
  78. package/lib/components/Menu/MenuItem.js.map +1 -1
  79. package/lib/components/MenuButton/MenuButton.d.ts +3 -1
  80. package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
  81. package/lib/components/MenuButton/MenuButton.js +5 -2
  82. package/lib/components/MenuButton/MenuButton.js.map +1 -1
  83. package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
  84. package/lib/components/Modal/MinimizedModal.js +5 -1
  85. package/lib/components/Modal/MinimizedModal.js.map +1 -1
  86. package/lib/components/Modal/Modal.d.ts.map +1 -1
  87. package/lib/components/Modal/Modal.js +7 -2
  88. package/lib/components/Modal/Modal.js.map +1 -1
  89. package/lib/components/Number/NumberInput.d.ts.map +1 -1
  90. package/lib/components/Number/NumberInput.js +4 -1
  91. package/lib/components/Number/NumberInput.js.map +1 -1
  92. package/lib/components/Pagination/Pagination.d.ts.map +1 -1
  93. package/lib/components/Pagination/Pagination.js +4 -1
  94. package/lib/components/Pagination/Pagination.js.map +1 -1
  95. package/lib/components/Rating/Rating.d.ts.map +1 -1
  96. package/lib/components/Rating/Rating.js +4 -1
  97. package/lib/components/Rating/Rating.js.map +1 -1
  98. package/lib/components/SearchInput/SearchInput.d.ts.map +1 -1
  99. package/lib/components/SearchInput/SearchInput.js +3 -1
  100. package/lib/components/SearchInput/SearchInput.js.map +1 -1
  101. package/lib/components/Slider/Slider.d.ts.map +1 -1
  102. package/lib/components/Slider/Slider.js +3 -4
  103. package/lib/components/Slider/Slider.js.map +1 -1
  104. package/lib/components/Slider/Slider.styles.d.ts +3 -0
  105. package/lib/components/Slider/Slider.styles.d.ts.map +1 -1
  106. package/lib/components/Slider/Slider.styles.js +16 -4
  107. package/lib/components/Slider/Slider.styles.js.map +1 -1
  108. package/lib/components/Slider/SliderTicks.d.ts +1 -0
  109. package/lib/components/Slider/SliderTicks.d.ts.map +1 -1
  110. package/lib/components/Slider/SliderTicks.js +16 -8
  111. package/lib/components/Slider/SliderTicks.js.map +1 -1
  112. package/lib/components/Slider/utils.d.ts +10 -1
  113. package/lib/components/Slider/utils.d.ts.map +1 -1
  114. package/lib/components/Slider/utils.js +21 -3
  115. package/lib/components/Slider/utils.js.map +1 -1
  116. package/lib/components/Switch/Switch.d.ts.map +1 -1
  117. package/lib/components/Switch/Switch.js +3 -1
  118. package/lib/components/Switch/Switch.js.map +1 -1
  119. package/lib/components/Toaster/Toaster.d.ts.map +1 -1
  120. package/lib/components/Toaster/Toaster.js +3 -1
  121. package/lib/components/Toaster/Toaster.js.map +1 -1
  122. package/lib/hooks/useAutoResize.d.ts.map +1 -1
  123. package/lib/hooks/useAutoResize.js +6 -7
  124. package/lib/hooks/useAutoResize.js.map +1 -1
  125. package/lib/hooks/useI18n.d.ts +4 -0
  126. package/lib/hooks/useI18n.d.ts.map +1 -1
  127. package/lib/i18n/default.json +5 -1
  128. package/lib/i18n/i18n.d.ts +8 -0
  129. package/lib/i18n/i18n.d.ts.map +1 -1
  130. package/package.json +1 -1
@@ -1 +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CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { ChangeEvent, forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually, readableColor } from 'polished';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { FormControlProps } from '../FormControl';\nimport { useDirection, useUID } from '../../hooks';\nimport Flex from '../Flex';\nimport { getHoverColors } from '../../styles';\nimport Icon, { StyledIcon } from '../Icon';\nimport { tryCatch } from '../../utils';\n\nexport interface SwitchProps extends BaseProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /**\n * Disables the control.\n * @default false\n */\n disabled?: FormControlProps['disabled'];\n /**\n * Sets checked prop via onChange.\n * @default false\n */\n on?: boolean;\n /** Callback that is triggered when the Switch is toggled. */\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n /** Ref for the input element. */\n ref?: Ref<HTMLInputElement>;\n}\n\nexport const SwitchLabel = styled.label(\n ({\n theme: {\n base,\n components: {\n switch: { width, height, 'touch-width': touchWidth, 'touch-height': touchHeight, off }\n }\n }\n }) => {\n return css`\n position: relative;\n cursor: pointer;\n padding-inline-end: calc(${width} + 0.5rem);\n height: ${height};\n width: 100%;\n\n @media (pointer: coarse) {\n padding-inline-end: calc(${touchWidth} + 0.5rem);\n height: ${touchHeight};\n }\n\n /** Checkmark */\n & > ${StyledIcon} {\n position: absolute;\n inset-inline-end: calc(0.5 * ${width} + 0.25rem);\n height: calc(0.5 * ${height});\n width: calc(0.5 * ${height});\n\n @media (pointer: coarse) {\n inset-inline-end: calc(0.5 * ${touchWidth} + 0.25rem);\n height: calc(0.5 * ${touchHeight});\n width: calc(0.5 * ${touchHeight});\n }\n }\n\n /** Track */\n &::before {\n position: absolute;\n content: '';\n inset-inline-end: 0;\n width: ${width};\n height: ${height};\n background-color: ${off.color};\n transition: background-color calc(0.5 * ${base.animation.speed})\n ${base.animation.timing.ease};\n border-radius: calc(9999 * ${base['border-radius']});\n\n @media (pointer: coarse) {\n width: ${touchWidth};\n height: ${touchHeight};\n }\n }\n\n /** Switch */\n &::after {\n position: absolute;\n content: '';\n inset-inline-end: calc(${width} - ${height} + 0.0625rem);\n height: calc(${height} - 0.125rem);\n width: calc(${height} - 0.125rem);\n background-color: ${base.palette['primary-background']};\n transition: transform calc(0.5 * ${base.animation.speed}) ${base.animation.timing.ease};\n border-radius: calc(9999 * ${base['border-radius']});\n\n @media (pointer: coarse) {\n inset-inline-end: calc(${touchWidth} - ${touchHeight} + 0.0625rem);\n height: calc(${touchHeight} - 0.125rem);\n width: calc(${touchHeight} - 0.125rem);\n }\n }\n `;\n }\n);\n\nSwitchLabel.defaultProps = defaultThemeProp;\n\nexport const SwitchInput = styled.input(\n ({\n theme: {\n base,\n components: {\n 'form-control': {\n ':focus': { 'box-shadow': shadow }\n },\n switch: { height, width, 'touch-height': touchHeight, 'touch-width': touchWidth, on, off }\n }\n }\n }) => {\n const { ltr } = useDirection();\n\n const checkmarkColor = tryCatch(() => readableColor(on.color));\n\n const onHoverColors = getHoverColors(on.color);\n const offHoverColors = getHoverColors(off.color);\n\n return css`\n ${hideVisually}\n\n & + ${SwitchLabel} {\n min-height: ${base['hit-area']['mouse-min']};\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n }\n\n & + ${SwitchLabel} > ${StyledIcon} {\n color: ${checkmarkColor};\n }\n\n &:checked + ${SwitchLabel}::before {\n background-color: ${on.color};\n }\n\n &:checked + ${SwitchLabel}::after {\n transform: translateX(calc((${width} - ${height}) * ${ltr ? '1' : '-1'}));\n\n @media (pointer: coarse) {\n transform: translateX(calc((${touchWidth} - ${touchHeight}) * ${ltr ? '1' : '-1'}));\n }\n }\n\n &:hover + ${SwitchLabel} > ${StyledIcon} {\n color: ${onHoverColors.foreground};\n }\n\n &:hover:checked + ${SwitchLabel}::before {\n background-color: ${onHoverColors.background};\n }\n\n &:hover + ${SwitchLabel}::before {\n background-color: ${offHoverColors.background};\n }\n\n &:focus + ${SwitchLabel}::before {\n box-shadow: ${shadow};\n }\n\n &:disabled + ${SwitchLabel} {\n opacity: ${base['disabled-opacity']};\n }\n `;\n }\n);\n\nSwitchInput.defaultProps = defaultThemeProp;\n\nexport const StyledSwitch = styled.div``;\n\nconst Switch: FunctionComponent<SwitchProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SwitchProps>, ref: SwitchProps['ref']) => {\n const uid = useUID();\n const { id = uid, label, disabled = false, on = false, onChange, ...restProps } = props;\n\n return (\n <StyledSwitch>\n <SwitchInput\n {...restProps}\n id={id}\n type='checkbox'\n role='switch'\n checked={on}\n aria-checked={on}\n disabled={disabled}\n onChange={onChange}\n ref={ref}\n />\n <Flex container={{ alignItems: 'center' }} as={SwitchLabel} htmlFor={id}>\n {label}\n {on && <Icon name='check' />}\n </Flex>\n </StyledSwitch>\n );\n }\n);\n\nexport default Switch;\n"]}
1
+ {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../src/components/Switch/Switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,UAAU,EAA2C,MAAM,OAAO,CAAC;AACzF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK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CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAEzC,MAAM,MAAM,GAAkD,UAAU,CACtE,CAAC,KAAmC,EAAE,GAAuB,EAAE,EAAE;IAC/D,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAExF,OAAO,CACL,MAAC,YAAY,eACX,KAAC,WAAW,oBACN,SAAS,IACb,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,UAAU,EACf,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,EAAE,kBACG,EAAE,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,GAAG,YACR,EACF,MAAC,IAAI,kBAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,iBACpE,KAAK,EACL,EAAE,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,WAAG,aACvB,YACM,CAChB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { ChangeEvent, forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually, readableColor } from 'polished';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { FormControlProps } from '../FormControl';\nimport { useDirection, useUID } from '../../hooks';\nimport Flex from '../Flex';\nimport { getHoverColors } from '../../styles';\nimport Icon, { StyledIcon, registerIcon } from '../Icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport { tryCatch } from '../../utils';\n\nregisterIcon(checkIcon);\n\nexport interface SwitchProps extends BaseProps {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /**\n * Disables the control.\n * @default false\n */\n disabled?: FormControlProps['disabled'];\n /**\n * Sets checked prop via onChange.\n * @default false\n */\n on?: boolean;\n /** Callback that is triggered when the Switch is toggled. */\n onChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n /** Ref for the input element. */\n ref?: Ref<HTMLInputElement>;\n}\n\nexport const SwitchLabel = styled.label(\n ({\n theme: {\n base,\n components: {\n switch: { width, height, 'touch-width': touchWidth, 'touch-height': touchHeight, off }\n }\n }\n }) => {\n return css`\n position: relative;\n cursor: pointer;\n padding-inline-end: calc(${width} + 0.5rem);\n height: ${height};\n width: 100%;\n\n @media (pointer: coarse) {\n padding-inline-end: calc(${touchWidth} + 0.5rem);\n height: ${touchHeight};\n }\n\n /** Checkmark */\n & > ${StyledIcon} {\n position: absolute;\n inset-inline-end: calc(0.5 * ${width} + 0.25rem);\n height: calc(0.5 * ${height});\n width: calc(0.5 * ${height});\n\n @media (pointer: coarse) {\n inset-inline-end: calc(0.5 * ${touchWidth} + 0.25rem);\n height: calc(0.5 * ${touchHeight});\n width: calc(0.5 * ${touchHeight});\n }\n }\n\n /** Track */\n &::before {\n position: absolute;\n content: '';\n inset-inline-end: 0;\n width: ${width};\n height: ${height};\n background-color: ${off.color};\n transition: background-color calc(0.5 * ${base.animation.speed})\n ${base.animation.timing.ease};\n border-radius: calc(9999 * ${base['border-radius']});\n\n @media (pointer: coarse) {\n width: ${touchWidth};\n height: ${touchHeight};\n }\n }\n\n /** Switch */\n &::after {\n position: absolute;\n content: '';\n inset-inline-end: calc(${width} - ${height} + 0.0625rem);\n height: calc(${height} - 0.125rem);\n width: calc(${height} - 0.125rem);\n background-color: ${base.palette['primary-background']};\n transition: transform calc(0.5 * ${base.animation.speed}) ${base.animation.timing.ease};\n border-radius: calc(9999 * ${base['border-radius']});\n\n @media (pointer: coarse) {\n inset-inline-end: calc(${touchWidth} - ${touchHeight} + 0.0625rem);\n height: calc(${touchHeight} - 0.125rem);\n width: calc(${touchHeight} - 0.125rem);\n }\n }\n `;\n }\n);\n\nSwitchLabel.defaultProps = defaultThemeProp;\n\nexport const SwitchInput = styled.input(\n ({\n theme: {\n base,\n components: {\n 'form-control': {\n ':focus': { 'box-shadow': shadow }\n },\n switch: { height, width, 'touch-height': touchHeight, 'touch-width': touchWidth, on, off }\n }\n }\n }) => {\n const { ltr } = useDirection();\n\n const checkmarkColor = tryCatch(() => readableColor(on.color));\n\n const onHoverColors = getHoverColors(on.color);\n const offHoverColors = getHoverColors(off.color);\n\n return css`\n ${hideVisually}\n\n & + ${SwitchLabel} {\n min-height: ${base['hit-area']['mouse-min']};\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n }\n\n & + ${SwitchLabel} > ${StyledIcon} {\n color: ${checkmarkColor};\n }\n\n &:checked + ${SwitchLabel}::before {\n background-color: ${on.color};\n }\n\n &:checked + ${SwitchLabel}::after {\n transform: translateX(calc((${width} - ${height}) * ${ltr ? '1' : '-1'}));\n\n @media (pointer: coarse) {\n transform: translateX(calc((${touchWidth} - ${touchHeight}) * ${ltr ? '1' : '-1'}));\n }\n }\n\n &:hover + ${SwitchLabel} > ${StyledIcon} {\n color: ${onHoverColors.foreground};\n }\n\n &:hover:checked + ${SwitchLabel}::before {\n background-color: ${onHoverColors.background};\n }\n\n &:hover + ${SwitchLabel}::before {\n background-color: ${offHoverColors.background};\n }\n\n &:focus + ${SwitchLabel}::before {\n box-shadow: ${shadow};\n }\n\n &:disabled + ${SwitchLabel} {\n opacity: ${base['disabled-opacity']};\n }\n `;\n }\n);\n\nSwitchInput.defaultProps = defaultThemeProp;\n\nexport const StyledSwitch = styled.div``;\n\nconst Switch: FunctionComponent<SwitchProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<SwitchProps>, ref: SwitchProps['ref']) => {\n const uid = useUID();\n const { id = uid, label, disabled = false, on = false, onChange, ...restProps } = props;\n\n return (\n <StyledSwitch>\n <SwitchInput\n {...restProps}\n id={id}\n type='checkbox'\n role='switch'\n checked={on}\n aria-checked={on}\n disabled={disabled}\n onChange={onChange}\n ref={ref}\n />\n <Flex container={{ alignItems: 'center' }} as={SwitchLabel} htmlFor={id}>\n {label}\n {on && <Icon name='check' />}\n </Flex>\n </StyledSwitch>\n );\n }\n);\n\nexport default Switch;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,iBAAiB,EACjB,SAAS,EAGT,OAAO,EACR,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,eAAO,MAAM,cAAc,eAA4D,CAAC;AAExF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IACzC,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,8BAGzB,CAAC;AAEH,UAAU,YAAY;IACpB,+EAA+E;IAC/E,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,OAAO,EAAE,SAAS,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uIAAuI;IACvI,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACxE,oBAAoB;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,oBAAoB;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,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E,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACxC;AAED,aAAK,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AA+G/D,UAAU,UAAW,SAAQ,YAAY;IACvC,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,YAAY,CAAC,eAAe,CAAC,CAAA;KAAE,KAAK,IAAI,CAAC;CACjG;AAED,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,UAAU,CAgC/C,CAAC;AAEF,QAAA,MAAM,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAiE5C,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -4,10 +4,12 @@ import { createContext, useContext, useReducer, useCallback, useMemo, useLayoutE
4
4
  import { createPortal } from 'react-dom';
5
5
  import styled, { css } from 'styled-components';
6
6
  import Button from '../Button';
7
- import Icon from '../Icon';
7
+ import Icon, { registerIcon } from '../Icon';
8
+ import * as timesIcon from '../Icon/icons/times.icon';
8
9
  import { reflow, createUID } from '../../utils';
9
10
  import { useConfiguration } from '../../hooks';
10
11
  import { defaultThemeProp } from '../../theme';
12
+ registerIcon(timesIcon);
11
13
  export const initializedKey = Symbol.for('@pega/cosmos-react-core.toaster.initialized');
12
14
  export const ToasterContext = createContext({
13
15
  push: () => { },
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.js","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EACV,WAAW,EACX,OAAO,EACP,eAAe,EAMhB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AA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LayoutEffect,\n FunctionComponent,\n ReactNode,\n CSSProperties,\n TransitionEvent,\n Context\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport { reflow, createUID } from '../../utils';\nimport { DeepRequired } from '../../types';\nimport { useConfiguration } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\n\nexport const initializedKey = Symbol.for('@pega/cosmos-react-core.toaster.initialized');\n\nexport interface ToasterContextValue {\n push: (message: IncomingMessage) => void;\n [initializedKey]: boolean;\n}\n\nexport const ToasterContext = createContext<ToasterContextValue>({\n push: () => {},\n [initializedKey]: false\n});\n\ninterface ToastMessage {\n /** String to identify the specific message. Used as onDismiss callback arg. */\n id: string;\n /** Recommend a simple string message. */\n content: ReactNode;\n /**\n * Time in milliseconds to automatically dismiss toast.\n * Can be set globally on Toaster and overridden individually at a message level.\n * @default Infinity\n */\n dismissAfter?: number;\n /** Called when user or timer dismisses toasts. Callback is passed the message id and boolean indicating if the dismissal was timed. */\n onDismiss?: ({ id, timeout }: { id: string; timeout: boolean }) => void;\n /** internal prop */\n dismissed: boolean;\n /** internal prop */\n timeoutId?: number;\n /** internal prop */\n translateY: number;\n}\n\nexport interface IncomingMessage {\n /** Id of the Toast. */\n id?: string;\n /** The content to display within the Toast. */\n content: ReactNode;\n /**\n * Time in milliseconds to automatically dismiss Toast.\n * Can be set globally on Toaster and overridden individually at a message level.\n * @default Infinity\n */\n dismissAfter?: ToastMessage['dismissAfter'];\n /** Called when user or timer dismisses Toasts. Callback is passed the message id and boolean indicating if the dismissal was timed. */\n onDismiss?: ToastMessage['onDismiss'];\n /** The id of the timeout controlling the Toast duration. */\n timeoutId?: ToastMessage['timeoutId'];\n}\n\nexport interface ToasterProps {\n /** The element(s) responsible for handling the Toaster state. */\n children: ReactNode;\n /**\n * Time in milliseconds to automatically dismiss Toast.\n * Can be set globally on Toaster and overridden individually at a message level.\n * @default Infinity\n */\n dismissAfter?: ToastMessage['dismissAfter'];\n /** Called when user or timer dismisses Toasts. Callback is passed the message id and boolean indicating if the dismissal was timed. */\n onDismiss?: ToastMessage['onDismiss'];\n /** Context to read previous values from. */\n context?: Context<ToasterContextValue>;\n}\n\ntype DispatchAction = 'push' | 'dismiss' | 'remove' | 'adjust';\n\nfunction reducer(\n current: ToastMessage[],\n { action, message: incoming }: { action: DispatchAction; message?: DeepRequired<IncomingMessage> }\n) {\n switch (action) {\n case 'push':\n if (!incoming) return current;\n return [\n ...current,\n {\n content: incoming.content,\n dismissed: false,\n dismissAfter: incoming.dismissAfter,\n timeoutId: incoming.timeoutId,\n id: incoming.id,\n onDismiss: incoming.onDismiss,\n translateY: 0\n }\n ];\n\n case 'adjust':\n return current.map((m, i) => {\n const height = 2.625;\n const margin = 0.5;\n const msgSpace = Number((height + margin).toFixed(1));\n const count = current.length - i;\n m.translateY = -(count * msgSpace);\n return m;\n });\n\n case 'dismiss':\n if (!incoming) return current;\n return current.map(m => {\n m.dismissed = m.dismissed || m.id === incoming.id;\n return m;\n });\n\n case 'remove':\n if (!incoming) return current;\n return current.filter(m => m.id !== incoming.id);\n\n default:\n return current;\n }\n}\n\nconst StyledToastButton = styled.button(\n ({ theme }) => css`\n border: none;\n color: inherit;\n padding: 0;\n font-size: 1rem;\n\n &:enabled:hover {\n background: #ffffff19;\n }\n\n &:enabled:focus {\n box-shadow: ${theme.base.shadow['focus-inverted']};\n }\n `\n);\n\nStyledToastButton.defaultProps = defaultThemeProp;\n\nconst StyledToastContent = styled.div`\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nconst StyledToast = styled.div<{ dismissed: boolean }>(({ dismissed, theme }) => {\n return css`\n position: absolute;\n display: flex;\n align-items: center;\n font-size: 0.875rem;\n height: 2.625rem;\n width: 100%;\n top: 0;\n left: 0;\n padding: calc(1.5 * ${theme.base.spacing}) ${theme.base.spacing};\n padding-left: calc(2 * ${theme.base.spacing});\n background: ${theme.base.colors.slate['extra-dark']};\n color: ${theme.base.colors.white};\n border-radius: calc(${theme.base['border-radius']} / 2);\n opacity: ${dismissed ? 0 : 1};\n will-change: transform;\n transform: var(--translateY) ${dismissed ? 'scale(0)' : ''};\n transition-property: transform, opacity;\n transition-duration: 0.3s;\n transition-timing-function: cubic-bezier(0.4, 0.6, 0.1, 1);\n `;\n});\n\nStyledToast.defaultProps = defaultThemeProp;\n\nconst StyledToaster = styled.div`\n position: fixed;\n z-index: ${({ theme }) => theme.base['z-index'].toast};\n width: 20rem;\n left: 50%;\n margin-left: -10rem;\n top: 100%;\n`;\n\nStyledToaster.defaultProps = defaultThemeProp;\n\ninterface ToastProps extends ToastMessage {\n dispatch: (message: { action: DispatchAction; message: DeepRequired<IncomingMessage> }) => void;\n}\n\nexport const Toast: FunctionComponent<ToastProps> = (props: ToastProps) => {\n const { dispatch, onDismiss, ...message } = props;\n const { content, dismissed, timeoutId, translateY } = message;\n\n const handleTransEnd = useCallback(\n (e: TransitionEvent<HTMLDivElement>) => {\n if (dismissed && e.propertyName === 'opacity') {\n dispatch({ action: 'remove', message } as any);\n }\n },\n [dismissed]\n );\n\n const dismiss = useCallback(() => {\n clearTimeout(timeoutId);\n if (dismissed) return;\n dispatch({ action: 'dismiss', message } as any);\n onDismiss?.({ id: message.id, timeout: false });\n }, [timeoutId, dismissed, onDismiss]);\n\n return (\n <StyledToast\n style={{ '--translateY': `translateY(${translateY}rem)` } as CSSProperties}\n dismissed={dismissed}\n onTransitionEnd={handleTransEnd}\n >\n <StyledToastContent>{content}</StyledToastContent>\n <Button as={StyledToastButton} variant='simple' onClick={dismiss} icon>\n <Icon name='times' />\n </Button>\n </StyledToast>\n );\n};\n\nconst Toaster: FunctionComponent<ToasterProps> = ({\n children,\n dismissAfter = Infinity,\n onDismiss,\n context = ToasterContext\n}: ToasterProps) => {\n const { portalTarget } = useConfiguration();\n\n const [messages, dispatch] = useReducer(reducer, []);\n useLayoutEffect(() => {\n reflow();\n dispatch({ action: 'adjust' });\n }, [messages.length]);\n\n const providerValue = useMemo(\n () => ({\n push(incoming: IncomingMessage) {\n const message: DeepRequired<IncomingMessage> = {\n ...incoming,\n id: incoming.id ?? createUID()\n } as DeepRequired<IncomingMessage>;\n\n const dismissTime = message.dismissAfter ?? dismissAfter;\n\n if (Number.isFinite(dismissTime)) {\n message.timeoutId = setTimeout(\n (timedOutMsg: ToastMessage) => {\n dispatch({ action: 'dismiss', message });\n (message.onDismiss || onDismiss)?.({ id: timedOutMsg.id, timeout: true });\n },\n dismissTime,\n message\n );\n }\n\n dispatch({\n action: 'push',\n message\n });\n },\n [initializedKey]: true\n }),\n [onDismiss, dismissAfter]\n );\n\n // Don't create additional ToasterContext.Providers.\n const priorCtx = useContext(context);\n if (priorCtx[initializedKey])\n return <ToasterContext.Provider value={priorCtx}>{children}</ToasterContext.Provider>;\n\n return (\n <>\n <ToasterContext.Provider value={providerValue}>{children}</ToasterContext.Provider>\n {!!messages.length &&\n portalTarget &&\n createPortal(\n <StyledToaster>\n {messages.map(message => (\n <Toast onDismiss={onDismiss} {...message} key={message.id} dispatch={dispatch} />\n ))}\n </StyledToaster>,\n portalTarget\n )}\n </>\n );\n};\n\nexport default Toaster;\n"]}
1
+ {"version":3,"file":"Toaster.js","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.tsx"],"names":[],"mappings":";;AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EACV,WAAW,EACX,OAAO,EACP,eAAe,EAMhB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aA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unctionComponent,\n ReactNode,\n CSSProperties,\n TransitionEvent,\n Context\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport styled, { css } from 'styled-components';\n\nimport Button from '../Button';\nimport Icon, { registerIcon } from '../Icon';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport { reflow, createUID } from '../../utils';\nimport { DeepRequired } from '../../types';\nimport { useConfiguration } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\n\nregisterIcon(timesIcon);\n\nexport const initializedKey = Symbol.for('@pega/cosmos-react-core.toaster.initialized');\n\nexport interface ToasterContextValue {\n push: (message: IncomingMessage) => void;\n [initializedKey]: boolean;\n}\n\nexport const ToasterContext = createContext<ToasterContextValue>({\n push: () => {},\n [initializedKey]: false\n});\n\ninterface ToastMessage {\n /** String to identify the specific message. Used as onDismiss callback arg. */\n id: string;\n /** Recommend a simple string message. */\n content: ReactNode;\n /**\n * Time in milliseconds to automatically dismiss toast.\n * Can be set globally on Toaster and overridden individually at a message level.\n * @default Infinity\n */\n dismissAfter?: number;\n /** Called when user or timer dismisses toasts. Callback is passed the message id and boolean indicating if the dismissal was timed. */\n onDismiss?: ({ id, timeout }: { id: string; timeout: boolean }) => void;\n /** internal prop */\n dismissed: boolean;\n /** internal prop */\n timeoutId?: number;\n /** internal prop */\n translateY: number;\n}\n\nexport interface IncomingMessage {\n /** Id of the Toast. */\n id?: string;\n /** The content to display within the Toast. */\n content: ReactNode;\n /**\n * Time in milliseconds to automatically dismiss Toast.\n * Can be set globally on Toaster and overridden individually at a message level.\n * @default Infinity\n */\n dismissAfter?: ToastMessage['dismissAfter'];\n /** Called when user or timer dismisses Toasts. Callback is passed the message id and boolean indicating if the dismissal was timed. */\n onDismiss?: ToastMessage['onDismiss'];\n /** The id of the timeout controlling the Toast duration. */\n timeoutId?: ToastMessage['timeoutId'];\n}\n\nexport interface ToasterProps {\n /** The element(s) responsible for handling the Toaster state. */\n children: ReactNode;\n /**\n * Time in milliseconds to automatically dismiss Toast.\n * Can be set globally on Toaster and overridden individually at a message level.\n * @default Infinity\n */\n dismissAfter?: ToastMessage['dismissAfter'];\n /** Called when user or timer dismisses Toasts. Callback is passed the message id and boolean indicating if the dismissal was timed. */\n onDismiss?: ToastMessage['onDismiss'];\n /** Context to read previous values from. */\n context?: Context<ToasterContextValue>;\n}\n\ntype DispatchAction = 'push' | 'dismiss' | 'remove' | 'adjust';\n\nfunction reducer(\n current: ToastMessage[],\n { action, message: incoming }: { action: DispatchAction; message?: DeepRequired<IncomingMessage> }\n) {\n switch (action) {\n case 'push':\n if (!incoming) return current;\n return [\n ...current,\n {\n content: incoming.content,\n dismissed: false,\n dismissAfter: incoming.dismissAfter,\n timeoutId: incoming.timeoutId,\n id: incoming.id,\n onDismiss: incoming.onDismiss,\n translateY: 0\n }\n ];\n\n case 'adjust':\n return current.map((m, i) => {\n const height = 2.625;\n const margin = 0.5;\n const msgSpace = Number((height + margin).toFixed(1));\n const count = current.length - i;\n m.translateY = -(count * msgSpace);\n return m;\n });\n\n case 'dismiss':\n if (!incoming) return current;\n return current.map(m => {\n m.dismissed = m.dismissed || m.id === incoming.id;\n return m;\n });\n\n case 'remove':\n if (!incoming) return current;\n return current.filter(m => m.id !== incoming.id);\n\n default:\n return current;\n }\n}\n\nconst StyledToastButton = styled.button(\n ({ theme }) => css`\n border: none;\n color: inherit;\n padding: 0;\n font-size: 1rem;\n\n &:enabled:hover {\n background: #ffffff19;\n }\n\n &:enabled:focus {\n box-shadow: ${theme.base.shadow['focus-inverted']};\n }\n `\n);\n\nStyledToastButton.defaultProps = defaultThemeProp;\n\nconst StyledToastContent = styled.div`\n flex: 1;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n`;\n\nconst StyledToast = styled.div<{ dismissed: boolean }>(({ dismissed, theme }) => {\n return css`\n position: absolute;\n display: flex;\n align-items: center;\n font-size: 0.875rem;\n height: 2.625rem;\n width: 100%;\n top: 0;\n left: 0;\n padding: calc(1.5 * ${theme.base.spacing}) ${theme.base.spacing};\n padding-left: calc(2 * ${theme.base.spacing});\n background: ${theme.base.colors.slate['extra-dark']};\n color: ${theme.base.colors.white};\n border-radius: calc(${theme.base['border-radius']} / 2);\n opacity: ${dismissed ? 0 : 1};\n will-change: transform;\n transform: var(--translateY) ${dismissed ? 'scale(0)' : ''};\n transition-property: transform, opacity;\n transition-duration: 0.3s;\n transition-timing-function: cubic-bezier(0.4, 0.6, 0.1, 1);\n `;\n});\n\nStyledToast.defaultProps = defaultThemeProp;\n\nconst StyledToaster = styled.div`\n position: fixed;\n z-index: ${({ theme }) => theme.base['z-index'].toast};\n width: 20rem;\n left: 50%;\n margin-left: -10rem;\n top: 100%;\n`;\n\nStyledToaster.defaultProps = defaultThemeProp;\n\ninterface ToastProps extends ToastMessage {\n dispatch: (message: { action: DispatchAction; message: DeepRequired<IncomingMessage> }) => void;\n}\n\nexport const Toast: FunctionComponent<ToastProps> = (props: ToastProps) => {\n const { dispatch, onDismiss, ...message } = props;\n const { content, dismissed, timeoutId, translateY } = message;\n\n const handleTransEnd = useCallback(\n (e: TransitionEvent<HTMLDivElement>) => {\n if (dismissed && e.propertyName === 'opacity') {\n dispatch({ action: 'remove', message } as any);\n }\n },\n [dismissed]\n );\n\n const dismiss = useCallback(() => {\n clearTimeout(timeoutId);\n if (dismissed) return;\n dispatch({ action: 'dismiss', message } as any);\n onDismiss?.({ id: message.id, timeout: false });\n }, [timeoutId, dismissed, onDismiss]);\n\n return (\n <StyledToast\n style={{ '--translateY': `translateY(${translateY}rem)` } as CSSProperties}\n dismissed={dismissed}\n onTransitionEnd={handleTransEnd}\n >\n <StyledToastContent>{content}</StyledToastContent>\n <Button as={StyledToastButton} variant='simple' onClick={dismiss} icon>\n <Icon name='times' />\n </Button>\n </StyledToast>\n );\n};\n\nconst Toaster: FunctionComponent<ToasterProps> = ({\n children,\n dismissAfter = Infinity,\n onDismiss,\n context = ToasterContext\n}: ToasterProps) => {\n const { portalTarget } = useConfiguration();\n\n const [messages, dispatch] = useReducer(reducer, []);\n useLayoutEffect(() => {\n reflow();\n dispatch({ action: 'adjust' });\n }, [messages.length]);\n\n const providerValue = useMemo(\n () => ({\n push(incoming: IncomingMessage) {\n const message: DeepRequired<IncomingMessage> = {\n ...incoming,\n id: incoming.id ?? createUID()\n } as DeepRequired<IncomingMessage>;\n\n const dismissTime = message.dismissAfter ?? dismissAfter;\n\n if (Number.isFinite(dismissTime)) {\n message.timeoutId = setTimeout(\n (timedOutMsg: ToastMessage) => {\n dispatch({ action: 'dismiss', message });\n (message.onDismiss || onDismiss)?.({ id: timedOutMsg.id, timeout: true });\n },\n dismissTime,\n message\n );\n }\n\n dispatch({\n action: 'push',\n message\n });\n },\n [initializedKey]: true\n }),\n [onDismiss, dismissAfter]\n );\n\n // Don't create additional ToasterContext.Providers.\n const priorCtx = useContext(context);\n if (priorCtx[initializedKey])\n return <ToasterContext.Provider value={priorCtx}>{children}</ToasterContext.Provider>;\n\n return (\n <>\n <ToasterContext.Provider value={providerValue}>{children}</ToasterContext.Provider>\n {!!messages.length &&\n portalTarget &&\n createPortal(\n <StyledToaster>\n {messages.map(message => (\n <Toast onDismiss={onDismiss} {...message} key={message.id} dispatch={dispatch} />\n ))}\n </StyledToaster>,\n portalTarget\n )}\n </>\n );\n};\n\nexport default Toaster;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoResize.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpD;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,oIAGK,IAAI,CAmC3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"useAutoResize.d.ts","sourceRoot":"","sources":["../../src/hooks/useAutoResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIpD;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,oIAGK,IAAI,CA4B3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -13,21 +13,20 @@ const useAutoResize = (maxHeight, minHeightProp) => {
13
13
  const [minHeight, setMinHeight] = useState(minHeightProp || 0);
14
14
  const autoResize = () => {
15
15
  if (element.current) {
16
+ let newMinHeight = minHeight;
16
17
  if (!minHeight) {
17
- setMinHeight(element.current.scrollHeight);
18
+ newMinHeight = element.current.scrollHeight;
19
+ setMinHeight(newMinHeight);
18
20
  }
19
21
  // Reset the heights to the base height so there is an overflow / or none to calculate the new height
20
- element.current.style.minHeight = `${minHeight}px`;
21
- element.current.style.height = `${minHeight}px`;
22
+ element.current.style.height = `${newMinHeight}px`;
22
23
  if (maxHeight) {
23
24
  element.current.style.overflowY =
24
25
  element.current.scrollHeight > maxHeight ? 'auto' : 'hidden';
25
- element.current.style.minHeight = `${Math.min(element.current.scrollHeight, maxHeight).toString()}px`;
26
- element.current.style.height = `${Math.min(element.current.scrollHeight, maxHeight).toString()}px`;
26
+ element.current.style.height = `${Math.min(element.current.scrollHeight, maxHeight)}px`;
27
27
  }
28
28
  else {
29
- element.current.style.minHeight = `${element.current.scrollHeight.toString()}px`;
30
- element.current.style.height = `${element.current.scrollHeight.toString()}px`;
29
+ element.current.style.height = `${element.current.scrollHeight}px`;
31
30
  }
32
31
  }
33
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoResize.js","sourceRoot":"","sources":["../../src/hooks/useAutoResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAa,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,CACpB,SAAkB,EAClB,aAAsB,EACM,EAAE;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAEhC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,aAAa,IAAI,CAAC,CAAC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C,OAAO,EAAE,mBAAmB,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useRef, useState, RefObject } from 'react';\n\nimport { debounce } from '../utils';\n\n/**\n * @example const [ref, resizeFunction] = useAutoResize();\n * maxHeight should be provided in pixels without units\n * minHeight should be provided in pixels without units\n * @returns * ref:: A reference for the element that the resize functionality should be applied to. [React RefObject](https://reactjs.org/docs/refs-and-the-dom.html)\n * * resizeFunction:: The function to call to automatically resize the element.\n * element refers to auto resizable element\n */\nconst useAutoResize = <T extends HTMLElement = HTMLElement>(\n maxHeight?: number,\n minHeightProp?: number\n): [RefObject<T>, () => void] => {\n const element = useRef<T>(null);\n\n const [minHeight, setMinHeight] = useState(minHeightProp || 0);\n\n const autoResize = () => {\n if (element.current) {\n if (!minHeight) {\n setMinHeight(element.current.scrollHeight);\n }\n // Reset the heights to the base height so there is an overflow / or none to calculate the new height\n element.current.style.minHeight = `${minHeight}px`;\n element.current.style.height = `${minHeight}px`;\n\n if (maxHeight) {\n element.current.style.overflowY =\n element.current.scrollHeight > maxHeight ? 'auto' : 'hidden';\n element.current.style.minHeight = `${Math.min(\n element.current.scrollHeight,\n maxHeight\n ).toString()}px`;\n element.current.style.height = `${Math.min(\n element.current.scrollHeight,\n maxHeight\n ).toString()}px`;\n } else {\n element.current.style.minHeight = `${element.current.scrollHeight.toString()}px`;\n element.current.style.height = `${element.current.scrollHeight.toString()}px`;\n }\n }\n };\n\n const debouncedAutoResize = debounce(autoResize, 100);\n\n return [element, debouncedAutoResize];\n};\n\nexport default useAutoResize;\n"]}
1
+ {"version":3,"file":"useAutoResize.js","sourceRoot":"","sources":["../../src/hooks/useAutoResize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAa,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,CACpB,SAAkB,EAClB,aAAsB,EACM,EAAE;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAEhC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,aAAa,IAAI,CAAC,CAAC,CAAC;IAE/D,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,IAAI,OAAO,CAAC,OAAO,EAAE;YACnB,IAAI,YAAY,GAAG,SAAS,CAAC;YAC7B,IAAI,CAAC,SAAS,EAAE;gBACd,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;gBAC5C,YAAY,CAAC,YAAY,CAAC,CAAC;aAC5B;YACD,qGAAqG;YACrG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,YAAY,IAAI,CAAC;YAEnD,IAAI,SAAS,EAAE;gBACb,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS;oBAC7B,OAAO,CAAC,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;gBAC/D,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,IAAI,CAAC;aACzF;iBAAM;gBACL,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,IAAI,CAAC;aACpE;SACF;IACH,CAAC,CAAC;IAEF,MAAM,mBAAmB,GAAG,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAEtD,OAAO,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useRef, useState, RefObject } from 'react';\n\nimport { debounce } from '../utils';\n\n/**\n * @example const [ref, resizeFunction] = useAutoResize();\n * maxHeight should be provided in pixels without units\n * minHeight should be provided in pixels without units\n * @returns * ref:: A reference for the element that the resize functionality should be applied to. [React RefObject](https://reactjs.org/docs/refs-and-the-dom.html)\n * * resizeFunction:: The function to call to automatically resize the element.\n * element refers to auto resizable element\n */\nconst useAutoResize = <T extends HTMLElement = HTMLElement>(\n maxHeight?: number,\n minHeightProp?: number\n): [RefObject<T>, () => void] => {\n const element = useRef<T>(null);\n\n const [minHeight, setMinHeight] = useState(minHeightProp || 0);\n\n const autoResize = () => {\n if (element.current) {\n let newMinHeight = minHeight;\n if (!minHeight) {\n newMinHeight = element.current.scrollHeight;\n setMinHeight(newMinHeight);\n }\n // Reset the heights to the base height so there is an overflow / or none to calculate the new height\n element.current.style.height = `${newMinHeight}px`;\n\n if (maxHeight) {\n element.current.style.overflowY =\n element.current.scrollHeight > maxHeight ? 'auto' : 'hidden';\n element.current.style.height = `${Math.min(element.current.scrollHeight, maxHeight)}px`;\n } else {\n element.current.style.height = `${element.current.scrollHeight}px`;\n }\n }\n };\n\n const debouncedAutoResize = debounce(autoResize, 100);\n\n return [element, debouncedAutoResize];\n};\n\nexport default useAutoResize;\n"]}
@@ -557,6 +557,10 @@ declare const useI18n: () => import("../i18n/translate").TranslationFunction<Rea
557
557
  confirmation_details: string;
558
558
  confirmation_whats_next: string;
559
559
  confirmation_open_tasks: string;
560
+ start: string;
561
+ end: string;
562
+ node: string;
563
+ search_nodes: string;
560
564
  }>>;
561
565
  export default useI18n;
562
566
  //# sourceMappingURL=useI18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/useI18n.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAGZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -552,5 +552,9 @@
552
552
  "alternateStage": "Alternate Stage",
553
553
  "confirmation_details": "Details",
554
554
  "confirmation_whats_next": "What's next",
555
- "confirmation_open_tasks": "Open tasks"
555
+ "confirmation_open_tasks": "Open tasks",
556
+ "start": "Start",
557
+ "end": "End",
558
+ "node": "Node",
559
+ "search_nodes": "Search nodes"
556
560
  }
@@ -556,6 +556,10 @@ declare const create: (translations?: Partial<{
556
556
  confirmation_details: string;
557
557
  confirmation_whats_next: string;
558
558
  confirmation_open_tasks: string;
559
+ start: string;
560
+ end: string;
561
+ node: string;
562
+ search_nodes: string;
559
563
  }> | undefined) => Readonly<TranslationPack>;
560
564
  export default create;
561
565
  export declare const DefaultTranslation: Readonly<Readonly<{
@@ -1113,6 +1117,10 @@ export declare const DefaultTranslation: Readonly<Readonly<{
1113
1117
  confirmation_details: string;
1114
1118
  confirmation_whats_next: string;
1115
1119
  confirmation_open_tasks: string;
1120
+ start: string;
1121
+ end: string;
1122
+ node: string;
1123
+ search_nodes: string;
1116
1124
  }>>;
1117
1125
  export declare const direction: (localeTag: string) => 'ltr' | 'rtl';
1118
1126
  //# sourceMappingURL=i18n.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,gBAAgB,CAAC;AAEhD,oBAAY,eAAe,GAAG,QAAQ,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAClE,oBAAY,WAAW,GAAG,OAAO,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE7D,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAW,CAAC;AAiB3C,eAAO,MAAM,SAAS,cAAe,MAAM,KAAG,KAAK,GAAG,KAErD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-core",
3
- "version": "2.0.0-dev.16.1",
3
+ "version": "2.0.0-dev.16.2",
4
4
  "description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
5
5
  "author": "Pegasystems",
6
6
  "license": "SEE LICENSE IN LICENSE",