@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
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# AWS RUM Analytics
|
|
2
|
+
|
|
3
|
+
GothamUI emits analytics through its browser analytics channel by default. When an application is wrapped by both Gotham and Metropolis, Metropolis automatically receives these events and delivers them to Reaktor. Gotham does not load an analytics SDK or send network requests by itself.
|
|
4
|
+
|
|
5
|
+
For local demos or troubleshooting, use the debug adapter to inspect the exact event passed to the analytics client:
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import {createAwsRumDebugClient} from '@nlabs/gothamui';
|
|
9
|
+
|
|
10
|
+
const awsRum = createAwsRumDebugClient({
|
|
11
|
+
enabled: import.meta.env.DEV,
|
|
12
|
+
target: metropolisAwsRum
|
|
13
|
+
});
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
When enabled, the adapter logs `[GothamUI] awsRum.track` and the event object. If a `target` is supplied, the same object is then forwarded for Metropolis delivery. Omitting `target` is useful for a console-only component demo.
|
|
17
|
+
|
|
18
|
+
## Plug-and-play configuration
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import {Gotham} from '@nlabs/gothamui';
|
|
22
|
+
import {Metropolis} from '@nlabs/metropolisjs';
|
|
23
|
+
|
|
24
|
+
root.render(
|
|
25
|
+
<Metropolis config={metropolisConfig}>
|
|
26
|
+
<Gotham config={{routes}} />
|
|
27
|
+
</Metropolis>
|
|
28
|
+
);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Set an application name and the shared Reaktor endpoint in Metropolis. The application name becomes the default analytics `appId`; `app.rum.appId` can override it:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
const metropolisConfig = {
|
|
35
|
+
production: {
|
|
36
|
+
app: {
|
|
37
|
+
api: {
|
|
38
|
+
rum: 'https://analytics.example.com/public'
|
|
39
|
+
},
|
|
40
|
+
name: 'my-app',
|
|
41
|
+
rum: {
|
|
42
|
+
respectPrivacySignals: true
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If `app.api.rum` is omitted, Metropolis uses its configured public endpoint. Every application uses the same endpoint and supplies its own `appId`. This allows a future dashboard to filter the shared log collection by application.
|
|
50
|
+
|
|
51
|
+
## Page views
|
|
52
|
+
|
|
53
|
+
Gotham automatically calls `awsRum.track()` once when the route changes. Add stable analytics metadata so dynamic identifiers and titles never become dimensions:
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
const routes = [{
|
|
57
|
+
analytics: {route: '/stories/:storyId', title: 'Story', viewId: 'story.detail'},
|
|
58
|
+
element: <StoryView />,
|
|
59
|
+
path: 'stories/:storyId'
|
|
60
|
+
}];
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## View performance
|
|
64
|
+
|
|
65
|
+
Use one terminal measurement instead of separate start/end beacons. A measurement starts when a view begins loading and finishes with exactly one outcome: `success`, `failure`, `timeout`, or `cancelled`. Gotham emits the resulting `view_performance` event; Metropolis handles delivery.
|
|
66
|
+
|
|
67
|
+
### React views
|
|
68
|
+
|
|
69
|
+
Call `useViewPerformance()` inside the view being measured. Keep its status `pending` while required content is loading, then change it to `success` or `failure` when the view reaches a terminal state.
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import {useViewPerformance} from '@nlabs/gothamui';
|
|
73
|
+
|
|
74
|
+
interface StoryViewProps {
|
|
75
|
+
readonly error?: Error;
|
|
76
|
+
readonly loading: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const StoryView = ({error, loading}: StoryViewProps) => {
|
|
80
|
+
useViewPerformance({
|
|
81
|
+
route: '/stories/:storyId',
|
|
82
|
+
status: error ? 'failure' : loading ? 'pending' : 'success',
|
|
83
|
+
title: 'Story',
|
|
84
|
+
viewId: 'story.detail'
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if(error) {
|
|
88
|
+
return <p>Unable to load this story.</p>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if(loading) {
|
|
92
|
+
return <p>Loading story…</p>;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return <article>Story content</article>;
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Options:
|
|
100
|
+
|
|
101
|
+
- `viewId` is required. Use a stable product identifier such as `story.detail`, never a database ID or URL.
|
|
102
|
+
- `status` is required and must be `pending`, `success`, or `failure`.
|
|
103
|
+
- `route` should be a stable route template such as `/stories/:storyId`, not the current dynamic pathname.
|
|
104
|
+
- `title` is an optional stable display name for the view.
|
|
105
|
+
- `timeoutMs` defaults to 30 seconds. Set it to `0` or a negative value to disable the automatic timeout.
|
|
106
|
+
|
|
107
|
+
The hook starts a new measurement when `awsRum`, `route`, `timeoutMs`, `title`, or `viewId` changes. It reports `cancelled` if the view unmounts or one of those values changes before completion. Once a measurement finishes, later status changes cannot emit a second event.
|
|
108
|
+
|
|
109
|
+
### Non-React lifecycles
|
|
110
|
+
|
|
111
|
+
`startView()` only measures time; it does not send analytics by itself. Supply an `onComplete` callback and pass the completed measurement to `reportViewPerformance()`:
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
import {
|
|
115
|
+
createAwsRumBrowserClient,
|
|
116
|
+
reportViewPerformance,
|
|
117
|
+
startView
|
|
118
|
+
} from '@nlabs/gothamui';
|
|
119
|
+
|
|
120
|
+
const awsRum = createAwsRumBrowserClient();
|
|
121
|
+
|
|
122
|
+
export const loadStory = async () => {
|
|
123
|
+
const view = startView({
|
|
124
|
+
onComplete: (measurement) => reportViewPerformance(awsRum, measurement),
|
|
125
|
+
route: '/stories/:storyId',
|
|
126
|
+
timeoutMs: 10_000,
|
|
127
|
+
title: 'Story',
|
|
128
|
+
viewId: 'story.detail'
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
const story = await loadStoryData();
|
|
133
|
+
view.succeed();
|
|
134
|
+
return story;
|
|
135
|
+
} catch(error) {
|
|
136
|
+
view.fail();
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The returned handle provides four terminal methods:
|
|
143
|
+
|
|
144
|
+
- `succeed()` records `success`.
|
|
145
|
+
- `fail()` records `failure`.
|
|
146
|
+
- `timeout()` records `timeout` immediately; the configured timer does this automatically when it expires.
|
|
147
|
+
- `cancel()` records `cancelled`, typically when navigation abandons unfinished work.
|
|
148
|
+
|
|
149
|
+
Only the first terminal method has an effect. Later calls are ignored and the timeout is cleared.
|
|
150
|
+
|
|
151
|
+
### Event payload
|
|
152
|
+
|
|
153
|
+
Gotham sends the completed measurement in this shape:
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
{
|
|
157
|
+
name: 'view_performance',
|
|
158
|
+
path: '/stories/:storyId',
|
|
159
|
+
properties: {
|
|
160
|
+
durationMs: 842,
|
|
161
|
+
outcome: 'success',
|
|
162
|
+
viewId: 'story.detail',
|
|
163
|
+
viewTitle: 'Story'
|
|
164
|
+
},
|
|
165
|
+
type: 'view_performance'
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
`path` and `viewTitle` are omitted when `route` and `title` are not supplied. `durationMs` is rounded to a non-negative whole number. Keep all identifiers stable and free of names, account IDs, query strings, or other identifying information.
|
|
170
|
+
|
|
171
|
+
## Automatic interaction tracking
|
|
172
|
+
|
|
173
|
+
Gotham automatically tracks semantic interactive elements rendered anywhere in the document while `GothamProvider` is mounted. This includes links, buttons, form controls, sliders, switches, tabs, menu items, editable regions, and keyboard-only form submissions. Delegated listeners also cover elements rendered later or in portals.
|
|
174
|
+
|
|
175
|
+
Interaction events contain only the control type, interaction type, and current pathname. Gotham never reads visible text, URLs, query strings, or control values. Give important interactions a stable event name with `data-analytics-name`:
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
<button data-analytics-name="checkout_started">Checkout</button>
|
|
179
|
+
<input data-analytics-name="volume_changed" type="range" />
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Use `data-analytics-track="false"` on a control or container for a private region that must not emit interaction events:
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
<section data-analytics-track="false">...</section>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Automatic interaction tracking is enabled by default. It can be disabled application-wide when an application provides its own delegated tracker:
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
<Gotham config={{analytics: {interactions: false}}} />
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Custom events
|
|
195
|
+
|
|
196
|
+
Use `useAwsRum()` for domain events that need additional stable properties:
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
import {useAwsRum} from '@nlabs/gothamui';
|
|
200
|
+
|
|
201
|
+
export const SignupButton = () => {
|
|
202
|
+
const awsRum = useAwsRum();
|
|
203
|
+
|
|
204
|
+
const onClick = () => {
|
|
205
|
+
awsRum?.track({
|
|
206
|
+
name: 'signup_started',
|
|
207
|
+
path: window.location.pathname,
|
|
208
|
+
properties: {placement: 'header'},
|
|
209
|
+
type: 'click'
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
return <button onClick={onClick}>Sign up</button>;
|
|
214
|
+
};
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Properties must be strings, numbers, or booleans. Do not include names, email addresses, form values, account IDs, query strings, or other identifying information.
|
|
218
|
+
|
|
219
|
+
## Delivery behavior
|
|
220
|
+
|
|
221
|
+
Metropolis:
|
|
222
|
+
|
|
223
|
+
- Generates a memory-only journey ID that resets with the application runtime.
|
|
224
|
+
- Adds an event ID, timestamp, and sequence number.
|
|
225
|
+
- Suppresses identical events during the deduplication window.
|
|
226
|
+
- Debounces events into batches.
|
|
227
|
+
- Throttles requests to the shared endpoint.
|
|
228
|
+
- Sends JSON through Rip-Hunter.
|
|
229
|
+
- Dispatches `AWS_RUM_TRACK_QUEUED`, `AWS_RUM_TRACK_SUCCESS`, and `AWS_RUM_TRACK_ERROR` Flux events.
|
|
230
|
+
|
|
231
|
+
The shared Reaktor mutation stores standalone `logs` documents. Each document contains `appId`; no graph edge is required.
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# GothamUI API Reference
|
|
2
|
+
|
|
3
|
+
This document provides detailed information about the components and APIs available in GothamUI.
|
|
4
|
+
|
|
5
|
+
## Core Components
|
|
6
|
+
|
|
7
|
+
### `<Gotham>`
|
|
8
|
+
|
|
9
|
+
The main component that bootstraps your GothamUI application.
|
|
10
|
+
|
|
11
|
+
**Props:**
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
|------|------|---------|-------------|
|
|
15
|
+
| `config` | `GothamConfiguration` | `{}` | Configuration object for the application |
|
|
16
|
+
| `children` | `ReactNode` | - | Optional child components |
|
|
17
|
+
| `classes` | `Record<string, string>` | - | Custom CSS classes |
|
|
18
|
+
| `isAuth` | `() => boolean` | - | Authentication check function |
|
|
19
|
+
|
|
20
|
+
**Example:**
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
import { Gotham } from '@nlabs/gothamui';
|
|
24
|
+
|
|
25
|
+
const config = {
|
|
26
|
+
app: {
|
|
27
|
+
name: 'my-app',
|
|
28
|
+
title: 'My Application'
|
|
29
|
+
},
|
|
30
|
+
routes: [
|
|
31
|
+
// Your routes
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const App = () => (
|
|
36
|
+
<Gotham config={config} />
|
|
37
|
+
);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### `<GothamProvider>`
|
|
41
|
+
|
|
42
|
+
Provider component that sets up the GothamUI context.
|
|
43
|
+
|
|
44
|
+
**Props:**
|
|
45
|
+
|
|
46
|
+
| Prop | Type | Default | Description |
|
|
47
|
+
|------|------|---------|-------------|
|
|
48
|
+
| `config` | `GothamConfiguration` | Required | Configuration object for the application |
|
|
49
|
+
| `children` | `ReactNode` | - | Child components |
|
|
50
|
+
| `session` | `Record<string, unknown>` | `{}` | Initial session data |
|
|
51
|
+
|
|
52
|
+
## Public Views
|
|
53
|
+
|
|
54
|
+
All GothamUI views are public from both `@nlabs/gothamui` and `@nlabs/gothamui/views`.
|
|
55
|
+
|
|
56
|
+
| View | Purpose |
|
|
57
|
+
|------|---------|
|
|
58
|
+
| `AuthSignInView` | Complete sign-in screen built on `AuthView` |
|
|
59
|
+
| `AuthSignUpView` | Complete account-registration screen built on `AuthView` |
|
|
60
|
+
| `AuthView` | Shared authentication layout |
|
|
61
|
+
| `DefaultView` | Responsive application shell with standard navigation |
|
|
62
|
+
| `Gotham` | GothamUI application bootstrap component |
|
|
63
|
+
| `GothamProvider` | Configuration, session, and Flux provider |
|
|
64
|
+
| `GothamRoot` | Root route outlet with notifications, loading state, and analytics |
|
|
65
|
+
| `HomeView` | Responsive home-page shell |
|
|
66
|
+
| `LoaderView` | Flux-connected full-screen loading state |
|
|
67
|
+
| `MenuView` | Responsive sidebar application shell |
|
|
68
|
+
| `NotFoundView` | Full-page missing-route view |
|
|
69
|
+
|
|
70
|
+
## Form Components
|
|
71
|
+
|
|
72
|
+
### `<Form>`
|
|
73
|
+
|
|
74
|
+
Form component with built-in validation using Zod.
|
|
75
|
+
|
|
76
|
+
**Props:**
|
|
77
|
+
|
|
78
|
+
| Prop | Type | Default | Description |
|
|
79
|
+
|------|------|---------|-------------|
|
|
80
|
+
| `children` | `ReactNode` | Required | Form fields and controls |
|
|
81
|
+
| `className` | `string` | - | Custom CSS class |
|
|
82
|
+
| `defaultValues` | `Record<string, unknown>` | `{}` | Default form values |
|
|
83
|
+
| `mode` | `'onSubmit'` \| `'onBlur'` \| `'onChange'` \| `'onTouched'` \| `'all'` | `'onBlur'` | Form validation mode |
|
|
84
|
+
| `name` | `string` | `'default'` | Form name (used for test IDs) |
|
|
85
|
+
| `onChange` | `(data: unknown) => void` | - | Change handler |
|
|
86
|
+
| `onSubmit` | `(data: unknown, event: BaseSyntheticEvent, setError: (field: string, error: { type: string; message: string }) => void) => void` | Required | Submit handler |
|
|
87
|
+
| `schema` | `z.ZodSchema<Record<string, unknown>>` | - | Zod validation schema |
|
|
88
|
+
| `validate` | `(data: unknown) => void` | - | Custom validation function |
|
|
89
|
+
| `validateOnBlur` | `boolean` | - | Whether to validate on blur |
|
|
90
|
+
|
|
91
|
+
**Example:**
|
|
92
|
+
|
|
93
|
+
```jsx
|
|
94
|
+
import { Form, TextField, Button } from '@nlabs/gothamui';
|
|
95
|
+
import { z } from 'zod';
|
|
96
|
+
|
|
97
|
+
const schema = z.object({
|
|
98
|
+
email: z.string().email(),
|
|
99
|
+
password: z.string().min(8)
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const LoginForm = () => (
|
|
103
|
+
<Form
|
|
104
|
+
schema={schema}
|
|
105
|
+
onSubmit={(data) => console.log(data)}
|
|
106
|
+
defaultValues={{ email: '', password: '' }}
|
|
107
|
+
>
|
|
108
|
+
<TextField name="email" label="Email" />
|
|
109
|
+
<TextField name="password" type="password" label="Password" />
|
|
110
|
+
<Button type="submit" label="Submit" />
|
|
111
|
+
</Form>
|
|
112
|
+
);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `<TextField>`
|
|
116
|
+
|
|
117
|
+
Text input component.
|
|
118
|
+
|
|
119
|
+
**Props:**
|
|
120
|
+
|
|
121
|
+
| Prop | Type | Default | Description |
|
|
122
|
+
|------|------|---------|-------------|
|
|
123
|
+
| `className` | `string` | - | Custom CSS class |
|
|
124
|
+
| `disabled` | `boolean` | `false` | Whether the field is disabled |
|
|
125
|
+
| `error` | `string` | - | Error message |
|
|
126
|
+
| `id` | `string` | - | Field ID |
|
|
127
|
+
| `label` | `string` | - | Field label |
|
|
128
|
+
| `name` | `string` | Required | Field name |
|
|
129
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Change handler |
|
|
130
|
+
| `placeholder` | `string` | - | Placeholder text |
|
|
131
|
+
| `required` | `boolean` | `false` | Whether the field is required |
|
|
132
|
+
| `type` | `'text'` \| `'password'` \| `'email'` \| `'number'` \| `'tel'` | `'text'` | Input type |
|
|
133
|
+
| `value` | `string` | - | Field value |
|
|
134
|
+
|
|
135
|
+
### `<SelectField>`
|
|
136
|
+
|
|
137
|
+
Dropdown select component.
|
|
138
|
+
|
|
139
|
+
**Props:**
|
|
140
|
+
|
|
141
|
+
| Prop | Type | Default | Description |
|
|
142
|
+
|------|------|---------|-------------|
|
|
143
|
+
| `className` | `string` | - | Custom CSS class |
|
|
144
|
+
| `disabled` | `boolean` | `false` | Whether the field is disabled |
|
|
145
|
+
| `error` | `string` | - | Error message |
|
|
146
|
+
| `id` | `string` | - | Field ID |
|
|
147
|
+
| `label` | `string` | - | Field label |
|
|
148
|
+
| `name` | `string` | Required | Field name |
|
|
149
|
+
| `onChange` | `(event: ChangeEvent<HTMLSelectElement>) => void` | - | Change handler |
|
|
150
|
+
| `options` | `Array<{ label: string; value: string }>` | `[]` | Select options |
|
|
151
|
+
| `placeholder` | `string` | - | Placeholder text |
|
|
152
|
+
| `required` | `boolean` | `false` | Whether the field is required |
|
|
153
|
+
| `value` | `string` | - | Field value |
|
|
154
|
+
|
|
155
|
+
### `<RadioField>`
|
|
156
|
+
|
|
157
|
+
Radio button group component.
|
|
158
|
+
|
|
159
|
+
**Props:**
|
|
160
|
+
|
|
161
|
+
| Prop | Type | Default | Description |
|
|
162
|
+
|------|------|---------|-------------|
|
|
163
|
+
| `className` | `string` | - | Custom CSS class |
|
|
164
|
+
| `disabled` | `boolean` | `false` | Whether the field is disabled |
|
|
165
|
+
| `error` | `string` | - | Error message |
|
|
166
|
+
| `id` | `string` | - | Field ID |
|
|
167
|
+
| `label` | `string` | - | Field label |
|
|
168
|
+
| `name` | `string` | Required | Field name |
|
|
169
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Change handler |
|
|
170
|
+
| `options` | `Array<{ label: string; value: string }>` | `[]` | Radio options |
|
|
171
|
+
| `required` | `boolean` | `false` | Whether the field is required |
|
|
172
|
+
| `value` | `string` | - | Field value |
|
|
173
|
+
|
|
174
|
+
### `<DateField>`
|
|
175
|
+
|
|
176
|
+
Date picker component.
|
|
177
|
+
|
|
178
|
+
**Props:**
|
|
179
|
+
|
|
180
|
+
| Prop | Type | Default | Description |
|
|
181
|
+
|------|------|---------|-------------|
|
|
182
|
+
| `className` | `string` | - | Custom CSS class |
|
|
183
|
+
| `disabled` | `boolean` | `false` | Whether the field is disabled |
|
|
184
|
+
| `error` | `string` | - | Error message |
|
|
185
|
+
| `id` | `string` | - | Field ID |
|
|
186
|
+
| `label` | `string` | - | Field label |
|
|
187
|
+
| `name` | `string` | Required | Field name |
|
|
188
|
+
| `onChange` | `(date: Date) => void` | - | Change handler |
|
|
189
|
+
| `placeholder` | `string` | - | Placeholder text |
|
|
190
|
+
| `required` | `boolean` | `false` | Whether the field is required |
|
|
191
|
+
| `value` | `Date` | - | Field value |
|
|
192
|
+
|
|
193
|
+
## UI Components
|
|
194
|
+
|
|
195
|
+
### `<Markdown>`
|
|
196
|
+
|
|
197
|
+
Renders Markdown through `react-markdown` while providing GothamUI container styling, remote content loading, and template values.
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
import {Markdown} from '@nlabs/gothamui';
|
|
201
|
+
|
|
202
|
+
<Markdown
|
|
203
|
+
className="prose"
|
|
204
|
+
content="# Welcome, {{name}}"
|
|
205
|
+
values={{name: 'Bruce'}}
|
|
206
|
+
/>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
| Prop | Type | Default | Description |
|
|
210
|
+
|------|------|---------|-------------|
|
|
211
|
+
| `className` | `string` | `''` | Additional class names for the Markdown container |
|
|
212
|
+
| `content` | `string` | - | Inline Markdown content |
|
|
213
|
+
| `url` | `string` | - | URL whose response supplies the Markdown content |
|
|
214
|
+
| `values` | `Record<string, unknown>` | `{}` | Values substituted into the Markdown template |
|
|
215
|
+
|
|
216
|
+
### `<PaymentMethodPanel>`
|
|
217
|
+
|
|
218
|
+
Displays an empty or masked saved-payment state and delegates add, replace, and remove workflows to application callbacks. It does not collect or store payment credentials.
|
|
219
|
+
|
|
220
|
+
| Prop | Type | Default | Description |
|
|
221
|
+
|------|------|---------|-------------|
|
|
222
|
+
| `brand` | `string` | `''` | Display-safe payment brand |
|
|
223
|
+
| `isAdding` | `boolean` | `false` | Shows add or replace progress and disables actions |
|
|
224
|
+
| `isRemoving` | `boolean` | `false` | Shows removal progress and disables actions |
|
|
225
|
+
| `last4` | `string` | `''` | Last four display digits |
|
|
226
|
+
| `onAdd` | `() => void` | Required | Starts the provider-owned add or replace flow |
|
|
227
|
+
| `onRemove` | `() => void` | `undefined` | Starts removal and controls whether the remove action is shown |
|
|
228
|
+
|
|
229
|
+
See [Payment methods](./payments.md) for all props, examples, loading states, and security guidance.
|
|
230
|
+
|
|
231
|
+
### `<Button>`
|
|
232
|
+
|
|
233
|
+
Button component with multiple variants and states.
|
|
234
|
+
|
|
235
|
+
**Props:**
|
|
236
|
+
|
|
237
|
+
| Prop | Type | Default | Description |
|
|
238
|
+
|------|------|---------|-------------|
|
|
239
|
+
| `children` | `ReactNode` | - | Button content |
|
|
240
|
+
| `className` | `string` | - | Custom CSS class |
|
|
241
|
+
| `color` | `GothamColor` | `'primary'` | Button color |
|
|
242
|
+
| `disabled` | `boolean` | `false` | Whether the button is disabled |
|
|
243
|
+
| `hasNotification` | `boolean` | `false` | Show notification indicator |
|
|
244
|
+
| `hasShadow` | `boolean` | `false` | Show shadow effect |
|
|
245
|
+
| `icon` | `ReactNode` | - | Button icon |
|
|
246
|
+
| `isLoading` | `boolean` | `false` | Show loading spinner |
|
|
247
|
+
| `label` | `string` | `''` | Button label (used if children not provided) |
|
|
248
|
+
| `onClick` | `(event?: unknown) => void` | `() => {}` | Click handler |
|
|
249
|
+
| `size` | `'sm'` \| `'md'` \| `'lg'` | `'md'` | Button size |
|
|
250
|
+
| `tabIndex` | `number` | - | Tab index |
|
|
251
|
+
| `type` | `'button'` \| `'reset'` \| `'submit'` | `'button'` | Button type |
|
|
252
|
+
| `variant` | `'text'` \| `'contained'` \| `'outlined'` | - | Button variant |
|
|
253
|
+
|
|
254
|
+
### `<Loader>`
|
|
255
|
+
|
|
256
|
+
Loading indicator component.
|
|
257
|
+
|
|
258
|
+
**Props:**
|
|
259
|
+
|
|
260
|
+
| Prop | Type | Default | Description |
|
|
261
|
+
|------|------|---------|-------------|
|
|
262
|
+
| `className` | `string` | - | Custom CSS class |
|
|
263
|
+
| `color` | `string` | `'primary'` | Loader color |
|
|
264
|
+
| `content` | `string` | - | Loading message |
|
|
265
|
+
| `size` | `'sm'` \| `'md'` \| `'lg'` | `'md'` | Loader size |
|
|
266
|
+
|
|
267
|
+
### `<Notify>`
|
|
268
|
+
|
|
269
|
+
Notification component for displaying alerts and messages.
|
|
270
|
+
|
|
271
|
+
**Props:**
|
|
272
|
+
|
|
273
|
+
| Prop | Type | Default | Description |
|
|
274
|
+
|------|------|---------|-------------|
|
|
275
|
+
| `actions` | `Array<{ label: string; onClick: () => void }>` | `[]` | Action buttons |
|
|
276
|
+
| `anchorOrigin` | `{ horizontal: 'left' \| 'center' \| 'right', vertical: 'top' \| 'bottom' }` | `{ horizontal: 'center', vertical: 'bottom' }` | Position of the notification |
|
|
277
|
+
| `autoHideDuration` | `number` | `5000` | Auto-hide duration in milliseconds |
|
|
278
|
+
| `className` | `string` | - | Custom CSS class |
|
|
279
|
+
| `isOpen` | `boolean` | `false` | Whether the notification is open |
|
|
280
|
+
| `message` | `string` | Required | Notification message |
|
|
281
|
+
| `onClose` | `() => void` | - | Close handler |
|
|
282
|
+
| `severity` | `'success'` \| `'info'` \| `'warning'` \| `'error'` | `'info'` | Notification severity |
|
|
283
|
+
|
|
284
|
+
### `<Svg>`
|
|
285
|
+
|
|
286
|
+
SVG icon component.
|
|
287
|
+
|
|
288
|
+
**Props:**
|
|
289
|
+
|
|
290
|
+
| Prop | Type | Default | Description |
|
|
291
|
+
|------|------|---------|-------------|
|
|
292
|
+
| `className` | `string` | - | Custom CSS class |
|
|
293
|
+
| `color` | `string` | - | Icon color |
|
|
294
|
+
| `height` | `number` | - | Icon height |
|
|
295
|
+
| `name` | `string` | Required | Icon name |
|
|
296
|
+
| `width` | `number` | - | Icon width |
|
|
297
|
+
|
|
298
|
+
## Navigation Components
|
|
299
|
+
|
|
300
|
+
### `<GothamRoute>`
|
|
301
|
+
|
|
302
|
+
Route component for defining routes with authentication.
|
|
303
|
+
|
|
304
|
+
**Props:**
|
|
305
|
+
|
|
306
|
+
| Prop | Type | Default | Description |
|
|
307
|
+
|------|------|---------|-------------|
|
|
308
|
+
| `authenticate` | `boolean` | `false` | Whether the route requires authentication |
|
|
309
|
+
| `element` | `ReactElement` | Required | Component to render |
|
|
310
|
+
| `path` | `string` | Required | Route path |
|
|
311
|
+
|
|
312
|
+
### `<AuthRoute>`
|
|
313
|
+
|
|
314
|
+
Route component that handles authentication redirects.
|
|
315
|
+
|
|
316
|
+
**Props:**
|
|
317
|
+
|
|
318
|
+
| Prop | Type | Default | Description |
|
|
319
|
+
|------|------|---------|-------------|
|
|
320
|
+
| `authenticate` | `boolean` | `false` | Whether the route requires authentication |
|
|
321
|
+
| `element` | `ReactElement` | Required | Component to render |
|
|
322
|
+
| `path` | `string` | Required | Route path |
|
|
323
|
+
|
|
324
|
+
## Configuration Types
|
|
325
|
+
|
|
326
|
+
### `GothamConfiguration`
|
|
327
|
+
|
|
328
|
+
Configuration object for GothamUI applications.
|
|
329
|
+
|
|
330
|
+
| Property | Type | Default | Description |
|
|
331
|
+
|----------|------|---------|-------------|
|
|
332
|
+
| `app` | `{ logo?: string; name?: string; title?: string; titleBarSeparator?: string; }` | `{ name: 'gotham', title: 'GothamUI' }` | Application metadata |
|
|
333
|
+
| `baseUrl` | `string` | `''` | Base URL for the application |
|
|
334
|
+
| `config` | `FluxOptions` | - | Flux configuration options |
|
|
335
|
+
| `displayMode` | `'light'` \| `'dark'` | - | Theme display mode |
|
|
336
|
+
| `flux` | `FluxFramework` | - | Custom Flux instance |
|
|
337
|
+
| `isAuth` | `() => boolean` | `() => false` | Authentication check function |
|
|
338
|
+
| `middleware` | `FluxMiddlewareType[]` | `[]` | Flux middleware |
|
|
339
|
+
| `onInit` | `() => void` | - | Initialization callback |
|
|
340
|
+
| `routes` | `GothamRouteData[]` | `[]` | Application routes |
|
|
341
|
+
| `storageType` | `'local'` \| `'session'` | `'session'` | Storage type for persisted state |
|
|
342
|
+
| `stores` | `unknown[]` | `[]` | Additional Flux stores |
|
|
343
|
+
| `theme` | `Record<string, unknown>` | `{}` | Theme configuration |
|
|
344
|
+
| `translations` | `Record<string, unknown>` | `{ translation: {} }` | i18n translations |
|
|
345
|
+
|
|
346
|
+
## Actions
|
|
347
|
+
|
|
348
|
+
### `GothamActions`
|
|
349
|
+
|
|
350
|
+
Action creators for common operations.
|
|
351
|
+
|
|
352
|
+
| Method | Parameters | Description |
|
|
353
|
+
|--------|------------|-------------|
|
|
354
|
+
| `init` | `() => Promise<FluxAction>` | Initialize the application |
|
|
355
|
+
| `loading` | `(isLoading: boolean, content?: string) => Promise<FluxAction>` | Show/hide loading indicator |
|
|
356
|
+
| `navBack` | `() => Promise<FluxAction>` | Navigate back |
|
|
357
|
+
| `navForward` | `() => Promise<FluxAction>` | Navigate forward |
|
|
358
|
+
| `navGoto` | `(path: string, params?: Record<string, unknown>) => Promise<FluxAction>` | Navigate to a path |
|
|
359
|
+
| `navReplace` | `(path: string, params?: Record<string, unknown>) => Promise<FluxAction>` | Replace current route |
|
|
360
|
+
| `notify` | `(params: GothamNotifyParams) => Promise<FluxAction>` | Show notification |
|
|
361
|
+
| `notifyClose` | `() => Promise<FluxAction>` | Close notification |
|
|
362
|
+
| `setConfig` | `(config: GothamConfiguration) => Promise<FluxAction>` | Update configuration |
|
|
363
|
+
| `signOut` | `() => Promise<FluxAction>` | Sign out user |
|
|
364
|
+
| `updateTitle` | `(title: string, separator?: string) => Promise<FluxAction>` | Update page title |
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# GothamUI vs Other Frameworks
|
|
2
|
+
|
|
3
|
+
This comparison highlights the key differences between GothamUI and other popular React frameworks.
|
|
4
|
+
|
|
5
|
+
## Feature Comparison
|
|
6
|
+
|
|
7
|
+
| Feature | GothamUI | Next.js | Create React App | Gatsby |
|
|
8
|
+
|---------|----------|---------|-----------------|--------|
|
|
9
|
+
| **Setup Complexity** | Low | Medium | Low | Medium |
|
|
10
|
+
| **Routing** | Built-in (React Router) | Built-in (File-based) | Requires react-router | Built-in (Gatsby Router) |
|
|
11
|
+
| **State Management** | Built-in (ArkhamJS/Flux) | External (Redux, etc.) | External (Redux, etc.) | External (Redux, etc.) |
|
|
12
|
+
| **Form Handling** | Built-in (React Hook Form + Zod) | External | External | External |
|
|
13
|
+
| **UI Components** | Built-in | External | External | External |
|
|
14
|
+
| **Internationalization** | Built-in (i18next) | External | External | External |
|
|
15
|
+
| **Authentication** | Built-in | External | External | External |
|
|
16
|
+
| **Notifications** | Built-in | External | External | External |
|
|
17
|
+
| **SSR/SSG Support** | No | Yes | No | Yes |
|
|
18
|
+
| **Development Experience** | Streamlined | Comprehensive | Basic | Comprehensive |
|
|
19
|
+
| **Bundle Size** | Medium | Large | Small | Large |
|
|
20
|
+
| **Learning Curve** | Gentle | Steep | Gentle | Steep |
|
|
21
|
+
| **Customization** | High | High | Medium | Medium |
|
|
22
|
+
| **Community Size** | Small | Very Large | Very Large | Large |
|
|
23
|
+
|
|
24
|
+
## When to Choose GothamUI
|
|
25
|
+
|
|
26
|
+
### Choose GothamUI when:
|
|
27
|
+
|
|
28
|
+
- You want a complete, ready-to-use React framework with minimal configuration
|
|
29
|
+
- You prefer a Flux-based state management approach
|
|
30
|
+
- You need built-in form handling with validation
|
|
31
|
+
- You want a consistent UI component library out of the box
|
|
32
|
+
- You're building a client-side application with authentication needs
|
|
33
|
+
- You value developer experience and want to minimize boilerplate code
|
|
34
|
+
|
|
35
|
+
### Choose Next.js when:
|
|
36
|
+
|
|
37
|
+
- You need server-side rendering (SSR) or static site generation (SSG)
|
|
38
|
+
- You want file-based routing
|
|
39
|
+
- You need advanced deployment options (Vercel integration)
|
|
40
|
+
- You're building a large-scale application with a large team
|
|
41
|
+
- You need API routes built into your application
|
|
42
|
+
|
|
43
|
+
### Choose Create React App when:
|
|
44
|
+
|
|
45
|
+
- You want a minimal React setup with maximum flexibility
|
|
46
|
+
- You prefer to add libraries as needed
|
|
47
|
+
- You're building a simple client-side application
|
|
48
|
+
- You're learning React and want to start with the basics
|
|
49
|
+
|
|
50
|
+
### Choose Gatsby when:
|
|
51
|
+
|
|
52
|
+
- You're building a static website or blog
|
|
53
|
+
- You need excellent image optimization
|
|
54
|
+
- You want to use GraphQL for data fetching
|
|
55
|
+
- You need a large plugin ecosystem
|
|
56
|
+
- You're building a content-heavy site
|
|
57
|
+
|
|
58
|
+
## Migration Path
|
|
59
|
+
|
|
60
|
+
If you're considering migrating to GothamUI from another framework, here's what you need to know:
|
|
61
|
+
|
|
62
|
+
### From Create React App to GothamUI
|
|
63
|
+
|
|
64
|
+
1. Install GothamUI and its dependencies
|
|
65
|
+
2. Replace your root component with `<Gotham>`
|
|
66
|
+
3. Configure your routes in the GothamUI config object
|
|
67
|
+
4. Migrate your state management to ArkhamJS
|
|
68
|
+
5. Replace form components with GothamUI form components
|
|
69
|
+
6. Replace UI components with GothamUI components
|
|
70
|
+
|
|
71
|
+
### From Next.js to GothamUI
|
|
72
|
+
|
|
73
|
+
1. Install GothamUI and its dependencies
|
|
74
|
+
2. Convert file-based routing to GothamUI route configuration
|
|
75
|
+
3. Migrate server-side logic to API endpoints or serverless functions
|
|
76
|
+
4. Migrate state management to ArkhamJS
|
|
77
|
+
5. Replace UI components with GothamUI components
|
|
78
|
+
|
|
79
|
+
## Conclusion
|
|
80
|
+
|
|
81
|
+
GothamUI offers a comprehensive solution for React applications with a focus on developer experience and productivity. While it may not have the large ecosystem of Next.js or the SSR capabilities of Gatsby, it excels at providing a complete, ready-to-use framework for client-side applications with minimal configuration.
|
|
82
|
+
|
|
83
|
+
By combining routing, state management, form handling, and UI components in a single package, GothamUI allows developers to focus on building features rather than configuring tools and libraries.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Containers
|
|
2
|
+
|
|
3
|
+
There are 2 included containers to choose from:
|
|
4
|
+
|
|
5
|
+
*default*
|
|
6
|
+
|
|
7
|
+
Has a top bar with logo and menu. The top bar is transparent and turns translucent with a backdrop blur when scrolling down. Use `transparentScrollBackdropFilter` to customize the blur while keeping the top state transparent.
|
|
8
|
+
|
|
9
|
+
*menu*
|
|
10
|
+
|
|
11
|
+
A side bar on the left.
|