@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,162 @@
|
|
|
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
|
+
/* https://css-tricks.com/books/greatest-css-tricks/scroll-shadows */
|
|
8
|
+
@define-mixin scroll-shadows {
|
|
9
|
+
--bgRGB: 73, 89, 99;
|
|
10
|
+
--bg: rgb(var(--bgRGB));
|
|
11
|
+
--bgTrans: rgba(var(--bgRGB), 0);
|
|
12
|
+
--shadow: rgba(41, 50, 56, 0.5);
|
|
13
|
+
background:
|
|
14
|
+
linear-gradient(var(--bg) 30%, var(--bgTrans)) center top, // Shadow Cover TOP
|
|
15
|
+
linear-gradient(var(--bgTrans), var(--bg) 70%) center bottom, // Shadow Cover BOTTOM
|
|
16
|
+
radial-gradient(farthest-side at 50% 0, var(--shadow), rgba(0, 0, 0, 0)) center top, // Shadow TOP
|
|
17
|
+
radial-gradient(farthest-side at 50% 100%, var(--shadow), rgba(0, 0, 0, 0)) center bottom; // Shadow BOTTOM
|
|
18
|
+
background-repeat: no-repeat;
|
|
19
|
+
background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
|
|
20
|
+
background-attachment: local, local, scroll, scroll;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@layer baklava.components {
|
|
24
|
+
.bk-tooltip {
|
|
25
|
+
@include bk.component-base(bk-tooltip);
|
|
26
|
+
|
|
27
|
+
cursor: default;
|
|
28
|
+
|
|
29
|
+
// overflow-y: auto;
|
|
30
|
+
|
|
31
|
+
max-width: 30rem;
|
|
32
|
+
max-height: 8lh; /* Show about 8 lines of text before scrolling */
|
|
33
|
+
/* Alternatively: https://floating-ui.com/docs/misc#handling-large-content
|
|
34
|
+
max-width: calc(100svw - var(--bk-sizing-2));
|
|
35
|
+
max-height: calc(100svh - var(--bk-sizing-2));
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
padding: bk.$spacing-4;
|
|
39
|
+
padding-bottom: bk.$spacing-7;
|
|
40
|
+
border-radius: bk.$radius-s;
|
|
41
|
+
background: bk.$theme-tooltip-background-default;
|
|
42
|
+
border: 1px solid bk.$theme-tooltip-border-default;
|
|
43
|
+
|
|
44
|
+
@include bk.text-layout;
|
|
45
|
+
text-align: left;
|
|
46
|
+
color: bk.$theme-tooltip-text-default;
|
|
47
|
+
@include bk.font(bk.$font-family-body);
|
|
48
|
+
font-size: 12px;
|
|
49
|
+
|
|
50
|
+
&.bk-tooltip--small {
|
|
51
|
+
width: 140px;
|
|
52
|
+
}
|
|
53
|
+
&.bk-tooltip--medium {
|
|
54
|
+
width: 225px;
|
|
55
|
+
}
|
|
56
|
+
&.bk-tooltip--large {
|
|
57
|
+
width: 345px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
--arrow-size: 7px;
|
|
61
|
+
|
|
62
|
+
&.bk-tooltip--arrow:before {
|
|
63
|
+
content: '';
|
|
64
|
+
border-bottom: 1px solid bk.$theme-tooltip-border-default;
|
|
65
|
+
border-right: 1px solid bk.$theme-tooltip-border-default;
|
|
66
|
+
background-color: bk.$theme-tooltip-background-default;
|
|
67
|
+
position: absolute;
|
|
68
|
+
width: calc(2 * var(--arrow-size));
|
|
69
|
+
height: calc(2 * var(--arrow-size));
|
|
70
|
+
}
|
|
71
|
+
&:is(.bk-tooltip--arrow-bottom, .bk-tooltip--arrow-top):before {
|
|
72
|
+
left: calc(50% - var(--arrow-size));
|
|
73
|
+
}
|
|
74
|
+
&.bk-tooltip--arrow-bottom:before {
|
|
75
|
+
bottom: calc(-1 * (calc(var(--arrow-size) + 1px)));
|
|
76
|
+
transform: rotate(45deg);
|
|
77
|
+
}
|
|
78
|
+
&.bk-tooltip--arrow-top:before {
|
|
79
|
+
top: calc(-1 * (calc(var(--arrow-size) + 1px)));
|
|
80
|
+
transform: rotate(-135deg);
|
|
81
|
+
}
|
|
82
|
+
&:is(.bk-tooltip--arrow-left, .bk-tooltip--arrow-right):before {
|
|
83
|
+
top: calc(50% - var(--arrow-size));
|
|
84
|
+
}
|
|
85
|
+
&.bk-tooltip--arrow-left:before {
|
|
86
|
+
left: calc(-1 * (calc(var(--arrow-size) + 1px)));
|
|
87
|
+
transform: rotate(135deg);
|
|
88
|
+
}
|
|
89
|
+
&.bk-tooltip--arrow-right:before {
|
|
90
|
+
right: calc(-1 * (calc(var(--arrow-size) + 1px)));
|
|
91
|
+
transform: rotate(-45deg);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.bk-tooltip__title {
|
|
95
|
+
font-size: bk.$font-size-l;
|
|
96
|
+
font-weight: bk.$font-weight-semibold;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.bk-tooltip__icon {
|
|
100
|
+
font-size: 18px;
|
|
101
|
+
margin-right: 10px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.bk-tooltip__alert {
|
|
105
|
+
color: bk.$theme-tooltip-text-error;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@position-try --bk-tooltip-position-top {
|
|
110
|
+
margin-top: var(--bk-layout-header-height); /* Compensate for layout header */
|
|
111
|
+
margin-bottom: 6px;
|
|
112
|
+
/* position-area: top; */
|
|
113
|
+
bottom: anchor(top);
|
|
114
|
+
justify-self: anchor-center;
|
|
115
|
+
}
|
|
116
|
+
@position-try --bk-tooltip-position-bottom {
|
|
117
|
+
margin-top: 6px;
|
|
118
|
+
/* position-area: bottom; */
|
|
119
|
+
justify-self: anchor-center;
|
|
120
|
+
top: anchor(bottom);
|
|
121
|
+
}
|
|
122
|
+
@position-try --bk-tooltip-position-left {
|
|
123
|
+
justify-self: anchor-center;
|
|
124
|
+
right: anchor(left);
|
|
125
|
+
}
|
|
126
|
+
@position-try --bk-tooltip-position-right {
|
|
127
|
+
justify-self: anchor-center;
|
|
128
|
+
left: anchor(right);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.bk-tooltip[popover] {
|
|
132
|
+
inset: auto; /* Note: future versions of Chrome should have this by default */
|
|
133
|
+
position: fixed;
|
|
134
|
+
/*position-anchor: --anchor-1;*/ /* Needs to be set dynamically */
|
|
135
|
+
|
|
136
|
+
position-try-fallbacks: --bk-tooltip-position-top, --bk-tooltip-position-bottom, --bk-tooltip-position-left, --bk-tooltip-position-right;
|
|
137
|
+
|
|
138
|
+
filter: drop-shadow(4px 4px 4px rgba(50 50 50 / 30%));
|
|
139
|
+
|
|
140
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
141
|
+
--transition-duration: 150ms;
|
|
142
|
+
transition:
|
|
143
|
+
display var(--transition-duration) allow-discrete,
|
|
144
|
+
overlay var(--transition-duration) allow-discrete,
|
|
145
|
+
opacity var(--transition-duration) ease-out,
|
|
146
|
+
translate var(--transition-duration) ease-out;
|
|
147
|
+
/* transform */ /* Note: don't animate `transform` with floating-ui, since it relies on it for positioning */
|
|
148
|
+
opacity: 0;
|
|
149
|
+
translate: 0 0.3rem;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&:popover-open {
|
|
153
|
+
opacity: 1;
|
|
154
|
+
translate: none;
|
|
155
|
+
|
|
156
|
+
@starting-style {
|
|
157
|
+
opacity: 0;
|
|
158
|
+
translate: 0 0.3rem;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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 type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
+
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
|
|
9
|
+
import { OverflowTester } from '../../../util/storybook/OverflowTester.tsx';
|
|
10
|
+
import { Button } from '../../actions/Button/Button.tsx';
|
|
11
|
+
import { Tooltip } from './Tooltip.tsx';
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
type TooltipArgs = React.ComponentProps<typeof Tooltip>;
|
|
15
|
+
type Story = StoryObj<TooltipArgs>;
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
component: Tooltip,
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: 'centered',
|
|
21
|
+
},
|
|
22
|
+
tags: ['autodocs'],
|
|
23
|
+
argTypes: {
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
children: 'This is a tooltip',
|
|
27
|
+
},
|
|
28
|
+
render: (args) => <Tooltip {...args}/>,
|
|
29
|
+
} satisfies Meta<TooltipArgs>;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export const TooltipStandard: Story = {
|
|
33
|
+
name: 'Tooltip',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const TooltipSmall: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
size: 'small',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const TooltipMedium: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
size: 'medium',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const TooltipLarge: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
size: 'large',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const TooltipWordBreak: StoryObj<typeof Tooltip> = {
|
|
55
|
+
name: 'Tooltip (word break)',
|
|
56
|
+
render: () => (
|
|
57
|
+
<Tooltip>
|
|
58
|
+
LoremipsumdolorsitametconsecteturadipiscingelitPellentesqueegetsemutnequelobortispharetranecvelquamEtiamsemnequegravidasedpharetrautvehiculaquislectusDonecacrhoncuspurus.
|
|
59
|
+
</Tooltip>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const TooltipScroll: StoryObj<typeof Tooltip> = {
|
|
64
|
+
name: 'Tooltip (scroll)',
|
|
65
|
+
render: () => (
|
|
66
|
+
<Tooltip>
|
|
67
|
+
<p>
|
|
68
|
+
Lorem ipsum dolor sit amet, <a href="/" onClick={event => { event.preventDefault(); }}>consectetur</a> adipiscing elit. Pellentesque eget sem ut neque lobortis pharetra nec vel quam. Etiam sem neque, gravida sed pharetra ut, vehicula quis lectus. Donec ac rhoncus purus. Proin ultricies augue vitae purus feugiat, in ultrices lorem aliquet. Donec eleifend ac dolor a auctor.
|
|
69
|
+
</p>
|
|
70
|
+
<p>
|
|
71
|
+
Cras ac suscipit nibh. Fusce tincidunt iaculis dapibus. Vivamus sit amet neque eu velit tincidunt semper. Donec at magna aliquam mi consectetur imperdiet. Donec pretium placerat quam, in sodales purus porta vitae. Phasellus nisl justo, luctus vel mi vel, sollicitudin.
|
|
72
|
+
</p>
|
|
73
|
+
<ul>
|
|
74
|
+
<li>A list item</li>
|
|
75
|
+
<li>Another list item</li>
|
|
76
|
+
</ul>
|
|
77
|
+
</Tooltip>
|
|
78
|
+
),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const TooltipNativeAnchoringControlled = () => {
|
|
82
|
+
// Note: in the future, browsers will support implicit anchors (`position-anchor: implicit`) so that the invoker
|
|
83
|
+
// will be used automatically as the anchor. For now, we need to hook them up using an anchor name.
|
|
84
|
+
// Alternatively, wrap both popover+invoker in an element with `anchor-scope` (but wrappers interfere with styling).
|
|
85
|
+
// https://www.w3.org/TR/css-anchor-position-1/#implicit
|
|
86
|
+
const id = React.useId();
|
|
87
|
+
const anchorName = `--bk-tooltip-anchor-${CSS.escape(id)}`;
|
|
88
|
+
const refTooltip = React.useRef<React.ComponentRef<typeof Tooltip>>(null);
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<>
|
|
92
|
+
<OverflowTester/>
|
|
93
|
+
|
|
94
|
+
{/* @ts-ignore Anchor Positioning not yet supported. */}
|
|
95
|
+
<Tooltip ref={refTooltip} id={id} popover="manual" style={{ positionAnchor: anchorName }}>
|
|
96
|
+
This is a tooltip with a lot of text that gives more information about the element.
|
|
97
|
+
It has a <a href="/" onClick={event => { event.preventDefault(); }}>link</a> you can focus.
|
|
98
|
+
</Tooltip>
|
|
99
|
+
<Button type="button" popoverTarget={id} variant="primary" label="Hover over me"
|
|
100
|
+
// @ts-ignore Anchor Positioning not yet supported.
|
|
101
|
+
style={{ anchorName }}
|
|
102
|
+
onMouseEnter={() => { refTooltip.current?.showPopover(); }}
|
|
103
|
+
onMouseLeave={() => { refTooltip.current?.hidePopover(); }}
|
|
104
|
+
/>
|
|
105
|
+
|
|
106
|
+
<OverflowTester/>
|
|
107
|
+
</>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
export const TooltipNativeAnchoring: Story = {
|
|
111
|
+
name: 'Tooltip (native browser)',
|
|
112
|
+
render: () => (
|
|
113
|
+
<TooltipNativeAnchoringControlled/>
|
|
114
|
+
),
|
|
115
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
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 { classNames as cx, type ComponentProps } from '../../../util/componentUtil.ts';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Icon, IconProps } from '../../graphics/Icon/Icon.tsx';
|
|
9
|
+
|
|
10
|
+
import cl from './Tooltip.module.scss';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export { cl as TooltipClassNames };
|
|
14
|
+
|
|
15
|
+
export type TooltipSize = 'small' | 'medium' | 'large';
|
|
16
|
+
|
|
17
|
+
export type TooltipProps = React.PropsWithChildren<ComponentProps<'div'> & {
|
|
18
|
+
/** Whether this component should be unstyled. */
|
|
19
|
+
unstyled?: undefined | boolean,
|
|
20
|
+
/** Whether you want the component to have a fixed width. If unset, it will have dynamic size. */
|
|
21
|
+
size?: undefined | TooltipSize,
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* A tooltip. Used by `TooltipProvider` to display a tooltip popover.
|
|
25
|
+
*/
|
|
26
|
+
export const Tooltip = ({ unstyled = false, size = undefined, ...propsRest }: TooltipProps) => {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
role="tooltip" // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role
|
|
30
|
+
{...propsRest}
|
|
31
|
+
className={cx({
|
|
32
|
+
bk: true,
|
|
33
|
+
[cl['bk-tooltip']]: !unstyled,
|
|
34
|
+
'bk-body-text': !unstyled,
|
|
35
|
+
[cl['bk-tooltip--small']]: size === 'small',
|
|
36
|
+
[cl['bk-tooltip--medium']]: size === 'medium',
|
|
37
|
+
[cl['bk-tooltip--large']]: size === 'large',
|
|
38
|
+
}, propsRest.className)}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type TooltipTitleProps = React.PropsWithChildren<ComponentProps<'h1'>>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Tooltip title. Can be optionally used as tooltip children.
|
|
47
|
+
*/
|
|
48
|
+
export const TooltipTitle = ({ children }: TooltipTitleProps) => (
|
|
49
|
+
<h1 className={cl['bk-tooltip__title']}>{children}</h1>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
export type TooltipItemProps = React.PropsWithChildren<ComponentProps<'p'> & {
|
|
53
|
+
/** Whether the item is an alert */
|
|
54
|
+
alert?: undefined | boolean;
|
|
55
|
+
}>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Tooltip item. Can be optionally used as tooltip children.
|
|
59
|
+
*/
|
|
60
|
+
export const TooltipItem = ({ alert = false, children }: TooltipItemProps) => (
|
|
61
|
+
<p
|
|
62
|
+
className={cx({
|
|
63
|
+
[cl['bk-tooltip__alert']]: alert,
|
|
64
|
+
})}
|
|
65
|
+
>
|
|
66
|
+
{children}
|
|
67
|
+
</p>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Tooltip icon. Can be optionally used as tooltip children.
|
|
72
|
+
*/
|
|
73
|
+
export const TooltipIcon = (props: IconProps) => (
|
|
74
|
+
<Icon className={cl['bk-tooltip__icon']} {...props} />
|
|
75
|
+
);
|
|
@@ -0,0 +1,169 @@
|
|
|
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 type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
+
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { Draggable } from '../../../util/drag.ts';
|
|
9
|
+
|
|
10
|
+
import { TooltipProvider } from './TooltipProvider.tsx';
|
|
11
|
+
import { TooltipIcon, TooltipItem, TooltipTitle } from './Tooltip.tsx';
|
|
12
|
+
import { Button } from '../../actions/Button/Button.tsx';
|
|
13
|
+
import { Icon } from '../../graphics/Icon/Icon.tsx';
|
|
14
|
+
import { OverflowTester } from '../../../util/storybook/OverflowTester.tsx';
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
type TooltipProviderArgs = React.ComponentProps<typeof TooltipProvider>;
|
|
18
|
+
type Story = StoryObj<TooltipProviderArgs>;
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
component: TooltipProvider,
|
|
22
|
+
parameters: {
|
|
23
|
+
layout: 'centered',
|
|
24
|
+
},
|
|
25
|
+
tags: ['autodocs'],
|
|
26
|
+
argTypes: {
|
|
27
|
+
},
|
|
28
|
+
args: {
|
|
29
|
+
tooltip: 'This is a tooltip',
|
|
30
|
+
children: (props) => <Button {...props()} variant="primary" label="Hover over me"/>,
|
|
31
|
+
},
|
|
32
|
+
render: (args) => <TooltipProvider {...args}/>,
|
|
33
|
+
} satisfies Meta<TooltipProviderArgs>;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export const PlacementTop: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
placement: 'top',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const PlacementBottom: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
placement: 'bottom',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const PlacementLeft: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
placement: 'left',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const PlacementRight: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
placement: 'right',
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const TooltipSmall: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
size: 'small',
|
|
63
|
+
tooltip: <>
|
|
64
|
+
<TooltipTitle>Title</TooltipTitle>
|
|
65
|
+
<TooltipItem>Lorem ipsum</TooltipItem>
|
|
66
|
+
<TooltipItem>Lorem ipsum</TooltipItem>
|
|
67
|
+
</>,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const TooltipMedium: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
placement: 'right',
|
|
74
|
+
size: 'medium',
|
|
75
|
+
tooltip: <>
|
|
76
|
+
<TooltipTitle>Title</TooltipTitle>
|
|
77
|
+
<TooltipItem alert={true}>
|
|
78
|
+
<TooltipIcon icon="alert" />
|
|
79
|
+
Lorem ipsum
|
|
80
|
+
</TooltipItem>
|
|
81
|
+
<TooltipItem>
|
|
82
|
+
<TooltipIcon icon="copy" />
|
|
83
|
+
Lorem ipsum
|
|
84
|
+
</TooltipItem>
|
|
85
|
+
</>,
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const TooltipLarge: Story = {
|
|
90
|
+
args: {
|
|
91
|
+
placement: 'left',
|
|
92
|
+
size: 'large',
|
|
93
|
+
tooltip: <>A large tooltip will have a fixed size,<br />even if the content is small.</>,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* When a tooltip hits the viewport during scroll, it will automatically reposition to be visible.
|
|
99
|
+
*/
|
|
100
|
+
export const TooltipWithScroll: Story = {
|
|
101
|
+
render: () => (
|
|
102
|
+
<>
|
|
103
|
+
<OverflowTester openDefault lines={5}/>
|
|
104
|
+
|
|
105
|
+
<TooltipProvider tooltip="Tooltips will auto-reposition when it hits the viewport due to scroll.">
|
|
106
|
+
{props => <Button {...props()} variant="primary" label="Scroll me" autoFocus/>}
|
|
107
|
+
</TooltipProvider>
|
|
108
|
+
|
|
109
|
+
<OverflowTester openDefault/>
|
|
110
|
+
</>
|
|
111
|
+
),
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Tooltips should activate on focus.
|
|
116
|
+
*/
|
|
117
|
+
export const TooltipWithFocus: Story = {
|
|
118
|
+
args: {
|
|
119
|
+
tooltip: 'Tooltips will open when the anchor element is focused',
|
|
120
|
+
children: (props) => <Button {...props()} variant="primary" label="Focus me" autoFocus/>,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const TooltipWithDrag = () => {
|
|
125
|
+
const boundaryRef = React.useRef<React.ComponentRef<'div'>>(null);
|
|
126
|
+
const [boundaryRendered, setBoundaryRendered] = React.useState(false);
|
|
127
|
+
|
|
128
|
+
React.useEffect(() => {
|
|
129
|
+
if (boundaryRef.current && !boundaryRendered) { setBoundaryRendered(true); }
|
|
130
|
+
}, [boundaryRendered]);
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<div ref={boundaryRef} style={{ minHeight: 400, display: 'grid', placeContent: 'center' }}>
|
|
134
|
+
{boundaryRef.current &&
|
|
135
|
+
<Draggable<HTMLButtonElement>>
|
|
136
|
+
{({ targetRef }) =>
|
|
137
|
+
<TooltipProvider
|
|
138
|
+
tooltip="The position of this tooltip will update to stay in view as it gets dragged towards
|
|
139
|
+
the viewport."
|
|
140
|
+
boundary={boundaryRef.current ?? undefined}
|
|
141
|
+
enablePreciseTracking
|
|
142
|
+
>
|
|
143
|
+
<Button ref={targetRef} variant="secondary" label="Drag me" autoFocus/>
|
|
144
|
+
</TooltipProvider>
|
|
145
|
+
}
|
|
146
|
+
</Draggable>
|
|
147
|
+
}
|
|
148
|
+
</div>
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
export const TooltipDraggable: Story = {
|
|
152
|
+
parameters: {
|
|
153
|
+
layout: 'fullscreen',
|
|
154
|
+
},
|
|
155
|
+
name: 'Tooltip (draggable anchor)',
|
|
156
|
+
render: () => <TooltipWithDrag/>,
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const TooltipEmpty: Story = {
|
|
160
|
+
args: {
|
|
161
|
+
tooltip: '',
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export const TooltipNull: Story = {
|
|
166
|
+
args: {
|
|
167
|
+
tooltip: null,
|
|
168
|
+
},
|
|
169
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
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 { classNames as cx, type ClassNameArgument } from '../../../util/componentUtil.ts';
|
|
6
|
+
import { mergeRefs } from '../../../util/reactUtil.ts';
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
|
|
9
|
+
import { usePopover, usePopoverArrow } from '../../util/Popover/Popover.tsx';
|
|
10
|
+
import { type TooltipProps, TooltipClassNames, Tooltip } from './Tooltip.tsx';
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
export type GetReferenceProps = (userProps?: undefined | React.HTMLProps<Element>) => Record<string, unknown>;
|
|
14
|
+
export type TooltipProviderProps = Omit<TooltipProps, 'children'> & {
|
|
15
|
+
/**
|
|
16
|
+
* The content to render, which should contain the anchor. This should be a render prop which takes props to
|
|
17
|
+
* apply on the anchor element. Alternatively, a single element can be provided to which the props are applied.
|
|
18
|
+
*/
|
|
19
|
+
children?: ((getReferenceProps: GetReferenceProps) => React.ReactNode) | React.ReactNode,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The tooltip message. If nullish, the tooltip will not be shown at all. This is useful in case the tooltip should
|
|
23
|
+
* be shown conditionally.
|
|
24
|
+
*/
|
|
25
|
+
tooltip?: null | React.ReactNode,
|
|
26
|
+
|
|
27
|
+
/** Where to show the tooltip relative to the anchor. */
|
|
28
|
+
// here we are not using Placement as exposed from Popover because Tooltip only supports a subset of Popover's default placements.
|
|
29
|
+
placement?: undefined | 'top' | 'bottom' | 'left' | 'right',
|
|
30
|
+
|
|
31
|
+
/** Enable more precise tracking of the anchor, at the cost of performance. */
|
|
32
|
+
enablePreciseTracking?: undefined | boolean,
|
|
33
|
+
|
|
34
|
+
/** A custom boundary to use to determine overflow of the tooltip. */
|
|
35
|
+
boundary?: undefined | Element,
|
|
36
|
+
|
|
37
|
+
/** Callback that is invoked when the tooltip gets activated. */
|
|
38
|
+
onTooltipActivated?: () => void,
|
|
39
|
+
|
|
40
|
+
/** Callback that is invoked when the tooltip gets deactivated. */
|
|
41
|
+
onTooltipDeactivated?: () => void,
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Provider around an anchor element to attach a tooltip popover.
|
|
45
|
+
*/
|
|
46
|
+
export const TooltipProvider = (props: TooltipProviderProps) => {
|
|
47
|
+
const {
|
|
48
|
+
children,
|
|
49
|
+
tooltip,
|
|
50
|
+
placement,
|
|
51
|
+
size,
|
|
52
|
+
enablePreciseTracking = false,
|
|
53
|
+
boundary,
|
|
54
|
+
onTooltipActivated,
|
|
55
|
+
onTooltipDeactivated,
|
|
56
|
+
...tooltipProps
|
|
57
|
+
} = props;
|
|
58
|
+
|
|
59
|
+
const arrowRef = React.useRef<HTMLElement>(null);
|
|
60
|
+
|
|
61
|
+
const {
|
|
62
|
+
context,
|
|
63
|
+
isMounted,
|
|
64
|
+
refs,
|
|
65
|
+
floatingStyles,
|
|
66
|
+
getReferenceProps,
|
|
67
|
+
getFloatingProps,
|
|
68
|
+
} = usePopover({
|
|
69
|
+
action: 'hover',
|
|
70
|
+
placement,
|
|
71
|
+
offset: 6,
|
|
72
|
+
enablePreciseTracking,
|
|
73
|
+
boundary,
|
|
74
|
+
...(arrowRef.current ? { arrowRef: arrowRef as React.RefObject<HTMLElement> } : {}),
|
|
75
|
+
});
|
|
76
|
+
const arrow = usePopoverArrow({ context });
|
|
77
|
+
|
|
78
|
+
// Call event listeners, if any
|
|
79
|
+
React.useLayoutEffect(() => {
|
|
80
|
+
if (isMounted) {
|
|
81
|
+
onTooltipActivated?.();
|
|
82
|
+
} else {
|
|
83
|
+
onTooltipDeactivated?.();
|
|
84
|
+
}
|
|
85
|
+
}, [isMounted, onTooltipActivated, onTooltipDeactivated]);
|
|
86
|
+
|
|
87
|
+
const renderTooltip = () => {
|
|
88
|
+
if (!isMounted || !tooltip) { return null; }
|
|
89
|
+
|
|
90
|
+
const floatingProps = getFloatingProps({
|
|
91
|
+
popover: 'manual',
|
|
92
|
+
style: floatingStyles,
|
|
93
|
+
});
|
|
94
|
+
return (
|
|
95
|
+
<Tooltip
|
|
96
|
+
{...floatingProps}
|
|
97
|
+
ref={mergeRefs<HTMLDivElement>(refs.setFloating, tooltipProps.ref)}
|
|
98
|
+
className={cx(
|
|
99
|
+
floatingProps.className as ClassNameArgument,
|
|
100
|
+
{ [TooltipClassNames['bk-tooltip--arrow']]: !!arrow?.side },
|
|
101
|
+
{ [TooltipClassNames['bk-tooltip--arrow-top']]: arrow?.side === 'top' },
|
|
102
|
+
{ [TooltipClassNames['bk-tooltip--arrow-bottom']]: arrow?.side === 'bottom' },
|
|
103
|
+
{ [TooltipClassNames['bk-tooltip--arrow-left']]: arrow?.side === 'left' },
|
|
104
|
+
{ [TooltipClassNames['bk-tooltip--arrow-right']]: arrow?.side === 'right' },
|
|
105
|
+
tooltipProps.className,
|
|
106
|
+
)}
|
|
107
|
+
style={{
|
|
108
|
+
...(floatingProps.style ?? {}),
|
|
109
|
+
...tooltipProps.style,
|
|
110
|
+
'--arrow-x': arrow?.arrowX,
|
|
111
|
+
'--arrow-y': arrow?.arrowY,
|
|
112
|
+
} as React.CSSProperties}
|
|
113
|
+
size={size}
|
|
114
|
+
>
|
|
115
|
+
{tooltip}
|
|
116
|
+
{/*
|
|
117
|
+
Fake arrow element for position tracking, the real arrow is drawn using `border-image`.
|
|
118
|
+
Note: `floating-ui` has a `FloatingArrow` component using a positioned <svg> arrow, but this doesn't work if
|
|
119
|
+
the tooltip has `overflow: hidden/scroll/auto` or `contain: paint` enabled.
|
|
120
|
+
*/}
|
|
121
|
+
<span ref={arrowRef} hidden aria-hidden/>
|
|
122
|
+
</Tooltip>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const renderAnchor = () => {
|
|
127
|
+
const renderPropArg: GetReferenceProps = (userProps?: undefined | React.HTMLProps<Element>) => {
|
|
128
|
+
const userPropsRef: undefined | string | React.Ref<Element> = userProps?.ref ?? undefined;
|
|
129
|
+
if (typeof userPropsRef === 'string') {
|
|
130
|
+
// We can't merge refs if one of the refs is a string
|
|
131
|
+
console.error(`Failed to render Tooltip, due to use of legacy string ref`);
|
|
132
|
+
return (userProps ?? {}) as Record<string, unknown>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
...getReferenceProps(userProps),
|
|
137
|
+
ref: userPropsRef ? mergeRefs(userPropsRef, refs.setReference) : refs.setReference,
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
if (typeof children === 'function') {
|
|
142
|
+
return children(renderPropArg);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// If a render prop is not used, try to attach it to the element directly.
|
|
146
|
+
// NOTE: `cloneElement` is marked as a legacy function by React. Recommended is to use a render prop instead.
|
|
147
|
+
if (!React.isValidElement(children)) {
|
|
148
|
+
return <span {...renderPropArg()}>{children}</span>;
|
|
149
|
+
}
|
|
150
|
+
if (React.Children.count(children) === 1) {
|
|
151
|
+
return React.cloneElement(children, renderPropArg(children.props as React.HTMLProps<Element>));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
console.error(`Invalid children passed to TooltipContainer, expected a render prop or single child element.`);
|
|
155
|
+
return children;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
return (
|
|
159
|
+
<>
|
|
160
|
+
{renderTooltip()}
|
|
161
|
+
{renderAnchor()}
|
|
162
|
+
</>
|
|
163
|
+
);
|
|
164
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export const useClipboard = () => {
|
|
6
|
+
return {
|
|
7
|
+
async writeText(text: string) {
|
|
8
|
+
return navigator.clipboard.writeText(text);
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
};
|