@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,57 @@
|
|
|
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, ComponentProps } from '../../util/componentUtil.ts';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
|
|
8
|
+
import cl from './Heading.module.scss';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export type H1Props = React.PropsWithChildren<ComponentProps<'h1'> & {
|
|
12
|
+
/** Whether this component should be unstyled. */
|
|
13
|
+
unstyled?: undefined | boolean,
|
|
14
|
+
}>;
|
|
15
|
+
export const H1 = ({ unstyled, ...props }: H1Props) => (
|
|
16
|
+
<h1 {...props} className={cx('bk', { [cl['bk-h1']]: !unstyled }, props.className)}/>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export type H2Props = React.PropsWithChildren<ComponentProps<'h2'> & {
|
|
20
|
+
/** Whether this component should be unstyled. */
|
|
21
|
+
unstyled?: undefined | boolean,
|
|
22
|
+
}>;
|
|
23
|
+
export const H2 = ({ unstyled, ...props }: H2Props) => (
|
|
24
|
+
<h2 {...props} className={cx('bk', { [cl['bk-h2']]: !unstyled }, props.className)}/>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export type H3Props = React.PropsWithChildren<ComponentProps<'h3'> & {
|
|
28
|
+
/** Whether this component should be unstyled. */
|
|
29
|
+
unstyled?: undefined | boolean,
|
|
30
|
+
}>;
|
|
31
|
+
export const H3 = ({ unstyled, ...props }: H3Props) => (
|
|
32
|
+
<h3 {...props} className={cx('bk', { [cl['bk-h3']]: !unstyled }, props.className)}/>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export type H4Props = React.PropsWithChildren<ComponentProps<'h4'> & {
|
|
36
|
+
/** Whether this component should be unstyled. */
|
|
37
|
+
unstyled?: undefined | boolean,
|
|
38
|
+
}>;
|
|
39
|
+
export const H4 = ({ unstyled, ...props }: H4Props) => (
|
|
40
|
+
<h4 {...props} className={cx('bk', { [cl['bk-h4']]: !unstyled }, props.className)}/>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export type H5Props = React.PropsWithChildren<ComponentProps<'h5'> & {
|
|
44
|
+
/** Whether this component should be unstyled. */
|
|
45
|
+
unstyled?: undefined | boolean,
|
|
46
|
+
}>;
|
|
47
|
+
export const H5 = ({ unstyled, ...props }: H5Props) => (
|
|
48
|
+
<h5 {...props} className={cx('bk', { [cl['bk-h5']]: !unstyled }, props.className)}/>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export type H6Props = React.PropsWithChildren<ComponentProps<'h6'> & {
|
|
52
|
+
/** Whether this component should be unstyled. */
|
|
53
|
+
unstyled?: undefined | boolean,
|
|
54
|
+
}>;
|
|
55
|
+
export const H6 = ({ unstyled, ...props }: H6Props) => (
|
|
56
|
+
<h6 {...props} className={cx('bk', { [cl['bk-h6']]: !unstyled }, props.className)}/>
|
|
57
|
+
);
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
// Note: use the `dedupe` variant so that the consumer of a component can overwrite classes from the component using
|
|
6
|
+
// `<MyComponent className={{ foo: false }}/>`
|
|
7
|
+
import classNames from 'classnames/dedupe';
|
|
8
|
+
import { type Argument as ClassNameArgument } from 'classnames';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export { classNames, type ClassNameArgument };
|
|
12
|
+
|
|
13
|
+
// Version of `React.ComponentPropsWithRef` that supports `classnames` syntax for the `className` attribute. So that
|
|
14
|
+
// components can take class names not just of type string, but any valid classnames `Argument`, e.g.:
|
|
15
|
+
// `<MyComponent className={['example1', { example2: condition() }]}/>`
|
|
16
|
+
export type ComponentProps<T extends React.ElementType> =
|
|
17
|
+
Omit<React.ComponentPropsWithRef<T>, 'className'> & {
|
|
18
|
+
className?: undefined | ClassNameArgument,
|
|
19
|
+
};
|
package/src/util/drag.ts
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* Source: https://github.com/idanen/react-draggable
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
type Delta = { x: number, y: number };
|
|
13
|
+
type Limits = { minX: number, maxX: number, minY: number, maxY: number };
|
|
14
|
+
type CalcDeltaArgs = {
|
|
15
|
+
x: number,
|
|
16
|
+
y: number,
|
|
17
|
+
limits?: undefined | Limits,
|
|
18
|
+
};
|
|
19
|
+
const calcDelta = ({ x, y, limits }: CalcDeltaArgs) => {
|
|
20
|
+
if (!limits) {
|
|
21
|
+
return { x, y };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { minX, maxX, minY, maxY } = limits;
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
x: Math.min(Math.max(x, minX), maxX),
|
|
28
|
+
y: Math.min(Math.max(y, minY), maxY),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type UseDraggableProps = {
|
|
33
|
+
controlStyle?: boolean,
|
|
34
|
+
viewport?: boolean,
|
|
35
|
+
rectLimits?: { left: number, right: number, top: number, bottom: number },
|
|
36
|
+
};
|
|
37
|
+
export type UseDraggableResult<T extends HTMLElement, H extends HTMLElement> = {
|
|
38
|
+
targetRef: React.Ref<T>,
|
|
39
|
+
handleRef: React.Ref<H>,
|
|
40
|
+
getTargetProps: () => Record<string, unknown>,
|
|
41
|
+
dragging: boolean,
|
|
42
|
+
delta: Delta,
|
|
43
|
+
resetState: () => void,
|
|
44
|
+
};
|
|
45
|
+
export const useDraggable = <T extends HTMLElement = HTMLElement, H extends HTMLElement = HTMLElement>(
|
|
46
|
+
props: UseDraggableProps,
|
|
47
|
+
): UseDraggableResult<T, H> => {
|
|
48
|
+
const {
|
|
49
|
+
controlStyle = true,
|
|
50
|
+
viewport = false,
|
|
51
|
+
rectLimits,
|
|
52
|
+
} = props;
|
|
53
|
+
|
|
54
|
+
const targetRef = React.useRef<T>(null);
|
|
55
|
+
const handleRef = React.useRef<H>(null);
|
|
56
|
+
const [dragging, setDragging] = React.useState<boolean>(false);
|
|
57
|
+
const [prev, setPrev] = React.useState({ x: 0, y: 0 });
|
|
58
|
+
const [delta, setDelta] = React.useState({ x: 0, y: 0 });
|
|
59
|
+
const initial = React.useRef({ x: 0, y: 0 });
|
|
60
|
+
const limits = React.useRef<undefined | Limits>(undefined);
|
|
61
|
+
|
|
62
|
+
const stopDragging = React.useCallback((event: MouseEvent | TouchEvent) => {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
setDragging(false);
|
|
65
|
+
const newDelta = reposition(event);
|
|
66
|
+
setPrev(newDelta);
|
|
67
|
+
if (controlStyle && targetRef.current) {
|
|
68
|
+
targetRef.current.style.willChange = '';
|
|
69
|
+
}
|
|
70
|
+
}, [controlStyle]);
|
|
71
|
+
|
|
72
|
+
const reposition = React.useCallback((event: MouseEvent | TouchEvent) => {
|
|
73
|
+
const source =
|
|
74
|
+
('changedTouches' in event && event.changedTouches[0])
|
|
75
|
+
|| ('touches' in event && event.touches[0])
|
|
76
|
+
|| event;
|
|
77
|
+
const clientX = 'clientX' in source ? source.clientX : 0;
|
|
78
|
+
const clientY = 'clientY' in source ? source.clientY : 0;
|
|
79
|
+
const x = clientX - initial.current.x + prev.x;
|
|
80
|
+
const y = clientY - initial.current.y + prev.y;
|
|
81
|
+
|
|
82
|
+
const newDelta = calcDelta({ x, y, limits: limits.current });
|
|
83
|
+
setDelta(newDelta);
|
|
84
|
+
|
|
85
|
+
return newDelta;
|
|
86
|
+
}, [prev]);
|
|
87
|
+
|
|
88
|
+
React.useEffect(() => {
|
|
89
|
+
const startDragging = (event: MouseEvent | TouchEvent): void => {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
setDragging(true);
|
|
92
|
+
const source = ('touches' in event && event.touches[0]) || event;
|
|
93
|
+
const clientX = 'clientX' in source ? source.clientX : 0;
|
|
94
|
+
const clientY = 'clientY' in source ? source.clientY : 0;
|
|
95
|
+
initial.current = { x: clientX, y: clientY };
|
|
96
|
+
|
|
97
|
+
const target = targetRef.current;
|
|
98
|
+
if (!target) { return; }
|
|
99
|
+
|
|
100
|
+
if (controlStyle) {
|
|
101
|
+
target.style.willChange = 'transform';
|
|
102
|
+
}
|
|
103
|
+
if (viewport || rectLimits) {
|
|
104
|
+
const {
|
|
105
|
+
left,
|
|
106
|
+
top,
|
|
107
|
+
width,
|
|
108
|
+
height
|
|
109
|
+
} = target.getBoundingClientRect();
|
|
110
|
+
|
|
111
|
+
if (viewport) {
|
|
112
|
+
limits.current = {
|
|
113
|
+
minX: -left + delta.x,
|
|
114
|
+
maxX: window.innerWidth - width - left + delta.x,
|
|
115
|
+
minY: -top + delta.y,
|
|
116
|
+
maxY: window.innerHeight - height - top + delta.y
|
|
117
|
+
};
|
|
118
|
+
} else if (rectLimits) {
|
|
119
|
+
limits.current = {
|
|
120
|
+
minX: rectLimits.left - left + delta.x,
|
|
121
|
+
maxX: rectLimits.right - width - left + delta.x,
|
|
122
|
+
minY: rectLimits.top - top + delta.y,
|
|
123
|
+
maxY: rectLimits.bottom - height - top + delta.y
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const handle = handleRef.current || targetRef.current;
|
|
130
|
+
handle?.addEventListener('mousedown', startDragging);
|
|
131
|
+
handle?.addEventListener('touchstart', startDragging);
|
|
132
|
+
|
|
133
|
+
return () => {
|
|
134
|
+
handle?.removeEventListener('mousedown', startDragging);
|
|
135
|
+
handle?.removeEventListener('touchstart', startDragging);
|
|
136
|
+
};
|
|
137
|
+
}, [controlStyle, viewport, delta, rectLimits]);
|
|
138
|
+
|
|
139
|
+
React.useEffect(() => {
|
|
140
|
+
const handle = handleRef.current || targetRef.current;
|
|
141
|
+
if (dragging) {
|
|
142
|
+
document.addEventListener('mousemove', reposition, { passive: true });
|
|
143
|
+
document.addEventListener('touchmove', reposition, { passive: true });
|
|
144
|
+
document.addEventListener('mouseup', stopDragging);
|
|
145
|
+
document.addEventListener('touchend', stopDragging);
|
|
146
|
+
} else {
|
|
147
|
+
document.removeEventListener('mousemove', reposition);
|
|
148
|
+
document.removeEventListener('mouseup', stopDragging);
|
|
149
|
+
document.removeEventListener('touchmove', reposition);
|
|
150
|
+
document.removeEventListener('touchend', stopDragging);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (controlStyle && handle) {
|
|
154
|
+
handle.style.cursor = dragging ? 'grabbing' : 'grab';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return () => {
|
|
158
|
+
if (controlStyle && handle) {
|
|
159
|
+
handle.style.cursor = '';
|
|
160
|
+
}
|
|
161
|
+
document.removeEventListener('mousemove', reposition);
|
|
162
|
+
document.removeEventListener('mouseup', stopDragging);
|
|
163
|
+
document.removeEventListener('touchmove', reposition);
|
|
164
|
+
document.removeEventListener('touchend', stopDragging);
|
|
165
|
+
};
|
|
166
|
+
}, [stopDragging, dragging, controlStyle, reposition]);
|
|
167
|
+
|
|
168
|
+
React.useEffect(() => {
|
|
169
|
+
if (controlStyle && targetRef.current) {
|
|
170
|
+
targetRef.current.style.transform = `translate(${delta.x}px, ${delta.y}px)`;
|
|
171
|
+
}
|
|
172
|
+
}, [delta, controlStyle]);
|
|
173
|
+
|
|
174
|
+
const getTargetProps = React.useCallback(
|
|
175
|
+
() => ({
|
|
176
|
+
'aria-grabbed': dragging || null,
|
|
177
|
+
}),
|
|
178
|
+
[dragging],
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const resetState = React.useCallback(() => {
|
|
182
|
+
setDelta({ x: 0, y: 0 });
|
|
183
|
+
setPrev({ x: 0, y: 0 });
|
|
184
|
+
}, []);
|
|
185
|
+
|
|
186
|
+
return { targetRef, handleRef, getTargetProps, dragging, delta, resetState };
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export type DraggableProps<T extends HTMLElement, H extends HTMLElement> = {
|
|
190
|
+
children: (result: UseDraggableResult<T, H>) => React.ReactNode,
|
|
191
|
+
};
|
|
192
|
+
export const Draggable = <T extends HTMLElement = HTMLElement, H extends HTMLElement = HTMLElement>({
|
|
193
|
+
children,
|
|
194
|
+
...rest
|
|
195
|
+
}: DraggableProps<T, H>) => {
|
|
196
|
+
return children(useDraggable(rest));
|
|
197
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
/* Source: https://github.com/wojtekmaj/merge-refs/tree/main */
|
|
6
|
+
|
|
7
|
+
import type * as React from 'react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A function that merges React refs into one.
|
|
11
|
+
* Supports both functions and ref objects created using createRef() and useRef().
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* ```tsx
|
|
15
|
+
* <div ref={mergeRefs(ref1, ref2, ref3)} />
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @param {(React.Ref<T> | undefined)[]} inputRefs Array of refs
|
|
19
|
+
* @returns {React.Ref<T> | React.RefCallback<T>} Merged refs
|
|
20
|
+
*/
|
|
21
|
+
export const mergeRefs = <T>(
|
|
22
|
+
...inputRefs: Array<undefined | React.Ref<T>>
|
|
23
|
+
): React.Ref<T> | React.RefCallback<T> => {
|
|
24
|
+
const filteredInputRefs = inputRefs.filter(Boolean);
|
|
25
|
+
|
|
26
|
+
if (filteredInputRefs.length <= 1) {
|
|
27
|
+
const firstRef = filteredInputRefs[0];
|
|
28
|
+
return firstRef || null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (ref) => {
|
|
32
|
+
filteredInputRefs.forEach((inputRef) => {
|
|
33
|
+
if (typeof inputRef === 'function') {
|
|
34
|
+
inputRef(ref);
|
|
35
|
+
} else if (inputRef) {
|
|
36
|
+
(inputRef as React.MutableRefObject<T | null>).current = ref;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
@layer baklava.base {
|
|
6
|
+
.util-overflow-tester {
|
|
7
|
+
margin-block: var(--bk-sizing-3);
|
|
8
|
+
|
|
9
|
+
summary {
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
|
|
7
|
+
import './OverflowTester.css';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
type OverflowTesterProps = {
|
|
11
|
+
lines?: number,
|
|
12
|
+
openDefault?: boolean,
|
|
13
|
+
};
|
|
14
|
+
export const OverflowTester = ({ lines = 50, openDefault = false }: OverflowTesterProps) => {
|
|
15
|
+
const ref = React.useRef<HTMLDetailsElement>(null);
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
if (openDefault && ref.current) {
|
|
18
|
+
ref.current.open = true;
|
|
19
|
+
}
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<details ref={ref} className="util-overflow-tester">
|
|
24
|
+
<summary>Test overflow</summary>
|
|
25
|
+
{Array.from({ length: lines }).map((_, index) =>
|
|
26
|
+
<p key={index}>...</p>
|
|
27
|
+
)}
|
|
28
|
+
</details>
|
|
29
|
+
);
|
|
30
|
+
};
|
package/src/util/time.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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 delay = (timeMs: number) => {
|
|
6
|
+
return new Promise(resolve => setTimeout(resolve, timeMs));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const timeout = (timeMs: number) => {
|
|
10
|
+
const message = `The action took too long to complete`;
|
|
11
|
+
return new Promise((_, reject) => setTimeout(reject, timeMs, new Error(message)));
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
// https://stackoverflow.com/questions/39419170/how-do-i-check-that-a-switch-block-is-exhaustive-in-typescript
|
|
6
|
+
export const assertUnreachable = (x: never): never => {
|
|
7
|
+
throw new Error(`Unexpected case`);
|
|
8
|
+
};
|