@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,192 @@
|
|
|
1
|
+
@use 'styles/mixins/focus-ring' as *;
|
|
2
|
+
|
|
3
|
+
$border-radius: 6px;
|
|
4
|
+
$border-width: 1px;
|
|
5
|
+
$inner-border-radius: $border-radius - $border-width;
|
|
6
|
+
$border-color: var(--mds-color-border-primary);
|
|
7
|
+
|
|
8
|
+
// TABLE
|
|
9
|
+
|
|
10
|
+
.table {
|
|
11
|
+
width: 100%;
|
|
12
|
+
border: $border-width solid $border-color;
|
|
13
|
+
border-radius: $border-radius;
|
|
14
|
+
border-spacing: 0;
|
|
15
|
+
|
|
16
|
+
&.layout-fixed {
|
|
17
|
+
table-layout: fixed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.striped {
|
|
21
|
+
& .tbody {
|
|
22
|
+
& .tr:nth-child(even) {
|
|
23
|
+
background-color: var(--mds-color-surface-faint);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.density-short {
|
|
30
|
+
--mds-table-cell-padding: 6px 16px 5px 16px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.density-medium {
|
|
34
|
+
--mds-table-cell-padding: 14px 16px 13px 16px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.density-tall {
|
|
38
|
+
--mds-table-cell-padding: 22px 16px 21px 16px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.valign-top {
|
|
42
|
+
--mds-table-valign: top;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.valign-middle {
|
|
46
|
+
--mds-table-valign: middle;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.valign-baseline {
|
|
50
|
+
--mds-table-valign: baseline;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.th,
|
|
54
|
+
.td {
|
|
55
|
+
padding: var(--mds-table-cell-padding);
|
|
56
|
+
|
|
57
|
+
&.align-center {
|
|
58
|
+
text-align: center;
|
|
59
|
+
|
|
60
|
+
& .content {
|
|
61
|
+
justify-content: center;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&.align-right {
|
|
66
|
+
text-align: right;
|
|
67
|
+
|
|
68
|
+
.content {
|
|
69
|
+
justify-content: flex-end;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.thead {
|
|
75
|
+
& .tr {
|
|
76
|
+
color: var(--mds-color-foreground-strong);
|
|
77
|
+
background-color: var(--mds-color-surface-strong);
|
|
78
|
+
|
|
79
|
+
// border radius: target first and last th elements in the row
|
|
80
|
+
|
|
81
|
+
&:first-of-type {
|
|
82
|
+
& .th:first-child {
|
|
83
|
+
border-top-left-radius: $inner-border-radius;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
& .th:last-child {
|
|
87
|
+
border-top-right-radius: $inner-border-radius;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
& .th {
|
|
93
|
+
position: relative;
|
|
94
|
+
text-align: left;
|
|
95
|
+
border-top: none;
|
|
96
|
+
border-right: none;
|
|
97
|
+
border-bottom: $border-width solid $border-color;
|
|
98
|
+
border-left: none;
|
|
99
|
+
|
|
100
|
+
// border between two cells (we emulate a cell border slightly detached from the top/bottom borders)
|
|
101
|
+
|
|
102
|
+
& + .th::before {
|
|
103
|
+
position: absolute;
|
|
104
|
+
top: 6px;
|
|
105
|
+
bottom: 6px;
|
|
106
|
+
left: -1px; // we need to offset the border by 1px to render a right border of the previous cell
|
|
107
|
+
width: 1px;
|
|
108
|
+
background-color: $border-color;
|
|
109
|
+
content: '';
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.tbody {
|
|
116
|
+
& .tr {
|
|
117
|
+
color: var(--mds-color-foreground-primary);
|
|
118
|
+
background-color: var(--mds-color-surface-primary);
|
|
119
|
+
|
|
120
|
+
// border radius: target first th (scope of row) and td, and last td elements in the last row
|
|
121
|
+
|
|
122
|
+
&:last-of-type {
|
|
123
|
+
& .th,
|
|
124
|
+
& .td {
|
|
125
|
+
border-bottom: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
& .th:first-child,
|
|
129
|
+
& .td:first-child {
|
|
130
|
+
border-bottom-left-radius: $inner-border-radius;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// a <th> will never be last child, only first child
|
|
134
|
+
& .td:last-child {
|
|
135
|
+
border-bottom-right-radius: $inner-border-radius;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
& .th,
|
|
141
|
+
& .td {
|
|
142
|
+
vertical-align: var(--mds-table-valign);
|
|
143
|
+
text-align: left;
|
|
144
|
+
border-top: none;
|
|
145
|
+
border-right: none;
|
|
146
|
+
border-bottom: $border-width solid $border-color;
|
|
147
|
+
border-left: none;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.content {
|
|
152
|
+
display: flex;
|
|
153
|
+
gap: 8px;
|
|
154
|
+
align-items: center;
|
|
155
|
+
justify-content: flex-start;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.th-button {
|
|
159
|
+
display: flex;
|
|
160
|
+
flex: none;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: center;
|
|
163
|
+
width: 24px;
|
|
164
|
+
height: 24px;
|
|
165
|
+
margin: -2px 0; // this is necessary to compensate for the height of the button being 24px while the line height of the text is 20px (the overall height of the cell shoud be 48px and we want to keep the cell's padding as is for consistency with Figma)
|
|
166
|
+
padding: 0;
|
|
167
|
+
color: var(--mds-color-foreground-faint);
|
|
168
|
+
background-color: transparent;
|
|
169
|
+
border: 1px solid transparent;
|
|
170
|
+
border-radius: 3px;
|
|
171
|
+
|
|
172
|
+
&:hover {
|
|
173
|
+
color: var(--mds-color-foreground-primary);
|
|
174
|
+
background-color: var(--mds-color-surface-interactive);
|
|
175
|
+
border-color: var(--mds-color-border-strong);
|
|
176
|
+
box-shadow: var(--mds-elevation-low-box-shadow);
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@include hds-focus-ring-with-pseudo-element($radius: inherit);
|
|
181
|
+
|
|
182
|
+
&:active {
|
|
183
|
+
color: var(--mds-color-foreground-primary);
|
|
184
|
+
background-color: var(--mds-color-surface-interactive-active);
|
|
185
|
+
border-color: var(--mds-color-border-strong);
|
|
186
|
+
box-shadow: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
& .aria-label-hidden-segment {
|
|
190
|
+
display: none;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const t = "table__tdU5g", e = "striped__MBMc-", n = "tbody__W5bOI", _ = "tr__xeZno", d = "th__GQbKk", i = "td__WktB5", a = "content__Js-E8", l = "thead__3-vDU", o = {
|
|
2
|
+
table: t,
|
|
3
|
+
"layout-fixed": "layout-fixed__9PpwJ",
|
|
4
|
+
striped: e,
|
|
5
|
+
tbody: n,
|
|
6
|
+
tr: _,
|
|
7
|
+
"density-short": "density-short__7tyZx",
|
|
8
|
+
"density-medium": "density-medium__nmuYV",
|
|
9
|
+
"density-tall": "density-tall__2N9i0",
|
|
10
|
+
"valign-top": "valign-top__SRqQY",
|
|
11
|
+
"valign-middle": "valign-middle__kSfMx",
|
|
12
|
+
"valign-baseline": "valign-baseline__UFJwd",
|
|
13
|
+
th: d,
|
|
14
|
+
td: i,
|
|
15
|
+
"align-center": "align-center__vOTTL",
|
|
16
|
+
content: a,
|
|
17
|
+
"align-right": "align-right__3vUHD",
|
|
18
|
+
thead: l,
|
|
19
|
+
"th-button": "th-button__drg-o",
|
|
20
|
+
"aria-label-hidden-segment": "aria-label-hidden-segment__oQhN8"
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
a as content,
|
|
24
|
+
o as default,
|
|
25
|
+
e as striped,
|
|
26
|
+
t as table,
|
|
27
|
+
n as tbody,
|
|
28
|
+
i as td,
|
|
29
|
+
d as th,
|
|
30
|
+
l as thead,
|
|
31
|
+
_ as tr
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=table.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HorizontalAlignment } from './utils';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
export interface TDProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Determines the horizontal content alignment (sometimes referred to as text alignment) for the cell (make sure it is also set for the column header).
|
|
6
|
+
*/
|
|
7
|
+
align?: HorizontalAlignment;
|
|
8
|
+
/**
|
|
9
|
+
* Elements passed as children are yielded as inner content of a <td> HTML element.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const TD: {
|
|
14
|
+
({ align, children, className, ...rest }: TDProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
export { TD };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import e from "classnames";
|
|
3
|
+
import { DEFAULT_ALIGNMENT as p } from "./utils.js";
|
|
4
|
+
import r from "./table.module.scss.js";
|
|
5
|
+
const d = ({
|
|
6
|
+
align: t = p,
|
|
7
|
+
children: m,
|
|
8
|
+
className: a,
|
|
9
|
+
...s
|
|
10
|
+
}) => /* @__PURE__ */ o(
|
|
11
|
+
"td",
|
|
12
|
+
{
|
|
13
|
+
className: e(
|
|
14
|
+
r.td,
|
|
15
|
+
r[`align-${t}`],
|
|
16
|
+
"mds-typography-legacy-body-200",
|
|
17
|
+
"mds-typography-font-weight-regular",
|
|
18
|
+
a
|
|
19
|
+
),
|
|
20
|
+
...s,
|
|
21
|
+
children: /* @__PURE__ */ o("div", { className: r.content, children: m })
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
d.displayName = "B.Td";
|
|
25
|
+
export {
|
|
26
|
+
d as TD
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=td.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"td.js","sources":["../../../src/components/table/td.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { DEFAULT_ALIGNMENT, type HorizontalAlignment } from './utils'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport s from './table.module.scss'\n\nexport interface TDProps extends HTMLAttributes<HTMLTableCellElement> {\n\t/**\n\t * Determines the horizontal content alignment (sometimes referred to as text alignment) for the cell (make sure it is also set for the column header).\n\t */\n\talign?: HorizontalAlignment\n\t/**\n\t * Elements passed as children are yielded as inner content of a <td> HTML element.\n\t */\n\tchildren: ReactNode\n}\n\nconst TD = ({\n\talign = DEFAULT_ALIGNMENT,\n\tchildren,\n\tclassName,\n\t...rest\n}: TDProps) => {\n\treturn (\n\t\t<td\n\t\t\tclassName={classNames(\n\t\t\t\ts.td,\n\t\t\t\ts[`align-${align}`],\n\t\t\t\t'mds-typography-legacy-body-200',\n\t\t\t\t'mds-typography-font-weight-regular',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t<div className={s.content}>{children}</div>\n\t\t</td>\n\t)\n}\n\nTD.displayName = 'B.Td'\n\nexport { TD }\n"],"names":["TD","align","DEFAULT_ALIGNMENT","children","className","rest","jsx","classNames","s"],"mappings":";;;;AAgBA,MAAMA,IAAK,CAAC;AAAA,EACX,OAAAC,IAAQC;AAAA,EACR,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAEE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,WAAWC;AAAA,MACVC,EAAE;AAAA,MACFA,EAAE,SAASP,CAAK,EAAE;AAAA,MAClB;AAAA,MACA;AAAA,MACAG;AAAA,IAAA;AAAA,IAEA,GAAGC;AAAA,IAEJ,UAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWE,EAAE,SAAU,UAAAL,EAAA,CAAS;AAAA,EAAA;AAAA;AAKxCH,EAAG,cAAc;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { useId as m } from "react";
|
|
3
|
+
import { Tooltip as a } from "../hds/wrappers/tooltip.js";
|
|
4
|
+
import { FlightIcon as l } from "../flight-icon/index.js";
|
|
5
|
+
import r from "./table.module.scss.js";
|
|
6
|
+
const b = ({ tooltip: e, labelId: i }) => {
|
|
7
|
+
const t = m();
|
|
8
|
+
return /* @__PURE__ */ o(a, { text: e, children: /* @__PURE__ */ n(
|
|
9
|
+
"button",
|
|
10
|
+
{
|
|
11
|
+
type: "button",
|
|
12
|
+
className: r["th-button"],
|
|
13
|
+
"aria-labelledby": `${t} ${i}`,
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ o("span", { id: t, className: r["aria-label-hidden-segment"], children: "More information for" }),
|
|
16
|
+
/* @__PURE__ */ o(l, { name: "info" })
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
) });
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
b as ThButtonTooltip
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=th-button-tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"th-button-tooltip.js","sources":["../../../src/components/table/th-button-tooltip.tsx"],"sourcesContent":["import { useId } from 'react'\nimport { Tooltip } from '../hds/wrappers/tooltip'\nimport { FlightIcon } from '../flight-icon'\nimport s from './table.module.scss'\n\ninterface TooltipProps {\n\ttooltip: string\n\tlabelId: string\n}\n\nexport const ThButtonTooltip = ({ tooltip, labelId }: TooltipProps) => {\n\tconst prefixLabelId = useId()\n\n\treturn (\n\t\t<Tooltip text={tooltip}>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName={s['th-button']}\n\t\t\t\taria-labelledby={`${prefixLabelId} ${labelId}`}\n\t\t\t>\n\t\t\t\t<span id={prefixLabelId} className={s['aria-label-hidden-segment']}>\n\t\t\t\t\tMore information for\n\t\t\t\t</span>\n\t\t\t\t<FlightIcon name=\"info\" />\n\t\t\t</button>\n\t\t</Tooltip>\n\t)\n}\n"],"names":["ThButtonTooltip","tooltip","labelId","prefixLabelId","useId","jsx","Tooltip","jsxs","s","FlightIcon"],"mappings":";;;;;AAUO,MAAMA,IAAkB,CAAC,EAAE,SAAAC,GAAS,SAAAC,QAA4B;AACtE,QAAMC,IAAgBC,EAAA;AAEtB,SACC,gBAAAC,EAACC,GAAA,EAAQ,MAAML,GACd,UAAA,gBAAAM;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,MAAK;AAAA,MACL,WAAWC,EAAE,WAAW;AAAA,MACxB,mBAAiB,GAAGL,CAAa,IAAID,CAAO;AAAA,MAE5C,UAAA;AAAA,QAAA,gBAAAG,EAAC,UAAK,IAAIF,GAAe,WAAWK,EAAE,2BAA2B,GAAG,UAAA,wBAEpE;AAAA,QACA,gBAAAH,EAACI,GAAA,EAAW,MAAK,OAAA,CAAO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAE1B;AAEF;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { HorizontalAlignment, Scope } from './utils';
|
|
3
|
+
export interface THProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Determines the horizontal content alignment (sometimes referred to as text alignment) for the column header.
|
|
6
|
+
*/
|
|
7
|
+
align?: HorizontalAlignment;
|
|
8
|
+
/**
|
|
9
|
+
* If used as the first item in a table body’s row, scope should be set to row for accessibility purposes.
|
|
10
|
+
*/
|
|
11
|
+
scope?: Scope;
|
|
12
|
+
/**
|
|
13
|
+
* Any valid CSS
|
|
14
|
+
* If set, determines the column’s width.
|
|
15
|
+
*/
|
|
16
|
+
width?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Text string which will appear in the tooltip. May contain basic HTML tags for formatting text such as strong and em tags. Not intended for multi-paragraph text or other more complex content. May not contain interactive content such as links or buttons. The placement and offset are automatically set and can’t be overwritten.
|
|
19
|
+
*/
|
|
20
|
+
tooltip?: string;
|
|
21
|
+
/**
|
|
22
|
+
* If set to `true`, it visually hides the column’s text content (it will still be available to screen readers for accessibility).
|
|
23
|
+
*/
|
|
24
|
+
isVisuallyHidden?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Elements passed as children are yielded as inner content of a `<th>` HTML element.
|
|
27
|
+
*/
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
declare const TH: {
|
|
31
|
+
({ align, width, scope, tooltip, isVisuallyHidden, children, className, ...rest }: THProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
displayName: string;
|
|
33
|
+
};
|
|
34
|
+
export { TH };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as s, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import f from "classnames";
|
|
3
|
+
import { DEFAULT_SCOPE as y, DEFAULT_ALIGNMENT as N } from "./utils.js";
|
|
4
|
+
import { useId as T } from "react";
|
|
5
|
+
import { ThButtonTooltip as g } from "./th-button-tooltip.js";
|
|
6
|
+
import t from "./table.module.scss.js";
|
|
7
|
+
const h = ({
|
|
8
|
+
align: l = N,
|
|
9
|
+
width: e,
|
|
10
|
+
scope: n = y,
|
|
11
|
+
tooltip: a,
|
|
12
|
+
isVisuallyHidden: i,
|
|
13
|
+
children: m,
|
|
14
|
+
className: p,
|
|
15
|
+
...c
|
|
16
|
+
}) => {
|
|
17
|
+
const r = T();
|
|
18
|
+
let o;
|
|
19
|
+
return i ? o = /* @__PURE__ */ s("span", { className: "sr-only", children: m }) : a ? o = /* @__PURE__ */ d("div", { className: t.content, children: [
|
|
20
|
+
/* @__PURE__ */ s("span", { id: r, children: m }),
|
|
21
|
+
/* @__PURE__ */ s(g, { tooltip: a, labelId: r })
|
|
22
|
+
] }) : o = /* @__PURE__ */ s("div", { className: t.content, children: m }), /* @__PURE__ */ s(
|
|
23
|
+
"th",
|
|
24
|
+
{
|
|
25
|
+
className: f(
|
|
26
|
+
t.th,
|
|
27
|
+
t[`align-${l}`],
|
|
28
|
+
"mds-typography-legacy-body-200",
|
|
29
|
+
"mds-typography-font-weight-semibold",
|
|
30
|
+
p
|
|
31
|
+
),
|
|
32
|
+
style: e ? { width: e, minWidth: e } : {},
|
|
33
|
+
...c,
|
|
34
|
+
scope: n,
|
|
35
|
+
children: o
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
h.displayName = "H.TH";
|
|
40
|
+
export {
|
|
41
|
+
h as TH
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=th.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"th.js","sources":["../../../src/components/table/th.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { DEFAULT_ALIGNMENT, DEFAULT_SCOPE } from './utils'\nimport { useId, type HTMLAttributes, type ReactNode } from 'react'\nimport { ThButtonTooltip } from './th-button-tooltip'\nimport type { HorizontalAlignment, Scope } from './utils'\nimport s from './table.module.scss'\n\nexport interface THProps extends HTMLAttributes<HTMLTableCellElement> {\n\t/**\n\t * Determines the horizontal content alignment (sometimes referred to as text alignment) for the column header.\n\t */\n\talign?: HorizontalAlignment\n\t/**\n\t * If used as the first item in a table body’s row, scope should be set to row for accessibility purposes.\n\t */\n\tscope?: Scope\n\t/**\n\t * Any valid CSS\n\t * If set, determines the column’s width.\n\t */\n\twidth?: string\n\t/**\n\t * Text string which will appear in the tooltip. May contain basic HTML tags for formatting text such as strong and em tags. Not intended for multi-paragraph text or other more complex content. May not contain interactive content such as links or buttons. The placement and offset are automatically set and can’t be overwritten.\n\t */\n\ttooltip?: string\n\t/**\n\t * If set to `true`, it visually hides the column’s text content (it will still be available to screen readers for accessibility).\n\t */\n\tisVisuallyHidden?: boolean\n\t/**\n\t * Elements passed as children are yielded as inner content of a `<th>` HTML element.\n\t */\n\tchildren: ReactNode\n}\n\nconst TH = ({\n\talign = DEFAULT_ALIGNMENT,\n\twidth,\n\tscope = DEFAULT_SCOPE,\n\ttooltip,\n\tisVisuallyHidden,\n\tchildren,\n\tclassName,\n\t...rest\n}: THProps) => {\n\tconst labelId = useId()\n\tlet content: React.ReactNode\n\n\tif (isVisuallyHidden) {\n\t\tcontent = <span className=\"sr-only\">{children}</span>\n\t} else if (tooltip) {\n\t\tcontent = (\n\t\t\t<div className={s.content}>\n\t\t\t\t<span id={labelId}>{children}</span>\n\t\t\t\t<ThButtonTooltip tooltip={tooltip} labelId={labelId} />\n\t\t\t</div>\n\t\t)\n\t} else {\n\t\tcontent = <div className={s.content}>{children}</div>\n\t}\n\n\treturn (\n\t\t<th\n\t\t\tclassName={classNames(\n\t\t\t\ts.th,\n\t\t\t\ts[`align-${align}`],\n\t\t\t\t'mds-typography-legacy-body-200',\n\t\t\t\t'mds-typography-font-weight-semibold',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={width ? { width, minWidth: width } : {}}\n\t\t\t{...rest}\n\t\t\tscope={scope}\n\t\t>\n\t\t\t{content}\n\t\t</th>\n\t)\n}\n\nTH.displayName = 'H.TH'\n\nexport { TH }\n"],"names":["TH","align","DEFAULT_ALIGNMENT","width","scope","DEFAULT_SCOPE","tooltip","isVisuallyHidden","children","className","rest","labelId","useId","content","jsx","jsxs","s","ThButtonTooltip","classNames"],"mappings":";;;;;;AAmCA,MAAMA,IAAK,CAAC;AAAA,EACX,OAAAC,IAAQC;AAAA,EACR,OAAAC;AAAA,EACA,OAAAC,IAAQC;AAAA,EACR,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAAe;AACd,QAAMC,IAAUC,EAAA;AAChB,MAAIC;AAEJ,SAAIN,IACHM,IAAU,gBAAAC,EAAC,QAAA,EAAK,WAAU,WAAW,UAAAN,GAAS,IACpCF,IACVO,IACC,gBAAAE,EAAC,OAAA,EAAI,WAAWC,EAAE,SACjB,UAAA;AAAA,IAAA,gBAAAF,EAAC,QAAA,EAAK,IAAIH,GAAU,UAAAH,EAAA,CAAS;AAAA,IAC7B,gBAAAM,EAACG,GAAA,EAAgB,SAAAX,GAAkB,SAAAK,EAAA,CAAkB;AAAA,EAAA,GACtD,IAGDE,IAAU,gBAAAC,EAAC,OAAA,EAAI,WAAWE,EAAE,SAAU,UAAAR,GAAS,GAI/C,gBAAAM;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAWI;AAAA,QACVF,EAAE;AAAA,QACFA,EAAE,SAASf,CAAK,EAAE;AAAA,QAClB;AAAA,QACA;AAAA,QACAQ;AAAA,MAAA;AAAA,MAED,OAAON,IAAQ,EAAE,OAAAA,GAAO,UAAUA,EAAA,IAAU,CAAA;AAAA,MAC3C,GAAGO;AAAA,MACJ,OAAAN;AAAA,MAEC,UAAAS;AAAA,IAAA;AAAA,EAAA;AAGJ;AAEAb,EAAG,cAAc;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface TRProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Elements passed as children are yielded as inner content of a `<tr>` HTML element.
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const TR: {
|
|
9
|
+
({ children, className, ...rest }: TRProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export { TR };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import t from "classnames";
|
|
3
|
+
import a from "./table.module.scss.js";
|
|
4
|
+
const e = ({ children: r, className: m, ...s }) => /* @__PURE__ */ o("tr", { className: t(a.tr, m), ...s, children: r });
|
|
5
|
+
e.displayName = "T.TR";
|
|
6
|
+
export {
|
|
7
|
+
e as TR
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=tr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tr.js","sources":["../../../src/components/table/tr.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport s from './table.module.scss'\n\nexport interface TRProps extends HTMLAttributes<HTMLTableRowElement> {\n\t/**\n\t * Elements passed as children are yielded as inner content of a `<tr>` HTML element.\n\t */\n\tchildren: ReactNode\n}\n\nconst TR = ({ children, className, ...rest }: TRProps) => {\n\treturn (\n\t\t<tr className={classNames(s.tr, className)} {...rest}>\n\t\t\t{children}\n\t\t</tr>\n\t)\n}\n\nTR.displayName = 'T.TR'\n\nexport { TR }\n"],"names":["TR","children","className","rest","jsx","classNames","s"],"mappings":";;;AAWA,MAAMA,IAAK,CAAC,EAAE,UAAAC,GAAU,WAAAC,GAAW,GAAGC,QAEpC,gBAAAC,EAAC,MAAA,EAAG,WAAWC,EAAWC,EAAE,IAAIJ,CAAS,GAAI,GAAGC,GAC9C,UAAAF,EAAA,CACF;AAIFD,EAAG,cAAc;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const DEFAULT_DENSITY = "medium";
|
|
2
|
+
export declare const DENSITIES: readonly ["default", "medium", "short", "tall"];
|
|
3
|
+
export type Density = (typeof DENSITIES)[number];
|
|
4
|
+
export declare const getDensity: (densityStr: string) => Density;
|
|
5
|
+
export declare const DEFAULT_VERTICAL_ALIGNMENT = "top";
|
|
6
|
+
export declare const VERTICAL_ALIGNMENTS: readonly ["baseline", "middle", "top"];
|
|
7
|
+
export type VerticalAlignment = (typeof VERTICAL_ALIGNMENTS)[number];
|
|
8
|
+
export declare const getVerticalAlignment: (valignStr: string) => VerticalAlignment;
|
|
9
|
+
export declare const DEFAULT_ALIGNMENT = "left";
|
|
10
|
+
export declare const ALIGNMENTS: readonly ["left", "center", "right"];
|
|
11
|
+
export type HorizontalAlignment = (typeof ALIGNMENTS)[number];
|
|
12
|
+
export declare const getHorizontalAlignment: (alignStr: string) => HorizontalAlignment;
|
|
13
|
+
export declare const DEFAULT_SCOPE = "col";
|
|
14
|
+
export declare const SCOPES: readonly ["col", "row"];
|
|
15
|
+
export type Scope = (typeof SCOPES)[number];
|
|
16
|
+
export declare const getScope: (scopeStr: string) => Scope;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const e = "medium", o = ["default", "medium", "short", "tall"], A = (n) => {
|
|
2
|
+
const t = n;
|
|
3
|
+
return o.includes(t) ? t : e;
|
|
4
|
+
}, c = "top", s = ["baseline", "middle", "top"], T = (n) => {
|
|
5
|
+
const t = n;
|
|
6
|
+
return s.includes(t) ? t : c;
|
|
7
|
+
}, l = "left", i = ["left", "center", "right"], u = (n) => {
|
|
8
|
+
const t = n;
|
|
9
|
+
return i.includes(t) ? t : l;
|
|
10
|
+
}, r = "col", E = ["col", "row"], d = (n) => {
|
|
11
|
+
const t = n;
|
|
12
|
+
return E.includes(t) ? t : r;
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
i as ALIGNMENTS,
|
|
16
|
+
l as DEFAULT_ALIGNMENT,
|
|
17
|
+
e as DEFAULT_DENSITY,
|
|
18
|
+
r as DEFAULT_SCOPE,
|
|
19
|
+
c as DEFAULT_VERTICAL_ALIGNMENT,
|
|
20
|
+
o as DENSITIES,
|
|
21
|
+
E as SCOPES,
|
|
22
|
+
s as VERTICAL_ALIGNMENTS,
|
|
23
|
+
A as getDensity,
|
|
24
|
+
u as getHorizontalAlignment,
|
|
25
|
+
d as getScope,
|
|
26
|
+
T as getVerticalAlignment
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/components/table/utils.ts"],"sourcesContent":["export const DEFAULT_DENSITY = 'medium'\nexport const DENSITIES = ['default', 'medium', 'short', 'tall'] as const\nexport type Density = (typeof DENSITIES)[number]\nexport const getDensity = (densityStr: string): Density => {\n\tconst density = densityStr as Density\n\treturn DENSITIES.includes(density) ? density : DEFAULT_DENSITY\n}\n\nexport const DEFAULT_VERTICAL_ALIGNMENT = 'top'\nexport const VERTICAL_ALIGNMENTS = ['baseline', 'middle', 'top'] as const\nexport type VerticalAlignment = (typeof VERTICAL_ALIGNMENTS)[number]\nexport const getVerticalAlignment = (valignStr: string): VerticalAlignment => {\n\tconst valign = valignStr as VerticalAlignment\n\treturn VERTICAL_ALIGNMENTS.includes(valign)\n\t\t? valign\n\t\t: DEFAULT_VERTICAL_ALIGNMENT\n}\n\nexport const DEFAULT_ALIGNMENT = 'left'\nexport const ALIGNMENTS = ['left', 'center', 'right'] as const\nexport type HorizontalAlignment = (typeof ALIGNMENTS)[number]\nexport const getHorizontalAlignment = (\n\talignStr: string\n): HorizontalAlignment => {\n\tconst align = alignStr as HorizontalAlignment\n\treturn ALIGNMENTS.includes(align) ? align : DEFAULT_ALIGNMENT\n}\n\nexport const DEFAULT_SCOPE = 'col'\nexport const SCOPES = ['col', 'row'] as const\nexport type Scope = (typeof SCOPES)[number]\nexport const getScope = (scopeStr: string): Scope => {\n\tconst scope = scopeStr as Scope\n\treturn SCOPES.includes(scope) ? scope : DEFAULT_SCOPE\n}\n"],"names":["DEFAULT_DENSITY","DENSITIES","getDensity","densityStr","density","DEFAULT_VERTICAL_ALIGNMENT","VERTICAL_ALIGNMENTS","getVerticalAlignment","valignStr","valign","DEFAULT_ALIGNMENT","ALIGNMENTS","getHorizontalAlignment","alignStr","align","DEFAULT_SCOPE","SCOPES","getScope","scopeStr","scope"],"mappings":"AAAO,MAAMA,IAAkB,UAClBC,IAAY,CAAC,WAAW,UAAU,SAAS,MAAM,GAEjDC,IAAa,CAACC,MAAgC;AAC1D,QAAMC,IAAUD;AAChB,SAAOF,EAAU,SAASG,CAAO,IAAIA,IAAUJ;AAChD,GAEaK,IAA6B,OAC7BC,IAAsB,CAAC,YAAY,UAAU,KAAK,GAElDC,IAAuB,CAACC,MAAyC;AAC7E,QAAMC,IAASD;AACf,SAAOF,EAAoB,SAASG,CAAM,IACvCA,IACAJ;AACJ,GAEaK,IAAoB,QACpBC,IAAa,CAAC,QAAQ,UAAU,OAAO,GAEvCC,IAAyB,CACrCC,MACyB;AACzB,QAAMC,IAAQD;AACd,SAAOF,EAAW,SAASG,CAAK,IAAIA,IAAQJ;AAC7C,GAEaK,IAAgB,OAChBC,IAAS,CAAC,OAAO,KAAK,GAEtBC,IAAW,CAACC,MAA4B;AACpD,QAAMC,IAAQD;AACd,SAAOF,EAAO,SAASG,CAAK,IAAIA,IAAQJ;AACzC;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode, HTMLAttributes, MouseEvent } from 'react';
|
|
2
|
+
export interface TabsProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
onClickTab?: (event: MouseEvent<HTMLButtonElement>, tabIndex: number) => void;
|
|
4
|
+
initialSelectedTabIndex?: number;
|
|
5
|
+
size?: 'medium' | 'large';
|
|
6
|
+
}
|
|
7
|
+
interface TabsListProps {
|
|
8
|
+
/**
|
|
9
|
+
* `<Tabs.Tab />` as children
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const Tabs: {
|
|
15
|
+
Provider: ({ children, onClickTab, initialSelectedTabIndex, size, className, ...rest }: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
TabList: ({ children, className }: TabsListProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
Panel: ({ children, className, ...rest }: import('./tab-panel').TabPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
Tab: ({ count, icon, isSelected: isInitialTab, children, className, trackingKey, tabIndicatorTheme, ...rest }: import('./tab').TabProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
};
|
|
20
|
+
export type { TabsListProps };
|
|
21
|
+
export { Tabs };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as b, jsxs as M } from "react/jsx-runtime";
|
|
3
|
+
import I from "classnames";
|
|
4
|
+
import { useState as i, useRef as N, useCallback as m, useEffect as u, useMemo as O } from "react";
|
|
5
|
+
import { TabPanel as S } from "./tab-panel.js";
|
|
6
|
+
import { Tab as U } from "./tab.js";
|
|
7
|
+
import { useTabsContext as q, TabsContext as B } from "./use-tabs-context.js";
|
|
8
|
+
import p from "./tabs.module.scss.js";
|
|
9
|
+
const F = ({
|
|
10
|
+
children: h,
|
|
11
|
+
onClickTab: n,
|
|
12
|
+
initialSelectedTabIndex: c = 0,
|
|
13
|
+
size: x = "medium",
|
|
14
|
+
className: E,
|
|
15
|
+
...k
|
|
16
|
+
}) => {
|
|
17
|
+
const [l, f] = i(
|
|
18
|
+
c
|
|
19
|
+
), s = N([]), d = N([]), [r, A] = i([]), [L, R] = i([]), [W, C] = i(0), [K, V] = i(0), a = N(null), y = m((t) => {
|
|
20
|
+
const e = s.current[t]?.parentNode;
|
|
21
|
+
e && e.scrollIntoView({
|
|
22
|
+
behavior: "smooth",
|
|
23
|
+
block: "nearest",
|
|
24
|
+
inline: "nearest"
|
|
25
|
+
});
|
|
26
|
+
}, []);
|
|
27
|
+
u(() => {
|
|
28
|
+
f(c);
|
|
29
|
+
}, [c]), u(() => {
|
|
30
|
+
const t = s.current[l]?.parentElement;
|
|
31
|
+
if (t && a.current) {
|
|
32
|
+
const e = t.offsetLeft, o = t.offsetWidth;
|
|
33
|
+
V(e), C(o), a.current.scrollTo({
|
|
34
|
+
left: e,
|
|
35
|
+
behavior: "smooth"
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, [s, l, y, a]), u(() => {
|
|
39
|
+
A(s.current.map((o) => o.id));
|
|
40
|
+
let t = 0, e = 0;
|
|
41
|
+
if (s.current.forEach((o, T) => {
|
|
42
|
+
o.hasAttribute("data-is-selected") && (t = T, e++);
|
|
43
|
+
}), e > 1)
|
|
44
|
+
throw new Error("Only one tab may use isSelected argument");
|
|
45
|
+
f(t);
|
|
46
|
+
}, [s]), u(() => {
|
|
47
|
+
R(d.current.map((t) => t.id));
|
|
48
|
+
}, [d]);
|
|
49
|
+
const P = m(
|
|
50
|
+
(t, e) => {
|
|
51
|
+
f(t), y(t), typeof n == "function" && n(e, t);
|
|
52
|
+
},
|
|
53
|
+
[n, y]
|
|
54
|
+
), w = m(
|
|
55
|
+
(t, e) => {
|
|
56
|
+
e.preventDefault(), s.current[t].focus();
|
|
57
|
+
},
|
|
58
|
+
[]
|
|
59
|
+
), g = m(
|
|
60
|
+
(t, e) => {
|
|
61
|
+
const o = "ArrowLeft", T = "ArrowRight", $ = "Enter", D = " ";
|
|
62
|
+
if (e.key === T) {
|
|
63
|
+
const v = (t + 1) % r.length;
|
|
64
|
+
w(v, e);
|
|
65
|
+
} else if (e.key === o) {
|
|
66
|
+
const v = (t + r.length - 1) % r.length;
|
|
67
|
+
w(v, e);
|
|
68
|
+
} else (e.key === $ || e.key === D) && f(t);
|
|
69
|
+
},
|
|
70
|
+
[w, r.length]
|
|
71
|
+
), j = O(
|
|
72
|
+
() => ({
|
|
73
|
+
tabNodes: s,
|
|
74
|
+
tabIds: r,
|
|
75
|
+
panelNodes: d,
|
|
76
|
+
panelIds: L,
|
|
77
|
+
selectedTabIndex: l,
|
|
78
|
+
onClick: P,
|
|
79
|
+
onKeyUp: g,
|
|
80
|
+
size: x,
|
|
81
|
+
tabsListRef: a
|
|
82
|
+
}),
|
|
83
|
+
[
|
|
84
|
+
s,
|
|
85
|
+
r,
|
|
86
|
+
d,
|
|
87
|
+
L,
|
|
88
|
+
l,
|
|
89
|
+
P,
|
|
90
|
+
g,
|
|
91
|
+
x,
|
|
92
|
+
a
|
|
93
|
+
]
|
|
94
|
+
);
|
|
95
|
+
return /* @__PURE__ */ b(B.Provider, { value: j, children: /* @__PURE__ */ b(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
className: I(p.tabs, E),
|
|
99
|
+
...k,
|
|
100
|
+
style: {
|
|
101
|
+
"--indicator-left-pos": `${K}px`,
|
|
102
|
+
"--indicator-width": `${W}px`
|
|
103
|
+
},
|
|
104
|
+
children: h
|
|
105
|
+
}
|
|
106
|
+
) });
|
|
107
|
+
}, G = ({ children: h, className: n }) => {
|
|
108
|
+
const { tabsListRef: c } = q();
|
|
109
|
+
return /* @__PURE__ */ b("div", { className: I(p["tablist-wrapper"], n), children: /* @__PURE__ */ M("ul", { className: p.tablist, role: "tablist", ref: c, children: [
|
|
110
|
+
h,
|
|
111
|
+
/* @__PURE__ */ b("li", { className: p.indicator, role: "presentation" })
|
|
112
|
+
] }) });
|
|
113
|
+
}, z = { Provider: F, TabList: G, Panel: S, Tab: U };
|
|
114
|
+
export {
|
|
115
|
+
z as Tabs
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/tabs/index.tsx"],"sourcesContent":["'use client'\n\nimport classNames from 'classnames'\nimport {\n\ttype ReactNode,\n\ttype HTMLAttributes,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n} from 'react'\nimport { TabPanel } from './tab-panel'\nimport { Tab } from './tab'\nimport { TabsContext, useTabsContext } from './use-tabs-context'\nimport s from './tabs.module.scss'\n\nexport interface TabsProps extends HTMLAttributes<HTMLDivElement> {\n\tonClickTab?: (event: MouseEvent<HTMLButtonElement>, tabIndex: number) => void\n\tinitialSelectedTabIndex?: number\n\tsize?: 'medium' | 'large'\n}\n\nconst Provider = ({\n\tchildren,\n\tonClickTab,\n\tinitialSelectedTabIndex = 0,\n\tsize = 'medium',\n\tclassName,\n\t...rest\n}: TabsProps) => {\n\tconst [selectedTabIndex, setSelectedTabIndex] = useState(\n\t\tinitialSelectedTabIndex\n\t)\n\tconst tabNodes = useRef<Array<HTMLButtonElement>>([])\n\tconst panelNodes = useRef<Array<HTMLDivElement>>([])\n\tconst [tabIds, setTabIds] = useState<Array<string>>([])\n\tconst [panelIds, setPanelIds] = useState<Array<string>>([])\n\tconst [indicatorWidth, setIndicatorWidth] = useState(0)\n\tconst [indicatorLeftPosition, setIndicatorLeftPosition] = useState(0)\n\tconst tabsListRef = useRef<HTMLUListElement | null>(null)\n\n\tconst scrollIntoView = useCallback((tabIndex: number) => {\n\t\t// Scroll Tab into view if it's out of view\n\t\tconst parentNode = tabNodes.current[tabIndex]\n\t\t\t?.parentNode as HTMLElement | null\n\t\tif (parentNode) {\n\t\t\tparentNode.scrollIntoView({\n\t\t\t\tbehavior: 'smooth',\n\t\t\t\tblock: 'nearest',\n\t\t\t\tinline: 'nearest',\n\t\t\t})\n\t\t}\n\t}, [])\n\n\tuseEffect(() => {\n\t\tsetSelectedTabIndex(initialSelectedTabIndex)\n\t}, [initialSelectedTabIndex])\n\n\tuseEffect(() => {\n\t\tconst tabElem = tabNodes.current[selectedTabIndex]?.parentElement\n\t\tif (tabElem && tabsListRef.current) {\n\t\t\tconst tabLeftPos = tabElem.offsetLeft\n\t\t\tconst tabWidth = tabElem.offsetWidth\n\t\t\tsetIndicatorLeftPosition(tabLeftPos)\n\t\t\tsetIndicatorWidth(tabWidth)\n\t\t\ttabsListRef.current.scrollTo({\n\t\t\t\tleft: tabLeftPos,\n\t\t\t\tbehavior: 'smooth',\n\t\t\t})\n\t\t}\n\t}, [tabNodes, selectedTabIndex, scrollIntoView, tabsListRef])\n\n\tuseEffect(() => {\n\t\tsetTabIds(tabNodes.current.map((tab) => tab.id))\n\t\tlet initialTabIndex = 0\n\t\tlet selectedCount = 0\n\n\t\ttabNodes.current.forEach((tabElement, index) => {\n\t\t\tif (tabElement.hasAttribute('data-is-selected')) {\n\t\t\t\tinitialTabIndex = index\n\t\t\t\tselectedCount++\n\t\t\t}\n\t\t})\n\n\t\tif (selectedCount > 1) {\n\t\t\tthrow new Error('Only one tab may use isSelected argument')\n\t\t}\n\n\t\tsetSelectedTabIndex(initialTabIndex)\n\t}, [tabNodes])\n\n\tuseEffect(() => {\n\t\tsetPanelIds(panelNodes.current.map((tab) => tab.id))\n\t}, [panelNodes])\n\n\tconst onClick = useCallback(\n\t\t(tabIndex: number, event: MouseEvent<HTMLButtonElement>) => {\n\t\t\tsetSelectedTabIndex(tabIndex)\n\n\t\t\tscrollIntoView(tabIndex)\n\n\t\t\t// invoke the callback function if it's provided as argument\n\t\t\tif (typeof onClickTab === 'function') {\n\t\t\t\tonClickTab(event, tabIndex)\n\t\t\t}\n\t\t},\n\t\t[onClickTab, scrollIntoView]\n\t)\n\n\t// Focus tab for keyboard & mouse navigation:\n\tconst focusTab = useCallback(\n\t\t(tabIndex: number, e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\te.preventDefault()\n\t\t\ttabNodes.current[tabIndex].focus()\n\t\t},\n\t\t[]\n\t)\n\n\tconst onKeyUp = useCallback(\n\t\t(tabIndex: number, e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\tconst leftArrow = 'ArrowLeft'\n\t\t\tconst rightArrow = 'ArrowRight'\n\t\t\tconst enterKey = 'Enter'\n\t\t\tconst spaceKey = ' '\n\n\t\t\tif (e.key === rightArrow) {\n\t\t\t\tconst nextTabIndex = (tabIndex + 1) % tabIds.length\n\t\t\t\tfocusTab(nextTabIndex, e)\n\t\t\t} else if (e.key === leftArrow) {\n\t\t\t\tconst prevTabIndex = (tabIndex + tabIds.length - 1) % tabIds.length\n\t\t\t\tfocusTab(prevTabIndex, e)\n\t\t\t} else if (e.key === enterKey || e.key === spaceKey) {\n\t\t\t\tsetSelectedTabIndex(tabIndex)\n\t\t\t}\n\t\t},\n\t\t[focusTab, tabIds.length]\n\t)\n\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\ttabNodes,\n\t\t\ttabIds,\n\t\t\tpanelNodes,\n\t\t\tpanelIds,\n\t\t\tselectedTabIndex,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tsize,\n\t\t\ttabsListRef,\n\t\t}),\n\t\t[\n\t\t\ttabNodes,\n\t\t\ttabIds,\n\t\t\tpanelNodes,\n\t\t\tpanelIds,\n\t\t\tselectedTabIndex,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tsize,\n\t\t\ttabsListRef,\n\t\t]\n\t)\n\n\treturn (\n\t\t<TabsContext.Provider value={contextValue}>\n\t\t\t<div\n\t\t\t\tclassName={classNames(s.tabs, className)}\n\t\t\t\t{...rest}\n\t\t\t\tstyle={{\n\t\t\t\t\t['--indicator-left-pos' as string]: `${indicatorLeftPosition}px`,\n\t\t\t\t\t['--indicator-width' as string]: `${indicatorWidth}px`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</TabsContext.Provider>\n\t)\n}\n\ninterface TabsListProps {\n\t/**\n\t * `<Tabs.Tab />` as children\n\t */\n\tchildren: ReactNode\n\tclassName?: string\n}\n\nconst TabList = ({ children, className }: TabsListProps) => {\n\tconst { tabsListRef } = useTabsContext()\n\treturn (\n\t\t<div className={classNames(s['tablist-wrapper'], className)}>\n\t\t\t<ul className={s.tablist} role=\"tablist\" ref={tabsListRef}>\n\t\t\t\t{children}\n\t\t\t\t<li className={s.indicator} role=\"presentation\"></li>\n\t\t\t</ul>\n\t\t</div>\n\t)\n}\n\nconst Tabs = { Provider, TabList, Panel: TabPanel, Tab }\n\nexport type { TabsListProps }\nexport { Tabs }\n"],"names":["Provider","children","onClickTab","initialSelectedTabIndex","size","className","rest","selectedTabIndex","setSelectedTabIndex","useState","tabNodes","useRef","panelNodes","tabIds","setTabIds","panelIds","setPanelIds","indicatorWidth","setIndicatorWidth","indicatorLeftPosition","tabsListRef","scrollIntoView","useCallback","tabIndex","parentNode","useEffect","tabElem","tabLeftPos","tabWidth","setIndicatorLeftPosition","tab","initialTabIndex","selectedCount","index","tabElement","onClick","event","focusTab","onKeyUp","leftArrow","rightArrow","enterKey","spaceKey","nextTabIndex","prevTabIndex","contextValue","useMemo","jsx","TabsContext","classNames","s","jsxs"],"mappings":";;;;;;;;AAyBkB,MACjBA,IAAA,CAAA;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC,IAAO;AAAA,EACP,MAAAC,IAAA;AAAA,EACA,WAAAC;AAAA,EACD,GAAAC;AACC;AAAgD,QAC/C,CAAAC,GAAAC,CAAA,IAAAC;AAAA,IACDN;AAAA,EACA,GACMO,IAAAC,EAAa,CAAA,CAA8B,GAC3CC,IAASD,EAAS,CAAA,CAAI,GACtB,CAACE,GAAAC,CAAU,IAAWL,EAAI,CAAA,CAAA,GAC1B,CAACM,GAAAC,CAAgB,IAAAP,EAAiB,CAAA,CAAA,GAClC,CAACQ,GAAAC,CAAuB,IAAAT,EAAA,CAAwB,GAChD,CAAAU,IAAkD,IAAAV,EAAA,CAAA,GAElDW,IAAAT,SAELU,IAAmBC,SAChB;AACH,cAAgBZ,EAAA,QAAAa,CAAA,GAAA;AACf,IAAAC,KAA0BA,iBACf;AAAA,MACV,UAAO;AAAA,MACP,OAAA;AAAA,MACA,QAAA;AAAA,IACF,CAAA;AAAA,EAGD,GAAA,CAAA,CAAA;AACC,EAAAC,EAAA,MAAA;AACD,IAAAjB,EAAIL,CAAwB;AAAA,EAE5B,GAAA,CAAAA,CAAgB,CAAA,GACfsB,EAAM,MAAA;AACN,UAAIC,IAAWhB,EAAA,SAAqB,GAAA;AACnC,QAAAgB,KAAMN,EAAa,SAAQ;AAC3B,YAAMO,IAAWD,EAAQ,YACzBE,IAAAF,EAAyB;AACzB,MAAAG,EAAkBF,CAAQ,GAC1BT,EAAYU,IAAiBR,EACtB,QAAA,SAAA;AAAA,QACN;QACA,UAAA;AAAA,MACF,CAAA;AAAA;EAGD,GAAA,CAAAV,GAAUH,GAAMc,GAAAD,CAAA,CAAA,GACfK,EAAA,MAAU;AACV,IAAAX,EAAIJ,EAAA,QAAkB,IAAA,CAAAoB,MAAAA,EAAA,EAAA,CAAA;AACtB,QAAIC,IAAgB,GAEpBC,IAAiB;AAQhB,QAPAtB,EAAI,QAAW,YAAauB,MAAkB;AAC7C,MAAAC,EAAA,aAAkB,kBAAA,MAClBH,IAAAE,GACDD;AAAA,IAGD,CAAA,GACCA;AACD,YAAA,IAAA,MAAA,0CAAA;AAGD,IAAAxB,EAAauB,CAAA;AAAA,EAEb,GAAA,CAAArB,CAAU,CAAA,GACTe,EAAA,MAAY;AACb,IAAAT,EAAcJ,EAAC,QAAA,IAAA,CAAAkB,MAAAA,EAAA,EAAA,CAAA;AAAA,EAEf,GAAA,CAAAlB,CAAM,CAAA;AAAU,QACduB,IAAkBb;AAAA,IAClB,CAAAC,GAAAa,MAAA;AAEA,MAAA5B,EAAee,CAAQ,GAGvBF,EAAWE,IACV,OAAArB,mBACDA,EAAAkC,GAAAb,CAAA;AAAA,IAED;AAAA,IACD,CAAArB,GAAAmB,CAAA;AAAA,EAGA,GACEgB,IAAkBf;AAAA,IAClB,CAAAC,GAAE,MAAA;AACF,QAAA,eAAiB,GAClBb,EAAA,QAAAa,CAAA,EAAA,MAAA;AAAA,IACA;AAAA,IACD,CAAA;AAAA,EAEA,GACEe,IAAkBhB;AAAA,IAClB,CAAAC,GAAM,MAAA;AACN,YAAMgB,IAAA,aACAC,IAAW,cACXC,IAAW,SAEXC;AACL,UAAA,EAAA,QAAMF,GAAgB;AACtB,cAAAG,SAAwB,KAAA9B,EAAA;UACd8B;MACV,WAAM,EAAA,QAAAJ,GAAgB;AACtB,cAAAK,SAAwB/B,EAAA,SAAA,KAAAA,EAAA;UACd+B,GAAU,CAAA;AAAA,MACpB,MAAA,EAAA,EAAA,QAAAH,KAA4B,EAAA,QAAAC,MAC7BlC,EAAAe,CAAA;AAAA,IAED;AAAA,IACD,CAAAc,GAAAxB,EAAA,MAAA;AAAA,EAEA,GACCgC,IAAOC;AAAA,IAAA,OACN;AAAA,MACA,UAAApC;AAAA,MACA,QAAAG;AAAA,MACA,YAAAD;AAAA,MACA,UAAAG;AAAA,MACA,kBAAAR;AAAA,MACA,SAAA4B;AAAA,MACA,SAAAG;AAAA,MACA,MAAAlC;AAAA,MACD,aAAAgB;AAAA,IACA;AAAA,IAAA;AAAA,MAECV;AAAA,MACAG;AAAA,MACAD;AAAA,MACAG;AAAA,MACAR;AAAA,MACA4B;AAAA,MACAG;AAAA,MACAlC;AAAA,MAAAgB;AAAA,IAEF;AAAA,EAEA;AAEE,SAAC,gBAAA2B,EAAAC,EAAA,UAAA,EAAA,OAAAH,GAAA,UAAA,gBAAAE;AAAA,IAAA;AAAA,IAAA;AAAA,MAEC,WAAGE,EAAAC,EAAA,MAAA7C,CAAA;AAAA,MACJ;MAAO;QAEL,wBAAmC,GAAAc,CAAc;AAAA,QACnD,qBAAA,GAAAF,CAAA;AAAA,MAEC;AAAA,MAAA,UAAAhB;AAAA;EAIL,EAAA,CAAA;AAUA,OACS,CAAA,EAAA,UAAAA,sBAA+B;AACvC;AAGI,SAAA,gBAAA8C,EAAA,OAAA,EAAA,WAAAE,EAAAC,EAAA,iBAAA,GAAA7C,CAAA,GAAA,UAAA,gBAAA8C,EAAA,MAAA,EAAA,WAAAD,EAAA,SAAA,MAAA,WAAA,KAAA9B,GAAA,UAAA;AAAA,IAAAnB;AAAA,IAGH,gBAAA8C,EAAA,MAAA,EAAA,WAAAG,EAAA,WAAA,MAAA,eAAA,CAAA;AAAA,EAEF,EAAA,CAAA,EAAA,CAAA;AAEA;"}
|