@hashicorp/mds-react 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +336 -0
- package/README.md +109 -0
- package/dist/components/accordion/index.d.ts +14 -0
- package/dist/components/accordion/index.js +9 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/accordion/item/button.d.ts +6 -0
- package/dist/components/accordion/item/button.js +44 -0
- package/dist/components/accordion/item/button.js.map +1 -0
- package/dist/components/accordion/item/index.d.ts +24 -0
- package/dist/components/accordion/item/index.js +59 -0
- package/dist/components/accordion/item/index.js.map +1 -0
- package/dist/components/accordion/style.module.scss +110 -0
- package/dist/components/accordion/style.module.scss.js +24 -0
- package/dist/components/accordion/style.module.scss.js.map +1 -0
- package/dist/components/alert/alert.module.scss +229 -0
- package/dist/components/alert/alert.module.scss.js +29 -0
- package/dist/components/alert/alert.module.scss.js.map +1 -0
- package/dist/components/alert/icon.d.ts +9 -0
- package/dist/components/alert/icon.js +34 -0
- package/dist/components/alert/icon.js.map +1 -0
- package/dist/components/alert/index.d.ts +62 -0
- package/dist/components/alert/index.js +97 -0
- package/dist/components/alert/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +30 -0
- package/dist/components/badge/index.js +50 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/badge/style.module.scss +130 -0
- package/dist/components/badge/style.module.scss.js +22 -0
- package/dist/components/badge/style.module.scss.js.map +1 -0
- package/dist/components/badge-count/index.d.ts +16 -0
- package/dist/components/badge-count/index.js +29 -0
- package/dist/components/badge-count/index.js.map +1 -0
- package/dist/components/badge-count/style.module.scss +108 -0
- package/dist/components/badge-count/style.module.scss.js +15 -0
- package/dist/components/badge-count/style.module.scss.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +7 -0
- package/dist/components/breadcrumbs/index.js +38 -0
- package/dist/components/breadcrumbs/index.js.map +1 -0
- package/dist/components/breadcrumbs/item/index.d.ts +2 -0
- package/dist/components/breadcrumbs/item/index.js +32 -0
- package/dist/components/breadcrumbs/item/index.js.map +1 -0
- package/dist/components/breadcrumbs/style.module.scss +183 -0
- package/dist/components/breadcrumbs/style.module.scss.js +27 -0
- package/dist/components/breadcrumbs/style.module.scss.js.map +1 -0
- package/dist/components/breadcrumbs/truncation-button/index.d.ts +3 -0
- package/dist/components/breadcrumbs/truncation-button/index.js +25 -0
- package/dist/components/breadcrumbs/truncation-button/index.js.map +1 -0
- package/dist/components/breadcrumbs/types/index.d.ts +51 -0
- package/dist/components/button/index.d.ts +31 -0
- package/dist/components/button/index.js +119 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/button/styles.module.scss +221 -0
- package/dist/components/button/styles.module.scss.js +32 -0
- package/dist/components/button/styles.module.scss.js.map +1 -0
- package/dist/components/card/card-thumbnail/card-thumbnail.module.css +10 -0
- package/dist/components/card/card-thumbnail/card-thumbnail.module.css.js +8 -0
- package/dist/components/card/card-thumbnail/card-thumbnail.module.css.js.map +1 -0
- package/dist/components/card/card-thumbnail/index.d.ts +2 -0
- package/dist/components/card/card-thumbnail/index.js +23 -0
- package/dist/components/card/card-thumbnail/index.js.map +1 -0
- package/dist/components/card/index.d.ts +3 -0
- package/dist/components/card/index.js +157 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/card/styles.module.css +98 -0
- package/dist/components/card/styles.module.css.js +29 -0
- package/dist/components/card/styles.module.css.js.map +1 -0
- package/dist/components/card/types.d.ts +52 -0
- package/dist/components/code-block/code-block.module.scss +511 -0
- package/dist/components/code-block/code-block.module.scss.js +34 -0
- package/dist/components/code-block/code-block.module.scss.js.map +1 -0
- package/dist/components/code-block/code-lines/index.d.ts +12 -0
- package/dist/components/code-block/code-lines/index.js +59 -0
- package/dist/components/code-block/code-lines/index.js.map +1 -0
- package/dist/components/code-block/code-lines/utils/split-html-into-lines.d.ts +19 -0
- package/dist/components/code-block/code-lines/utils/split-html-into-lines.js +19 -0
- package/dist/components/code-block/code-lines/utils/split-html-into-lines.js.map +1 -0
- package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.d.ts +21 -0
- package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.js +31 -0
- package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.js.map +1 -0
- package/dist/components/code-block/hidden-copy-content/index.d.ts +5 -0
- package/dist/components/code-block/hidden-copy-content/index.js +13 -0
- package/dist/components/code-block/hidden-copy-content/index.js.map +1 -0
- package/dist/components/code-block/index.d.ts +55 -0
- package/dist/components/code-block/index.js +88 -0
- package/dist/components/code-block/index.js.map +1 -0
- package/dist/components/code-block/utils/parse-highlighted-lines.d.ts +2 -0
- package/dist/components/code-block/utils/parse-highlighted-lines.js +39 -0
- package/dist/components/code-block/utils/parse-highlighted-lines.js.map +1 -0
- package/dist/components/code-block/utils/process-snippet.d.ts +12 -0
- package/dist/components/code-block/utils/process-snippet.js +20 -0
- package/dist/components/code-block/utils/process-snippet.js.map +1 -0
- package/dist/components/code-block/utils/shellwords.d.ts +14 -0
- package/dist/components/code-block/utils/shellwords.js +33 -0
- package/dist/components/code-block/utils/shellwords.js.map +1 -0
- package/dist/components/combo-box-primitive/index.d.ts +69 -0
- package/dist/components/combo-box-primitive/index.js +302 -0
- package/dist/components/combo-box-primitive/index.js.map +1 -0
- package/dist/components/dialog-primitive/dialog.module.scss +38 -0
- package/dist/components/dialog-primitive/dialog.module.scss.js +12 -0
- package/dist/components/dialog-primitive/dialog.module.scss.js.map +1 -0
- package/dist/components/dialog-primitive/index.d.ts +12 -0
- package/dist/components/dialog-primitive/index.js +15 -0
- package/dist/components/dialog-primitive/index.js.map +1 -0
- package/dist/components/disclosure-primitive/index.d.ts +19 -0
- package/dist/components/disclosure-primitive/index.js +57 -0
- package/dist/components/disclosure-primitive/index.js.map +1 -0
- package/dist/components/disclosure-primitive/styles.module.css +3 -0
- package/dist/components/disclosure-primitive/styles.module.css.js +7 -0
- package/dist/components/disclosure-primitive/styles.module.css.js.map +1 -0
- package/dist/components/disclosure-primitive/use-disclosure-primitive.d.ts +11 -0
- package/dist/components/disclosure-primitive/use-disclosure-primitive.js +17 -0
- package/dist/components/disclosure-primitive/use-disclosure-primitive.js.map +1 -0
- package/dist/components/dismiss-button/index.d.ts +9 -0
- package/dist/components/dismiss-button/index.js +22 -0
- package/dist/components/dismiss-button/index.js.map +1 -0
- package/dist/components/dismiss-button/styles.module.scss +31 -0
- package/dist/components/dismiss-button/styles.module.scss.js +7 -0
- package/dist/components/dismiss-button/styles.module.scss.js.map +1 -0
- package/dist/components/dropdown/index.d.ts +72 -0
- package/dist/components/dropdown/index.js +79 -0
- package/dist/components/dropdown/index.js.map +1 -0
- package/dist/components/dropdown/list-item/custom.d.ts +10 -0
- package/dist/components/dropdown/list-item/custom.js +9 -0
- package/dist/components/dropdown/list-item/custom.js.map +1 -0
- package/dist/components/dropdown/list-item/index.d.ts +19 -0
- package/dist/components/dropdown/list-item/index.js +14 -0
- package/dist/components/dropdown/list-item/index.js.map +1 -0
- package/dist/components/dropdown/list-item/interactive.d.ts +29 -0
- package/dist/components/dropdown/list-item/interactive.js +49 -0
- package/dist/components/dropdown/list-item/interactive.js.map +1 -0
- package/dist/components/dropdown/list-item/separator.d.ts +8 -0
- package/dist/components/dropdown/list-item/separator.js +17 -0
- package/dist/components/dropdown/list-item/separator.js.map +1 -0
- package/dist/components/dropdown/list-item/styles.module.css +222 -0
- package/dist/components/dropdown/list-item/styles.module.css.js +26 -0
- package/dist/components/dropdown/list-item/styles.module.css.js.map +1 -0
- package/dist/components/dropdown/list-item/title.d.ts +10 -0
- package/dist/components/dropdown/list-item/title.js +9 -0
- package/dist/components/dropdown/list-item/title.js.map +1 -0
- package/dist/components/dropdown/styles.module.css +74 -0
- package/dist/components/dropdown/styles.module.css.js +24 -0
- package/dist/components/dropdown/styles.module.css.js.map +1 -0
- package/dist/components/dropdown/toggle-button/index.d.ts +30 -0
- package/dist/components/dropdown/toggle-button/index.js +54 -0
- package/dist/components/dropdown/toggle-button/index.js.map +1 -0
- package/dist/components/dropdown/toggle-button/styles.module.scss +54 -0
- package/dist/components/dropdown/toggle-button/styles.module.scss.js +14 -0
- package/dist/components/dropdown/toggle-button/styles.module.scss.js.map +1 -0
- package/dist/components/flight-icon/flight-icon.module.css +31 -0
- package/dist/components/flight-icon/flight-icon.module.css.js +12 -0
- package/dist/components/flight-icon/flight-icon.module.css.js.map +1 -0
- package/dist/components/flight-icon/index.d.ts +44 -0
- package/dist/components/flight-icon/index.js +58 -0
- package/dist/components/flight-icon/index.js.map +1 -0
- package/dist/components/form/checkbox/form-checkbox.module.css +88 -0
- package/dist/components/form/checkbox/form-checkbox.module.css.js +8 -0
- package/dist/components/form/checkbox/form-checkbox.module.css.js.map +1 -0
- package/dist/components/form/checkbox/index.d.ts +45 -0
- package/dist/components/form/checkbox/index.js +109 -0
- package/dist/components/form/checkbox/index.js.map +1 -0
- package/dist/components/form/error/form-error.module.css +23 -0
- package/dist/components/form/error/form-error.module.css.js +14 -0
- package/dist/components/form/error/form-error.module.css.js.map +1 -0
- package/dist/components/form/error/index.d.ts +16 -0
- package/dist/components/form/error/index.js +22 -0
- package/dist/components/form/error/index.js.map +1 -0
- package/dist/components/form/field/form-field.module.css +79 -0
- package/dist/components/form/field/form-field.module.css.js +17 -0
- package/dist/components/form/field/form-field.module.css.js.map +1 -0
- package/dist/components/form/field/index.d.ts +19 -0
- package/dist/components/form/field/index.js +46 -0
- package/dist/components/form/field/index.js.map +1 -0
- package/dist/components/form/fieldset/form-fieldset.module.css +48 -0
- package/dist/components/form/fieldset/form-fieldset.module.css.js +19 -0
- package/dist/components/form/fieldset/form-fieldset.module.css.js.map +1 -0
- package/dist/components/form/fieldset/index.d.ts +19 -0
- package/dist/components/form/fieldset/index.js +65 -0
- package/dist/components/form/fieldset/index.js.map +1 -0
- package/dist/components/form/file-input/form-file-input.module.scss +81 -0
- package/dist/components/form/file-input/form-file-input.module.scss.js +7 -0
- package/dist/components/form/file-input/form-file-input.module.scss.js.map +1 -0
- package/dist/components/form/file-input/index.d.ts +27 -0
- package/dist/components/form/file-input/index.js +68 -0
- package/dist/components/form/file-input/index.js.map +1 -0
- package/dist/components/form/helper-text/form-helper-text.module.css +10 -0
- package/dist/components/form/helper-text/form-helper-text.module.css.js +7 -0
- package/dist/components/form/helper-text/form-helper-text.module.css.js.map +1 -0
- package/dist/components/form/helper-text/index.d.ts +11 -0
- package/dist/components/form/helper-text/index.js +22 -0
- package/dist/components/form/helper-text/index.js.map +1 -0
- package/dist/components/form/indicator/form-indicator.module.css +10 -0
- package/dist/components/form/indicator/form-indicator.module.css.js +8 -0
- package/dist/components/form/indicator/form-indicator.module.css.js.map +1 -0
- package/dist/components/form/indicator/index.d.ts +9 -0
- package/dist/components/form/indicator/index.js +22 -0
- package/dist/components/form/indicator/index.js.map +1 -0
- package/dist/components/form/label/form-label.module.css +15 -0
- package/dist/components/form/label/form-label.module.css.js +10 -0
- package/dist/components/form/label/form-label.module.css.js.map +1 -0
- package/dist/components/form/label/index.d.ts +14 -0
- package/dist/components/form/label/index.js +33 -0
- package/dist/components/form/label/index.js.map +1 -0
- package/dist/components/form/legend/form-legend.module.css +17 -0
- package/dist/components/form/legend/form-legend.module.css.js +10 -0
- package/dist/components/form/legend/form-legend.module.css.js.map +1 -0
- package/dist/components/form/legend/index.d.ts +12 -0
- package/dist/components/form/legend/index.js +19 -0
- package/dist/components/form/legend/index.js.map +1 -0
- package/dist/components/form/radio/form-radio.module.scss +74 -0
- package/dist/components/form/radio/form-radio.module.scss.js +8 -0
- package/dist/components/form/radio/form-radio.module.scss.js.map +1 -0
- package/dist/components/form/radio/index.d.ts +44 -0
- package/dist/components/form/radio/index.js +100 -0
- package/dist/components/form/radio/index.js.map +1 -0
- package/dist/components/form/radio-card/description.d.ts +3 -0
- package/dist/components/form/radio-card/description.js +10 -0
- package/dist/components/form/radio-card/description.js.map +1 -0
- package/dist/components/form/radio-card/form-radio-card.module.css +153 -0
- package/dist/components/form/radio-card/form-radio-card.module.css.js +30 -0
- package/dist/components/form/radio-card/form-radio-card.module.css.js.map +1 -0
- package/dist/components/form/radio-card/group.d.ts +11 -0
- package/dist/components/form/radio-card/group.js +31 -0
- package/dist/components/form/radio-card/group.js.map +1 -0
- package/dist/components/form/radio-card/index.d.ts +48 -0
- package/dist/components/form/radio-card/index.js +67 -0
- package/dist/components/form/radio-card/index.js.map +1 -0
- package/dist/components/form/radio-card/label.d.ts +3 -0
- package/dist/components/form/radio-card/label.js +10 -0
- package/dist/components/form/radio-card/label.js.map +1 -0
- package/dist/components/form/select/form-select.module.css +89 -0
- package/dist/components/form/select/form-select.module.css.js +14 -0
- package/dist/components/form/select/form-select.module.css.js.map +1 -0
- package/dist/components/form/select/index.d.ts +21 -0
- package/dist/components/form/select/index.js +79 -0
- package/dist/components/form/select/index.js.map +1 -0
- package/dist/components/form/super-select/form-super-select.module.css +155 -0
- package/dist/components/form/super-select/form-super-select.module.css.js +22 -0
- package/dist/components/form/super-select/form-super-select.module.css.js.map +1 -0
- package/dist/components/form/super-select/index.d.ts +55 -0
- package/dist/components/form/super-select/index.js +170 -0
- package/dist/components/form/super-select/index.js.map +1 -0
- package/dist/components/form/text-input/index.d.ts +98 -0
- package/dist/components/form/text-input/index.js +91 -0
- package/dist/components/form/text-input/index.js.map +1 -0
- package/dist/components/form/text-input/styles.module.css +158 -0
- package/dist/components/form/text-input/styles.module.css.js +15 -0
- package/dist/components/form/text-input/styles.module.css.js.map +1 -0
- package/dist/components/form/textarea/form-textarea.module.css +88 -0
- package/dist/components/form/textarea/form-textarea.module.css.js +14 -0
- package/dist/components/form/textarea/form-textarea.module.css.js.map +1 -0
- package/dist/components/form/textarea/index.d.ts +19 -0
- package/dist/components/form/textarea/index.js +74 -0
- package/dist/components/form/textarea/index.js.map +1 -0
- package/dist/components/form/toggle/form-toggle.module.scss +164 -0
- package/dist/components/form/toggle/form-toggle.module.scss.js +12 -0
- package/dist/components/form/toggle/form-toggle.module.scss.js.map +1 -0
- package/dist/components/form/toggle/index.d.ts +78 -0
- package/dist/components/form/toggle/index.js +102 -0
- package/dist/components/form/toggle/index.js.map +1 -0
- package/dist/components/hds/wrappers/tooltip.d.ts +13 -0
- package/dist/components/hds/wrappers/tooltip.js +51 -0
- package/dist/components/hds/wrappers/tooltip.js.map +1 -0
- package/dist/components/icon-tile/index.d.ts +21 -0
- package/dist/components/icon-tile/index.js +50 -0
- package/dist/components/icon-tile/index.js.map +1 -0
- package/dist/components/icon-tile/style.module.scss +136 -0
- package/dist/components/icon-tile/style.module.scss.js +29 -0
- package/dist/components/icon-tile/style.module.scss.js.map +1 -0
- package/dist/components/index.d.ts +60 -0
- package/dist/components/index.js +119 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/inline-link/index.d.ts +40 -0
- package/dist/components/inline-link/index.js +33 -0
- package/dist/components/inline-link/index.js.map +1 -0
- package/dist/components/inline-link/inline-link.module.css +49 -0
- package/dist/components/inline-link/inline-link.module.css.js +11 -0
- package/dist/components/inline-link/inline-link.module.css.js.map +1 -0
- package/dist/components/interactive/index.d.ts +26 -0
- package/dist/components/interactive/index.js +59 -0
- package/dist/components/interactive/index.js.map +1 -0
- package/dist/components/legacy-button/index.d.ts +5 -0
- package/dist/components/legacy-button/index.js +65 -0
- package/dist/components/legacy-button/index.js.map +1 -0
- package/dist/components/legacy-button/types.d.ts +37 -0
- package/dist/components/legacy-button/utils.d.ts +9 -0
- package/dist/components/legacy-button/utils.js +39 -0
- package/dist/components/legacy-button/utils.js.map +1 -0
- package/dist/components/menu-primitive/index.d.ts +14 -0
- package/dist/components/menu-primitive/index.js +68 -0
- package/dist/components/menu-primitive/index.js.map +1 -0
- package/dist/components/menu-primitive/styles.module.css +16 -0
- package/dist/components/menu-primitive/styles.module.css.js +12 -0
- package/dist/components/menu-primitive/styles.module.css.js.map +1 -0
- package/dist/components/menu-primitive/use-menu-primitive.d.ts +9 -0
- package/dist/components/menu-primitive/use-menu-primitive.js +17 -0
- package/dist/components/menu-primitive/use-menu-primitive.js.map +1 -0
- package/dist/components/modal/index.d.ts +13 -0
- package/dist/components/modal/index.js +61 -0
- package/dist/components/modal/index.js.map +1 -0
- package/dist/components/modal/modal.module.css +22 -0
- package/dist/components/modal/modal.module.css.js +8 -0
- package/dist/components/modal/modal.module.css.js.map +1 -0
- package/dist/components/modal/use-modal.d.ts +8 -0
- package/dist/components/modal/use-modal.js +17 -0
- package/dist/components/modal/use-modal.js.map +1 -0
- package/dist/components/separator/index.d.ts +10 -0
- package/dist/components/separator/index.js +15 -0
- package/dist/components/separator/index.js.map +1 -0
- package/dist/components/separator/separator.module.css +15 -0
- package/dist/components/separator/separator.module.css.js +10 -0
- package/dist/components/separator/separator.module.css.js.map +1 -0
- package/dist/components/standalone-link/index.d.ts +23 -0
- package/dist/components/standalone-link/index.js +54 -0
- package/dist/components/standalone-link/index.js.map +1 -0
- package/dist/components/standalone-link/styles.module.scss +166 -0
- package/dist/components/standalone-link/styles.module.scss.js +17 -0
- package/dist/components/standalone-link/styles.module.scss.js.map +1 -0
- package/dist/components/table/index.d.ts +58 -0
- package/dist/components/table/index.js +52 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/table.module.scss +192 -0
- package/dist/components/table/table.module.scss.js +33 -0
- package/dist/components/table/table.module.scss.js.map +1 -0
- package/dist/components/table/td.d.ts +17 -0
- package/dist/components/table/td.js +28 -0
- package/dist/components/table/td.js.map +1 -0
- package/dist/components/table/th-button-tooltip.d.ts +6 -0
- package/dist/components/table/th-button-tooltip.js +24 -0
- package/dist/components/table/th-button-tooltip.js.map +1 -0
- package/dist/components/table/th.d.ts +34 -0
- package/dist/components/table/th.js +43 -0
- package/dist/components/table/th.js.map +1 -0
- package/dist/components/table/tr.d.ts +12 -0
- package/dist/components/table/tr.js +9 -0
- package/dist/components/table/tr.js.map +1 -0
- package/dist/components/table/utils.d.ts +16 -0
- package/dist/components/table/utils.js +28 -0
- package/dist/components/table/utils.js.map +1 -0
- package/dist/components/tabs/index.d.ts +21 -0
- package/dist/components/tabs/index.js +117 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/tabs/tab-panel.d.ts +5 -0
- package/dist/components/tabs/tab-panel.js +35 -0
- package/dist/components/tabs/tab-panel.js.map +1 -0
- package/dist/components/tabs/tab.d.ts +24 -0
- package/dist/components/tabs/tab.js +70 -0
- package/dist/components/tabs/tab.js.map +1 -0
- package/dist/components/tabs/tabs.module.scss +163 -0
- package/dist/components/tabs/tabs.module.scss.js +22 -0
- package/dist/components/tabs/tabs.module.scss.js.map +1 -0
- package/dist/components/tabs/use-tabs-context.d.ts +15 -0
- package/dist/components/tabs/use-tabs-context.js +16 -0
- package/dist/components/tabs/use-tabs-context.js.map +1 -0
- package/dist/components/text/index.d.ts +44 -0
- package/dist/components/text/index.js +112 -0
- package/dist/components/text/index.js.map +1 -0
- package/dist/components/text/style.module.scss +11 -0
- package/dist/components/text/style.module.scss.js +9 -0
- package/dist/components/text/style.module.scss.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.d.ts +8 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js +62 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css +76 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js +20 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/index.d.ts +44 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/index.js +104 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/index.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.d.ts +10 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.js +13 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css +29 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js +14 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css +76 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css.js +28 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css.js.map +1 -0
- package/dist/components/visualizations/bar-chart/index.d.ts +13 -0
- package/dist/components/visualizations/bar-chart/index.js +37 -0
- package/dist/components/visualizations/bar-chart/index.js.map +1 -0
- package/dist/components/visualizations/bar-chart/style.module.css +39 -0
- package/dist/components/visualizations/bar-chart/style.module.css.js +12 -0
- package/dist/components/visualizations/bar-chart/style.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.d.ts +3 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.js +14 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css +14 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js +10 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/index.d.ts +3 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/index.js +58 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/index.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css +32 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js +16 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/index.d.ts +3 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.d.ts +3 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.js +42 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css +20 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js +14 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/index.d.ts +10 -0
- package/dist/components/visualizations/donut-chart/index.js +90 -0
- package/dist/components/visualizations/donut-chart/index.js.map +1 -0
- package/dist/components/visualizations/donut-chart/styles.module.css +73 -0
- package/dist/components/visualizations/donut-chart/styles.module.css.js +20 -0
- package/dist/components/visualizations/donut-chart/styles.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/types.d.ts +16 -0
- package/dist/hooks/use-media-query/index.js +16 -0
- package/dist/hooks/use-media-query/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +158 -0
- package/dist/index.js.map +1 -0
- package/dist/patterns/card/index.d.ts +5 -0
- package/dist/patterns/card/newsroom-card/index.d.ts +15 -0
- package/dist/patterns/card/newsroom-card/index.js +26 -0
- package/dist/patterns/card/newsroom-card/index.js.map +1 -0
- package/dist/patterns/card/newsroom-card/style.module.css +12 -0
- package/dist/patterns/card/newsroom-card/style.module.css.js +8 -0
- package/dist/patterns/card/newsroom-card/style.module.css.js.map +1 -0
- package/dist/patterns/card/partner-card/index.d.ts +18 -0
- package/dist/patterns/card/partner-card/index.js +42 -0
- package/dist/patterns/card/partner-card/index.js.map +1 -0
- package/dist/patterns/card/partner-card/style.module.css +24 -0
- package/dist/patterns/card/partner-card/style.module.css.js +12 -0
- package/dist/patterns/card/partner-card/style.module.css.js.map +1 -0
- package/dist/patterns/card/person-card/index.d.ts +15 -0
- package/dist/patterns/card/person-card/index.js +52 -0
- package/dist/patterns/card/person-card/index.js.map +1 -0
- package/dist/patterns/card/person-card/style.module.css +28 -0
- package/dist/patterns/card/person-card/style.module.css.js +12 -0
- package/dist/patterns/card/person-card/style.module.css.js.map +1 -0
- package/dist/patterns/card/primitives.d.ts +37 -0
- package/dist/patterns/card/primitives.js +77 -0
- package/dist/patterns/card/primitives.js.map +1 -0
- package/dist/patterns/card/promo-card/index.d.ts +18 -0
- package/dist/patterns/card/promo-card/index.js +36 -0
- package/dist/patterns/card/promo-card/index.js.map +1 -0
- package/dist/patterns/card/resource-card/index.d.ts +16 -0
- package/dist/patterns/card/resource-card/index.js +26 -0
- package/dist/patterns/card/resource-card/index.js.map +1 -0
- package/dist/patterns/card/style.module.css +121 -0
- package/dist/patterns/card/style.module.css.js +30 -0
- package/dist/patterns/card/style.module.css.js.map +1 -0
- package/dist/patterns/card/thumbnails/index.d.ts +13 -0
- package/dist/patterns/card/thumbnails/index.js +25 -0
- package/dist/patterns/card/thumbnails/index.js.map +1 -0
- package/dist/patterns/card/types.d.ts +41 -0
- package/dist/patterns/card/unified-card/index.d.ts +10 -0
- package/dist/patterns/card/unified-card/index.js +37 -0
- package/dist/patterns/card/unified-card/index.js.map +1 -0
- package/dist/patterns/copy-button/clipboard.d.ts +16 -0
- package/dist/patterns/copy-button/clipboard.js +78 -0
- package/dist/patterns/copy-button/clipboard.js.map +1 -0
- package/dist/patterns/copy-button/index.d.ts +19 -0
- package/dist/patterns/copy-button/index.js +57 -0
- package/dist/patterns/copy-button/index.js.map +1 -0
- package/dist/patterns/copy-button/style.module.css +23 -0
- package/dist/patterns/copy-button/style.module.css.js +13 -0
- package/dist/patterns/copy-button/style.module.css.js.map +1 -0
- package/dist/patterns/index.d.ts +15 -0
- package/dist/patterns/index.js +35 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/layout/index.d.ts +69 -0
- package/dist/patterns/layout/index.js +47 -0
- package/dist/patterns/layout/index.js.map +1 -0
- package/dist/patterns/layout/layout.module.css +72 -0
- package/dist/patterns/layout/layout.module.css.js +20 -0
- package/dist/patterns/layout/layout.module.css.js.map +1 -0
- package/dist/patterns/product-badge/index.d.ts +11 -0
- package/dist/patterns/product-badge/index.js +22 -0
- package/dist/patterns/product-badge/index.js.map +1 -0
- package/dist/patterns/product-badge/style.module.css +3 -0
- package/dist/patterns/product-badge/style.module.css.js +8 -0
- package/dist/patterns/product-badge/style.module.css.js.map +1 -0
- package/dist/patterns/product-logo/index.d.ts +48 -0
- package/dist/patterns/product-logo/index.js +130 -0
- package/dist/patterns/product-logo/index.js.map +1 -0
- package/dist/patterns/product-logo/product-logo.module.css +24 -0
- package/dist/patterns/product-logo/product-logo.module.css.js +13 -0
- package/dist/patterns/product-logo/product-logo.module.css.js.map +1 -0
- package/dist/patterns/related-content/index.d.ts +6 -0
- package/dist/patterns/related-content/index.js +65 -0
- package/dist/patterns/related-content/index.js.map +1 -0
- package/dist/patterns/related-content/style.module.css +74 -0
- package/dist/patterns/related-content/style.module.css.js +22 -0
- package/dist/patterns/related-content/style.module.css.js.map +1 -0
- package/dist/patterns/related-content/types.d.ts +14 -0
- package/dist/style.css +1 -0
- package/dist/styles/mixins/button.scss +284 -0
- package/dist/styles/mixins/focus-ring.scss +75 -0
- package/dist/utils/get-contrast-yiq.d.ts +20 -0
- package/dist/utils/get-contrast-yiq.js +13 -0
- package/dist/utils/get-contrast-yiq.js.map +1 -0
- package/dist/utils/hooks/use-screen-size.d.ts +5 -0
- package/dist/utils/hooks/use-screen-size.js +10 -0
- package/dist/utils/hooks/use-screen-size.js.map +1 -0
- package/dist/utils/i18n/index.d.ts +1 -0
- package/dist/utils/i18n/index.js +41 -0
- package/dist/utils/i18n/index.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/make-normalizer/index.d.ts +30 -0
- package/dist/utils/make-normalizer/index.js +34 -0
- package/dist/utils/make-normalizer/index.js.map +1 -0
- package/dist/utils/mds-context/index.d.ts +59 -0
- package/dist/utils/mds-context/index.js +85 -0
- package/dist/utils/mds-context/index.js.map +1 -0
- package/package.json +113 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
$hds-button-border-radius: 5px;
|
|
2
|
+
$hds-button-border-width: 1px;
|
|
3
|
+
$hds-button-focus-border-width: 3px;
|
|
4
|
+
|
|
5
|
+
@mixin hds-button() {
|
|
6
|
+
position: relative;
|
|
7
|
+
display: flex;
|
|
8
|
+
gap: 0.375rem;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
width: auto;
|
|
12
|
+
// notice: we set the font-weight of the button text to "regular" (on purpose)
|
|
13
|
+
// because of the antialising of the browser that renders the text quite different
|
|
14
|
+
// from what it looks like in Figma, so we prefer to have them visually similar
|
|
15
|
+
// even if they differ in their internal implementation (in Figma the font-weight is medium/500)
|
|
16
|
+
// for more context about this decision: https://hashicorp.atlassian.net/browse/HDS-2099
|
|
17
|
+
font-weight: var(--mds-typography-font-weight-regular);
|
|
18
|
+
font-family: var(--mds-typography-font-stack-text);
|
|
19
|
+
text-decoration: underline;
|
|
20
|
+
text-decoration-color: transparent;
|
|
21
|
+
border: $hds-button-border-width solid transparent; // We need this to be transparent for a11y
|
|
22
|
+
border-radius: $hds-button-border-radius;
|
|
23
|
+
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
24
|
+
outline-color: transparent; // We need this to be transparent for a11y
|
|
25
|
+
isolation: isolate;
|
|
26
|
+
transition: color 0.15s ease-in, background-color 0.15s ease-in,
|
|
27
|
+
border-color 0.15s ease-in, text-decoration-color 0.15s ease-in;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@mixin hds-button-state-disabled() {
|
|
31
|
+
color: var(--mds-color-foreground-disabled);
|
|
32
|
+
background: var(--mds-color-surface-faint);
|
|
33
|
+
border-color: var(--mds-color-border-primary);
|
|
34
|
+
box-shadow: none;
|
|
35
|
+
cursor: not-allowed;
|
|
36
|
+
|
|
37
|
+
&::before {
|
|
38
|
+
border-color: transparent;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@mixin hds-button-state-focus() {
|
|
43
|
+
box-shadow: none;
|
|
44
|
+
|
|
45
|
+
&::before {
|
|
46
|
+
// the position absolute of an element is computed from the inside of the border of the container
|
|
47
|
+
// so we have to take in account the border width of the pseudo-element container itself
|
|
48
|
+
$shift: $hds-button-border-width + $hds-button-focus-border-width;
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: -$shift;
|
|
51
|
+
right: -$shift;
|
|
52
|
+
bottom: -$shift;
|
|
53
|
+
left: -$shift;
|
|
54
|
+
z-index: -1;
|
|
55
|
+
border: $hds-button-focus-border-width solid transparent;
|
|
56
|
+
border-radius: $hds-button-border-radius + $hds-button-focus-border-width;
|
|
57
|
+
content: '';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@mixin hds-button-color-primary() {
|
|
62
|
+
color: var(
|
|
63
|
+
--mds-accent-button-color-foreground,
|
|
64
|
+
var(--mds-color-foreground-high-contrast)
|
|
65
|
+
);
|
|
66
|
+
background: var(
|
|
67
|
+
--mds-accent-button-color-background,
|
|
68
|
+
var(--mds-color-palette-blue-200)
|
|
69
|
+
);
|
|
70
|
+
border-color: var(
|
|
71
|
+
--mds-accent-button-color-border,
|
|
72
|
+
var(--mds-color-palette-blue-300)
|
|
73
|
+
);
|
|
74
|
+
border-width: var(--mds-accent-button-border-width, $hds-button-border-width);
|
|
75
|
+
box-shadow: var(--mds-elevation-low-box-shadow);
|
|
76
|
+
|
|
77
|
+
&:hover {
|
|
78
|
+
color: var(
|
|
79
|
+
--mds-accent-button-color-hover-foreground,
|
|
80
|
+
var(
|
|
81
|
+
--mds-accent-button-color-foreground,
|
|
82
|
+
var(--mds-color-foreground-high-contrast)
|
|
83
|
+
)
|
|
84
|
+
);
|
|
85
|
+
background: var(
|
|
86
|
+
--mds-accent-button-color-hover-background,
|
|
87
|
+
var(
|
|
88
|
+
--mds-accent-button-color-background,
|
|
89
|
+
var(--mds-color-palette-blue-300)
|
|
90
|
+
)
|
|
91
|
+
);
|
|
92
|
+
border-color: var(
|
|
93
|
+
--mds-accent-button-color-hover-border,
|
|
94
|
+
var(--mds-accent-button-color-border, var(--mds-color-palette-blue-400))
|
|
95
|
+
);
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:focus {
|
|
100
|
+
color: var(
|
|
101
|
+
--mds-accent-button-color-focus-foreground,
|
|
102
|
+
var(
|
|
103
|
+
--mds-accent-button-color-foreground,
|
|
104
|
+
var(--mds-color-foreground-high-contrast)
|
|
105
|
+
)
|
|
106
|
+
);
|
|
107
|
+
background: var(
|
|
108
|
+
--mds-accent-button-color-focus-background,
|
|
109
|
+
var(
|
|
110
|
+
--mds-accent-button-color-background,
|
|
111
|
+
var(--mds-color-palette-blue-200)
|
|
112
|
+
)
|
|
113
|
+
);
|
|
114
|
+
border-color: var(
|
|
115
|
+
--mds-accent-button-color-focus-border,
|
|
116
|
+
var(
|
|
117
|
+
--mds-accent-button-color-border,
|
|
118
|
+
var(--mds-color-focus-action-internal)
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
&::before {
|
|
123
|
+
// the position absolute of an element is computed from the inside of the border of the container
|
|
124
|
+
// so we have to take in account the border width of the pseudo-element container itself
|
|
125
|
+
// plus for the primary button we want to have a 2px gap between the button and the focus
|
|
126
|
+
$shift: $hds-button-border-width + $hds-button-focus-border-width + 2px;
|
|
127
|
+
top: -$shift;
|
|
128
|
+
right: -$shift;
|
|
129
|
+
bottom: -$shift;
|
|
130
|
+
left: -$shift;
|
|
131
|
+
border-color: var(--mds-color-focus-action-external);
|
|
132
|
+
border-radius: $hds-button-border-radius + $hds-button-focus-border-width +
|
|
133
|
+
2px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&:active {
|
|
138
|
+
color: var(
|
|
139
|
+
--mds-accent-button-color-active-foreground,
|
|
140
|
+
var(
|
|
141
|
+
--mds-accent-button-color-foreground,
|
|
142
|
+
var(--mds-color-foreground-high-contrast)
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
background: var(
|
|
146
|
+
--mds-accent-button-color-active-background,
|
|
147
|
+
var(
|
|
148
|
+
--mds-accent-button-color-background,
|
|
149
|
+
var(--mds-color-palette-blue-400)
|
|
150
|
+
)
|
|
151
|
+
);
|
|
152
|
+
border-color: var(
|
|
153
|
+
--mds-accent-button-color-active-border,
|
|
154
|
+
var(--mds-accent-button-color-border, var(--mds-color-palette-blue-400))
|
|
155
|
+
);
|
|
156
|
+
box-shadow: none;
|
|
157
|
+
|
|
158
|
+
&::before {
|
|
159
|
+
border-color: transparent;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@mixin hds-button-color-secondary() {
|
|
165
|
+
color: var(--mds-color-foreground-primary);
|
|
166
|
+
background-color: var(--mds-color-surface-faint);
|
|
167
|
+
border-color: var(--mds-color-border-strong);
|
|
168
|
+
box-shadow: var(--mds-elevation-low-box-shadow);
|
|
169
|
+
|
|
170
|
+
&:hover {
|
|
171
|
+
color: var(--mds-color-foreground-primary);
|
|
172
|
+
background-color: var(--mds-color-surface-primary);
|
|
173
|
+
border-color: var(--mds-color-border-strong);
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&:focus {
|
|
178
|
+
color: var(--mds-color-foreground-primary);
|
|
179
|
+
background-color: var(--mds-color-surface-faint);
|
|
180
|
+
border-color: var(--mds-color-focus-action-internal);
|
|
181
|
+
|
|
182
|
+
&::before {
|
|
183
|
+
border-color: var(--mds-color-focus-action-external);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&:active {
|
|
188
|
+
color: var(--mds-color-foreground-primary);
|
|
189
|
+
background-color: var(--mds-color-surface-interactive-active);
|
|
190
|
+
border-color: var(--mds-color-border-strong);
|
|
191
|
+
box-shadow: none;
|
|
192
|
+
|
|
193
|
+
&::before {
|
|
194
|
+
border-color: transparent;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@mixin hds-button-color-tertiary() {
|
|
200
|
+
color: var(--mds-color-foreground-action);
|
|
201
|
+
background-color: transparent;
|
|
202
|
+
border-color: transparent;
|
|
203
|
+
|
|
204
|
+
&:hover {
|
|
205
|
+
color: var(--mds-color-foreground-action-hover);
|
|
206
|
+
background-color: var(--mds-color-surface-primary);
|
|
207
|
+
border-color: var(--mds-color-border-strong);
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&:focus {
|
|
212
|
+
color: var(--mds-color-foreground-action);
|
|
213
|
+
border-color: var(--mds-color-focus-action-internal);
|
|
214
|
+
|
|
215
|
+
&::before {
|
|
216
|
+
border-color: var(--mds-color-focus-action-external);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
&:active {
|
|
221
|
+
color: var(--mds-color-foreground-action-active);
|
|
222
|
+
background-color: var(--mds-color-surface-interactive-active);
|
|
223
|
+
border-color: var(--mds-color-border-strong);
|
|
224
|
+
box-shadow: none;
|
|
225
|
+
|
|
226
|
+
&::before {
|
|
227
|
+
border-color: transparent;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
//
|
|
232
|
+
// IMPORTANT: we need to use also the [disabled] selector because if the "disabled" attribute is applied to a "Button as link",
|
|
233
|
+
// the ":disabled" pseudo-selector is not applied to the element in the browser (rightly) because a link can't be disabled
|
|
234
|
+
// but from the product perspective there may be use cases where they need to have a "Button as link" that looks disabled anyway
|
|
235
|
+
//
|
|
236
|
+
&:disabled,
|
|
237
|
+
&[disabled],
|
|
238
|
+
&:disabled:focus,
|
|
239
|
+
&[disabled]:focus,
|
|
240
|
+
&:disabled:hover,
|
|
241
|
+
&[disabled]:hover {
|
|
242
|
+
background-color: transparent;
|
|
243
|
+
border-color: transparent;
|
|
244
|
+
|
|
245
|
+
&::before {
|
|
246
|
+
border-color: transparent;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@mixin hds-button-color-critical() {
|
|
252
|
+
color: var(--mds-color-foreground-critical-on-surface);
|
|
253
|
+
background-color: var(--mds-color-surface-critical);
|
|
254
|
+
border-color: var(--mds-color-foreground-critical-on-surface);
|
|
255
|
+
box-shadow: var(--mds-elevation-low-box-shadow);
|
|
256
|
+
|
|
257
|
+
&:hover {
|
|
258
|
+
color: var(--mds-color-foreground-high-contrast);
|
|
259
|
+
background-color: var(--mds-color-palette-red-300);
|
|
260
|
+
border-color: var(--mds-color-palette-red-400);
|
|
261
|
+
cursor: pointer;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&:focus {
|
|
265
|
+
color: var(--mds-color-foreground-critical-on-surface);
|
|
266
|
+
background-color: var(--mds-color-surface-critical);
|
|
267
|
+
border-color: var(--mds-color-focus-critical-internal);
|
|
268
|
+
|
|
269
|
+
&::before {
|
|
270
|
+
border-color: var(--mds-color-focus-critical-external);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
&:active {
|
|
275
|
+
color: var(--mds-color-foreground-high-contrast);
|
|
276
|
+
background-color: var(--mds-color-palette-red-400);
|
|
277
|
+
border-color: var(--mds-color-palette-red-400);
|
|
278
|
+
box-shadow: none;
|
|
279
|
+
|
|
280
|
+
&::before {
|
|
281
|
+
border-color: transparent;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// For an explanation of the ":focus/:focus-visible" states see:
|
|
2
|
+
// - https://github.com/hashicorp/design-system-components/issues/161
|
|
3
|
+
// - https://www.tpgi.com/focus-visible-and-backwards-compatibility/
|
|
4
|
+
|
|
5
|
+
@mixin hds-focus-ring-basic($color: action) {
|
|
6
|
+
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
7
|
+
outline-color: transparent;
|
|
8
|
+
|
|
9
|
+
// default focus for browsers that still rely on ":focus"
|
|
10
|
+
&:focus {
|
|
11
|
+
box-shadow: var(--mds-focus-ring-#{$color}-box-shadow);
|
|
12
|
+
}
|
|
13
|
+
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
|
|
14
|
+
&:focus:not(:focus-visible) {
|
|
15
|
+
box-shadow: none;
|
|
16
|
+
}
|
|
17
|
+
// set focus for browsers that support ":focus-visible"
|
|
18
|
+
&:focus-visible {
|
|
19
|
+
box-shadow: var(--mds-focus-ring-#{$color}-box-shadow);
|
|
20
|
+
}
|
|
21
|
+
// remove the focus ring on "active + focused" state (by design)
|
|
22
|
+
&:focus:active {
|
|
23
|
+
box-shadow: none;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@mixin hds-focus-ring-with-pseudo-element(
|
|
28
|
+
$top: 0,
|
|
29
|
+
$right: 0,
|
|
30
|
+
$bottom: 0,
|
|
31
|
+
$left: 0,
|
|
32
|
+
$radius: 5px,
|
|
33
|
+
$color: action
|
|
34
|
+
) {
|
|
35
|
+
position: relative;
|
|
36
|
+
outline-style: solid; // used to avoid double outline+focus-ring in Safari (see https://github.com/hashicorp/design-system-components/issues/161#issuecomment-1031548656)
|
|
37
|
+
outline-color: transparent;
|
|
38
|
+
isolation: isolate; // used to create a new stacking context (needed to have the pseudo element below text/icon but not the parent container)
|
|
39
|
+
|
|
40
|
+
&::before {
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: $top;
|
|
43
|
+
right: $right;
|
|
44
|
+
bottom: $bottom;
|
|
45
|
+
left: $left;
|
|
46
|
+
z-index: -1;
|
|
47
|
+
border-radius: $radius;
|
|
48
|
+
content: '';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// default focus for browsers that still rely on ":focus"
|
|
52
|
+
&:focus {
|
|
53
|
+
&::before {
|
|
54
|
+
box-shadow: var(--mds-focus-ring-#{$color}-box-shadow);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// undo the previous declaration for browsers that support ":focus-visible" but wouldn't normally show default focus styles
|
|
58
|
+
&:focus:not(:focus-visible) {
|
|
59
|
+
&::before {
|
|
60
|
+
box-shadow: none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// set focus for browsers that support ":focus-visible"
|
|
64
|
+
&:focus-visible {
|
|
65
|
+
&::before {
|
|
66
|
+
box-shadow: var(--mds-focus-ring-#{$color}-box-shadow);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// remove the focus ring on "active + focused" state (by design)
|
|
70
|
+
&:focus:active {
|
|
71
|
+
&::before {
|
|
72
|
+
box-shadow: none;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the contrast of an RGB color and determines whether to use dark or light text.
|
|
3
|
+
* @param rgb - An object containing the red (r), green (g), and blue (b) components of the color.
|
|
4
|
+
* @returns A string indicating whether to use 'dark' or 'light'.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getContrastYIQ: (rgb: {
|
|
7
|
+
r: number;
|
|
8
|
+
g: number;
|
|
9
|
+
b: number;
|
|
10
|
+
}) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Converts a HEX color string to an RGB object.
|
|
13
|
+
* @param hex - The HEX color string (e.g., "#ffffff").
|
|
14
|
+
* @returns An object containing the red (r), green (g), and blue (b) components, and black if the HEX string is invalid.
|
|
15
|
+
*/
|
|
16
|
+
export declare const hexToRgb: (hex: string) => {
|
|
17
|
+
r: number;
|
|
18
|
+
g: number;
|
|
19
|
+
b: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const r = (t) => (t.r * 299 + t.g * 587 + t.b * 114) / 1e3 >= 192 ? "dark" : "light", n = (t) => {
|
|
2
|
+
const e = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);
|
|
3
|
+
return e ? {
|
|
4
|
+
r: parseInt(e[1], 16),
|
|
5
|
+
g: parseInt(e[2], 16),
|
|
6
|
+
b: parseInt(e[3], 16)
|
|
7
|
+
} : { r: 0, g: 0, b: 0 };
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
r as getContrastYIQ,
|
|
11
|
+
n as hexToRgb
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=get-contrast-yiq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-contrast-yiq.js","sources":["../../src/utils/get-contrast-yiq.ts"],"sourcesContent":["/**\n * Calculates the contrast of an RGB color and determines whether to use dark or light text.\n * @param rgb - An object containing the red (r), green (g), and blue (b) components of the color.\n * @returns A string indicating whether to use 'dark' or 'light'.\n */\nexport const getContrastYIQ = (rgb: {\n\tr: number\n\tg: number\n\tb: number\n}): string => {\n\t// Calculate the YIQ value using the RGB components\n\tconst yiq = (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000\n\t// If YIQ is greater than or equal to 192, use 'dark', otherwise use 'light'\n\treturn yiq >= 192 ? 'dark' : 'light'\n}\n\n/**\n * Converts a HEX color string to an RGB object.\n * @param hex - The HEX color string (e.g., \"#ffffff\").\n * @returns An object containing the red (r), green (g), and blue (b) components, and black if the HEX string is invalid.\n */\nexport const hexToRgb = (hex: string): { r: number; g: number; b: number } => {\n\t// Extract the RGB components from the HEX string using a regular expression\n\tconst result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex)\n\t// If the HEX string is valid, parse the components and return the RGB object\n\treturn result\n\t\t? {\n\t\t\t\tr: parseInt(result[1], 16),\n\t\t\t\tg: parseInt(result[2], 16),\n\t\t\t\tb: parseInt(result[3], 16),\n\t\t }\n\t\t: { r: 0, g: 0, b: 0 } // Return black if the HEX string is invalid\n}\n"],"names":["getContrastYIQ","rgb","hexToRgb","hex","result"],"mappings":"AAKO,MAAMA,IAAiB,CAACC,OAMjBA,EAAI,IAAI,MAAMA,EAAI,IAAI,MAAMA,EAAI,IAAI,OAAO,OAE1C,MAAM,SAAS,SAQjBC,IAAW,CAACC,MAAqD;AAE7E,QAAMC,IAAS,4CAA4C,KAAKD,CAAG;AAEnE,SAAOC,IACJ;AAAA,IACA,GAAG,SAASA,EAAO,CAAC,GAAG,EAAE;AAAA,IACzB,GAAG,SAASA,EAAO,CAAC,GAAG,EAAE;AAAA,IACzB,GAAG,SAASA,EAAO,CAAC,GAAG,EAAE;AAAA,EAAA,IAEzB,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,EAAA;AACrB;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMediaQuery as e } from "../../hooks/use-media-query/index.js";
|
|
3
|
+
const t = () => e("(max-width: 768px)"), m = () => e("(min-width: 768px) and (max-width: 1119px)"), s = () => e("(min-width: 768px)"), d = () => e("(min-width: 1120px)");
|
|
4
|
+
export {
|
|
5
|
+
d as useLarge,
|
|
6
|
+
m as useMedium,
|
|
7
|
+
s as useMediumUp,
|
|
8
|
+
t as useSmall
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=use-screen-size.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-screen-size.js","sources":["../../../src/utils/hooks/use-screen-size.ts"],"sourcesContent":["'use client'\n\nimport { useMediaQuery } from '@web/hooks/use-media-query'\n\n// ref: https://github.com/hashicorp/web/blob/main/packages/mds-tokens/src/custom-media.css\nconst useSmall = () => useMediaQuery('(max-width: 768px)')\nconst useMedium = () =>\n\tuseMediaQuery('(min-width: 768px) and (max-width: 1119px)')\nconst useMediumUp = () => useMediaQuery('(min-width: 768px)')\nconst useLarge = () => useMediaQuery('(min-width: 1120px)')\n\nexport { useSmall, useMedium, useMediumUp, useLarge }\n"],"names":["useSmall","useMediaQuery","useMedium","useMediumUp"],"mappings":";;AAMA,MAAMA,IAAA,MAAYC,EACjB,oBAAc,GACTC,IAAA,MAAcD,EAAM,4CAAkC,GACtDE,IAAW,MAAMF,EAAc,oBAAqB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const localize: (key: "required" | "optional", locale: "id" | "fr" | "en" | "de" | "es" | "ja" | "ko" | "pt", capitalization?: ("title" | "none" | "lower" | "sentence" | "upper") | undefined) => string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createLocalize as o } from "@web/utils/i18n";
|
|
2
|
+
const r = o({
|
|
3
|
+
de: {
|
|
4
|
+
optional: "optional",
|
|
5
|
+
// "optional" is the same in German
|
|
6
|
+
required: "erforderlich"
|
|
7
|
+
},
|
|
8
|
+
en: {
|
|
9
|
+
optional: "optional",
|
|
10
|
+
required: "required"
|
|
11
|
+
},
|
|
12
|
+
es: {
|
|
13
|
+
optional: "opcional",
|
|
14
|
+
required: "obligatorio"
|
|
15
|
+
},
|
|
16
|
+
fr: {
|
|
17
|
+
optional: "facultatif",
|
|
18
|
+
required: "obligatoire"
|
|
19
|
+
},
|
|
20
|
+
id: {
|
|
21
|
+
// ! TODO Translate text to Indonesian
|
|
22
|
+
optional: "optional",
|
|
23
|
+
required: "required"
|
|
24
|
+
},
|
|
25
|
+
ja: {
|
|
26
|
+
optional: "任意",
|
|
27
|
+
required: "必須"
|
|
28
|
+
},
|
|
29
|
+
ko: {
|
|
30
|
+
optional: "선택 사항",
|
|
31
|
+
required: "필수"
|
|
32
|
+
},
|
|
33
|
+
pt: {
|
|
34
|
+
optional: "opcional",
|
|
35
|
+
required: "obrigatório"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
r as localize
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/i18n/index.ts"],"sourcesContent":["import { createLocalize } from '@web/utils/i18n'\n\nexport const localize = createLocalize({\n\tde: {\n\t\toptional: 'optional', // \"optional\" is the same in German\n\t\trequired: 'erforderlich',\n\t},\n\ten: {\n\t\toptional: 'optional',\n\t\trequired: 'required',\n\t},\n\tes: {\n\t\toptional: 'opcional',\n\t\trequired: 'obligatorio',\n\t},\n\tfr: {\n\t\toptional: 'facultatif',\n\t\trequired: 'obligatoire',\n\t},\n\tid: {\n\t\t// ! TODO Translate text to Indonesian\n\t\toptional: 'optional',\n\t\trequired: 'required',\n\t},\n\tja: {\n\t\toptional: '任意',\n\t\trequired: '必須',\n\t},\n\tko: {\n\t\toptional: '선택 사항',\n\t\trequired: '필수',\n\t},\n\tpt: {\n\t\toptional: 'opcional',\n\t\trequired: 'obrigatório',\n\t},\n})\n"],"names":["localize","createLocalize"],"mappings":";AAEO,MAAMA,IAAWC,EAAe;AAAA,EACtC,IAAI;AAAA,IACH,UAAU;AAAA;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEX,IAAI;AAAA,IACH,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEX,IAAI;AAAA,IACH,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEX,IAAI;AAAA,IACH,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEX,IAAI;AAAA;AAAA,IAEH,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEX,IAAI;AAAA,IACH,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEX,IAAI;AAAA,IACH,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAAA,EAEX,IAAI;AAAA,IACH,UAAU;AAAA,IACV,UAAU;AAAA,EAAA;AAEZ,CAAC;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useLarge as u, useMedium as m, useMediumUp as o, useSmall as s } from "./hooks/use-screen-size.js";
|
|
2
|
+
import { MDSProvider as i } from "./mds-context/index.js";
|
|
3
|
+
export {
|
|
4
|
+
i as MDSProvider,
|
|
5
|
+
u as useLarge,
|
|
6
|
+
m as useMedium,
|
|
7
|
+
o as useMediumUp,
|
|
8
|
+
s as useSmall
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type NormalizerOpts<TOut extends string> = {
|
|
2
|
+
aliases?: Record<string, TOut>;
|
|
3
|
+
fallback?: TOut;
|
|
4
|
+
transform?: (raw: string) => string;
|
|
5
|
+
};
|
|
6
|
+
export type Normalizer<TOut extends string> = {
|
|
7
|
+
(input: unknown, opts?: NormalizerOpts<TOut>): TOut;
|
|
8
|
+
with(bound: NormalizerOpts<TOut>): Normalizer<TOut>;
|
|
9
|
+
};
|
|
10
|
+
export declare function makeNormalizer<TAllowed extends readonly string[], TOut extends TAllowed[number]>(allowed: TAllowed, defaults: {
|
|
11
|
+
fallback: TOut;
|
|
12
|
+
aliases?: Record<string, TOut>;
|
|
13
|
+
transform?: (raw: string) => string;
|
|
14
|
+
}): Normalizer<TOut>;
|
|
15
|
+
/**
|
|
16
|
+
* Group helper: normalize a whole props object in one call.
|
|
17
|
+
* - `all.transform` applies to every normalizer in the set (safe cross-type).
|
|
18
|
+
* - `each[key]` lets you override per-key opts (aliases/fallback/transform).
|
|
19
|
+
*/
|
|
20
|
+
export declare function makeNormalizerSet<TOuts extends Record<string, string>>(map: {
|
|
21
|
+
[K in keyof TOuts]: Normalizer<TOuts[K]>;
|
|
22
|
+
}): ((input: { [K in keyof TOuts]?: unknown; }, opts?: {
|
|
23
|
+
all?: Pick<NormalizerOpts<string>, "transform"> | undefined;
|
|
24
|
+
each?: { [K_1 in keyof TOuts]?: NormalizerOpts<TOuts[K_1]> | undefined; } | undefined;
|
|
25
|
+
} | undefined) => { [K_2 in keyof TOuts]: TOuts[K_2]; }) & {
|
|
26
|
+
with(all: Pick<NormalizerOpts<string>, "transform">): (input: { [K in keyof TOuts]?: unknown; }, opts?: {
|
|
27
|
+
all?: Pick<NormalizerOpts<string>, "transform"> | undefined;
|
|
28
|
+
each?: { [K_1 in keyof TOuts]?: NormalizerOpts<TOuts[K_1]> | undefined; } | undefined;
|
|
29
|
+
} | undefined) => { [K_2 in keyof TOuts]: TOuts[K_2]; };
|
|
30
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function h(o, s) {
|
|
2
|
+
const a = o, r = s.aliases ?? Object.fromEntries(a.map((t) => [t, t])), c = s.transform ?? ((t) => t.trim().toLowerCase()), n = (t, e) => {
|
|
3
|
+
const i = { ...r, ...e?.aliases ?? {} }, l = e?.fallback ?? s.fallback, k = e?.transform ?? c;
|
|
4
|
+
if (typeof t != "string") return l;
|
|
5
|
+
const f = k(t), u = i[f] ?? f;
|
|
6
|
+
return a.includes(u) ? u : l;
|
|
7
|
+
};
|
|
8
|
+
return n.with = (t) => (e, i) => n(e, { ...t, ...i ?? {} }), n;
|
|
9
|
+
}
|
|
10
|
+
function b(o) {
|
|
11
|
+
const s = (a, r) => {
|
|
12
|
+
const c = {};
|
|
13
|
+
for (const n in o) {
|
|
14
|
+
if (!Object.prototype.hasOwnProperty.call(o, n)) continue;
|
|
15
|
+
const t = n, e = o[t], i = r?.all ? e.with(r.all) : e;
|
|
16
|
+
c[t] = i(a?.[t], r?.each?.[t]);
|
|
17
|
+
}
|
|
18
|
+
return c;
|
|
19
|
+
};
|
|
20
|
+
return s.with = (a) => {
|
|
21
|
+
const r = {};
|
|
22
|
+
for (const c in o) {
|
|
23
|
+
if (!Object.prototype.hasOwnProperty.call(o, c)) continue;
|
|
24
|
+
const n = c;
|
|
25
|
+
r[n] = o[n].with(a);
|
|
26
|
+
}
|
|
27
|
+
return b(r);
|
|
28
|
+
}, s;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
h as makeNormalizer,
|
|
32
|
+
b as makeNormalizerSet
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/utils/make-normalizer/index.tsx"],"sourcesContent":["export type NormalizerOpts<TOut extends string> = {\n\taliases?: Record<string, TOut>\n\tfallback?: TOut\n\ttransform?: (raw: string) => string\n}\n\nexport type Normalizer<TOut extends string> = {\n\t(input: unknown, opts?: NormalizerOpts<TOut>): TOut\n\twith(bound: NormalizerOpts<TOut>): Normalizer<TOut>\n}\n\nexport function makeNormalizer<\n\tTAllowed extends readonly string[],\n\tTOut extends TAllowed[number]\n>(\n\tallowed: TAllowed,\n\tdefaults: {\n\t\tfallback: TOut\n\t\taliases?: Record<string, TOut>\n\t\ttransform?: (raw: string) => string\n\t}\n): Normalizer<TOut> {\n\tconst list = allowed as readonly string[]\n\n\tconst defaultAliases: Record<string, TOut> =\n\t\tdefaults.aliases ??\n\t\t(Object.fromEntries(list.map((v) => [v, v])) as Record<string, TOut>)\n\n\tconst defaultTransform =\n\t\tdefaults.transform ?? ((s: string) => s.trim().toLowerCase())\n\n\tconst core = ((input: unknown, opts?: NormalizerOpts<TOut>): TOut => {\n\t\tconst aliases = { ...defaultAliases, ...(opts?.aliases ?? {}) }\n\t\tconst fallback = opts?.fallback ?? defaults.fallback\n\t\tconst transform = opts?.transform ?? defaultTransform\n\n\t\tif (typeof input !== 'string') return fallback\n\n\t\tconst s = transform(input)\n\t\tconst candidate = (aliases[s] ?? s) as string\n\t\treturn list.includes(candidate) ? (candidate as TOut) : fallback\n\t}) as Normalizer<TOut>\n\n\tcore.with = (bound: NormalizerOpts<TOut>) =>\n\t\t((input: unknown, opts?: NormalizerOpts<TOut>) =>\n\t\t\tcore(input, { ...bound, ...(opts ?? {}) })) as Normalizer<TOut>\n\n\treturn core\n}\n\n/**\n * Group helper: normalize a whole props object in one call.\n * - `all.transform` applies to every normalizer in the set (safe cross-type).\n * - `each[key]` lets you override per-key opts (aliases/fallback/transform).\n */\nexport function makeNormalizerSet<TOuts extends Record<string, string>>(map: {\n\t[K in keyof TOuts]: Normalizer<TOuts[K]>\n}) {\n\ttype In = { [K in keyof TOuts]?: unknown | null }\n\ttype Out = { [K in keyof TOuts]: TOuts[K] }\n\ttype All = Pick<NormalizerOpts<string>, 'transform'> // safe cross-prop\n\ttype Each = { [K in keyof TOuts]?: NormalizerOpts<TOuts[K]> }\n\ttype Call = (input: In, opts?: { all?: All; each?: Each }) => Out\n\n\tconst call = ((input: In, opts?: { all?: All; each?: Each }) => {\n\t\tconst out = {} as Out\n\t\tfor (const k in map) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(map, k)) continue\n\t\t\tconst key = k as keyof TOuts\n\t\t\tconst n = map[key]\n\t\t\tconst base = opts?.all ? n.with(opts.all as any) : n\n\t\t\tout[key] = base(input?.[key], opts?.each?.[key]) as TOuts[typeof key]\n\t\t}\n\t\treturn out\n\t}) as Call & { with(all: All): Call }\n\n\tcall.with = (all: All) => {\n\t\tconst bound = {} as { [K in keyof TOuts]: Normalizer<TOuts[K]> }\n\t\tfor (const k in map) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(map, k)) continue\n\t\t\tconst key = k as keyof TOuts\n\t\t\tbound[key] = map[key].with(all as any)\n\t\t}\n\t\treturn makeNormalizerSet(bound)\n\t}\n\n\treturn call\n}\n"],"names":["makeNormalizer","allowed","defaults","list","defaultAliases","v","defaultTransform","s","core","input","opts","aliases","fallback","transform","candidate","bound","makeNormalizerSet","map","call","out","k","key","n","base","all"],"mappings":"AAWO,SAASA,EAIfC,GACAC,GAKmB;AACnB,QAAMC,IAAOF,GAEPG,IACLF,EAAS,WACR,OAAO,YAAYC,EAAK,IAAI,CAACE,MAAM,CAACA,GAAGA,CAAC,CAAC,CAAC,GAEtCC,IACLJ,EAAS,cAAc,CAACK,MAAcA,EAAE,OAAO,gBAE1CC,IAAQ,CAACC,GAAgBC,MAAsC;AACpE,UAAMC,IAAU,EAAE,GAAGP,GAAgB,GAAIM,GAAM,WAAW,GAAC,GACrDE,IAAWF,GAAM,YAAYR,EAAS,UACtCW,IAAYH,GAAM,aAAaJ;AAErC,QAAI,OAAOG,KAAU,SAAU,QAAOG;AAEtC,UAAML,IAAIM,EAAUJ,CAAK,GACnBK,IAAaH,EAAQJ,CAAC,KAAKA;AACjC,WAAOJ,EAAK,SAASW,CAAS,IAAKA,IAAqBF;AAAA,EACzD;AAEA,SAAAJ,EAAK,OAAO,CAACO,MACX,CAACN,GAAgBC,MACjBF,EAAKC,GAAO,EAAE,GAAGM,GAAO,GAAIL,KAAQ,CAAA,GAAK,GAEpCF;AACR;AAOO,SAASQ,EAAwDC,GAErE;AAOF,QAAMC,IAAQ,CAACT,GAAWC,MAAsC;AAC/D,UAAMS,IAAM,CAAA;AACZ,eAAWC,KAAKH,GAAK;AACpB,UAAI,CAAC,OAAO,UAAU,eAAe,KAAKA,GAAKG,CAAC,EAAG;AACnD,YAAMC,IAAMD,GACNE,IAAIL,EAAII,CAAG,GACXE,IAAOb,GAAM,MAAMY,EAAE,KAAKZ,EAAK,GAAU,IAAIY;AACnD,MAAAH,EAAIE,CAAG,IAAIE,EAAKd,IAAQY,CAAG,GAAGX,GAAM,OAAOW,CAAG,CAAC;AAAA,IAChD;AACA,WAAOF;AAAA,EACR;AAEA,SAAAD,EAAK,OAAO,CAACM,MAAa;AACzB,UAAMT,IAAQ,CAAA;AACd,eAAWK,KAAKH,GAAK;AACpB,UAAI,CAAC,OAAO,UAAU,eAAe,KAAKA,GAAKG,CAAC,EAAG;AACnD,YAAMC,IAAMD;AACZ,MAAAL,EAAMM,CAAG,IAAIJ,EAAII,CAAG,EAAE,KAAKG,CAAU;AAAA,IACtC;AACA,WAAOR,EAAkBD,CAAK;AAAA,EAC/B,GAEOG;AACR;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CSSProperties, ImgHTMLAttributes, ComponentType } from 'react';
|
|
2
|
+
type FillLayout = {
|
|
3
|
+
fill: true;
|
|
4
|
+
/** Strongly recommended when using fill */
|
|
5
|
+
sizes?: string;
|
|
6
|
+
};
|
|
7
|
+
type FixedLayout = {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
fill?: false;
|
|
11
|
+
};
|
|
12
|
+
/** Next/Image extras we want to allow on adapters (all optional here) */
|
|
13
|
+
type NextImageExtras = {
|
|
14
|
+
priority?: boolean;
|
|
15
|
+
placeholder?: 'blur' | 'empty';
|
|
16
|
+
blurDataURL?: string;
|
|
17
|
+
quality?: number;
|
|
18
|
+
unoptimized?: boolean;
|
|
19
|
+
onLoadingComplete?: (img: HTMLImageElement) => void;
|
|
20
|
+
};
|
|
21
|
+
export type MDSImageProps = ({
|
|
22
|
+
alt: string;
|
|
23
|
+
/** DS-neutral; Next adapter may also accept StaticImageData at runtime */
|
|
24
|
+
src: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: CSSProperties;
|
|
27
|
+
loading?: 'eager' | 'lazy';
|
|
28
|
+
decoding?: 'sync' | 'async' | 'auto';
|
|
29
|
+
fetchPriority?: 'high' | 'low' | 'auto';
|
|
30
|
+
objectFit?: string;
|
|
31
|
+
objectPosition?: string;
|
|
32
|
+
} & (FillLayout | FixedLayout)) & Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'width' | 'height' | 'loading' | 'decoding'> & NextImageExtras;
|
|
33
|
+
type ImageComponent = ComponentType<MDSImageProps>;
|
|
34
|
+
/**
|
|
35
|
+
* Start from all standard <a> props, then refine:
|
|
36
|
+
* - force a typed href
|
|
37
|
+
* - keep children required
|
|
38
|
+
* - keep Next-specific props optional so the default <a> can ignore them
|
|
39
|
+
*/
|
|
40
|
+
export type MDSLinkProps = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
|
|
41
|
+
href: string | URL;
|
|
42
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
43
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
44
|
+
} & {
|
|
45
|
+
prefetch?: boolean;
|
|
46
|
+
replace?: boolean;
|
|
47
|
+
scroll?: boolean;
|
|
48
|
+
shallow?: boolean;
|
|
49
|
+
locale?: string | false;
|
|
50
|
+
};
|
|
51
|
+
type LinkComponent = React.ForwardRefExoticComponent<MDSLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
52
|
+
export declare function MDSProvider({ children, imageComponent, linkComponent, }: {
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
imageComponent?: ImageComponent;
|
|
55
|
+
linkComponent?: LinkComponent;
|
|
56
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export declare function useMDSImage(): ImageComponent;
|
|
58
|
+
export declare function useMDSLink(): LinkComponent;
|
|
59
|
+
export {};
|