@hashicorp/mds-react 0.9.3 → 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.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.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.js +34 -0
- package/components/alert/icon.js.map +1 -0
- package/components/alert/index.js +97 -0
- package/components/alert/index.js.map +1 -0
- 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.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.js +38 -0
- package/components/breadcrumbs/index.js.map +1 -0
- 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.js +25 -0
- package/components/breadcrumbs/truncation-button/index.js.map +1 -0
- package/components/button/index.d.ts +2 -1
- 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.js +23 -0
- package/components/card/card-thumbnail/index.js.map +1 -0
- package/components/card/index.d.ts +2 -1
- 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 +1 -0
- 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.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.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.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.js +13 -0
- package/components/code-block/hidden-copy-content/index.js.map +1 -0
- 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.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.js +15 -0
- package/components/dialog-primitive/index.js.map +1 -0
- 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.js +17 -0
- package/components/disclosure-primitive/use-disclosure-primitive.js.map +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.js +79 -0
- package/components/dropdown/index.js.map +1 -0
- 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.js +14 -0
- package/components/dropdown/list-item/index.js.map +1 -0
- 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.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.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.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.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.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.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.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.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.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.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.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.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.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.js +31 -0
- package/components/form/radio-card/group.js.map +1 -0
- 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.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.js +170 -0
- package/components/form/super-select/index.js.map +1 -0
- 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.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.js +102 -0
- package/components/form/toggle/index.js.map +1 -0
- package/components/hds/wrappers/tooltip.js +51 -0
- package/components/hds/wrappers/tooltip.js.map +1 -0
- 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.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.js +59 -0
- package/components/interactive/index.js.map +1 -0
- package/components/legacy-button/index.js +65 -0
- package/components/legacy-button/index.js.map +1 -0
- package/components/legacy-button/utils.js +39 -0
- package/components/legacy-button/utils.js.map +1 -0
- 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.js +17 -0
- package/components/menu-primitive/use-menu-primitive.js.map +1 -0
- 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.js +17 -0
- package/components/modal/use-modal.js.map +1 -0
- 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.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.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.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.js +43 -0
- package/components/table/th.js.map +1 -0
- 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.js +117 -0
- package/components/tabs/index.js.map +1 -0
- package/components/tabs/tab-panel.js +35 -0
- package/components/tabs/tab-panel.js.map +1 -0
- 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.js +16 -0
- package/components/tabs/use-tabs-context.js.map +1 -0
- 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.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.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.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.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.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.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.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.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.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.js +77 -0
- package/patterns/card/primitives.js.map +1 -0
- 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.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.js +25 -0
- package/patterns/card/thumbnails/index.js.map +1 -0
- package/patterns/card/unified-card/index.js +37 -0
- package/patterns/card/unified-card/index.js.map +1 -0
- package/patterns/copy-button/clipboard.js +78 -0
- package/patterns/copy-button/clipboard.js.map +1 -0
- 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.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.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.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/style.css +1 -1
- 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.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.js +34 -0
- package/utils/make-normalizer/index.js.map +1 -0
- 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,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, Fragment as x, jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { useState as m, useCallback as c, useMemo as y, useEffect as h } from "react";
|
|
4
|
+
import k from "react-focus-lock";
|
|
5
|
+
import { Dialog as p } from "../dialog-primitive/index.js";
|
|
6
|
+
import { ModalContext as E } from "./use-modal.js";
|
|
7
|
+
import { useModal as I } from "./use-modal.js";
|
|
8
|
+
import D from "./modal.module.css.js";
|
|
9
|
+
const L = ({
|
|
10
|
+
onClose: s,
|
|
11
|
+
initialIsOpen: f = !1,
|
|
12
|
+
initialModalContent: u = null,
|
|
13
|
+
children: v
|
|
14
|
+
}) => {
|
|
15
|
+
const [r, a] = m(
|
|
16
|
+
u
|
|
17
|
+
), [e, t] = m(f), o = c(() => {
|
|
18
|
+
t(!1), a(null), s && s();
|
|
19
|
+
}, [t, s]), i = c(
|
|
20
|
+
(n) => {
|
|
21
|
+
a(n), t(!0);
|
|
22
|
+
},
|
|
23
|
+
[t]
|
|
24
|
+
), M = y(
|
|
25
|
+
() => ({
|
|
26
|
+
isOpen: e,
|
|
27
|
+
openModal: i,
|
|
28
|
+
modalContent: r,
|
|
29
|
+
closeModal: o
|
|
30
|
+
}),
|
|
31
|
+
[e, i, o, r]
|
|
32
|
+
);
|
|
33
|
+
return h(() => {
|
|
34
|
+
const n = (w) => {
|
|
35
|
+
w.key === "Escape" && e && o();
|
|
36
|
+
};
|
|
37
|
+
return e && window.addEventListener("keydown", n), () => {
|
|
38
|
+
e && window.removeEventListener("keydown", n);
|
|
39
|
+
};
|
|
40
|
+
}, [e, o]), /* @__PURE__ */ d(E.Provider, { value: M, children: [
|
|
41
|
+
v,
|
|
42
|
+
e && r && /* @__PURE__ */ d(x, { children: [
|
|
43
|
+
/* @__PURE__ */ l(k, { children: /* @__PURE__ */ l(
|
|
44
|
+
p.Wrapper,
|
|
45
|
+
{
|
|
46
|
+
onDismiss: o,
|
|
47
|
+
className: D.modal,
|
|
48
|
+
open: e,
|
|
49
|
+
children: r
|
|
50
|
+
}
|
|
51
|
+
) }),
|
|
52
|
+
/* @__PURE__ */ l(p.Overlay, {})
|
|
53
|
+
] })
|
|
54
|
+
] });
|
|
55
|
+
};
|
|
56
|
+
L.displayName = "ModalProvider";
|
|
57
|
+
export {
|
|
58
|
+
L as ModalProvider,
|
|
59
|
+
I as useModal
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/modal/index.tsx"],"sourcesContent":["'use client'\n\nimport { useMemo, useState, useCallback, useEffect } from 'react'\nimport FocusLock from 'react-focus-lock'\nimport { Dialog } from '../dialog-primitive'\nimport { ModalContext, useModal } from './use-modal'\nimport type { ReactNode } from 'react'\nimport type { ModalContextState } from './use-modal'\nimport s from './modal.module.css'\n\ninterface ModalProps {\n\tinitialIsOpen?: boolean\n\tinitialModalContent?: ReactNode\n\tonClose?: () => void\n\tchildren: ReactNode\n}\n\nconst ModalProvider = ({\n\tonClose,\n\tinitialIsOpen = false,\n\tinitialModalContent = null,\n\tchildren,\n}: ModalProps) => {\n\tconst [modalContent, setModalContent] = useState<ReactNode | null>(\n\t\tinitialModalContent\n\t)\n\tconst [isOpen, setIsOpen] = useState(initialIsOpen)\n\n\tconst closeModal = useCallback(() => {\n\t\tsetIsOpen(false)\n\t\tsetModalContent(null)\n\t\tif (onClose) {\n\t\t\tonClose()\n\t\t}\n\t}, [setIsOpen, onClose])\n\n\tconst openModal = useCallback(\n\t\t(content: ReactNode) => {\n\t\t\tsetModalContent(content)\n\t\t\tsetIsOpen(true)\n\t\t},\n\t\t[setIsOpen]\n\t)\n\n\tconst contextValue: ModalContextState = useMemo(\n\t\t() => ({\n\t\t\tisOpen,\n\t\t\topenModal,\n\t\t\tmodalContent,\n\t\t\tcloseModal,\n\t\t}),\n\t\t[isOpen, openModal, closeModal, modalContent]\n\t)\n\n\tuseEffect(() => {\n\t\tconst handleKeyDown = (event: KeyboardEvent) => {\n\t\t\tif (event.key === 'Escape' && isOpen) {\n\t\t\t\tcloseModal()\n\t\t\t}\n\t\t}\n\t\tif (isOpen) {\n\t\t\twindow.addEventListener('keydown', handleKeyDown)\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (isOpen) {\n\t\t\t\twindow.removeEventListener('keydown', handleKeyDown)\n\t\t\t}\n\t\t}\n\t}, [isOpen, closeModal])\n\n\treturn (\n\t\t<ModalContext.Provider value={contextValue}>\n\t\t\t{children}\n\t\t\t{isOpen && modalContent && (\n\t\t\t\t<>\n\t\t\t\t\t<FocusLock>\n\t\t\t\t\t\t<Dialog.Wrapper\n\t\t\t\t\t\t\tonDismiss={closeModal}\n\t\t\t\t\t\t\tclassName={s.modal}\n\t\t\t\t\t\t\topen={isOpen}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{modalContent}\n\t\t\t\t\t\t</Dialog.Wrapper>\n\t\t\t\t\t</FocusLock>\n\t\t\t\t\t<Dialog.Overlay />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</ModalContext.Provider>\n\t)\n}\n\nModalProvider.displayName = 'ModalProvider'\n\nexport { useModal, ModalProvider }\n"],"names":["ModalProvider","onClose","initialIsOpen","initialModalContent","children","modalContent","setModalContent","useState","isOpen","setIsOpen","closeModal","useCallback","content","contextValue","useMemo","openModal","useEffect","handleKeyDown","event","jsxs","ModalContext","jsx","FocusLock","Dialog","s"],"mappings":";;;;;;;;AAiBuB,MACtBA,IAAA,CAAA;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC,IAAA;AAAA,EACA,qBAAAC,IAAA;AAAA,EACD,UAAAC;AACC;AAAwC,QACvC,CAAAC,GAAAC,CAAA,IAAAC;AAAA,IACDJ;AAAA,EACA,GAEM,CAAAK,GAAAC,CAAa,IAAAF,EAAkBL,CAAA,GACpCQ,IAAeC,EAAA,MAAA;AACf,IAAAF,EAAA,EAAA,GACAH,EAAa,IAAA,QAEbL,EAAA;AAAA,EAGD,GAAA,CAAAQ,GAAMR,CAAY,CAAA,OACOU;AAAA,IACvB,CAAAC,MAAA;AACA,MAAAN,EAAcM,CAAA,GACfH,EAAA,EAAA;AAAA,IACA;AAAA,IACD,CAAAA,CAAA;AAAA,EAEA,GACCI,IAAOC;AAAA,IAAA,OACN;AAAA,MACA,QAAAN;AAAA,MACA,WAAAO;AAAA,MACA,cAAAV;AAAA,MACD,YAAAK;AAAA,IACA;AAAA,IACD,CAAAF,GAAAO,GAAAL,GAAAL,CAAA;AAAA,EAEA;AACC,SAAAW,EAAM,MAAA;AACL,UAAIC,IAAc,CAAAC;AACjB,gBAAW,YAAAV,KACZE,EAAA;AAAA,IAED;AACC,gBACD,OAAA,iBAAA,WAAAO,CAAA,SAGK;AACH,WACD,OAAA,oBAAA,WAAAA,CAAA;AAAA,IAEF;AAAA,EAEA,GAAA,CAAAT,GAAAE,CAAA,CACC,GACE,gBAAAS,EAAAC,EAAA,UAAA,EAAA,OAAAP,GAAA,UAAA;AAAA,IACAT;AAAA,IAECI,KAAAH,KACC,gBAAAc,iBAAA;AAAA,MAAQ,gBAAAE,EAAAC,GAAA,EAAA,UAAA,gBAAAD;AAAA,QAAPE,EAAA;AAAA,QAAA;AAAA,UAEA,WAAWb;AAAA,UACX,WAAMc,EAAA;AAAA,UAEL;UAAA,UAAAnB;AAAA;MAEH,EAAA,CAAA;AAAA,MAED,gBAAAgB,EAAAE,EAAA,SAAA,CAAA,CAAA;AAAA,MAEF,CAAA;AAAA,EAEF,EAAA,CAAA;AAEA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext as e, useContext as n } from "react";
|
|
3
|
+
const o = e(
|
|
4
|
+
void 0
|
|
5
|
+
);
|
|
6
|
+
o.displayName = "ModalContext";
|
|
7
|
+
function d() {
|
|
8
|
+
const t = n(o);
|
|
9
|
+
if (t === void 0)
|
|
10
|
+
throw new Error("useModal must be used within a ModalContext.Provider");
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
o as ModalContext,
|
|
15
|
+
d as useModal
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=use-modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-modal.js","sources":["../../../src/components/modal/use-modal.ts"],"sourcesContent":["'use client'\n\nimport { createContext, useContext } from 'react'\nimport type { ReactNode } from 'react'\n\nexport interface ModalContextState {\n\tisOpen: boolean\n\topenModal: (content: ReactNode) => void\n\tcloseModal: () => void\n}\n\nexport const ModalContext = createContext<ModalContextState | undefined>(\n\tundefined\n)\nModalContext.displayName = 'ModalContext'\n\nexport function useModal(): ModalContextState {\n\tconst context = useContext(ModalContext)\n\tif (context === undefined) {\n\t\tthrow new Error('useModal must be used within a ModalContext.Provider')\n\t}\n\treturn context\n}\n"],"names":["ModalContext","createContext","useModal","context","useContext"],"mappings":";;AAW4B,MAC3BA,IAAAC;AAAA,EACD;AACA;AAEOD,gBAAuC;AAC7C,SAAME,IAAU;AAChB,QAAIC,IAAYC,EAAWJ,CAAA;AAC1B,MAAAG,MAAU;AACX,UAAA,IAAA,MAAA,sDAAA;AAED,SAAAA;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import p from "classnames";
|
|
3
|
+
import r from "./separator.module.css.js";
|
|
4
|
+
const t = ({ spacing: a = "24", className: o, ...s }) => /* @__PURE__ */ m(
|
|
5
|
+
"hr",
|
|
6
|
+
{
|
|
7
|
+
className: p(r.separator, r[`spacing-${a}`], o),
|
|
8
|
+
...s
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
t.displayName = "Separator";
|
|
12
|
+
export {
|
|
13
|
+
t as Separator
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react'\nimport classNames from 'classnames'\nimport s from './separator.module.css'\n\ninterface SeparatorProps extends HTMLAttributes<HTMLHRElement> {\n\tspacing?: '0' | '24'\n}\n\nconst Separator = ({ spacing = '24', className, ...rest }: SeparatorProps) => {\n\treturn (\n\t\t<hr\n\t\t\tclassName={classNames(s.separator, s[`spacing-${spacing}`], className)}\n\t\t\t{...rest}\n\t\t/>\n\t)\n}\n\nSeparator.displayName = 'Separator'\n\nexport type { SeparatorProps }\nexport { Separator }\n"],"names":["Separator","spacing","className","rest","jsx","classNames","s"],"mappings":";;;AAQA,MAAMA,IAAY,CAAC,EAAE,SAAAC,IAAU,MAAM,WAAAC,GAAW,GAAGC,QAEjD,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,WAAWC,EAAWC,EAAE,WAAWA,EAAE,WAAWL,CAAO,EAAE,GAAGC,CAAS;AAAA,IACpE,GAAGC;AAAA,EAAA;AAAA;AAKPH,EAAU,cAAc;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"separator.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsxs as p, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as S } from "react";
|
|
3
|
+
import I from "classnames";
|
|
4
|
+
import { Interactive as L } from "../interactive/index.js";
|
|
5
|
+
import { FlightIcon as f } from "../flight-icon/index.js";
|
|
6
|
+
import a from "./styles.module.scss.js";
|
|
7
|
+
const T = ["small", "medium", "large"], h = [
|
|
8
|
+
"primary",
|
|
9
|
+
"secondary",
|
|
10
|
+
"secondary-inverted"
|
|
11
|
+
], k = ["leading", "trailing"], O = S(
|
|
12
|
+
({
|
|
13
|
+
text: i,
|
|
14
|
+
size: m = "medium",
|
|
15
|
+
color: s = "primary",
|
|
16
|
+
icon: t,
|
|
17
|
+
iconPosition: r = "leading",
|
|
18
|
+
className: o,
|
|
19
|
+
"data-testid": l,
|
|
20
|
+
locale: d,
|
|
21
|
+
...N
|
|
22
|
+
}, c) => {
|
|
23
|
+
const e = t && /* @__PURE__ */ n(f, { name: t, size: 16 });
|
|
24
|
+
return /* @__PURE__ */ p(
|
|
25
|
+
L,
|
|
26
|
+
{
|
|
27
|
+
...N,
|
|
28
|
+
ref: c,
|
|
29
|
+
className: I(
|
|
30
|
+
a["standalone-link"],
|
|
31
|
+
a[`size-${m}`],
|
|
32
|
+
a[`color-${s}`],
|
|
33
|
+
a[`icon-position-${r}`],
|
|
34
|
+
o
|
|
35
|
+
),
|
|
36
|
+
"data-testid": l,
|
|
37
|
+
locale: d,
|
|
38
|
+
children: [
|
|
39
|
+
e && r === "leading" && e,
|
|
40
|
+
/* @__PURE__ */ n("span", { className: a.text, children: i }),
|
|
41
|
+
e && r === "trailing" && e
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
O.displayName = "StandaloneLink";
|
|
48
|
+
export {
|
|
49
|
+
h as STANDALONE_LINK_COLORS,
|
|
50
|
+
k as STANDALONE_LINK_ICON_POSITIONS,
|
|
51
|
+
T as STANDALONE_LINK_SIZES,
|
|
52
|
+
O as StandaloneLink
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/standalone-link/index.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport classNames from 'classnames'\nimport type { InteractiveProps } from '../interactive'\nimport { Interactive } from '../interactive'\nimport { FlightIcon } from '../flight-icon'\nimport s from './styles.module.scss'\n\nconst STANDALONE_LINK_SIZES = ['small', 'medium', 'large'] as const\ntype StandaloneLinkSize = (typeof STANDALONE_LINK_SIZES)[number]\n\nconst STANDALONE_LINK_COLORS = [\n\t'primary',\n\t'secondary',\n\t'secondary-inverted',\n] as const\ntype StandaloneLinkColor = (typeof STANDALONE_LINK_COLORS)[number]\n\nconst STANDALONE_LINK_ICON_POSITIONS = ['leading', 'trailing'] as const\ntype StandaloneLinkIconPosition =\n\t(typeof STANDALONE_LINK_ICON_POSITIONS)[number]\n\ninterface StandaloneLinkProps extends Omit<InteractiveProps, 'color' | 'size'> {\n\ttext: string\n\tsize?: StandaloneLinkSize\n\tcolor?: StandaloneLinkColor\n\ticon?: string\n\ticonPosition?: StandaloneLinkIconPosition\n\thref?: string\n\tlocale?: string\n\tisHrefExternal?: boolean\n\tonClick?: () => void\n\tclassName?: string\n\t'data-testid'?: string\n}\n\nconst StandaloneLink = forwardRef<\n\tHTMLAnchorElement | HTMLButtonElement,\n\tStandaloneLinkProps\n>(\n\t(\n\t\t{\n\t\t\ttext,\n\t\t\tsize = 'medium',\n\t\t\tcolor = 'primary',\n\t\t\ticon,\n\t\t\ticonPosition = 'leading',\n\t\t\tclassName,\n\t\t\t'data-testid': dataTestId,\n\t\t\tlocale,\n\t\t\t...props\n\t\t},\n\t\tref\n\t) => {\n\t\tconst iconElement = icon && <FlightIcon name={icon} size={16} />\n\n\t\treturn (\n\t\t\t<Interactive\n\t\t\t\t{...props}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\ts['standalone-link'],\n\t\t\t\t\ts[`size-${size}`],\n\t\t\t\t\ts[`color-${color}`],\n\t\t\t\t\ts[`icon-position-${iconPosition}`],\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\tdata-testid={dataTestId}\n\t\t\t\tlocale={locale}\n\t\t\t>\n\t\t\t\t{iconElement && iconPosition === 'leading' && iconElement}\n\t\t\t\t<span className={s.text}>{text}</span>\n\t\t\t\t{iconElement && iconPosition === 'trailing' && iconElement}\n\t\t\t</Interactive>\n\t\t)\n\t}\n)\n\nStandaloneLink.displayName = 'StandaloneLink'\n\nexport type {\n\tStandaloneLinkSize,\n\tStandaloneLinkColor,\n\tStandaloneLinkIconPosition,\n\tStandaloneLinkProps,\n}\nexport {\n\tSTANDALONE_LINK_SIZES,\n\tSTANDALONE_LINK_COLORS,\n\tSTANDALONE_LINK_ICON_POSITIONS,\n\tStandaloneLink,\n}\n"],"names":["STANDALONE_LINK_SIZES","STANDALONE_LINK_COLORS","STANDALONE_LINK_ICON_POSITIONS","StandaloneLink","forwardRef","text","size","color","icon","iconPosition","className","dataTestId","locale","props","ref","iconElement","jsx","FlightIcon","jsxs","Interactive","classNames","s"],"mappings":";;;;;;AAOA,MAAMA,IAAwB,CAAC,SAAS,UAAU,OAAO,GAGnDC,IAAyB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,GAGMC,IAAiC,CAAC,WAAW,UAAU,GAkBvDC,IAAiBC;AAAA,EAItB,CACC;AAAA,IACC,MAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,OAAAC,IAAQ;AAAA,IACR,MAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,WAAAC;AAAA,IACA,eAAeC;AAAA,IACf,QAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAEJC,MACI;AACJ,UAAMC,IAAcP,KAAQ,gBAAAQ,EAACC,KAAW,MAAMT,GAAM,MAAM,IAAI;AAE9D,WACC,gBAAAU;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,GAAGN;AAAA,QACJ,KAAAC;AAAA,QACA,WAAWM;AAAA,UACVC,EAAE,iBAAiB;AAAA,UACnBA,EAAE,QAAQf,CAAI,EAAE;AAAA,UAChBe,EAAE,SAASd,CAAK,EAAE;AAAA,UAClBc,EAAE,iBAAiBZ,CAAY,EAAE;AAAA,UACjCC;AAAA,QAAA;AAAA,QAED,eAAaC;AAAA,QACb,QAAAC;AAAA,QAEC,UAAA;AAAA,UAAAG,KAAeN,MAAiB,aAAaM;AAAA,UAC9C,gBAAAC,EAAC,QAAA,EAAK,WAAWK,EAAE,MAAO,UAAAhB,GAAK;AAAA,UAC9BU,KAAeN,MAAiB,cAAcM;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGlD;AACD;AAEAZ,EAAe,cAAc;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const o = "text__2B7Ih", i = {
|
|
2
|
+
"standalone-link": "standalone-link__85Pyl",
|
|
3
|
+
"icon-position-leading": "icon-position-leading__KE5kn",
|
|
4
|
+
"icon-position-trailing": "icon-position-trailing__Mygyz",
|
|
5
|
+
text: o,
|
|
6
|
+
"size-small": "size-small__pf7gu",
|
|
7
|
+
"size-medium": "size-medium__r6Rbi",
|
|
8
|
+
"size-large": "size-large__aue6M",
|
|
9
|
+
"color-primary": "color-primary__7WaoM",
|
|
10
|
+
"color-secondary": "color-secondary__4qYkh",
|
|
11
|
+
"color-secondary-inverted": "color-secondary-inverted__ILbsj"
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
i as default,
|
|
15
|
+
o as text
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=styles.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import f from "classnames";
|
|
3
|
+
import { TD as N } from "./td.js";
|
|
4
|
+
import { TH as y } from "./th.js";
|
|
5
|
+
import { TR as u } from "./tr.js";
|
|
6
|
+
import { DEFAULT_DENSITY as b, DEFAULT_VERTICAL_ALIGNMENT as E } from "./utils.js";
|
|
7
|
+
import o from "./table.module.scss.js";
|
|
8
|
+
function r({
|
|
9
|
+
caption: a,
|
|
10
|
+
density: s = b,
|
|
11
|
+
valign: i = E,
|
|
12
|
+
isStriped: l,
|
|
13
|
+
isFixedLayout: d,
|
|
14
|
+
children: n,
|
|
15
|
+
className: T,
|
|
16
|
+
...p
|
|
17
|
+
}) {
|
|
18
|
+
return /* @__PURE__ */ c(
|
|
19
|
+
"table",
|
|
20
|
+
{
|
|
21
|
+
className: f(
|
|
22
|
+
o.table,
|
|
23
|
+
o[`density-${s}`],
|
|
24
|
+
o[`valign-${i}`],
|
|
25
|
+
{
|
|
26
|
+
[o.striped]: l,
|
|
27
|
+
[o["layout-fixed"]]: d
|
|
28
|
+
},
|
|
29
|
+
T
|
|
30
|
+
),
|
|
31
|
+
...p,
|
|
32
|
+
children: [
|
|
33
|
+
a && /* @__PURE__ */ e("caption", { className: "sr-only", children: a }),
|
|
34
|
+
n
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
r.displayName = "Table";
|
|
40
|
+
function t({ children: a }) {
|
|
41
|
+
return /* @__PURE__ */ e("thead", { className: o.thead, children: a });
|
|
42
|
+
}
|
|
43
|
+
t.displayName = "T.Head";
|
|
44
|
+
function m({ children: a }) {
|
|
45
|
+
return /* @__PURE__ */ e("tbody", { className: o.tbody, children: a });
|
|
46
|
+
}
|
|
47
|
+
m.displayName = "T.Body";
|
|
48
|
+
const R = { Root: r, TR: u, THead: t, TH: y, TBody: m, TD: N };
|
|
49
|
+
export {
|
|
50
|
+
R as Table
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/table/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { TD } from './td'\nimport { TH } from './th'\nimport { TR } from './tr'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport {\n\tDEFAULT_DENSITY,\n\tDEFAULT_VERTICAL_ALIGNMENT,\n\ttype Density,\n\ttype VerticalAlignment,\n} from './utils'\nimport s from './table.module.scss'\n\nexport interface TableProps extends HTMLAttributes<HTMLTableElement> {\n\t/**\n\t * Define on the table invocation. If set to `true`, even-numbered rows will have a different background color from odd-numbered rows.\n\t */\n\tisStriped?: boolean\n\t/**\n\t * If set to `true`, the `table-display`(CSS) property will be set to fixed. See [MDN reference on table-layout](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout) for more details.\n\t */\n\tisFixedLayout?: boolean\n\t/**\n\t * If set, determines the density (height) of the table body’s rows.\n\t */\n\tdensity?: Density\n\t/**\n\t * Determines the vertical alignment for content in a table. Does not apply to table headers (`th`). See [MDN reference on vertical-align](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align) for more details.\n\t */\n\tvalign?: VerticalAlignment\n\t/**\n\t * Adds a (non-visible) caption for users with assistive technology. If set on a sortable table, the provided table caption is paired with the automatically generated sorted message text.\n\t */\n\tcaption?: string\n}\n\nfunction Root({\n\tcaption,\n\tdensity = DEFAULT_DENSITY,\n\tvalign = DEFAULT_VERTICAL_ALIGNMENT,\n\tisStriped,\n\tisFixedLayout,\n\tchildren,\n\tclassName,\n\t...rest\n}: TableProps) {\n\treturn (\n\t\t<table\n\t\t\tclassName={classNames(\n\t\t\t\ts.table,\n\t\t\t\ts[`density-${density}`],\n\t\t\t\ts[`valign-${valign}`],\n\t\t\t\t{\n\t\t\t\t\t[s.striped]: isStriped,\n\t\t\t\t\t[s['layout-fixed']]: isFixedLayout,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{caption && <caption className=\"sr-only\">{caption}</caption>}\n\t\t\t{children}\n\t\t</table>\n\t)\n}\nRoot.displayName = 'Table'\n\nfunction THead({ children }: { children: ReactNode }) {\n\treturn <thead className={s.thead}>{children}</thead>\n}\nTHead.displayName = 'T.Head'\n\nfunction TBody({ children }: { children: ReactNode }) {\n\treturn <tbody className={s.tbody}>{children}</tbody>\n}\nTBody.displayName = 'T.Body'\n\nconst Table = { Root, TR, THead, TH, TBody, TD }\n\nexport { Table }\n"],"names":["Root","caption","density","DEFAULT_DENSITY","valign","DEFAULT_VERTICAL_ALIGNMENT","isStriped","isFixedLayout","children","className","rest","jsxs","classNames","s","jsx","THead","TBody","Table","TR","TH","TD"],"mappings":";;;;;;;AAoCA,SAASA,EAAK;AAAA,EACb,SAAAC;AAAA,EACA,SAAAC,IAAUC;AAAA,EACV,QAAAC,IAASC;AAAA,EACT,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,GAAe;AACd,SACC,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAWC;AAAA,QACVC,EAAE;AAAA,QACFA,EAAE,WAAWX,CAAO,EAAE;AAAA,QACtBW,EAAE,UAAUT,CAAM,EAAE;AAAA,QACpB;AAAA,UACC,CAACS,EAAE,OAAO,GAAGP;AAAA,UACb,CAACO,EAAE,cAAc,CAAC,GAAGN;AAAA,QAAA;AAAA,QAEtBE;AAAA,MAAA;AAAA,MAEA,GAAGC;AAAA,MAEH,UAAA;AAAA,QAAAT,KAAW,gBAAAa,EAAC,WAAA,EAAQ,WAAU,WAAW,UAAAb,GAAQ;AAAA,QACjDO;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGJ;AACAR,EAAK,cAAc;AAEnB,SAASe,EAAM,EAAE,UAAAP,KAAqC;AACrD,SAAO,gBAAAM,EAAC,SAAA,EAAM,WAAWD,EAAE,OAAQ,UAAAL,GAAS;AAC7C;AACAO,EAAM,cAAc;AAEpB,SAASC,EAAM,EAAE,UAAAR,KAAqC;AACrD,SAAO,gBAAAM,EAAC,SAAA,EAAM,WAAWD,EAAE,OAAQ,UAAAL,GAAS;AAC7C;AACAQ,EAAM,cAAc;AAEpB,MAAMC,IAAQ,EAAE,MAAAjB,GAAM,IAAAkB,GAAI,OAAAH,GAAO,IAAAI,GAAI,OAAAH,GAAO,IAAAI,EAAA;"}
|
|
@@ -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,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,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,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;"}
|
|
@@ -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
|