@pega/cosmos-react-core 4.0.0-dev.14.0 → 4.0.0-dev.14.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.
- package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.js +0 -2
- package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +0 -4
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +6 -5
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/AppShellList.d.ts +1 -1
- package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.js.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellList.styles.js +0 -1
- package/lib/components/AppShell/AppShellList.styles.js.map +1 -1
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationList.js.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.js +31 -11
- package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
- package/lib/components/AppShell/Operator.d.ts.map +1 -1
- package/lib/components/AppShell/Operator.js +1 -3
- package/lib/components/AppShell/Operator.js.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts +2 -2
- package/lib/components/Avatar/Avatar.js.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts +9 -21
- package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +0 -2
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/Badges/Count.d.ts +1 -1
- package/lib/components/Badges/Count.js.map +1 -1
- package/lib/components/Banner/Banner.d.ts +1 -1
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Boolean/BooleanDisplay.d.ts +2 -2
- package/lib/components/Boolean/BooleanDisplay.js.map +1 -1
- package/lib/components/Button/BareButton.d.ts +1 -1
- package/lib/components/Button/BareButton.js.map +1 -1
- package/lib/components/Button/Button.d.ts +4 -8
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/lib/components/ColorPicker/ColorPicker.js.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.types.d.ts +2 -6
- package/lib/components/CompositeInput/CompositeInput.types.d.ts.map +1 -1
- package/lib/components/CompositeInput/CompositeInput.types.js.map +1 -1
- package/lib/components/Configuration/Configuration.d.ts +9 -27
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/CreditCard/utils.d.ts +1 -1
- package/lib/components/CreditCard/utils.d.ts.map +1 -1
- package/lib/components/CreditCard/utils.js +1 -1
- package/lib/components/CreditCard/utils.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.d.ts +3 -7
- package/lib/components/Currency/CurrencyInput.types.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.types.js.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.d.ts +4 -10
- package/lib/components/DateTime/DateTimeDisplay.d.ts.map +1 -1
- package/lib/components/DateTime/DateTimeDisplay.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts +1 -3
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts +1 -3
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts +1 -3
- package/lib/components/DateTime/Input/TimeRangeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeRangeInput.js.map +1 -1
- package/lib/components/DateTime/Input/usePickerButton.js +3 -3
- package/lib/components/DateTime/Input/usePickerButton.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.d.ts +4 -6
- package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.types.d.ts +2 -4
- package/lib/components/DateTime/Picker/DatePicker.types.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.types.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.d.ts +1 -3
- package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.d.ts +1 -3
- package/lib/components/DateTime/Picker/Weeks.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Weeks.js.map +1 -1
- package/lib/components/DateTime/Picker/utils.js +1 -1
- package/lib/components/DateTime/Picker/utils.js.map +1 -1
- package/lib/components/Dialog/Dialog.types.d.ts +11 -33
- package/lib/components/Dialog/Dialog.types.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.types.js.map +1 -1
- package/lib/components/Dialog/InfoDialog.js +1 -1
- package/lib/components/Dialog/InfoDialog.js.map +1 -1
- package/lib/components/Drawer/Drawer.d.ts +9 -9
- package/lib/components/Drawer/Drawer.d.ts.map +1 -1
- package/lib/components/Drawer/Drawer.js.map +1 -1
- package/lib/components/Email/EmailDisplay.d.ts +1 -1
- package/lib/components/Email/EmailDisplay.js.map +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.styles.d.ts.map +1 -1
- package/lib/components/EmojiPicker/EmojiPicker.styles.js +1 -6
- package/lib/components/EmojiPicker/EmojiPicker.styles.js.map +1 -1
- package/lib/components/ExpandCollapse/ExpandCollapse.d.ts +6 -6
- package/lib/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
- package/lib/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.d.ts +1 -3
- package/lib/components/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts +1 -1
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/File/FileDisplay.d.ts +2 -2
- package/lib/components/File/FileDisplay.d.ts.map +1 -1
- package/lib/components/File/FileDisplay.js.map +1 -1
- package/lib/components/File/FileInput.d.ts +1 -3
- package/lib/components/File/FileInput.d.ts.map +1 -1
- package/lib/components/File/FileInput.js.map +1 -1
- package/lib/components/FormControl/FormControl.d.ts +3 -2
- package/lib/components/FormControl/FormControl.d.ts.map +1 -1
- package/lib/components/FormControl/FormControl.js.map +1 -1
- package/lib/components/FormField/FormField.d.ts +2 -2
- package/lib/components/FormField/FormField.d.ts.map +1 -1
- package/lib/components/FormField/FormField.js +10 -14
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/Grid/Grid.d.ts.map +1 -1
- package/lib/components/Grid/Grid.js +0 -3
- package/lib/components/Grid/Grid.js.map +1 -1
- package/lib/components/Grid/Grid.types.d.ts +6 -6
- package/lib/components/Grid/Grid.types.js.map +1 -1
- package/lib/components/Input/Input.d.ts +1 -1
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Label/Label.d.ts +1 -1
- package/lib/components/Label/Label.js.map +1 -1
- package/lib/components/Lightbox/Lightbox.types.d.ts +1 -1
- package/lib/components/Lightbox/Lightbox.types.d.ts.map +1 -1
- package/lib/components/Lightbox/Lightbox.types.js.map +1 -1
- package/lib/components/Link/Link.d.ts +1 -1
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.d.ts +2 -2
- package/lib/components/ListToolbar/ListToolbar.types.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.types.js.map +1 -1
- package/lib/components/Location/LocationDisplay.d.ts +1 -1
- package/lib/components/Location/LocationDisplay.js.map +1 -1
- package/lib/components/Location/utils.d.ts +1 -1
- package/lib/components/Location/utils.d.ts.map +1 -1
- package/lib/components/Location/utils.js +1 -1
- package/lib/components/Location/utils.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +6 -12
- package/lib/components/Menu/Menu.types.d.ts.map +1 -1
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts +1 -1
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +3 -5
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.types.d.ts +25 -71
- package/lib/components/Modal/Modal.types.d.ts.map +1 -1
- package/lib/components/Modal/Modal.types.js.map +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.d.ts.map +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.js +4 -0
- package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.d.ts.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.js +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.js.map +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.types.d.ts +1 -1
- package/lib/components/MultiStepForm/MultiStepForm.types.js.map +1 -1
- package/lib/components/Phone/PhoneDisplay.d.ts +1 -1
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +4 -4
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +16 -1
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/modifiers.d.ts.map +1 -1
- package/lib/components/Popover/modifiers.js +25 -6
- package/lib/components/Popover/modifiers.js.map +1 -1
- package/lib/components/Progress/Progress.types.d.ts +2 -2
- package/lib/components/Progress/Progress.types.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.d.ts +1 -1
- package/lib/components/SearchInput/SearchInput.js.map +1 -1
- package/lib/components/Skeleton/LineSkeleton.d.ts +2 -2
- package/lib/components/Skeleton/LineSkeleton.js.map +1 -1
- package/lib/components/Skeleton/RectangleSkeleton.d.ts +3 -3
- package/lib/components/Skeleton/RectangleSkeleton.js.map +1 -1
- package/lib/components/Slider/Slider.types.d.ts +3 -9
- package/lib/components/Slider/Slider.types.d.ts.map +1 -1
- package/lib/components/Slider/Slider.types.js.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.d.ts +2 -1
- package/lib/components/SummaryItem/SummaryItem.d.ts.map +1 -1
- package/lib/components/SummaryItem/SummaryItem.js.map +1 -1
- package/lib/components/SummaryList/SummaryList.d.ts +2 -2
- package/lib/components/SummaryList/SummaryList.d.ts.map +1 -1
- package/lib/components/SummaryList/SummaryList.js.map +1 -1
- package/lib/components/Table/Table.d.ts +1 -1
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Tabs/TabPanel.d.ts +1 -1
- package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/Tabs.types.d.ts +1 -1
- package/lib/components/Tabs/Tabs.types.js.map +1 -1
- package/lib/components/Text/Text.d.ts +2 -4
- package/lib/components/Text/Text.d.ts.map +1 -1
- package/lib/components/Text/Text.js.map +1 -1
- package/lib/components/Toaster/Toaster.types.d.ts +1 -1
- package/lib/components/Toaster/Toaster.types.d.ts.map +1 -1
- package/lib/components/Toaster/Toaster.types.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts +3 -3
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/URL/URLDisplay.d.ts +1 -1
- package/lib/components/URL/URLDisplay.js +2 -2
- package/lib/components/URL/URLDisplay.js.map +1 -1
- package/lib/hooks/useArrows.js +1 -1
- package/lib/hooks/useArrows.js.map +1 -1
- package/lib/i18n/translate.d.ts +2 -6
- package/lib/i18n/translate.d.ts.map +1 -1
- package/lib/i18n/translate.js.map +1 -1
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/utils/kebabToCamel.d.ts +1 -3
- package/lib/utils/kebabToCamel.d.ts.map +1 -1
- package/lib/utils/kebabToCamel.js +1 -3
- package/lib/utils/kebabToCamel.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SummaryList.js","sourceRoot":"","sources":["../../../src/components/SummaryList/SummaryList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,OAAO,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,OAAyB,MAAM,YAAY,CAAC;AACnD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,UAA+B,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,WAAiC,MAAM,gBAAgB,CAAC;AAC/D,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,UAAU,MAAM,eAAe,CAAC;AAuCvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,UAAU,CACp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C,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,IAAI,GAAQ,EACxC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAC,KAAK,cAAE,KAAK,GAAS,IAC/C,EACN,OAAO,IAAI,KAAC,OAAO,IAAC,KAAK,EAAE,OAAO,GAAI,IAC5B,CACd,EAED,KAAC,wBAAwB,IAAC,OAAO,EAAE,OAAO,YAAG,OAAO,GAA4B,EAE/E,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,IAAI,SAAS,IAAI,CAC3E,KAAC,UAAU,IAAC,OAAO,EAAC,QAAQ,YAC1B,KAAC,MAAM,IACL,OAAO,EAAC,MAAM,gBACF,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAC3E,OAAO,EAAE,SAAS,YAEjB,CAAC,CAAC,UAAU,CAAC,GACP,GACE,CACd,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, FC, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Actions, { ActionsProps } from '../Actions';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Count from '../Badges/Count';\nimport Icon from '../Icon';\nimport Card, { CardHeader, CardContent, CardFooter } from '../Card';\nimport EmptyState, { EmptyStateProps } from '../EmptyState';\nimport { ForwardProps, NoChildrenProp, OmitStrict, Action } from '../../types';\nimport { omitProps } from '../../styles';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport SummaryItem, { SummaryItemProps } from '../SummaryItem';\nimport Progress from '../Progress';\nimport Button from '../Button';\nimport ErrorState from '../ErrorState';\nimport type { ErrorStateProps } from '../ErrorState';\n\nexport interface SummaryListProps extends NoChildrenProp {\n /** Name of the utility to be used as its heading along with associated actions and aria attributes. */\n name?: string;\n /** Identifier for the icon within Pega icons.
|
|
1
|
+
{"version":3,"file":"SummaryList.js","sourceRoot":"","sources":["../../../src/components/SummaryList/SummaryList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA4B,OAAO,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,OAAyB,MAAM,YAAY,CAAC;AACnD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,UAA+B,MAAM,eAAe,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,WAAiC,MAAM,gBAAgB,CAAC;AAC/D,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,UAAU,MAAM,eAAe,CAAC;AAuCvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,UAAU,CACpE,SAAS,CAAC,SAAS,CAAC,CACrB,CACC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;MACvB,OAAO;IACT,GAAG,CAAA;;KAEF;;;uCAGkC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;GAErE,CACF,CAAC;AAEF,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,C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,EAE/E,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,IAAI,SAAS,IAAI,CAC3E,KAAC,UAAU,IAAC,OAAO,EAAC,QAAQ,YAC1B,KAAC,MAAM,IACL,OAAO,EAAC,MAAM,gBACF,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,EAC3E,OAAO,EAAE,SAAS,YAEjB,CAAC,CAAC,UAAU,CAAC,GACP,GACE,CACd,IACI,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, FC, useMemo } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport Actions, { ActionsProps } from '../Actions';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport Count from '../Badges/Count';\nimport Icon from '../Icon';\nimport Card, { CardHeader, CardContent, CardFooter } from '../Card';\nimport EmptyState, { EmptyStateProps } from '../EmptyState';\nimport { ForwardProps, NoChildrenProp, OmitStrict, Action } from '../../types';\nimport { omitProps } from '../../styles';\nimport { useI18n } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport SummaryItem, { SummaryItemProps } from '../SummaryItem';\nimport Progress from '../Progress';\nimport Button from '../Button';\nimport ErrorState from '../ErrorState';\nimport type { ErrorStateProps } from '../ErrorState';\n\nexport interface SummaryListProps extends NoChildrenProp {\n /** Name of the utility to be used as its heading along with associated actions and aria attributes. */\n name?: string;\n /** Identifier for the icon within Pega icons. */\n icon?: string;\n /** Integer representing the total count of items for a list utility dataset. */\n count?: number;\n /** Top level actions for the utility. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n /** If the utility is in a state of fetching data. */\n loading?: boolean | string;\n /** An array of SummaryListItem objects to render. Pass an appropriately limited length array with a desired sort order based on design system defaults or config. */\n items: SummaryListItem[];\n /** User click initiated callback for when to show view all modal. List lengths less than the count prop will display a \"View all\" button with this function is bound to. */\n onViewAll?: (callback: Function) => void;\n /** A simple message to display when there are no items. */\n noItemsText?: EmptyStateProps['message'];\n /**\n * Indicate an error occurred while acquiring data for the list.\n * The default error state may be overridden with custom props.\n */\n error?: boolean | ErrorStateProps;\n /** Ref for the SummaryList's root element. */\n ref?: Ref<HTMLElement>;\n}\n\nexport interface SummaryListItem\n extends OmitStrict<SummaryItemProps, 'actions'>,\n Pick<ActionsProps, 'contextualLabel'>,\n ForwardProps {\n /** A unique id to represent the item. */\n id: string;\n /** A set of Actions to render alongside the item. If more than one action is passed a consolidated ActionMenu will be generated. */\n actions?: Action[];\n}\n\nexport const StyledSummaryListContent = styled(CardContent).withConfig<{ loading?: boolean }>(\n omitProps('loading')\n)(\n ({ theme, loading }) => css`\n ${loading &&\n css`\n min-height: 4rem;\n `}\n\n &:not(:last-child) > ul > li:last-child {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListContent.defaultProps = defaultThemeProp;\n\nexport const StyledSummaryListItem: typeof SummaryItem = styled(SummaryItem)(\n ({ theme }) =>\n css`\n padding: ${theme.base.spacing} 0;\n\n &:not(:last-child) {\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n `\n);\n\nStyledSummaryListItem.defaultProps = defaultThemeProp;\n\nexport const SummaryListItems = ({ name, items }: Pick<SummaryListProps, 'items' | 'name'>) => {\n const t = useI18n();\n return (\n <ul>\n {items.map(({ id, actions: itemActions, contextualLabel, ...restItemProps }) => {\n return (\n <StyledSummaryListItem\n key={id}\n {...restItemProps}\n forwardedAs='li'\n actions={\n itemActions && (\n <Actions\n items={itemActions}\n contextualLabel={\n name && contextualLabel\n ? t('action_from_summarylist_heading', [contextualLabel, name])\n : contextualLabel\n }\n />\n )\n }\n />\n );\n })}\n </ul>\n );\n};\n\nconst SummaryList: FC<SummaryListProps & ForwardProps> = forwardRef(\n (\n {\n icon,\n name,\n count,\n actions,\n items,\n onViewAll,\n loading,\n noItemsText,\n error,\n ...restProps\n }: PropsWithoutRef<SummaryListProps>,\n ref: SummaryListProps['ref']\n ) => {\n const t = useI18n();\n\n const content = useMemo(() => {\n if (loading) {\n return (\n <Progress placement='local' message={typeof loading === 'string' ? loading : undefined} />\n );\n }\n\n if (error) {\n return <ErrorState {...(error === true ? {} : error)} />;\n }\n\n return items.length > 0 ? (\n <SummaryListItems name={name} items={items} />\n ) : (\n <EmptyState message={noItemsText} />\n );\n }, [loading, items, noItemsText, error]);\n\n return (\n <Card ref={ref} {...restProps}>\n {(icon || name || typeof count === 'number' || actions) && (\n <CardHeader>\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n {icon && <Icon name={icon} />}\n {name && <Text variant='h2'>{name}</Text>}\n {typeof count === 'number' && <Count>{count}</Count>}\n </Flex>\n {actions && <Actions items={actions} />}\n </CardHeader>\n )}\n\n <StyledSummaryListContent loading={loading}>{content}</StyledSummaryListContent>\n\n {!error && typeof count === 'number' && count > items.length && onViewAll && (\n <CardFooter justify='center'>\n <Button\n variant='link'\n aria-label={name ? t('view_all_noun', [name.toLowerCase()]) : t('view_all')}\n onClick={onViewAll}\n >\n {t('view_all')}\n </Button>\n </CardFooter>\n )}\n </Card>\n );\n }\n);\n\nexport default SummaryList;\n"]}
|
|
@@ -10,7 +10,7 @@ export interface ColumnProps<RowData extends DefaultRowData = DefaultRowData> {
|
|
|
10
10
|
label: string;
|
|
11
11
|
/**
|
|
12
12
|
* The text alignment of the column header and the row contents for the column.
|
|
13
|
-
* @default
|
|
13
|
+
* @default 'left'
|
|
14
14
|
*/
|
|
15
15
|
align?: 'left' | 'center' | 'right';
|
|
16
16
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAgE,MAAM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AQ,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,CAAC,CAC/C,eAAC,UAAU,IAAC,EAAE,EAAE,cAAc,KAAM,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,EAAE,EAAE,IACnE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,KAAC,QAAQ,OAAK,GAAG,GAAI,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAC5D,CACd,CAAC,IALK,GAAG,CAAC,EAAE,CAMV,CACN,CAAC,EACH,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CAChC,uBACE,KAAC,eAAe,IAAC,OAAO,EAAE,OAAO,CAAC,MAAM,YACtC,KAAC,UAAU,KAAG,GACE,GACf,CACN,IACK,IACI,GACK,IACT,GACT,CACR,CAAC;AACJ,CAAC,CAEuB,CAAC;AAEzB,eAAe,KAAK,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, ReactNode, ReactElement, ComponentType } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport type { BaseProps, ForwardProps, NoChildrenProp, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport Progress from '../Progress';\nimport Text from '../Text';\nimport EmptyState from '../EmptyState';\nimport Card, { CardContent } from '../Card';\n\nexport interface DefaultRowData {\n id: string | number;\n}\n\nexport interface ColumnProps<RowData extends DefaultRowData = DefaultRowData> {\n /** Render cell content for a column with a component or by passing a property key on the row object to serve as an accessor. */\n renderer: ComponentType<RowData> | keyof RowData;\n /** The visual label for the column. */\n label: string;\n /**\n * The text alignment of the column header and the row contents for the column.\n * @default \"left\"\n */\n align?: 'left' | 'center' | 'right';\n /**\n * If true, this column will not wrap text on overflow.\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport interface TableProps<RowData extends DefaultRowData = DefaultRowData>\n extends BaseProps,\n NoChildrenProp {\n /** The column headers that will structure the Table. */\n columns: ColumnProps<RowData>[];\n /**\n * The content of the Table, represented as an array of objects with key value pairs.\n * @default []\n */\n data?: RowData[];\n /**\n * Should the data rows highlight when the mouse hovers over them.\n * @default false\n */\n hoverHighlight?: boolean;\n /**\n * Indicates if the data to populate the Table is still loading.\n * @default false\n */\n loading?: boolean;\n /** A message to be displayed when Table data is loading. */\n loadingMessage?: string;\n /** The title that will render above the Table if provided. */\n title?: ReactNode;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLTableElement>;\n}\n\ntype TablePropsWithDefaults = PropsWithDefaults<TableProps, 'hoverHighlight' | 'loading'>;\n\nconst StyledTable = styled.table<Pick<TablePropsWithDefaults, 'hoverHighlight'>>(props => {\n const {\n hoverHighlight,\n theme: {\n base: {\n palette: { 'secondary-background': hoverBg },\n spacing\n },\n components: { table }\n }\n } = props;\n\n const verticalSpacingHeader = `calc(${table.header['vertical-spacing']} * ${spacing})`;\n const verticalSpacingBody = `calc(${table.body['vertical-spacing']} * ${spacing})`;\n const horizontalSpacing = `calc(max(${table.header['horizontal-spacing']}, ${table.body['horizontal-spacing']}) * ${spacing})`;\n\n const borderHeader = `${table.header['border-width']} solid ${table.header['border-color']}`;\n const borderBody = `${table.body['border-width']} solid ${table.body['border-color']}`;\n\n return css`\n border-collapse: collapse;\n width: 100%;\n background-color: transparent;\n\n thead {\n tr th {\n padding: ${`${table.spacing['vertical-inner'] ? verticalSpacingHeader : '0'} ${\n table.spacing['horizontal-inner'] ? horizontalSpacing : '0'\n }`};\n border-bottom: ${table.border['horizontal-inner'] ? borderHeader : 'none'};\n border-inline-end: ${table.border['vertical-inner'] ? borderHeader : 'none'};\n }\n\n tr:first-of-type th {\n padding-top: ${table.spacing['vertical-outer'] ? verticalSpacingHeader : '0'};\n border-top: ${table.border['horizontal-outer'] ? borderHeader : 'none'};\n }\n\n tr th:first-of-type {\n padding-inline-start: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-start: ${table.border['vertical-outer'] ? borderHeader : 'none'};\n }\n\n tr th:last-of-type {\n padding-inline-end: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-end: ${table.border['vertical-outer'] ? borderHeader : 'none'};\n }\n }\n\n tbody {\n tr td {\n padding: ${`${table.spacing['vertical-inner'] ? verticalSpacingBody : '0'} ${\n table.spacing['horizontal-inner'] ? horizontalSpacing : '0'\n }`};\n border-bottom: ${table.border['horizontal-inner'] ? borderBody : 'none'};\n border-inline-end: ${table.border['vertical-inner'] ? borderBody : 'none'};\n }\n\n tr:last-of-type td {\n padding-bottom: ${table.spacing['vertical-outer'] ? verticalSpacingBody : '0'};\n border-bottom: ${table.border['horizontal-outer'] ? borderBody : 'none'};\n }\n\n tr td:first-of-type {\n padding-inline-start: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-start: ${table.border['vertical-outer'] ? borderBody : 'none'};\n }\n\n tr td:last-of-type {\n padding-inline-end: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-end: ${table.border['vertical-outer'] ? borderBody : 'none'};\n }\n }\n\n ${hoverHighlight &&\n css`\n tbody tr:hover td,\n tbody tr:focus-within td {\n background-color: ${hoverBg};\n }\n `}\n `;\n});\n\nStyledTable.defaultProps = defaultThemeProp;\n\nconst StyledCell = styled.td<Pick<ColumnProps, 'align' | 'noWrap'>>(\n ({ align, noWrap = false }) => css`\n text-align: ${align || 'left'};\n white-space: ${noWrap ? 'nowrap' : null};\n `\n);\n\nStyledCell.defaultProps = defaultThemeProp;\n\nconst StyledHeaderCell = styled.th(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n table: { header }\n }\n }\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n font-size: ${fontSizes[header['font-size'] as FontSize]};\n font-weight: ${header['font-weight']};\n color: ${header['foreground-color']};\n background-color: ${header['background-color']};\n `;\n }\n);\n\nStyledHeaderCell.defaultProps = defaultThemeProp;\n\nconst StyledBodyCell = styled.td(\n ({\n theme: {\n components: {\n table: { body }\n }\n }\n }) => css`\n color: ${body['foreground-color']};\n background-color: ${body['background-color']};\n `\n);\n\nStyledBodyCell.defaultProps = defaultThemeProp;\n\nconst StyledEmptyCell = styled.td`\n padding: calc(2 * ${props => props.theme.base.spacing});\n`;\n\nStyledEmptyCell.defaultProps = defaultThemeProp;\n\nconst StyledLoadingCell = styled.td`\n position: relative;\n height: 6rem;\n`;\n\nexport const StyledTableWrapper = styled.div`\n /* Setting it on a table element requires 'display: block' which breaks a11y. */\n overflow-x: auto;\n`;\n\nStyledTableWrapper.defaultProps = defaultThemeProp;\n\nconst StyledTableCaption = styled.caption`\n ${hideVisually}\n`;\n\nStyledTableCaption.defaultProps = defaultThemeProp;\n\nconst Table = forwardRef((props: PropsWithoutRef<TableProps>, ref: Ref<HTMLTableElement>) => {\n const {\n columns,\n data = [],\n hoverHighlight = false,\n loading = false,\n loadingMessage = '',\n title,\n ...restProps\n } = props;\n\n return (\n <Card>\n <CardContent container={{ rowGap: 1 }}>\n {title && (\n <Text variant='h2' as='span' aria-hidden>\n {title}\n </Text>\n )}\n <StyledTableWrapper>\n <StyledTable ref={ref} hoverHighlight={hoverHighlight} {...restProps}>\n {title && <StyledTableCaption>{title}</StyledTableCaption>}\n <thead>\n <tr>\n {columns.map(col => (\n <StyledCell as={StyledHeaderCell} {...col} scope='col' key={col.label}>\n {col.label}\n </StyledCell>\n ))}\n </tr>\n </thead>\n <tbody>\n {loading && (\n <tr>\n <StyledLoadingCell colSpan={columns.length}>\n <Progress placement='local' message={loadingMessage} />\n </StyledLoadingCell>\n </tr>\n )}\n {data.length > 0 &&\n !loading &&\n data.map(row => (\n <tr key={row.id}>\n {columns.map(({ renderer: Renderer, ...col }) => (\n <StyledCell as={StyledBodyCell} {...col} key={`${col.label}-${row.id}`}>\n {typeof Renderer === 'function' ? <Renderer {...row} /> : row[Renderer]}\n </StyledCell>\n ))}\n </tr>\n ))}\n {data.length === 0 && !loading && (\n <tr>\n <StyledEmptyCell colSpan={columns.length}>\n <EmptyState />\n </StyledEmptyCell>\n </tr>\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </CardContent>\n </Card>\n );\n}) as <RowData extends DefaultRowData = DefaultRowData>(\n props: TableProps<RowData> & ForwardProps\n) => ReactElement | null;\n\nexport default Table;\n"]}
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAgE,MAAM,OAAO,CAAC;AACjG,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;AAC3D,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAqD5C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAiD,KAAK,CAAC,EAAE;IACvF,MAAM,EACJ,cAAc,EACd,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,EAC5C,OAAO,EACR,EACD,UAAU,EAAE,EAAE,KAAK,EAAE,EACtB,EACF,GAAG,KAAK,CAAC;IAEV,MAAM,qBAAqB,GAAG,QAAQ,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,MAAM,OAAO,GAAG,CAAC;IACvF,MAAM,mBAAmB,GAAG,QAAQ,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,OAAO,GAAG,CAAC;I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AC,KAAK,CACC,CACd,CAAC,GACC,GACC,EACR,4BACG,OAAO,IAAI,CACV,uBACE,KAAC,iBAAiB,IAAC,OAAO,EAAE,OAAO,CAAC,MAAM,YACxC,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,cAAc,GAAI,GACrC,GACjB,CACN,EACA,IAAI,CAAC,MAAM,GAAG,CAAC;wCACd,CAAC,OAAO;wCACR,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACd,uBACG,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,CAAC,CAC/C,eAAC,UAAU,IAAC,EAAE,EAAE,cAAc,KAAM,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,EAAE,EAAE,IACnE,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,KAAC,QAAQ,OAAK,GAAG,GAAI,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAC5D,CACd,CAAC,IALK,GAAG,CAAC,EAAE,CAMV,CACN,CAAC,EACH,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CAChC,uBACE,KAAC,eAAe,IAAC,OAAO,EAAE,OAAO,CAAC,MAAM,YACtC,KAAC,UAAU,KAAG,GACE,GACf,CACN,IACK,IACI,GACK,IACT,GACT,CACR,CAAC;AACJ,CAAC,CAEuB,CAAC;AAEzB,eAAe,KAAK,CAAC","sourcesContent":["import { forwardRef, PropsWithoutRef, Ref, ReactNode, ReactElement, ComponentType } from 'react';\nimport styled, { css } from 'styled-components';\nimport { hideVisually } from 'polished';\n\nimport type { BaseProps, ForwardProps, NoChildrenProp, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize, FontSize } from '../../styles';\nimport Progress from '../Progress';\nimport Text from '../Text';\nimport EmptyState from '../EmptyState';\nimport Card, { CardContent } from '../Card';\n\nexport interface DefaultRowData {\n id: string | number;\n}\n\nexport interface ColumnProps<RowData extends DefaultRowData = DefaultRowData> {\n /** Render cell content for a column with a component or by passing a property key on the row object to serve as an accessor. */\n renderer: ComponentType<RowData> | keyof RowData;\n /** The visual label for the column. */\n label: string;\n /**\n * The text alignment of the column header and the row contents for the column.\n * @default 'left'\n */\n align?: 'left' | 'center' | 'right';\n /**\n * If true, this column will not wrap text on overflow.\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport interface TableProps<RowData extends DefaultRowData = DefaultRowData>\n extends BaseProps,\n NoChildrenProp {\n /** The column headers that will structure the Table. */\n columns: ColumnProps<RowData>[];\n /**\n * The content of the Table, represented as an array of objects with key value pairs.\n * @default []\n */\n data?: RowData[];\n /**\n * Should the data rows highlight when the mouse hovers over them.\n * @default false\n */\n hoverHighlight?: boolean;\n /**\n * Indicates if the data to populate the Table is still loading.\n * @default false\n */\n loading?: boolean;\n /** A message to be displayed when Table data is loading. */\n loadingMessage?: string;\n /** The title that will render above the Table if provided. */\n title?: ReactNode;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLTableElement>;\n}\n\ntype TablePropsWithDefaults = PropsWithDefaults<TableProps, 'hoverHighlight' | 'loading'>;\n\nconst StyledTable = styled.table<Pick<TablePropsWithDefaults, 'hoverHighlight'>>(props => {\n const {\n hoverHighlight,\n theme: {\n base: {\n palette: { 'secondary-background': hoverBg },\n spacing\n },\n components: { table }\n }\n } = props;\n\n const verticalSpacingHeader = `calc(${table.header['vertical-spacing']} * ${spacing})`;\n const verticalSpacingBody = `calc(${table.body['vertical-spacing']} * ${spacing})`;\n const horizontalSpacing = `calc(max(${table.header['horizontal-spacing']}, ${table.body['horizontal-spacing']}) * ${spacing})`;\n\n const borderHeader = `${table.header['border-width']} solid ${table.header['border-color']}`;\n const borderBody = `${table.body['border-width']} solid ${table.body['border-color']}`;\n\n return css`\n border-collapse: collapse;\n width: 100%;\n background-color: transparent;\n\n thead {\n tr th {\n padding: ${`${table.spacing['vertical-inner'] ? verticalSpacingHeader : '0'} ${\n table.spacing['horizontal-inner'] ? horizontalSpacing : '0'\n }`};\n border-bottom: ${table.border['horizontal-inner'] ? borderHeader : 'none'};\n border-inline-end: ${table.border['vertical-inner'] ? borderHeader : 'none'};\n }\n\n tr:first-of-type th {\n padding-top: ${table.spacing['vertical-outer'] ? verticalSpacingHeader : '0'};\n border-top: ${table.border['horizontal-outer'] ? borderHeader : 'none'};\n }\n\n tr th:first-of-type {\n padding-inline-start: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-start: ${table.border['vertical-outer'] ? borderHeader : 'none'};\n }\n\n tr th:last-of-type {\n padding-inline-end: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-end: ${table.border['vertical-outer'] ? borderHeader : 'none'};\n }\n }\n\n tbody {\n tr td {\n padding: ${`${table.spacing['vertical-inner'] ? verticalSpacingBody : '0'} ${\n table.spacing['horizontal-inner'] ? horizontalSpacing : '0'\n }`};\n border-bottom: ${table.border['horizontal-inner'] ? borderBody : 'none'};\n border-inline-end: ${table.border['vertical-inner'] ? borderBody : 'none'};\n }\n\n tr:last-of-type td {\n padding-bottom: ${table.spacing['vertical-outer'] ? verticalSpacingBody : '0'};\n border-bottom: ${table.border['horizontal-outer'] ? borderBody : 'none'};\n }\n\n tr td:first-of-type {\n padding-inline-start: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-start: ${table.border['vertical-outer'] ? borderBody : 'none'};\n }\n\n tr td:last-of-type {\n padding-inline-end: ${table.spacing['horizontal-outer'] ? horizontalSpacing : '0'};\n border-inline-end: ${table.border['vertical-outer'] ? borderBody : 'none'};\n }\n }\n\n ${hoverHighlight &&\n css`\n tbody tr:hover td,\n tbody tr:focus-within td {\n background-color: ${hoverBg};\n }\n `}\n `;\n});\n\nStyledTable.defaultProps = defaultThemeProp;\n\nconst StyledCell = styled.td<Pick<ColumnProps, 'align' | 'noWrap'>>(\n ({ align, noWrap = false }) => css`\n text-align: ${align || 'left'};\n white-space: ${noWrap ? 'nowrap' : null};\n `\n);\n\nStyledCell.defaultProps = defaultThemeProp;\n\nconst StyledHeaderCell = styled.th(\n ({\n theme: {\n base: { 'font-size': fontSize, 'font-scale': fontScale },\n components: {\n table: { header }\n }\n }\n }) => {\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n font-size: ${fontSizes[header['font-size'] as FontSize]};\n font-weight: ${header['font-weight']};\n color: ${header['foreground-color']};\n background-color: ${header['background-color']};\n `;\n }\n);\n\nStyledHeaderCell.defaultProps = defaultThemeProp;\n\nconst StyledBodyCell = styled.td(\n ({\n theme: {\n components: {\n table: { body }\n }\n }\n }) => css`\n color: ${body['foreground-color']};\n background-color: ${body['background-color']};\n `\n);\n\nStyledBodyCell.defaultProps = defaultThemeProp;\n\nconst StyledEmptyCell = styled.td`\n padding: calc(2 * ${props => props.theme.base.spacing});\n`;\n\nStyledEmptyCell.defaultProps = defaultThemeProp;\n\nconst StyledLoadingCell = styled.td`\n position: relative;\n height: 6rem;\n`;\n\nexport const StyledTableWrapper = styled.div`\n /* Setting it on a table element requires 'display: block' which breaks a11y. */\n overflow-x: auto;\n`;\n\nStyledTableWrapper.defaultProps = defaultThemeProp;\n\nconst StyledTableCaption = styled.caption`\n ${hideVisually}\n`;\n\nStyledTableCaption.defaultProps = defaultThemeProp;\n\nconst Table = forwardRef((props: PropsWithoutRef<TableProps>, ref: Ref<HTMLTableElement>) => {\n const {\n columns,\n data = [],\n hoverHighlight = false,\n loading = false,\n loadingMessage = '',\n title,\n ...restProps\n } = props;\n\n return (\n <Card>\n <CardContent container={{ rowGap: 1 }}>\n {title && (\n <Text variant='h2' as='span' aria-hidden>\n {title}\n </Text>\n )}\n <StyledTableWrapper>\n <StyledTable ref={ref} hoverHighlight={hoverHighlight} {...restProps}>\n {title && <StyledTableCaption>{title}</StyledTableCaption>}\n <thead>\n <tr>\n {columns.map(col => (\n <StyledCell as={StyledHeaderCell} {...col} scope='col' key={col.label}>\n {col.label}\n </StyledCell>\n ))}\n </tr>\n </thead>\n <tbody>\n {loading && (\n <tr>\n <StyledLoadingCell colSpan={columns.length}>\n <Progress placement='local' message={loadingMessage} />\n </StyledLoadingCell>\n </tr>\n )}\n {data.length > 0 &&\n !loading &&\n data.map(row => (\n <tr key={row.id}>\n {columns.map(({ renderer: Renderer, ...col }) => (\n <StyledCell as={StyledBodyCell} {...col} key={`${col.label}-${row.id}`}>\n {typeof Renderer === 'function' ? <Renderer {...row} /> : row[Renderer]}\n </StyledCell>\n ))}\n </tr>\n ))}\n {data.length === 0 && !loading && (\n <tr>\n <StyledEmptyCell colSpan={columns.length}>\n <EmptyState />\n </StyledEmptyCell>\n </tr>\n )}\n </tbody>\n </StyledTable>\n </StyledTableWrapper>\n </CardContent>\n </Card>\n );\n}) as <RowData extends DefaultRowData = DefaultRowData>(\n props: TableProps<RowData> & ForwardProps\n) => ReactElement | null;\n\nexport default Table;\n"]}
|
|
@@ -6,7 +6,7 @@ interface TabPanelProps {
|
|
|
6
6
|
/**
|
|
7
7
|
* The current selected value of the tabs. Controls the visibility of the tab panel.
|
|
8
8
|
* The tabsValue must match the tabId in order for the TabPanel to show itself.
|
|
9
|
-
|
|
9
|
+
*/
|
|
10
10
|
currentTabId?: string;
|
|
11
11
|
/** Content of the tab panel. */
|
|
12
12
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabPanel.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/TabPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAmB,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,UAAU,aAAa;IACrB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd;;;
|
|
1
|
+
{"version":3,"file":"TabPanel.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/TabPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAmB,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,UAAU,aAAa;IACrB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAMD,eAAO,MAAM,cAAc;aAChB,OAAO;SAehB,CAAC;AAEH,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAkB7D,CAAC;AAIF,eAAe,QAAQ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabPanel.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAkBhD,MAAM,YAAY,GAA2B;IAC3C,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAErC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACjB,OAAO,GAAG,CAAA;;;;;;;;MAQN,CAAC,OAAO;QACV,GAAG,CAAA;;KAEF;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoD,UAAU,CAC1E,CACE,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAkC,EAC/E,GAAyB,EACzB,EAAE;IACF,OAAO,CACL,KAAC,cAAc,OACT,SAAS,EACb,OAAO,EAAE,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,EAC9D,IAAI,EAAC,UAAU,qBACE,GAAG,KAAK,EAAE,EAC3B,EAAE,EAAE,GAAG,KAAK,QAAQ,EACpB,GAAG,EAAE,GAAG,YAEP,QAAQ,GACM,CAClB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;AAErC,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, ReactNode, Ref, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../types';\n\ninterface TabPanelProps {\n /** The id of the Tab that the tab panel is related to. */\n tabId: string;\n /**\n * The current selected value of the tabs. Controls the visibility of the tab panel.\n * The tabsValue must match the tabId in order for the TabPanel to show itself.\n
|
|
1
|
+
{"version":3,"file":"TabPanel.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAkBhD,MAAM,YAAY,GAA2B;IAC3C,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAErC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACjB,OAAO,GAAG,CAAA;;;;;;;;MAQN,CAAC,OAAO;QACV,GAAG,CAAA;;KAEF;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAoD,UAAU,CAC1E,CACE,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAkC,EAC/E,GAAyB,EACzB,EAAE;IACF,OAAO,CACL,KAAC,cAAc,OACT,SAAS,EACb,OAAO,EAAE,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,EAC9D,IAAI,EAAC,UAAU,qBACE,GAAG,KAAK,EAAE,EAC3B,EAAE,EAAE,GAAG,KAAK,QAAQ,EACpB,GAAG,EAAE,GAAG,YAEP,QAAQ,GACM,CAClB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;AAErC,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, ReactNode, Ref, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '../../types';\n\ninterface TabPanelProps {\n /** The id of the Tab that the tab panel is related to. */\n tabId: string;\n /**\n * The current selected value of the tabs. Controls the visibility of the tab panel.\n * The tabsValue must match the tabId in order for the TabPanel to show itself.\n */\n currentTabId?: string;\n /** Content of the tab panel. */\n children: ReactNode;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst defaultProps: Partial<TabPanelProps> = {\n tabId: ''\n};\n\nexport const StyledTabPanel = styled.div<{\n current: boolean;\n}>(({ current }) => {\n return css`\n min-width: 0;\n max-width: 100%;\n\n :focus {\n outline: none;\n }\n\n ${!current &&\n css`\n display: none;\n `}\n `;\n});\n\nconst TabPanel: FunctionComponent<TabPanelProps & ForwardProps> = forwardRef(\n (\n { tabId, currentTabId, children, ...restProps }: PropsWithoutRef<TabPanelProps>,\n ref: TabPanelProps['ref']\n ) => {\n return (\n <StyledTabPanel\n {...restProps}\n current={currentTabId && tabId ? currentTabId === tabId : true}\n role='tabpanel'\n aria-labelledby={`${tabId}`}\n id={`${tabId}-panel`}\n ref={ref}\n >\n {children}\n </StyledTabPanel>\n );\n }\n);\n\nTabPanel.defaultProps = defaultProps;\n\nexport default TabPanel;\n"]}
|
|
@@ -18,7 +18,7 @@ export interface TabsProps extends BaseProps, NoChildrenProp {
|
|
|
18
18
|
*/
|
|
19
19
|
tabs: Tab[];
|
|
20
20
|
/** The type handles what direction the tabs will be rendered in.
|
|
21
|
-
* @default
|
|
21
|
+
* @default 'horizontal'
|
|
22
22
|
*/
|
|
23
23
|
type?: 'horizontal' | 'vertical';
|
|
24
24
|
/** The currentTabId tells the tab list which Tab should be active. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.types.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent } from 'react';\n\nimport type { BaseProps, NoChildrenProp } from '../../types';\n\nexport interface Tab {\n /** The name that will be displayed on the Tab. */\n name: string;\n /** The id that is referenced when a Tab is activated. */\n id: string;\n /** A link to navigate to when the Tab is clicked. */\n href?: string;\n /** If a count is provided, the Count Badge will be rendered alongside the Tab name. */\n count?: number;\n /** Disables the tab if true */\n disabled?: boolean;\n}\n\nexport interface TabsProps extends BaseProps, NoChildrenProp {\n /** An array of Tab data used to render the individual tabs.\n * @default []\n */\n tabs: Tab[];\n /** The type handles what direction the tabs will be rendered in.\n * @default
|
|
1
|
+
{"version":3,"file":"Tabs.types.js","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEvent } from 'react';\n\nimport type { BaseProps, NoChildrenProp } from '../../types';\n\nexport interface Tab {\n /** The name that will be displayed on the Tab. */\n name: string;\n /** The id that is referenced when a Tab is activated. */\n id: string;\n /** A link to navigate to when the Tab is clicked. */\n href?: string;\n /** If a count is provided, the Count Badge will be rendered alongside the Tab name. */\n count?: number;\n /** Disables the tab if true */\n disabled?: boolean;\n}\n\nexport interface TabsProps extends BaseProps, NoChildrenProp {\n /** An array of Tab data used to render the individual tabs.\n * @default []\n */\n tabs: Tab[];\n /** The type handles what direction the tabs will be rendered in.\n * @default 'horizontal'\n */\n type?: 'horizontal' | 'vertical';\n /** The currentTabId tells the tab list which Tab should be active. */\n currentTabId: string;\n /** The onTabClick will take a callback function that is called every time a new tab is clicked and returns an id as well as the click event. */\n onTabClick?: (id: string, event?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n}\n"]}
|
|
@@ -5,12 +5,10 @@ export interface TextProps extends BaseProps, AsProp {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
/**
|
|
7
7
|
* Typographical sizes and styles.
|
|
8
|
-
* @default
|
|
8
|
+
* @default 'primary'
|
|
9
9
|
*/
|
|
10
10
|
variant?: 'primary' | 'secondary' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
11
|
-
/**
|
|
12
|
-
* Render text with semantic color based on a status.
|
|
13
|
-
*/
|
|
11
|
+
/** Render text with semantic color based on a status. */
|
|
14
12
|
status?: 'error' | 'warning' | 'success';
|
|
15
13
|
/** Ref for the wrapping element. */
|
|
16
14
|
ref?: Ref<HTMLSpanElement | HTMLHeadingElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAc,GAAG,EAAmB,MAAM,OAAO,CAAC;AAIvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AAKjF,MAAM,WAAW,SAAU,SAAQ,SAAS,EAAE,MAAM;IAClD,oBAAoB;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC5E
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAc,GAAG,EAAmB,MAAM,OAAO,CAAC;AAIvF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAqB,MAAM,aAAa,CAAC;AAKjF,MAAM,WAAW,SAAU,SAAQ,SAAS,EAAE,MAAM;IAClD,oBAAoB;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC5E,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,GAAG,kBAAkB,CAAC,CAAC;CACjD;AAID,eAAO,MAAM,UAAU,qMAoCrB,CAAC;AAIH,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CASrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAgC,UAAU,EAAwB,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAgC,UAAU,EAAwB,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EA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,EAAE,OAAO,GAAG,SAAS,EAAE,EAAE,EAAE,GAAG,SAAS,EAA8B,EACrE,GAAqB,EACrB,EAAE;IACF,2EAA2E;IAC3E,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,EAAE,GAAG,OAAkD,CAAC;IACzF,OAAO,KAAC,UAAU,IAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,KAAM,SAAS,GAAI,CAAC;AAC3E,CAAC,CACF,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, ReactNode, forwardRef, Ref, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport { BaseProps, ForwardProps, AsProp, PropsWithDefaults } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { calculateFontSize, FontSize } from '../../styles';\n\nexport interface TextProps extends BaseProps, AsProp {\n /** Text content. */\n children: ReactNode;\n /**\n * Typographical sizes and styles.\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n /** Render text with semantic color based on a status. */\n status?: 'error' | 'warning' | 'success';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLSpanElement | HTMLHeadingElement>;\n}\n\ntype TextPropsWithDefaults = PropsWithDefaults<TextProps, 'variant'>;\n\nexport const StyledText = styled.span<TextPropsWithDefaults>(props => {\n const {\n variant,\n status,\n theme: {\n base: {\n 'font-size': fontSize,\n 'font-scale': fontScale,\n palette: { 'foreground-color': foregroundColor, urgent: error, warn: warning, success },\n transparency: { 'transparent-2': secondaryAlpha }\n },\n components: { text }\n }\n } = props;\n\n let color: string | undefined;\n\n if (status) {\n color = {\n error,\n warning,\n success\n }[status];\n }\n\n if (variant === 'secondary') {\n color = tryCatch(() => rgba(color ?? foregroundColor, secondaryAlpha));\n }\n\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n font-size: ${fontSizes[text[variant]['font-size'] as FontSize]};\n font-weight: ${text[variant]['font-weight']};\n color: ${color};\n `;\n});\n\nStyledText.defaultProps = defaultThemeProp;\n\nconst Text: FunctionComponent<TextProps & ForwardProps> = forwardRef(\n (\n { variant = 'primary', as, ...restProps }: PropsWithoutRef<TextProps>,\n ref: TextProps['ref']\n ) => {\n // If variant is for a heading, and no as is passed, set as to heading tag.\n if (!as && /h\\d/i.test(variant)) as = variant as 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n return <StyledText ref={ref} variant={variant} as={as} {...restProps} />;\n }\n);\n\nexport default Text;\n"]}
|
|
@@ -17,7 +17,7 @@ export interface ToastMessage {
|
|
|
17
17
|
}) => void;
|
|
18
18
|
}
|
|
19
19
|
export interface ToasterProps {
|
|
20
|
-
/** The element(s) responsible for handling the Toaster state.
|
|
20
|
+
/** The element(s) responsible for handling the Toaster state. */
|
|
21
21
|
children: ReactNode;
|
|
22
22
|
/**
|
|
23
23
|
* Time in milliseconds to automatically dismiss Toast.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.types.d.ts","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uIAAuI;IACvI,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE;QAAE,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CAClG;AAED,MAAM,WAAW,YAAY;IAC3B,
|
|
1
|
+
{"version":3,"file":"Toaster.types.d.ts","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uIAAuI;IACvI,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE;QAAE,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CAClG;AAED,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC5C,uIAAuI;IACvI,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;CACvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toaster.types.js","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactNode } from 'react';\n\nexport interface ToastMessage {\n /** String to identify the specific message. Used as onDismiss callback arg. */\n id?: string;\n /** A short message to provide feedback based upon a user action. */\n content: string;\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: NonNullable<ToastMessage['id']>; timeout: boolean }) => void;\n}\n\nexport interface ToasterProps {\n /** The element(s) responsible for handling the Toaster state.
|
|
1
|
+
{"version":3,"file":"Toaster.types.js","sourceRoot":"","sources":["../../../src/components/Toaster/Toaster.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactNode } from 'react';\n\nexport interface ToastMessage {\n /** String to identify the specific message. Used as onDismiss callback arg. */\n id?: string;\n /** A short message to provide feedback based upon a user action. */\n content: string;\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: NonNullable<ToastMessage['id']>; timeout: boolean }) => void;\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}\n"]}
|
|
@@ -8,12 +8,12 @@ export interface TooltipProps extends BaseProps {
|
|
|
8
8
|
target: Element | null;
|
|
9
9
|
/**
|
|
10
10
|
* Delay showing the tooltip on mouseenter.
|
|
11
|
-
* @default
|
|
11
|
+
* @default 'short'
|
|
12
12
|
*/
|
|
13
13
|
showDelay?: Delay;
|
|
14
14
|
/**
|
|
15
15
|
* Delay hiding the tooltip on mouseleave.
|
|
16
|
-
* @default
|
|
16
|
+
* @default 'long'
|
|
17
17
|
*/
|
|
18
18
|
hideDelay?: Delay;
|
|
19
19
|
/**
|
|
@@ -28,7 +28,7 @@ export interface TooltipProps extends BaseProps {
|
|
|
28
28
|
describeTarget?: boolean;
|
|
29
29
|
/**
|
|
30
30
|
* Sets the placement of the tooltip relative to the target.
|
|
31
|
-
* @default
|
|
31
|
+
* @default 'bottom'
|
|
32
32
|
*/
|
|
33
33
|
placement?: PopoverProps['placement'];
|
|
34
34
|
ref?: Ref<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAKV,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,OAAgC,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAmCjD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC;aACvD,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC;iBACxC,QAAQ,CAAC,GAAG;;eAEd,KAAK,CAAC,IAAI,CAAC,OAAO;;;;eAIlB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO;GACzC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE9C,MAAM,OAAO,GAAmD,UAAU,CACxE,CACE,EACE,QAAQ,EACR,MAAM,EACN,SAAS,GAAG,OAAO,EACnB,SAAS,GAAG,MAAM,EAClB,MAAM,GAAG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ClB,GAAG,EAAE,UAAU,YAEd,QAAQ,GACD,CACX,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MutableRefObject,\n PropsWithoutRef,\n Ref,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Popover, { Delay, PopoverProps } from '../Popover';\nimport { useConsolidatedRef, useUID } from '../../hooks';\nimport { calculateFontSize } from '../../styles';\n\nexport interface TooltipProps extends BaseProps {\n /** Text content for the tooltip. */\n children: string | string[];\n /** Element to serve as the tooltip's target. */\n target: Element | null;\n /**\n * Delay showing the tooltip on mouseenter.\n * @default \"short\"\n */\n showDelay?: Delay;\n /**\n * Delay hiding the tooltip on mouseleave.\n * @default \"long\"\n */\n hideDelay?: Delay;\n /**\n * If true, the Tooltip will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default true\n */\n portal?: PopoverProps['portal'];\n /**\n * If true, the Tooltip will automatically apply an aria-describedby attribute to its target.\n * @default true\n */\n describeTarget?: boolean;\n /**\n * Sets the placement of the tooltip relative to the target.\n * @default \"bottom\"\n */\n placement?: PopoverProps['placement'];\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledTooltip = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n background-color: ${theme.components.tooltip['background-color']};\n color: ${theme.components.tooltip['foreground-color']};\n font-size: ${fontSize.xxs};\n max-width: 40ch;\n padding: ${theme.base.spacing};\n white-space: pre-line;\n word-break: break-word;\n pointer-events: none;\n z-index: ${theme.base['z-index'].tooltip};\n `;\n});\n\nStyledTooltip.defaultProps = defaultThemeProp;\n\nconst Tooltip: FunctionComponent<TooltipProps & ForwardProps> = forwardRef(\n (\n {\n children,\n target,\n showDelay = 'short',\n hideDelay = 'long',\n portal = true,\n placement = 'bottom',\n describeTarget = true,\n ...restProps\n }: PropsWithoutRef<TooltipProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n const id = useUID();\n const [show, setShow] = useState(false);\n const tooltipRef = useConsolidatedRef(ref);\n const lastClickedRef: MutableRefObject<EventTarget | null> = useRef(null);\n\n const showTooltip = useCallback(() => {\n setShow(true);\n }, []);\n\n const onMouseDown = useCallback(\n ({ target: eTarget }: MouseEvent) => {\n lastClickedRef.current = eTarget;\n if (eTarget === tooltipRef.current || eTarget === target) return;\n setShow(false);\n },\n [target]\n );\n\n const onFocusOut = useCallback(() => {\n if (lastClickedRef.current !== tooltipRef.current) {\n setShow(false);\n }\n lastClickedRef.current = null;\n }, []);\n\n const onMouseEnter = useCallback(() => {\n setShow(true);\n }, [target]);\n\n const onMouseLeave = useCallback(() => {\n if (document.activeElement !== target) {\n setShow(false);\n }\n }, [target]);\n\n const onKeyDown = useCallback(\n ({ key }: KeyboardEvent) => {\n if (key === 'Escape' && document.activeElement === target) {\n setShow(false);\n }\n },\n [target]\n );\n\n useEffect(() => {\n if (!target) return;\n\n document.addEventListener('keydown', onKeyDown);\n document.addEventListener('mousedown', onMouseDown);\n\n target.addEventListener('focusin', showTooltip);\n target.addEventListener('focusout', onFocusOut);\n\n target.addEventListener('mouseenter', onMouseEnter);\n target.addEventListener('mouseleave', onMouseLeave);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.removeEventListener('mousedown', onMouseDown);\n\n target.removeEventListener('focusin', showTooltip);\n target.removeEventListener('focusout', onFocusOut);\n\n target.removeEventListener('mouseenter', onMouseEnter);\n target.removeEventListener('mouseleave', onMouseLeave);\n };\n }, [target, showTooltip, onMouseDown, onFocusOut, onMouseLeave, onKeyDown]);\n\n useEffect(() => {\n if (target && describeTarget && show) {\n const describedBy = target.getAttribute('aria-describedby');\n // Set the attribute to the old attribute plus the id\n target.setAttribute('aria-describedby', describedBy ? `${describedBy} ${id}` : id);\n } else if (target) {\n // Get the old attribute\n const describedBy = target.getAttribute('aria-describedby');\n if (describedBy) {\n // If the old attribute matches the id just remove it entirely\n if (describedBy === id) {\n target.removeAttribute('aria-describedby');\n } else {\n // Otherwise we want to just remove the id that was added and reset the attribute to what it was before\n const oldDescribedBy = describedBy.replace(new RegExp(`(?:^|\\\\s+)${id}`), '');\n target.setAttribute('aria-describedby', oldDescribedBy);\n }\n }\n }\n }, [describeTarget, target, show]);\n\n return (\n <Popover\n id={id}\n {...restProps}\n show={show}\n showDelay={showDelay}\n hideDelay={hideDelay}\n groupId='tooltip'\n strategy='fixed'\n portal={portal}\n as={StyledTooltip}\n role='tooltip'\n target={target}\n arrow\n placement={placement}\n onMouseDown={onMouseDown}\n hideOnTargetHidden\n ref={tooltipRef}\n >\n {children}\n </Popover>\n );\n }\n);\n\nexport default Tooltip;\n"]}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAKV,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,OAAgC,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAmCjD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAEtF,OAAO,GAAG,CAAA;wBACY,K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iBACzD;aACF;SACF;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnC,OAAO,CACL,KAAC,OAAO,IACN,EAAE,EAAE,EAAE,KACF,SAAS,EACb,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAC,SAAS,EACjB,QAAQ,EAAC,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,aAAa,EACjB,IAAI,EAAC,SAAS,EACd,MAAM,EAAE,MAAM,EACd,KAAK,QACL,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,kBAAkB,QAClB,GAAG,EAAE,UAAU,YAEd,QAAQ,GACD,CACX,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MutableRefObject,\n PropsWithoutRef,\n Ref,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { BaseProps, ForwardProps } from '../../types';\nimport { defaultThemeProp } from '../../theme';\nimport Popover, { Delay, PopoverProps } from '../Popover';\nimport { useConsolidatedRef, useUID } from '../../hooks';\nimport { calculateFontSize } from '../../styles';\n\nexport interface TooltipProps extends BaseProps {\n /** Text content for the tooltip. */\n children: string | string[];\n /** Element to serve as the tooltip's target. */\n target: Element | null;\n /**\n * Delay showing the tooltip on mouseenter.\n * @default 'short'\n */\n showDelay?: Delay;\n /**\n * Delay hiding the tooltip on mouseleave.\n * @default 'long'\n */\n hideDelay?: Delay;\n /**\n * If true, the Tooltip will render outside of the current DOM hierarchy in a [portal](https://reactjs.org/docs/portals.html).\n * @default true\n */\n portal?: PopoverProps['portal'];\n /**\n * If true, the Tooltip will automatically apply an aria-describedby attribute to its target.\n * @default true\n */\n describeTarget?: boolean;\n /**\n * Sets the placement of the tooltip relative to the target.\n * @default 'bottom'\n */\n placement?: PopoverProps['placement'];\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledTooltip = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n background-color: ${theme.components.tooltip['background-color']};\n color: ${theme.components.tooltip['foreground-color']};\n font-size: ${fontSize.xxs};\n max-width: 40ch;\n padding: ${theme.base.spacing};\n white-space: pre-line;\n word-break: break-word;\n pointer-events: none;\n z-index: ${theme.base['z-index'].tooltip};\n `;\n});\n\nStyledTooltip.defaultProps = defaultThemeProp;\n\nconst Tooltip: FunctionComponent<TooltipProps & ForwardProps> = forwardRef(\n (\n {\n children,\n target,\n showDelay = 'short',\n hideDelay = 'long',\n portal = true,\n placement = 'bottom',\n describeTarget = true,\n ...restProps\n }: PropsWithoutRef<TooltipProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n const id = useUID();\n const [show, setShow] = useState(false);\n const tooltipRef = useConsolidatedRef(ref);\n const lastClickedRef: MutableRefObject<EventTarget | null> = useRef(null);\n\n const showTooltip = useCallback(() => {\n setShow(true);\n }, []);\n\n const onMouseDown = useCallback(\n ({ target: eTarget }: MouseEvent) => {\n lastClickedRef.current = eTarget;\n if (eTarget === tooltipRef.current || eTarget === target) return;\n setShow(false);\n },\n [target]\n );\n\n const onFocusOut = useCallback(() => {\n if (lastClickedRef.current !== tooltipRef.current) {\n setShow(false);\n }\n lastClickedRef.current = null;\n }, []);\n\n const onMouseEnter = useCallback(() => {\n setShow(true);\n }, [target]);\n\n const onMouseLeave = useCallback(() => {\n if (document.activeElement !== target) {\n setShow(false);\n }\n }, [target]);\n\n const onKeyDown = useCallback(\n ({ key }: KeyboardEvent) => {\n if (key === 'Escape' && document.activeElement === target) {\n setShow(false);\n }\n },\n [target]\n );\n\n useEffect(() => {\n if (!target) return;\n\n document.addEventListener('keydown', onKeyDown);\n document.addEventListener('mousedown', onMouseDown);\n\n target.addEventListener('focusin', showTooltip);\n target.addEventListener('focusout', onFocusOut);\n\n target.addEventListener('mouseenter', onMouseEnter);\n target.addEventListener('mouseleave', onMouseLeave);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n document.removeEventListener('mousedown', onMouseDown);\n\n target.removeEventListener('focusin', showTooltip);\n target.removeEventListener('focusout', onFocusOut);\n\n target.removeEventListener('mouseenter', onMouseEnter);\n target.removeEventListener('mouseleave', onMouseLeave);\n };\n }, [target, showTooltip, onMouseDown, onFocusOut, onMouseLeave, onKeyDown]);\n\n useEffect(() => {\n if (target && describeTarget && show) {\n const describedBy = target.getAttribute('aria-describedby');\n // Set the attribute to the old attribute plus the id\n target.setAttribute('aria-describedby', describedBy ? `${describedBy} ${id}` : id);\n } else if (target) {\n // Get the old attribute\n const describedBy = target.getAttribute('aria-describedby');\n if (describedBy) {\n // If the old attribute matches the id just remove it entirely\n if (describedBy === id) {\n target.removeAttribute('aria-describedby');\n } else {\n // Otherwise we want to just remove the id that was added and reset the attribute to what it was before\n const oldDescribedBy = describedBy.replace(new RegExp(`(?:^|\\\\s+)${id}`), '');\n target.setAttribute('aria-describedby', oldDescribedBy);\n }\n }\n }\n }, [describeTarget, target, show]);\n\n return (\n <Popover\n id={id}\n {...restProps}\n show={show}\n showDelay={showDelay}\n hideDelay={hideDelay}\n groupId='tooltip'\n strategy='fixed'\n portal={portal}\n as={StyledTooltip}\n role='tooltip'\n target={target}\n arrow\n placement={placement}\n onMouseDown={onMouseDown}\n hideOnTargetHidden\n ref={tooltipRef}\n >\n {children}\n </Popover>\n );\n }\n);\n\nexport default Tooltip;\n"]}
|
|
@@ -12,7 +12,7 @@ import QRCode from '../QRCode';
|
|
|
12
12
|
const generateUrlMarkup = (url) => {
|
|
13
13
|
const markedUrl = url
|
|
14
14
|
.split('//')
|
|
15
|
-
|
|
15
|
+
// Insert \x1f (unit separator) char as a placeholder at correct position.
|
|
16
16
|
.map(str => {
|
|
17
17
|
return str
|
|
18
18
|
.replace(/:/giu, '$&\x1f')
|
|
@@ -20,7 +20,7 @@ const generateUrlMarkup = (url) => {
|
|
|
20
20
|
.replace(/[=&]/giu, '\x1f$&\x1f');
|
|
21
21
|
})
|
|
22
22
|
.join('//\x1f');
|
|
23
|
-
|
|
23
|
+
// Replace unit separator character with <wbr /> element. Create an array of nodes in place of string to pass tags escaping.
|
|
24
24
|
return markedUrl.split('\x1f').reduce((urlFragments, part) => {
|
|
25
25
|
urlFragments.push(part, _jsx("wbr", {}, urlFragments.length));
|
|
26
26
|
return urlFragments;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"URLDisplay.js","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AAEvF,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAgB/B;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAa,EAAE;IACnD,MAAM,SAAS,GAAG,GAAG;SAClB,KAAK,CAAC,IAAI,CAAC;QACZ,
|
|
1
|
+
{"version":3,"file":"URLDisplay.js","sourceRoot":"","sources":["../../../src/components/URL/URLDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AAEvF,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAgB/B;;;;;;GAMG;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAa,EAAE;IACnD,MAAM,SAAS,GAAG,GAAG;SAClB,KAAK,CAAC,IAAI,CAAC;QACZ,0EAA0E;SACzE,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,OAAO,GAAG;aACP,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC;aACzB,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC;aACrC,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACtC,CAAC,CAAC;SACD,IAAI,CAAC,QAAQ,CAAC,CAAC;IAElB,4HAA4H;IAC5H,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAc,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE;QACxE,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,gBAAU,YAAY,CAAC,MAAM,CAAI,CAAC,CAAC;QAC3D,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AAEF,MAAM,UAAU,GAAsD,UAAU,CAC9E,CACE,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,EAAoC,EACxF,GAA2B,EAC3B,EAAE;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAC3B,WAAW,IAAI,iBAAiB,CAAC,KAAK,CAAC,CACxC,CAAC,CAAC,CAAC,CACF,8BAAkB,MAAM,6BAAsB,CAC/C,CAAC;IAEF,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,KAAK,EAAE;QAChC,OAAO,CACL,eAAM,GAAG,EAAE,GAA2B,KAAM,SAAS,YAClD,YAAY,GACR,CACR,CAAC;KACH;IACD,IAAI,OAAO,KAAK,QAAQ,EAAE;QACxB,OAAO,CACL,KAAC,MAAM,IACL,GAAG,EAAE,GAA4B,KAC7B,SAAS,EACb,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,WAAW,GAClB,CACH,CAAC;KACH;IACD,OAAO,CACL,KAAC,IAAI,IAAC,GAAG,EAAE,GAA6B,KAAM,SAAS,EAAE,IAAI,EAAE,KAAK,YACjE,YAAY,GACR,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, ReactNode, Ref } from 'react';\n\nimport Link from '../Link';\nimport { BaseProps, ForwardProps, NoChildrenProp } from '../../types';\nimport QRCode from '../QRCode';\n\nexport interface URLDisplayProps extends BaseProps, NoChildrenProp {\n /** URL address, includes scheme, 'http://', 'https://' */\n value?: string;\n /** The text to be displayed. */\n displayText?: string;\n /**\n * Controls styling of the field.\n * @default 'link'\n */\n variant?: 'link' | 'text' | 'qrcode';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLAnchorElement | HTMLSpanElement | HTMLImageElement | HTMLDivElement>;\n}\n\n/**\n * Function gets the url as a string and converts it to a HTML markup with whitespace opportunity elements.\n * It helps breaking a long url correctly to avoid parent container overflow issues\n * according to \"The Chicago Manual of Style\" copywriting standard.\n * @param url input url to construct markup for\n * @returns array of nodes\n */\nconst generateUrlMarkup = (url: string): ReactNode => {\n const markedUrl = url\n .split('//')\n // Insert \\x1f (unit separator) char as a placeholder at correct position.\n .map(str => {\n return str\n .replace(/:/giu, '$&\\x1f')\n .replace(/[/~.,\\\\-_?#%]/giu, '\\x1f$&')\n .replace(/[=&]/giu, '\\x1f$&\\x1f');\n })\n .join('//\\x1f');\n\n // Replace unit separator character with <wbr /> element. Create an array of nodes in place of string to pass tags escaping.\n return markedUrl.split('\\x1f').reduce<ReactNode[]>((urlFragments, part) => {\n urlFragments.push(part, <wbr key={urlFragments.length} />);\n return urlFragments;\n }, []);\n};\n\nconst URLDisplay: FunctionComponent<URLDisplayProps & ForwardProps> = forwardRef(\n (\n { value, displayText, variant = 'link', ...restProps }: PropsWithoutRef<URLDisplayProps>,\n ref: URLDisplayProps['ref']\n ) => {\n const displayValue = value ? (\n displayText || generateUrlMarkup(value)\n ) : (\n <span aria-hidden='true'>––</span>\n );\n\n if (variant === 'text' || !value) {\n return (\n <span ref={ref as Ref<HTMLSpanElement>} {...restProps}>\n {displayValue}\n </span>\n );\n }\n if (variant === 'qrcode') {\n return (\n <QRCode\n ref={ref as Ref<HTMLImageElement>}\n {...restProps}\n value={value}\n label={displayText}\n />\n );\n }\n return (\n <Link ref={ref as Ref<HTMLAnchorElement>} {...restProps} href={value}>\n {displayValue}\n </Link>\n );\n }\n);\n\nexport default URLDisplay;\n"]}
|
package/lib/hooks/useArrows.js
CHANGED
|
@@ -17,7 +17,7 @@ cycle = true,
|
|
|
17
17
|
selector = focusable,
|
|
18
18
|
/** Which keys are used to navigate through the list */
|
|
19
19
|
dir = 'up-down', allowTabFocus = true, updateTabIndex = true } = {},
|
|
20
|
-
/**
|
|
20
|
+
/** Pass this prop in the internal dependencies when list is dynamic */
|
|
21
21
|
dependencies = []) => {
|
|
22
22
|
const [NextKey, PrevKey] = dir === 'up-down' ? ['ArrowDown', 'ArrowUp'] : ['ArrowRight', 'ArrowLeft'];
|
|
23
23
|
const setTabIndexes = useCallback((el) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArrows.js","sourceRoot":"","sources":["../../src/hooks/useArrows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAA6B,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,SAAS,GAAG;;;;;CAKjB,CAAC;AAEF;;;GAGG;AACH,MAAM,SAAS,GAAG,CAChB,GAA2B,EAC3B;AACE,yKAAyK;AACzK,KAAK,GAAG,IAAI;AACZ,wPAAwP;AACxP,QAAQ,GAAG,SAAS;AACpB,uDAAuD;AACvD,GAAG,GAAG,SAAS,EACf,aAAa,GAAG,IAAI,EACpB,cAAc,GAAG,IAAI,KAOnB,EAAE;AACN,
|
|
1
|
+
{"version":3,"file":"useArrows.js","sourceRoot":"","sources":["../../src/hooks/useArrows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAA6B,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,SAAS,GAAG;;;;;CAKjB,CAAC;AAEF;;;GAGG;AACH,MAAM,SAAS,GAAG,CAChB,GAA2B,EAC3B;AACE,yKAAyK;AACzK,KAAK,GAAG,IAAI;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AAC,GAAG,KAAK,OAAO,EAAE;YAC5B,IAAI,QAAQ,KAAK,OAAO,EAAE;gBACxB,IAAI,CAAC,KAAK;oBAAE,OAAO;gBACnB,WAAW,GAAG,CAAC,CAAC;aACjB;iBAAM;gBACL,WAAW,GAAG,QAAQ,GAAG,CAAC,CAAC;aAC5B;SACF;aAAM,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YAC5B,IAAI,QAAQ,KAAK,CAAC,EAAE;gBAClB,IAAI,CAAC,KAAK;oBAAE,OAAO;gBACnB,WAAW,GAAG,OAAO,CAAC;aACvB;iBAAM;gBACL,WAAW,GAAG,QAAQ,GAAG,CAAC,CAAC;aAC5B;SACF;aAAM;YACL,OAAO;SACR;QAED,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC,EACD,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAChD,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,EAAE;YAAE,OAAO;QAChB,IAAI,cAAc,EAAE;YAClB,aAAa,CAAC,EAAE,CAAC,CAAC;SACnB;QACD,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAEzC,OAAO,GAAG,EAAE;YACV,EAAE,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC;AACzD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import { useEffect, useCallback, RefObject, DependencyList } from 'react';\n\nimport { documentIsAvailable } from '../utils';\n\nconst focusable = `\n a[href],\n button:enabled,\n input[type='checkbox']:enabled,\n input[type='radio']:enabled\n`;\n\n/**\n * @example useArrows(ref, { cycle, selector });\n * @param ref - A reference to the element that will be navigated through. [React RefObject](https://reactjs.org/docs/refs-and-the-dom.html)\n */\nconst useArrows = (\n ref: RefObject<HTMLElement>,\n {\n /** If true, the down or up arrow key will navigate to the first or last element if the element currently focused is the last or first index of the selected elements. */\n cycle = true,\n /** A query selector that will determine which elements to cycle through with the arrow keys. The selector will be used in conjunction with [querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll#selectors). */\n selector = focusable,\n /** Which keys are used to navigate through the list */\n dir = 'up-down',\n allowTabFocus = true,\n updateTabIndex = true\n }: {\n cycle?: boolean;\n selector?: string;\n dir?: 'up-down' | 'left-right';\n allowTabFocus?: boolean;\n updateTabIndex?: boolean;\n } = {},\n /** Pass this prop in the internal dependencies when list is dynamic */\n dependencies: DependencyList = []\n) => {\n const [NextKey, PrevKey] =\n dir === 'up-down' ? ['ArrowDown', 'ArrowUp'] : ['ArrowRight', 'ArrowLeft'];\n\n const setTabIndexes = useCallback(\n (el: HTMLElement) => {\n // don't set tabindex -1 for first element, or an element with a checked input inside of it to be able to focus it\n\n // 0 second timeout added because DOM needs to be up to date after list is updated before running query\n setTimeout(() => {\n const focusableElements = Array.from(el.querySelectorAll(selector));\n\n if (focusableElements.length > 0) {\n if (allowTabFocus) (focusableElements[0] as HTMLElement).tabIndex = 0;\n focusableElements.slice(1).forEach(item => {\n if (item instanceof HTMLElement) {\n const checked = (item as HTMLInputElement).checked;\n if (!checked) item.tabIndex = -1;\n }\n });\n }\n }, 0);\n },\n [selector, ...dependencies]\n );\n\n const listener = useCallback(\n (e: KeyboardEvent) => {\n const el = ref.current;\n if (!el) return;\n if (['Home', 'End', NextKey, PrevKey].includes(e.key)) e.preventDefault();\n\n if (!documentIsAvailable) return;\n\n const items = Array.from(el.querySelectorAll(selector)).filter(\n (item): item is HTMLElement => item instanceof HTMLElement\n );\n\n if (!items.length) return;\n\n const rootNode = el.getRootNode();\n\n if (!(rootNode instanceof Document) && !(rootNode instanceof ShadowRoot)) return;\n\n const focusIdx = items.indexOf(rootNode.activeElement as HTMLElement);\n const lastIdx = items.length - 1;\n let newFocusIdx;\n\n if (e.key === 'Home' || (e.key === NextKey && focusIdx === -1)) {\n newFocusIdx = 0;\n } else if (e.key === 'End' || (e.key === PrevKey && focusIdx === -1)) {\n newFocusIdx = lastIdx;\n } else if (e.key === 'Enter') {\n if (updateTabIndex) {\n setTabIndexes(el);\n }\n return;\n } else if (e.key === NextKey) {\n if (focusIdx === lastIdx) {\n if (!cycle) return;\n newFocusIdx = 0;\n } else {\n newFocusIdx = focusIdx + 1;\n }\n } else if (e.key === PrevKey) {\n if (focusIdx === 0) {\n if (!cycle) return;\n newFocusIdx = lastIdx;\n } else {\n newFocusIdx = focusIdx - 1;\n }\n } else {\n return;\n }\n\n items[newFocusIdx].focus();\n },\n [ref.current, cycle, selector, ...dependencies]\n );\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n if (updateTabIndex) {\n setTabIndexes(el);\n }\n el.addEventListener('keydown', listener);\n\n return () => {\n el.removeEventListener('keydown', listener);\n };\n }, [ref.current, selector, listener, ...dependencies]);\n};\n\nexport default useArrows;\n"]}
|
package/lib/i18n/translate.d.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import type { ReactChild, ReactText } from 'react';
|
|
2
2
|
type TranslationTemplate = string | Record<Intl.LDMLPluralRule, string>;
|
|
3
|
-
/**
|
|
4
|
-
* Interface for advanced translation options, like plural forms.
|
|
5
|
-
*/
|
|
3
|
+
/** * Interface for advanced translation options, like plural forms. */
|
|
6
4
|
export interface TranslationOptions {
|
|
7
5
|
/**
|
|
8
6
|
* Value that determines which plural form will be chosen during translation.
|
|
9
7
|
* @default 0
|
|
10
8
|
*/
|
|
11
9
|
count?: number;
|
|
12
|
-
/**
|
|
13
|
-
* Discriminator for pluralization type: 'cardinal' or 'ordinal'.
|
|
14
|
-
*/
|
|
10
|
+
/** Discriminator for pluralization type: 'cardinal' or 'ordinal'. */
|
|
15
11
|
pluralType?: Intl.PluralRuleType;
|
|
16
12
|
}
|
|
17
13
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../src/i18n/translate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,KAAK,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../src/i18n/translate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,KAAK,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AAExE,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,UAAU,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAChF,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;IAC3B,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAAC;IAC9E,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;CACvF;AAED;;;;;;GAMG;AACH,QAAA,MAAM,aAAa,0EAET,MAAM,2BA6Bf,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translate.js","sourceRoot":"","sources":["../../src/i18n/translate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"translate.js","sourceRoot":"","sources":["../../src/i18n/translate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA4BjC;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CACpB,WAAc,EACd,MAAc,EACU,EAAE;IAC1B,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IACvE,OAAO,CAAC,CACN,OAA8B,EAC9B,SAAqC,EAAE,EACvC,OAA4B,EACJ,EAAE;QAC1B,IAAI,QAAQ,GAAwB,WAAW,CAAC,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,QAAQ;YAAE,OAAO,iBAAiB,OAAO,EAAE,CAAC;QACjD,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAChC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,MAAM,CACpF,OAAO,EAAE,KAAK,IAAI,CAAC,CACpB,CAAC;YACF,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;SAC3B;QACD,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YACpD,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YACvD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE;gBAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;YAC5E,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAEhC,oDAAoD;QACpD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,KAAC,QAAQ,cAAU,IAAI,IAAR,CAAC,CAAmB,CAAC,CAAC;IACtE,CAAC,CAA2B,CAAC;AAC/B,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { Fragment } from 'react';\nimport type { ReactChild, ReactText } from 'react';\n\nimport { TranslationPack } from './i18n';\n\ntype TranslationTemplate = string | Record<Intl.LDMLPluralRule, string>;\n\n/** * Interface for advanced translation options, like plural forms. */\nexport interface TranslationOptions {\n /**\n * Value that determines which plural form will be chosen during translation.\n * @default 0\n */\n count?: number;\n /** Discriminator for pluralization type: 'cardinal' or 'ordinal'. */\n pluralType?: Intl.PluralRuleType;\n}\n\n/**\n * Function that takes translation key with optional tokens and translation options to drive the translation process.\n * Returns translated string with tokens inserted at defined slots.\n */\nexport interface TranslationFunction<T extends Record<string, TranslationTemplate>> {\n (literal: keyof T): string;\n (literal: keyof T, tokens: ReactText[], options?: TranslationOptions): string;\n (literal: keyof T, tokens: ReactChild[], options?: TranslationOptions): JSX.Element[];\n}\n\n/**\n * Function returns a function capable to translate tokens based on given translation pack and given locale.\n * The passed translation object should be correlated to given locale.\n * @param translation a translation pack (might be default or completely/partially overridden).\n * @param locale locale as BCP 47 language tag. Used for pluralization rules.\n * @returns\n */\nconst translatorFor = <T extends Record<string, TranslationTemplate>>(\n translation: T,\n locale: string\n): TranslationFunction<T> => {\n const cardinalRules = new Intl.PluralRules(locale);\n const ordinalRules = new Intl.PluralRules(locale, { type: 'ordinal' });\n return ((\n literal: keyof TranslationPack,\n tokens: (ReactChild | ReactText)[] = [],\n options?: TranslationOptions\n ): string | JSX.Element[] => {\n let template: TranslationTemplate = translation[literal];\n if (!template) return `!unknown key: ${literal}`;\n const result: ReactChild[] = [];\n if (typeof template === 'object') {\n const type = (options?.pluralType === 'ordinal' ? ordinalRules : cardinalRules).select(\n options?.count || 0\n );\n template = template[type];\n }\n template.split(/\\{(\\d+)\\}/g).forEach((chunk, index) => {\n const part = index % 2 ? tokens[Number(chunk)] : chunk;\n if (part !== undefined && part !== '') result.push(part);\n });\n\n if (result.every(part => typeof part === 'string' || typeof part === 'number'))\n return result.join('').trim();\n\n // eslint-disable-next-line react/no-array-index-key\n return result.map((part, i) => <Fragment key={i}>{part}</Fragment>);\n }) as TranslationFunction<T>;\n};\n\nexport default translatorFor;\n"]}
|
package/lib/types/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEhD,MAAM,WAAW,SAAS;IACxB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,SAAS,MAAM,EAAE,GAAG,SAAS,IAAI;IAC1E,IAAI,EAAE,MAAM,CAAC;CACd,GAAG;KACD,GAAG,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,MAAM;CACpE,CAAC;AAEF,MAAM,WAAW,UAAU,CAAC,QAAQ,S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IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AAGlE,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,EAAE,GAC3E,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,GACrC,UAAU,CAAC,CAAC,CAAC,CAAC;AAElB,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,MAAM,SAAS,CAAC,GACzD,MAAM,GACN,CAAC,SAAS,IAAI,MAAM,CAAC,EAAE,GACvB,YAAY,CAAC,CAAC,CAAC,GACf,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,MAAM,CAAC,EAAE,GACjC,GAAG,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,GACzB,CAAC,CAAC;AAEN,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACzC;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,GACD,CAAC,CAAC"}
|
package/lib/types/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ElementType, MouseEvent } from 'react';\n\nexport interface BaseProps {\n /** Additional CSS classes. */\n className?: string;\n}\n\nexport type TestIdsRecord<Elements extends readonly string[] | undefined> = {\n root: string;\n} & {\n [Key in NonNullable<Elements>[number] as KebabToCamel<Key>]: string;\n};\n\nexport interface TestIdProp<Elements extends readonly string[] | undefined = undefined> {\n /**\n * Applies a data-testid attribute to a component's root element and may be utilized as a prefix for descendant elements.\n * Descendant element data-testid attributes are applied in a component to component specific manner.\n */\n testId?: Elements extends undefined ? string : string | Partial<TestIdsRecord<Elements>>;\n}\n\nexport interface ForwardProps {\n [prop: string]: unknown;\n}\n\nexport interface NoChildrenProp {\n children?: never;\n}\n\nexport type HTMLTag = keyof JSX.IntrinsicElements;\nexport interface AsProp {\n /** HTML tag or React Component to render the component as. */\n as?: ElementType;\n /** HTML tag or React Component to finally render the component as. */\n forwardedAs?: ElementType;\n}\n\nexport interface Action extends ForwardProps {\n /** A string to uniquely identify this Action within the onClick handler. */\n id: string;\n /** The text content of the Action. */\n text: string;\n /** The name of the Cosmos Icon to render, if any. */\n icon?: string;\n /** A location to navigate to. Passing an href will render a Link styled as a Button. */\n href?: string;\n /** Called when the Action is clicked. */\n onClick?: (\n id: string,\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>,\n /**\n * If the action was rendered as an item in a menu the associated menuButton element will be provided.\n * Often necessary for focus purposes.\n */\n menuButton?: HTMLButtonElement\n ) => void;\n /** Determines if the Action will be disabled. */\n disabled?: boolean;\n}\n\n// https://github.com/microsoft/TypeScript/issues/30825\nexport type OmitStrict<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;\nexport type PartialByKey<T extends object, K extends keyof T> = OmitStrict<T, K> &\n Partial<Pick<T, K>>;\nexport type RequiredByKey<T extends object, K extends keyof T> = OmitStrict<T, K> &\n Required<Pick<T, K>>;\n\nexport type DeepPartial<T> = T extends (infer U)[]\n ? DeepPartial<U>[]\n : T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\nexport type DeepRequired<T> = T extends (infer U)[]\n ? DeepRequired<U>[]\n : T extends Function\n ? T\n : T extends object\n ? { [K in keyof T]-?: DeepRequired<T[K]> }\n : T;\n\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\n// https://stackoverflow.com/a/49725198\nexport type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> &\n {\n [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;\n }[Keys];\n\n// Lowers type inference precedence without changing the type.\n// https://github.com/Microsoft/TypeScript/issues/14829#issue-216577598\nexport type DeferInfer<T> = T & { [K in keyof T]: T[K] };\n\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"","sourcesContent":["import { ElementType, MouseEvent } from 'react';\n\nexport interface BaseProps {\n /** Additional CSS classes. */\n className?: string;\n}\n\nexport type TestIdsRecord<Elements extends readonly string[] | undefined> = {\n root: string;\n} & {\n [Key in NonNullable<Elements>[number] as KebabToCamel<Key>]: string;\n};\n\nexport interface TestIdProp<Elements extends readonly string[] | undefined = undefined> {\n /**\n * Applies a data-testid attribute to a component's root element and may be utilized as a prefix for descendant elements.\n * Descendant element data-testid attributes are applied in a component to component specific manner.\n */\n testId?: Elements extends undefined ? string : string | Partial<TestIdsRecord<Elements>>;\n}\n\nexport interface ForwardProps {\n [prop: string]: unknown;\n}\n\nexport interface NoChildrenProp {\n children?: never;\n}\n\nexport type HTMLTag = keyof JSX.IntrinsicElements;\nexport interface AsProp {\n /** HTML tag or React Component to render the component as. */\n as?: ElementType;\n /** HTML tag or React Component to finally render the component as. */\n forwardedAs?: ElementType;\n}\n\nexport interface Action extends ForwardProps {\n /** A string to uniquely identify this Action within the onClick handler. */\n id: string;\n /** The text content of the Action. */\n text: string;\n /** The name of the Cosmos Icon to render, if any. */\n icon?: string;\n /** A location to navigate to. Passing an href will render a Link styled as a Button. */\n href?: string;\n /** Called when the Action is clicked. */\n onClick?: (\n id: string,\n e: MouseEvent<HTMLButtonElement | HTMLAnchorElement | HTMLInputElement>,\n /**\n * If the action was rendered as an item in a menu the associated menuButton element will be provided.\n * Often necessary for focus purposes.\n */\n menuButton?: HTMLButtonElement\n ) => void;\n /** Determines if the Action will be disabled. */\n disabled?: boolean;\n}\n\n// https://github.com/microsoft/TypeScript/issues/30825\nexport type OmitStrict<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;\nexport type PartialByKey<T extends object, K extends keyof T> = OmitStrict<T, K> &\n Partial<Pick<T, K>>;\nexport type RequiredByKey<T extends object, K extends keyof T> = OmitStrict<T, K> &\n Required<Pick<T, K>>;\n\nexport type DeepPartial<T> = T extends (infer U)[]\n ? DeepPartial<U>[]\n : T extends object\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : T;\n\nexport type DeepRequired<T> = T extends (infer U)[]\n ? DeepRequired<U>[]\n : T extends Function\n ? T\n : T extends object\n ? { [K in keyof T]-?: DeepRequired<T[K]> }\n : T;\n\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\n// https://stackoverflow.com/a/49725198\nexport type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> &\n {\n [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;\n }[Keys];\n\n// Lowers type inference precedence without changing the type.\n// https://github.com/Microsoft/TypeScript/issues/14829#issue-216577598\nexport type DeferInfer<T> = T & { [K in keyof T]: T[K] };\n\nexport type PropsWithDefaults<\n // eslint-disable-next-line @typescript-eslint/ban-types\n Props extends object = {},\n Defaults extends keyof Props = never\n> = OmitStrict<Props, Defaults> & Required<Pick<Props, Defaults>>;\n\n// Modified from https://github.com/microsoft/TypeScript/pull/40336\nexport type KebabToPascal<S extends string> = S extends `${infer T}-${infer U}`\n ? `${Capitalize<T>}${KebabToPascal<U>}`\n : Capitalize<S>;\n\nexport type KebabToCamel<S extends string> = string extends S\n ? string\n : S extends `-${infer T}`\n ? KebabToCamel<T>\n : S extends `${infer T}-${infer U}`\n ? `${T}${KebabToPascal<U>}`\n : S;\n\nexport type PrettyPrint<T> = T extends object\n ? {\n [K in keyof T]: T[K];\n }\n : T;\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { KebabToCamel } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Converts kebab-case string to camelCase.
|
|
4
|
-
*/
|
|
2
|
+
/** Converts kebab-case string to camelCase. */
|
|
5
3
|
declare const kebabToCamel: <S extends string>(str: S) => KebabToCamel<S>;
|
|
6
4
|
export default kebabToCamel;
|
|
7
5
|
//# sourceMappingURL=kebabToCamel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kebabToCamel.d.ts","sourceRoot":"","sources":["../../src/utils/kebabToCamel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"kebabToCamel.d.ts","sourceRoot":"","sources":["../../src/utils/kebabToCamel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,+CAA+C;AAC/C,QAAA,MAAM,YAAY,+CAIjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|