@fortanix/baklava 1.0.0-beta-20241114
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 +6 -0
- package/LICENSE +373 -0
- package/README.md +43 -0
- package/app/Demo.tsx +33 -0
- package/app/index.html +12 -0
- package/app/lib.ts +54 -0
- package/app/main.tsx +32 -0
- package/dist/baklava.d.ts +752 -0
- package/dist/baklava.js +4962 -0
- package/dist/lib.css +1 -0
- package/package.json +102 -0
- package/src/assets/fonts/montserrat/montserrat-v25-latin_latin-ext-100.woff2 +0 -0
- package/src/assets/fonts/montserrat/montserrat-v25-latin_latin-ext-200.woff2 +0 -0
- package/src/assets/fonts/montserrat/montserrat-v25-latin_latin-ext-300.woff2 +0 -0
- package/src/assets/fonts/montserrat/montserrat-v25-latin_latin-ext-500.woff2 +0 -0
- package/src/assets/fonts/montserrat/montserrat-v25-latin_latin-ext-600.woff2 +0 -0
- package/src/assets/fonts/montserrat/montserrat-v25-latin_latin-ext-700.woff2 +0 -0
- package/src/assets/fonts/montserrat/montserrat-v25-latin_latin-ext-regular.woff2 +0 -0
- package/src/assets/fonts/open-sans/open-sans-v23-latin-600.woff2 +0 -0
- package/src/assets/fonts/open-sans/open-sans-v23-latin-700.woff2 +0 -0
- package/src/assets/fonts/open-sans/open-sans-v23-latin-regular.woff2 +0 -0
- package/src/assets/fonts/source-code-pro/source-code-pro-v14-latin-regular.woff2 +0 -0
- package/src/assets/icons/_icons.ts +58 -0
- package/src/assets/icons/accounts.svg +11 -0
- package/src/assets/icons/alert.svg +3 -0
- package/src/assets/icons/apache.svg +3 -0
- package/src/assets/icons/apps.svg +5 -0
- package/src/assets/icons/assessment.svg +11 -0
- package/src/assets/icons/audit-log.svg +12 -0
- package/src/assets/icons/authentication.svg +12 -0
- package/src/assets/icons/calendar.svg +10 -0
- package/src/assets/icons/caret-down.svg +3 -0
- package/src/assets/icons/check.svg +3 -0
- package/src/assets/icons/cloud-accounts.svg +15 -0
- package/src/assets/icons/copy.svg +4 -0
- package/src/assets/icons/cross.svg +4 -0
- package/src/assets/icons/dashboard.svg +12 -0
- package/src/assets/icons/dataverse.svg +12 -0
- package/src/assets/icons/delete.svg +5 -0
- package/src/assets/icons/docs.svg +10 -0
- package/src/assets/icons/download.svg +11 -0
- package/src/assets/icons/edit-params.svg +3 -0
- package/src/assets/icons/edit.svg +10 -0
- package/src/assets/icons/email.svg +3 -0
- package/src/assets/icons/eye.svg +11 -0
- package/src/assets/icons/file-error.svg +17 -0
- package/src/assets/icons/file.svg +15 -0
- package/src/assets/icons/folder.svg +14 -0
- package/src/assets/icons/fortanix-ki.svg +13 -0
- package/src/assets/icons/graph.svg +9 -0
- package/src/assets/icons/groups.svg +10 -0
- package/src/assets/icons/hide.svg +3 -0
- package/src/assets/icons/home.svg +11 -0
- package/src/assets/icons/iam.svg +11 -0
- package/src/assets/icons/info.svg +4 -0
- package/src/assets/icons/infrastructure.svg +5 -0
- package/src/assets/icons/integrations.svg +3 -0
- package/src/assets/icons/key-link.svg +12 -0
- package/src/assets/icons/key.svg +4 -0
- package/src/assets/icons/no-login.svg +10 -0
- package/src/assets/icons/page-forward.svg +4 -0
- package/src/assets/icons/plugins.svg +4 -0
- package/src/assets/icons/policy.svg +13 -0
- package/src/assets/icons/print.svg +11 -0
- package/src/assets/icons/scripts.svg +4 -0
- package/src/assets/icons/search.svg +3 -0
- package/src/assets/icons/security-object.svg +5 -0
- package/src/assets/icons/services.svg +10 -0
- package/src/assets/icons/settings.svg +12 -0
- package/src/assets/icons/solutions.svg +3 -0
- package/src/assets/icons/success.svg +3 -0
- package/src/assets/icons/tasks.svg +10 -0
- package/src/assets/icons/user-profile.svg +3 -0
- package/src/assets/icons/user.svg +10 -0
- package/src/assets/icons/warning.svg +3 -0
- package/src/assets/icons/workflows.svg +11 -0
- package/src/assets/icons_new/Accounts.svg +11 -0
- package/src/assets/icons_new/Alert.svg +3 -0
- package/src/assets/icons_new/Apache.svg +3 -0
- package/src/assets/icons_new/Apps.svg +5 -0
- package/src/assets/icons_new/Assessment.svg +11 -0
- package/src/assets/icons_new/Audit Log.svg +12 -0
- package/src/assets/icons_new/Authentication.svg +12 -0
- package/src/assets/icons_new/Calendar.svg +10 -0
- package/src/assets/icons_new/Carrot Down.svg +3 -0
- package/src/assets/icons_new/Cloud Accounts.svg +15 -0
- package/src/assets/icons_new/Copy.svg +4 -0
- package/src/assets/icons_new/Dashboard.svg +12 -0
- package/src/assets/icons_new/Dataverse.svg +12 -0
- package/src/assets/icons_new/Delete.svg +5 -0
- package/src/assets/icons_new/Docs.svg +10 -0
- package/src/assets/icons_new/Download.svg +11 -0
- package/src/assets/icons_new/Edit Params.svg +3 -0
- package/src/assets/icons_new/Edit.svg +10 -0
- package/src/assets/icons_new/Email.svg +3 -0
- package/src/assets/icons_new/Eye.svg +11 -0
- package/src/assets/icons_new/Groups.svg +10 -0
- package/src/assets/icons_new/Hide.svg +3 -0
- package/src/assets/icons_new/Home.svg +11 -0
- package/src/assets/icons_new/IAM.svg +11 -0
- package/src/assets/icons_new/Info.svg +4 -0
- package/src/assets/icons_new/Infrastructure.svg +5 -0
- package/src/assets/icons_new/Integrations.svg +3 -0
- package/src/assets/icons_new/KI.svg +13 -0
- package/src/assets/icons_new/Key Link.svg +12 -0
- package/src/assets/icons_new/Key.svg +4 -0
- package/src/assets/icons_new/No Login.svg +10 -0
- package/src/assets/icons_new/Page FWD.svg +4 -0
- package/src/assets/icons_new/Plugins.svg +4 -0
- package/src/assets/icons_new/Policy.svg +13 -0
- package/src/assets/icons_new/Print.svg +11 -0
- package/src/assets/icons_new/Scripts.svg +4 -0
- package/src/assets/icons_new/Search.svg +3 -0
- package/src/assets/icons_new/Security Objects.svg +5 -0
- package/src/assets/icons_new/Services.svg +10 -0
- package/src/assets/icons_new/Settings.svg +12 -0
- package/src/assets/icons_new/Solutions.svg +3 -0
- package/src/assets/icons_new/Tasks.svg +10 -0
- package/src/assets/icons_new/User Account.svg +3 -0
- package/src/assets/icons_new/Users.svg +10 -0
- package/src/assets/icons_new/Workflows.svg +11 -0
- package/src/assets/icons_old/_icons.ts +172 -0
- package/src/assets/icons_old/account.svg +4 -0
- package/src/assets/icons_old/accounts.svg +4 -0
- package/src/assets/icons_old/add.svg +4 -0
- package/src/assets/icons_old/alert.svg +4 -0
- package/src/assets/icons_old/app.svg +4 -0
- package/src/assets/icons_old/arrow-drop-down.svg +4 -0
- package/src/assets/icons_old/arrow-drop-up.svg +4 -0
- package/src/assets/icons_old/arrow-expand.svg +4 -0
- package/src/assets/icons_old/arrow-left.svg +5 -0
- package/src/assets/icons_old/arrow-right.svg +4 -0
- package/src/assets/icons_old/audit-log.svg +4 -0
- package/src/assets/icons_old/bell.svg +4 -0
- package/src/assets/icons_old/billing.svg +4 -0
- package/src/assets/icons_old/bug.svg +4 -0
- package/src/assets/icons_old/builds.svg +4 -0
- package/src/assets/icons_old/calendar.svg +4 -0
- package/src/assets/icons_old/certificate.svg +4 -0
- package/src/assets/icons_old/check.svg +4 -0
- package/src/assets/icons_old/checkbox-checked.svg +4 -0
- package/src/assets/icons_old/checkbox-disabled.svg +4 -0
- package/src/assets/icons_old/checkbox-unchecked.svg +4 -0
- package/src/assets/icons_old/chevron-left.svg +4 -0
- package/src/assets/icons_old/chevron-right.svg +4 -0
- package/src/assets/icons_old/clear-all.svg +4 -0
- package/src/assets/icons_old/color-picker.svg +10 -0
- package/src/assets/icons_old/connection.svg +4 -0
- package/src/assets/icons_old/copy.svg +4 -0
- package/src/assets/icons_old/cross-thin.svg +4 -0
- package/src/assets/icons_old/cross.svg +4 -0
- package/src/assets/icons_old/crypto-policy.svg +4 -0
- package/src/assets/icons_old/customers.svg +4 -0
- package/src/assets/icons_old/dashboard.svg +4 -0
- package/src/assets/icons_old/data-center.svg +4 -0
- package/src/assets/icons_old/data-connector-read.svg +6 -0
- package/src/assets/icons_old/data-connector-write.svg +6 -0
- package/src/assets/icons_old/dataset.svg +3 -0
- package/src/assets/icons_old/dataverse.svg +6 -0
- package/src/assets/icons_old/delete.svg +4 -0
- package/src/assets/icons_old/deployment-deployed.svg +4 -0
- package/src/assets/icons_old/deployment-none.svg +4 -0
- package/src/assets/icons_old/derive.svg +4 -0
- package/src/assets/icons_old/docs.svg +4 -0
- package/src/assets/icons_old/document-blank.svg +4 -0
- package/src/assets/icons_old/domain.svg +4 -0
- package/src/assets/icons_old/download-cloud.svg +4 -0
- package/src/assets/icons_old/download.svg +4 -0
- package/src/assets/icons_old/edit-params.svg +4 -0
- package/src/assets/icons_old/edit.svg +4 -0
- package/src/assets/icons_old/em-app.svg +4 -0
- package/src/assets/icons_old/em-dashboard.svg +4 -0
- package/src/assets/icons_old/email.svg +4 -0
- package/src/assets/icons_old/empty-credential.svg +4 -0
- package/src/assets/icons_old/enterprise-badge.svg +6 -0
- package/src/assets/icons_old/environment-production.svg +4 -0
- package/src/assets/icons_old/environment-test.svg +4 -0
- package/src/assets/icons_old/event-critical.svg +4 -0
- package/src/assets/icons_old/event-error.svg +4 -0
- package/src/assets/icons_old/event-success.svg +4 -0
- package/src/assets/icons_old/event-warning.svg +4 -0
- package/src/assets/icons_old/expiration.svg +4 -0
- package/src/assets/icons_old/export.svg +4 -0
- package/src/assets/icons_old/external.svg +4 -0
- package/src/assets/icons_old/eye-closed.svg +4 -0
- package/src/assets/icons_old/eye.svg +4 -0
- package/src/assets/icons_old/file.svg +7 -0
- package/src/assets/icons_old/flag.svg +4 -0
- package/src/assets/icons_old/forbid.svg +4 -0
- package/src/assets/icons_old/fortanix-app-aci.svg +6 -0
- package/src/assets/icons_old/fortanix-app-edp.svg +4 -0
- package/src/assets/icons_old/fortanix-app-enclave-os.svg +4 -0
- package/src/assets/icons_old/frame-expand.svg +4 -0
- package/src/assets/icons_old/fresh.svg +4 -0
- package/src/assets/icons_old/generated.svg +4 -0
- package/src/assets/icons_old/gift.svg +4 -0
- package/src/assets/icons_old/global.svg +4 -0
- package/src/assets/icons_old/group.svg +4 -0
- package/src/assets/icons_old/help.svg +4 -0
- package/src/assets/icons_old/home-info.svg +5 -0
- package/src/assets/icons_old/home.svg +4 -0
- package/src/assets/icons_old/horizontal-collapse.svg +5 -0
- package/src/assets/icons_old/horizontal-expand.svg +5 -0
- package/src/assets/icons_old/hsm.svg +4 -0
- package/src/assets/icons_old/info.svg +4 -0
- package/src/assets/icons_old/install.svg +4 -0
- package/src/assets/icons_old/integration.svg +7 -0
- package/src/assets/icons_old/key-clone.svg +4 -0
- package/src/assets/icons_old/key-custodian-policy.svg +10 -0
- package/src/assets/icons_old/key-destroy.svg +4 -0
- package/src/assets/icons_old/key-download.svg +4 -0
- package/src/assets/icons_old/key-justification-policy.svg +5 -0
- package/src/assets/icons_old/key-link.svg +4 -0
- package/src/assets/icons_old/key-metadata-policy.svg +5 -0
- package/src/assets/icons_old/key-primary.svg +11 -0
- package/src/assets/icons_old/key-remove.svg +4 -0
- package/src/assets/icons_old/key-rotation.svg +4 -0
- package/src/assets/icons_old/key-undo-policy.svg +10 -0
- package/src/assets/icons_old/key-wrapping.svg +6 -0
- package/src/assets/icons_old/key.svg +4 -0
- package/src/assets/icons_old/leave-account.svg +4 -0
- package/src/assets/icons_old/link.svg +4 -0
- package/src/assets/icons_old/lock-closed.svg +4 -0
- package/src/assets/icons_old/lock.svg +4 -0
- package/src/assets/icons_old/locked-user.svg +4 -0
- package/src/assets/icons_old/marketplace.svg +4 -0
- package/src/assets/icons_old/minus.svg +4 -0
- package/src/assets/icons_old/monitoring.svg +4 -0
- package/src/assets/icons_old/no-logging.svg +4 -0
- package/src/assets/icons_old/node-cluster.svg +4 -0
- package/src/assets/icons_old/node.svg +4 -0
- package/src/assets/icons_old/operations.svg +13 -0
- package/src/assets/icons_old/options.svg +4 -0
- package/src/assets/icons_old/play.svg +4 -0
- package/src/assets/icons_old/plug.svg +4 -0
- package/src/assets/icons_old/plugin-clone.svg +4 -0
- package/src/assets/icons_old/plugin.svg +4 -0
- package/src/assets/icons_old/plugins.svg +4 -0
- package/src/assets/icons_old/pod.svg +4 -0
- package/src/assets/icons_old/print.svg +4 -0
- package/src/assets/icons_old/projects.svg +11 -0
- package/src/assets/icons_old/python.svg +4 -0
- package/src/assets/icons_old/quorum.svg +4 -0
- package/src/assets/icons_old/refresh.svg +4 -0
- package/src/assets/icons_old/regenerate.svg +4 -0
- package/src/assets/icons_old/region.svg +4 -0
- package/src/assets/icons_old/reports.svg +3 -0
- package/src/assets/icons_old/request-approve.svg +4 -0
- package/src/assets/icons_old/request-decline.svg +4 -0
- package/src/assets/icons_old/reseller.svg +4 -0
- package/src/assets/icons_old/script.svg +7 -0
- package/src/assets/icons_old/search.svg +4 -0
- package/src/assets/icons_old/service-account.svg +4 -0
- package/src/assets/icons_old/settings.svg +4 -0
- package/src/assets/icons_old/sidebar-closed.svg +8 -0
- package/src/assets/icons_old/sidebar-open.svg +8 -0
- package/src/assets/icons_old/sign-out.svg +4 -0
- package/src/assets/icons_old/sign.svg +4 -0
- package/src/assets/icons_old/software.svg +4 -0
- package/src/assets/icons_old/sql-aggregate.svg +7 -0
- package/src/assets/icons_old/sql.svg +7 -0
- package/src/assets/icons_old/stack.svg +4 -0
- package/src/assets/icons_old/star-empty.svg +4 -0
- package/src/assets/icons_old/star-fill.svg +4 -0
- package/src/assets/icons_old/subscription.svg +5 -0
- package/src/assets/icons_old/support.svg +11 -0
- package/src/assets/icons_old/switcher.svg +4 -0
- package/src/assets/icons_old/sysadmin.svg +4 -0
- package/src/assets/icons_old/tag.svg +4 -0
- package/src/assets/icons_old/target.svg +4 -0
- package/src/assets/icons_old/tasks.svg +4 -0
- package/src/assets/icons_old/tfa-user.svg +4 -0
- package/src/assets/icons_old/tfa.svg +4 -0
- package/src/assets/icons_old/tokenization.svg +4 -0
- package/src/assets/icons_old/tools.svg +4 -0
- package/src/assets/icons_old/transition-from.svg +4 -0
- package/src/assets/icons_old/transition-to.svg +4 -0
- package/src/assets/icons_old/upload.svg +4 -0
- package/src/assets/icons_old/user-remove.svg +3 -0
- package/src/assets/icons_old/user.svg +4 -0
- package/src/assets/icons_old/view-type-cards.svg +4 -0
- package/src/assets/icons_old/view-type-list.svg +4 -0
- package/src/assets/icons_old/view-type-table.svg +4 -0
- package/src/assets/icons_old/warning.svg +4 -0
- package/src/assets/icons_old/workflow.svg +3 -0
- package/src/assets/icons_old/wrap.svg +4 -0
- package/src/assets/icons_old/wrench.svg +4 -0
- package/src/assets/images/fortanix_logo_icon.svg +20 -0
- package/src/components/actions/Button/Button.module.scss +81 -0
- package/src/components/actions/Button/Button.stories.tsx +262 -0
- package/src/components/actions/Button/Button.tsx +133 -0
- package/src/components/actions/ButtonAsLink/ButtonAsLink.module.scss +13 -0
- package/src/components/actions/ButtonAsLink/ButtonAsLink.stories.tsx +49 -0
- package/src/components/actions/ButtonAsLink/ButtonAsLink.tsx +56 -0
- package/src/components/actions/Link/Link.module.scss +38 -0
- package/src/components/actions/Link/Link.stories.tsx +54 -0
- package/src/components/actions/Link/Link.tsx +59 -0
- package/src/components/actions/LinkAsButton/LinkAsButton.stories.tsx +70 -0
- package/src/components/actions/LinkAsButton/LinkAsButton.tsx +59 -0
- package/src/components/containers/Alert/Alert.module.scss +41 -0
- package/src/components/containers/Alert/Alert.stories.tsx +47 -0
- package/src/components/containers/Alert/Alert.tsx +65 -0
- package/src/components/containers/Banner/Banner.module.scss +100 -0
- package/src/components/containers/Banner/Banner.stories.tsx +198 -0
- package/src/components/containers/Banner/Banner.tsx +121 -0
- package/src/components/containers/Card/Card.module.scss +32 -0
- package/src/components/containers/Card/Card.stories.tsx +67 -0
- package/src/components/containers/Card/Card.tsx +48 -0
- package/src/components/containers/Dialog/Dialog.module.scss +166 -0
- package/src/components/containers/Dialog/Dialog.stories.tsx +32 -0
- package/src/components/containers/Dialog/Dialog.tsx +130 -0
- package/src/components/containers/Panel/Panel.module.scss +32 -0
- package/src/components/containers/Panel/Panel.stories.tsx +46 -0
- package/src/components/containers/Panel/Panel.tsx +48 -0
- package/src/components/forms/context/Form/Form.module.scss +11 -0
- package/src/components/forms/context/Form/Form.stories.tsx +99 -0
- package/src/components/forms/context/Form/Form.tsx +106 -0
- package/src/components/forms/context/Form/FormOptics.tsx +109 -0
- package/src/components/forms/context/SubmitButton/SubmitButton.module.scss +9 -0
- package/src/components/forms/context/SubmitButton/SubmitButton.stories.tsx +132 -0
- package/src/components/forms/context/SubmitButton/SubmitButton.tsx +98 -0
- package/src/components/forms/controls/Checkbox/Checkbox.module.scss +67 -0
- package/src/components/forms/controls/Checkbox/Checkbox.stories.tsx +119 -0
- package/src/components/forms/controls/Checkbox/Checkbox.tsx +53 -0
- package/src/components/forms/controls/Input/Input.module.scss +40 -0
- package/src/components/forms/controls/Input/Input.stories.tsx +55 -0
- package/src/components/forms/controls/Input/Input.tsx +44 -0
- package/src/components/forms/controls/SegmentedControl/SegmentedControl.module.scss +76 -0
- package/src/components/forms/controls/SegmentedControl/SegmentedControl.stories.tsx +92 -0
- package/src/components/forms/controls/SegmentedControl/SegmentedControl.tsx +103 -0
- package/src/components/forms/controls/Select/Select.module.scss +105 -0
- package/src/components/forms/controls/Select/Select.stories.tsx +43 -0
- package/src/components/forms/controls/Select/Select.tsx +166 -0
- package/src/components/forms/controls/Switch/Switch.module.scss +63 -0
- package/src/components/forms/controls/Switch/Switch.stories.tsx +50 -0
- package/src/components/forms/controls/Switch/Switch.tsx +46 -0
- package/src/components/forms/fields/CheckboxField/CheckboxField.module.scss +46 -0
- package/src/components/forms/fields/CheckboxField/CheckboxField.stories.tsx +74 -0
- package/src/components/forms/fields/CheckboxField/CheckboxField.tsx +118 -0
- package/src/components/forms/fields/CheckboxGroup/CheckboxGroup.module.scss +22 -0
- package/src/components/forms/fields/CheckboxGroup/CheckboxGroup.stories.tsx +36 -0
- package/src/components/forms/fields/CheckboxGroup/CheckboxGroup.tsx +37 -0
- package/src/components/forms/fields/InputField/InputField.module.scss +24 -0
- package/src/components/forms/fields/InputField/InputField.stories.tsx +57 -0
- package/src/components/forms/fields/InputField/InputField.tsx +72 -0
- package/src/components/graphics/Icon/Icon.module.scss +42 -0
- package/src/components/graphics/Icon/Icon.stories.tsx +67 -0
- package/src/components/graphics/Icon/Icon.tsx +50 -0
- package/src/components/graphics/PlaceholderEmpty/PlaceholderEmpty.module.scss +76 -0
- package/src/components/graphics/PlaceholderEmpty/PlaceholderEmpty.stories.tsx +101 -0
- package/src/components/graphics/PlaceholderEmpty/PlaceholderEmpty.tsx +91 -0
- package/src/components/graphics/ProgressBar/ProgressBar.module.scss +43 -0
- package/src/components/graphics/ProgressBar/ProgressBar.stories.tsx +70 -0
- package/src/components/graphics/ProgressBar/ProgressBar.tsx +58 -0
- package/src/components/graphics/Spinner/Spinner.module.scss +61 -0
- package/src/components/graphics/Spinner/Spinner.stories.tsx +56 -0
- package/src/components/graphics/Spinner/Spinner.tsx +41 -0
- package/src/components/lists/PropertyList/PropertyList.module.scss +33 -0
- package/src/components/lists/PropertyList/PropertyList.stories.tsx +45 -0
- package/src/components/lists/PropertyList/PropertyList.tsx +60 -0
- package/src/components/navigations/Stepper/Stepper.module.scss +88 -0
- package/src/components/navigations/Stepper/Stepper.stories.tsx +68 -0
- package/src/components/navigations/Stepper/Stepper.tsx +95 -0
- package/src/components/navigations/Tabs/Tabs.module.scss +71 -0
- package/src/components/navigations/Tabs/Tabs.stories.tsx +106 -0
- package/src/components/navigations/Tabs/Tabs.tsx +121 -0
- package/src/components/overlays/DropdownMenu/DropdownMenu.module.scss +113 -0
- package/src/components/overlays/DropdownMenu/DropdownMenu.stories.tsx +91 -0
- package/src/components/overlays/DropdownMenu/DropdownMenu.tsx +155 -0
- package/src/components/overlays/DropdownMenu/DropdownMenuProvider.module.scss +105 -0
- package/src/components/overlays/DropdownMenu/DropdownMenuProvider.stories.tsx +71 -0
- package/src/components/overlays/DropdownMenu/DropdownMenuProvider.tsx +168 -0
- package/src/components/overlays/Modal/Modal.module.scss +185 -0
- package/src/components/overlays/Modal/Modal.stories.tsx +144 -0
- package/src/components/overlays/Modal/Modal.tsx +202 -0
- package/src/components/overlays/Toast/Toast.module.scss +123 -0
- package/src/components/overlays/Toast/Toast.stories.tsx +219 -0
- package/src/components/overlays/Toast/Toast.tsx +233 -0
- package/src/components/overlays/Toast/ToastyOverride.scss +27 -0
- package/src/components/overlays/Tooltip/Tooltip.module.scss +162 -0
- package/src/components/overlays/Tooltip/Tooltip.stories.tsx +115 -0
- package/src/components/overlays/Tooltip/Tooltip.tsx +75 -0
- package/src/components/overlays/Tooltip/TooltipProvider.stories.tsx +169 -0
- package/src/components/overlays/Tooltip/TooltipProvider.tsx +164 -0
- package/src/components/util/Clipboard/Clipboard.tsx +11 -0
- package/src/components/util/Popover/Popover.tsx +219 -0
- package/src/docs/Changelog.mdx +7 -0
- package/src/docs/Colors.mdx +113 -0
- package/src/docs/Colors.module.scss +56 -0
- package/src/docs/Iconography.mdx +70 -0
- package/src/docs/Iconography.module.scss +37 -0
- package/src/docs/Introduction.mdx +26 -0
- package/src/docs/Typography.mdx +109 -0
- package/src/docs/Typography.module.scss +22 -0
- package/src/layouts/AppLayout/AppLayout.module.scss +110 -0
- package/src/layouts/AppLayout/AppLayout.stories.tsx +112 -0
- package/src/layouts/AppLayout/AppLayout.tsx +31 -0
- package/src/layouts/AppLayout/Breadcrumbs/Breadcrumbs.module.scss +47 -0
- package/src/layouts/AppLayout/Breadcrumbs/Breadcrumbs.stories.tsx +66 -0
- package/src/layouts/AppLayout/Breadcrumbs/Breadcrumbs.tsx +63 -0
- package/src/layouts/AppLayout/Header/AccountSelector.module.scss +24 -0
- package/src/layouts/AppLayout/Header/AccountSelector.stories.tsx +31 -0
- package/src/layouts/AppLayout/Header/AccountSelector.tsx +51 -0
- package/src/layouts/AppLayout/Header/Header.module.scss +74 -0
- package/src/layouts/AppLayout/Header/Header.stories.tsx +30 -0
- package/src/layouts/AppLayout/Header/Header.tsx +31 -0
- package/src/layouts/AppLayout/Header/SolutionSelector.module.scss +24 -0
- package/src/layouts/AppLayout/Header/SolutionSelector.stories.tsx +31 -0
- package/src/layouts/AppLayout/Header/SolutionSelector.tsx +50 -0
- package/src/layouts/AppLayout/Header/UserMenu.module.scss +31 -0
- package/src/layouts/AppLayout/Header/UserMenu.stories.tsx +32 -0
- package/src/layouts/AppLayout/Header/UserMenu.tsx +67 -0
- package/src/layouts/AppLayout/Logo/Logo.module.scss +78 -0
- package/src/layouts/AppLayout/Logo/Logo.tsx +38 -0
- package/src/layouts/AppLayout/Nav/Nav.module.scss +73 -0
- package/src/layouts/AppLayout/Nav/Nav.stories.tsx +32 -0
- package/src/layouts/AppLayout/Nav/Nav.tsx +75 -0
- package/src/layouts/AppLayout/Sidebar/Sidebar.module.scss +46 -0
- package/src/layouts/AppLayout/Sidebar/Sidebar.stories.tsx +30 -0
- package/src/layouts/AppLayout/Sidebar/Sidebar.tsx +33 -0
- package/src/layouts/FormLayout/FormLayout.module.scss +19 -0
- package/src/layouts/FormLayout/FormLayout.stories.tsx +64 -0
- package/src/layouts/FormLayout/FormLayout.tsx +32 -0
- package/src/styling/accessibility.css +24 -0
- package/src/styling/context/theming.scss +26 -0
- package/src/styling/context/theming_mixins.scss +79 -0
- package/src/styling/defs.scss +60 -0
- package/src/styling/fonts.css +126 -0
- package/src/styling/fonts_mixins.scss +16 -0
- package/src/styling/global.scss +49 -0
- package/src/styling/lib/normalize.css +78 -0
- package/src/styling/lib/reset-custom.css +58 -0
- package/src/styling/lib/reset.css +115 -0
- package/src/styling/main.scss +29 -0
- package/src/styling/variables.css +18 -0
- package/src/styling/variables.scss +928 -0
- package/src/styling/variables.ts +64 -0
- package/src/types/globals.d.ts +14 -0
- package/src/types/vite-env.d.ts +1 -0
- package/src/typography/BodyText/BodyText.mixins.scss +224 -0
- package/src/typography/BodyText/BodyText.module.scss +28 -0
- package/src/typography/BodyText/BodyText.stories.tsx +109 -0
- package/src/typography/BodyText/BodyText.tsx +30 -0
- package/src/typography/Heading/Heading.mixins.scss +42 -0
- package/src/typography/Heading/Heading.module.scss +15 -0
- package/src/typography/Heading/Heading.stories.tsx +112 -0
- package/src/typography/Heading/Heading.tsx +57 -0
- package/src/util/componentUtil.ts +19 -0
- package/src/util/drag.ts +197 -0
- package/src/util/reactUtil.ts +40 -0
- package/src/util/storybook/OverflowTester.css +13 -0
- package/src/util/storybook/OverflowTester.tsx +30 -0
- package/src/util/time.ts +12 -0
- package/src/util/types.ts +8 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* Copyright (c) Fortanix, Inc.
|
|
2
|
+
|* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
|
|
3
|
+
|* the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
@use '../../../styling/defs.scss' as bk;
|
|
6
|
+
|
|
7
|
+
@layer baklava.components {
|
|
8
|
+
.bk-toast {
|
|
9
|
+
width: auto !important; // Override style for .Toastify__toast-container
|
|
10
|
+
padding: 0 !important; // Override style for .Toastify__toast-container
|
|
11
|
+
width: 400px !important; // Override style for .Toastify__toast-container
|
|
12
|
+
|
|
13
|
+
&:has(.bk-close--dark) {
|
|
14
|
+
.bk-toast__body {
|
|
15
|
+
margin-right: bk.$spacing-4 !important; // Override style for .Toastify__toast-body
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.bk-toast--success,
|
|
20
|
+
.bk-toast--info,
|
|
21
|
+
.bk-toast--error {
|
|
22
|
+
min-height: 54px !important; // Override style for .Toastify__toast
|
|
23
|
+
padding: bk.$spacing-4 !important; // Override style for .Toastify__toast
|
|
24
|
+
border: 1px solid transparent;
|
|
25
|
+
border-left: 4px solid transparent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.bk-toast--success {
|
|
29
|
+
border-color: #{bk.$theme-notification-success-border-default};
|
|
30
|
+
// Override style for .Toastify__toast-theme--light
|
|
31
|
+
background-color: #{bk.$theme-notification-success-background-default} !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.bk-toast--info {
|
|
35
|
+
border-color: #{bk.$theme-notification-informational-border-default};
|
|
36
|
+
// Override style for .Toastify__toast-theme--light
|
|
37
|
+
background-color: #{bk.$theme-notification-informational-background-default} !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.bk-toast--error {
|
|
41
|
+
border-color: #{bk.$theme-notification-alert-border-default};
|
|
42
|
+
// Override style for .Toastify__toast-theme--light
|
|
43
|
+
background-color: #{bk.$theme-notification-alert-background-default} !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.bk-toast__icon--success,
|
|
47
|
+
.bk-toast__icon--info,
|
|
48
|
+
.bk-toast__icon--error {
|
|
49
|
+
font-size: 18px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.bk-toast__icon--success {
|
|
53
|
+
color: #{bk.$theme-notification-success-border-default};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.bk-toast__icon--info {
|
|
57
|
+
color: #{bk.$theme-notification-informational-border-default};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.bk-toast__icon--error {
|
|
61
|
+
color: #{bk.$theme-notification-alert-border-default};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.bk-close--dark {
|
|
65
|
+
position: absolute;
|
|
66
|
+
top: bk.$spacing-4;
|
|
67
|
+
right: bk.$spacing-4;
|
|
68
|
+
color: #{bk.$theme-notification-icon-default};
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.bk-toast__body {
|
|
73
|
+
margin: 0 !important; // Override style for .Toastify__toast-body
|
|
74
|
+
padding: 0 !important; // Override style for .Toastify__toast-body
|
|
75
|
+
align-items: flex-start !important; // Override style for .Toastify__toast-body
|
|
76
|
+
color: bk.$theme-notification-text-default;
|
|
77
|
+
@include bk.font(bk.$font-family-body);
|
|
78
|
+
font-size: 14px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.bk-toast__message {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
gap: bk.$spacing-1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.bk-toast__message__title {
|
|
88
|
+
font-weight: bk.$font-weight-semibold;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.bk-toast__actions {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
gap: bk.$spacing-3;
|
|
95
|
+
margin-top: bk.$spacing-3;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.bk-toast__copy-icon {
|
|
99
|
+
padding: 0;
|
|
100
|
+
color: bk.$theme-notification-text-link;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.bk-toast__progress-bar--success,
|
|
104
|
+
.bk-toast__progress-bar--info,
|
|
105
|
+
.bk-toast__progress-bar--error {
|
|
106
|
+
margin-top: bk.$spacing-3;
|
|
107
|
+
opacity: 1 !important; // Override style for .Toastify__progress-bar
|
|
108
|
+
background-color: #{bk.$theme-progress-bar-fill} !important; // Override style for .Toastify__progress-bar
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.bk-toast__button,
|
|
112
|
+
.bk-toast__copy-button {
|
|
113
|
+
padding: 0;
|
|
114
|
+
color: bk.$theme-notification-text-link;
|
|
115
|
+
font-size: 12px;
|
|
116
|
+
font-weight: bk.$font-weight-semibold;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.bk-toast__link {
|
|
120
|
+
font-weight: bk.$font-weight-semibold;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/* Copyright (c) Fortanix, Inc.
|
|
2
|
+
|* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
|
|
3
|
+
|* the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
7
|
+
|
|
8
|
+
import { Button } from '../../actions/Button/Button.tsx';
|
|
9
|
+
import {
|
|
10
|
+
notify,
|
|
11
|
+
ToastButton,
|
|
12
|
+
CopyActionButton,
|
|
13
|
+
ToastLink,
|
|
14
|
+
ToastMessage,
|
|
15
|
+
ToastProvider,
|
|
16
|
+
type NotifyProps,
|
|
17
|
+
} from './Toast.tsx';
|
|
18
|
+
|
|
19
|
+
type ToastArg = NotifyProps;
|
|
20
|
+
type Story = StoryObj<ToastArg>;
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
component: ToastMessage,
|
|
24
|
+
parameters: {
|
|
25
|
+
layout: 'centered',
|
|
26
|
+
},
|
|
27
|
+
tags: ['autodocs'],
|
|
28
|
+
argTypes: {},
|
|
29
|
+
args: {
|
|
30
|
+
title: 'Title',
|
|
31
|
+
},
|
|
32
|
+
decorators: [
|
|
33
|
+
Story => (
|
|
34
|
+
<ToastProvider>
|
|
35
|
+
<Story/>
|
|
36
|
+
</ToastProvider>
|
|
37
|
+
),
|
|
38
|
+
],
|
|
39
|
+
} satisfies Meta<ToastArg>;
|
|
40
|
+
|
|
41
|
+
const notificationText = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, magna aliqua.`;
|
|
42
|
+
|
|
43
|
+
const Actions = () => {
|
|
44
|
+
return (
|
|
45
|
+
<>
|
|
46
|
+
<CopyActionButton message={notificationText} />
|
|
47
|
+
<ToastButton>Share</ToastButton>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Success: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
options: {},
|
|
55
|
+
},
|
|
56
|
+
render: (args) => (
|
|
57
|
+
<Button onClick={() => notify.success(args)}>
|
|
58
|
+
Notify Success
|
|
59
|
+
</Button>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const Info: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
options: {},
|
|
66
|
+
},
|
|
67
|
+
render: (args) => (
|
|
68
|
+
<Button onClick={() => notify.info(args)}>
|
|
69
|
+
Notify Info
|
|
70
|
+
</Button>
|
|
71
|
+
),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Error: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
options: {},
|
|
77
|
+
},
|
|
78
|
+
render: (args) => (
|
|
79
|
+
<Button onClick={() => notify.error(args)}>
|
|
80
|
+
Notify Error
|
|
81
|
+
</Button>
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const ErrorWithMessage: Story = {
|
|
86
|
+
args: {
|
|
87
|
+
message: notificationText,
|
|
88
|
+
options: {},
|
|
89
|
+
},
|
|
90
|
+
render: (args) => (
|
|
91
|
+
<Button onClick={() => notify.error(args)}>
|
|
92
|
+
Notify Error with message (includes a default copy button)
|
|
93
|
+
</Button>
|
|
94
|
+
),
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const SuccessWithMessageAndLink: Story = {
|
|
98
|
+
args: {
|
|
99
|
+
message: (
|
|
100
|
+
<>
|
|
101
|
+
{`${notificationText} `}
|
|
102
|
+
<ToastLink href="/">Link</ToastLink>
|
|
103
|
+
</>
|
|
104
|
+
),
|
|
105
|
+
options: {
|
|
106
|
+
autoClose: false,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
render: (args) => (
|
|
110
|
+
<Button onClick={() => notify.success(args)}>
|
|
111
|
+
Notify success with message and link
|
|
112
|
+
</Button>
|
|
113
|
+
),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const SuccessWithCloseButton: Story = {
|
|
117
|
+
args: {
|
|
118
|
+
message: notificationText,
|
|
119
|
+
options: {
|
|
120
|
+
closeButton: true,
|
|
121
|
+
autoClose: false,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
render: (args) => (
|
|
125
|
+
<Button onClick={() => notify.success(args)}>
|
|
126
|
+
Notify success with close button
|
|
127
|
+
</Button>
|
|
128
|
+
),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const SuccessWithActions: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
message: notificationText,
|
|
134
|
+
options: {
|
|
135
|
+
closeButton: true,
|
|
136
|
+
autoClose: false,
|
|
137
|
+
actions: <Actions />,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
render: (args) => (
|
|
141
|
+
<Button onClick={() => notify.success(args)}>
|
|
142
|
+
Notify success with actions
|
|
143
|
+
</Button>
|
|
144
|
+
),
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const PreventDuplicate: Story = {
|
|
148
|
+
args: {
|
|
149
|
+
options: {
|
|
150
|
+
toastId: 'uniqueId',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
render: (args) => (
|
|
154
|
+
<Button onClick={() => notify.success(args)}>
|
|
155
|
+
Notify
|
|
156
|
+
</Button>
|
|
157
|
+
),
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const AddProgressBarToAllToasts: Story = {
|
|
161
|
+
args: {
|
|
162
|
+
message: notificationText,
|
|
163
|
+
options: {
|
|
164
|
+
closeButton: true,
|
|
165
|
+
actions: <Actions />,
|
|
166
|
+
hideProgressBar: false,
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
render: (args) => (
|
|
170
|
+
<>
|
|
171
|
+
<div style={{ marginBottom: '20px' }}>
|
|
172
|
+
<Button onClick={() => notify.success(args)}>
|
|
173
|
+
Notify success with progress bar
|
|
174
|
+
</Button>
|
|
175
|
+
</div>
|
|
176
|
+
<div style={{ marginBottom: '20px' }}>
|
|
177
|
+
<Button onClick={() => notify.info(args)}>
|
|
178
|
+
Notify info with progress bar
|
|
179
|
+
</Button>
|
|
180
|
+
</div>
|
|
181
|
+
<div style={{ marginBottom: '20px' }}>
|
|
182
|
+
<Button onClick={() => notify.error(args)}>
|
|
183
|
+
Notify error with progress bar
|
|
184
|
+
</Button>
|
|
185
|
+
</div>
|
|
186
|
+
</>
|
|
187
|
+
),
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export const AddProgressBarToAllToastsWithAutoDelay: Story = {
|
|
191
|
+
args: {
|
|
192
|
+
message: notificationText,
|
|
193
|
+
options: {
|
|
194
|
+
delay: 3000,
|
|
195
|
+
closeButton: true,
|
|
196
|
+
actions: <Actions />,
|
|
197
|
+
hideProgressBar: false,
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
render: (args) => (
|
|
201
|
+
<>
|
|
202
|
+
<div style={{ marginBottom: '20px' }}>
|
|
203
|
+
<Button onClick={() => notify.success(args)}>
|
|
204
|
+
Notify success with progress bar after 3 seconds
|
|
205
|
+
</Button>
|
|
206
|
+
</div>
|
|
207
|
+
<div style={{ marginBottom: '20px' }}>
|
|
208
|
+
<Button onClick={() => notify.info(args)}>
|
|
209
|
+
Notify info with progress bar after 3 seconds
|
|
210
|
+
</Button>
|
|
211
|
+
</div>
|
|
212
|
+
<div style={{ marginBottom: '20px' }}>
|
|
213
|
+
<Button onClick={() => notify.error(args)}>
|
|
214
|
+
Notify error with progress bar after 3 seconds
|
|
215
|
+
</Button>
|
|
216
|
+
</div>
|
|
217
|
+
</>
|
|
218
|
+
),
|
|
219
|
+
};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/* Copyright (c) Fortanix, Inc.
|
|
2
|
+
|* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
|
|
3
|
+
|* the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import * as ReactDOM from 'react-dom';
|
|
7
|
+
|
|
8
|
+
import { classNames as cx, type ClassNameArgument } from '../../../util/componentUtil.ts';
|
|
9
|
+
import {
|
|
10
|
+
toast,
|
|
11
|
+
ToastContainer as ToastifyContainer,
|
|
12
|
+
type ToastContainerProps as ToastifyContainerProps,
|
|
13
|
+
type ToastContent,
|
|
14
|
+
type ToastOptions as ToastifyOptions,
|
|
15
|
+
} from 'react-toastify';
|
|
16
|
+
import 'react-toastify/dist/ReactToastify.css';
|
|
17
|
+
|
|
18
|
+
import { Icon } from '../../graphics/Icon/Icon.tsx';
|
|
19
|
+
import { TooltipProvider } from '../Tooltip/TooltipProvider.tsx';
|
|
20
|
+
import { Button, type ButtonProps } from '../../actions/Button/Button.tsx';
|
|
21
|
+
import { Link, type LinkProps } from '../../actions/Link/Link.tsx';
|
|
22
|
+
|
|
23
|
+
import './ToastyOverride.scss';
|
|
24
|
+
import cl from './Toast.module.scss';
|
|
25
|
+
|
|
26
|
+
export { cl as ToastClassNames };
|
|
27
|
+
|
|
28
|
+
export { type ToastContent };
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export const ToastLink = ({ className, ...propsRest }: LinkProps) => {
|
|
32
|
+
return (
|
|
33
|
+
<Link className={cx(cl['bk-toast__link'], className)} {...propsRest} />
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const ToastButton = ({ className, ...propsRest }: ButtonProps) => {
|
|
38
|
+
return (
|
|
39
|
+
<Button className={cx(cl['bk-toast__button'], className)} {...propsRest} />
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type CopyActionButton = {
|
|
44
|
+
/** A tooltip message of this component. */
|
|
45
|
+
message: ToastContent,
|
|
46
|
+
|
|
47
|
+
/** A classname of this component. */
|
|
48
|
+
className?: ClassNameArgument,
|
|
49
|
+
};
|
|
50
|
+
export const CopyActionButton = ({ message = null, className }: CopyActionButton): React.ReactElement | null => {
|
|
51
|
+
const defaultTooltipMessage = 'Copy message';
|
|
52
|
+
const [tooltipMessage, setTooltipMessage] = React.useState<string>(defaultTooltipMessage);
|
|
53
|
+
const isStringMessage = typeof message === 'string';
|
|
54
|
+
|
|
55
|
+
const handleCopy = async (event: React.MouseEvent) => {
|
|
56
|
+
event.stopPropagation();
|
|
57
|
+
if (isStringMessage) {
|
|
58
|
+
try {
|
|
59
|
+
await navigator.clipboard.writeText(message);
|
|
60
|
+
setTooltipMessage('Successfully copied');
|
|
61
|
+
} catch (error: unknown) {
|
|
62
|
+
setTooltipMessage('Failed to copy');
|
|
63
|
+
} finally {
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
setTooltipMessage(defaultTooltipMessage);
|
|
66
|
+
}, 2000);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
{isStringMessage &&
|
|
74
|
+
<TooltipProvider placement="bottom" tooltip={tooltipMessage} className="bk-toast__tooltip">
|
|
75
|
+
<Button
|
|
76
|
+
className={cx(cl['bk-toast__copy-button'], className)}
|
|
77
|
+
onClick={handleCopy}
|
|
78
|
+
>
|
|
79
|
+
Copy
|
|
80
|
+
</Button>
|
|
81
|
+
</TooltipProvider>
|
|
82
|
+
}
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const ToastMessage = (props: NotifyProps): React.ReactElement => {
|
|
88
|
+
const { title, message, options = {} } = props;
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<>
|
|
92
|
+
<div className={cx(cl['bk-toast__message'])}>
|
|
93
|
+
<div className={cx(cl['bk-toast__message__title'])}>
|
|
94
|
+
{title}
|
|
95
|
+
</div>
|
|
96
|
+
{(message && typeof message !== 'function') && <p>{message}</p>}
|
|
97
|
+
</div>
|
|
98
|
+
{options.actions &&
|
|
99
|
+
<div className={cx(cl['bk-toast__actions'])}>
|
|
100
|
+
{options.actions}
|
|
101
|
+
</div>
|
|
102
|
+
}
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
type ToastOptions = Omit<ToastifyOptions, 'bodyClassName'> & {
|
|
108
|
+
className?: ClassNameArgument,
|
|
109
|
+
bodyClassName?: ClassNameArgument,
|
|
110
|
+
actions?: React.ReactElement,
|
|
111
|
+
};
|
|
112
|
+
export type NotifyProps = {
|
|
113
|
+
/** A title of this component. */
|
|
114
|
+
title: string | React.ReactNode,
|
|
115
|
+
|
|
116
|
+
/** A message of this component. */
|
|
117
|
+
message?: ToastContent,
|
|
118
|
+
|
|
119
|
+
/** Options of this component. */
|
|
120
|
+
options?: ToastOptions,
|
|
121
|
+
}
|
|
122
|
+
const success = ({ title, message, options = {} }: NotifyProps) => {
|
|
123
|
+
const { className, bodyClassName, actions, closeButton = false, ...restOptions } = options;
|
|
124
|
+
const content = <ToastMessage title={title} message={message} options={options} />;
|
|
125
|
+
const updatedOptions: ToastifyOptions = {
|
|
126
|
+
autoClose: 5000,
|
|
127
|
+
className: cx(cl['bk-toast--success'], className),
|
|
128
|
+
bodyClassName: cx(cl['bk-toast__body'], bodyClassName),
|
|
129
|
+
progressClassName: cx(cl['bk-toast__progress-bar--success']),
|
|
130
|
+
icon: <Icon icon="success" className={cx(cl['bk-toast__icon--success'])} />,
|
|
131
|
+
closeButton: closeButton === true ? <CloseToastButton /> : closeButton,
|
|
132
|
+
...restOptions,
|
|
133
|
+
};
|
|
134
|
+
return toast.success(content, updatedOptions);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const info = ({ title, message, options = {} }: NotifyProps) => {
|
|
138
|
+
const { className, bodyClassName, actions, closeButton = false, ...restOptions } = options;
|
|
139
|
+
const content = <ToastMessage title={title} message={message} options={options} />;
|
|
140
|
+
const updatedOptions: ToastifyOptions = {
|
|
141
|
+
autoClose: 5000,
|
|
142
|
+
className: cx(cl['bk-toast--info'], className),
|
|
143
|
+
bodyClassName: cx(cl['bk-toast__body'], bodyClassName),
|
|
144
|
+
progressClassName: cx(cl['bk-toast__progress-bar--info']),
|
|
145
|
+
icon: <Icon icon="warning" className={cx(cl['bk-toast__icon--info'])} />,
|
|
146
|
+
closeButton: closeButton === true ? <CloseToastButton /> : closeButton,
|
|
147
|
+
...restOptions,
|
|
148
|
+
};
|
|
149
|
+
return toast.info(content, updatedOptions);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const error = ({ title, message, options = {} }: NotifyProps) => {
|
|
153
|
+
const { className, bodyClassName, actions, closeButton = false, ...restOptions } = options;
|
|
154
|
+
const content = (
|
|
155
|
+
<ToastMessage
|
|
156
|
+
title={title}
|
|
157
|
+
message={message}
|
|
158
|
+
options={{
|
|
159
|
+
...options,
|
|
160
|
+
...(actions || message) && { actions: actions || <CopyActionButton message={message} /> },
|
|
161
|
+
}}
|
|
162
|
+
/>
|
|
163
|
+
);
|
|
164
|
+
const updatedOptions: ToastifyOptions = {
|
|
165
|
+
autoClose: 5000,
|
|
166
|
+
className: cx(cl['bk-toast--error'], className),
|
|
167
|
+
bodyClassName: cx(cl['bk-toast__body'], bodyClassName),
|
|
168
|
+
progressClassName: cx(cl['bk-toast__progress-bar--error']),
|
|
169
|
+
icon: <Icon icon="alert" className={cx(cl['bk-toast__icon--error'])} />,
|
|
170
|
+
closeButton: closeButton === true ? <CloseToastButton /> : closeButton,
|
|
171
|
+
...restOptions,
|
|
172
|
+
};
|
|
173
|
+
return toast.error(content, updatedOptions);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const dismiss = (id?: string | number): boolean | void => toast.dismiss(id);
|
|
177
|
+
|
|
178
|
+
export const notify = { success, info, error, dismiss };
|
|
179
|
+
|
|
180
|
+
type CloseToastButtonProps = {
|
|
181
|
+
closeToast?: () => void,
|
|
182
|
+
};
|
|
183
|
+
const CloseToastButton = ({ closeToast }: CloseToastButtonProps) => (
|
|
184
|
+
<Icon icon="cross" className={cx(cl['bk-close--dark'])} onClick={closeToast} />
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
type ToastProviderProps = Omit<ToastifyContainerProps, 'className'> & {
|
|
188
|
+
/** Whether this component should be unstyled. */
|
|
189
|
+
unstyled?: undefined | boolean,
|
|
190
|
+
|
|
191
|
+
/** A classname of this component. */
|
|
192
|
+
className?: ClassNameArgument,
|
|
193
|
+
|
|
194
|
+
/** Whether this component should have a close button. */
|
|
195
|
+
hasCloseButton?: boolean,
|
|
196
|
+
|
|
197
|
+
/** Whether this component should display progress bar. */
|
|
198
|
+
showProgressBar?: boolean,
|
|
199
|
+
|
|
200
|
+
/** Components or elements to be rendered within the Provider. */
|
|
201
|
+
children: React.ReactNode,
|
|
202
|
+
};
|
|
203
|
+
export const ToastProvider = (props: ToastProviderProps) => {
|
|
204
|
+
const {
|
|
205
|
+
unstyled = false,
|
|
206
|
+
hasCloseButton = false,
|
|
207
|
+
className = '',
|
|
208
|
+
showProgressBar = false,
|
|
209
|
+
children,
|
|
210
|
+
...propsRest
|
|
211
|
+
} = props;
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<>
|
|
215
|
+
{children}
|
|
216
|
+
{ReactDOM.createPortal(
|
|
217
|
+
<ToastifyContainer
|
|
218
|
+
className={cx(
|
|
219
|
+
{
|
|
220
|
+
bk: true,
|
|
221
|
+
[cl['bk-toast']]: !unstyled,
|
|
222
|
+
},
|
|
223
|
+
className,
|
|
224
|
+
)}
|
|
225
|
+
hideProgressBar={!showProgressBar}
|
|
226
|
+
closeButton={hasCloseButton && <CloseToastButton/>}
|
|
227
|
+
{...propsRest}
|
|
228
|
+
/>,
|
|
229
|
+
window.document.body,
|
|
230
|
+
)}
|
|
231
|
+
</>
|
|
232
|
+
);
|
|
233
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* Copyright (c) Fortanix, Inc.
|
|
2
|
+
|* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
|
|
3
|
+
|* the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
4
|
+
|
|
5
|
+
@use '../../../styling/defs.scss' as bk;
|
|
6
|
+
|
|
7
|
+
// Define styling to override react-toastify's styles, as overriding directly from Toast.module.scss is not possible.
|
|
8
|
+
.Toastify {
|
|
9
|
+
.Toastify__toast {
|
|
10
|
+
&:has(.Toastify__progress-bar--wrp) {
|
|
11
|
+
padding-bottom: calc(bk.$spacing-4 + 4px);
|
|
12
|
+
overflow: visible; // to display progress bar over the border
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.Toastify__progress-bar--wrp {
|
|
17
|
+
height: 4px;
|
|
18
|
+
left: -2px;
|
|
19
|
+
width: calc(100% + 2px);
|
|
20
|
+
border-bottom-right-radius: var(--toastify-toast-bd-radius);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.Toastify__progress-bar--bg {
|
|
24
|
+
background: transparent;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|