@nlabs/gothamui 1.8.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/LICENSE +21 -0
- package/MIGRATION.md +36 -0
- package/README.md +768 -0
- package/docs/assets/gothamui-app-architecture.svg +159 -0
- package/docs/assets/gothamui-logo.png +0 -0
- package/docs/assets/gothamui-logo.svg +42 -0
- package/docs/render-performance.md +34 -0
- package/lib/actions/GothamActions.d.ts +42 -0
- package/lib/actions/GothamActions.js +67 -0
- package/lib/actions/MarkdownActions.d.ts +4 -0
- package/lib/actions/MarkdownActions.js +48 -0
- package/lib/app.d.ts +1 -0
- package/lib/app.js +198 -0
- package/lib/components/Alert/Alert.d.ts +8 -0
- package/lib/components/Alert/Alert.js +24 -0
- package/lib/components/Alert/Alert.stories.js +59 -0
- package/lib/components/AuthRoute/AuthRoute.d.ts +3 -0
- package/lib/components/AuthRoute/AuthRoute.js +21 -0
- package/lib/components/AuthRoute/AuthRoute.stories.js +45 -0
- package/lib/components/AutocompleteField/AutocompleteField.d.ts +24 -0
- package/lib/components/AutocompleteField/AutocompleteField.js +148 -0
- package/lib/components/AutocompleteField/AutocompleteField.stories.js +62 -0
- package/lib/components/Avatar/Avatar.d.ts +29 -0
- package/lib/components/Avatar/Avatar.js +154 -0
- package/lib/components/Avatar/Avatar.stories.js +105 -0
- package/lib/components/Badge/Badge.d.ts +9 -0
- package/lib/components/Badge/Badge.js +22 -0
- package/lib/components/Badge/Badge.stories.js +53 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +19 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.js +74 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.stories.js +95 -0
- package/lib/components/Button/Button.d.ts +25 -0
- package/lib/components/Button/Button.js +157 -0
- package/lib/components/Button/Button.stories.js +119 -0
- package/lib/components/Card/Card.d.ts +8 -0
- package/lib/components/Card/Card.js +39 -0
- package/lib/components/Card/Card.stories.js +60 -0
- package/lib/components/CategoryGrid/CategoryGrid.d.ts +15 -0
- package/lib/components/CategoryGrid/CategoryGrid.js +42 -0
- package/lib/components/CategoryGrid/CategoryGrid.stories.js +35 -0
- package/lib/components/Chat/AudioMessage/AudioMessage.css +1 -0
- package/lib/components/Chat/AudioMessage/AudioMessage.d.ts +3 -0
- package/lib/components/Chat/AudioMessage/AudioMessage.js +28 -0
- package/lib/components/Chat/Avatar/Avatar.css +1 -0
- package/lib/components/Chat/Avatar/Avatar.d.ts +3 -0
- package/lib/components/Chat/Avatar/Avatar.js +72 -0
- package/lib/components/Chat/Button/Button.css +1 -0
- package/lib/components/Chat/Button/Button.d.ts +3 -0
- package/lib/components/Chat/Button/Button.js +37 -0
- package/lib/components/Chat/Chat.stories.js +688 -0
- package/lib/components/Chat/ChatItem/ChatItem.css +1 -0
- package/lib/components/Chat/ChatItem/ChatItem.d.ts +3 -0
- package/lib/components/Chat/ChatItem/ChatItem.js +183 -0
- package/lib/components/Chat/ChatList/ChatList.css +1 -0
- package/lib/components/Chat/ChatList/ChatList.d.ts +3 -0
- package/lib/components/Chat/ChatList/ChatList.js +84 -0
- package/lib/components/Chat/Circle/Circle.d.ts +3 -0
- package/lib/components/Chat/Circle/Circle.js +27 -0
- package/lib/components/Chat/Dropdown/Dropdown.css +1 -0
- package/lib/components/Chat/Dropdown/Dropdown.d.ts +3 -0
- package/lib/components/Chat/Dropdown/Dropdown.js +66 -0
- package/lib/components/Chat/FileMessage/FileMessage.css +1 -0
- package/lib/components/Chat/FileMessage/FileMessage.d.ts +3 -0
- package/lib/components/Chat/FileMessage/FileMessage.js +77 -0
- package/lib/components/Chat/Input/Input.css +1 -0
- package/lib/components/Chat/Input/Input.d.ts +3 -0
- package/lib/components/Chat/Input/Input.js +108 -0
- package/lib/components/Chat/LocationMessage/LocationMessage.css +1 -0
- package/lib/components/Chat/LocationMessage/LocationMessage.d.ts +3 -0
- package/lib/components/Chat/LocationMessage/LocationMessage.js +36 -0
- package/lib/components/Chat/MeetingItem/MeetingItem.css +1 -0
- package/lib/components/Chat/MeetingItem/MeetingItem.d.ts +3 -0
- package/lib/components/Chat/MeetingItem/MeetingItem.js +106 -0
- package/lib/components/Chat/MeetingLink/MeetingLink.css +1 -0
- package/lib/components/Chat/MeetingLink/MeetingLink.d.ts +3 -0
- package/lib/components/Chat/MeetingLink/MeetingLink.js +26 -0
- package/lib/components/Chat/MeetingList/MeetingList.css +1 -0
- package/lib/components/Chat/MeetingList/MeetingList.d.ts +3 -0
- package/lib/components/Chat/MeetingList/MeetingList.js +52 -0
- package/lib/components/Chat/MeetingMessage/MeetingMessage.css +1 -0
- package/lib/components/Chat/MeetingMessage/MeetingMessage.d.ts +3 -0
- package/lib/components/Chat/MeetingMessage/MeetingMessage.js +227 -0
- package/lib/components/Chat/MessageBox/MessageBox.css +1 -0
- package/lib/components/Chat/MessageBox/MessageBox.d.ts +3 -0
- package/lib/components/Chat/MessageBox/MessageBox.js +263 -0
- package/lib/components/Chat/MessageList/MessageList.css +1 -0
- package/lib/components/Chat/MessageList/MessageList.d.ts +2 -0
- package/lib/components/Chat/MessageList/MessageList.js +196 -0
- package/lib/components/Chat/Navbar/Navbar.css +1 -0
- package/lib/components/Chat/Navbar/Navbar.d.ts +3 -0
- package/lib/components/Chat/Navbar/Navbar.js +21 -0
- package/lib/components/Chat/PhotoMessage/PhotoMessage.css +1 -0
- package/lib/components/Chat/PhotoMessage/PhotoMessage.d.ts +3 -0
- package/lib/components/Chat/PhotoMessage/PhotoMessage.js +73 -0
- package/lib/components/Chat/Popup/Popup.css +1 -0
- package/lib/components/Chat/Popup/Popup.d.ts +3 -0
- package/lib/components/Chat/Popup/Popup.js +45 -0
- package/lib/components/Chat/README.md +50 -0
- package/lib/components/Chat/ReplyMessage/ReplyMessage.css +1 -0
- package/lib/components/Chat/ReplyMessage/ReplyMessage.d.ts +3 -0
- package/lib/components/Chat/ReplyMessage/ReplyMessage.js +42 -0
- package/lib/components/Chat/SideBar/SideBar.css +1 -0
- package/lib/components/Chat/SideBar/SideBar.d.ts +3 -0
- package/lib/components/Chat/SideBar/SideBar.js +21 -0
- package/lib/components/Chat/SpotifyMessage/SpotifyMessage.css +1 -0
- package/lib/components/Chat/SpotifyMessage/SpotifyMessage.d.ts +3 -0
- package/lib/components/Chat/SpotifyMessage/SpotifyMessage.js +28 -0
- package/lib/components/Chat/SystemMessage/SystemMessage.css +1 -0
- package/lib/components/Chat/SystemMessage/SystemMessage.d.ts +3 -0
- package/lib/components/Chat/SystemMessage/SystemMessage.js +14 -0
- package/lib/components/Chat/VideoMessage/VideoMessage.css +1 -0
- package/lib/components/Chat/VideoMessage/VideoMessage.d.ts +3 -0
- package/lib/components/Chat/VideoMessage/VideoMessage.js +88 -0
- package/lib/components/Chat/assets/img/leftArrow.svg +6 -0
- package/lib/components/Chat/assets/img/rightArrow.svg +6 -0
- package/lib/components/Chat/index.d.ts +25 -0
- package/lib/components/Chat/index.js +27 -0
- package/lib/components/Chat/type.d.js +52 -0
- package/lib/components/Chat/utils/formatRelativeDate.d.ts +4 -0
- package/lib/components/Chat/utils/formatRelativeDate.js +110 -0
- package/lib/components/Checkbox/Checkbox.d.ts +15 -0
- package/lib/components/Checkbox/Checkbox.js +106 -0
- package/lib/components/Checkbox/Checkbox.stories.js +51 -0
- package/lib/components/ComponentUtils/renderWithAsChild.d.ts +9 -0
- package/lib/components/ComponentUtils/renderWithAsChild.js +27 -0
- package/lib/components/Container/Container.d.ts +7 -0
- package/lib/components/Container/Container.js +16 -0
- package/lib/components/Container/Container.stories.js +36 -0
- package/lib/components/DateField/DateField.d.ts +22 -0
- package/lib/components/DateField/DateField.js +145 -0
- package/lib/components/DateField/DateField.stories.js +125 -0
- package/lib/components/DateField/DatePicker.d.ts +9 -0
- package/lib/components/DateField/DatePicker.js +205 -0
- package/lib/components/DateField/DatePicker.stories.js +33 -0
- package/lib/components/DescriptionList/DescriptionList.d.ts +4 -0
- package/lib/components/DescriptionList/DescriptionList.js +19 -0
- package/lib/components/DescriptionList/DescriptionList.stories.js +34 -0
- package/lib/components/Dialog/Dialog.d.ts +25 -0
- package/lib/components/Dialog/Dialog.js +66 -0
- package/lib/components/Dialog/Dialog.stories.js +88 -0
- package/lib/components/DropUpload/DropUpload.d.ts +37 -0
- package/lib/components/DropUpload/DropUpload.js +323 -0
- package/lib/components/DropUpload/DropUpload.stories.js +48 -0
- package/lib/components/Empty/Empty.d.ts +11 -0
- package/lib/components/Empty/Empty.js +39 -0
- package/lib/components/Empty/Empty.stories.js +52 -0
- package/lib/components/EmptyState/EmptyState.d.ts +15 -0
- package/lib/components/EmptyState/EmptyState.js +44 -0
- package/lib/components/EmptyState/EmptyState.stories.js +36 -0
- package/lib/components/ErrorMessage/ErrorMessage.d.ts +7 -0
- package/lib/components/ErrorMessage/ErrorMessage.js +20 -0
- package/lib/components/ErrorMessage/ErrorMessage.stories.js +25 -0
- package/lib/components/FaqSection/FaqSection.d.ts +14 -0
- package/lib/components/FaqSection/FaqSection.js +37 -0
- package/lib/components/FaqSection/FaqSection.stories.js +31 -0
- package/lib/components/Fieldset/Fieldset.d.ts +21 -0
- package/lib/components/Fieldset/Fieldset.js +39 -0
- package/lib/components/Fieldset/Fieldset.stories.js +42 -0
- package/lib/components/Footer/Footer.d.ts +26 -0
- package/lib/components/Footer/Footer.js +119 -0
- package/lib/components/Footer/Footer.stories.js +184 -0
- package/lib/components/Form/Form.d.ts +42 -0
- package/lib/components/Form/Form.js +198 -0
- package/lib/components/Form/Form.stories.js +65 -0
- package/lib/components/Form/FormContext.d.ts +35 -0
- package/lib/components/Form/FormContext.js +71 -0
- package/lib/components/GothamRoute/GothamRoute.d.ts +0 -0
- package/lib/components/GothamRoute/GothamRoute.js +56 -0
- package/lib/components/GothamRouter/GothamRouter.d.ts +0 -0
- package/lib/components/GothamRouter/GothamRouter.js +52 -0
- package/lib/components/Heading/Heading.d.ts +7 -0
- package/lib/components/Heading/Heading.js +20 -0
- package/lib/components/Heading/Heading.stories.js +51 -0
- package/lib/components/IncentiveGrid/IncentiveGrid.d.ts +15 -0
- package/lib/components/IncentiveGrid/IncentiveGrid.js +34 -0
- package/lib/components/IncentiveGrid/IncentiveGrid.stories.js +41 -0
- package/lib/components/InputField/InputField.d.ts +25 -0
- package/lib/components/InputField/InputField.js +68 -0
- package/lib/components/InputField/InputField.stories.js +58 -0
- package/lib/components/Item/Item.d.ts +25 -0
- package/lib/components/Item/Item.js +79 -0
- package/lib/components/Item/Item.stories.js +94 -0
- package/lib/components/Kbd/Kbd.d.ts +2 -0
- package/lib/components/Kbd/Kbd.js +9 -0
- package/lib/components/Kbd/Kbd.stories.js +24 -0
- package/lib/components/Label/Label.d.ts +11 -0
- package/lib/components/Label/Label.js +23 -0
- package/lib/components/Label/Label.stories.js +38 -0
- package/lib/components/Link/Link.d.ts +7 -0
- package/lib/components/Link/Link.js +13 -0
- package/lib/components/Link/Link.stories.js +28 -0
- package/lib/components/ListContainer/ListContainer.d.ts +8 -0
- package/lib/components/ListContainer/ListContainer.js +14 -0
- package/lib/components/ListContainer/ListContainer.stories.js +45 -0
- package/lib/components/Loader/Loader.d.ts +9 -0
- package/lib/components/Loader/Loader.js +36 -0
- package/lib/components/Loader/Loader.stories.js +94 -0
- package/lib/components/LogoCloud/LogoCloud.d.ts +15 -0
- package/lib/components/LogoCloud/LogoCloud.js +43 -0
- package/lib/components/LogoCloud/LogoCloud.stories.js +28 -0
- package/lib/components/Markdown/Markdown.d.ts +8 -0
- package/lib/components/Markdown/Markdown.js +64 -0
- package/lib/components/Markdown/Markdown.stories.js +34 -0
- package/lib/components/MediaLightbox/MediaLightbox.d.ts +22 -0
- package/lib/components/MediaLightbox/MediaLightbox.js +80 -0
- package/lib/components/MediaObject/MediaObject.d.ts +8 -0
- package/lib/components/MediaObject/MediaObject.js +37 -0
- package/lib/components/MediaObject/MediaObject.stories.js +28 -0
- package/lib/components/Navbar/Navbar.d.ts +43 -0
- package/lib/components/Navbar/Navbar.js +213 -0
- package/lib/components/Navbar/Navbar.stories.js +235 -0
- package/lib/components/NotFound/NotFound.d.ts +34 -0
- package/lib/components/NotFound/NotFound.js +351 -0
- package/lib/components/NotFound/NotFound.stories.js +80 -0
- package/lib/components/Notify/Notify.d.ts +18 -0
- package/lib/components/Notify/Notify.js +178 -0
- package/lib/components/Notify/Notify.stories.js +148 -0
- package/lib/components/Notify/NotifyExample.d.ts +1 -0
- package/lib/components/Notify/NotifyExample.js +174 -0
- package/lib/components/Notify/README.md +103 -0
- package/lib/components/Pagination/Pagination.d.ts +18 -0
- package/lib/components/Pagination/Pagination.js +225 -0
- package/lib/components/Pagination/Pagination.stories.js +69 -0
- package/lib/components/PasswordStrengthMeter/PasswordStrengthMeter.d.ts +12 -0
- package/lib/components/PasswordStrengthMeter/PasswordStrengthMeter.js +88 -0
- package/lib/components/PasswordStrengthMeter/PasswordStrengthMeter.stories.js +16 -0
- package/lib/components/PaymentMethodPanel/PaymentMethodPanel.d.ts +18 -0
- package/lib/components/PaymentMethodPanel/PaymentMethodPanel.js +113 -0
- package/lib/components/PaymentMethodPanel/PaymentMethodPanel.stories.js +88 -0
- package/lib/components/Pricing/Pricing.d.ts +78 -0
- package/lib/components/Pricing/Pricing.js +764 -0
- package/lib/components/Pricing/Pricing.stories.js +146 -0
- package/lib/components/ProductGrid/ProductGrid.d.ts +23 -0
- package/lib/components/ProductGrid/ProductGrid.js +79 -0
- package/lib/components/ProductGrid/ProductGrid.stories.js +50 -0
- package/lib/components/ProgressSteps/ProgressSteps.d.ts +13 -0
- package/lib/components/ProgressSteps/ProgressSteps.js +51 -0
- package/lib/components/ProgressSteps/ProgressSteps.stories.js +35 -0
- package/lib/components/RadioField/RadioField.d.ts +16 -0
- package/lib/components/RadioField/RadioField.js +63 -0
- package/lib/components/RadioField/RadioField.stories.js +140 -0
- package/lib/components/ReviewList/ReviewList.d.ts +15 -0
- package/lib/components/ReviewList/ReviewList.js +51 -0
- package/lib/components/ReviewList/ReviewList.stories.js +29 -0
- package/lib/components/SectionHeader/SectionHeader.d.ts +9 -0
- package/lib/components/SectionHeader/SectionHeader.js +36 -0
- package/lib/components/SectionHeader/SectionHeader.stories.js +35 -0
- package/lib/components/SelectField/SelectField.d.ts +18 -0
- package/lib/components/SelectField/SelectField.js +145 -0
- package/lib/components/SelectField/SelectField.stories.js +155 -0
- package/lib/components/SelectField/SelectOption.d.ts +13 -0
- package/lib/components/SelectField/SelectOption.js +40 -0
- package/lib/components/SelectField/SelectOption.stories.js +40 -0
- package/lib/components/Separator/Separator.d.ts +6 -0
- package/lib/components/Separator/Separator.js +13 -0
- package/lib/components/Separator/Separator.stories.js +70 -0
- package/lib/components/Skeleton/Skeleton.d.ts +2 -0
- package/lib/components/Skeleton/Skeleton.js +9 -0
- package/lib/components/Skeleton/Skeleton.stories.js +24 -0
- package/lib/components/Svg/Svg.d.ts +9 -0
- package/lib/components/Svg/Svg.js +25 -0
- package/lib/components/Svg/Svg.stories.js +34 -0
- package/lib/components/Switch/Switch.d.ts +12 -0
- package/lib/components/Switch/Switch.js +54 -0
- package/lib/components/Switch/Switch.stories.js +61 -0
- package/lib/components/Table/Table.d.ts +18 -0
- package/lib/components/Table/Table.js +99 -0
- package/lib/components/Table/Table.stories.js +79 -0
- package/lib/components/Tabs/Tabs.d.ts +17 -0
- package/lib/components/Tabs/Tabs.js +85 -0
- package/lib/components/Tabs/Tabs.stories.js +45 -0
- package/lib/components/Text/Text.d.ts +5 -0
- package/lib/components/Text/Text.js +24 -0
- package/lib/components/Text/Text.stories.js +35 -0
- package/lib/components/TextField/TextField.d.ts +31 -0
- package/lib/components/TextField/TextField.js +91 -0
- package/lib/components/TextField/TextField.stories.js +158 -0
- package/lib/components/Textarea/Textarea.d.ts +5 -0
- package/lib/components/Textarea/Textarea.js +10 -0
- package/lib/components/Textarea/Textarea.stories.js +32 -0
- package/lib/components/index.d.ts +60 -0
- package/lib/components/index.js +62 -0
- package/lib/config/appConfig.d.ts +5 -0
- package/lib/config/appConfig.js +20 -0
- package/lib/constants/AuthConstants.d.ts +8 -0
- package/lib/constants/AuthConstants.js +9 -0
- package/lib/constants/GothamConstants.d.ts +24 -0
- package/lib/constants/GothamConstants.js +25 -0
- package/lib/constants/MarkdownConstants.d.ts +8 -0
- package/lib/constants/MarkdownConstants.js +9 -0
- package/lib/constants/MessageConstants.d.ts +10 -0
- package/lib/constants/MessageConstants.js +11 -0
- package/lib/docs/analytics.md +231 -0
- package/lib/docs/api-reference.md +364 -0
- package/lib/docs/comparison.md +83 -0
- package/lib/docs/containers.md +11 -0
- package/lib/docs/gettingStarted.md +338 -0
- package/lib/docs/payments.md +79 -0
- package/lib/editor/CodeEditor.d.ts +11 -0
- package/lib/editor/CodeEditor.js +15 -0
- package/lib/editor/CodeEditor.stories.js +24 -0
- package/lib/editor/index.d.ts +1 -0
- package/lib/editor/index.js +3 -0
- package/lib/errors/UserError.d.ts +8 -0
- package/lib/errors/UserError.js +12 -0
- package/lib/examples/OptimizedFormExample.d.ts +1 -0
- package/lib/examples/OptimizedFormExample.js +130 -0
- package/lib/form/index.d.ts +11 -0
- package/lib/form/index.js +13 -0
- package/lib/hooks/useIsMobile.d.ts +1 -0
- package/lib/hooks/useIsMobile.js +12 -0
- package/lib/i18n/index.d.ts +8 -0
- package/lib/i18n/index.js +7 -0
- package/lib/icons/Dual Ring-1s-100px.svg +1 -0
- package/lib/icons/gotham-logo.svg +17 -0
- package/lib/icons/gotham.svg +8 -0
- package/lib/icons/index.d.ts +5 -0
- package/lib/icons/index.js +6 -0
- package/lib/icons/pencil.svg +6 -0
- package/lib/img/arkhamjs-logo.png +0 -0
- package/lib/img/logo.png +0 -0
- package/lib/index.d.ts +25 -0
- package/lib/index.js +25 -0
- package/lib/router/index.d.ts +5 -0
- package/lib/router/index.js +6 -0
- package/lib/stores/GothamAppStore.d.ts +35 -0
- package/lib/stores/GothamAppStore.js +70 -0
- package/lib/stories/Button.d.ts +28 -0
- package/lib/stories/Button.js +22 -0
- package/lib/stories/Header.d.ts +12 -0
- package/lib/stories/Header.js +78 -0
- package/lib/stories/Page.d.ts +3 -0
- package/lib/stories/Page.js +108 -0
- package/lib/stories/assets/accessibility.png +0 -0
- package/lib/stories/assets/accessibility.svg +5 -0
- package/lib/stories/assets/addon-library.png +0 -0
- package/lib/stories/assets/assets.png +0 -0
- package/lib/stories/assets/context.png +0 -0
- package/lib/stories/assets/discord.svg +15 -0
- package/lib/stories/assets/docs.png +0 -0
- package/lib/stories/assets/figma-plugin.png +0 -0
- package/lib/stories/assets/github.svg +3 -0
- package/lib/stories/assets/share.png +0 -0
- package/lib/stories/assets/styling.png +0 -0
- package/lib/stories/assets/testing.png +0 -0
- package/lib/stories/assets/theming.png +0 -0
- package/lib/stories/assets/tutorials.svg +12 -0
- package/lib/stories/assets/youtube.svg +4 -0
- package/lib/stories/button.css +1 -0
- package/lib/stories/header.css +1 -0
- package/lib/stories/page.css +1 -0
- package/lib/styles/chat.css +1 -0
- package/lib/styles/index.css +2 -0
- package/lib/styles/tailwind.css +1 -0
- package/lib/types/assets.d.js +2 -0
- package/lib/types/gotham.d.ts +12 -0
- package/lib/types/gotham.js +3 -0
- package/lib/types/vitest-globals.d.js +3 -0
- package/lib/utils/GothamContext.d.ts +14 -0
- package/lib/utils/GothamContext.js +14 -0
- package/lib/utils/awsRum.d.ts +23 -0
- package/lib/utils/awsRum.js +50 -0
- package/lib/utils/colorUtils.d.ts +20 -0
- package/lib/utils/colorUtils.js +499 -0
- package/lib/utils/contentUtils.d.ts +2 -0
- package/lib/utils/contentUtils.js +18 -0
- package/lib/utils/i18nUtil.d.ts +1 -0
- package/lib/utils/i18nUtil.js +7 -0
- package/lib/utils/imageUtils.d.ts +5 -0
- package/lib/utils/imageUtils.js +48 -0
- package/lib/utils/interactionAnalytics.d.ts +10 -0
- package/lib/utils/interactionAnalytics.js +142 -0
- package/lib/utils/navEventQueue.d.ts +6 -0
- package/lib/utils/navEventQueue.js +50 -0
- package/lib/utils/refUtils.d.ts +2 -0
- package/lib/utils/refUtils.js +11 -0
- package/lib/utils/routeUtils.d.ts +12 -0
- package/lib/utils/routeUtils.js +109 -0
- package/lib/utils/sizeUtils.d.ts +5 -0
- package/lib/utils/sizeUtils.js +6 -0
- package/lib/utils/storyInteractions.d.ts +6 -0
- package/lib/utils/storyInteractions.js +45 -0
- package/lib/utils/storyUtils.d.ts +1 -0
- package/lib/utils/storyUtils.js +11 -0
- package/lib/utils/testUtils.d.ts +3 -0
- package/lib/utils/testUtils.js +56 -0
- package/lib/utils/timer.d.ts +21 -0
- package/lib/utils/timer.js +38 -0
- package/lib/utils/useBreakpoint.d.ts +6 -0
- package/lib/utils/useBreakpoint.js +56 -0
- package/lib/utils/viewPerformance.d.ts +34 -0
- package/lib/utils/viewPerformance.js +103 -0
- package/lib/utils/viewUtils.d.ts +9 -0
- package/lib/utils/viewUtils.js +44 -0
- package/lib/views/AuthSignInView/AuthSignInView.d.ts +20 -0
- package/lib/views/AuthSignInView/AuthSignInView.js +107 -0
- package/lib/views/AuthSignInView/AuthSignInView.stories.js +29 -0
- package/lib/views/AuthSignUpView/AuthSignUpView.d.ts +21 -0
- package/lib/views/AuthSignUpView/AuthSignUpView.js +146 -0
- package/lib/views/AuthSignUpView/AuthSignUpView.stories.js +30 -0
- package/lib/views/AuthView/AuthView.d.ts +16 -0
- package/lib/views/AuthView/AuthView.js +60 -0
- package/lib/views/AuthView/AuthView.stories.js +34 -0
- package/lib/views/DefaultView/DefaultView.d.ts +5 -0
- package/lib/views/DefaultView/DefaultView.js +134 -0
- package/lib/views/Gotham/Gotham.d.ts +44 -0
- package/lib/views/Gotham/Gotham.js +24 -0
- package/lib/views/Gotham/Gotham.stories.js +31 -0
- package/lib/views/Gotham/GothamListeners.d.ts +0 -0
- package/lib/views/Gotham/GothamListeners.js +2 -0
- package/lib/views/Gotham/GothamProvider.d.ts +43 -0
- package/lib/views/Gotham/GothamProvider.js +217 -0
- package/lib/views/Gotham/GothamRoot.d.ts +6 -0
- package/lib/views/Gotham/GothamRoot.js +69 -0
- package/lib/views/HomeView/HomeView.d.ts +10 -0
- package/lib/views/HomeView/HomeView.js +134 -0
- package/lib/views/LoaderView/LoaderView.d.ts +8 -0
- package/lib/views/LoaderView/LoaderView.js +30 -0
- package/lib/views/MenuView/MenuView.d.ts +13 -0
- package/lib/views/MenuView/MenuView.js +305 -0
- package/lib/views/NotFoundView/NotFoundView.d.ts +2 -0
- package/lib/views/NotFoundView/NotFoundView.js +12 -0
- package/lib/views/index.d.ts +11 -0
- package/lib/views/index.js +13 -0
- package/package.json +202 -0
- package/styles/tailwind.css +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,768 @@
|
|
|
1
|
+
# GothamUI: The Complete Front-End UI Framework
|
|
2
|
+
|
|
3
|
+
> **GothamJS is now GothamUI.** Install `@nlabs/gothamui`. Existing component APIs and subpath exports are preserved. See the [migration guide](MIGRATION.md).
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Seamlessly integrating components, routing, state management, and transitions
|
|
8
|
+
|
|
9
|
+
> A comprehensive front-end UI framework that handles everything from component rendering to routing and smooth transitions with minimal configuration.
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/@nlabs/gothamui)
|
|
12
|
+
[](https://www.npmjs.com/package/@nlabs/gothamui)
|
|
13
|
+
[](https://gothamui.nitrogenx.co)
|
|
14
|
+
[](https://github.com/nitrogenlabs/gothamui/issues)
|
|
15
|
+
[](https://github.com/ellerbrock/typescript-badges/)
|
|
16
|
+
[](http://opensource.org/licenses/MIT)
|
|
17
|
+
[](https://discord.gg/Ttgev58)
|
|
18
|
+
|
|
19
|
+
GothamUI is an all-inclusive React framework that unifies UI components, navigation, state management, and transitions into one cohesive system. Built by Nitrogen Labs, GothamUI eliminates the need to piece together multiple libraries, providing developers with a consistent, integrated solution for all front-end UI needs.
|
|
20
|
+
|
|
21
|
+
## How GothamUI fits into your app
|
|
22
|
+
|
|
23
|
+
Your application keeps ownership of its routes, configuration, domain logic, and data. GothamUI turns those inputs into a cohesive presentation layer with components, navigation, state, forms, responsive styling, localization, and telemetry built in.
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
## Key Features
|
|
28
|
+
|
|
29
|
+
- **Unified Component Library**: Beautifully designed, fully customizable UI components with consistent styling and behavior
|
|
30
|
+
- **Seamless Routing & Transitions**: Built-in navigation system with smooth page transitions and animations
|
|
31
|
+
- **Integrated State Management**: Flux-based state handling that connects directly to your UI components
|
|
32
|
+
- **Form System**: Complete form components with validation, error handling, and accessibility features
|
|
33
|
+
- **Theming & Styling**: Light/dark mode support and customizable design system based on Tailwind CSS
|
|
34
|
+
- **Responsive Design**: Mobile-first components that adapt beautifully to any screen size
|
|
35
|
+
- **Internationalization**: Built-in i18n support for multilingual applications
|
|
36
|
+
- **Authentication Flows**: Ready-to-use authentication UI components and routing guards
|
|
37
|
+
- **Icon Library**: Complete Lucide React icon set available for use throughout your application
|
|
38
|
+
|
|
39
|
+
## Getting Started
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Install GothamUI
|
|
43
|
+
npm install @nlabs/gothamui
|
|
44
|
+
|
|
45
|
+
# Or with yarn
|
|
46
|
+
yarn add @nlabs/gothamui
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Create your first GothamUI application:
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
import {createRoot} from 'react-dom/client';
|
|
53
|
+
import {Gotham} from '@nlabs/gothamui';
|
|
54
|
+
|
|
55
|
+
// Define your application configuration
|
|
56
|
+
const config = {
|
|
57
|
+
app: {
|
|
58
|
+
name: 'my-awesome-app',
|
|
59
|
+
title: 'My Awesome App'
|
|
60
|
+
},
|
|
61
|
+
routes: [
|
|
62
|
+
{
|
|
63
|
+
path: '/',
|
|
64
|
+
element: <HomePage />,
|
|
65
|
+
props: {
|
|
66
|
+
topBar: {
|
|
67
|
+
logo: <img src="/logo.png" alt="Logo" />,
|
|
68
|
+
menu: [
|
|
69
|
+
{ label: 'Sign In', url: '/signin' },
|
|
70
|
+
{ label: 'Sign Up', url: '/signup' }
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Render your application
|
|
79
|
+
const root = createRoot(document.getElementById('app'));
|
|
80
|
+
root.render(<Gotham config={config} />);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## CSS and Styling
|
|
84
|
+
|
|
85
|
+
GothamUI uses Tailwind CSS with custom theme variables for consistent styling. To use GothamUI components with proper styling in your project, you need to import the GothamUI theme CSS.
|
|
86
|
+
|
|
87
|
+
### Importing GothamUI Styles
|
|
88
|
+
|
|
89
|
+
```css
|
|
90
|
+
/* Import GothamUI theme CSS in your main CSS file */
|
|
91
|
+
@import '@nlabs/gothamui/styles/tailwind.css';
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Tailwind CSS v4 Configuration
|
|
95
|
+
|
|
96
|
+
Since GothamUI uses Tailwind CSS v4, configuration is done via CSS custom properties instead of a `tailwind.config.js` file. The GothamUI theme CSS already includes all the necessary color variables.
|
|
97
|
+
|
|
98
|
+
If you need to customize the theme further, you can override the CSS custom properties in your own CSS:
|
|
99
|
+
|
|
100
|
+
```css
|
|
101
|
+
/* In your main CSS file, after importing GothamUI styles */
|
|
102
|
+
@import '@nlabs/gothamui/styles/tailwind.css';
|
|
103
|
+
|
|
104
|
+
/* Override GothamUI theme variables */
|
|
105
|
+
@theme {
|
|
106
|
+
--color-primary: #your-custom-primary;
|
|
107
|
+
--color-secondary: #your-custom-secondary;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Source Detection (Tailwind v4.2)
|
|
112
|
+
|
|
113
|
+
Tailwind v4.2 uses source detection instead of `content` arrays in JavaScript config.
|
|
114
|
+
GothamUI already includes `@source` for its own components, and your app can add sources in CSS when needed:
|
|
115
|
+
|
|
116
|
+
```css
|
|
117
|
+
/* src/styles/main.css */
|
|
118
|
+
@import '@nlabs/gothamui/styles/tailwind.css';
|
|
119
|
+
|
|
120
|
+
/* Optional: explicit app source paths (useful in monorepos/non-standard layouts) */
|
|
121
|
+
@source "../**/*.{js,jsx,ts,tsx}";
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
For PostCSS, use the Tailwind v4 plugin package (`@tailwindcss/postcss`):
|
|
125
|
+
|
|
126
|
+
#### Webpack Configuration
|
|
127
|
+
|
|
128
|
+
```js
|
|
129
|
+
// webpack.config.js
|
|
130
|
+
module.exports = {
|
|
131
|
+
// ... other webpack config
|
|
132
|
+
module: {
|
|
133
|
+
rules: [
|
|
134
|
+
{
|
|
135
|
+
test: /\.css$/,
|
|
136
|
+
use: [
|
|
137
|
+
'style-loader',
|
|
138
|
+
'css-loader',
|
|
139
|
+
{
|
|
140
|
+
loader: 'postcss-loader',
|
|
141
|
+
options: {
|
|
142
|
+
postcssOptions: {
|
|
143
|
+
plugins: [
|
|
144
|
+
require('@tailwindcss/postcss')
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### Lex Configuration
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
// lex.config.mjs
|
|
160
|
+
export default {
|
|
161
|
+
// ... other config
|
|
162
|
+
tailwindCssPath: './src/styles/main.css'
|
|
163
|
+
};
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Vite Configuration
|
|
167
|
+
|
|
168
|
+
```js
|
|
169
|
+
// vite.config.js
|
|
170
|
+
export default {
|
|
171
|
+
css: {
|
|
172
|
+
postcss: {
|
|
173
|
+
plugins: [
|
|
174
|
+
require('@tailwindcss/postcss')
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### What Gets Imported
|
|
182
|
+
|
|
183
|
+
The GothamUI theme CSS includes:
|
|
184
|
+
|
|
185
|
+
- **Custom Color Palette**: Primary, secondary, neutral, success, error, warning, and info colors
|
|
186
|
+
- **Dark Mode Support**: Automatic dark mode variants for all colors
|
|
187
|
+
- **Typography**: Inter font family with proper font weights
|
|
188
|
+
- **Autofill Styles**: Browser autofill styling fixes for form inputs
|
|
189
|
+
- **Base Styles**: Essential CSS resets and utilities
|
|
190
|
+
|
|
191
|
+
### Using GothamUI Colors in Your Components
|
|
192
|
+
|
|
193
|
+
```jsx
|
|
194
|
+
// GothamUI colors are available as Tailwind classes
|
|
195
|
+
<div className="bg-primary text-white dark:bg-primary-dark dark:text-black-dark">
|
|
196
|
+
Styled with GothamUI theme
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
// Or use them in custom CSS
|
|
200
|
+
.my-component {
|
|
201
|
+
background-color: var(--color-primary);
|
|
202
|
+
color: var(--color-white);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Components
|
|
207
|
+
|
|
208
|
+
GothamUI provides a rich set of components to accelerate your development:
|
|
209
|
+
|
|
210
|
+
### Chat Components
|
|
211
|
+
|
|
212
|
+
GothamUI now includes a first-party chat UI module based on the `react-chat-elements` component set.
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
// Option 1: Namespace import from root package
|
|
216
|
+
import {Chat} from '@nlabs/gothamui';
|
|
217
|
+
|
|
218
|
+
// Option 2: Direct chat subpath import
|
|
219
|
+
import {ChatList, MessageBox, MessageList} from '@nlabs/gothamui/chat';
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Chat components inherit their runtime styles from GothamUI's Tailwind v4 stylesheet, so import [`@nlabs/gothamui/styles/tailwind.css`](#installation) once at your app entrypoint.
|
|
223
|
+
|
|
224
|
+
### Icons
|
|
225
|
+
|
|
226
|
+
GothamUI includes the complete [Lucide React](https://lucide.dev/) icon library, providing you with over 1000+ beautifully designed, customizable icons that follow a consistent design language.
|
|
227
|
+
|
|
228
|
+
#### Why Lucide React?
|
|
229
|
+
|
|
230
|
+
- **Consistent Design**: All icons follow the same design principles and stroke width
|
|
231
|
+
- **Customizable**: Easy to customize size, color, stroke width, and other properties
|
|
232
|
+
- **Accessible**: Built with accessibility in mind, including proper ARIA attributes
|
|
233
|
+
- **Tree Shakeable**: Only the icons you import are included in your bundle
|
|
234
|
+
- **TypeScript Support**: Full type definitions for all icons
|
|
235
|
+
- **Active Development**: Regularly updated with new icons and improvements
|
|
236
|
+
|
|
237
|
+
#### Quick Reference
|
|
238
|
+
|
|
239
|
+
- **Icon Gallery**: [Browse all available icons](https://lucide.dev/icons/)
|
|
240
|
+
- **Documentation**: [Lucide React documentation](https://lucide.dev/guide/packages/lucide-react)
|
|
241
|
+
- **GitHub**: [Lucide project on GitHub](https://github.com/lucide-icons/lucide)
|
|
242
|
+
|
|
243
|
+
#### Usage
|
|
244
|
+
|
|
245
|
+
```jsx
|
|
246
|
+
import { Camera, Heart, Star, Settings, LucideLoader } from '@nlabs/gothamui/icons';
|
|
247
|
+
|
|
248
|
+
const MyComponent = () => (
|
|
249
|
+
<div>
|
|
250
|
+
<Camera size={24} />
|
|
251
|
+
<Heart size={24} color="red" />
|
|
252
|
+
<Star size={24} fill="yellow" />
|
|
253
|
+
<Settings size={24} />
|
|
254
|
+
<LucideLoader size={24} /> {/* Use LucideLoader to avoid conflict with GothamUI Loader component */}
|
|
255
|
+
</div>
|
|
256
|
+
);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### Icon Properties
|
|
260
|
+
|
|
261
|
+
All Lucide React icons support these common properties:
|
|
262
|
+
|
|
263
|
+
```jsx
|
|
264
|
+
<Camera
|
|
265
|
+
size={24} // Icon size in pixels
|
|
266
|
+
color="currentColor" // Icon color
|
|
267
|
+
strokeWidth={2} // Stroke width
|
|
268
|
+
fill="none" // Fill color
|
|
269
|
+
className="my-icon" // CSS classes
|
|
270
|
+
/>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
> **Note**: The `Loader` icon from Lucide React is exported as `LucideLoader` to avoid conflicts with GothamUI's `Loader` component.
|
|
274
|
+
|
|
275
|
+
### Optimized Form Components
|
|
276
|
+
|
|
277
|
+
GothamUI provides optimized form components with automatic validation, accessibility features, and performance optimizations:
|
|
278
|
+
|
|
279
|
+
```jsx
|
|
280
|
+
import { Button, Form, TextField } from '@nlabs/gothamui';
|
|
281
|
+
import { z } from 'zod';
|
|
282
|
+
|
|
283
|
+
// Define your form schema with Zod
|
|
284
|
+
const loginSchema = z.object({
|
|
285
|
+
email: z.string().email('Please enter a valid email'),
|
|
286
|
+
password: z.string().min(8, 'Password must be at least 8 characters')
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
const LoginForm = () => (
|
|
290
|
+
<Form
|
|
291
|
+
schema={loginSchema}
|
|
292
|
+
onSubmit={handleSubmit}
|
|
293
|
+
showErrors={true} // Show form-level errors at top
|
|
294
|
+
mode="onBlur" // Validate on blur for better UX
|
|
295
|
+
>
|
|
296
|
+
{({isSubmitting, disabled}) => (
|
|
297
|
+
<>
|
|
298
|
+
<TextField
|
|
299
|
+
name="email"
|
|
300
|
+
label="Email"
|
|
301
|
+
type="email"
|
|
302
|
+
placeholder="Enter your email"
|
|
303
|
+
required
|
|
304
|
+
/>
|
|
305
|
+
<TextField
|
|
306
|
+
name="password"
|
|
307
|
+
label="Password"
|
|
308
|
+
type="password"
|
|
309
|
+
placeholder="Enter your password"
|
|
310
|
+
required
|
|
311
|
+
/>
|
|
312
|
+
<Button
|
|
313
|
+
type="submit"
|
|
314
|
+
variant="contained"
|
|
315
|
+
color="primary"
|
|
316
|
+
label="Sign In"
|
|
317
|
+
disabled={isSubmitting}
|
|
318
|
+
isLoading={isSubmitting}
|
|
319
|
+
/>
|
|
320
|
+
</>
|
|
321
|
+
)}
|
|
322
|
+
</Form>
|
|
323
|
+
);
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### Optimized Form Features
|
|
327
|
+
|
|
328
|
+
- **Automatic Validation**: Integrated Zod schema validation with react-hook-form
|
|
329
|
+
- **Performance Optimized**: Efficient re-rendering and validation triggering
|
|
330
|
+
- **Accessibility**: Proper ARIA attributes and form structure
|
|
331
|
+
- **Loading States**: Use `Button` with `disabled` and `isLoading` during form submission
|
|
332
|
+
- **Error Handling**: Both field-level and form-level error display
|
|
333
|
+
- **Type Safety**: Full TypeScript support with inferred types
|
|
334
|
+
|
|
335
|
+
### Legacy Form Components
|
|
336
|
+
|
|
337
|
+
```jsx
|
|
338
|
+
import { Form, TextField, Button } from '@nlabs/gothamui';
|
|
339
|
+
import { z } from 'zod';
|
|
340
|
+
|
|
341
|
+
// Define your form schema with Zod
|
|
342
|
+
const loginSchema = z.object({
|
|
343
|
+
email: z.string().email('Please enter a valid email'),
|
|
344
|
+
password: z.string().min(8, 'Password must be at least 8 characters')
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
const LoginForm = () => (
|
|
348
|
+
<Form
|
|
349
|
+
schema={loginSchema}
|
|
350
|
+
onSubmit={(data) => console.log('Form submitted:', data)}
|
|
351
|
+
>
|
|
352
|
+
<TextField
|
|
353
|
+
name="email"
|
|
354
|
+
label="Email"
|
|
355
|
+
placeholder="Enter your email"
|
|
356
|
+
/>
|
|
357
|
+
<TextField
|
|
358
|
+
name="password"
|
|
359
|
+
type="password"
|
|
360
|
+
label="Password"
|
|
361
|
+
placeholder="Enter your password"
|
|
362
|
+
/>
|
|
363
|
+
<Button
|
|
364
|
+
type="submit"
|
|
365
|
+
variant="contained"
|
|
366
|
+
color="primary"
|
|
367
|
+
label="Sign In"
|
|
368
|
+
/>
|
|
369
|
+
</Form>
|
|
370
|
+
);
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Payment Method Panel
|
|
374
|
+
|
|
375
|
+
`PaymentMethodPanel` displays an empty or masked saved-payment state while your application owns the provider integration. It never collects or stores card credentials.
|
|
376
|
+
|
|
377
|
+
```tsx
|
|
378
|
+
import {PaymentMethodPanel} from '@nlabs/gothamui';
|
|
379
|
+
|
|
380
|
+
<PaymentMethodPanel
|
|
381
|
+
brand="Visa"
|
|
382
|
+
last4="4242"
|
|
383
|
+
onAdd={openPaymentProvider}
|
|
384
|
+
onRemove={removePaymentMethod}
|
|
385
|
+
/>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
Use `isAdding` and `isRemoving` to represent provider operations. See the [payment-method documentation](./src/docs/payments.md) for empty states, customization, props, and the security boundary.
|
|
389
|
+
|
|
390
|
+
### UI Components
|
|
391
|
+
|
|
392
|
+
```jsx
|
|
393
|
+
import { Button, Notify, Loader } from '@nlabs/gothamui';
|
|
394
|
+
|
|
395
|
+
// Stylish button with multiple variants
|
|
396
|
+
<Button
|
|
397
|
+
variant="contained" // 'contained', 'outlined', or 'text'
|
|
398
|
+
color="primary" // 'primary', 'secondary', 'success', 'error', etc.
|
|
399
|
+
size="md" // 'sm', 'md', or 'lg'
|
|
400
|
+
onClick={handleClick}
|
|
401
|
+
>
|
|
402
|
+
Click Me
|
|
403
|
+
</Button>
|
|
404
|
+
|
|
405
|
+
// Show notifications
|
|
406
|
+
<Notify
|
|
407
|
+
message="Operation completed successfully!"
|
|
408
|
+
severity="success" // 'success', 'info', 'warning', or 'error'
|
|
409
|
+
autoHideDuration={5000}
|
|
410
|
+
/>
|
|
411
|
+
|
|
412
|
+
// Loading indicator
|
|
413
|
+
<Loader size="md" />
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
### Markdown
|
|
417
|
+
|
|
418
|
+
`Markdown` is a lightweight wrapper around `react-markdown` for rendering inline or remote Markdown with optional template values:
|
|
419
|
+
|
|
420
|
+
```tsx
|
|
421
|
+
import {Markdown} from '@nlabs/gothamui';
|
|
422
|
+
|
|
423
|
+
<Markdown
|
|
424
|
+
content="# GothamUI {{version}}\nAll UI components are publicly exported."
|
|
425
|
+
values={{version: '1.5.4'}}
|
|
426
|
+
/>
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### Code Editor
|
|
430
|
+
|
|
431
|
+
`CodeEditor` is GothamUI's shared Monaco editor integration. Import it from the dedicated editor entry point so applications that do not use Monaco keep it out of their normal component imports:
|
|
432
|
+
|
|
433
|
+
```tsx
|
|
434
|
+
import {CodeEditor} from '@nlabs/gothamui/editor';
|
|
435
|
+
|
|
436
|
+
<CodeEditor
|
|
437
|
+
height="400px"
|
|
438
|
+
language="json"
|
|
439
|
+
options={{minimap: {enabled: false}, wordWrap: 'on'}}
|
|
440
|
+
value="{}"
|
|
441
|
+
/>
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Public Views
|
|
445
|
+
|
|
446
|
+
Every GothamUI view is part of the public package API. Import views from the package root or from the dedicated `views` entry point:
|
|
447
|
+
|
|
448
|
+
```tsx
|
|
449
|
+
import {DefaultView, Markdown} from '@nlabs/gothamui';
|
|
450
|
+
// Or: import {DefaultView} from '@nlabs/gothamui/views';
|
|
451
|
+
|
|
452
|
+
const ReleaseNotes = () => (
|
|
453
|
+
<DefaultView title="Release notes">
|
|
454
|
+
<Markdown content="# Release notes" />
|
|
455
|
+
</DefaultView>
|
|
456
|
+
);
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
The public view exports are `AuthSignInView`, `AuthSignUpView`, `AuthView`, `DefaultView`, `Gotham`, `GothamProvider`, `GothamRoot`, `HomeView`, `LoaderView`, `MenuView`, and `NotFoundView`.
|
|
460
|
+
|
|
461
|
+
## State Management
|
|
462
|
+
|
|
463
|
+
GothamUI uses ArkhamJS, a Flux implementation, for state management:
|
|
464
|
+
|
|
465
|
+
```jsx
|
|
466
|
+
import {useFlux} from '@nlabs/arkhamjs-utils-react';
|
|
467
|
+
import {GothamActions} from '@nlabs/gothamui';
|
|
468
|
+
|
|
469
|
+
const MyComponent = () => {
|
|
470
|
+
const flux = useFlux();
|
|
471
|
+
|
|
472
|
+
// Navigate to a new route
|
|
473
|
+
const handleNavigation = () => {
|
|
474
|
+
GothamActions.navGoto('/dashboard');
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
// Show a notification
|
|
478
|
+
const showNotification = () => {
|
|
479
|
+
GothamActions.notify({
|
|
480
|
+
message: 'This is a notification',
|
|
481
|
+
severity: 'info'
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
// Show/hide loading indicator
|
|
486
|
+
const startLoading = () => {
|
|
487
|
+
GothamActions.loading(true, 'Loading data...');
|
|
488
|
+
|
|
489
|
+
// After operation completes
|
|
490
|
+
setTimeout(() => {
|
|
491
|
+
GothamActions.loading(false);
|
|
492
|
+
}, 2000);
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
return (
|
|
496
|
+
<div>
|
|
497
|
+
<Button onClick={handleNavigation} label="Go to Dashboard" />
|
|
498
|
+
<Button onClick={showNotification} label="Show Notification" />
|
|
499
|
+
<Button onClick={startLoading} label="Start Loading" />
|
|
500
|
+
</div>
|
|
501
|
+
);
|
|
502
|
+
};
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
## Routing
|
|
506
|
+
|
|
507
|
+
GothamUI simplifies routing with React Router integration:
|
|
508
|
+
|
|
509
|
+
```jsx
|
|
510
|
+
const config = {
|
|
511
|
+
routes: [
|
|
512
|
+
{
|
|
513
|
+
path: '/',
|
|
514
|
+
element: <HomeView />,
|
|
515
|
+
props: {
|
|
516
|
+
// Props passed to the component
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
path: '/dashboard',
|
|
521
|
+
element: <DashboardView />,
|
|
522
|
+
authenticate: true, // Requires authentication
|
|
523
|
+
children: [
|
|
524
|
+
{
|
|
525
|
+
path: 'profile',
|
|
526
|
+
element: <ProfileView />
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
path: 'settings',
|
|
530
|
+
element: <SettingsView />
|
|
531
|
+
}
|
|
532
|
+
]
|
|
533
|
+
}
|
|
534
|
+
]
|
|
535
|
+
};
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
## Authentication
|
|
539
|
+
|
|
540
|
+
GothamUI provides built-in authentication support:
|
|
541
|
+
|
|
542
|
+
```jsx
|
|
543
|
+
const config = {
|
|
544
|
+
// Define authentication check function
|
|
545
|
+
isAuth: () => Boolean(localStorage.getItem('token')),
|
|
546
|
+
routes: [
|
|
547
|
+
{
|
|
548
|
+
path: '/protected',
|
|
549
|
+
element: <ProtectedView />,
|
|
550
|
+
authenticate: true // This route requires authentication
|
|
551
|
+
}
|
|
552
|
+
]
|
|
553
|
+
};
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
## Internationalization
|
|
557
|
+
|
|
558
|
+
Easy internationalization with i18next:
|
|
559
|
+
|
|
560
|
+
```jsx
|
|
561
|
+
const config = {
|
|
562
|
+
translations: {
|
|
563
|
+
en: {
|
|
564
|
+
greeting: 'Hello, {{name}}!',
|
|
565
|
+
buttons: {
|
|
566
|
+
submit: 'Submit'
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
es: {
|
|
570
|
+
greeting: '¡Hola, {{name}}!',
|
|
571
|
+
buttons: {
|
|
572
|
+
submit: 'Enviar'
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
// In your component
|
|
579
|
+
import {useTranslation} from '@nlabs/gothamui';
|
|
580
|
+
|
|
581
|
+
const MyComponent = () => {
|
|
582
|
+
const { t } = useTranslation();
|
|
583
|
+
|
|
584
|
+
return (
|
|
585
|
+
<div>
|
|
586
|
+
<h1>{t('greeting', { name: 'User' })}</h1>
|
|
587
|
+
<Button label={t('buttons.submit')} />
|
|
588
|
+
</div>
|
|
589
|
+
);
|
|
590
|
+
};
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
## Analytics
|
|
594
|
+
|
|
595
|
+
GothamUI can emit provider-neutral page views and UI events through an injected `awsRum` client. When paired with MetropolisJS, events are deduplicated, batched, and sent to a shared Reaktor analytics app.
|
|
596
|
+
|
|
597
|
+
```tsx
|
|
598
|
+
import {useAwsRum} from '@nlabs/gothamui';
|
|
599
|
+
|
|
600
|
+
const MyComponent = () => {
|
|
601
|
+
const awsRum = useAwsRum();
|
|
602
|
+
|
|
603
|
+
return (
|
|
604
|
+
<button onClick={() => awsRum?.track({name: 'signup', type: 'click'})}>
|
|
605
|
+
Sign up
|
|
606
|
+
</button>
|
|
607
|
+
);
|
|
608
|
+
};
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
Learn more in the [Analytics documentation](./src/docs/analytics.md).
|
|
612
|
+
|
|
613
|
+
## Theming
|
|
614
|
+
|
|
615
|
+
GothamUI supports light/dark mode and custom themes:
|
|
616
|
+
|
|
617
|
+
```jsx
|
|
618
|
+
const config = {
|
|
619
|
+
displayMode: 'dark', // 'light' or 'dark'
|
|
620
|
+
theme: {
|
|
621
|
+
// Custom theme properties
|
|
622
|
+
colors: {
|
|
623
|
+
primary: '#3f51b5',
|
|
624
|
+
secondary: '#f50057'
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
## Configuration
|
|
631
|
+
|
|
632
|
+
GothamUI is highly configurable:
|
|
633
|
+
|
|
634
|
+
```jsx
|
|
635
|
+
const config = {
|
|
636
|
+
app: {
|
|
637
|
+
name: 'my-app',
|
|
638
|
+
title: 'My Application',
|
|
639
|
+
logo: '/logo.svg',
|
|
640
|
+
titleBarSeparator: '|'
|
|
641
|
+
},
|
|
642
|
+
baseUrl: '',
|
|
643
|
+
storageType: 'local', // 'local' or 'session'
|
|
644
|
+
middleware: [customMiddleware],
|
|
645
|
+
stores: [customStore],
|
|
646
|
+
onInit: () => {
|
|
647
|
+
// Custom initialization logic
|
|
648
|
+
console.log('App initialized');
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
## Why Choose GothamUI?
|
|
654
|
+
|
|
655
|
+
- **UI Consistency**: Create visually cohesive applications with a unified design language
|
|
656
|
+
- **Developer Experience**: Spend less time wiring up libraries and more time building features
|
|
657
|
+
- **Reduced Bundle Size**: One framework instead of multiple libraries means optimized bundle size
|
|
658
|
+
- **Seamless Transitions**: Built-in animations and transitions between routes and UI states
|
|
659
|
+
- **Accessibility**: Components designed with accessibility in mind from the start
|
|
660
|
+
- **Rapid Development**: Go from concept to production with significantly less boilerplate code
|
|
661
|
+
- **TypeScript Support**: Full type definitions for enhanced developer experience
|
|
662
|
+
|
|
663
|
+
## Learn More
|
|
664
|
+
|
|
665
|
+
Visit our [official documentation](https://gothamui.nitrogenx.co) for comprehensive guides, API references, and examples.
|
|
666
|
+
|
|
667
|
+
## Using with Lex
|
|
668
|
+
|
|
669
|
+
GothamUI works seamlessly with [Lex](https://github.com/nitrogenlabs/lex), Nitrogen Labs' build and development toolkit. Lex provides optimized building, testing, and development workflows for projects using GothamUI.
|
|
670
|
+
|
|
671
|
+
### Installation
|
|
672
|
+
|
|
673
|
+
```bash
|
|
674
|
+
# Install Lex globally
|
|
675
|
+
npm install -g @nlabs/lex
|
|
676
|
+
|
|
677
|
+
# Or install locally in your project
|
|
678
|
+
npm install --save-dev @nlabs/lex
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
### Lex Project Configuration
|
|
682
|
+
|
|
683
|
+
Create a `lex.config.mjs` file in your project root:
|
|
684
|
+
|
|
685
|
+
```js
|
|
686
|
+
export default {
|
|
687
|
+
entryJs: 'src/index.tsx', // Your main entry point
|
|
688
|
+
outputPath: './dist', // Build output directory
|
|
689
|
+
useTypescript: true, // Enable TypeScript support
|
|
690
|
+
jest: {
|
|
691
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
692
|
+
testEnvironment: 'jsdom'
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
### Development Workflow
|
|
698
|
+
|
|
699
|
+
```bash
|
|
700
|
+
# Start development server with hot reload
|
|
701
|
+
lex dev
|
|
702
|
+
|
|
703
|
+
# Build for production
|
|
704
|
+
lex compile
|
|
705
|
+
|
|
706
|
+
# Run tests
|
|
707
|
+
lex test
|
|
708
|
+
|
|
709
|
+
# Lint and fix code
|
|
710
|
+
lex lint --fix
|
|
711
|
+
|
|
712
|
+
# Update dependencies
|
|
713
|
+
lex update --interactive
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
### Integration with GothamUI
|
|
717
|
+
|
|
718
|
+
Lex automatically detects GothamUI projects and configures Tailwind CSS integration. Your `lex.config.mjs` will include:
|
|
719
|
+
|
|
720
|
+
```js
|
|
721
|
+
export default {
|
|
722
|
+
// ... other config
|
|
723
|
+
tailwindCssPath: './src/styles/main.css', // Your main CSS file
|
|
724
|
+
};
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
### Build Optimization
|
|
728
|
+
|
|
729
|
+
Lex optimizes GothamUI builds by:
|
|
730
|
+
|
|
731
|
+
- **Tree Shaking**: Removes unused GothamUI components from your bundle
|
|
732
|
+
- **CSS Optimization**: Processes Tailwind CSS with GothamUI theme variables
|
|
733
|
+
- **TypeScript Compilation**: Optimized compilation with proper type checking
|
|
734
|
+
- **Asset Handling**: Automatic copying of GothamUI assets and fonts
|
|
735
|
+
|
|
736
|
+
### Example Project Structure
|
|
737
|
+
|
|
738
|
+
```text
|
|
739
|
+
my-gothamui-app/
|
|
740
|
+
├── src/
|
|
741
|
+
│ ├── index.tsx
|
|
742
|
+
│ ├── App.tsx
|
|
743
|
+
│ ├── styles/
|
|
744
|
+
│ │ └── main.css
|
|
745
|
+
│ └── components/
|
|
746
|
+
├── lex.config.mjs
|
|
747
|
+
├── package.json
|
|
748
|
+
└── tsconfig.json
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
### CSS Setup with Lex
|
|
752
|
+
|
|
753
|
+
In your `src/styles/main.css`:
|
|
754
|
+
|
|
755
|
+
```css
|
|
756
|
+
@import '@nlabs/gothamui/styles/tailwind.css';
|
|
757
|
+
|
|
758
|
+
/* Your custom styles */
|
|
759
|
+
@theme {
|
|
760
|
+
/* Override GothamUI theme variables if needed */
|
|
761
|
+
}
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
Lex will automatically process this CSS file and include it in your build output.
|
|
765
|
+
|
|
766
|
+
## License
|
|
767
|
+
|
|
768
|
+
GothamUI is [MIT licensed](./LICENSE).
|