@stytch/vanilla-js 4.12.2 → 4.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/b2b/adminPortal/package.json +6 -0
- package/dist/APINetworkClient.d.ts +6 -0
- package/dist/BootstrapDataManager.d.ts +38 -0
- package/dist/CaptchaProvider.d.ts +7 -0
- package/dist/ClientsideServicesProvider.d.ts +16 -0
- package/dist/HeadlessOAuthClient.d.ts +68 -0
- package/dist/NetworkClient.d.ts +25 -0
- package/dist/PKCEManager.d.ts +12 -0
- package/dist/StytchHeadlessClient.d.ts +45 -0
- package/dist/StytchUIClient.d.ts +86 -0
- package/dist/SubscriptionService.d.ts +111 -0
- package/dist/adminPortal/AdminPortalStyleConfig.d.ts +166 -0
- package/dist/adminPortal/AdminPortalWrapper.d.ts +6 -0
- package/dist/adminPortal/MainContainer.d.ts +4 -0
- package/dist/adminPortal/Router.d.ts +44 -0
- package/dist/adminPortal/StytchClientContext.d.ts +3 -0
- package/dist/adminPortal/components/Accordion.d.ts +6 -0
- package/dist/adminPortal/components/ActionMenu.d.ts +22 -0
- package/dist/adminPortal/components/Alert.d.ts +4 -0
- package/dist/adminPortal/components/Button.d.ts +6 -0
- package/dist/adminPortal/components/Code.d.ts +7 -0
- package/dist/adminPortal/components/CopyableText.d.ts +7 -0
- package/dist/adminPortal/components/DeleteConnection.d.ts +21 -0
- package/dist/adminPortal/components/EmbeddedTable.d.ts +3 -0
- package/dist/adminPortal/components/FlexBox.d.ts +1 -0
- package/dist/adminPortal/components/InfoIcon.d.ts +3 -0
- package/dist/adminPortal/components/Input.d.ts +5 -0
- package/dist/adminPortal/components/Label.d.ts +4 -0
- package/dist/adminPortal/components/ListEditor.d.ts +4 -0
- package/dist/adminPortal/components/MenuItem.d.ts +4 -0
- package/dist/adminPortal/components/Modal.d.ts +16 -0
- package/dist/adminPortal/components/PageLoadingIndicator.d.ts +2 -0
- package/dist/adminPortal/components/PaginatedTable.d.ts +4 -0
- package/dist/adminPortal/components/SearchBar.d.ts +3 -0
- package/dist/adminPortal/components/Select.d.ts +12 -0
- package/dist/adminPortal/components/SetDefaultConnection.d.ts +29 -0
- package/dist/adminPortal/components/SettingsContainer.d.ts +24 -0
- package/dist/adminPortal/components/SettingsList.d.ts +4 -0
- package/dist/adminPortal/components/SettingsListItem.d.ts +5 -0
- package/dist/adminPortal/components/SettingsSection.d.ts +6 -0
- package/dist/adminPortal/components/Table.d.ts +3 -0
- package/dist/adminPortal/components/TableActions.d.ts +5 -0
- package/dist/adminPortal/components/Tag.d.ts +5 -0
- package/dist/adminPortal/components/TagList.d.ts +4 -0
- package/dist/adminPortal/components/Toast.d.ts +5 -0
- package/dist/adminPortal/components/Tooltip.d.ts +2 -0
- package/dist/adminPortal/components/Typography.d.ts +4 -0
- package/dist/adminPortal/index.d.ts +3 -0
- package/dist/adminPortal/index.esm.js +5 -0
- package/dist/adminPortal/index.js +5 -0
- package/dist/adminPortal/makeAdminPortalComponentMountFn.d.ts +19 -0
- package/dist/adminPortal/shared/components/Accordion.d.ts +15 -0
- package/dist/adminPortal/shared/components/Button.d.ts +25 -0
- package/dist/adminPortal/shared/components/Code.d.ts +14 -0
- package/dist/adminPortal/shared/components/ContentSpacing.d.ts +6 -0
- package/dist/adminPortal/shared/components/CopyableText.d.ts +16 -0
- package/dist/adminPortal/shared/components/EmbeddedTable.d.ts +16 -0
- package/dist/adminPortal/shared/components/FlexBox.d.ts +11 -0
- package/dist/adminPortal/shared/components/InfoIcon.d.ts +7 -0
- package/dist/adminPortal/shared/components/Input.d.ts +28 -0
- package/dist/adminPortal/shared/components/Label.d.ts +10 -0
- package/dist/adminPortal/shared/components/ListEditor.d.ts +27 -0
- package/dist/adminPortal/shared/components/MenuItem.d.ts +14 -0
- package/dist/adminPortal/shared/components/Modal.d.ts +20 -0
- package/dist/adminPortal/shared/components/PaginatedTable.d.ts +30 -0
- package/dist/adminPortal/shared/components/SearchBar.d.ts +6 -0
- package/dist/adminPortal/shared/components/Select.d.ts +30 -0
- package/dist/adminPortal/shared/components/Table.d.ts +17 -0
- package/dist/adminPortal/shared/components/TableActions.d.ts +15 -0
- package/dist/adminPortal/shared/components/Tag.d.ts +4 -0
- package/dist/adminPortal/shared/components/Toast.d.ts +18 -0
- package/dist/adminPortal/shared/components/Tooltip.d.ts +12 -0
- package/dist/adminPortal/shared/components/Typography.d.ts +15 -0
- package/dist/adminPortal/shared/components/componentInjection.d.ts +48 -0
- package/dist/adminPortal/shared/components/constants.d.ts +3 -0
- package/dist/adminPortal/shared/components/types.d.ts +13 -0
- package/dist/adminPortal/shared/utils/clickToCopyUtils.d.ts +15 -0
- package/dist/adminPortal/shared/utils/composeStyles.d.ts +60 -0
- package/dist/adminPortal/shared/utils/keys.d.ts +74 -0
- package/dist/adminPortal/shared/utils/noop.d.ts +1 -0
- package/dist/adminPortal/shared/utils/tableUtils.d.ts +3 -0
- package/dist/adminPortal/shared/utils/uniqueIds.d.ts +2 -0
- package/dist/adminPortal/shared/utils/useToggleState.d.ts +7 -0
- package/dist/adminPortal/sso/AdminPortalSSO.d.ts +18 -0
- package/dist/adminPortal/sso/AppDetails.d.ts +5 -0
- package/dist/adminPortal/sso/AttributeMappingTable.d.ts +22 -0
- package/dist/adminPortal/sso/DetailsSection.d.ts +6 -0
- package/dist/adminPortal/sso/IdpInfo.d.ts +147 -0
- package/dist/adminPortal/sso/IdpSelect.d.ts +126 -0
- package/dist/adminPortal/sso/OrganizationUpdatesSection.d.ts +7 -0
- package/dist/adminPortal/sso/RoleAssignmentsSection.d.ts +6 -0
- package/dist/adminPortal/sso/SSOConnectionDetailsScreen.d.ts +4 -0
- package/dist/adminPortal/sso/SSOConnectionsScreen.d.ts +2 -0
- package/dist/adminPortal/sso/SSONewConnectionConfigureScreen.d.ts +5 -0
- package/dist/adminPortal/sso/SSONewConnectionScreen.d.ts +2 -0
- package/dist/adminPortal/sso/SSORouter.d.ts +44 -0
- package/dist/adminPortal/sso/TaggedConnection.d.ts +8 -0
- package/dist/adminPortal/sso/mountAdminPortalSSO.d.ts +15 -0
- package/dist/adminPortal/sso/useDisplayPagination.d.ts +14 -0
- package/dist/adminPortal/utils/Connection.d.ts +9 -0
- package/dist/adminPortal/utils/ConnectionType.d.ts +1 -0
- package/dist/adminPortal/utils/clickToCopyUtils.d.ts +5 -0
- package/dist/adminPortal/utils/collator.d.ts +1 -0
- package/dist/adminPortal/utils/organizationGetKey.d.ts +1 -0
- package/dist/adminPortal/utils/theme.d.ts +6 -0
- package/dist/adminPortal/utils/useAdminPortalConfig.d.ts +10 -0
- package/dist/adminPortal/utils/useApiNetworkClient.d.ts +2 -0
- package/dist/adminPortal/utils/useB2BInternals.d.ts +1 -0
- package/dist/adminPortal/utils/useFormState.d.ts +13 -0
- package/dist/adminPortal/utils/useMutateOrganization.d.ts +4 -0
- package/dist/adminPortal/utils/useMutateSsoConnection.d.ts +19 -0
- package/dist/adminPortal/utils/useMutateWithToast.d.ts +7 -0
- package/dist/adminPortal/utils/useNavigateAwayWarning.d.ts +1 -0
- package/dist/adminPortal/utils/useOrgInfo.d.ts +1 -0
- package/dist/adminPortal/utils/useRbac.d.ts +51 -0
- package/dist/adminPortal/utils/useRevalidateConnectionList.d.ts +1 -0
- package/dist/adminPortal/utils/useSsoConnections.d.ts +2 -0
- package/dist/adminPortal/utils/useStateSliceSetter.d.ts +2 -0
- package/dist/adminPortal/utils/useStytchClient.d.ts +1 -0
- package/dist/assets/CreateIcon.d.ts +6 -0
- package/dist/assets/amazon.d.ts +3 -0
- package/dist/assets/apple.d.ts +3 -0
- package/dist/assets/backArrow.d.ts +5 -0
- package/dist/assets/binance.d.ts +3 -0
- package/dist/assets/bitbucket.d.ts +3 -0
- package/dist/assets/check.d.ts +2 -0
- package/dist/assets/checkmark.d.ts +2 -0
- package/dist/assets/chevron.d.ts +3 -0
- package/dist/assets/coinbase.d.ts +4 -0
- package/dist/assets/confirmation.d.ts +2 -0
- package/dist/assets/copy.d.ts +3 -0
- package/dist/assets/cross.d.ts +2 -0
- package/dist/assets/discord.d.ts +3 -0
- package/dist/assets/errorIcon.d.ts +3 -0
- package/dist/assets/facebook.d.ts +3 -0
- package/dist/assets/figma.d.ts +3 -0
- package/dist/assets/genericWallet.d.ts +4 -0
- package/dist/assets/github.d.ts +3 -0
- package/dist/assets/gitlab.d.ts +3 -0
- package/dist/assets/gmail.d.ts +3 -0
- package/dist/assets/google.d.ts +3 -0
- package/dist/assets/linkedin.d.ts +3 -0
- package/dist/assets/metamask.d.ts +4 -0
- package/dist/assets/microsoft.d.ts +3 -0
- package/dist/assets/outlook.d.ts +3 -0
- package/dist/assets/passkeyAdded.d.ts +2 -0
- package/dist/assets/passkeys.d.ts +3 -0
- package/dist/assets/passkeysCollage.d.ts +2 -0
- package/dist/assets/passwordIcon.d.ts +5 -0
- package/dist/assets/pencil.d.ts +2 -0
- package/dist/assets/phantom.d.ts +3 -0
- package/dist/assets/salesforce.d.ts +3 -0
- package/dist/assets/slack.d.ts +3 -0
- package/dist/assets/snackbarError.d.ts +2 -0
- package/dist/assets/snackbarSuccess.d.ts +2 -0
- package/dist/assets/snapchat.d.ts +3 -0
- package/dist/assets/successIcon.d.ts +3 -0
- package/dist/assets/tiktok.d.ts +3 -0
- package/dist/assets/trash.d.ts +2 -0
- package/dist/assets/twitch.d.ts +3 -0
- package/dist/assets/twitter.d.ts +3 -0
- package/dist/assets/vessel.d.ts +4 -0
- package/dist/assets/warningIcon.d.ts +3 -0
- package/dist/assets/yahoo.d.ts +3 -0
- package/dist/assets/yahooLogo.d.ts +3 -0
- package/dist/b2b/HeadlessB2BOAuthClient.d.ts +100 -0
- package/dist/b2b/StytchB2BHeadlessClient.d.ts +51 -0
- package/dist/b2b/StytchB2BUIClient.d.ts +40 -0
- package/dist/b2b/index.d.ts +1 -189
- package/dist/b2b/index.esm.js +5598 -13879
- package/dist/b2b/index.headless.d.ts +1 -148
- package/dist/b2b/index.headless.esm.js +2 -5269
- package/dist/b2b/index.headless.js +98 -5253
- package/dist/b2b/index.js +5722 -13890
- package/dist/b2b/oneTap/B2BOneTapProvider.d.ts +39 -0
- package/dist/extractErrorMessage-Dg5V9q2V.js +4534 -0
- package/dist/extractErrorMessage-HqH3v6mm.js +4493 -0
- package/dist/index.d.ts +1 -187
- package/dist/index.esm.js +1 -14827
- package/dist/index.headless-BMU_pBP_.js +1691 -0
- package/dist/index.headless-Hm4-qWxa.js +1695 -0
- package/dist/index.headless.d.ts +1 -103
- package/dist/index.headless.esm.js +5086 -3920
- package/dist/index.headless.js +5135 -3907
- package/dist/index.js +1 -14807
- package/dist/internal-BNX5AEoW.js +5196 -0
- package/dist/internal-CfUZ681R.js +5106 -0
- package/dist/oneTap/OneTapClient.d.ts +22 -0
- package/dist/oneTap/OneTapProvider.d.ts +36 -0
- package/dist/oneTap/navigatorSupportsFedCM.d.ts +1 -0
- package/dist/oneTap/positionModes.d.ts +6 -0
- package/dist/types.d.ts +18 -0
- package/dist/ui/CreateWebComponent.d.ts +20 -0
- package/dist/ui/b2b/App.d.ts +5 -0
- package/dist/ui/b2b/Container.d.ts +2 -0
- package/dist/ui/b2b/GlobalContextProvider.d.ts +82 -0
- package/dist/ui/b2b/MfaState.d.ts +50 -0
- package/dist/ui/b2b/clearStytchSearchParams.d.ts +1 -0
- package/dist/ui/b2b/generateProductComponentsOrdering.d.ts +13 -0
- package/dist/ui/b2b/getEnabledMethods.d.ts +5 -0
- package/dist/ui/b2b/hooks/useIsOnlyFloatingOneTap.d.ts +1 -0
- package/dist/ui/b2b/mfa.d.ts +70 -0
- package/dist/ui/b2b/reducer.d.ts +25 -0
- package/dist/ui/b2b/screens/Discovery.d.ts +2 -0
- package/dist/ui/b2b/screens/EmailConfirmation.d.ts +2 -0
- package/dist/ui/b2b/screens/MFAEnrollmentSelectionScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/MagicLinkForm.d.ts +3 -0
- package/dist/ui/b2b/screens/Main.d.ts +2 -0
- package/dist/ui/b2b/screens/OAuthButtons.d.ts +15 -0
- package/dist/ui/b2b/screens/PasswordAuthenticate.d.ts +7 -0
- package/dist/ui/b2b/screens/PasswordEmailForm.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordForgotForm.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordResetConfirmation.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordResetForm.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordSetNew.d.ts +2 -0
- package/dist/ui/b2b/screens/PasswordUseButton.d.ts +2 -0
- package/dist/ui/b2b/screens/RecoveryCodeEntryScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/RecoveryCodeSaveScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/SMSOTPEnrollScreen.d.ts +3 -0
- package/dist/ui/b2b/screens/SMSOTPEntryScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/SSOButtons.d.ts +6 -0
- package/dist/ui/b2b/screens/TOTPEnrollManualScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/TOTPEnrollQRScreen.d.ts +2 -0
- package/dist/ui/b2b/screens/TOTPEntryScreen.d.ts +2 -0
- package/dist/ui/b2b/utils.d.ts +34 -0
- package/dist/ui/b2c/App.d.ts +11 -0
- package/dist/ui/b2c/Container.d.ts +2 -0
- package/dist/ui/b2c/GlobalContextProvider.d.ts +83 -0
- package/dist/ui/b2c/reducer.d.ts +23 -0
- package/dist/ui/b2c/screens/Crypto/ConnectWallet.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/Error.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/OtherWallets.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/PasskeyConfirmation.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/SetupNewWallet.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/SignMessage.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/Success.d.ts +2 -0
- package/dist/ui/b2c/screens/Crypto/WalletButtons.d.ts +4 -0
- package/dist/ui/b2c/screens/Main/LoginForm/MagicLinkForm.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/LoginForm/OTPForm.d.ts +16 -0
- package/dist/ui/b2c/screens/Main/LoginForm/PasskeyButton.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/LoginForm/PasswordForm.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/LoginForm/index.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/OAuthButtons.d.ts +2 -0
- package/dist/ui/b2c/screens/Main/index.d.ts +2 -0
- package/dist/ui/b2c/screens/Passkey/PasskeyRegistrationStart.d.ts +2 -0
- package/dist/ui/b2c/screens/Passkey/PasskeyRegistrationSuccess.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/MagicLinkOption.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordAuthenticate.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordBreached.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordDedupe.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordForgot.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordNewUser.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordSecondaryMethod.d.ts +4 -0
- package/dist/ui/b2c/screens/Password/PasswordSetNew.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/PasswordlessCreate.d.ts +2 -0
- package/dist/ui/b2c/screens/Password/ResetPassword.d.ts +2 -0
- package/dist/ui/b2c/screens/Secondary/EmailConfirmation.d.ts +6 -0
- package/dist/ui/b2c/screens/Secondary/OTPAuthenticate.d.ts +4 -0
- package/dist/ui/b2c/screens/Secondary/OTPConfirmation.d.ts +2 -0
- package/dist/ui/b2c/screens/Secondary/PasswordCreateAuthenticate.d.ts +2 -0
- package/dist/ui/b2c/utils.d.ts +1 -0
- package/dist/ui/components/AlertBox.d.ts +8 -0
- package/dist/ui/components/AnimatedContainer.d.ts +5 -0
- package/dist/ui/components/B2BOneTap.d.ts +2 -0
- package/dist/ui/components/Button.d.ts +5 -0
- package/dist/ui/components/CircularProgress.d.ts +12 -0
- package/dist/ui/components/Confirmation.d.ts +2 -0
- package/dist/ui/components/CountrySelector.d.ts +7 -0
- package/dist/ui/components/Divider.d.ts +2 -0
- package/dist/ui/components/EditableRow.d.ts +15 -0
- package/dist/ui/components/EmailConfirmation.d.ts +11 -0
- package/dist/ui/components/EmailInput.d.ts +7 -0
- package/dist/ui/components/ErrorScreen.d.ts +2 -0
- package/dist/ui/components/ErrorText.d.ts +4 -0
- package/dist/ui/components/Flex.d.ts +40 -0
- package/dist/ui/components/InlineButton.d.ts +7 -0
- package/dist/ui/components/Input.d.ts +1 -0
- package/dist/ui/components/InsetContainer.d.ts +1 -0
- package/dist/ui/components/Loading.d.ts +3 -0
- package/dist/ui/components/LoadingBar.d.ts +4 -0
- package/dist/ui/components/MainContainer.d.ts +3 -0
- package/dist/ui/components/OAuthB2BButton.d.ts +14 -0
- package/dist/ui/components/OAuthButton.d.ts +14 -0
- package/dist/ui/components/OTPControl.d.ts +8 -0
- package/dist/ui/components/OTPEntry.d.ts +11 -0
- package/dist/ui/components/OTPInput.d.ts +6 -0
- package/dist/ui/components/OneTap.d.ts +18 -0
- package/dist/ui/components/OneTapErrorMessages.d.ts +7 -0
- package/dist/ui/components/PasswordError.d.ts +17 -0
- package/dist/ui/components/PasswordInput.d.ts +6 -0
- package/dist/ui/components/PasswordStrengthCheck.d.ts +4 -0
- package/dist/ui/components/PhoneInput.d.ts +10 -0
- package/dist/ui/components/SentOTPEntry.d.ts +10 -0
- package/dist/ui/components/Snackbar.d.ts +2 -0
- package/dist/ui/components/SubmitButton.d.ts +8 -0
- package/dist/ui/components/TOTPEntry.d.ts +8 -0
- package/dist/ui/components/Text.d.ts +9 -0
- package/dist/ui/components/VerifyEmailConfirmation.d.ts +10 -0
- package/dist/ui/components/WalletButton.d.ts +8 -0
- package/dist/ui/hooks/useIsMounted.d.ts +3 -0
- package/dist/ui/hooks/useIsOnlyFloatingOneTap.d.ts +1 -0
- package/dist/ui/hooks/usePromptPasskey.d.ts +7 -0
- package/dist/ui/theme.d.ts +112 -0
- package/dist/utils/Optional.d.ts +3 -0
- package/dist/utils/assertUnreachable.d.ts +1 -0
- package/dist/utils/crypto.d.ts +60 -0
- package/dist/utils/deepEqual.d.ts +1 -0
- package/dist/utils/extractErrorMessage.d.ts +1 -0
- package/dist/utils/extractErrorType.d.ts +1 -0
- package/dist/utils/index.d.ts +28 -0
- package/dist/utils/internal.d.ts +34 -0
- package/dist/utils/isTruthy.d.ts +3 -0
- package/dist/utils/oauthProviderType.d.ts +7 -0
- package/dist/utils/passkeys.d.ts +8 -0
- package/package.json +19 -17
- package/dist/b2b/index.esm.d.ts +0 -190
- package/dist/b2b/index.headless.esm.d.ts +0 -149
- package/dist/index.esm.d.ts +0 -188
- package/dist/index.headless.esm.d.ts +0 -104
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PartialDeep } from 'type-fest';
|
|
2
|
+
import { StytchB2BHeadlessClient } from '../b2b/StytchB2BHeadlessClient';
|
|
3
|
+
import { AdminPortalStyleConfig } from './AdminPortalStyleConfig';
|
|
4
|
+
export interface AdminPortalComponentMountOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The Stytch B2B client to use.
|
|
7
|
+
*/
|
|
8
|
+
client: StytchB2BHeadlessClient;
|
|
9
|
+
/**
|
|
10
|
+
* An HTML element or query selector string for the element that should contain the UI.
|
|
11
|
+
* @example '#container'
|
|
12
|
+
*/
|
|
13
|
+
element: string | HTMLElement;
|
|
14
|
+
/**
|
|
15
|
+
* An {@link AdminPortalStyleConfig} object containing custom styling info.
|
|
16
|
+
*/
|
|
17
|
+
styles?: PartialDeep<AdminPortalStyleConfig>;
|
|
18
|
+
}
|
|
19
|
+
export declare const makeAdminPortalComponentMountFn: <TMountOptions extends AdminPortalComponentMountOptions>(component: import("react").ComponentType<TMountOptions>, webComponentName: string, mountFunctionName: string) => (options: TMountOptions) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AccordionProps, Accordion as MUIAccordion, AccordionDetails as MUIAccordionDetails, AccordionSummary as MUIAccordionSummary } from '@material-ui/core';
|
|
2
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
3
|
+
import { Classes } from '../utils/composeStyles';
|
|
4
|
+
export declare const makeAccordionStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"accordion" | "accordionDetails" | "accordionExpanded" | "accordionSummary", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"accordion" | "accordionDetails" | "accordionExpanded" | "accordionSummary", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"accordion" | "accordionDetails" | "accordionExpanded" | "accordionSummary"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"accordion" | "accordionDetails" | "accordionExpanded" | "accordionSummary">;
|
|
5
|
+
interface useAccordionProps {
|
|
6
|
+
defaultValue: boolean;
|
|
7
|
+
}
|
|
8
|
+
type AccordionBehavior = Pick<AccordionProps, 'expanded' | 'onChange'> & {
|
|
9
|
+
setExpanded: Dispatch<SetStateAction<boolean>>;
|
|
10
|
+
};
|
|
11
|
+
export declare const useAccordion: ({ defaultValue }?: useAccordionProps) => AccordionBehavior;
|
|
12
|
+
export declare const AccordionCore: (props: React.ComponentProps<typeof MUIAccordion> & Classes<typeof makeAccordionStyles>) => JSX.Element;
|
|
13
|
+
export declare const AccordionSummaryCore: ({ classes, ...props }: React.ComponentProps<typeof MUIAccordionSummary> & Classes<typeof makeAccordionStyles>) => JSX.Element;
|
|
14
|
+
export declare const AccordionDetailsCore: (props: React.ComponentProps<typeof MUIAccordionDetails> & Classes<typeof makeAccordionStyles>) => JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ButtonProps as InternalButtonProps } from '@material-ui/core';
|
|
2
|
+
import React, { MouseEventHandler, ReactNode, VFC } from 'react';
|
|
3
|
+
import { Classes } from '../utils/composeStyles';
|
|
4
|
+
export declare const makeButtonStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"button" | "text" | "primary" | "secondary" | "compact" | "iconOnly" | "ghost" | "warningGhost" | "warningPrimary" | "warningText", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"button" | "text" | "primary" | "secondary" | "compact" | "iconOnly" | "ghost" | "warningGhost" | "warningPrimary" | "warningText", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"button" | "text" | "primary" | "secondary" | "compact" | "iconOnly" | "ghost" | "warningGhost" | "warningPrimary" | "warningText"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"button" | "text" | "primary" | "secondary" | "compact" | "iconOnly" | "ghost" | "warningGhost" | "warningPrimary" | "warningText">;
|
|
5
|
+
type Variant = 'ghost' | 'primary' | 'secondary' | 'text';
|
|
6
|
+
export type ButtonCoreProps = {
|
|
7
|
+
autoFocus?: boolean;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
compact?: boolean;
|
|
11
|
+
component?: React.ElementType;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
endIcon?: ReactNode;
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
16
|
+
startIcon?: ReactNode;
|
|
17
|
+
type?: InternalButtonProps['type'];
|
|
18
|
+
variant?: Variant;
|
|
19
|
+
warning?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type ButtonCoreCommonProps = ButtonCoreProps & {
|
|
22
|
+
component?: 'span' | 'button' | 'div';
|
|
23
|
+
};
|
|
24
|
+
export declare const ButtonCore: VFC<ButtonCoreProps & Classes<typeof makeButtonStyles>>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { Classes } from '../utils/composeStyles';
|
|
3
|
+
export declare const CODE_HORIZONTAL_PADDING = 1;
|
|
4
|
+
export declare const commonCodeStyles: {
|
|
5
|
+
code: {
|
|
6
|
+
borderRadius: number;
|
|
7
|
+
width: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const makeCodeStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"code", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"code", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"code"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"code">;
|
|
11
|
+
export interface CodeCoreProps {
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const CodeCore: FC<CodeCoreProps & Classes<typeof makeCodeStyles>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { InjectedComponents } from './componentInjection';
|
|
3
|
+
import { Classes } from '../utils/composeStyles';
|
|
4
|
+
export declare const makeCopyableTextStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"code" | "copyableText" | "copyIcon" | "hasCopiedIcon" | "noWrap", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"code" | "copyableText" | "copyIcon" | "hasCopiedIcon" | "noWrap", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"code" | "copyableText" | "copyIcon" | "hasCopiedIcon" | "noWrap"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"code" | "copyableText" | "copyIcon" | "hasCopiedIcon" | "noWrap">;
|
|
5
|
+
export type CopyableTextCoreProps = {
|
|
6
|
+
children?: string;
|
|
7
|
+
textToCopy?: string;
|
|
8
|
+
noWrap?: boolean;
|
|
9
|
+
id?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const CopyableTextCore: ({ children, textToCopy, noWrap, id, label, classes, CodeComponent: Code, LabelComponent: Label, TypographyComponent: Typography, useClickToCopy, }: CopyableTextCoreProps & Classes<typeof makeCopyableTextStyles> & InjectedComponents<'Code' | 'Label' | 'Typography' | 'useClickToCopy'>) => JSX.Element;
|
|
13
|
+
export interface CopyableTruncatedIdCoreProps {
|
|
14
|
+
children: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const CopyableTruncatedIdCore: FC<CopyableTruncatedIdCoreProps & InjectedComponents<'CopyableText'>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Classes } from '../utils/composeStyles';
|
|
3
|
+
import { TableActionCoreProps } from './TableActions';
|
|
4
|
+
import { InjectedComponents } from './componentInjection';
|
|
5
|
+
import { TableItemRenderer } from './types';
|
|
6
|
+
export declare const makeEmbeddedTableStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"embeddedTableWithActions" | "tableCell" | "tableActionsCell" | "tableHeader" | "bottomAction", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"embeddedTableWithActions" | "tableCell" | "tableActionsCell" | "tableHeader" | "bottomAction", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"embeddedTableWithActions" | "tableCell" | "tableActionsCell" | "tableHeader" | "bottomAction"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"embeddedTableWithActions" | "tableCell" | "tableActionsCell" | "tableHeader" | "bottomAction">;
|
|
7
|
+
export type EmbeddedTableCoreProps<T> = {
|
|
8
|
+
itemRenderer: TableItemRenderer<T>[];
|
|
9
|
+
items: T[];
|
|
10
|
+
rowKeyExtractor?(item: T): string;
|
|
11
|
+
getItemActionProps?: (item: T, setState: (state: Record<string, unknown>) => void, state?: Record<string, unknown>) => TableActionCoreProps;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
initialItemState?: Record<string, unknown>;
|
|
14
|
+
bottomAction?: ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export declare const EmbeddedTableCore: <T extends string | Record<string, unknown>>({ itemRenderer, items, rowKeyExtractor, getItemActionProps, readOnly, bottomAction, initialItemState, classes, TableActionsComponent: TableActions, TypographyComponent: Typography, }: EmbeddedTableCoreProps<T> & Classes<(<TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"embeddedTableWithActions" | "tableCell" | "tableActionsCell" | "tableHeader" | "bottomAction", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"embeddedTableWithActions" | "tableCell" | "tableActionsCell" | "tableHeader" | "bottomAction", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"embeddedTableWithActions" | "tableCell" | "tableActionsCell" | "tableHeader" | "bottomAction"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"embeddedTableWithActions" | "tableCell" | "tableActionsCell" | "tableHeader" | "bottomAction">)> & InjectedComponents<"Typography" | "TableActions">) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
gap?: number;
|
|
4
|
+
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch';
|
|
5
|
+
flexDirection?: 'row' | 'column';
|
|
6
|
+
justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
|
|
7
|
+
flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare const FlexBox: FC<Props>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Classes } from '../utils/composeStyles';
|
|
2
|
+
import { InjectedComponents } from './componentInjection';
|
|
3
|
+
export declare const makeInfoIconStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"infoIconContainer", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"infoIconContainer", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"infoIconContainer"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"infoIconContainer">;
|
|
4
|
+
export type InfoIconCoreProps = {
|
|
5
|
+
tooltipText: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const InfoIconCore: ({ tooltipText, classes, TooltipComponent: Tooltip, }: InfoIconCoreProps & Classes<typeof makeInfoIconStyles> & InjectedComponents<'Tooltip'>) => JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OutlinedInputProps } from '@material-ui/core';
|
|
2
|
+
import { WithClasses } from '../utils/composeStyles';
|
|
3
|
+
import { InjectedComponents } from './componentInjection';
|
|
4
|
+
export declare const makeInputStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"input" | "fullWidth" | "inputContainer" | "multilineContainer" | "readOnlyContainer" | "fileUploadContainer" | "fileUploadHidden", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"input" | "fullWidth" | "inputContainer" | "multilineContainer" | "readOnlyContainer" | "fileUploadContainer" | "fileUploadHidden", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"input" | "fullWidth" | "inputContainer" | "multilineContainer" | "readOnlyContainer" | "fileUploadContainer" | "fileUploadHidden"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"input" | "fullWidth" | "inputContainer" | "multilineContainer" | "readOnlyContainer" | "fileUploadContainer" | "fileUploadHidden">;
|
|
5
|
+
export type InputCoreProps = {
|
|
6
|
+
caption?: string;
|
|
7
|
+
copyable?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
fileUpload?: boolean;
|
|
11
|
+
fullWidth?: boolean;
|
|
12
|
+
id?: string;
|
|
13
|
+
inputProps?: OutlinedInputProps['inputProps'];
|
|
14
|
+
inputRef?: OutlinedInputProps['inputRef'];
|
|
15
|
+
label?: string;
|
|
16
|
+
multiline?: boolean;
|
|
17
|
+
onBlur?: () => void;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
onFocus?: () => void;
|
|
20
|
+
onKeyDown?: OutlinedInputProps['onKeyDown'];
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
readOnlyConcealed?: boolean;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
type?: OutlinedInputProps['type'];
|
|
26
|
+
value?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const InputCore: ({ caption, copyable, disabled, error, fileUpload, fullWidth, id, inputProps, inputRef, label, multiline, onBlur, onChange, onFocus, onKeyDown, placeholder, readOnly, readOnlyConcealed, required, type, value, classes, ButtonComponent, CopyableTextComponent: CopyableText, LabelComponent: Label, TypographyComponent: Typography, }: WithClasses<InputCoreProps, typeof makeInputStyles> & InjectedComponents<'Button' | 'CopyableText' | 'Label' | 'Typography'>) => JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { InjectedComponents } from './componentInjection';
|
|
3
|
+
export type LabelCoreProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
htmlFor?: string;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
variant?: 'body1' | 'body2';
|
|
9
|
+
};
|
|
10
|
+
export declare const LabelCore: FC<LabelCoreProps & InjectedComponents<'Typography'>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { InjectedComponents } from './componentInjection';
|
|
3
|
+
import { EmbeddedTableCoreProps } from './EmbeddedTable';
|
|
4
|
+
import { ModalCoreProps } from './Modal';
|
|
5
|
+
export declare const ADD_NEW_BUTTON_TEXT = "Add new";
|
|
6
|
+
export type AddModalProps = Pick<ModalCoreProps, 'title' | 'description' | 'confirmButtonText' | 'confirm' | 'disableConfirm' | 'noCancelButton' | 'keepOpenOnConfirm'> & {
|
|
7
|
+
close?(): void;
|
|
8
|
+
content?: ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export type ListEditorCoreProps<T> = EmbeddedTableCoreProps<T> & {
|
|
11
|
+
hideAddButton?: boolean;
|
|
12
|
+
title?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
limit?: number;
|
|
15
|
+
addModalProps?: AddModalProps;
|
|
16
|
+
onAdd?(): void;
|
|
17
|
+
};
|
|
18
|
+
export declare const ListEditorCore: <T extends string | Record<string, unknown>>({ title, description, limit, addModalProps, hideAddButton, onAdd, ButtonComponent: Button, EmbeddedTableComponent: EmbeddedTable, ModalComponent: Modal, TypographyComponent: Typography, ...embeddedTableProps }: EmbeddedTableCoreProps<T> & {
|
|
19
|
+
hideAddButton?: boolean | undefined;
|
|
20
|
+
title?: string | undefined;
|
|
21
|
+
description?: string | undefined;
|
|
22
|
+
limit?: number | undefined;
|
|
23
|
+
addModalProps?: AddModalProps | undefined;
|
|
24
|
+
onAdd?(): void;
|
|
25
|
+
} & InjectedComponents<"Typography" | "Button" | "Modal"> & {
|
|
26
|
+
EmbeddedTableComponent: React.ComponentType<EmbeddedTableCoreProps<T>>;
|
|
27
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
import { OptionItem, Prettify } from './types';
|
|
3
|
+
import { InjectedComponents } from './componentInjection';
|
|
4
|
+
export type MenuItemFields = Prettify<OptionItem & {
|
|
5
|
+
subtext?: string;
|
|
6
|
+
onClick?: MouseEventHandler<HTMLLIElement>;
|
|
7
|
+
}>;
|
|
8
|
+
export type MenuItemCoreProps = MenuItemFields & {
|
|
9
|
+
Icon?: ReactNode;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
forceSelected?: boolean;
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const MenuItemCore: ({ Icon, disabled, footer, forceSelected, label, onClick, selected, subtext, TypographyComponent: Typography, }: MenuItemCoreProps & InjectedComponents<'Typography'>) => JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ModalStateType = {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
open: () => void;
|
|
5
|
+
close: () => void;
|
|
6
|
+
confirm: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare const useModalState: (confirmAction?: () => unknown) => ModalStateType;
|
|
9
|
+
export type ModalCoreProps = Omit<ModalStateType, 'open'> & {
|
|
10
|
+
cancelButtonText?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
confirmButtonText?: string;
|
|
13
|
+
disableConfirm?: boolean;
|
|
14
|
+
warning?: boolean;
|
|
15
|
+
title: string;
|
|
16
|
+
showLoadingOnConfirm?: boolean;
|
|
17
|
+
noCancelButton?: boolean;
|
|
18
|
+
keepOpenOnConfirm?: boolean;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
|
+
import { InjectedComponents } from './componentInjection';
|
|
3
|
+
import { TableCoreProps } from './Table';
|
|
4
|
+
import { Classes } from '../utils/composeStyles';
|
|
5
|
+
export declare const DEFAULT_TABLE_ROWS_PER_PAGE = 20;
|
|
6
|
+
export declare const makePaginatedTableStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"tablePagination" | "paginationBoder" | "emptyTable", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"tablePagination" | "paginationBoder" | "emptyTable", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"tablePagination" | "paginationBoder" | "emptyTable"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"tablePagination" | "paginationBoder" | "emptyTable">;
|
|
7
|
+
export type PaginatedTableCoreProps<T> = TableCoreProps<T> & {
|
|
8
|
+
currentPage: number;
|
|
9
|
+
loadNext(): void;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
metadata?: {
|
|
12
|
+
cursor: string;
|
|
13
|
+
total: number;
|
|
14
|
+
};
|
|
15
|
+
setCurrentPage(page: number): void;
|
|
16
|
+
rowsPerPage?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const PaginatedTableCore: <T extends Record<string, unknown>>({ currentPage, loadNext, isLoading, metadata, setCurrentPage, rowsPerPage, classes, TableComponent: Table, TypographyComponent: Typography, ...tableProps }: TableCoreProps<T> & {
|
|
19
|
+
currentPage: number;
|
|
20
|
+
loadNext(): void;
|
|
21
|
+
isLoading?: boolean | undefined;
|
|
22
|
+
metadata?: {
|
|
23
|
+
cursor: string;
|
|
24
|
+
total: number;
|
|
25
|
+
} | undefined;
|
|
26
|
+
setCurrentPage(page: number): void;
|
|
27
|
+
rowsPerPage?: number | undefined;
|
|
28
|
+
} & Classes<(<TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"tablePagination" | "paginationBoder" | "emptyTable", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"tablePagination" | "paginationBoder" | "emptyTable", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"tablePagination" | "paginationBoder" | "emptyTable"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"tablePagination" | "paginationBoder" | "emptyTable">)> & InjectedComponents<"Typography"> & {
|
|
29
|
+
TableComponent: React.ComponentType<TableCoreProps<T>>;
|
|
30
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Classes } from '../utils/composeStyles';
|
|
2
|
+
import { InputCoreProps } from './Input';
|
|
3
|
+
import { InjectedComponents } from './componentInjection';
|
|
4
|
+
export declare const makeSearchBarStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"icon" | "searchBar" | "searchInput" | "searchIcon" | "slashIcon" | "slashIconContainer", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"icon" | "searchBar" | "searchInput" | "searchIcon" | "slashIcon" | "slashIconContainer", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"icon" | "searchBar" | "searchInput" | "searchIcon" | "slashIcon" | "slashIconContainer"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"icon" | "searchBar" | "searchInput" | "searchIcon" | "slashIcon" | "slashIconContainer">;
|
|
5
|
+
export type SearchBarCoreProps = Pick<InputCoreProps, 'label' | 'id' | 'onChange' | 'placeholder' | 'value'>;
|
|
6
|
+
export declare const SearchBarCore: ({ classes, InputComponent: Input, ...inputProps }: SearchBarCoreProps & Classes<typeof makeSearchBarStyles> & InjectedComponents<'Input'>) => JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
import { InjectedComponents } from './componentInjection';
|
|
3
|
+
import { OptionItem } from './types';
|
|
4
|
+
import { Classes } from '../utils/composeStyles';
|
|
5
|
+
export declare const makeSelectStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"select" | "disabled" | "fullWidth" | "readOnlyContainer" | "checkIcon" | "menuPaper" | "selectContainer" | "selectContainerOpen", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"select" | "disabled" | "fullWidth" | "readOnlyContainer" | "checkIcon" | "menuPaper" | "selectContainer" | "selectContainerOpen", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"select" | "disabled" | "fullWidth" | "readOnlyContainer" | "checkIcon" | "menuPaper" | "selectContainer" | "selectContainerOpen"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"select" | "disabled" | "fullWidth" | "readOnlyContainer" | "checkIcon" | "menuPaper" | "selectContainer" | "selectContainerOpen">;
|
|
6
|
+
type SelectItem = OptionItem & {
|
|
7
|
+
Icon?: ReactNode;
|
|
8
|
+
selected?: boolean;
|
|
9
|
+
onClick?: MouseEventHandler<HTMLLIElement>;
|
|
10
|
+
forceSelected?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type SelectCoreProps<U extends string | number | string[] | number[], TSelectItem> = {
|
|
13
|
+
caption?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
fullWidth?: boolean;
|
|
16
|
+
id?: string;
|
|
17
|
+
label?: ReactNode;
|
|
18
|
+
menuAnchorHorizontal?: 'left' | 'right' | 'center';
|
|
19
|
+
selectItems: TSelectItem[];
|
|
20
|
+
multiple?: boolean;
|
|
21
|
+
onChange?: (value: U) => void;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
value?: U | null;
|
|
26
|
+
};
|
|
27
|
+
export declare const SelectCore: <U extends string | number | string[] | number[], TSelectItem extends SelectItem>({ caption, disabled, fullWidth, id, label, menuAnchorHorizontal, selectItems, multiple, onChange, placeholder, readOnly, required, value, classes, LabelComponent: Label, MenuItemComponent: MenuItem, TypographyComponent: Typography, }: SelectCoreProps<U, TSelectItem> & Classes<(<TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"select" | "disabled" | "fullWidth" | "readOnlyContainer" | "checkIcon" | "menuPaper" | "selectContainer" | "selectContainerOpen", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"select" | "disabled" | "fullWidth" | "readOnlyContainer" | "checkIcon" | "menuPaper" | "selectContainer" | "selectContainerOpen", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"select" | "disabled" | "fullWidth" | "readOnlyContainer" | "checkIcon" | "menuPaper" | "selectContainer" | "selectContainerOpen"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"select" | "disabled" | "fullWidth" | "readOnlyContainer" | "checkIcon" | "menuPaper" | "selectContainer" | "selectContainerOpen">)> & InjectedComponents<"Label" | "Typography"> & {
|
|
28
|
+
MenuItemComponent: React.ComponentType<SelectItem | TSelectItem>;
|
|
29
|
+
}) => JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { Classes } from '../utils/composeStyles';
|
|
3
|
+
import { TableActionCoreProps } from './TableActions';
|
|
4
|
+
import { InjectedComponents } from './componentInjection';
|
|
5
|
+
import { TableItemRenderer } from './types';
|
|
6
|
+
export declare const makeTableStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"tableCell" | "tableActionsCell" | "tableHeader" | "tableWithExpandedContent" | "tableWithActions" | "tableHeaderActionsCell" | "cellWithExpandedContent" | "expandMoreCell" | "openChevron" | "expandedRow" | "expandedContentCell" | "expandedContentContainer" | "clickable", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"tableCell" | "tableActionsCell" | "tableHeader" | "tableWithExpandedContent" | "tableWithActions" | "tableHeaderActionsCell" | "cellWithExpandedContent" | "expandMoreCell" | "openChevron" | "expandedRow" | "expandedContentCell" | "expandedContentContainer" | "clickable", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"tableCell" | "tableActionsCell" | "tableHeader" | "tableWithExpandedContent" | "tableWithActions" | "tableHeaderActionsCell" | "cellWithExpandedContent" | "expandMoreCell" | "openChevron" | "expandedRow" | "expandedContentCell" | "expandedContentContainer" | "clickable"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"tableCell" | "tableActionsCell" | "tableHeader" | "tableWithExpandedContent" | "tableWithActions" | "tableHeaderActionsCell" | "cellWithExpandedContent" | "expandMoreCell" | "openChevron" | "expandedRow" | "expandedContentCell" | "expandedContentContainer" | "clickable">;
|
|
7
|
+
export type TableCoreProps<T> = {
|
|
8
|
+
ExpandedContent?: ComponentType<{
|
|
9
|
+
data: T;
|
|
10
|
+
}>;
|
|
11
|
+
itemRenderer: TableItemRenderer<T>[];
|
|
12
|
+
items: T[];
|
|
13
|
+
rowKeyExtractor?(item: T): string;
|
|
14
|
+
onRowClick?(id: string): void;
|
|
15
|
+
getItemActionProps?: (item: T) => TableActionCoreProps;
|
|
16
|
+
};
|
|
17
|
+
export declare const TableCore: <T extends Record<string, unknown>>({ ExpandedContent, itemRenderer, items, rowKeyExtractor, onRowClick, getItemActionProps, classes, TableActionsComponent: TableActions, TypographyComponent: Typography, }: TableCoreProps<T> & Classes<(<TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"tableCell" | "tableActionsCell" | "tableHeader" | "tableWithExpandedContent" | "tableWithActions" | "tableHeaderActionsCell" | "cellWithExpandedContent" | "expandMoreCell" | "openChevron" | "expandedRow" | "expandedContentCell" | "expandedContentContainer" | "clickable", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"tableCell" | "tableActionsCell" | "tableHeader" | "tableWithExpandedContent" | "tableWithActions" | "tableHeaderActionsCell" | "cellWithExpandedContent" | "expandMoreCell" | "openChevron" | "expandedRow" | "expandedContentCell" | "expandedContentContainer" | "clickable", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"tableCell" | "tableActionsCell" | "tableHeader" | "tableWithExpandedContent" | "tableWithActions" | "tableHeaderActionsCell" | "cellWithExpandedContent" | "expandMoreCell" | "openChevron" | "expandedRow" | "expandedContentCell" | "expandedContentContainer" | "clickable"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"tableCell" | "tableActionsCell" | "tableHeader" | "tableWithExpandedContent" | "tableWithActions" | "tableHeaderActionsCell" | "cellWithExpandedContent" | "expandMoreCell" | "openChevron" | "expandedRow" | "expandedContentCell" | "expandedContentContainer" | "clickable">)> & InjectedComponents<"Typography" | "TableActions">) => JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { InjectedComponents } from './componentInjection';
|
|
3
|
+
export declare const useTableActionStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"tableActions">;
|
|
4
|
+
export declare const TABLE_ACTIONS_HEADER = "Actions";
|
|
5
|
+
type TableAction = {
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
9
|
+
export type TableActionCoreProps = {
|
|
10
|
+
warningAction?: TableAction;
|
|
11
|
+
action?: TableAction;
|
|
12
|
+
customAction?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export declare const TableActionsCore: ({ warningAction, action, customAction, ButtonComponent: Button, }: TableActionCoreProps & InjectedComponents<'Button'>) => JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { Classes } from '../utils/composeStyles';
|
|
3
|
+
export declare const makeTagStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"tag", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"tag", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"tag"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"tag">;
|
|
4
|
+
export declare const TagCore: FC<PropsWithChildren & Classes<typeof makeTagStyles>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { FC, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { InjectedComponents } from './componentInjection';
|
|
3
|
+
import { Classes } from '../utils/composeStyles';
|
|
4
|
+
export declare const makeToastStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"error" | "success" | "snackbar" | "closeButton" | "closeIcon" | "toast" | "errorIcon" | "successIcon", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"error" | "success" | "snackbar" | "closeButton" | "closeIcon" | "toast" | "errorIcon" | "successIcon", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"error" | "success" | "snackbar" | "closeButton" | "closeIcon" | "toast" | "errorIcon" | "successIcon"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"error" | "success" | "snackbar" | "closeButton" | "closeIcon" | "toast" | "errorIcon" | "successIcon">;
|
|
5
|
+
type ToastType = 'success' | 'error';
|
|
6
|
+
type ToastContextType = {
|
|
7
|
+
openToast(options: {
|
|
8
|
+
text: ReactNode;
|
|
9
|
+
type: ToastType;
|
|
10
|
+
openDurationMS?: number;
|
|
11
|
+
}): void;
|
|
12
|
+
closeToast(): void;
|
|
13
|
+
};
|
|
14
|
+
export declare const ToastContext: React.Context<ToastContextType>;
|
|
15
|
+
export declare const useToast: () => ToastContextType;
|
|
16
|
+
export type ToastContextProviderCoreProps = PropsWithChildren;
|
|
17
|
+
export declare const ToastContextProviderCore: FC<ToastContextProviderCoreProps & Classes<typeof makeToastStyles> & InjectedComponents<'Typography'>>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TooltipProps } from '@material-ui/core';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { Classes } from '../utils/composeStyles';
|
|
4
|
+
import { InjectedComponents } from './componentInjection';
|
|
5
|
+
export declare const makeTooltipStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"tooltip" | "targetWrapper", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"tooltip" | "targetWrapper", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"tooltip" | "targetWrapper"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"tooltip" | "targetWrapper">;
|
|
6
|
+
export type TooltipCoreProps = {
|
|
7
|
+
children: ReactElement;
|
|
8
|
+
text: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
placement?: TooltipProps['placement'];
|
|
11
|
+
};
|
|
12
|
+
export declare const TooltipCore: ({ text, children, disabled, placement, classes, TypographyComponent: Typography, }: TooltipCoreProps & Classes<typeof makeTooltipStyles> & InjectedComponents<'Typography'>) => JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TypographyProps as MUITypographyProps } from '@material-ui/core';
|
|
2
|
+
import React, { FC, ReactNode } from 'react';
|
|
3
|
+
import { Classes } from '../utils/composeStyles';
|
|
4
|
+
export declare const makeTypographyStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"disabled" | "typography", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"disabled" | "typography", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"disabled" | "typography"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"disabled" | "typography">;
|
|
5
|
+
type Color = 'primary' | 'secondary' | 'error';
|
|
6
|
+
export type TypographyCoreProps = {
|
|
7
|
+
align?: MUITypographyProps['align'];
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
color?: Color;
|
|
10
|
+
component?: React.ElementType;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'body1' | 'body2';
|
|
13
|
+
};
|
|
14
|
+
export declare const TypographyCore: FC<TypographyCoreProps & Classes<typeof makeTypographyStyles>>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { UseClickToCopyCoreParams, UseClickToCopyCoreReturnType } from '../utils/clickToCopyUtils';
|
|
2
|
+
import { ButtonCoreCommonProps } from './Button';
|
|
3
|
+
import { CodeCoreProps } from './Code';
|
|
4
|
+
import { CopyableTextCoreProps } from './CopyableText';
|
|
5
|
+
import { InputCoreProps } from './Input';
|
|
6
|
+
import { LabelCoreProps } from './Label';
|
|
7
|
+
import { ModalCoreProps } from './Modal';
|
|
8
|
+
import { SearchBarCoreProps } from './SearchBar';
|
|
9
|
+
import { TableActionCoreProps } from './TableActions';
|
|
10
|
+
import { TooltipCoreProps } from './Tooltip';
|
|
11
|
+
import { TypographyCoreProps } from './Typography';
|
|
12
|
+
/**
|
|
13
|
+
* A map of shared components to their (shared) props. Add new components here
|
|
14
|
+
* so that they may be referenced via dependency injection.
|
|
15
|
+
*/
|
|
16
|
+
type SharedComponentPropsMap = {
|
|
17
|
+
Button: ButtonCoreCommonProps;
|
|
18
|
+
Code: CodeCoreProps;
|
|
19
|
+
CopyableText: CopyableTextCoreProps;
|
|
20
|
+
Input: InputCoreProps;
|
|
21
|
+
Label: LabelCoreProps;
|
|
22
|
+
Modal: ModalCoreProps;
|
|
23
|
+
SearchBar: SearchBarCoreProps;
|
|
24
|
+
TableActions: TableActionCoreProps;
|
|
25
|
+
Tooltip: TooltipCoreProps;
|
|
26
|
+
Typography: TypographyCoreProps;
|
|
27
|
+
};
|
|
28
|
+
type SharedHooksMap = {
|
|
29
|
+
useClickToCopy: [[UseClickToCopyCoreParams], UseClickToCopyCoreReturnType];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Helper type for declaring props to reference other components via dependency
|
|
33
|
+
* injection.
|
|
34
|
+
*
|
|
35
|
+
* @template T The string identifier(s) of the components to reference. To
|
|
36
|
+
* reference multiple components, use a union type.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* const MyComponent = ({ ButtonComponent, ...props }: MyComponentProps & InjectedComponents<'Button'>) => {
|
|
41
|
+
* return <ButtonComponent>...</ButtonComponent>;
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export type InjectedComponents<T extends keyof SharedComponentPropsMap | keyof SharedHooksMap> = {
|
|
46
|
+
[K in T as K extends keyof SharedComponentPropsMap ? `${K}Component` : K]: K extends keyof SharedComponentPropsMap ? React.ComponentType<SharedComponentPropsMap[K]> : K extends keyof SharedHooksMap ? (...params: SharedHooksMap[K][0]) => SharedHooksMap[K][1] : never;
|
|
47
|
+
};
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type OptionItem = {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export type Prettify<T> = {
|
|
8
|
+
[K in keyof T]: T[K];
|
|
9
|
+
} & {};
|
|
10
|
+
export type TableItemRenderer<T> = {
|
|
11
|
+
title: string;
|
|
12
|
+
getValue(data: T, state?: Record<string, unknown>): string | number | boolean | ReactNode;
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { Classes } from './composeStyles';
|
|
3
|
+
export declare const makeClickToCopyStyles: <TProps extends object>(...styles: (Partial<import("@material-ui/core").StyleRules<"checkCircle" | "darkBackground" | "containerHover", TProps>> | ((theme: import("@material-ui/core").Theme) => Partial<import("@material-ui/core").StyleRules<"checkCircle" | "darkBackground" | "containerHover", TProps>>))[]) => keyof TProps extends never ? (props?: any) => import("@material-ui/styles").ClassNameMap<"checkCircle" | "darkBackground" | "containerHover"> : (props: TProps) => import("@material-ui/styles").ClassNameMap<"checkCircle" | "darkBackground" | "containerHover">;
|
|
4
|
+
export interface UseClickToCopyCoreParams {
|
|
5
|
+
darkBackground?: boolean;
|
|
6
|
+
iconSize?: 'small' | 'medium' | 'large';
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UseClickToCopyCoreReturnType {
|
|
10
|
+
copied: boolean;
|
|
11
|
+
copyToClipboard: (e: MouseEvent<HTMLElement>) => void;
|
|
12
|
+
CopyIcon: ReactNode;
|
|
13
|
+
containerHoverClass: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const useClickToCopyCore: ({ classes, darkBackground, iconSize, text, }: UseClickToCopyCoreParams & Classes<typeof makeClickToCopyStyles>) => UseClickToCopyCoreReturnType;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Theme as DefaultTheme } from '@material-ui/core/styles/createTheme';
|
|
2
|
+
import { ClassNameMap, StyleRules, StyleRulesCallback } from '@material-ui/core/styles/withStyles';
|
|
3
|
+
type PartialStyles<Theme, ClassKey extends string, Props extends object> = ((theme: Theme) => Partial<StyleRules<ClassKey, Props>>) | Partial<StyleRules<ClassKey, Props>>;
|
|
4
|
+
export declare const composeStyles: <Theme = DefaultTheme, Props extends object = {}, ClassKey extends string = string>(...styles: PartialStyles<Theme, ClassKey, Props>[]) => StyleRulesCallback<Theme, Props, ClassKey>;
|
|
5
|
+
/**
|
|
6
|
+
* A factory function for creating a makeStyles function with a base set of
|
|
7
|
+
* styles. Use this when creating a shared version of a component that needs to
|
|
8
|
+
* accept additional styles.
|
|
9
|
+
*
|
|
10
|
+
* @param baseStyles Base styles to be applied first
|
|
11
|
+
* @returns A typed version of makeStyles that merges the given base style with
|
|
12
|
+
* additional styles supplied later
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const makeButtonStyles = makeStylesFactory((theme) => ({
|
|
17
|
+
* // base styles
|
|
18
|
+
* button: {
|
|
19
|
+
* padding: theme.spacing(1),
|
|
20
|
+
* },
|
|
21
|
+
* }));
|
|
22
|
+
*
|
|
23
|
+
* // Base component definition
|
|
24
|
+
* const ButtonCore = ({ classes, ...props }: ButtonProps & Classes<typeof makeButtonStyles>) => {
|
|
25
|
+
* // ...
|
|
26
|
+
* };
|
|
27
|
+
*
|
|
28
|
+
* // Hook that generates merged styles
|
|
29
|
+
* const useStyles = makeButtonStyles((theme) => ({
|
|
30
|
+
* // additional styles to be merged
|
|
31
|
+
* button: {
|
|
32
|
+
* backgroundColor: theme.palette.primary.main,
|
|
33
|
+
* },
|
|
34
|
+
* }));
|
|
35
|
+
*
|
|
36
|
+
* // Customized component definition
|
|
37
|
+
* const Button = (props: ButtonProps) => {
|
|
38
|
+
* const classes = useStyles();
|
|
39
|
+
* return <ButtonCore {...props} classes={classes} />;
|
|
40
|
+
* };
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare const makeStylesFactory: <Props extends object, ClassKey extends string>(...baseStyles: PartialStyles<DefaultTheme, ClassKey, Props>[]) => <TProps extends Props>(...styles: PartialStyles<DefaultTheme, ClassKey, TProps>[]) => keyof TProps extends never ? (props?: any) => ClassNameMap<ClassKey> : (props: TProps) => ClassNameMap<ClassKey>;
|
|
44
|
+
export type ClassKeyFromFactory<T> = T extends (...args: any) => (...args: any) => ClassNameMap<infer U> ? ClassNameMap<U> : never;
|
|
45
|
+
/**
|
|
46
|
+
* A type that adds a `classes` prop to a component's props, given a factory
|
|
47
|
+
* function returned from `makeStylesFactory`.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* const MyComponent = ({ classes, ...props }: MyComponentProps & Classes<typeof makeMyComponentStyles>) => {
|
|
52
|
+
* // classes is the return value of `useStyles`
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export type Classes<T> = {
|
|
57
|
+
classes: ClassKeyFromFactory<T>;
|
|
58
|
+
};
|
|
59
|
+
export type WithClasses<P, T> = P & Classes<T>;
|
|
60
|
+
export {};
|