@hashicorp/mds-react 0.9.2 → 0.9.4
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/components/accordion/index.d.ts +1 -1
- package/components/accordion/index.js +9 -0
- package/components/accordion/index.js.map +1 -0
- package/components/accordion/item/button.js +44 -0
- package/components/accordion/item/button.js.map +1 -0
- package/components/accordion/item/index.d.ts +1 -1
- package/components/accordion/item/index.js +59 -0
- package/components/accordion/item/index.js.map +1 -0
- package/components/accordion/style.module.scss.js +24 -0
- package/components/accordion/style.module.scss.js.map +1 -0
- package/components/alert/alert.module.scss.js +29 -0
- package/components/alert/alert.module.scss.js.map +1 -0
- package/components/alert/icon.d.ts +2 -2
- package/components/alert/icon.js +34 -0
- package/components/alert/icon.js.map +1 -0
- package/components/alert/index.d.ts +6 -6
- package/components/alert/index.js +97 -0
- package/components/alert/index.js.map +1 -0
- package/components/badge/index.d.ts +1 -1
- package/components/badge/index.js +50 -0
- package/components/badge/index.js.map +1 -0
- package/components/badge/style.module.scss.js +22 -0
- package/components/badge/style.module.scss.js.map +1 -0
- package/components/badge-count/index.d.ts +1 -1
- package/components/badge-count/index.js +29 -0
- package/components/badge-count/index.js.map +1 -0
- package/components/badge-count/style.module.scss.js +15 -0
- package/components/badge-count/style.module.scss.js.map +1 -0
- package/components/breadcrumbs/index.d.ts +2 -2
- package/components/breadcrumbs/index.js +38 -0
- package/components/breadcrumbs/index.js.map +1 -0
- package/components/breadcrumbs/item/index.d.ts +1 -1
- package/components/breadcrumbs/item/index.js +32 -0
- package/components/breadcrumbs/item/index.js.map +1 -0
- package/components/breadcrumbs/style.module.scss.js +27 -0
- package/components/breadcrumbs/style.module.scss.js.map +1 -0
- package/components/breadcrumbs/truncation-button/index.d.ts +1 -1
- package/components/breadcrumbs/truncation-button/index.js +25 -0
- package/components/breadcrumbs/truncation-button/index.js.map +1 -0
- package/components/breadcrumbs/types/index.d.ts +1 -1
- package/components/button/index.d.ts +4 -3
- package/components/button/index.js +119 -0
- package/components/button/index.js.map +1 -0
- package/components/button/styles.module.scss.js +32 -0
- package/components/button/styles.module.scss.js.map +1 -0
- package/components/card/card-thumbnail/card-thumbnail.module.css.js +8 -0
- package/components/card/card-thumbnail/card-thumbnail.module.css.js.map +1 -0
- package/components/card/card-thumbnail/index.d.ts +1 -1
- package/components/card/card-thumbnail/index.js +23 -0
- package/components/card/card-thumbnail/index.js.map +1 -0
- package/components/card/index.d.ts +3 -2
- package/components/card/index.js +160 -0
- package/components/card/index.js.map +1 -0
- package/components/card/styles.module.css.js +29 -0
- package/components/card/styles.module.css.js.map +1 -0
- package/components/card/types.d.ts +4 -3
- package/components/code-block/code-block.module.scss.js +34 -0
- package/components/code-block/code-block.module.scss.js.map +1 -0
- package/components/code-block/code-lines/index.d.ts +1 -8
- package/components/code-block/code-lines/index.js +59 -0
- package/components/code-block/code-lines/index.js.map +1 -0
- package/components/code-block/code-lines/utils/split-html-into-lines.d.ts +1 -1
- package/components/code-block/code-lines/utils/split-html-into-lines.js +19 -0
- package/components/code-block/code-lines/utils/split-html-into-lines.js.map +1 -0
- package/components/code-block/code-lines/utils/split-jsx-into-lines.d.ts +1 -1
- package/components/code-block/code-lines/utils/split-jsx-into-lines.js +31 -0
- package/components/code-block/code-lines/utils/split-jsx-into-lines.js.map +1 -0
- package/components/code-block/hidden-copy-content/index.d.ts +3 -3
- package/components/code-block/hidden-copy-content/index.js +13 -0
- package/components/code-block/hidden-copy-content/index.js.map +1 -0
- package/components/code-block/index.d.ts +1 -1
- package/components/code-block/index.js +88 -0
- package/components/code-block/index.js.map +1 -0
- package/components/code-block/utils/parse-highlighted-lines.js +39 -0
- package/components/code-block/utils/parse-highlighted-lines.js.map +1 -0
- package/components/code-block/utils/process-snippet.js +20 -0
- package/components/code-block/utils/process-snippet.js.map +1 -0
- package/components/code-block/utils/shellwords.js +33 -0
- package/components/code-block/utils/shellwords.js.map +1 -0
- package/components/combo-box-primitive/index.d.ts +1 -0
- package/components/combo-box-primitive/index.js +302 -0
- package/components/combo-box-primitive/index.js.map +1 -0
- package/components/dialog-primitive/dialog.module.scss.js +12 -0
- package/components/dialog-primitive/dialog.module.scss.js.map +1 -0
- package/components/dialog-primitive/index.d.ts +1 -1
- package/components/dialog-primitive/index.js +15 -0
- package/components/dialog-primitive/index.js.map +1 -0
- package/components/disclosure-primitive/index.d.ts +1 -2
- package/components/disclosure-primitive/index.js +57 -0
- package/components/disclosure-primitive/index.js.map +1 -0
- package/components/disclosure-primitive/styles.module.css.js +7 -0
- package/components/disclosure-primitive/styles.module.css.js.map +1 -0
- package/components/disclosure-primitive/use-disclosure-primitive.d.ts +2 -2
- package/components/disclosure-primitive/use-disclosure-primitive.js +17 -0
- package/components/disclosure-primitive/use-disclosure-primitive.js.map +1 -0
- package/components/dismiss-button/index.d.ts +1 -0
- package/components/dismiss-button/index.js +22 -0
- package/components/dismiss-button/index.js.map +1 -0
- package/components/dismiss-button/styles.module.scss.js +7 -0
- package/components/dismiss-button/styles.module.scss.js.map +1 -0
- package/components/dropdown/index.d.ts +6 -6
- package/components/dropdown/index.js +79 -0
- package/components/dropdown/index.js.map +1 -0
- package/components/dropdown/list-item/custom.d.ts +1 -1
- package/components/dropdown/list-item/custom.js +9 -0
- package/components/dropdown/list-item/custom.js.map +1 -0
- package/components/dropdown/list-item/index.d.ts +4 -4
- package/components/dropdown/list-item/index.js +14 -0
- package/components/dropdown/list-item/index.js.map +1 -0
- package/components/dropdown/list-item/interactive.d.ts +1 -1
- package/components/dropdown/list-item/interactive.js +49 -0
- package/components/dropdown/list-item/interactive.js.map +1 -0
- package/components/dropdown/list-item/separator.d.ts +1 -1
- package/components/dropdown/list-item/separator.js +17 -0
- package/components/dropdown/list-item/separator.js.map +1 -0
- package/components/dropdown/list-item/styles.module.css.js +26 -0
- package/components/dropdown/list-item/styles.module.css.js.map +1 -0
- package/components/dropdown/list-item/title.d.ts +1 -1
- package/components/dropdown/list-item/title.js +9 -0
- package/components/dropdown/list-item/title.js.map +1 -0
- package/components/dropdown/styles.module.css.js +24 -0
- package/components/dropdown/styles.module.css.js.map +1 -0
- package/components/dropdown/toggle-button/index.d.ts +2 -2
- package/components/dropdown/toggle-button/index.js +54 -0
- package/components/dropdown/toggle-button/index.js.map +1 -0
- package/components/dropdown/toggle-button/styles.module.scss.js +14 -0
- package/components/dropdown/toggle-button/styles.module.scss.js.map +1 -0
- package/components/flight-icon/flight-icon.module.css.js +12 -0
- package/components/flight-icon/flight-icon.module.css.js.map +1 -0
- package/components/flight-icon/index.d.ts +2 -2
- package/components/flight-icon/index.js +58 -0
- package/components/flight-icon/index.js.map +1 -0
- package/components/form/checkbox/form-checkbox.module.css.js +8 -0
- package/components/form/checkbox/form-checkbox.module.css.js.map +1 -0
- package/components/form/checkbox/index.d.ts +1 -1
- package/components/form/checkbox/index.js +109 -0
- package/components/form/checkbox/index.js.map +1 -0
- package/components/form/error/form-error.module.css.js +14 -0
- package/components/form/error/form-error.module.css.js.map +1 -0
- package/components/form/error/index.d.ts +1 -1
- package/components/form/error/index.js +22 -0
- package/components/form/error/index.js.map +1 -0
- package/components/form/field/form-field.module.css.js +17 -0
- package/components/form/field/form-field.module.css.js.map +1 -0
- package/components/form/field/index.d.ts +1 -1
- package/components/form/field/index.js +46 -0
- package/components/form/field/index.js.map +1 -0
- package/components/form/fieldset/form-fieldset.module.css.js +19 -0
- package/components/form/fieldset/form-fieldset.module.css.js.map +1 -0
- package/components/form/fieldset/index.d.ts +1 -1
- package/components/form/fieldset/index.js +65 -0
- package/components/form/fieldset/index.js.map +1 -0
- package/components/form/file-input/form-file-input.module.scss.js +7 -0
- package/components/form/file-input/form-file-input.module.scss.js.map +1 -0
- package/components/form/file-input/index.d.ts +1 -1
- package/components/form/file-input/index.js +68 -0
- package/components/form/file-input/index.js.map +1 -0
- package/components/form/helper-text/form-helper-text.module.css.js +7 -0
- package/components/form/helper-text/form-helper-text.module.css.js.map +1 -0
- package/components/form/helper-text/index.d.ts +1 -1
- package/components/form/helper-text/index.js +22 -0
- package/components/form/helper-text/index.js.map +1 -0
- package/components/form/indicator/form-indicator.module.css.js +8 -0
- package/components/form/indicator/form-indicator.module.css.js.map +1 -0
- package/components/form/indicator/index.js +23 -0
- package/components/form/indicator/index.js.map +1 -0
- package/components/form/label/form-label.module.css.js +10 -0
- package/components/form/label/form-label.module.css.js.map +1 -0
- package/components/form/label/index.d.ts +1 -1
- package/components/form/label/index.js +33 -0
- package/components/form/label/index.js.map +1 -0
- package/components/form/legend/form-legend.module.css.js +10 -0
- package/components/form/legend/form-legend.module.css.js.map +1 -0
- package/components/form/legend/index.d.ts +1 -1
- package/components/form/legend/index.js +19 -0
- package/components/form/legend/index.js.map +1 -0
- package/components/form/radio/form-radio.module.scss.js +8 -0
- package/components/form/radio/form-radio.module.scss.js.map +1 -0
- package/components/form/radio/index.d.ts +1 -1
- package/components/form/radio/index.js +100 -0
- package/components/form/radio/index.js.map +1 -0
- package/components/form/radio-card/description.js +10 -0
- package/components/form/radio-card/description.js.map +1 -0
- package/components/form/radio-card/form-radio-card.module.css.js +30 -0
- package/components/form/radio-card/form-radio-card.module.css.js.map +1 -0
- package/components/form/radio-card/group.d.ts +1 -1
- package/components/form/radio-card/group.js +31 -0
- package/components/form/radio-card/group.js.map +1 -0
- package/components/form/radio-card/index.d.ts +2 -2
- package/components/form/radio-card/index.js +67 -0
- package/components/form/radio-card/index.js.map +1 -0
- package/components/form/radio-card/label.js +10 -0
- package/components/form/radio-card/label.js.map +1 -0
- package/components/form/select/form-select.module.css.js +14 -0
- package/components/form/select/form-select.module.css.js.map +1 -0
- package/components/form/select/index.d.ts +1 -1
- package/components/form/select/index.js +79 -0
- package/components/form/select/index.js.map +1 -0
- package/components/form/super-select/form-super-select.module.css.js +22 -0
- package/components/form/super-select/form-super-select.module.css.js.map +1 -0
- package/components/form/super-select/index.d.ts +2 -2
- package/components/form/super-select/index.js +170 -0
- package/components/form/super-select/index.js.map +1 -0
- package/components/form/text-input/index.d.ts +1 -1
- package/components/form/text-input/index.js +91 -0
- package/components/form/text-input/index.js.map +1 -0
- package/components/form/text-input/styles.module.css.js +15 -0
- package/components/form/text-input/styles.module.css.js.map +1 -0
- package/components/form/textarea/form-textarea.module.css.js +14 -0
- package/components/form/textarea/form-textarea.module.css.js.map +1 -0
- package/components/form/textarea/index.d.ts +1 -1
- package/components/form/textarea/index.js +74 -0
- package/components/form/textarea/index.js.map +1 -0
- package/components/form/toggle/form-toggle.module.scss.js +12 -0
- package/components/form/toggle/form-toggle.module.scss.js.map +1 -0
- package/components/form/toggle/index.d.ts +1 -1
- package/components/form/toggle/index.js +102 -0
- package/components/form/toggle/index.js.map +1 -0
- package/components/hds/wrappers/tooltip.d.ts +3 -4
- package/components/hds/wrappers/tooltip.js +51 -0
- package/components/hds/wrappers/tooltip.js.map +1 -0
- package/components/icon-tile/index.d.ts +1 -1
- package/components/icon-tile/index.js +50 -0
- package/components/icon-tile/index.js.map +1 -0
- package/components/icon-tile/style.module.scss.js +29 -0
- package/components/icon-tile/style.module.scss.js.map +1 -0
- package/components/index.d.ts +1 -1
- package/components/index.js +116 -73
- package/components/index.js.map +1 -1
- package/components/inline-link/index.d.ts +1 -1
- package/components/inline-link/index.js +33 -0
- package/components/inline-link/index.js.map +1 -0
- package/components/inline-link/inline-link.module.css.js +11 -0
- package/components/inline-link/inline-link.module.css.js.map +1 -0
- package/components/interactive/index.d.ts +3 -4
- package/components/interactive/index.js +59 -0
- package/components/interactive/index.js.map +1 -0
- package/components/legacy-button/index.d.ts +3 -3
- package/components/legacy-button/index.js +65 -0
- package/components/legacy-button/index.js.map +1 -0
- package/components/legacy-button/types.d.ts +1 -1
- package/components/legacy-button/utils.d.ts +1 -1
- package/components/legacy-button/utils.js +39 -0
- package/components/legacy-button/utils.js.map +1 -0
- package/components/menu-primitive/index.d.ts +1 -1
- package/components/menu-primitive/index.js +68 -0
- package/components/menu-primitive/index.js.map +1 -0
- package/components/menu-primitive/styles.module.css.js +12 -0
- package/components/menu-primitive/styles.module.css.js.map +1 -0
- package/components/menu-primitive/use-menu-primitive.d.ts +2 -2
- package/components/menu-primitive/use-menu-primitive.js +17 -0
- package/components/menu-primitive/use-menu-primitive.js.map +1 -0
- package/components/modal/index.d.ts +1 -1
- package/components/modal/index.js +61 -0
- package/components/modal/index.js.map +1 -0
- package/components/modal/modal.module.css.js +8 -0
- package/components/modal/modal.module.css.js.map +1 -0
- package/components/modal/use-modal.d.ts +2 -2
- package/components/modal/use-modal.js +17 -0
- package/components/modal/use-modal.js.map +1 -0
- package/components/separator/index.d.ts +1 -1
- package/components/separator/index.js +15 -0
- package/components/separator/index.js.map +1 -0
- package/components/separator/separator.module.css.js +10 -0
- package/components/separator/separator.module.css.js.map +1 -0
- package/components/standalone-link/index.d.ts +2 -2
- package/components/standalone-link/index.js +54 -0
- package/components/standalone-link/index.js.map +1 -0
- package/components/standalone-link/styles.module.scss.js +17 -0
- package/components/standalone-link/styles.module.scss.js.map +1 -0
- package/components/table/index.d.ts +5 -5
- package/components/table/index.js +52 -0
- package/components/table/index.js.map +1 -0
- package/components/table/table.module.scss.js +33 -0
- package/components/table/table.module.scss.js.map +1 -0
- package/components/table/td.d.ts +2 -2
- package/components/table/td.js +28 -0
- package/components/table/td.js.map +1 -0
- package/components/table/th-button-tooltip.js +24 -0
- package/components/table/th-button-tooltip.js.map +1 -0
- package/components/table/th.d.ts +2 -2
- package/components/table/th.js +43 -0
- package/components/table/th.js.map +1 -0
- package/components/table/tr.d.ts +1 -1
- package/components/table/tr.js +9 -0
- package/components/table/tr.js.map +1 -0
- package/components/table/utils.js +28 -0
- package/components/table/utils.js.map +1 -0
- package/components/tabs/index.d.ts +3 -3
- package/components/tabs/index.js +117 -0
- package/components/tabs/index.js.map +1 -0
- package/components/tabs/tab-panel.d.ts +1 -1
- package/components/tabs/tab-panel.js +35 -0
- package/components/tabs/tab-panel.js.map +1 -0
- package/components/tabs/tab.d.ts +2 -2
- package/components/tabs/tab.js +70 -0
- package/components/tabs/tab.js.map +1 -0
- package/components/tabs/tabs.module.scss.js +22 -0
- package/components/tabs/tabs.module.scss.js.map +1 -0
- package/components/tabs/use-tabs-context.d.ts +2 -2
- package/components/tabs/use-tabs-context.js +16 -0
- package/components/tabs/use-tabs-context.js.map +1 -0
- package/components/text/index.d.ts +6 -6
- package/components/text/index.js +112 -0
- package/components/text/index.js.map +1 -0
- package/components/text/style.module.scss.js +9 -0
- package/components/text/style.module.scss.js.map +1 -0
- package/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js +62 -0
- package/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js.map +1 -0
- package/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js +20 -0
- package/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js.map +1 -0
- package/components/visualizations/bar-chart/horizontal-chart/index.d.ts +1 -0
- package/components/visualizations/bar-chart/horizontal-chart/index.js +104 -0
- package/components/visualizations/bar-chart/horizontal-chart/index.js.map +1 -0
- package/components/visualizations/bar-chart/horizontal-chart/legend/index.js +13 -0
- package/components/visualizations/bar-chart/horizontal-chart/legend/index.js.map +1 -0
- package/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js +14 -0
- package/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js.map +1 -0
- package/components/visualizations/bar-chart/horizontal-chart/style.module.css.js +28 -0
- package/components/visualizations/bar-chart/horizontal-chart/style.module.css.js.map +1 -0
- package/components/visualizations/bar-chart/index.d.ts +1 -1
- package/components/visualizations/bar-chart/index.js +37 -0
- package/components/visualizations/bar-chart/index.js.map +1 -0
- package/components/visualizations/bar-chart/style.module.css.js +12 -0
- package/components/visualizations/bar-chart/style.module.css.js.map +1 -0
- package/components/visualizations/donut-chart/components/arc-tooltip/index.d.ts +2 -2
- package/components/visualizations/donut-chart/components/arc-tooltip/index.js +14 -0
- package/components/visualizations/donut-chart/components/arc-tooltip/index.js.map +1 -0
- package/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js +10 -0
- package/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js.map +1 -0
- package/components/visualizations/donut-chart/components/external-arc-label/index.d.ts +2 -2
- package/components/visualizations/donut-chart/components/external-arc-label/index.js +58 -0
- package/components/visualizations/donut-chart/components/external-arc-label/index.js.map +1 -0
- package/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js +16 -0
- package/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js.map +1 -0
- package/components/visualizations/donut-chart/components/internal-arc-label/index.d.ts +2 -2
- package/components/visualizations/donut-chart/components/internal-arc-label/index.js +42 -0
- package/components/visualizations/donut-chart/components/internal-arc-label/index.js.map +1 -0
- package/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js +14 -0
- package/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js.map +1 -0
- package/components/visualizations/donut-chart/index.d.ts +1 -1
- package/components/visualizations/donut-chart/index.js +90 -0
- package/components/visualizations/donut-chart/index.js.map +1 -0
- package/components/visualizations/donut-chart/styles.module.css.js +20 -0
- package/components/visualizations/donut-chart/styles.module.css.js.map +1 -0
- package/hooks/use-media-query/index.js +16 -0
- package/hooks/use-media-query/index.js.map +1 -0
- package/index.js +155 -101
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/patterns/card/newsroom-card/index.d.ts +1 -1
- package/patterns/card/newsroom-card/index.js +26 -0
- package/patterns/card/newsroom-card/index.js.map +1 -0
- package/patterns/card/newsroom-card/style.module.css.js +8 -0
- package/patterns/card/newsroom-card/style.module.css.js.map +1 -0
- package/patterns/card/partner-card/index.d.ts +2 -2
- package/patterns/card/partner-card/index.js +42 -0
- package/patterns/card/partner-card/index.js.map +1 -0
- package/patterns/card/partner-card/style.module.css.js +12 -0
- package/patterns/card/partner-card/style.module.css.js.map +1 -0
- package/patterns/card/person-card/index.d.ts +1 -1
- package/patterns/card/person-card/index.js +52 -0
- package/patterns/card/person-card/index.js.map +1 -0
- package/patterns/card/person-card/style.module.css.js +12 -0
- package/patterns/card/person-card/style.module.css.js.map +1 -0
- package/patterns/card/primitives.d.ts +5 -5
- package/patterns/card/primitives.js +77 -0
- package/patterns/card/primitives.js.map +1 -0
- package/patterns/card/promo-card/index.d.ts +1 -1
- package/patterns/card/promo-card/index.js +36 -0
- package/patterns/card/promo-card/index.js.map +1 -0
- package/patterns/card/resource-card/index.d.ts +1 -1
- package/patterns/card/resource-card/index.js +26 -0
- package/patterns/card/resource-card/index.js.map +1 -0
- package/patterns/card/style.module.css.js +30 -0
- package/patterns/card/style.module.css.js.map +1 -0
- package/patterns/card/thumbnails/index.d.ts +1 -1
- package/patterns/card/thumbnails/index.js +25 -0
- package/patterns/card/thumbnails/index.js.map +1 -0
- package/patterns/card/types.d.ts +6 -6
- package/patterns/card/unified-card/index.d.ts +1 -1
- package/patterns/card/unified-card/index.js +37 -0
- package/patterns/card/unified-card/index.js.map +1 -0
- package/patterns/copy-button/clipboard.d.ts +1 -1
- package/patterns/copy-button/clipboard.js +78 -0
- package/patterns/copy-button/clipboard.js.map +1 -0
- package/patterns/copy-button/index.d.ts +1 -1
- package/patterns/copy-button/index.js +57 -0
- package/patterns/copy-button/index.js.map +1 -0
- package/patterns/copy-button/style.module.css.js +13 -0
- package/patterns/copy-button/style.module.css.js.map +1 -0
- package/patterns/index.js +32 -22
- package/patterns/index.js.map +1 -1
- package/patterns/layout/index.d.ts +20 -20
- package/patterns/layout/index.js +47 -0
- package/patterns/layout/index.js.map +1 -0
- package/patterns/layout/layout.module.css.js +20 -0
- package/patterns/layout/layout.module.css.js.map +1 -0
- package/patterns/product-badge/index.js +22 -0
- package/patterns/product-badge/index.js.map +1 -0
- package/patterns/product-badge/style.module.css.js +8 -0
- package/patterns/product-badge/style.module.css.js.map +1 -0
- package/patterns/product-logo/index.d.ts +15 -15
- package/patterns/product-logo/index.js +130 -0
- package/patterns/product-logo/index.js.map +1 -0
- package/patterns/product-logo/product-logo.module.css.js +13 -0
- package/patterns/product-logo/product-logo.module.css.js.map +1 -0
- package/patterns/related-content/index.d.ts +1 -1
- package/patterns/related-content/index.js +65 -0
- package/patterns/related-content/index.js.map +1 -0
- package/patterns/related-content/style.module.css.js +22 -0
- package/patterns/related-content/style.module.css.js.map +1 -0
- package/patterns/related-content/types.d.ts +1 -1
- package/style.css +1 -1
- package/styles/mixins/button.scss +1 -6
- package/utils/get-contrast-yiq.js +13 -0
- package/utils/get-contrast-yiq.js.map +1 -0
- package/utils/hooks/use-screen-size.js +10 -0
- package/utils/hooks/use-screen-size.js.map +1 -0
- package/utils/i18n/constants/index.js +98 -0
- package/utils/i18n/constants/index.js.map +1 -0
- package/utils/i18n/helpers/locale-provider.js +9 -0
- package/utils/i18n/helpers/locale-provider.js.map +1 -0
- package/utils/i18n/helpers/to-smart-sentence-case.js +12 -0
- package/utils/i18n/helpers/to-smart-sentence-case.js.map +1 -0
- package/utils/i18n/helpers/to-smart-title-case.js +10 -0
- package/utils/i18n/helpers/to-smart-title-case.js.map +1 -0
- package/utils/i18n/helpers/use-locale.js +14 -0
- package/utils/i18n/helpers/use-locale.js.map +1 -0
- package/utils/i18n/index.d.ts +1 -1
- package/utils/i18n/index.js +41 -0
- package/utils/i18n/index.js.map +1 -0
- package/utils/i18n/index2.js +33 -0
- package/utils/i18n/index2.js.map +1 -0
- package/utils/index.js +7 -7
- package/utils/make-normalizer/index.d.ts +6 -6
- package/utils/make-normalizer/index.js +34 -0
- package/utils/make-normalizer/index.js.map +1 -0
- package/utils/mds-context/index.d.ts +1 -1
- package/{index-DBjAbGt7.js → utils/mds-context/index.js} +20 -19
- package/utils/mds-context/index.js.map +1 -0
- package/index-B9mPJh9w.js +0 -579
- package/index-B9mPJh9w.js.map +0 -1
- package/index-BHBlMMNF.js +0 -16
- package/index-BHBlMMNF.js.map +0 -1
- package/index-C4GBbW3N.js +0 -3567
- package/index-C4GBbW3N.js.map +0 -1
- package/index-DBjAbGt7.js.map +0 -1
- package/index-WkGIywHj.js +0 -767
- package/index-WkGIywHj.js.map +0 -1
- package/use-screen-size-BOnkX_K-.js +0 -9
- package/use-screen-size-BOnkX_K-.js.map +0 -1
|
@@ -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;"}
|
package/components/table/tr.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export interface TRProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
3
3
|
/**
|
|
4
4
|
* Elements passed as children are yielded as inner content of a `<tr>` HTML element.
|
|
@@ -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,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;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, HTMLAttributes, MouseEvent } from 'react';
|
|
2
2
|
export interface TabsProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
onClickTab?: (event: MouseEvent<HTMLButtonElement>, tabIndex: number) => void;
|
|
4
4
|
initialSelectedTabIndex?: number;
|
|
@@ -14,8 +14,8 @@ interface TabsListProps {
|
|
|
14
14
|
declare const Tabs: {
|
|
15
15
|
Provider: ({ children, onClickTab, initialSelectedTabIndex, size, className, ...rest }: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
TabList: ({ children, className }: TabsListProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
Panel: ({ children, className, ...rest }: import(
|
|
18
|
-
Tab: ({ count, icon, isSelected: isInitialTab, children, className, trackingKey, tabIndicatorTheme, ...rest }: import(
|
|
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
19
|
};
|
|
20
20
|
export type { TabsListProps };
|
|
21
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;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
2
|
type TabPanelProps = HTMLAttributes<HTMLDivElement>;
|
|
3
3
|
declare const TabPanel: ({ children, className, ...rest }: TabPanelProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export type { TabPanelProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
3
|
+
import { useId as f, useMemo as o } from "react";
|
|
4
|
+
import u from "classnames";
|
|
5
|
+
import { useTabsContext as I } from "./use-tabs-context.js";
|
|
6
|
+
import x from "./tabs.module.scss.js";
|
|
7
|
+
const y = ({ children: r, className: d, ...l }) => {
|
|
8
|
+
const { panelIds: n, tabIds: t, selectedTabIndex: a, panelNodes: c } = I(), s = "panel-" + f(), e = o(
|
|
9
|
+
() => n.indexOf(s),
|
|
10
|
+
[n, s]
|
|
11
|
+
), i = o(
|
|
12
|
+
() => e > -1 ? t[e] : void 0,
|
|
13
|
+
[t, e]
|
|
14
|
+
), m = o(
|
|
15
|
+
() => e === a,
|
|
16
|
+
[e, a]
|
|
17
|
+
);
|
|
18
|
+
return /* @__PURE__ */ b(
|
|
19
|
+
"section",
|
|
20
|
+
{
|
|
21
|
+
className: u(x.panel, d),
|
|
22
|
+
...l,
|
|
23
|
+
role: "tabpanel",
|
|
24
|
+
"aria-labelledby": i,
|
|
25
|
+
id: s,
|
|
26
|
+
hidden: !m,
|
|
27
|
+
ref: (p) => c.current.push(p),
|
|
28
|
+
children: r
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
y as TabPanel
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=tab-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab-panel.js","sources":["../../../src/components/tabs/tab-panel.tsx"],"sourcesContent":["'use client'\n\nimport { useId, useMemo, type HTMLAttributes } from 'react'\nimport classNames from 'classnames'\nimport { useTabsContext } from './use-tabs-context'\nimport s from './tabs.module.scss'\n\ntype TabPanelProps = HTMLAttributes<HTMLDivElement>\n\nconst TabPanel = ({ children, className, ...rest }: TabPanelProps) => {\n\tconst { panelIds, tabIds, selectedTabIndex, panelNodes } = useTabsContext()\n\tconst panelId = 'panel-' + useId()\n\n\tconst nodeIndex = useMemo(\n\t\t() => panelIds.indexOf(panelId),\n\t\t[panelIds, panelId]\n\t)\n\n\tconst tabId = useMemo(\n\t\t() => (nodeIndex > -1 ? tabIds[nodeIndex] : undefined),\n\t\t[tabIds, nodeIndex]\n\t)\n\n\tconst isSelected = useMemo(\n\t\t() => nodeIndex === selectedTabIndex,\n\t\t[nodeIndex, selectedTabIndex]\n\t)\n\n\treturn (\n\t\t<section\n\t\t\tclassName={classNames(s.panel, className)}\n\t\t\t{...rest}\n\t\t\trole=\"tabpanel\"\n\t\t\taria-labelledby={tabId}\n\t\t\tid={panelId}\n\t\t\thidden={!isSelected}\n\t\t\tref={(el: HTMLDivElement) => panelNodes.current.push(el)}\n\t\t>\n\t\t\t{children}\n\t\t</section>\n\t)\n}\n\nexport type { TabPanelProps }\nexport { TabPanel }\n"],"names":["TabPanel","children","className","rest","panelIds","tabIds","panelNodes","useTabsContext","panelId","useId","useMemo","tabId","nodeIndex","isSelected","selectedTabIndex","jsx","classNames","s","el"],"mappings":";;;;;;AAUC,MAAAA,IAAQ,CAAA,EAAU,UAAAC,GAAQ,WAAAC,GAAA,GAAAC,EAAkB,MAAA;AAC5C,QAAM,EAAA,UAAAC,GAAU,QAAAC,wBAAiB,YAAAC,EAAA,IAAAC,EAAA,GAE3BC,IAAA,WAAYC,EAAA,OACFC;AAAA,IACf,MAACN,EAAU,QAAOI,CAAA;AAAA,IACnB,CAAAJ,GAAAI,CAAA;AAAA,EAEA,GACCG,IAAOD;AAAA,IACP,MAACE,IAAiB,KAAAP,EAAAO,CAAA,IAAA;AAAA,IACnB,CAAAP,GAAAO,CAAA;AAAA,EAEA,GACCC,IAAMH;AAAA,IACN,MAACE,MAAWE;AAAA,IACb,CAAAF,GAAAE,CAAA;AAAA,EAEA;AACC,SAAC,gBAAAC;AAAA,IAAA;AAAA,IAAA;AAAA,MAEC,WAAGC,EAAAC,EAAA,OAAAf,CAAA;AAAA,MACJ,GAAAC;AAAA,MACA,MAAA;AAAA,MACA,mBAAIQ;AAAA,MACJ,IAAAH;AAAA,MACA,QAAM,CAAAK;AAAA,MAEL,KAAA,CAAAK,MAAAZ,EAAA,QAAA,KAAAY,CAAA;AAAA,MAAA,UAAAjB;AAAA,IACF;AAAA,EAEF;;"}
|
package/components/tabs/tab.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { FlightIconName } from '../flight-icon';
|
|
3
3
|
interface TabProps extends HTMLAttributes<HTMLLIElement> {
|
|
4
4
|
tabIndicatorTheme?: 'primary' | 'secondary';
|
|
5
5
|
/**
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r, jsxs as N } from "react/jsx-runtime";
|
|
3
|
+
import c from "classnames";
|
|
4
|
+
import { BadgeCount as z } from "../badge-count/index.js";
|
|
5
|
+
import { useId as T, useMemo as p } from "react";
|
|
6
|
+
import { useTabsContext as j } from "./use-tabs-context.js";
|
|
7
|
+
import { FlightIcon as k } from "../flight-icon/index.js";
|
|
8
|
+
import o from "./tabs.module.scss.js";
|
|
9
|
+
const M = ({
|
|
10
|
+
count: n,
|
|
11
|
+
icon: i,
|
|
12
|
+
isSelected: b,
|
|
13
|
+
children: y,
|
|
14
|
+
className: u,
|
|
15
|
+
trackingKey: f,
|
|
16
|
+
tabIndicatorTheme: g = "primary",
|
|
17
|
+
...x
|
|
18
|
+
}) => {
|
|
19
|
+
const { tabNodes: h, tabIds: d, selectedTabIndex: m, onClick: I, onKeyUp: C, size: l } = j(), s = "tab-" + T(), t = p(() => d.indexOf(s), [d, s]), a = p(
|
|
20
|
+
() => t === m,
|
|
21
|
+
[t, m]
|
|
22
|
+
);
|
|
23
|
+
return /* @__PURE__ */ r(
|
|
24
|
+
"li",
|
|
25
|
+
{
|
|
26
|
+
className: c(
|
|
27
|
+
o.tab,
|
|
28
|
+
o[g],
|
|
29
|
+
{
|
|
30
|
+
[o.selected]: a
|
|
31
|
+
},
|
|
32
|
+
u
|
|
33
|
+
),
|
|
34
|
+
...x,
|
|
35
|
+
role: "presentation",
|
|
36
|
+
children: /* @__PURE__ */ N(
|
|
37
|
+
"button",
|
|
38
|
+
{
|
|
39
|
+
className: c(
|
|
40
|
+
o["tab-button"],
|
|
41
|
+
"mds-typography-font-weight-medium",
|
|
42
|
+
{
|
|
43
|
+
"mds-typography-legacy-body-200": l === "medium",
|
|
44
|
+
"mds-typography-legacy-body-300": l === "large"
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
role: "tab",
|
|
48
|
+
type: "button",
|
|
49
|
+
id: s,
|
|
50
|
+
"aria-selected": a,
|
|
51
|
+
tabIndex: a ? void 0 : -1,
|
|
52
|
+
onClick: (e) => I(t, e),
|
|
53
|
+
onKeyUp: (e) => C(t, e),
|
|
54
|
+
"data-is-selected": b,
|
|
55
|
+
"data-analytics": f,
|
|
56
|
+
ref: (e) => h.current.push(e),
|
|
57
|
+
children: [
|
|
58
|
+
i && /* @__PURE__ */ r(k, { name: i, size: 16, role: "presentation" }),
|
|
59
|
+
y,
|
|
60
|
+
n && /* @__PURE__ */ r(z, { text: n, size: "small", role: "presentation" })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
M as Tab
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab.js","sources":["../../../src/components/tabs/tab.tsx"],"sourcesContent":["'use client'\n\nimport classNames from 'classnames'\nimport { BadgeCount } from '../badge-count'\nimport { useId, type HTMLAttributes, useMemo } from 'react'\nimport { useTabsContext } from './use-tabs-context'\nimport type { FlightIconName } from '../flight-icon'\nimport { FlightIcon } from '../flight-icon'\nimport s from './tabs.module.scss'\n\ninterface TabProps extends HTMLAttributes<HTMLLIElement> {\n\ttabIndicatorTheme?: 'primary' | 'secondary'\n\t/**\n\t * Displays a count indicator in the tab. Accepts the text value that should go in Badge Count. (optional)\n\t */\n\tcount?: string\n\t/**\n\t * Displays an icon in the tab. (optional)\n\t */\n\ticon?: FlightIconName\n\t/**\n\t * Customizes the initial tab to display when the page is loaded. The first tab is selected on page load by default. (optional)\n\t */\n\tisSelected?: boolean\n\t/**\n\t * Used to append analytics and tracking related data attributes to any interactive element internal to this component.\n\t */\n\ttrackingKey?: string\n}\n\nconst Tab = ({\n\tcount,\n\ticon,\n\tisSelected: isInitialTab,\n\tchildren,\n\tclassName,\n\ttrackingKey,\n\ttabIndicatorTheme = 'primary',\n\t...rest\n}: TabProps) => {\n\tconst { tabNodes, tabIds, selectedTabIndex, onClick, onKeyUp, size } =\n\t\tuseTabsContext()\n\tconst tabId = 'tab-' + useId()\n\n\tconst nodeIndex = useMemo(() => tabIds.indexOf(tabId), [tabIds, tabId])\n\n\tconst isSelected = useMemo(\n\t\t() => nodeIndex === selectedTabIndex,\n\t\t[nodeIndex, selectedTabIndex]\n\t)\n\n\treturn (\n\t\t<li\n\t\t\tclassName={classNames(\n\t\t\t\ts.tab,\n\t\t\t\ts[tabIndicatorTheme],\n\t\t\t\t{\n\t\t\t\t\t[s.selected]: isSelected,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...rest}\n\t\t\trole=\"presentation\"\n\t\t>\n\t\t\t<button\n\t\t\t\tclassName={classNames(\n\t\t\t\t\ts['tab-button'],\n\t\t\t\t\t'mds-typography-font-weight-medium',\n\t\t\t\t\t{\n\t\t\t\t\t\t['mds-typography-legacy-body-200']: size === 'medium',\n\t\t\t\t\t\t['mds-typography-legacy-body-300']: size === 'large',\n\t\t\t\t\t}\n\t\t\t\t)}\n\t\t\t\trole=\"tab\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tid={tabId}\n\t\t\t\taria-selected={isSelected}\n\t\t\t\ttabIndex={!isSelected ? -1 : undefined}\n\t\t\t\tonClick={(e) => onClick(nodeIndex, e)}\n\t\t\t\tonKeyUp={(e) => onKeyUp(nodeIndex, e)}\n\t\t\t\tdata-is-selected={isInitialTab}\n\t\t\t\tdata-analytics={trackingKey}\n\t\t\t\tref={(el: HTMLButtonElement) => tabNodes.current.push(el)}\n\t\t\t>\n\t\t\t\t{icon && <FlightIcon name={icon} size={16} role=\"presentation\" />}\n\n\t\t\t\t{children}\n\n\t\t\t\t{count && <BadgeCount text={count} size=\"small\" role=\"presentation\" />}\n\t\t\t</button>\n\t\t</li>\n\t)\n}\n\nexport type { TabProps }\nexport { Tab }\n"],"names":["Tab","count","icon","isInitialTab","children","className","trackingKey","tabIndicatorTheme","rest","tabNodes","tabIds","onClick","onKeyUp","size","useTabsContext","tabId","nodeIndex","useMemo","isSelected","selectedTabIndex","jsx","classNames","s","jsxs","el","FlightIcon","BadgeCount"],"mappings":";;;;;;;;AA8Ba,MACZA,IAAA,CAAA;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,mBAAAC,IAAG;AAAA,EACJ,GAAAC;AACC;AAEA,QAAM,EAAA,UAAAC,GAAQ,QAAAC,wBAAe,SAAAC,GAAA,SAAAC,GAAA,MAAAC,EAAA,IAAAC,EAAA,GAEvBC,IAAA,WAAoB,GAEpBC,IAAAC,EAAa,MAAAP,EAAA,QAAAK,CAAA,GAAA,CAAAL,GAAAK,CAAA,CAAA,GAClBG,IAAMD;AAAA,IACN,MAACD,MAAWG;AAAA,IACb,CAAAH,GAAAG,CAAA;AAAA,EAEA;AACC,SAAC,gBAAAC;AAAA,IAAA;AAAA,IAAA;AAAA,MACW,WACRC;AAAA,QACFC,EAAE;AAAA,QACFA,EAAAf,CAAA;AAAA,QAAA;AAAA,UAEA,CAAAe,EAAA,QAAA,GAAAJ;AAAA,QACA;AAAA,QACDb;AAAA,MACC;AAAA,MACD,GAAAG;AAAA,MAEA,MAAA;AAAA,MAAA,UAAC,gBAAAe;AAAA,QAAA;AAAA,QAAA;AAAA,UACW,WACRF;AAAA,YACFC,EAAA,YAAA;AAAA,YACA;AAAA,YAAA;AAAA,cAEE,kCAAmCT,MAAS;AAAA,cAAA,kCAAAA,MAAA;AAAA,YAE/C;AAAA,UACA;AAAA,UACA,MAAK;AAAA,UACL,MAAI;AAAA,UACJ,IAAAE;AAAA,UACA;UACA,UAAUG,IAAc,SAAA;AAAA,UACxB,SAAS,CAAC,MAAMP,EAAQK,GAAW,CAAC;AAAA,UACpC,SAAA,CAAA,MAAAJ,EAAkBI,GAAA,CAAA;AAAA,UAClB,oBAAgBb;AAAA,UAChB,kBAAgCG;AAAA,UAE/B,YAAAG,EAAA,QAAA,KAAAe,CAAA;AAAA,UAAA,UAAA;AAAA,YAEAtB,KAAA,gBAAAkB,EAAAK,GAAA,EAAA,MAAAvB,GAAA,MAAA,IAAA,MAAA,eAAA,CAAA;AAAA,YAEAE;AAAA,YAAmEH,KAAA,gBAAAmB,EAAAM,GAAA,EAAA,MAAAzB,GAAA,MAAA,SAAA,MAAA,eAAA,CAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACrE;AAAA,IACD;AAAA,EAEF;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const t = "tablist__sKiEs", a = "tab__qi523", s = "primary__iGc9C", e = "selected__SVr0E", n = "indicator__OHxre", r = "secondary__qlHsL", c = "panel__G8tI0", _ = {
|
|
2
|
+
"tablist-wrapper": "tablist-wrapper__nF28e",
|
|
3
|
+
tablist: t,
|
|
4
|
+
tab: a,
|
|
5
|
+
primary: s,
|
|
6
|
+
selected: e,
|
|
7
|
+
indicator: n,
|
|
8
|
+
secondary: r,
|
|
9
|
+
"tab-button": "tab-button__qI9wt",
|
|
10
|
+
panel: c
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
_ as default,
|
|
14
|
+
n as indicator,
|
|
15
|
+
c as panel,
|
|
16
|
+
s as primary,
|
|
17
|
+
r as secondary,
|
|
18
|
+
e as selected,
|
|
19
|
+
a as tab,
|
|
20
|
+
t as tablist
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=tabs.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MutableRefObject, MouseEvent, KeyboardEvent } from 'react';
|
|
2
2
|
interface TabsContextState {
|
|
3
3
|
tabNodes: MutableRefObject<Array<HTMLButtonElement>>;
|
|
4
4
|
panelNodes: MutableRefObject<Array<HTMLDivElement>>;
|
|
@@ -10,6 +10,6 @@ interface TabsContextState {
|
|
|
10
10
|
size: 'medium' | 'large';
|
|
11
11
|
tabsListRef: MutableRefObject<HTMLUListElement | null>;
|
|
12
12
|
}
|
|
13
|
-
export declare const TabsContext: import(
|
|
13
|
+
export declare const TabsContext: import('react').Context<TabsContextState | undefined>;
|
|
14
14
|
export declare function useTabsContext(): TabsContextState;
|
|
15
15
|
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext as e, useContext as o } from "react";
|
|
3
|
+
const n = e(
|
|
4
|
+
void 0
|
|
5
|
+
);
|
|
6
|
+
function s() {
|
|
7
|
+
const t = o(n);
|
|
8
|
+
if (t === void 0)
|
|
9
|
+
throw new Error("useTabsContext must be used within a TabsContext.Provider");
|
|
10
|
+
return t;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
n as TabsContext,
|
|
14
|
+
s as useTabsContext
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=use-tabs-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tabs-context.js","sources":["../../../src/components/tabs/use-tabs-context.ts"],"sourcesContent":["'use client'\n\nimport {\n\ttype MutableRefObject,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n\tcreateContext,\n\tuseContext,\n} from 'react'\n\ninterface TabsContextState {\n\ttabNodes: MutableRefObject<Array<HTMLButtonElement>>\n\tpanelNodes: MutableRefObject<Array<HTMLDivElement>>\n\ttabIds: Array<string>\n\tpanelIds: Array<string>\n\tselectedTabIndex: number\n\tonClick: (tabIndex: number, event: MouseEvent<HTMLButtonElement>) => void\n\tonKeyUp: (tabIndex: number, event: KeyboardEvent<HTMLButtonElement>) => void\n\tsize: 'medium' | 'large'\n\ttabsListRef: MutableRefObject<HTMLUListElement | null>\n}\n\nexport const TabsContext = createContext<TabsContextState | undefined>(\n\tundefined\n)\n\nexport function useTabsContext(): TabsContextState {\n\tconst context = useContext(TabsContext)\n\tif (context === undefined) {\n\t\tthrow new Error('useTabsContext must be used within a TabsContext.Provider')\n\t}\n\treturn context\n}\n"],"names":["TabsContext","createContext","useTabsContext","context","useContext"],"mappings":";;AAsB2B,MAC1BA,IAAAC;AAAA,EACD;AAEO;AACN,SAAMC,IAAU;AAChB,QAAIC,IAAYC,EAAWJ,CAAA;AAC1B,MAAAG,MAAU;AACX,UAAA,IAAA,MAAA,2DAAA;AAED,SAAAA;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
2
|
declare const TEXT_COLORS: readonly ["primary", "strong", "faint", "disabled", "high-contrast", "action", "action-hover", "action-active", "highlight", "highlight-on-surface", "highlight-high-contrast", "success", "success-on-surface", "success-high-contrast", "warning", "warning-on-surface", "warning-high-contrast", "critical", "critical-on-surface", "critical-high-contrast"];
|
|
3
3
|
declare const TEXT_GROUPS: readonly ["hds-body", "code", "body", "display-expressive", "label"];
|
|
4
4
|
declare const TEXT_SIZES: readonly ["100", "200", "300", "400", "500", "600", "700", "800"];
|
|
@@ -35,10 +35,10 @@ interface CodeProps<T extends ElementType> extends BaseTextProps<T> {
|
|
|
35
35
|
size?: '100' | '200' | '300';
|
|
36
36
|
}
|
|
37
37
|
declare const Text: {
|
|
38
|
-
Body: <T extends ElementType
|
|
39
|
-
DisplayExpressive: <
|
|
40
|
-
Label: <
|
|
41
|
-
HDSBody: <
|
|
42
|
-
Code: <
|
|
38
|
+
Body: <T extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, ...rest }: BodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof BodyProps<T>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
|
|
39
|
+
DisplayExpressive: <T_2 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, ...rest }: DisplayExpressiveProps<T_2> & Omit<ComponentPropsWithRef<T_2>, keyof DisplayExpressiveProps<T_2>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
|
|
40
|
+
Label: <T_3 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>(props: LabelProps<T_3> & Omit<ComponentPropsWithRef<T_3>, "className" | "color" | "tag" | "weight" | "align">) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
|
|
41
|
+
HDSBody: <T_4 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, weight, ...rest }: HDSBodyProps<T_4> & Omit<ComponentPropsWithRef<T_4>, keyof HDSBodyProps<T_4>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
|
|
42
|
+
Code: <T_5 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, weight, ...rest }: CodeProps<T_5> & Omit<ComponentPropsWithRef<T_5>, keyof CodeProps<T_5>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
|
|
43
43
|
};
|
|
44
44
|
export { Text, TEXT_COLORS, TEXT_WEIGHTS };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import l from "classnames";
|
|
3
|
+
import { createElement as e } from "react";
|
|
4
|
+
import m from "./style.module.scss.js";
|
|
5
|
+
const b = [
|
|
6
|
+
"primary",
|
|
7
|
+
"strong",
|
|
8
|
+
"faint",
|
|
9
|
+
"disabled",
|
|
10
|
+
"high-contrast",
|
|
11
|
+
"action",
|
|
12
|
+
"action-hover",
|
|
13
|
+
"action-active",
|
|
14
|
+
"highlight",
|
|
15
|
+
"highlight-on-surface",
|
|
16
|
+
"highlight-high-contrast",
|
|
17
|
+
"success",
|
|
18
|
+
"success-on-surface",
|
|
19
|
+
"success-high-contrast",
|
|
20
|
+
"warning",
|
|
21
|
+
"warning-on-surface",
|
|
22
|
+
"warning-high-contrast",
|
|
23
|
+
"critical",
|
|
24
|
+
"critical-on-surface",
|
|
25
|
+
"critical-high-contrast"
|
|
26
|
+
], B = ["regular", "medium", "semibold", "bold"];
|
|
27
|
+
function f(r, o) {
|
|
28
|
+
return {
|
|
29
|
+
"hds-body": `mds-typography-legacy-body-${o}`,
|
|
30
|
+
code: `mds-typography-code-${o}`,
|
|
31
|
+
"display-expressive": `mds-typography-display-expressive-${o}`,
|
|
32
|
+
label: "mds-typography-label",
|
|
33
|
+
body: `mds-typography-body-${o}`
|
|
34
|
+
}[r];
|
|
35
|
+
}
|
|
36
|
+
const n = ({
|
|
37
|
+
tag: r,
|
|
38
|
+
group: o,
|
|
39
|
+
size: s = "200",
|
|
40
|
+
weight: a,
|
|
41
|
+
align: c,
|
|
42
|
+
color: t,
|
|
43
|
+
children: p,
|
|
44
|
+
className: g,
|
|
45
|
+
...d
|
|
46
|
+
}) => {
|
|
47
|
+
const h = r ?? "span", u = f(o, s), i = b.includes(t);
|
|
48
|
+
return /* @__PURE__ */ y(
|
|
49
|
+
h,
|
|
50
|
+
{
|
|
51
|
+
className: l(
|
|
52
|
+
u,
|
|
53
|
+
{
|
|
54
|
+
[m[`align-${c}`]]: c,
|
|
55
|
+
[`mds-typography-font-weight-${a}`]: a,
|
|
56
|
+
[`mds-foreground-${t}`]: t && i
|
|
57
|
+
},
|
|
58
|
+
g
|
|
59
|
+
),
|
|
60
|
+
style: t && !i ? { color: t } : {},
|
|
61
|
+
...d,
|
|
62
|
+
children: p
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}, T = ({
|
|
66
|
+
size: r = "300",
|
|
67
|
+
...o
|
|
68
|
+
}) => e(n, {
|
|
69
|
+
...o,
|
|
70
|
+
size: r,
|
|
71
|
+
group: "body"
|
|
72
|
+
}), x = ({
|
|
73
|
+
size: r = "200",
|
|
74
|
+
...o
|
|
75
|
+
}) => e(n, {
|
|
76
|
+
...o,
|
|
77
|
+
size: r,
|
|
78
|
+
group: "display-expressive"
|
|
79
|
+
}), v = (r) => e(n, {
|
|
80
|
+
...r,
|
|
81
|
+
group: "label"
|
|
82
|
+
}), $ = ({
|
|
83
|
+
size: r = "200",
|
|
84
|
+
weight: o = "regular",
|
|
85
|
+
...s
|
|
86
|
+
}) => e(n, {
|
|
87
|
+
...s,
|
|
88
|
+
size: r,
|
|
89
|
+
weight: o,
|
|
90
|
+
group: "hds-body"
|
|
91
|
+
}), E = ({
|
|
92
|
+
size: r = "200",
|
|
93
|
+
weight: o = "regular",
|
|
94
|
+
...s
|
|
95
|
+
}) => e(n, {
|
|
96
|
+
...s,
|
|
97
|
+
size: r,
|
|
98
|
+
weight: o,
|
|
99
|
+
group: "code"
|
|
100
|
+
}), D = {
|
|
101
|
+
Body: T,
|
|
102
|
+
DisplayExpressive: x,
|
|
103
|
+
Label: v,
|
|
104
|
+
HDSBody: $,
|
|
105
|
+
Code: E
|
|
106
|
+
};
|
|
107
|
+
export {
|
|
108
|
+
b as TEXT_COLORS,
|
|
109
|
+
B as TEXT_WEIGHTS,
|
|
110
|
+
D as Text
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/text/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport {\n\tcreateElement,\n\ttype ComponentPropsWithRef,\n\ttype ElementType,\n} from 'react'\nimport s from './style.module.scss'\n\nconst TEXT_COLORS = [\n\t'primary',\n\t'strong',\n\t'faint',\n\t'disabled',\n\t'high-contrast',\n\t'action',\n\t'action-hover',\n\t'action-active',\n\t'highlight',\n\t'highlight-on-surface',\n\t'highlight-high-contrast',\n\t'success',\n\t'success-on-surface',\n\t'success-high-contrast',\n\t'warning',\n\t'warning-on-surface',\n\t'warning-high-contrast',\n\t'critical',\n\t'critical-on-surface',\n\t'critical-high-contrast',\n] as const\n\nconst TEXT_GROUPS = [\n\t'hds-body',\n\t'code',\n\t'body',\n\t'display-expressive',\n\t'label',\n] as const\n\nconst TEXT_SIZES = [\n\t'100',\n\t'200',\n\t'300',\n\t'400',\n\t'500',\n\t'600',\n\t'700',\n\t'800',\n] as const\n\nconst TEXT_WEIGHTS = ['regular', 'medium', 'semibold', 'bold'] as const\n\ntype TextColor = (typeof TEXT_COLORS)[number]\ntype TextWeight = (typeof TEXT_WEIGHTS)[number]\ntype TextGroup = (typeof TEXT_GROUPS)[number]\ntype TextSize = (typeof TEXT_SIZES)[number]\n\n// small typescript hack to support autocomplete and arbitrary strings\ntype HexColor = string & { hexish?: unknown }\n\ninterface BaseTextProps<T extends ElementType> {\n\ttag?: T\n\tsize?: TextSize\n\tweight?: TextWeight\n\talign?: 'left' | 'center' | 'right'\n\tcolor?: TextColor | HexColor\n\tclassName?: string\n}\n\ninterface TextImplProps<T extends ElementType> extends BaseTextProps<T> {\n\tgroup: TextGroup\n}\n\nfunction getTypographyToken(group: TextGroup, size: TextSize): string {\n\tconst groupToTokenMap: Record<TextGroup, string> = {\n\t\t'hds-body': `mds-typography-legacy-body-${size}`,\n\t\tcode: `mds-typography-code-${size}`,\n\t\t'display-expressive': `mds-typography-display-expressive-${size}`,\n\t\tlabel: `mds-typography-label`,\n\t\tbody: `mds-typography-body-${size}`,\n\t}\n\n\treturn groupToTokenMap[group]\n}\n\nconst TextImpl = <T extends ElementType = 'span'>({\n\ttag,\n\tgroup,\n\tsize = '200',\n\tweight,\n\talign,\n\tcolor,\n\tchildren,\n\tclassName,\n\t...rest\n}: TextImplProps<T> &\n\tOmit<ComponentPropsWithRef<T>, keyof TextImplProps<T>>) => {\n\tconst Component = tag ?? 'span'\n\tconst variant = getTypographyToken(group, size)\n\n\tconst usesPredefinedColor = TEXT_COLORS.includes(color as TextColor)\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={classNames(\n\t\t\t\tvariant,\n\t\t\t\t{\n\t\t\t\t\t[s[`align-${align}`]]: align,\n\t\t\t\t\t[`mds-typography-font-weight-${weight}`]: weight,\n\t\t\t\t\t[`mds-foreground-${color}`]: color && usesPredefinedColor,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={color && !usesPredefinedColor ? { color } : {}}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{children}\n\t\t</Component>\n\t)\n}\n\ninterface BodyProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '200' | '300' | '400'\n}\n\nconst Body = <T extends ElementType>({\n\tsize = '300',\n\t...rest\n}: BodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof BodyProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tgroup: 'body',\n\t})\n}\n\ninterface DisplayExpressiveProps<T extends ElementType>\n\textends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800'\n}\n\nconst DisplayExpressive = <T extends ElementType>({\n\tsize = '200',\n\t...rest\n}: DisplayExpressiveProps<T> &\n\tOmit<ComponentPropsWithRef<T>, keyof DisplayExpressiveProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tgroup: 'display-expressive',\n\t})\n}\n\ntype LabelProps<T extends ElementType> = Omit<BaseTextProps<T>, 'size'>\n\nconst Label = <T extends ElementType>(\n\tprops: LabelProps<T> & Omit<ComponentPropsWithRef<T>, keyof LabelProps<T>>\n) => {\n\treturn createElement(TextImpl, {\n\t\t...props,\n\t\tgroup: 'label',\n\t})\n}\n\ninterface HDSBodyProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300'\n}\n\nconst HDSBody = <T extends ElementType>({\n\tsize = '200',\n\tweight = 'regular',\n\t...rest\n}: HDSBodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof HDSBodyProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tweight,\n\t\tgroup: 'hds-body',\n\t})\n}\n\ninterface CodeProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300'\n}\n\nconst Code = <T extends ElementType>({\n\tsize = '200',\n\tweight = 'regular',\n\t...rest\n}: CodeProps<T> & Omit<ComponentPropsWithRef<T>, keyof CodeProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tweight,\n\t\tgroup: 'code',\n\t})\n}\n\nconst Text = {\n\tBody,\n\tDisplayExpressive,\n\tLabel,\n\tHDSBody,\n\tCode,\n}\n\nexport { Text, TEXT_COLORS, TEXT_WEIGHTS }\n"],"names":["TEXT_COLORS","TEXT_WEIGHTS","getTypographyToken","group","size","TextImpl","tag","weight","align","color","children","className","rest","Component","variant","usesPredefinedColor","jsx","classNames","s","Body","createElement","DisplayExpressive","Label","props","HDSBody","Code","Text"],"mappings":";;;;AAQA,MAAMA,IAAc;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAqBMC,IAAe,CAAC,WAAW,UAAU,YAAY,MAAM;AAuB7D,SAASC,EAAmBC,GAAkBC,GAAwB;AASrE,SARmD;AAAA,IAClD,YAAY,8BAA8BA,CAAI;AAAA,IAC9C,MAAM,uBAAuBA,CAAI;AAAA,IACjC,sBAAsB,qCAAqCA,CAAI;AAAA,IAC/D,OAAO;AAAA,IACP,MAAM,uBAAuBA,CAAI;AAAA,EAAA,EAGXD,CAAK;AAC7B;AAEA,MAAME,IAAW,CAAiC;AAAA,EACjD,KAAAC;AAAA,EACA,OAAAH;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAG;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAC4D;AAC3D,QAAMC,IAAYP,KAAO,QACnBQ,IAAUZ,EAAmBC,GAAOC,CAAI,GAExCW,IAAsBf,EAAY,SAASS,CAAkB;AAEnE,SACC,gBAAAO;AAAA,IAACH;AAAA,IAAA;AAAA,MACA,WAAWI;AAAA,QACVH;AAAA,QACA;AAAA,UACC,CAACI,EAAE,SAASV,CAAK,EAAE,CAAC,GAAGA;AAAA,UACvB,CAAC,8BAA8BD,CAAM,EAAE,GAAGA;AAAA,UAC1C,CAAC,kBAAkBE,CAAK,EAAE,GAAGA,KAASM;AAAA,QAAA;AAAA,QAEvCJ;AAAA,MAAA;AAAA,MAED,OAAOF,KAAS,CAACM,IAAsB,EAAE,OAAAN,EAAA,IAAU,CAAA;AAAA,MAClD,GAAGG;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGJ,GAMMS,IAAO,CAAwB;AAAA,EACpC,MAAAf,IAAO;AAAA,EACP,GAAGQ;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,OAAO;AAAA,CACP,GAQIiB,IAAoB,CAAwB;AAAA,EACjD,MAAAjB,IAAO;AAAA,EACP,GAAGQ;AACJ,MAEQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,OAAO;AAAA,CACP,GAKIkB,IAAQ,CACbC,MAEOH,EAAcf,GAAU;AAAA,EAC9B,GAAGkB;AAAA,EACH,OAAO;AAAA,CACP,GAOIC,IAAU,CAAwB;AAAA,EACvC,MAAApB,IAAO;AAAA,EACP,QAAAG,IAAS;AAAA,EACT,GAAGK;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,QAAAG;AAAA,EACA,OAAO;AAAA,CACP,GAOIkB,IAAO,CAAwB;AAAA,EACpC,MAAArB,IAAO;AAAA,EACP,QAAAG,IAAS;AAAA,EACT,GAAGK;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,QAAAG;AAAA,EACA,OAAO;AAAA,CACP,GAGImB,IAAO;AAAA,EACZ,MAAAP;AAAA,EACA,mBAAAE;AAAA,EACA,OAAAC;AAAA,EACA,SAAAE;AAAA,EACA,MAAAC;AACD;"}
|