@sproutsocial/racine 13.1.1 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/__flow__/EnumIconNames.js +1 -1
- package/__flow__/EnumIllustrationNames.js +1 -1
- package/__flow__/IconViewBoxes.js +1 -0
- package/__flow__/IllustrationViewBoxes.js +2 -0
- package/__flow__/SpotIllustration/illustrationNames.js +1 -1
- package/bin/racine-codemod.js +37 -6
- package/codemods/__tests__/icon-library.test.js +224 -0
- package/codemods/__tests__/icon-name-substitution.test.js +39 -0
- package/codemods/codemod-docs.js +54 -0
- package/codemods/icon-library.js +315 -0
- package/codemods/icon-name-substitution.js +43 -0
- package/commonjs/Avatar/index.js +1 -1
- package/commonjs/Badge/constants.js +0 -1
- package/commonjs/Badge/styles.js +0 -1
- package/commonjs/Banner/styles.js +0 -1
- package/commonjs/Box/styles.js +0 -1
- package/commonjs/Breadcrumb/index.js +3 -1
- package/commonjs/Breadcrumb/styles.js +0 -1
- package/commonjs/Button/styles.js +0 -1
- package/commonjs/Card/index.js +0 -1
- package/commonjs/Card/styles.js +0 -1
- package/commonjs/CharacterCounter/index.js +5 -3
- package/commonjs/CharacterCounter/styles.js +0 -1
- package/commonjs/ChartLegend/styles.js +0 -1
- package/commonjs/Checkbox/index.js +5 -3
- package/commonjs/Checkbox/styles.js +0 -1
- package/commonjs/Collapsible/index.js +4 -2
- package/commonjs/Collapsible/styles.js +0 -1
- package/commonjs/DatePicker/StatefulDateRangePicker.js +1 -1
- package/commonjs/DatePicker/StatefulSingleDatePicker.js +1 -1
- package/commonjs/DatePicker/common.js +0 -1
- package/commonjs/DatePicker/styles.js +0 -2
- package/commonjs/Drawer/index.js +3 -1
- package/commonjs/Drawer/styles.js +0 -1
- package/commonjs/Fieldset/styles.js +0 -1
- package/commonjs/FormField/index.flow.js +0 -1
- package/commonjs/FormField/index.js +1 -2
- package/commonjs/Icon/styles.js +0 -1
- package/commonjs/IconViewBoxes.js +1 -0
- package/commonjs/IllustrationViewBoxes.js +2 -0
- package/commonjs/Image/index.js +5 -3
- package/commonjs/Image/styles.js +0 -1
- package/commonjs/Indicator/index.js +5 -3
- package/commonjs/Indicator/styles.js +0 -1
- package/commonjs/Input/index.js +5 -3
- package/commonjs/Input/styles.js +0 -1
- package/commonjs/KeyboardKey/index.js +3 -1
- package/commonjs/KeyboardKey/styles.js +0 -1
- package/commonjs/Label/index.js +3 -2
- package/commonjs/Link/constants.js +0 -1
- package/commonjs/Link/styles.js +0 -1
- package/commonjs/Listbox/index.js +3 -1
- package/commonjs/Loader/index.js +5 -3
- package/commonjs/Loader/styles.js +0 -1
- package/commonjs/Menu/constants.js +0 -1
- package/commonjs/Menu/descendants.js +5 -3
- package/commonjs/Menu/hooks.js +0 -1
- package/commonjs/Menu/index.js +4 -2
- package/commonjs/Menu/styles.js +0 -1
- package/commonjs/Message/constants.js +0 -1
- package/commonjs/Message/styles.js +0 -1
- package/commonjs/Numeral/index.js +1 -1
- package/commonjs/Numeral/styles.js +0 -1
- package/commonjs/Numeral/tests/testNumeral.js +5 -3
- package/commonjs/OverflowList/styles.js +0 -1
- package/commonjs/PartnerLogo/styles.js +0 -1
- package/commonjs/Popout/index.js +4 -2
- package/commonjs/Popout/styles.js +0 -1
- package/commonjs/Portal/index.js +5 -3
- package/commonjs/Radio/index.js +5 -3
- package/commonjs/Radio/styles.js +0 -1
- package/commonjs/SegmentedControl/index.js +1 -1
- package/commonjs/SegmentedControl/styles.js +0 -1
- package/commonjs/Select/index.js +5 -3
- package/commonjs/Select/styles.js +0 -1
- package/commonjs/Skeleton/index.js +0 -1
- package/commonjs/SpotIllustration/illustrationNames.js +1 -1
- package/commonjs/SpotIllustration/index.js +0 -1
- package/commonjs/Switch/index.js +5 -3
- package/commonjs/Switch/styles.js +0 -1
- package/commonjs/Table/styles.js +0 -1
- package/commonjs/TableCell/index.js +3 -1
- package/commonjs/TableCell/styles.js +0 -1
- package/commonjs/TableHeaderCell/constants.js +0 -1
- package/commonjs/TableHeaderCell/index.js +5 -3
- package/commonjs/TableHeaderCell/styles.js +0 -1
- package/commonjs/TableRowAccordion/index.js +5 -3
- package/commonjs/TableRowAccordion/styles.js +0 -1
- package/commonjs/Tabs/index.js +5 -3
- package/commonjs/Tabs/styles.js +0 -1
- package/commonjs/Text/styles.js +0 -1
- package/commonjs/Textarea/index.js +5 -3
- package/commonjs/Textarea/styles.js +0 -1
- package/commonjs/Toast/styles.js +0 -2
- package/commonjs/ToggleHint/index.js +5 -3
- package/commonjs/ToggleHint/styles.js +0 -1
- package/commonjs/Token/styles.js +0 -1
- package/commonjs/TokenInput/index.js +5 -3
- package/commonjs/TokenInput/styles.js +0 -1
- package/commonjs/TokenInput/util.js +0 -1
- package/commonjs/Tooltip/index.js +4 -2
- package/commonjs/Tooltip/styles.js +0 -1
- package/commonjs/VisuallyHidden/index.js +0 -1
- package/commonjs/dataviz/index.js +0 -1
- package/commonjs/systemProps/background.js +0 -1
- package/commonjs/systemProps/border.js +0 -1
- package/commonjs/systemProps/color.js +0 -1
- package/commonjs/systemProps/custom.js +0 -1
- package/commonjs/systemProps/flexbox.js +0 -1
- package/commonjs/systemProps/grid.js +0 -1
- package/commonjs/systemProps/layout.js +0 -1
- package/commonjs/systemProps/position.js +0 -1
- package/commonjs/systemProps/shadow.js +0 -1
- package/commonjs/systemProps/space.js +1 -3
- package/commonjs/systemProps/systemProps.js +0 -1
- package/commonjs/systemProps/tests/types.flow.js +0 -1
- package/commonjs/systemProps/typography.js +0 -1
- package/commonjs/systemProps/variant.js +0 -1
- package/commonjs/themes/dark/dataviz-palette.js +0 -1
- package/commonjs/themes/dark/decorative-palettes.js +0 -1
- package/commonjs/themes/dark/theme.js +4 -1
- package/commonjs/themes/extendedThemes/sproutTheme/dark/theme.js +4 -1
- package/commonjs/themes/extendedThemes/sproutTheme/light/theme.js +4 -1
- package/commonjs/themes/light/dataviz-palette.js +0 -1
- package/commonjs/themes/light/decorative-palettes.js +0 -1
- package/commonjs/themes/light/literal-colors.js +0 -1
- package/commonjs/themes/light/theme.js +4 -1
- package/commonjs/utils/a11yTest.js +1 -1
- package/commonjs/utils/chartColors.js +0 -1
- package/commonjs/utils/constants.js +0 -1
- package/commonjs/utils/dataQaLabelQueries.js +1 -1
- package/commonjs/utils/hooks.js +5 -3
- package/commonjs/utils/index.js +0 -1
- package/commonjs/utils/innerText.js +0 -2
- package/commonjs/utils/mixins.js +0 -1
- package/commonjs/utils/react-testing-library.js +5 -3
- package/commonjs/utils/system-props.js +0 -1
- package/commonjs/utils/useInteractiveColor.js +0 -1
- package/dist/icon.svg +1 -1
- package/dist/iconList.js +1 -1
- package/dist/illustration.svg +1 -1
- package/dist/illustrationList.js +1 -1
- package/lib/Avatar/index.js +1 -1
- package/lib/Badge/constants.js +0 -2
- package/lib/Badge/index.flow.js +0 -1
- package/lib/Badge/styles.js +0 -1
- package/lib/Banner/index.flow.js +0 -1
- package/lib/Banner/styles.js +0 -1
- package/lib/Box/index.flow.js +0 -1
- package/lib/Box/styles.js +0 -1
- package/lib/Breadcrumb/index.flow.js +0 -1
- package/lib/Breadcrumb/index.js +4 -1
- package/lib/Breadcrumb/styles.js +0 -1
- package/lib/Button/index.flow.js +0 -1
- package/lib/Button/styles.js +0 -1
- package/lib/Card/index.flow.js +0 -1
- package/lib/Card/index.js +0 -1
- package/lib/Card/styles.js +0 -1
- package/lib/CharacterCounter/index.js +5 -3
- package/lib/CharacterCounter/styles.js +0 -1
- package/lib/ChartLegend/styles.js +0 -1
- package/lib/Checkbox/index.js +5 -3
- package/lib/Checkbox/styles.js +0 -1
- package/lib/Collapsible/index.flow.js +0 -1
- package/lib/Collapsible/index.js +5 -2
- package/lib/Collapsible/styles.js +0 -1
- package/lib/DatePicker/StatefulDateRangePicker.js +1 -1
- package/lib/DatePicker/StatefulSingleDatePicker.js +1 -1
- package/lib/DatePicker/common.js +0 -1
- package/lib/DatePicker/styles.js +0 -1
- package/lib/Drawer/index.flow.js +0 -1
- package/lib/Drawer/index.js +4 -1
- package/lib/Drawer/styles.js +0 -1
- package/lib/EmptyState/index.flow.js +0 -1
- package/lib/Fieldset/index.flow.js +0 -1
- package/lib/Fieldset/styles.js +0 -1
- package/lib/FormField/index.flow.js +0 -1
- package/lib/FormField/index.js +1 -2
- package/lib/Icon/deprecatedIcons.js +0 -1
- package/lib/Icon/index.flow.js +0 -2
- package/lib/Icon/styles.js +0 -1
- package/lib/IconViewBoxes.js +1 -0
- package/lib/IllustrationViewBoxes.js +2 -0
- package/lib/Image/index.js +5 -3
- package/lib/Image/styles.js +0 -1
- package/lib/Indicator/index.js +5 -3
- package/lib/Indicator/styles.js +0 -1
- package/lib/Input/index.flow.js +0 -1
- package/lib/Input/index.js +5 -3
- package/lib/Input/styles.js +0 -1
- package/lib/KeyboardKey/index.js +3 -1
- package/lib/KeyboardKey/styles.js +0 -1
- package/lib/Label/index.flow.js +0 -1
- package/lib/Label/index.js +3 -2
- package/lib/Link/constants.js +0 -1
- package/lib/Link/index.flow.js +0 -1
- package/lib/Link/styles.js +0 -1
- package/lib/Listbox/index.flow.js +0 -1
- package/lib/Listbox/index.js +4 -1
- package/lib/Loader/index.js +5 -3
- package/lib/Loader/styles.js +0 -1
- package/lib/Menu/constants.js +0 -2
- package/lib/Menu/descendants.js +5 -2
- package/lib/Menu/hooks.js +0 -1
- package/lib/Menu/index.flow.js +0 -1
- package/lib/Menu/index.js +5 -2
- package/lib/Menu/styles.js +0 -1
- package/lib/Message/constants.js +0 -2
- package/lib/Message/index.flow.js +0 -1
- package/lib/Message/styles.js +0 -1
- package/lib/Modal/index.flow.js +0 -1
- package/lib/Numeral/constants.js +0 -1
- package/lib/Numeral/index.js +1 -1
- package/lib/Numeral/styles.js +0 -1
- package/lib/Numeral/tests/testNumeral.js +4 -2
- package/lib/OverflowList/index.flow.js +0 -1
- package/lib/OverflowList/styles.js +0 -1
- package/lib/PartnerLogo/styles.js +0 -1
- package/lib/Popout/index.flow.js +0 -1
- package/lib/Popout/index.js +5 -2
- package/lib/Popout/styles.js +0 -1
- package/lib/Portal/index.flow.js +0 -1
- package/lib/Portal/index.js +4 -2
- package/lib/Radio/index.js +5 -3
- package/lib/Radio/styles.js +0 -1
- package/lib/SegmentedControl/index.flow.js +0 -1
- package/lib/SegmentedControl/index.js +1 -1
- package/lib/SegmentedControl/styles.js +0 -1
- package/lib/Select/index.flow.js +0 -1
- package/lib/Select/index.js +5 -3
- package/lib/Select/styles.js +0 -1
- package/lib/Skeleton/index.js +0 -1
- package/lib/SpotIllustration/illustrationNames.js +1 -2
- package/lib/SpotIllustration/index.js +0 -1
- package/lib/Stack/index.flow.js +0 -1
- package/lib/Switch/index.js +5 -3
- package/lib/Switch/styles.js +0 -1
- package/lib/Table/index.flow.js +0 -1
- package/lib/Table/styles.js +0 -1
- package/lib/TableCell/index.flow.js +0 -1
- package/lib/TableCell/index.js +3 -1
- package/lib/TableCell/styles.js +0 -1
- package/lib/TableHeaderCell/constants.js +0 -2
- package/lib/TableHeaderCell/index.flow.js +0 -2
- package/lib/TableHeaderCell/index.js +5 -3
- package/lib/TableHeaderCell/styles.js +0 -1
- package/lib/TableRowAccordion/index.flow.js +0 -1
- package/lib/TableRowAccordion/index.js +5 -3
- package/lib/TableRowAccordion/styles.js +0 -1
- package/lib/Tabs/index.flow.js +0 -1
- package/lib/Tabs/index.js +5 -3
- package/lib/Tabs/styles.js +0 -1
- package/lib/Text/index.flow.js +0 -1
- package/lib/Text/styles.js +0 -1
- package/lib/Textarea/index.flow.js +0 -1
- package/lib/Textarea/index.js +5 -3
- package/lib/Textarea/styles.js +0 -1
- package/lib/Toast/index.flow.js +0 -1
- package/lib/Toast/styles.js +0 -1
- package/lib/ToggleHint/index.js +5 -3
- package/lib/ToggleHint/styles.js +0 -1
- package/lib/Token/index.flow.js +0 -1
- package/lib/Token/styles.js +0 -1
- package/lib/TokenInput/index.flow.js +0 -1
- package/lib/TokenInput/index.js +5 -3
- package/lib/TokenInput/styles.js +0 -1
- package/lib/TokenInput/util.js +0 -2
- package/lib/Tooltip/index.flow.js +0 -1
- package/lib/Tooltip/index.js +4 -2
- package/lib/Tooltip/styles.js +0 -1
- package/lib/VisuallyHidden/index.js +0 -1
- package/lib/dataviz/index.js +0 -1
- package/lib/index.js +0 -3
- package/lib/systemProps/background.js +0 -2
- package/lib/systemProps/border.js +0 -2
- package/lib/systemProps/color.js +0 -2
- package/lib/systemProps/custom.js +0 -2
- package/lib/systemProps/flexbox.js +0 -2
- package/lib/systemProps/grid.js +0 -2
- package/lib/systemProps/index.js +0 -2
- package/lib/systemProps/layout.js +0 -2
- package/lib/systemProps/position.js +0 -2
- package/lib/systemProps/shadow.js +0 -2
- package/lib/systemProps/space.js +1 -3
- package/lib/systemProps/systemProps.js +0 -1
- package/lib/systemProps/tests/types.flow.js +0 -3
- package/lib/systemProps/typography.js +0 -2
- package/lib/systemProps/variant.js +0 -1
- package/lib/themes/dark/dataviz-palette.js +0 -2
- package/lib/themes/dark/decorative-palettes.js +0 -2
- package/lib/themes/dark/theme.js +4 -1
- package/lib/themes/extendedThemes/sproutTheme/dark/theme.js +4 -1
- package/lib/themes/extendedThemes/sproutTheme/index.js +0 -1
- package/lib/themes/extendedThemes/sproutTheme/light/theme.js +4 -1
- package/lib/themes/light/dataviz-palette.js +0 -2
- package/lib/themes/light/decorative-palettes.js +0 -2
- package/lib/themes/light/literal-colors.js +0 -2
- package/lib/themes/light/theme.js +4 -2
- package/lib/types/theme.colors.flow.js +0 -2
- package/lib/types/theme.flow.js +0 -1
- package/lib/utils/a11yTest.js +1 -1
- package/lib/utils/chartColors.js +0 -2
- package/lib/utils/constants.js +0 -2
- package/lib/utils/dataQaLabelQueries.js +1 -1
- package/lib/utils/hooks.js +5 -3
- package/lib/utils/index.js +0 -1
- package/lib/utils/innerText.js +0 -3
- package/lib/utils/mixins.js +0 -1
- package/lib/utils/react-testing-library.js +4 -2
- package/lib/utils/system-props.js +0 -1
- package/lib/utils/useInteractiveColor.js +0 -1
- package/package.json +2 -2
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
// We need the deprecated icon name mapping so that we can migrate icons still
|
|
2
|
+
// using the ancient names all the way to the new names.
|
|
3
|
+
// prettier-ignore
|
|
4
|
+
const deprecatedNames = {backtotop: 'back-to-top', 'circle-check-filled': 'circle-check', 'circle-check-no-fill': 'circle-check', 'circle-check-inverse-outline': 'circle-check-outline', 'circle-check-inverse': 'circle-check-outline', 'circle+-filled': 'circle+', 'circlex-filled': 'circlex', 'circle+-nofill': 'circle+', 'circlex-nofill': 'circlex', creditcard: 'credit-card', 'direct-message': 'messages', 'facebook-nofill': 'facebook', googleanalytics: 'google-analytics-color', 'instagram-brand-keyword': 'hashtag', 'help-white': 'help', 'info-white': 'info', 'instagram-nofill': 'instagram', 'key-circle': 'key', 'key-square': 'key', 'linkedin-nofill': 'linkedin', 'listening-home': 'listening', 'location-pub': 'location', 'location-pub-outline': 'location-outline', 'publishing-calendar': 'calendar', qrcode: 'qr-code', 'sparkles-solid': 'sparkles', 'star-inverse': 'star-outline', 'triangle-white': 'triangle', 'triangle-nofill': 'triangle', 'tripadvisor-circle-filled': 'tripadvisor-circle', 'tripadvisor-circle-empty': 'tripadvisor-circle-outline', 'tumblr-square': 'tumblr', 'tumblr-nofill': 'tumblr', 'twitter-business-mention': 'search', 'verified-nofill': 'verified', 'window-maximize-solid': 'window-maximize'};
|
|
5
|
+
|
|
6
|
+
// Mapping from old icon names to new icon names
|
|
7
|
+
// prettier-ignore
|
|
8
|
+
const IconMap = {'active-listener': 'listening-outline', 'add-item': 'plus-outline', 'add-keyword': 'plus-outline', 'add-team-member': 'user-plus-outline', 'add-variable': 'curly-brackets-plus-outline', 'address-card-outline': 'profile-card-outline', 'address-card-solid': 'profile-card-solid', ads: 'dollar-outline', 'advocacy-outline': 'advocacy-outline', advocacy: 'advocacy-solid', 'approval-indicator-outline': 'stamp-outline', 'approval-indicator': 'stamp-solid', archive: 'file-box-outline', 'arrow-down-line': 'arrow-down-to-line-outline', 'arrow-down': 'arrow-down-outline', 'arrow-left-line': 'arrow-left-to-line-outline', 'arrow-left': 'arrow-left-outline', 'arrow-right-line': 'arrow-right-to-line-outline', 'arrow-right': 'arrow-right-outline', 'arrow-up-line': 'arrow-up-to-line-outline', 'arrow-up': 'arrow-up-outline', arrows: 'arrows-up-down-left-right-outline', 'asset-library-outline': 'asset-library-outline', 'asset-library': 'asset-library-solid', assign: 'sitemap-outline', atom: 'atom-outline', audio: 'audio-outline', 'back-to-top': 'arrow-up-outline', 'bambu-icon-outline': 'bambu-outline', 'bambu-icon': 'bambu-solid', barcode: 'barcode-outline', basketball: 'basketball-outline', 'bell-outline': 'bell-outline', bold: 'bold-outline', book: 'book-outline', 'bookmark-filled': 'bookmark-solid', bookmark: 'bookmark-outline', bot: 'robot-outline', browser: 'window-full-outline', 'bulk-select': 'square-check-outline', business: 'briefcase-outline', 'calendar-outline': 'calendar-outline', calendar: 'calendar-solid', 'camera-outline': 'camera-outline', 'camera-story': 'camera-story-solid', camera: 'camera-solid', campaign: 'megaphone-outline', carousel: 'carousel-outline', 'cart-plus': 'cart-plus-outline', check: 'check-outline', 'chevron-down-filled': 'caret-down-outline', 'chevron-down': 'chevron-down-outline', 'chevron-left': 'chevron-left-outline', 'chevron-right': 'chevron-right-outline', 'chevron-up-down-filled': 'caret-up-down-outline', 'chevron-up-filled': 'caret-up-outline', 'chevron-up': 'chevron-up-outline', 'circle-check-outline': 'circle-check-outline', 'circle-check': 'circle-check-solid', circle: 'circle-no-fill-outline', 'circle+': 'plus-outline', circles: 'large-circle-small-circle-outline', circleX: 'circle-x-outline', circlex: 'circle-x-outline', 'click-to-view': 'hand-pointer-clicking-outline', clicks: 'pointer-outline', 'clipboard-outline': 'clipboard-outline', clipboard: 'clipboard-solid', clock: 'clock-outline', 'closed-captioning': 'closed-caption-outline', cloud: 'cloud-outline', code: 'code-outline', columns: 'columns-outline', 'comment-alt-outline': 'comments-outline', 'comment-alt': 'comment-solid', 'comment-lines-alt-outline': 'comment-outline', comment: 'comments-outline', 'compact-density': 'bars-density-small-outline', 'compact-indicator': 'bars-density-small-outline', comparison: 'diamond-vs-outline', competitor: 'office-building-outline', compose: 'pencil-to-square-outline', 'content-suggestions': 'comment-sparkle-outline', 'credit-card': 'credit-card-outline', crop: 'crop-outline', crown: 'crown-outline', dashboard: 'gauge-outline', 'deconstructed-negative-sentiment': 'expression-frown-outline', 'deconstructed-neutral-sentiment': 'expression-neutral-outline', 'deconstructed-positive-sentiment': 'expression-smile-open-outline', discovery: 'compass-outline', 'dislike-outline': 'thumbs-down-outline', dislike: 'thumbs-down-solid', 'dm-link-outline': 'comment-plus-outline', 'dm-link': 'comment-plus-solid', 'doesnt-recommend': 'comment-star-slash-outline', dotdotdot: 'ellipsis-horizontal-outline', download: 'arrow-down-to-bracket-outline', 'drafts-outline': 'paper-outline', drafts: 'paper-solid', 'duplicate-outline': 'papers-outline', duplicate: 'papers-solid', 'emoji-outline': 'face-smile-outline', emoji: 'face-smile-solid', 'empty-image': 'camera-x-outline', 'engagement-per-post': 'comment-outline', engagements: 'comments-outline', error: 'circle-exclamation-outline', 'exchange-alt': 'arrows-left-right-outline', 'expanded-indicator': 'bars-density-large-outline', export: 'square-round-arrow-up-right-outline', 'extended-circles': 'large-circle-small-circle-outline', 'external-link-alt': 'squares-arrow-up-right-outline', 'external-link': 'square-round-arrow-up-right-outline', 'extreme-negative-sentiment': 'face-frown-open-outline', 'eye-outline': 'eye-outline', 'eye-slash-outline': 'eye-slash-outline', 'eye-slash': 'eye-slash-solid', eye: 'eye-solid', 'facebook-branded-content-outline': 'handshake-outline', 'facebook-branded-content': 'handshake-solid', feeds: 'unordered-list-outline', female: 'symbol-venus-outline', 'file-chart-line': 'paper-bars-outline', 'file-edit': 'paper-pencil-outline', 'file-times-solid': 'paper-x-outline', filter: 'filter-outline', 'flag-outline': 'flag-outline', flag: 'flag-solid', 'folder-open': 'folder-open-outline', folder: 'folder-outline', 'follow-outline': 'user-plus-outline', follow: 'user-plus-solid', 'follower-increase': 'user-arrow-up-outline', following: 'user-check-outline', font: 'font-case-outline', 'full-access': 'circle-fill-outline', gear: 'gear-outline', gears: 'gear-outline', glasses: 'glasses-outline', globe: 'globe-outline', grip: 'grip-lines-vertical-outline', h1: 'h1-outline', h2: 'h2-outline', h3: 'h3-outline', h4: 'h3-outline', hamburger: 'horizontal-lines-outline', hashtag: 'hashtag-outline', headset: 'headset-outline', 'heart-outline': 'heart-outline', heart: 'heart-solid', heartbeat: 'heart-pulse-outline', 'help-alt': 'question-mark-outline', help: 'circle-question-outline', hiking: 'person-hiking-outline', history: 'clock-rotate-left-outline', home: 'house-outline', hourglass: 'hourglass-outline', 'image-caption': 'rectangle-caption-outline', image: 'image-outline', images: 'images-outline', 'impressions-per-post': 'comment-eye-outline', impressions: 'eye-outline', 'inactive-listener': 'file-box-outline', 'inbox-action': 'inbox-check-outline', 'inbox-views': 'inboxes-outline', inbox: 'inbox-outline', indicator: 'circle-fill-outline', industry: 'office-building-outline', info: 'circle-i-outline', 'internal-activity-outline': 'clock-rotate-left-outline', 'internal-activity': 'clock-rotate-left-solid', italic: 'italics-outline', key: 'key-outline', keyboard: 'keyboard-outline', 'laptop-phone': 'laptop-mobile-outline', 'large-density': 'bars-density-large-outline', lift: 'circle-dollar-arrow-up-outline', 'like-outline': 'thumbs-up-outline', like: 'thumbs-up-solid', link: 'link-outline', 'list-ol': 'ordered-list-outline', listening: 'listening-outline', lists: 'unordered-list-outline', 'location-outline': 'location-pin-outline', location: 'location-pin-solid', lock: 'lock-outline', 'magic-wand': 'magic-wand-outline', male: 'symbol-mars-outline', mention: 'symbol-at-outline', 'message-preview-outline': 'eye-outline', 'message-preview': 'eye-solid', message: 'comment-outline', 'messages-outline': 'envelope-outline', messages: 'envelope-solid', 'metric-table': 'metric-table-outline', minus: 'minus-outline', mobile: 'mobile-outline', monitor: 'pulse-outline', moon: 'moon-crescent-outline', 'negative-sentiment': 'face-frown-outline', 'neutral-positive-sentiment': 'face-smile-outline', 'neutral-sentiment': 'face-neutral-outline', 'new-trend': 'fire-outline', newspaper: 'newspaper-outline', 'no-access': 'circle-minus-outline', 'no-notifications-filled': 'bell-slash-solid', 'no-notifications': 'bell-slash-outline', notepad: 'clipboard-outline', 'notifications-publishing': 'alarm-clock-outline', notifications: 'bell-outline', offline: 'wifi-slash-outline', online: 'wifi-outline', 'paid-promotion-outline': 'circle-dollar-outline', 'paid-promotion': 'circle-dollar-solid', paid: 'calculator-outline', paint: 'paint-can-outline', palette: 'art-palette-outline', paperclip: 'paperclip-outline', pause: 'pause-outline', 'pencil-outline': 'pencil-outline', pencil: 'pencil-solid', person: 'user-outline', phone: 'phone-outline', 'pinterest-boards-outline': 'mood-boards-outline', 'pinterest-boards': 'mood-boards-solid', 'play-circle': 'play-outline', play: 'play-outline', plug: 'plug-outline', plus: 'plus-outline', 'positive-sentiment': 'face-smile-open-outline', 'power-up-outline': 'lightning-bolt-outline', 'power-up': 'lightning-bolt-solid', 'profile-connect': 'leaf-plus-outline', 'profile-disconnect': 'leaf-minus-outline', 'publishing-outline': 'paper-plane-outline', publishing: 'paper-plane-outline', 'puzzle-piece': 'puzzle-piece-outline', 'qr-code': 'qr-code-outline', queue: 'queue-outline', recommendation: 'comment-star-outline', referrals: 'star-full-outline', refresh: 'arrows-rotate-outline', rejected: 'ban-outline', 'reply-outline': 'reply-outline', reply: 'reply-solid', 'reporting-period': 'calendar-range-outline', reporting: 'chart-bar-simple-outline', 'reports-home': 'four-squares-outline', reports: 'chart-pie-outline', retweet: 'repost-outline', rss: 'rss-outline', sales: 'dollar-outline', 'save-assets': 'asset-library-plus-outline', 'saved-messages': 'comment-bookmark-outline', 'saved-reply-outline': 'bookmark-reply-outline', 'saved-reply': 'bookmark-reply-solid', search: 'magnifying-glass-outline', 'sent-message-outline': 'inbox-arrow-up-outline', 'sent-message': 'inbox-arrow-up-solid', share: 'square-round-arrow-up-right-outline', 'shopping-bag-outline': 'shopping-bag-outline', 'shopping-bag': 'shopping-bag-solid', 'show-navigation': 'browser-nav-bar-outline', 'small-density': 'bars-density-medium-outline', smiley: 'face-smile-outline', 'some-access': 'circle-half-outline', sparkles: 'sparkle-outline', 'spike-alert': 'comment-exclamation-outline', 'star-half-alt-solid': 'star-half-outline', 'star-of-life': 'star-of-life-outline', 'star-outline': 'star-outline', star: 'star-full-outline', 'sticky-note-outline': 'note-outline', 'sticky-note': 'note-solid', story: 'camera-story-outline', stories: 'story-outline', suggestions: 'comment-light-bulb-outline', sun: 'sun-outline', 'tag-outline': 'tag-outline', tag: 'tag-solid', 'targeting-outline': 'bullseye-arrow-outline', targeting: 'bullseye-arrow-solid', 'tasks-outline': 'thumbtack-outline', tasks: 'thumbtack-solid', 'team-conversation-outline': 'sprout-leaf-lightning-bolt-outline', 'team-conversation': 'sprout-leaf-lightning-bolt-solid', team: 'users-outline', 'text-asset': 'text-serif-outline', text: 'text-serif-outline', times: 'x-outline', tools: 'screwdriver-hammer-outline', 'trash-can-outline': 'trash-outline', 'trash-can': 'trash-solid', 'trend-down': 'arrow-right-down-outline', 'trend-up': 'arrow-right-up-outline', 'trend-neutral': 'arrow-right-outline', trends: 'fire-outline', 'triangle-black': 'triangle-outline', triangle: 'triangle-exclamation-outline', 'trophy-outline': 'trophy-outline', 'unfollow-outline': 'user-x-outline', unfollow: 'user-x-solid', unlink: 'link-slash-outline', unlock: 'unlock-outline', upload: 'arrow-up-from-bracket-outline', 'user-circle': 'user-sprout-outline', users: 'users-outline', 'video-camera-story': 'video-camera-story-outline', 'video-camera': 'video-camera-outline', vip: 'gem-outline', weight: 'weight-outline', 'window-maximize': 'window-modal-outline', 'window-minimize': 'window-minimize-outline', 'window-regular': 'browser-outline', 'window-restore': 'browser-restore-outline', x: 'x-outline', 'tripadvisor-circle-filled': 'tripadvisor-cicle-solid', 'tripadvisor-circle-empty': 'tripadvisor-circle-outline', 'flat-positive-sentiment': 'face-smile-outline', 'flat-negative-sentiment': 'face-frown-outline', 'flat-neutral-sentiment': 'face-neutral-outline'};
|
|
9
|
+
|
|
10
|
+
// All the new icon names. Used to avoid attempting to migrate an icon name that has already been migrated.
|
|
11
|
+
// prettier-ignore
|
|
12
|
+
const ExternalIconNames = ["fb-reactions-angry","fb-reactions-haha","fb-reactions-like","fb-reactions-love","fb-reactions-sad","fb-reactions-wow","recommendation","reels-outline","reels-solid","tripadvisor-circle-outline","tripadvisor-circle-solid","verified","yelp-full-star","yelp-half-star"];
|
|
13
|
+
// prettier-ignore
|
|
14
|
+
const GeneralIconNames = ["alarm-clock-outline","alarm-clock-solid","all-caps-outline","all-caps-solid","alt-text-outline","alt-text-solid","arrow-down-outline","arrow-down-solid","arrow-down-to-bracket-outline","arrow-down-to-bracket-solid","arrow-down-to-line-outline","arrow-down-to-line-solid","arrow-left-outline","arrow-left-solid","arrow-left-to-line-outline","arrow-left-to-line-solid","arrow-right-down-outline","arrow-right-down-solid","arrow-right-from-bracket-outline","arrow-right-from-bracket-solid","arrow-right-outline","arrow-right-solid","arrow-right-to-line-outline","arrow-right-to-line-solid","arrow-right-up-outline","arrow-right-up-solid","arrow-up-from-bracket-outline","arrow-up-from-bracket-solid","arrow-up-outline","arrow-up-solid","arrow-up-to-line-outline","arrow-up-to-line-solid","arrows-left-right-outline","arrows-left-right-solid","arrows-pointing-in-outline","arrows-pointing-in-solid","arrows-pointing-out-outline","arrows-pointing-out-solid","arrows-rotate-outline","arrows-rotate-solid","arrows-up-down-left-right-outline","arrows-up-down-left-right-solid","art-palette-outline","art-palette-solid","atom-outline","atom-solid","audio-outline","audio-solid","ban-outline","ban-solid","barcode-outline","barcode-solid","bars-density-large-outline","bars-density-large-solid","bars-density-medium-outline","bars-density-medium-solid","bars-density-small-outline","bars-density-small-solid","bars-density-two-panel-outline","bars-density-two-panel-solid","basketball-outline","basketball-solid","bell-outline","bell-slash-outline","bell-slash-solid","bell-solid","bold-outline","bold-solid","book-open-outline","book-open-solid","book-outline","book-solid","bookmark-filter-outline","bookmark-filter-solid","bookmark-outline","bookmark-reply-outline","bookmark-reply-solid","bookmark-solid","briefcase-outline","briefcase-solid","browser-nav-bar-outline","browser-nav-bar-solid","browser-outline","browser-restore-outline","browser-restore-solid","browser-solid","bullseye-arrow-outline","bullseye-arrow-solid","calculator-outline","calculator-solid","calendar-clock-outline","calendar-clock-solid","calendar-day-outline","calendar-day-solid","calendar-outline","calendar-range-outline","calendar-range-solid","calendar-solid","camera-outline","camera-solid","camera-story-outline","camera-story-solid","camera-x-outline","camera-x-solid","caret-down-outline","caret-down-solid","caret-up-down-outline","caret-up-down-solid","caret-up-down-sort-down-outline","caret-up-down-sort-down-solid","caret-up-down-sort-up-outline","caret-up-down-sort-up-solid","caret-up-outline","caret-up-solid","carousel-outline","carousel-solid","cart-outline","cart-plus-outline","cart-plus-solid","cart-solid","chart-area-outline","chart-area-solid","chart-arrow-down-outline","chart-arrow-down-solid","chart-arrow-neutral-outline","chart-arrow-neutral-solid","chart-arrow-up-outline","chart-arrow-up-solid","chart-bar-outline","chart-bar-simple-outline","chart-bar-simple-solid","chart-bar-solid","chart-donut-outline","chart-donut-solid","chart-line-outline","chart-line-solid","chart-pie-outline","chart-pie-solid","check-outline","check-solid","chevron-down-outline","chevron-down-solid","chevron-left-outline","chevron-left-solid","chevron-right-outline","chevron-right-solid","chevron-up-outline","chevron-up-solid","circle-check-double-outline","circle-check-double-solid","circle-check-outline","circle-check-solid","circle-dollar-arrow-up-outline","circle-dollar-arrow-up-solid","circle-dollar-outline","circle-dollar-solid","circle-exclamation-outline","circle-exclamation-solid","circle-fill-outline","circle-fill-solid","circle-half-outline","circle-half-solid","circle-i-outline","circle-i-solid","circle-minus-outline","circle-minus-solid","circle-no-fill-outline","circle-no-fill-solid","circle-question-outline","circle-question-solid","circle-user-outline","circle-user-solid","circle-x-outline","circle-x-solid","clipboard-outline","clipboard-solid","clock-outline","clock-rotate-left-outline","clock-rotate-left-solid","clock-solid","closed-caption-outline","closed-caption-solid","cloud-outline","cloud-solid","code-outline","code-solid","columns-outline","columns-solid","comment-plus-outline","comment-plus-solid","comment-star-outline","comment-star-slash-outline","comment-star-slash-solid","comment-star-solid","compass-outline","compass-solid","credit-card-outline","credit-card-solid","crop-outline","crop-solid","crown-outline","crown-solid","curly-brackets-plus-outline","curly-brackets-plus-solid","delete-left-outline","delete-left-solid","diamond-outline","diamond-solid","diamond-vs-outline","diamond-vs-solid","dollar-outline","dollar-solid","ellipsis-horizontal-outline","ellipsis-horizontal-solid","ellipsis-vertical-outline","ellipsis-vertical-solid","envelope-outline","envelope-solid","expression-frown-outline","expression-frown-solid","expression-neutral-outline","expression-neutral-solid","expression-smile-open-outline","expression-smile-open-solid","eye-dropper-outline","eye-dropper-solid","eye-outline","eye-slash-outline","eye-slash-solid","eye-solid","face-frown-open-outline","face-frown-open-solid","face-frown-outline","face-frown-solid","face-neutral-outline","face-neutral-solid","face-smile-open-outline","face-smile-open-solid","face-smile-outline","face-smile-solid","file-box-arrow-up-outline","file-box-arrow-up-solid","file-box-outline","file-box-solid","filter-outline","filter-solid","fire-outline","fire-solid","flag-outline","flag-solid","folder-open-outline","folder-open-solid","folder-outline","folder-solid","font-case-outline","font-case-solid","four-squares-outline","four-squares-solid","gauge-outline","gauge-solid","gear-outline","gear-solid","gem-outline","gem-solid","gif-outline","gif-solid","glasses-outline","glasses-solid","globe-outline","globe-solid","grip-lines-vertical-outline","grip-lines-vertical-solid","h1-outline","h1-solid","h2-outline","h2-solid","h3-outline","h3-solid","h4-outline","h4-solid","hand-pointer-clicking-outline","hand-pointer-clicking-solid","handshake-outline","handshake-solid","hashtag-outline","hashtag-solid","headset-outline","headset-solid","heart-outline","heart-pulse-outline","heart-pulse-solid","heart-solid","horizontal-lines-outline","horizontal-lines-solid","hourglass-outline","hourglass-solid","house-outline","house-solid","image-outline","image-solid","images-outline","images-solid","inbox-arrow-up-outline","inbox-arrow-up-solid","inbox-check-outline","inbox-check-solid","inbox-lightning-bolt-outline","inbox-lightning-bolt-solid","inbox-outline","inbox-solid","inboxes-outline","inboxes-solid","italics-outline","italics-solid","justify-center-outline","justify-center-solid","justify-left-outline","justify-left-solid","justify-right-outline","justify-right-solid","key-outline","key-solid","keyboard-outline","keyboard-solid","language-outline","language-solid","laptop-mobile-outline","laptop-mobile-solid","larger-circle-small-circle-outline","larger-circle-small-circle-solid","lightbulb-outline","lightbulb-solid","lightning-bolt-outline","lightning-bolt-solid","link-broken-outline","link-broken-solid","link-outline","link-slash-outline","link-slash-solid","link-solid","locate-outline","locate-solid","location-pin-outline","location-pin-solid","lock-outline","lock-solid","magic-wand-outline","magic-wand-solid","magnifying-glass-outline","magnifying-glass-solid","magnifying-glass-twitter-outline","magnifying-glass-twitter-solid","masks-theater-outline","masks-theater-solid","megaphone-dollar-outline","megaphone-dollar-solid","megaphone-outline","megaphone-solid","metric-table-outline","metric-table-solid","microphone-outline","microphone-solid","minus-outline","minus-solid","mobile-outline","mobile-solid","mood-boards-outline","mood-boards-solid","moon-crescent-outline","moon-crescent-solid","newspaper-outline","newspaper-solid","note-outline","note-solid","office-building-outline","office-building-solid","ordered-list-outline","ordered-list-solid","paint-can-outline","paint-can-solid","paper-bars-outline","paper-bars-solid","paper-outline","paper-pencil-outline","paper-pencil-solid","paper-plane-arrows-rotate-outline","paper-plane-arrows-rotate-solid","paper-plane-outline","paper-plane-solid","paper-solid","paper-x-outline","paper-x-solid","paperclip-outline","paperclip-solid","papers-outline","papers-solid","pattern-circle-triangle-square-outline","pattern-circle-triangle-square-solid","pause-outline","pause-solid","pencil-outline","pencil-solid","person-hiking-outline","person-hiking-solid","phone-outline","phone-solid","play-outline","play-solid","plug-outline","plug-solid","plus-outline","plus-solid","pointer-outline","pointer-solid","profile-card-outline","profile-card-solid","pulse-outline","pulse-solid","puzzle-piece-outline","puzzle-piece-solid","qr-code-outline","qr-code-solid","question-mark-outline","question-mark-solid","rectangle-caption-outline","rectangle-caption-solid","reply-outline","reply-solid","repost-outline","repost-solid","robot-outline","robot-solid","route-outline","route-solid","rss-outline","rss-solid","screwdriver-hammer-outline","screwdriver-hammer-solid","seeds-outline","seeds-solid","shopping-bag-outline","shopping-bag-solid","sitemap-outline","sitemap-solid","sparkle-outline","sparkle-solid","square-check-outline","square-check-solid","square-outline","square-solid","squares-arrow-up-right-outline","squares-arrow-up-right-solid","stamp-check-outline","stamp-check-solid","stamp-outline","stamp-solid","star-full-outline","star-full-solid","star-half-outline","star-half-solid","star-of-life-outline","star-of-life-solid","star-outline","star-solid","story-outline","story-solid","strikethrough-outline","strikethrough-solid","sun-outline","sun-solid","symbol-at-outline","symbol-at-solid","symbol-mars-outline","symbol-mars-solid","symbol-venus-outline","symbol-venus-solid","tag-outline","tag-solid","tags-outline","tags-solid","text-serif-outline","text-serif-solid","thread-outline","thread-solid","thumbs-down-outline","thumbs-down-solid","thumbs-up-outline","thumbs-up-solid","thumbtack-check-outline","thumbtack-check-solid","thumbtack-outline","thumbtack-solid","ticket-outline","ticket-solid","trash-outline","trash-solid","triangle-exclamation-outline","triangle-exclamation-solid","triangle-outline","triangle-solid","trophy-outline","trophy-solid","underline-outline","underline-solid","unlock-outline","unlock-solid","unordered-list-outline","unordered-list-solid","user-arrow-up-outline","user-arrow-up-solid","user-check-outline","user-check-solid","user-minus-outline","user-minus-solid","user-outline","user-plus-outline","user-plus-solid","user-solid","user-x-outline","user-x-solid","users-outline","users-solid","video-camera-outline","video-camera-solid","video-camera-story-outline","video-camera-story-solid","weight-outline","weight-solid","wifi-outline","wifi-slash-outline","wifi-slash-solid","wifi-solid","window-arrow-up-left-outline","window-arrow-up-left-solid","window-dock-left-outline","window-dock-left-solid","window-dock-right-outline","window-dock-right-solid","window-full-outline","window-full-solid","window-minimize-outline","window-minimize-solid","window-modal-outline","window-modal-solid","x-outline","x-solid"]
|
|
15
|
+
// prettier-ignore
|
|
16
|
+
const SproutIconNames = ["advocacy-outline","advocacy-solid","asset-library-outline","asset-library-plus-outline","asset-library-plus-solid","asset-library-solid","bambu-outline","bambu-solid","comment-bookmark-outline","comment-bookmark-solid","comment-exclamation-outline","comment-exclamation-solid","comment-eye-outline","comment-eye-solid","comment-light-bulb-outline","comment-light-bulb-solid","comment-outline","comment-solid","comment-sparkle-outline","comment-sparkle-solid","comments-outline","comments-solid","leaf-minus-outline","leaf-minus-solid","leaf-plus-outline","leaf-plus-solid","listening-outline","listening-solid","pencil-to-square-outline","pencil-to-square-solid","queue-outline","queue-solid","sprout-leaf-ellipsis-outline","sprout-leaf-ellipsis-solid","sprout-leaf-lightning-bolt-outline","sprout-leaf-lightning-bolt-solid","sprout-leaf-sync-outline","sprout-leaf-sync-solid","square-round-arrow-up-right-outline","square-round-arrow-up-right-solid","user-sprout-outline","user-sprout-solid"];
|
|
17
|
+
const newIconNames = [
|
|
18
|
+
...ExternalIconNames,
|
|
19
|
+
...GeneralIconNames,
|
|
20
|
+
...SproutIconNames,
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
// Map the current icon name to the new icon name
|
|
24
|
+
const mapIconName = (currentName) => {
|
|
25
|
+
if (IconMap[currentName]) {
|
|
26
|
+
return IconMap[currentName];
|
|
27
|
+
}
|
|
28
|
+
// Migrates icons using icon names that were deprecated in 2020
|
|
29
|
+
if (IconMap[deprecatedNames[currentName]]) {
|
|
30
|
+
return IconMap[deprecatedNames[currentName]];
|
|
31
|
+
}
|
|
32
|
+
// Checks if the icon name has already been migrated. Makes the codemod semi-idempotent.
|
|
33
|
+
if (
|
|
34
|
+
newIconNames.includes(currentName) ||
|
|
35
|
+
newIconNames.includes(`${currentName}-solid`) // All icons with a solid variant also have an outline variant, so we don't need to check both.
|
|
36
|
+
) {
|
|
37
|
+
return currentName;
|
|
38
|
+
}
|
|
39
|
+
return '';
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Perform regex replacements with the raw file text
|
|
43
|
+
function replaceIconNames(file, firstRegex, secondRegex) {
|
|
44
|
+
let source = file.source;
|
|
45
|
+
firstRegex?.forEach((result) => {
|
|
46
|
+
// Extract just the icon name from the regex result
|
|
47
|
+
const iconName = result.match(/['"]([^'"]+)['"]/g)[0].replace(/['"]/g, '');
|
|
48
|
+
const mappedIcon = mapIconName(iconName);
|
|
49
|
+
if (mappedIcon) {
|
|
50
|
+
const replacement = result.replace(iconName, mappedIcon);
|
|
51
|
+
source = source.replace(result, replacement);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
secondRegex?.forEach((result) => {
|
|
55
|
+
// Extract just the icon name from the regex result
|
|
56
|
+
const iconName = result.replace('ssiconsvg-', '').replace(/['"]/g, '');
|
|
57
|
+
const mappedIcon = mapIconName(iconName);
|
|
58
|
+
if (mappedIcon) {
|
|
59
|
+
const replacement = result
|
|
60
|
+
.replace('ssiconsvg-', 'seeds-svgs_')
|
|
61
|
+
.replace(iconName, mappedIcon);
|
|
62
|
+
source = source.replace(result, replacement);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return source;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Racine components that accept icon names as top-level props.
|
|
69
|
+
// Users can pass in additional components in their codebase that accept icon names as props with "--components={componentName: [iconPropNames], ...}".
|
|
70
|
+
// A non-top-level prop example is the "iconName" prop nested under TokenInput's "tokens" prop. We can't fix those automatically.
|
|
71
|
+
const defaultComponents = {
|
|
72
|
+
Icon: ['name'],
|
|
73
|
+
'Icon.Toggle': ['activeName', 'inactiveName'],
|
|
74
|
+
Badge: ['iconName'],
|
|
75
|
+
TokenInput: ['iconName'],
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// We need to concatenate a few properties to get subcomponent names from AST (e.g., Icon.Toggle).
|
|
79
|
+
const getSubcomponentName = (element) => {
|
|
80
|
+
return `${element.value.name.object.name}.${element.value.name.property.name}`;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Reformat the components option until it's the same format as defaultComponents above. It comes through like this:
|
|
84
|
+
// '0': 'Accordion:[icon]',
|
|
85
|
+
// '1': 'FacebookPMAux:[iconName',
|
|
86
|
+
// '2': 'secondaryIconName]',
|
|
87
|
+
// Wrap each word in quotes and join it all together with commas, then wrap it in bracket and parse it from JSON.
|
|
88
|
+
const optionToObject = (components) => {
|
|
89
|
+
const withQuotesAndCommas = components
|
|
90
|
+
.join(',')
|
|
91
|
+
// (\w|\.) = letters or periods. Handles component names with periods in them such as subcomponents.
|
|
92
|
+
.replace(/((\w|\.)+)/g, '"$1"');
|
|
93
|
+
try {
|
|
94
|
+
return JSON.parse('{' + withQuotesAndCommas + '}');
|
|
95
|
+
} catch (e) {
|
|
96
|
+
e.message = `
|
|
97
|
+
Failed to parse the components argument. Please verify that it is formatted correctly:
|
|
98
|
+
Format: --components="{ComponentName: ['nameProp']}"
|
|
99
|
+
- The argument should be an object wrapped in quotes
|
|
100
|
+
- Name props must be passed as an array because some components may have multiple relevant props.`;
|
|
101
|
+
throw e;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
module.exports = function transformer(file, api, options) {
|
|
106
|
+
const quote = options?.quote ?? 'single';
|
|
107
|
+
const components = options?.components
|
|
108
|
+
? {...defaultComponents, ...optionToObject(options.components)}
|
|
109
|
+
: defaultComponents;
|
|
110
|
+
const addComments = options?.addComments ?? true;
|
|
111
|
+
const shimComponentName = options?.shimName ?? '';
|
|
112
|
+
const shimComponentPath = options?.shimImportPath ?? '';
|
|
113
|
+
const addShimComponent = !!shimComponentName;
|
|
114
|
+
|
|
115
|
+
let source = file.source;
|
|
116
|
+
|
|
117
|
+
// Codemods run faster and cause fewer formatting issues if you only write files with modifications.
|
|
118
|
+
let hasModifications = false;
|
|
119
|
+
|
|
120
|
+
// Keep track of which components have usages that cannot be migrated and how many total usages per file cannot be migrated.
|
|
121
|
+
const unmigratedComponents = [];
|
|
122
|
+
let unmigratedCount = 0;
|
|
123
|
+
|
|
124
|
+
// Track how many components in the file were converted to the shim component.
|
|
125
|
+
let shimmedCount = 0;
|
|
126
|
+
// Count how many "Icon" components in particular are in the file so that we can determine if they were all shimmed.
|
|
127
|
+
// Other components can have their string icon names migrated, but only "Icon" can be shimmed.
|
|
128
|
+
let iconCount = 0;
|
|
129
|
+
|
|
130
|
+
// Regex: This code can migrate icon names outside of js files as well as some cases in js files that the codemod cannot identify.
|
|
131
|
+
// We do any regex-based replacements and then, if it's a js file, we parse the result to AST and look for any additional icon names to migrate.
|
|
132
|
+
|
|
133
|
+
// Regex 1: This regex looks for "icon" or "iconName" followed 0+ whitespace characters, a colon or equal sign,
|
|
134
|
+
// 0+ whitespace characters, then something wrapped in single or double quotes.
|
|
135
|
+
const firstRegex = file.source.match(
|
|
136
|
+
/(icon|iconName)\s*([:=])\s*(['"])([^'"]+)(['"])/g
|
|
137
|
+
);
|
|
138
|
+
// Regex 2: This regex looks for "ssiconsvg-" + any non-quote characters until the next quote.
|
|
139
|
+
// This appears in snap files and when manually rendering icons in non-React code like stache files.
|
|
140
|
+
const secondRegex = file.source.match(/(ssiconsvg-)([^'"]+)(['"])/g);
|
|
141
|
+
|
|
142
|
+
// If either regex found results, execute find+replace before parsing the file into AST.
|
|
143
|
+
if (firstRegex || secondRegex) {
|
|
144
|
+
const sourceWithReplacements = replaceIconNames(
|
|
145
|
+
file,
|
|
146
|
+
firstRegex,
|
|
147
|
+
secondRegex
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
// Only set hasModifications to true if the replacement step changed anything.
|
|
151
|
+
if (sourceWithReplacements !== file.source) {
|
|
152
|
+
hasModifications = true;
|
|
153
|
+
source = sourceWithReplacements;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// We want to short-circuit before parsing to AST for non-JS/TS files.
|
|
158
|
+
if (
|
|
159
|
+
// file.path is undefined during test runs only
|
|
160
|
+
file.path &&
|
|
161
|
+
!file.path.endsWith('js') &&
|
|
162
|
+
!file.path.endsWith('ts') &&
|
|
163
|
+
!file.path.endsWith('tsx')
|
|
164
|
+
) {
|
|
165
|
+
return hasModifications ? source : null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Now the AST modifications happen.
|
|
169
|
+
const j = api.jscodeshift;
|
|
170
|
+
const ast = j(source);
|
|
171
|
+
const icons = ast.find(j.JSXOpeningElement).filter((element) => {
|
|
172
|
+
let componentName = element.value.name.name;
|
|
173
|
+
if (element.value.name?.type === 'JSXMemberExpression') {
|
|
174
|
+
componentName = getSubcomponentName(element);
|
|
175
|
+
}
|
|
176
|
+
if (componentName === 'Icon') {
|
|
177
|
+
iconCount += 1;
|
|
178
|
+
}
|
|
179
|
+
return components[componentName];
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// Save comments at the top of the file if they exist. Otherwise, they may be deleted if we modify the first import.
|
|
183
|
+
const originalFirstNode = ast.find(j.Program).get('body', 0).node;
|
|
184
|
+
const originalFirstComments = originalFirstNode.comments;
|
|
185
|
+
|
|
186
|
+
icons.forEach((iconPath) => {
|
|
187
|
+
const attrs = j(iconPath).find(j.JSXAttribute);
|
|
188
|
+
const componentName =
|
|
189
|
+
iconPath.value.name.name ?? getSubcomponentName(iconPath);
|
|
190
|
+
const nameProps = components[componentName];
|
|
191
|
+
attrs.forEach((path) => {
|
|
192
|
+
const {node} = path;
|
|
193
|
+
// nameProps is an array because some components accept icon names for multiple props
|
|
194
|
+
// (e.g., Icon.Toggle's activeName and inactiveName props)
|
|
195
|
+
if (nameProps.includes(node.name.name)) {
|
|
196
|
+
const value = node.value.value;
|
|
197
|
+
if (value) {
|
|
198
|
+
// Map string icon names
|
|
199
|
+
const mappedValue = mapIconName(value);
|
|
200
|
+
if (mappedValue) {
|
|
201
|
+
node.value = j.literal(mappedValue);
|
|
202
|
+
hasModifications = true;
|
|
203
|
+
} else {
|
|
204
|
+
// This case handles invalid string icon names.
|
|
205
|
+
unmigratedCount += 1;
|
|
206
|
+
!unmigratedComponents.includes(componentName) &&
|
|
207
|
+
unmigratedComponents.push(componentName);
|
|
208
|
+
}
|
|
209
|
+
} else if (node.value.expression.type === 'ConditionalExpression') {
|
|
210
|
+
// Handle ternary statements (eg, `name={isActive ? 'like' : 'like-outline'}`)
|
|
211
|
+
const oldConsequent = node.value.expression.consequent?.value;
|
|
212
|
+
const oldAlternate = node.value.expression.alternate?.value;
|
|
213
|
+
const newConsequent = oldConsequent
|
|
214
|
+
? mapIconName(oldConsequent)
|
|
215
|
+
: undefined;
|
|
216
|
+
const newAlternate = oldAlternate
|
|
217
|
+
? mapIconName(oldAlternate)
|
|
218
|
+
: undefined;
|
|
219
|
+
|
|
220
|
+
if (newConsequent && newAlternate) {
|
|
221
|
+
hasModifications = true;
|
|
222
|
+
node.value.expression.consequent = j.literal(newConsequent);
|
|
223
|
+
node.value.expression.alternate = j.literal(newAlternate);
|
|
224
|
+
} else {
|
|
225
|
+
unmigratedCount += 1;
|
|
226
|
+
!unmigratedComponents.includes(componentName) &&
|
|
227
|
+
unmigratedComponents.push(componentName);
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
// This case handles when the nameProp value is a variable.
|
|
231
|
+
if (componentName === 'Icon' && addShimComponent) {
|
|
232
|
+
iconPath.node.name = shimComponentName;
|
|
233
|
+
shimmedCount += 1;
|
|
234
|
+
hasModifications = true;
|
|
235
|
+
} else {
|
|
236
|
+
unmigratedCount += 1;
|
|
237
|
+
!unmigratedComponents.includes(componentName) &&
|
|
238
|
+
unmigratedComponents.push(componentName);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
if (addShimComponent && shimmedCount > 0) {
|
|
246
|
+
// Add the shim import after the racine import
|
|
247
|
+
ast
|
|
248
|
+
.find(j.ImportDeclaration, {
|
|
249
|
+
source: {value: '@sproutsocial/racine'},
|
|
250
|
+
})
|
|
251
|
+
.filter((element) => {
|
|
252
|
+
// There may be multiple Racine import statements. Only change the one that imports Icon.
|
|
253
|
+
return element.node.specifiers
|
|
254
|
+
.map((specifier) => specifier.imported.name)
|
|
255
|
+
.includes('Icon');
|
|
256
|
+
})
|
|
257
|
+
.insertAfter(
|
|
258
|
+
j.importDeclaration(
|
|
259
|
+
[j.importSpecifier(j.identifier(shimComponentName))],
|
|
260
|
+
j.literal(shimComponentPath)
|
|
261
|
+
)
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
// Checks for non-standard usages of the Icon component: styled(Icon) and typeof Icon
|
|
265
|
+
// We don't want to delete the import if Icon is used in this way in the file.
|
|
266
|
+
const hasOtherIconUsages =
|
|
267
|
+
source.match(/\(Icon\)/) || source.match(/typeof Icon/);
|
|
268
|
+
|
|
269
|
+
// If we migrated every Icon in the file to the shim component, remove the Icon import.
|
|
270
|
+
if (shimmedCount === iconCount && !hasOtherIconUsages) {
|
|
271
|
+
ast
|
|
272
|
+
.find(j.ImportDeclaration, {
|
|
273
|
+
source: {value: '@sproutsocial/racine'},
|
|
274
|
+
})
|
|
275
|
+
.replaceWith((path) => {
|
|
276
|
+
// Remove "Icon" from the imported items
|
|
277
|
+
const importedItems = path.node.specifiers.filter(
|
|
278
|
+
(specifier) => specifier.imported.name !== 'Icon'
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
// If Icon was the only item being imported from Racine, delete the import statement.
|
|
282
|
+
if (!importedItems.length) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return j.importDeclaration(
|
|
287
|
+
importedItems,
|
|
288
|
+
j.literal(path.node.source.value)
|
|
289
|
+
);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
hasModifications = true;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// If the first node has been modified or deleted, reattach the comments to the new first node.
|
|
297
|
+
const newFirstNode = ast.find(j.Program).get('body', 0).node;
|
|
298
|
+
if (newFirstNode !== originalFirstNode) {
|
|
299
|
+
newFirstNode.comments = originalFirstComments;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (addComments && unmigratedCount > 0) {
|
|
303
|
+
const comment = j.commentBlock(
|
|
304
|
+
`TODO (icon-library codemod): Please manually migrate icon names passed to ${unmigratedCount} component(s) in this file.
|
|
305
|
+
Look for usages of these components: ${unmigratedComponents.join(', ')}`
|
|
306
|
+
);
|
|
307
|
+
// Add this comment after any comments on the first node.
|
|
308
|
+
newFirstNode.comments = newFirstNode.comments
|
|
309
|
+
? [...newFirstNode.comments, comment]
|
|
310
|
+
: [comment];
|
|
311
|
+
hasModifications = true;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return hasModifications ? ast.toSource({quote}) : null;
|
|
315
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// We need the deprecated icon name mapping so that we can migrate icons still using the ancient names all the way to the new names.
|
|
2
|
+
// prettier-ignore
|
|
3
|
+
const deprecatedNames = {backtotop: 'back-to-top', 'circle-check-filled': 'circle-check', 'circle-check-no-fill': 'circle-check', 'circle-check-inverse-outline': 'circle-check-outline', 'circle-check-inverse': 'circle-check-outline', 'circle+-filled': 'circle+', 'circlex-filled': 'circlex', 'circle+-nofill': 'circle+', 'circlex-nofill': 'circlex', creditcard: 'credit-card', 'direct-message': 'messages', 'facebook-nofill': 'facebook', googleanalytics: 'google-analytics-color', 'instagram-brand-keyword': 'hashtag', 'help-white': 'help', 'info-white': 'info', 'instagram-nofill': 'instagram', 'key-circle': 'key', 'key-square': 'key', 'linkedin-nofill': 'linkedin', 'listening-home': 'listening', 'location-pub': 'location', 'location-pub-outline': 'location-outline', 'publishing-calendar': 'calendar', qrcode: 'qr-code', 'sparkles-solid': 'sparkles', 'star-inverse': 'star-outline', 'triangle-white': 'triangle', 'triangle-nofill': 'triangle', 'tripadvisor-circle-filled': 'tripadvisor-circle', 'tripadvisor-circle-empty': 'tripadvisor-circle-outline', 'tumblr-square': 'tumblr', 'tumblr-nofill': 'tumblr', 'twitter-business-mention': 'search', 'verified-nofill': 'verified', 'window-maximize-solid': 'window-maximize'};
|
|
4
|
+
|
|
5
|
+
// Mapping from old icon names to new icon names
|
|
6
|
+
// prettier-ignore
|
|
7
|
+
const IconMap = {'active-listener': 'listening-outline', 'add-item': 'plus-outline', 'add-keyword': 'plus-outline', 'add-team-member': 'user-plus-outline', 'add-variable': 'curly-brackets-plus-outline', 'address-card-outline': 'profile-card-outline', 'address-card-solid': 'profile-card-solid', ads: 'dollar-outline', 'advocacy-outline': 'advocacy-outline', advocacy: 'advocacy-solid', 'approval-indicator-outline': 'stamp-outline', 'approval-indicator': 'stamp-solid', archive: 'file-box-outline', 'arrow-down-line': 'arrow-down-to-line-outline', 'arrow-down': 'arrow-down-outline', 'arrow-left-line': 'arrow-left-to-line-outline', 'arrow-left': 'arrow-left-outline', 'arrow-right-line': 'arrow-right-to-line-outline', 'arrow-right': 'arrow-right-outline', 'arrow-up-line': 'arrow-up-to-line-outline', 'arrow-up': 'arrow-up-outline', arrows: 'arrows-up-down-left-right-outline', 'asset-library-outline': 'asset-library-outline', 'asset-library': 'asset-library-solid', assign: 'sitemap-outline', atom: 'atom-outline', audio: 'audio-outline', 'back-to-top': 'arrow-up-outline', 'bambu-icon-outline': 'bambu-outline', 'bambu-icon': 'bambu-solid', barcode: 'barcode-outline', basketball: 'basketball-outline', 'bell-outline': 'bell-outline', bold: 'bold-outline', book: 'book-outline', 'bookmark-filled': 'bookmark-solid', bookmark: 'bookmark-outline', bot: 'robot-outline', browser: 'window-full-outline', 'bulk-select': 'square-check-outline', business: 'briefcase-outline', 'calendar-outline': 'calendar-outline', calendar: 'calendar-solid', 'camera-outline': 'camera-outline', 'camera-story': 'camera-story-solid', camera: 'camera-solid', campaign: 'megaphone-outline', carousel: 'carousel-outline', 'cart-plus': 'cart-plus-outline', check: 'check-outline', 'chevron-down-filled': 'caret-down-outline', 'chevron-down': 'chevron-down-outline', 'chevron-left': 'chevron-left-outline', 'chevron-right': 'chevron-right-outline', 'chevron-up-down-filled': 'caret-up-down-outline', 'chevron-up-filled': 'caret-up-outline', 'chevron-up': 'chevron-up-outline', 'circle-check-outline': 'circle-check-outline', 'circle-check': 'circle-check-solid', circle: 'circle-no-fill-outline', 'circle+': 'plus-outline', circles: 'large-circle-small-circle-outline', circleX: 'circle-x-outline', circlex: 'circle-x-outline', 'click-to-view': 'hand-pointer-clicking-outline', clicks: 'pointer-outline', 'clipboard-outline': 'clipboard-outline', clipboard: 'clipboard-solid', clock: 'clock-outline', 'closed-captioning': 'closed-caption-outline', cloud: 'cloud-outline', code: 'code-outline', columns: 'columns-outline', 'comment-alt-outline': 'comments-outline', 'comment-alt': 'comment-solid', 'comment-lines-alt-outline': 'comment-outline', comment: 'comments-outline', 'compact-density': 'bars-density-small-outline', 'compact-indicator': 'bars-density-small-outline', comparison: 'diamond-vs-outline', competitor: 'office-building-outline', compose: 'pencil-to-square-outline', 'content-suggestions': 'comment-sparkle-outline', 'credit-card': 'credit-card-outline', crop: 'crop-outline', crown: 'crown-outline', dashboard: 'gauge-outline', 'deconstructed-negative-sentiment': 'expression-frown-outline', 'deconstructed-neutral-sentiment': 'expression-neutral-outline', 'deconstructed-positive-sentiment': 'expression-smile-open-outline', discovery: 'compass-outline', 'dislike-outline': 'thumbs-down-outline', dislike: 'thumbs-down-solid', 'dm-link-outline': 'comment-plus-outline', 'dm-link': 'comment-plus-solid', 'doesnt-recommend': 'comment-star-slash-outline', dotdotdot: 'ellipsis-horizontal-outline', download: 'arrow-down-to-bracket-outline', 'drafts-outline': 'paper-outline', drafts: 'paper-solid', 'duplicate-outline': 'papers-outline', duplicate: 'papers-solid', 'emoji-outline': 'face-smile-outline', emoji: 'face-smile-solid', 'empty-image': 'camera-x-outline', 'engagement-per-post': 'comment-outline', engagements: 'comments-outline', error: 'circle-exclamation-outline', 'exchange-alt': 'arrows-left-right-outline', 'expanded-indicator': 'bars-density-large-outline', export: 'square-round-arrow-up-right-outline', 'extended-circles': 'large-circle-small-circle-outline', 'external-link-alt': 'squares-arrow-up-right-outline', 'external-link': 'square-round-arrow-up-right-outline', 'extreme-negative-sentiment': 'face-frown-open-outline', 'eye-outline': 'eye-outline', 'eye-slash-outline': 'eye-slash-outline', 'eye-slash': 'eye-slash-solid', eye: 'eye-solid', 'facebook-branded-content-outline': 'handshake-outline', 'facebook-branded-content': 'handshake-solid', feeds: 'unordered-list-outline', female: 'symbol-venus-outline', 'file-chart-line': 'paper-bars-outline', 'file-edit': 'paper-pencil-outline', 'file-times-solid': 'paper-x-outline', filter: 'filter-outline', 'flag-outline': 'flag-outline', flag: 'flag-solid', 'folder-open': 'folder-open-outline', folder: 'folder-outline', 'follow-outline': 'user-plus-outline', follow: 'user-plus-solid', 'follower-increase': 'user-arrow-up-outline', following: 'user-check-outline', font: 'font-case-outline', 'full-access': 'circle-fill-outline', gear: 'gear-outline', gears: 'gear-outline', glasses: 'glasses-outline', globe: 'globe-outline', grip: 'grip-lines-vertical-outline', h1: 'h1-outline', h2: 'h2-outline', h3: 'h3-outline', h4: 'h3-outline', hamburger: 'horizontal-lines-outline', hashtag: 'hashtag-outline', headset: 'headset-outline', 'heart-outline': 'heart-outline', heart: 'heart-solid', heartbeat: 'heart-pulse-outline', 'help-alt': 'question-mark-outline', help: 'circle-question-outline', hiking: 'person-hiking-outline', history: 'clock-rotate-left-outline', home: 'house-outline', hourglass: 'hourglass-outline', 'image-caption': 'rectangle-caption-outline', image: 'image-outline', images: 'images-outline', 'impressions-per-post': 'comment-eye-outline', impressions: 'eye-outline', 'inactive-listener': 'file-box-outline', 'inbox-action': 'inbox-check-outline', 'inbox-views': 'inboxes-outline', inbox: 'inbox-outline', indicator: 'circle-fill-outline', industry: 'office-building-outline', info: 'circle-i-outline', 'internal-activity-outline': 'clock-rotate-left-outline', 'internal-activity': 'clock-rotate-left-solid', italic: 'italics-outline', key: 'key-outline', keyboard: 'keyboard-outline', 'laptop-phone': 'laptop-mobile-outline', 'large-density': 'bars-density-large-outline', lift: 'circle-dollar-arrow-up-outline', 'like-outline': 'thumbs-up-outline', like: 'thumbs-up-solid', link: 'link-outline', 'list-ol': 'ordered-list-outline', listening: 'listening-outline', lists: 'unordered-list-outline', 'location-outline': 'location-pin-outline', location: 'location-pin-solid', lock: 'lock-outline', 'magic-wand': 'magic-wand-outline', male: 'symbol-mars-outline', mention: 'symbol-at-outline', 'message-preview-outline': 'eye-outline', 'message-preview': 'eye-solid', message: 'comment-outline', 'messages-outline': 'envelope-outline', messages: 'envelope-solid', 'metric-table': 'metric-table-outline', minus: 'minus-outline', mobile: 'mobile-outline', monitor: 'pulse-outline', moon: 'moon-crescent-outline', 'negative-sentiment': 'face-frown-outline', 'neutral-positive-sentiment': 'face-smile-outline', 'neutral-sentiment': 'face-neutral-outline', 'new-trend': 'fire-outline', newspaper: 'newspaper-outline', 'no-access': 'circle-minus-outline', 'no-notifications-filled': 'bell-slash-solid', 'no-notifications': 'bell-slash-outline', notepad: 'clipboard-outline', 'notifications-publishing': 'alarm-clock-outline', notifications: 'bell-outline', offline: 'wifi-slash-outline', online: 'wifi-outline', 'paid-promotion-outline': 'circle-dollar-outline', 'paid-promotion': 'circle-dollar-solid', paid: 'calculator-outline', paint: 'paint-can-outline', palette: 'art-palette-outline', paperclip: 'paperclip-outline', pause: 'pause-outline', 'pencil-outline': 'pencil-outline', pencil: 'pencil-solid', person: 'user-outline', phone: 'phone-outline', 'pinterest-boards-outline': 'mood-boards-outline', 'pinterest-boards': 'mood-boards-solid', 'play-circle': 'play-outline', play: 'play-outline', plug: 'plug-outline', plus: 'plus-outline', 'positive-sentiment': 'face-smile-open-outline', 'power-up-outline': 'lightning-bolt-outline', 'power-up': 'lightning-bolt-solid', 'profile-connect': 'leaf-plus-outline', 'profile-disconnect': 'leaf-minus-outline', 'publishing-outline': 'paper-plane-outline', publishing: 'paper-plane-outline', 'puzzle-piece': 'puzzle-piece-outline', 'qr-code': 'qr-code-outline', queue: 'queue-outline', recommendation: 'comment-star-outline', referrals: 'star-full-outline', refresh: 'arrows-rotate-outline', rejected: 'ban-outline', 'reply-outline': 'reply-outline', reply: 'reply-solid', 'reporting-period': 'calendar-range-outline', reporting: 'chart-bar-simple-outline', 'reports-home': 'four-squares-outline', reports: 'chart-pie-outline', retweet: 'repost-outline', rss: 'rss-outline', sales: 'dollar-outline', 'save-assets': 'asset-library-plus-outline', 'saved-messages': 'comment-bookmark-outline', 'saved-reply-outline': 'bookmark-reply-outline', 'saved-reply': 'bookmark-reply-solid', search: 'magnifying-glass-outline', 'sent-message-outline': 'inbox-arrow-up-outline', 'sent-message': 'inbox-arrow-up-solid', share: 'square-round-arrow-up-right-outline', 'shopping-bag-outline': 'shopping-bag-outline', 'shopping-bag': 'shopping-bag-solid', 'show-navigation': 'browser-nav-bar-outline', 'small-density': 'bars-density-medium-outline', smiley: 'face-smile-outline', 'some-access': 'circle-half-outline', sparkles: 'sparkle-outline', 'spike-alert': 'comment-exclamation-outline', 'star-half-alt-solid': 'star-half-outline', 'star-of-life': 'star-of-life-outline', 'star-outline': 'star-outline', star: 'star-full-outline', 'sticky-note-outline': 'note-outline', 'sticky-note': 'note-solid', story: 'camera-story-outline', stories: 'story-outline', suggestions: 'comment-light-bulb-outline', sun: 'sun-outline', 'tag-outline': 'tag-outline', tag: 'tag-solid', 'targeting-outline': 'bullseye-arrow-outline', targeting: 'bullseye-arrow-solid', 'tasks-outline': 'thumbtack-outline', tasks: 'thumbtack-solid', 'team-conversation-outline': 'sprout-leaf-lightning-bolt-outline', 'team-conversation': 'sprout-leaf-lightning-bolt-solid', team: 'users-outline', 'text-asset': 'text-serif-outline', text: 'text-serif-outline', times: 'x-outline', tools: 'screwdriver-hammer-outline', 'trash-can-outline': 'trash-outline', 'trash-can': 'trash-solid', 'trend-down': 'arrow-right-down-outline', 'trend-up': 'arrow-right-up-outline', 'trend-neutral': 'arrow-right-outline', trends: 'fire-outline', 'triangle-black': 'triangle-outline', triangle: 'triangle-exclamation-outline', 'trophy-outline': 'trophy-outline', 'unfollow-outline': 'user-x-outline', unfollow: 'user-x-solid', unlink: 'link-slash-outline', unlock: 'unlock-outline', upload: 'arrow-up-from-bracket-outline', 'user-circle': 'user-sprout-outline', users: 'users-outline', 'video-camera-story': 'video-camera-story-outline', 'video-camera': 'video-camera-outline', vip: 'gem-outline', weight: 'weight-outline', 'window-maximize': 'window-modal-outline', 'window-minimize': 'window-minimize-outline', 'window-regular': 'browser-outline', 'window-restore': 'browser-restore-outline', x: 'x-outline', 'tripadvisor-circle-filled': 'tripadvisor-cicle-solid', 'tripadvisor-circle-empty': 'tripadvisor-circle-outline', 'flat-positive-sentiment': 'face-smile-outline', 'flat-negative-sentiment': 'face-frown-outline', 'flat-neutral-sentiment': 'face-neutral-outline'};
|
|
8
|
+
|
|
9
|
+
// Map the current icon name to the new icon name
|
|
10
|
+
const mapIconName = (currentName) => {
|
|
11
|
+
if (IconMap[currentName]) {
|
|
12
|
+
return IconMap[currentName];
|
|
13
|
+
}
|
|
14
|
+
// Migrates icons using icon names that were deprecated in 2020
|
|
15
|
+
if (IconMap[deprecatedNames[currentName]]) {
|
|
16
|
+
return IconMap[deprecatedNames[currentName]];
|
|
17
|
+
}
|
|
18
|
+
return '';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
module.exports = function transformer(file, api, options) {
|
|
22
|
+
const quote = options?.quote ?? 'single';
|
|
23
|
+
const j = api.jscodeshift;
|
|
24
|
+
const ast = j(file.source);
|
|
25
|
+
let hasModifications = false;
|
|
26
|
+
|
|
27
|
+
// Because we do not filter down the literals we find in any way to confirm they are icon-related,
|
|
28
|
+
// we may end up inadvertently mapping non-icon-name usages of strings that happen to be icon names.
|
|
29
|
+
// Thus, it is *extremely important* to manually check the results of this codemod!
|
|
30
|
+
// Otherwise, non-icon-related bugs may be introduced.
|
|
31
|
+
ast.find(j.Literal).forEach((path) => {
|
|
32
|
+
const value = path.value.value;
|
|
33
|
+
if (value) {
|
|
34
|
+
const mappedValue = mapIconName(value);
|
|
35
|
+
if (mappedValue) {
|
|
36
|
+
path.value.value = mappedValue;
|
|
37
|
+
hasModifications = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return hasModifications ? ast.toSource({quote}) : null;
|
|
43
|
+
};
|
package/commonjs/Avatar/index.js
CHANGED
|
@@ -21,7 +21,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
21
21
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
22
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
23
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
-
function _iterableToArrayLimit(arr, i) { var _i =
|
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
25
25
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
26
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
27
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
package/commonjs/Badge/styles.js
CHANGED
|
@@ -9,7 +9,6 @@ var _themeGet = require("@styled-system/theme-get");
|
|
|
9
9
|
var _systemProps = require("../utils/system-props");
|
|
10
10
|
var _constants = require("./constants");
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
12
|
// eslint-disable-next-line flowtype/generic-spacing
|
|
14
13
|
var Container = _styledComponents.default.span.withConfig({
|
|
15
14
|
displayName: "styles__Container",
|
|
@@ -9,7 +9,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
9
9
|
var _systemProps = require("../utils/system-props");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
|
|
13
12
|
var Container = _styledComponents.default.div.withConfig({
|
|
14
13
|
displayName: "styles__Container",
|
|
15
14
|
componentId: "sc-q43dr4-0"
|
package/commonjs/Box/styles.js
CHANGED
|
@@ -7,7 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
8
|
var _systemProps = require("../utils/system-props");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
10
|
var Container = _styledComponents.default.div.withConfig({
|
|
12
11
|
displayName: "styles__Container",
|
|
13
12
|
componentId: "sc-ma8yo6-0"
|
|
@@ -17,7 +17,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
18
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
19
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21
23
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
22
24
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
25
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
|
|
10
9
|
var Nav = _styledComponents.default.nav.withConfig({
|
|
11
10
|
displayName: "styles__Nav",
|
|
12
11
|
componentId: "sc-1ub1apc-0"
|
|
@@ -12,7 +12,6 @@ var _styles = _interopRequireDefault(require("../Icon/styles"));
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
14
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
15
|
var Container = _styledComponents.default.button.withConfig({
|
|
17
16
|
displayName: "styles__Container",
|
|
18
17
|
componentId: "sc-1juy94s-0"
|
package/commonjs/Card/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'no babel-plugin-flow-react-proptypes';
|
|
3
|
-
|
|
4
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
package/commonjs/Card/styles.js
CHANGED
|
@@ -8,7 +8,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
8
8
|
var _Box = _interopRequireDefault(require("../Box"));
|
|
9
9
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
11
|
var Container = (0, _styledComponents.default)(_Box.default).withConfig({
|
|
13
12
|
displayName: "styles__Container",
|
|
14
13
|
componentId: "sc-p098yi-0"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -11,11 +10,12 @@ var _excluded = ["size"];
|
|
|
11
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
14
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
15
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
16
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
17
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
18
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
19
19
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
20
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
21
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
@@ -24,7 +24,9 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
24
24
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
25
25
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
26
26
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
27
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
28
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
29
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
28
30
|
var CharacterCounter = /*#__PURE__*/function (_React$Component) {
|
|
29
31
|
_inherits(CharacterCounter, _React$Component);
|
|
30
32
|
var _super = _createSuper(CharacterCounter);
|