@spaced-out/ui-design-system 0.3.38 → 0.3.39-beta.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/.cspell/custom-words.txt +4 -0
- package/.github/workflows/publish_to_npm.yml +32 -4
- package/CHANGELOG.md +14 -0
- package/dts-generator/.editorconfig +10 -0
- package/dts-generator/.gitattributes +4 -0
- package/dts-generator/README.md +63 -0
- package/dts-generator/convert.js +101 -0
- package/dts-generator/package.json +16 -0
- package/gulpfile.js +20 -1
- package/lib/components/Avatar/Avatar.d.ts +264 -0
- package/lib/components/Avatar/index.d.ts +1 -0
- package/lib/components/AvatarGroup/AvatarGroup.d.ts +161 -0
- package/lib/components/AvatarGroup/index.d.ts +1 -0
- package/lib/components/Badge/Badge.d.ts +138 -0
- package/lib/components/Badge/index.d.ts +1 -0
- package/lib/components/Banner/Banner.d.ts +52 -0
- package/lib/components/Banner/index.d.ts +1 -0
- package/lib/components/Breadcrumbs/BreadcrumbLink/BreadcrumbLink.d.ts +50 -0
- package/lib/components/Breadcrumbs/BreadcrumbLink/index.d.ts +1 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +64 -0
- package/lib/components/Breadcrumbs/index.d.ts +2 -0
- package/lib/components/Button/Button.d.ts +288 -0
- package/lib/components/Button/index.d.ts +14 -0
- package/lib/components/ButtonDropdown/ButtonDropdown.d.ts +192 -0
- package/lib/components/ButtonDropdown/SimpleButtonDropdown.d.ts +148 -0
- package/lib/components/ButtonDropdown/index.d.ts +2 -0
- package/lib/components/ButtonTabs/ButtonTab/ButtonTab.d.ts +82 -0
- package/lib/components/ButtonTabs/ButtonTab/index.d.ts +1 -0
- package/lib/components/ButtonTabs/ButtonTabDropdown.d.ts +118 -0
- package/lib/components/ButtonTabs/ButtonTabs.d.ts +113 -0
- package/lib/components/ButtonTabs/index.d.ts +2 -0
- package/lib/components/Card/Card.d.ts +163 -0
- package/lib/components/Card/index.d.ts +1 -0
- package/lib/components/Charts/ChartTooltip/index.d.ts +10 -0
- package/lib/components/Charts/ChartWrapper/ChartWrapper.d.ts +184 -0
- package/lib/components/Charts/ChartWrapper/index.d.ts +1 -0
- package/lib/components/Charts/ColumnChart/ColumnChart.d.ts +111 -0
- package/lib/components/Charts/ColumnChart/index.d.ts +1 -0
- package/lib/components/Charts/DonutChart/DonutChart.d.ts +142 -0
- package/lib/components/Charts/DonutChart/index.d.ts +1 -0
- package/lib/components/Charts/FunnelChart/FunnelChart.d.ts +99 -0
- package/lib/components/Charts/FunnelChart/index.d.ts +1 -0
- package/lib/components/Charts/LineChart/LineChart.d.ts +97 -0
- package/lib/components/Charts/LineChart/index.d.ts +1 -0
- package/lib/components/Charts/SpiderChart/SpiderChart.d.ts +95 -0
- package/lib/components/Charts/SpiderChart/index.d.ts +1 -0
- package/lib/components/Charts/index.d.ts +7 -0
- package/lib/components/ChatBubble/ChatBubble.d.ts +203 -0
- package/lib/components/ChatBubble/index.d.ts +1 -0
- package/lib/components/Checkbox/Checkbox.d.ts +165 -0
- package/lib/components/Checkbox/CheckboxGroup.d.ts +113 -0
- package/lib/components/Checkbox/index.d.ts +2 -0
- package/lib/components/Chip/Chip.d.ts +181 -0
- package/lib/components/Chip/index.d.ts +2 -0
- package/lib/components/CircularLoader/CircularLoader.d.ts +56 -0
- package/lib/components/CircularLoader/index.d.ts +1 -0
- package/lib/components/CollapsibleCard/CollapsibleCard.d.ts +134 -0
- package/lib/components/CollapsibleCard/index.d.ts +1 -0
- package/lib/components/Combobox/Combobox.d.ts +292 -0
- package/lib/components/Combobox/helper.d.ts +205 -0
- package/lib/components/Combobox/index.d.ts +1 -0
- package/lib/components/ConditionalWrapper/ConditionalWrapper.d.ts +12 -0
- package/lib/components/ConditionalWrapper/index.d.ts +1 -0
- package/lib/components/DateRangePicker/Calendar.d.ts +119 -0
- package/lib/components/DateRangePicker/DateRangePicker.d.ts +196 -0
- package/lib/components/DateRangePicker/DateRangeWrapper.d.ts +311 -0
- package/lib/components/DateRangePicker/Day.d.ts +70 -0
- package/lib/components/DateRangePicker/index.d.ts +1 -0
- package/lib/components/Dialog/Dialog.d.ts +208 -0
- package/lib/components/Dialog/index.d.ts +1 -0
- package/lib/components/Disclaimer/Disclaimer.d.ts +32 -0
- package/lib/components/Disclaimer/index.d.ts +1 -0
- package/lib/components/Dropdown/Dropdown.d.ts +145 -0
- package/lib/components/Dropdown/SimpleDropdown.d.ts +142 -0
- package/lib/components/Dropdown/index.d.ts +2 -0
- package/lib/components/EmptyState/EmptyImages/CalendarEmptyImage.d.ts +108 -0
- package/lib/components/EmptyState/EmptyImages/ChartEmptyImage.d.ts +194 -0
- package/lib/components/EmptyState/EmptyImages/DataEmptyImage.d.ts +116 -0
- package/lib/components/EmptyState/EmptyImages/FileEmptyImage.d.ts +133 -0
- package/lib/components/EmptyState/EmptyImages/MessageEmptyImage.d.ts +64 -0
- package/lib/components/EmptyState/EmptyImages/UploadEmptyImage.d.ts +67 -0
- package/lib/components/EmptyState/EmptyImages/index.d.ts +6 -0
- package/lib/components/EmptyState/EmptyState.d.ts +82 -0
- package/lib/components/EmptyState/index.d.ts +1 -0
- package/lib/components/ErrorMessage/ErrorImages/ForbiddenImage.d.ts +85 -0
- package/lib/components/ErrorMessage/ErrorImages/NotFoundImage.d.ts +117 -0
- package/lib/components/ErrorMessage/ErrorImages/ServerErrorImage.d.ts +237 -0
- package/lib/components/ErrorMessage/ErrorImages/UnauthorizedImage.d.ts +73 -0
- package/lib/components/ErrorMessage/ErrorImages/index.d.ts +4 -0
- package/lib/components/ErrorMessage/ErrorMessage.d.ts +86 -0
- package/lib/components/ErrorMessage/index.d.ts +1 -0
- package/lib/components/FileUpload/FileBlock/FileBlock.d.ts +137 -0
- package/lib/components/FileUpload/FileBlock/index.d.ts +1 -0
- package/lib/components/FileUpload/FileUpload.d.ts +190 -0
- package/lib/components/FileUpload/index.d.ts +2 -0
- package/lib/components/FocusManager/FocusManager.d.ts +52 -0
- package/lib/components/FocusManager/index.d.ts +1 -0
- package/lib/components/FocusManagerWithArrowKeyNavigation/FocusManagerWithArrowKeyNavigation.d.ts +137 -0
- package/lib/components/FocusManagerWithArrowKeyNavigation/index.d.ts +1 -0
- package/lib/components/FormTitleWrapper/FormTitleWrapper.d.ts +62 -0
- package/lib/components/FormTitleWrapper/index.d.ts +1 -0
- package/lib/components/Grid/Grid.d.ts +104 -0
- package/lib/components/Grid/index.d.ts +1 -0
- package/lib/components/Icon/ClickableIcon.d.ts +101 -0
- package/lib/components/Icon/Icon.d.ts +71 -0
- package/lib/components/Icon/Icon.docs.d.ts +138 -0
- package/lib/components/Icon/SemanticIcon.d.ts +42 -0
- package/lib/components/Icon/index.d.ts +3 -0
- package/lib/components/InContextAlert/InContextAlert.d.ts +210 -0
- package/lib/components/InContextAlert/index.d.ts +1 -0
- package/lib/components/InlineDropdown/InlineDropdown.d.ts +146 -0
- package/lib/components/InlineDropdown/SimpleInlineDropdown.d.ts +145 -0
- package/lib/components/InlineDropdown/index.d.ts +2 -0
- package/lib/components/Input/Input.d.ts +327 -0
- package/lib/components/Input/index.d.ts +1 -0
- package/lib/components/KPIBox/KPIBox.d.ts +89 -0
- package/lib/components/KPIBox/index.d.ts +1 -0
- package/lib/components/LinearLoader/LinearLoader.d.ts +44 -0
- package/lib/components/LinearLoader/index.d.ts +1 -0
- package/lib/components/Link/Link.d.ts +225 -0
- package/lib/components/Link/index.d.ts +1 -0
- package/lib/components/Menu/Menu.d.ts +379 -0
- package/lib/components/Menu/MenuOptionButton.d.ts +199 -0
- package/lib/components/Menu/index.d.ts +2 -0
- package/lib/components/Modal/Modal.d.ts +354 -0
- package/lib/components/Modal/index.d.ts +14 -0
- package/lib/components/Notification/Notification.d.ts +147 -0
- package/lib/components/Notification/index.d.ts +1 -0
- package/lib/components/OptionButton/OptionButton.d.ts +150 -0
- package/lib/components/OptionButton/SimpleOptionButton.d.ts +150 -0
- package/lib/components/OptionButton/index.d.ts +2 -0
- package/lib/components/PageTitle/PageTitle.d.ts +256 -0
- package/lib/components/PageTitle/index.d.ts +1 -0
- package/lib/components/Pagination/Pagination.d.ts +144 -0
- package/lib/components/Pagination/PaginationItem.d.ts +136 -0
- package/lib/components/Pagination/index.d.ts +1 -0
- package/lib/components/Panel/Panel.d.ts +168 -0
- package/lib/components/Panel/index.d.ts +9 -0
- package/lib/components/ProgressDonut/ProgressDonut.d.ts +102 -0
- package/lib/components/ProgressDonut/index.d.ts +1 -0
- package/lib/components/PromptChip/PromptChip.d.ts +167 -0
- package/lib/components/PromptChip/index.d.ts +1 -0
- package/lib/components/PromptInput/PromptInput.d.ts +189 -0
- package/lib/components/PromptInput/index.d.ts +1 -0
- package/lib/components/RadioButton/RadioButton.d.ts +132 -0
- package/lib/components/RadioButton/RadioGroup.d.ts +88 -0
- package/lib/components/RadioButton/index.d.ts +2 -0
- package/lib/components/RadioTile/RadioTile.d.ts +109 -0
- package/lib/components/RadioTile/index.d.ts +1 -0
- package/lib/components/RangeSlider/RangeSlider.d.ts +207 -0
- package/lib/components/RangeSlider/index.d.ts +1 -0
- package/lib/components/Rating/Rating.d.ts +131 -0
- package/lib/components/Rating/index.d.ts +1 -0
- package/lib/components/ScoreBar/ScoreBar.d.ts +122 -0
- package/lib/components/ScoreBar/index.d.ts +1 -0
- package/lib/components/SearchInput/SearchInput.d.ts +79 -0
- package/lib/components/SearchInput/index.d.ts +2 -0
- package/lib/components/Separator/Separator.d.ts +51 -0
- package/lib/components/Separator/index.d.ts +1 -0
- package/lib/components/Shimmer/Shimmer.d.ts +131 -0
- package/lib/components/Shimmer/index.d.ts +1 -0
- package/lib/components/SideMenuLink/SideMenuLink.d.ts +336 -0
- package/lib/components/SideMenuLink/index.d.ts +1 -0
- package/lib/components/StatusIndicator/StatusIndicator.d.ts +60 -0
- package/lib/components/StatusIndicator/index.d.ts +1 -0
- package/lib/components/Stepper/Step/Step.d.ts +119 -0
- package/lib/components/Stepper/Step/StepContent.d.ts +35 -0
- package/lib/components/Stepper/Step/StepLabel.d.ts +35 -0
- package/lib/components/Stepper/Step/index.d.ts +3 -0
- package/lib/components/Stepper/Stepper.d.ts +60 -0
- package/lib/components/Stepper/index.d.ts +2 -0
- package/lib/components/StickyBar/StickyBar.d.ts +55 -0
- package/lib/components/StickyBar/index.d.ts +1 -0
- package/lib/components/SubMenu/SubMenu.d.ts +89 -0
- package/lib/components/SubMenu/SubMenuGroup.d.ts +156 -0
- package/lib/components/SubMenu/SubMenuItem.d.ts +161 -0
- package/lib/components/SubMenu/SubMenuLink.d.ts +81 -0
- package/lib/components/SubMenu/index.d.ts +4 -0
- package/lib/components/Table/Cell.d.ts +107 -0
- package/lib/components/Table/DefaultRow.d.ts +144 -0
- package/lib/components/Table/DefaultTableHeader.d.ts +236 -0
- package/lib/components/Table/StaticTable.d.ts +198 -0
- package/lib/components/Table/Table.d.ts +113 -0
- package/lib/components/Table/Table.docs.d.ts +532 -0
- package/lib/components/Table/TableActionBar.d.ts +48 -0
- package/lib/components/Table/TableBottomBar.d.ts +20 -0
- package/lib/components/Table/TableTopBar.d.ts +20 -0
- package/lib/components/Table/dummyTableData.d.ts +2189 -0
- package/lib/components/Table/hooks.d.ts +98 -0
- package/lib/components/Table/index.d.ts +8 -0
- package/lib/components/Tabs/Tab/Tab.d.ts +146 -0
- package/lib/components/Tabs/Tab/index.d.ts +1 -0
- package/lib/components/Tabs/TabList/TabDropdown.d.ts +100 -0
- package/lib/components/Tabs/TabList/TabList.d.ts +157 -0
- package/lib/components/Tabs/TabList/index.d.ts +1 -0
- package/lib/components/Tabs/index.d.ts +2 -0
- package/lib/components/Text/Text.d.ts +1021 -0
- package/lib/components/Text/index.d.ts +30 -0
- package/lib/components/TextTile/TextTile.d.ts +40 -0
- package/lib/components/TextTile/index.d.ts +1 -0
- package/lib/components/Textarea/Textarea.d.ts +132 -0
- package/lib/components/Textarea/index.d.ts +2 -0
- package/lib/components/Timeline/Timeline.d.ts +40 -0
- package/lib/components/Timeline/TimelineItem/TimelineItem.d.ts +121 -0
- package/lib/components/Timeline/TimelineItem/index.d.ts +1 -0
- package/lib/components/Timeline/index.d.ts +2 -0
- package/lib/components/Toast/Toast.d.ts +248 -0
- package/lib/components/Toast/ToastContainer.d.ts +140 -0
- package/lib/components/Toast/ToastManager.d.ts +58 -0
- package/lib/components/Toast/index.d.ts +10 -0
- package/lib/components/Toggle/Toggle.d.ts +111 -0
- package/lib/components/Toggle/index.d.ts +1 -0
- package/lib/components/TokenListInput/TokenListInput.d.ts +333 -0
- package/lib/components/TokenListInput/TokenValueChips.d.ts +64 -0
- package/lib/components/TokenListInput/index.d.ts +1 -0
- package/lib/components/Tooltip/Tooltip.d.ts +186 -0
- package/lib/components/Tooltip/index.d.ts +1 -0
- package/lib/components/Truncate/Truncate.d.ts +87 -0
- package/lib/components/Truncate/index.d.ts +2 -0
- package/lib/components/TruncatedTextWithTooltip/TruncatedTextWithTooltip.d.ts +95 -0
- package/lib/components/TruncatedTextWithTooltip/index.d.ts +1 -0
- package/lib/components/Typeahead/SimpleTypeahead.d.ts +141 -0
- package/lib/components/Typeahead/Typeahead.d.ts +217 -0
- package/lib/components/Typeahead/index.d.ts +2 -0
- package/lib/components/WeekdayPicker/WeekdayPicker.d.ts +242 -0
- package/lib/components/WeekdayPicker/index.d.ts +1 -0
- package/lib/components/index.d.ts +71 -0
- package/lib/hooks/index.d.ts +12 -0
- package/lib/hooks/useArbitraryOptionAddition/index.d.ts +1 -0
- package/lib/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.d.ts +124 -0
- package/lib/hooks/useCopyToClipboard/index.d.ts +1 -0
- package/lib/hooks/useCopyToClipboard/useCopyToClipboard.d.ts +27 -0
- package/lib/hooks/useFileUpload/index.d.ts +1 -0
- package/lib/hooks/useFileUpload/useFileUpload.d.ts +342 -0
- package/lib/hooks/useFilteredOptions/index.d.ts +1 -0
- package/lib/hooks/useFilteredOptions/useFilteredOptions.d.ts +87 -0
- package/lib/hooks/useInputState/index.d.ts +1 -0
- package/lib/hooks/useInputState/useInputState.d.ts +22 -0
- package/lib/hooks/useLockedBody/index.d.ts +1 -0
- package/lib/hooks/useLockedBody/useLockedBody.d.ts +46 -0
- package/lib/hooks/useModal/index.d.ts +1 -0
- package/lib/hooks/useModal/useModal.d.ts +32 -0
- package/lib/hooks/useMountTransition/index.d.ts +24 -0
- package/lib/hooks/usePagination/index.d.ts +1 -0
- package/lib/hooks/usePagination/usePagination.d.ts +140 -0
- package/lib/hooks/useToastPortal/index.d.ts +1 -0
- package/lib/hooks/useToastPortal/useToastPortal.d.ts +31 -0
- package/lib/hooks/useToggle/index.d.ts +1 -0
- package/lib/hooks/useToggle/useToggle.d.ts +11 -0
- package/lib/hooks/useWindowSize/index.d.ts +1 -0
- package/lib/hooks/useWindowSize/useWindowSize.d.ts +28 -0
- package/lib/index.d.ts +5 -0
- package/lib/styles/index.d.ts +267 -0
- package/lib/styles/variables/_border.d.ts +12 -0
- package/lib/styles/variables/_color.d.ts +104 -0
- package/lib/styles/variables/_elevation.d.ts +7 -0
- package/lib/styles/variables/_font.d.ts +30 -0
- package/lib/styles/variables/_motion.d.ts +6 -0
- package/lib/styles/variables/_opacity.d.ts +15 -0
- package/lib/styles/variables/_shadow.d.ts +24 -0
- package/lib/styles/variables/_size.d.ts +57 -0
- package/lib/styles/variables/_space.d.ts +12 -0
- package/lib/types/charts.d.ts +225 -0
- package/lib/types/common.d.ts +10 -0
- package/lib/types/date-range-picker.d.ts +17 -0
- package/lib/types/date-range-picker.js.flow +2 -3
- package/lib/types/index.d.ts +6 -0
- package/lib/types/menu.d.ts +13 -0
- package/lib/types/toast.d.ts +32 -0
- package/lib/types/typography.d.ts +17 -0
- package/lib/utils/array/are-arrays-equal.d.ts +11 -0
- package/lib/utils/array/index.d.ts +1 -0
- package/lib/utils/charts/charts.d.ts +102 -0
- package/lib/utils/charts/columnChart.d.ts +51 -0
- package/lib/utils/charts/donutChart.d.ts +116 -0
- package/lib/utils/charts/funnelChart.d.ts +94 -0
- package/lib/utils/charts/helpers.d.ts +44 -0
- package/lib/utils/charts/index.d.ts +7 -0
- package/lib/utils/charts/lineChart.d.ts +44 -0
- package/lib/utils/charts/spiderChart.d.ts +46 -0
- package/lib/utils/charts/typography.d.ts +42 -0
- package/lib/utils/classify/index.d.ts +27 -0
- package/lib/utils/click-away/click-away.d.ts +194 -0
- package/lib/utils/click-away/index.d.ts +1 -0
- package/lib/utils/date-range-picker/date-range-picker.d.ts +391 -0
- package/lib/utils/date-range-picker/index.d.ts +2 -0
- package/lib/utils/date-range-picker/timezones.d.ts +262 -0
- package/lib/utils/dom/dom.d.ts +245 -0
- package/lib/utils/dom/index.d.ts +1 -0
- package/lib/utils/helpers/helpers.d.ts +48 -0
- package/lib/utils/helpers/index.d.ts +1 -0
- package/lib/utils/index.d.ts +14 -0
- package/lib/utils/makeClassNameComponent/index.d.ts +1 -0
- package/lib/utils/makeClassNameComponent/makeClassNameComponent.d.ts +73 -0
- package/lib/utils/menu/index.d.ts +1 -0
- package/lib/utils/merge-refs/index.d.ts +1 -0
- package/lib/utils/merge-refs/merge-refs.d.ts +15 -0
- package/lib/utils/rating/index.d.ts +1 -0
- package/lib/utils/rating/rating.d.ts +31 -0
- package/lib/utils/score-bar/index.d.ts +1 -0
- package/lib/utils/score-bar/score-bar.d.ts +54 -0
- package/lib/utils/string/index.d.ts +1 -0
- package/lib/utils/string/string.d.ts +30 -0
- package/lib/utils/token-list-input/token-list-input.d.ts +32 -0
- package/lib/utils/tokens/index.d.ts +1 -0
- package/lib/utils/tokens/tokens.d.ts +230 -0
- package/package.json +5 -5
package/.cspell/custom-words.txt
CHANGED
|
@@ -46,14 +46,17 @@ flowtype
|
|
|
46
46
|
fontawesome
|
|
47
47
|
framename
|
|
48
48
|
Gaurav
|
|
49
|
+
gulpfile
|
|
49
50
|
Heatmaps
|
|
50
51
|
highcharts
|
|
51
52
|
Hovd
|
|
52
53
|
innerref
|
|
53
54
|
interdimensional
|
|
54
55
|
Jangid
|
|
56
|
+
jscodeshift
|
|
55
57
|
Kamchatskiy
|
|
56
58
|
Kemshetty
|
|
59
|
+
khanacademy
|
|
57
60
|
Kiritimati
|
|
58
61
|
Kosrae
|
|
59
62
|
Kuala
|
|
@@ -100,6 +103,7 @@ senseai
|
|
|
100
103
|
sharad
|
|
101
104
|
Stapleton
|
|
102
105
|
storysource
|
|
106
|
+
subproject
|
|
103
107
|
superrover
|
|
104
108
|
Swatantramishra
|
|
105
109
|
Syowa
|
|
@@ -37,16 +37,44 @@ jobs:
|
|
|
37
37
|
token: ${{ secrets.NPM_PUBLISH_USER_ACCESS_TOKEN }}
|
|
38
38
|
fetch-depth: '0'
|
|
39
39
|
|
|
40
|
-
# Setup Node
|
|
41
|
-
- name: Setup Node.js
|
|
40
|
+
# Note(Nishant): Possible cleanup required Setup Node 18 for the base npm package
|
|
41
|
+
- name: Setup Node.js @18
|
|
42
42
|
uses: actions/setup-node@v4
|
|
43
43
|
with:
|
|
44
44
|
registry-url: https://registry.npmjs.org/
|
|
45
45
|
node-version: '18.20.5'
|
|
46
46
|
|
|
47
|
-
#
|
|
47
|
+
# Note(Nishant): Possible cleanup required Setup Node 20 for the dts-generator
|
|
48
|
+
# We already pin the node versions with volta so this should be fine(but not ideal)
|
|
49
|
+
- name: Setup Node.js @20
|
|
50
|
+
uses: actions/setup-node@v4
|
|
51
|
+
with:
|
|
52
|
+
registry-url: https://registry.npmjs.org/
|
|
53
|
+
node-version: '20.9.0'
|
|
54
|
+
|
|
55
|
+
# -------------------------------------------------------------------------------------
|
|
56
|
+
# Note(Nishant): Install isolated dependencies for app and the DTS generator tool
|
|
57
|
+
# -------------------------------------------------------------------------------------
|
|
58
|
+
# Our project uses `flow-to-ts` to convert `.js.flow` files into `.d.ts` files.
|
|
59
|
+
# This is handled in a dedicated subproject located at `dts-generator/`,
|
|
60
|
+
# which contains its own `package.json` with pinned versions of `flow-to-ts`,
|
|
61
|
+
# `jscodeshift`, and `glob`.
|
|
62
|
+
#
|
|
63
|
+
# We keep it isolated to:
|
|
64
|
+
# - Avoid dependency conflicts with the main project (e.g. Babel, Yarn PnP)
|
|
65
|
+
# - Maintain cleaner separation of concerns (build vs type generation)
|
|
66
|
+
# - Simplify upgrades or testing for Flow → TS conversions
|
|
67
|
+
#
|
|
68
|
+
# The `yarn --cwd` command ensures that only the dependencies inside
|
|
69
|
+
# `dts-generator` are installed, and is necessary before invoking
|
|
70
|
+
# `yarn build`, as our `gulpfile.js` calls this tool via `spawnSync`.
|
|
71
|
+
#
|
|
72
|
+
# DO NOT remove this step — skipping it will break `.d.ts` generation in CI.
|
|
73
|
+
# -------------------------------------------------------------------------------------
|
|
48
74
|
- name: Install dependencies
|
|
49
|
-
run:
|
|
75
|
+
run: |
|
|
76
|
+
yarn install
|
|
77
|
+
yarn --cwd dts-generator install
|
|
50
78
|
|
|
51
79
|
# ToDo(Nishant): Activate this once we have chromatic tests ready.
|
|
52
80
|
#- name: Run tests
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.3.39-beta.0](https://github.com/spaced-out/ui-design-system/compare/v0.3.38...v0.3.39-beta.0) (2025-05-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* 🌈 add dts-generator tooling to support .d.ts generation from .js.flow files ([#334](https://github.com/spaced-out/ui-design-system/issues/334)) ([4580f22](https://github.com/spaced-out/ui-design-system/commit/4580f228a69b094d46078170138f621408393a03))
|
|
11
|
+
* react 19 upgrade ([#340](https://github.com/spaced-out/ui-design-system/issues/340)) ([e90f3a4](https://github.com/spaced-out/ui-design-system/commit/e90f3a4b417cf37c531f912f309fa4e989160ba7))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* multiple node versions ([#343](https://github.com/spaced-out/ui-design-system/issues/343)) ([f8f08e4](https://github.com/spaced-out/ui-design-system/commit/f8f08e46acadb5d892bd032250c0a58518d495a2))
|
|
17
|
+
* yarn pack manager version ([#342](https://github.com/spaced-out/ui-design-system/issues/342)) ([64021f0](https://github.com/spaced-out/ui-design-system/commit/64021f044c678581bc5ad872a1f7593b966a811a))
|
|
18
|
+
|
|
5
19
|
### [0.3.38](https://github.com/spaced-out/ui-design-system/compare/v0.3.38-beta.0...v0.3.38) (2025-05-09)
|
|
6
20
|
|
|
7
21
|
### [0.3.38-beta.0](https://github.com/spaced-out/ui-design-system/compare/v0.3.37...v0.3.38-beta.0) (2025-05-09)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# DTS Generator
|
|
2
|
+
|
|
3
|
+
This folder contains a standalone utility to generate TypeScript declaration (`.d.ts`) files from existing `.js.flow` files using [`flow-to-ts`](https://github.com/MarcoPolo/flowToTs). These typings are essential for supporting downstream TypeScript consumers of the Genesis component library.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Why this exists
|
|
8
|
+
|
|
9
|
+
Although Genesis is written in Flow, the JavaScript ecosystem (including editors like VSCode, tsserver, and downstream NPM consumers) expects `.d.ts` files for rich type support. This tool bridges that gap by converting `.js.flow` files into `.d.ts` files that TypeScript understands — without requiring a full migration to TypeScript.
|
|
10
|
+
|
|
11
|
+
This is **not a Flow-to-TypeScript migration**. It's a compatibility layer that allows us to continue using Flow internally while supporting TS externally.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What it does
|
|
16
|
+
|
|
17
|
+
- Scans `lib/` for `.js.flow` files
|
|
18
|
+
- Uses `flow-to-ts` to convert each file into a `.d.ts` equivalent
|
|
19
|
+
- Writes the `.d.ts` files alongside the original files
|
|
20
|
+
- Formats the output with Prettier
|
|
21
|
+
|
|
22
|
+
This process runs automatically as part of the `yarn build` step (via Gulp), ensuring typings are up-to-date with every release.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
Install dependencies:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
yarn --cwd dts-generator install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Run the generator:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
yarn --cwd dts-generator generate
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This will generate and format all `.d.ts` files for the project based on the current contents of `lib/`.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Included in Release
|
|
45
|
+
|
|
46
|
+
The `.d.ts` files generated here are published as part of our NPM release and are used by any project consuming Genesis with TypeScript.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Tech Stack
|
|
51
|
+
|
|
52
|
+
- [`flow-to-ts`](https://github.com/khan/flow-to-ts)
|
|
53
|
+
- [`jscodeshift`](https://github.com/facebook/jscodeshift)
|
|
54
|
+
- [`glob`](https://www.npmjs.com/package/glob)
|
|
55
|
+
- [`prettier`](https://prettier.io)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Related Context
|
|
60
|
+
|
|
61
|
+
This setup is a foundational step toward the long-term vision of migrating all frontend codebases (`ui_server`, `ui_design_system`, `ui_chatbot`) to TypeScript at Sense.
|
|
62
|
+
|
|
63
|
+
---
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note(Nishant): This script is part of our long-term migration and type safety strategy.
|
|
3
|
+
*
|
|
4
|
+
* Context:
|
|
5
|
+
* Our codebase has historically used Flow for type checking. Flow offers strong static typing,
|
|
6
|
+
* but has limited ecosystem support compared to TypeScript. Since the TypeScript ecosystem
|
|
7
|
+
* (including editors like VSCode, IDE integrations, and npm consumers) natively expects `.d.ts`
|
|
8
|
+
* files for type definitions, we need to bridge that gap.
|
|
9
|
+
*
|
|
10
|
+
* Purpose of this script:
|
|
11
|
+
* 1. It converts `.js.flow` files (Flow declaration files) in our `lib/` directory to
|
|
12
|
+
* corresponding `.d.ts` files using `flow-to-ts`.
|
|
13
|
+
* 2. The output `.d.ts` files provide equivalent type declarations in TypeScript syntax.
|
|
14
|
+
* 3. We format these generated files using `prettier` to ensure consistent and readable output.
|
|
15
|
+
*
|
|
16
|
+
* Why `.d.ts` files matter:
|
|
17
|
+
* - TypeScript consumers of our NPM package (like internal projects or external partners)
|
|
18
|
+
* rely on `.d.ts` files to get autocompletion, compile-time checking, and rich IDE support.
|
|
19
|
+
* - They serve as the public API contract of our component library.
|
|
20
|
+
* - Without `.d.ts` files, consumers would have to fall back to `any` or custom typings,
|
|
21
|
+
* defeating the purpose of having a typed library.
|
|
22
|
+
*
|
|
23
|
+
* Why not just migrate to TS directly?
|
|
24
|
+
* - A full migration to TS is non-trivial and requires coordination across all teams.
|
|
25
|
+
* - In the interim, this approach gives us compatibility with the TypeScript ecosystem
|
|
26
|
+
* without dropping Flow support.
|
|
27
|
+
*
|
|
28
|
+
* How it works:
|
|
29
|
+
* - We locate all `.js.flow` files under `lib/`
|
|
30
|
+
* - Each file is passed through `flow-to-ts` with `-o d.ts` to get a `.d.ts` representation.
|
|
31
|
+
* - We write the output next to the original file.
|
|
32
|
+
* - The result is then formatted using Prettier.
|
|
33
|
+
*
|
|
34
|
+
* This script is invoked as part of the build pipeline, and must run **after** the Gulp build step.
|
|
35
|
+
* Do not remove or bypass this logic — breaking `.d.ts` generation will break downstream consumers.
|
|
36
|
+
*
|
|
37
|
+
* Future:
|
|
38
|
+
* - Once we fully migrate to TypeScript, this step can be replaced by native `.d.ts` generation
|
|
39
|
+
* via `tsc` or Babel.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
const fs = require('fs');
|
|
43
|
+
const path = require('path');
|
|
44
|
+
const glob = require('glob');
|
|
45
|
+
const {spawnSync} = require('child_process');
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const files = glob.sync(path.resolve(__dirname, '../lib/**/*.js.flow'));
|
|
49
|
+
|
|
50
|
+
files.forEach((file) => {
|
|
51
|
+
const outPath = file.replace(/\.js\.flow$/, '.d.ts');
|
|
52
|
+
const flowToTs = path.resolve(__dirname, './node_modules/.bin/flow-to-ts');
|
|
53
|
+
// Note(Nishant) For some reason if i try to install prettier locally it fails for few components. Not
|
|
54
|
+
// spending too much time on it because the idea here is to move to ts eventually
|
|
55
|
+
const prettier = path.resolve(__dirname, '../node_modules/.bin/prettier');
|
|
56
|
+
|
|
57
|
+
const result = spawnSync(flowToTs, ['-o', 'd.ts', file], {
|
|
58
|
+
encoding: 'utf-8',
|
|
59
|
+
// Note(Nishant): Tells Node.js to run the command inside a shell, like bash or sh.
|
|
60
|
+
// essential for calling binaries via relative paths (e.g., from node_modules/.bin/)
|
|
61
|
+
shell: true,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const stdout = result.stdout?.trim();
|
|
65
|
+
const stderr = result.stderr?.trim();
|
|
66
|
+
|
|
67
|
+
if (result.error) {
|
|
68
|
+
console.error(`Spawn error converting ${file}:`, result.error.message);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (stderr) {
|
|
73
|
+
console.error(`stderr converting ${file}:\n${stderr}`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (result.status !== 0) {
|
|
78
|
+
console.error(`Non-zero exit code for ${file}`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (stdout && !stdout.includes('Processing') && !stdout.includes('Results')) {
|
|
83
|
+
fs.writeFileSync(outPath, stdout);
|
|
84
|
+
// eslint-disable-next-line no-console
|
|
85
|
+
console.log(`✅ Converted: ${file} → ${outPath}`);
|
|
86
|
+
|
|
87
|
+
// Format with Prettier
|
|
88
|
+
const fmt = spawnSync(prettier, ['--write', outPath], {
|
|
89
|
+
encoding: 'utf-8',
|
|
90
|
+
shell: true,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (fmt.status !== 0) {
|
|
94
|
+
console.error(`Prettier formatting failed for ${outPath}`);
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
console.warn(
|
|
98
|
+
`No meaningful output for ${file}. It may be empty or skipped.`,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dts-generator",
|
|
3
|
+
"private": true,
|
|
4
|
+
"scripts": {
|
|
5
|
+
"generate": "node convert.js"
|
|
6
|
+
},
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@khanacademy/flow-to-ts": "^0.5.2",
|
|
9
|
+
"glob": "^11.0.1",
|
|
10
|
+
"jscodeshift": "^17.3.0"
|
|
11
|
+
},
|
|
12
|
+
"volta": {
|
|
13
|
+
"node": "20.9.0",
|
|
14
|
+
"yarn": "1.22.19"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/gulpfile.js
CHANGED
|
@@ -2,6 +2,8 @@ const gulp = require('gulp');
|
|
|
2
2
|
const babel = require('gulp-babel');
|
|
3
3
|
const rename = require('gulp-rename');
|
|
4
4
|
const replace = require('gulp-replace');
|
|
5
|
+
const {spawnSync} = require('child_process');
|
|
6
|
+
const path = require('path');
|
|
5
7
|
|
|
6
8
|
const babelRc = require('./babel.config');
|
|
7
9
|
|
|
@@ -46,4 +48,21 @@ function copyOther() {
|
|
|
46
48
|
.pipe(gulp.dest('lib'));
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
function generateDts(done) {
|
|
52
|
+
const result = spawnSync('yarn', ['generate'], {
|
|
53
|
+
stdio: 'inherit',
|
|
54
|
+
cwd: path.resolve(__dirname, 'dts-generator'),
|
|
55
|
+
shell: true,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (result.status !== 0) {
|
|
59
|
+
return done(new Error('Failed to generate .d.ts files'));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
done();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const coreBuild = gulp.parallel(buildCjs, copyFlow, copyOther);
|
|
66
|
+
const fullBuild = gulp.series(coreBuild, generateDts);
|
|
67
|
+
|
|
68
|
+
module.exports.build = fullBuild;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import {$ReadOnly, $Values, $Keys} from 'utility-types';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
JumboSmall,
|
|
5
|
+
SubTitleLarge,
|
|
6
|
+
SubTitleMedium,
|
|
7
|
+
SubTitleSmall,
|
|
8
|
+
} from '../../components/Text';
|
|
9
|
+
import * as COLORS from '../../styles/variables/_color';
|
|
10
|
+
import {
|
|
11
|
+
colorDangerLightest,
|
|
12
|
+
colorGrayLightest,
|
|
13
|
+
colorInformationLightest,
|
|
14
|
+
colorNeutralLightest,
|
|
15
|
+
colorSuccessLightest,
|
|
16
|
+
colorWarningLightest,
|
|
17
|
+
} from '../../styles/variables/_color';
|
|
18
|
+
import classify from '../../utils/classify';
|
|
19
|
+
import type {IconType} from '../Icon';
|
|
20
|
+
import {Icon} from '../Icon';
|
|
21
|
+
import type {StatusSemanticType} from '../StatusIndicator';
|
|
22
|
+
import {StatusIndicator} from '../StatusIndicator';
|
|
23
|
+
import css from './Avatar.module.css';
|
|
24
|
+
type ClassNames = $ReadOnly<{
|
|
25
|
+
wrapper?: string;
|
|
26
|
+
ring?: string;
|
|
27
|
+
content?: string;
|
|
28
|
+
image?: string;
|
|
29
|
+
icon?: string;
|
|
30
|
+
text?: string;
|
|
31
|
+
}>;
|
|
32
|
+
export const AVATAR_SIZE = Object.freeze({
|
|
33
|
+
small: 'small',
|
|
34
|
+
medium: 'medium',
|
|
35
|
+
large: 'large',
|
|
36
|
+
extraLarge: 'extraLarge',
|
|
37
|
+
});
|
|
38
|
+
export const avatarSizeOptions: Array<unknown> = [...Object.keys(AVATAR_SIZE)];
|
|
39
|
+
export type AvatarSize = $Values<typeof AVATAR_SIZE>;
|
|
40
|
+
export const AVATAR_COLOR = Object.freeze({
|
|
41
|
+
red: colorDangerLightest,
|
|
42
|
+
orange: colorWarningLightest,
|
|
43
|
+
green: colorSuccessLightest,
|
|
44
|
+
blue: colorInformationLightest,
|
|
45
|
+
gray: colorGrayLightest,
|
|
46
|
+
indigo: colorNeutralLightest,
|
|
47
|
+
});
|
|
48
|
+
export type AvatarColorType = $Keys<typeof AVATAR_COLOR>;
|
|
49
|
+
export type AvatarProps = {
|
|
50
|
+
classNames?: ClassNames;
|
|
51
|
+
size?: AvatarSize;
|
|
52
|
+
imageSrc?: string;
|
|
53
|
+
ring?: boolean;
|
|
54
|
+
icon?: boolean;
|
|
55
|
+
text?: string;
|
|
56
|
+
color?: AvatarColorType;
|
|
57
|
+
style?: unknown;
|
|
58
|
+
iconName?: string;
|
|
59
|
+
iconType?: IconType;
|
|
60
|
+
ring?: boolean;
|
|
61
|
+
status?: StatusSemanticType;
|
|
62
|
+
statusBorderColorToken?: $Keys<typeof COLORS>;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const getAvatarText = (text = '') => {
|
|
66
|
+
const [firstWord, secondWord] = text.split(' ');
|
|
67
|
+
const firstChar = firstWord ? firstWord[0].toUpperCase() : '';
|
|
68
|
+
const secondChar = secondWord ? secondWord[0].toUpperCase() : '';
|
|
69
|
+
return firstChar + secondChar;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const AvatarTextDecorator = ({
|
|
73
|
+
avatarText,
|
|
74
|
+
size,
|
|
75
|
+
className,
|
|
76
|
+
}: {
|
|
77
|
+
avatarText: string;
|
|
78
|
+
size: AvatarSize;
|
|
79
|
+
className?: string;
|
|
80
|
+
}) => {
|
|
81
|
+
switch (size) {
|
|
82
|
+
case 'small':
|
|
83
|
+
return <SubTitleSmall className={className}>{avatarText}</SubTitleSmall>;
|
|
84
|
+
|
|
85
|
+
case 'medium':
|
|
86
|
+
return (
|
|
87
|
+
<SubTitleMedium className={className}>{avatarText}</SubTitleMedium>
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
case 'large':
|
|
91
|
+
return <SubTitleLarge className={className}>{avatarText}</SubTitleLarge>;
|
|
92
|
+
|
|
93
|
+
case 'extraLarge':
|
|
94
|
+
return <JumboSmall className={className}>{avatarText}</JumboSmall>;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// mapping of iconSize for each avatar size;
|
|
99
|
+
const iconSize = Object.freeze({
|
|
100
|
+
small: 'small',
|
|
101
|
+
medium: 'medium',
|
|
102
|
+
large: 'medium',
|
|
103
|
+
extraLarge: 'large',
|
|
104
|
+
});
|
|
105
|
+
export type AvatarContentProps = {
|
|
106
|
+
imageSrc?: string;
|
|
107
|
+
text?: string;
|
|
108
|
+
iconName?: string;
|
|
109
|
+
iconType?: IconType;
|
|
110
|
+
size: AvatarSize;
|
|
111
|
+
color?: AvatarColorType;
|
|
112
|
+
ring?: boolean;
|
|
113
|
+
status?: StatusSemanticType;
|
|
114
|
+
statusBorderColorToken?: $Keys<typeof COLORS>;
|
|
115
|
+
classNames?: ClassNames;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const AvatarConditionalContent = ({
|
|
119
|
+
imageSrc,
|
|
120
|
+
text,
|
|
121
|
+
iconName,
|
|
122
|
+
size,
|
|
123
|
+
iconType,
|
|
124
|
+
color = 'blue',
|
|
125
|
+
status,
|
|
126
|
+
statusBorderColorToken,
|
|
127
|
+
classNames,
|
|
128
|
+
}: AvatarContentProps) => (
|
|
129
|
+
<div
|
|
130
|
+
className={classify(
|
|
131
|
+
css.innerContainer,
|
|
132
|
+
{
|
|
133
|
+
[css.alignCenter]: !imageSrc,
|
|
134
|
+
},
|
|
135
|
+
classNames?.content,
|
|
136
|
+
)}
|
|
137
|
+
style={{
|
|
138
|
+
'--background-color': AVATAR_COLOR[color],
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
{!!status && (
|
|
142
|
+
<div className={classify(css.statusIndicatorWrapper, css[size])}>
|
|
143
|
+
<StatusIndicator
|
|
144
|
+
status={status}
|
|
145
|
+
withBorder
|
|
146
|
+
borderColorToken={statusBorderColorToken}
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
150
|
+
|
|
151
|
+
{imageSrc ? (
|
|
152
|
+
<img
|
|
153
|
+
src={imageSrc}
|
|
154
|
+
alt="Avatar"
|
|
155
|
+
className={classify(css.avatar, classNames?.image)}
|
|
156
|
+
></img>
|
|
157
|
+
) : iconName ? (
|
|
158
|
+
<Icon
|
|
159
|
+
name={iconName}
|
|
160
|
+
type={iconType}
|
|
161
|
+
size={iconSize[size]}
|
|
162
|
+
className={classNames?.icon}
|
|
163
|
+
/>
|
|
164
|
+
) : text ? (
|
|
165
|
+
<AvatarTextDecorator
|
|
166
|
+
avatarText={getAvatarText(text)}
|
|
167
|
+
size={size}
|
|
168
|
+
className={classNames?.text}
|
|
169
|
+
/>
|
|
170
|
+
) : null}
|
|
171
|
+
</div>
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
export const Avatar: React$AbstractComponent<AvatarProps, HTMLDivElement> =
|
|
175
|
+
React.forwardRef<AvatarProps, HTMLDivElement>(
|
|
176
|
+
(
|
|
177
|
+
{
|
|
178
|
+
classNames,
|
|
179
|
+
size = AVATAR_SIZE.medium,
|
|
180
|
+
imageSrc,
|
|
181
|
+
text,
|
|
182
|
+
style,
|
|
183
|
+
iconName,
|
|
184
|
+
iconType,
|
|
185
|
+
color,
|
|
186
|
+
ring = false,
|
|
187
|
+
status,
|
|
188
|
+
statusBorderColorToken,
|
|
189
|
+
}: AvatarProps,
|
|
190
|
+
ref,
|
|
191
|
+
) => (
|
|
192
|
+
<div
|
|
193
|
+
className={classify(
|
|
194
|
+
css.container,
|
|
195
|
+
{
|
|
196
|
+
[css.extraLargeSize]: size === 'extraLarge',
|
|
197
|
+
[css.largeSize]: size === 'large',
|
|
198
|
+
[css.mediumSize]: size === 'medium',
|
|
199
|
+
[css.smallSize]: size === 'small',
|
|
200
|
+
},
|
|
201
|
+
classNames?.wrapper,
|
|
202
|
+
)}
|
|
203
|
+
style={style}
|
|
204
|
+
ref={ref}
|
|
205
|
+
>
|
|
206
|
+
{ring ? (
|
|
207
|
+
<div className={classify(css.ring, classNames?.ring)}>
|
|
208
|
+
<div className={css.whiteCircle}>
|
|
209
|
+
<AvatarConditionalContent
|
|
210
|
+
imageSrc={imageSrc}
|
|
211
|
+
text={text}
|
|
212
|
+
iconName={iconName}
|
|
213
|
+
iconType={iconType}
|
|
214
|
+
color={color}
|
|
215
|
+
size={size}
|
|
216
|
+
status={status}
|
|
217
|
+
statusBorderColorToken={statusBorderColorToken}
|
|
218
|
+
classNames={classNames}
|
|
219
|
+
/>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
) : (
|
|
223
|
+
<AvatarConditionalContent
|
|
224
|
+
imageSrc={imageSrc}
|
|
225
|
+
text={text}
|
|
226
|
+
iconName={iconName}
|
|
227
|
+
iconType={iconType}
|
|
228
|
+
color={color}
|
|
229
|
+
size={size}
|
|
230
|
+
status={status}
|
|
231
|
+
statusBorderColorToken={statusBorderColorToken}
|
|
232
|
+
classNames={classNames}
|
|
233
|
+
/>
|
|
234
|
+
)}
|
|
235
|
+
</div>
|
|
236
|
+
),
|
|
237
|
+
);
|
|
238
|
+
export const BaseAvatar = ({
|
|
239
|
+
classNames,
|
|
240
|
+
size = AVATAR_SIZE.medium,
|
|
241
|
+
text = '',
|
|
242
|
+
style,
|
|
243
|
+
color = 'blue',
|
|
244
|
+
}: AvatarProps): React.ReactNode => (
|
|
245
|
+
<div
|
|
246
|
+
className={classify(
|
|
247
|
+
css.container,
|
|
248
|
+
{
|
|
249
|
+
[css.baseExtraLargeSize]: size === 'extraLarge',
|
|
250
|
+
[css.baseLargeSize]: size === 'large',
|
|
251
|
+
[css.baseMediumSize]: size === 'medium',
|
|
252
|
+
[css.baseSmallSize]: size === 'small',
|
|
253
|
+
},
|
|
254
|
+
classNames?.wrapper,
|
|
255
|
+
)}
|
|
256
|
+
style={{...style, background: AVATAR_COLOR[color]}}
|
|
257
|
+
>
|
|
258
|
+
<AvatarTextDecorator
|
|
259
|
+
avatarText={text}
|
|
260
|
+
size={size}
|
|
261
|
+
className={classNames?.text}
|
|
262
|
+
/>
|
|
263
|
+
</div>
|
|
264
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Avatar';
|