@hashicorp/mds-react 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +336 -0
- package/README.md +109 -0
- package/dist/components/accordion/index.d.ts +14 -0
- package/dist/components/accordion/index.js +9 -0
- package/dist/components/accordion/index.js.map +1 -0
- package/dist/components/accordion/item/button.d.ts +6 -0
- package/dist/components/accordion/item/button.js +44 -0
- package/dist/components/accordion/item/button.js.map +1 -0
- package/dist/components/accordion/item/index.d.ts +24 -0
- package/dist/components/accordion/item/index.js +59 -0
- package/dist/components/accordion/item/index.js.map +1 -0
- package/dist/components/accordion/style.module.scss +110 -0
- package/dist/components/accordion/style.module.scss.js +24 -0
- package/dist/components/accordion/style.module.scss.js.map +1 -0
- package/dist/components/alert/alert.module.scss +229 -0
- package/dist/components/alert/alert.module.scss.js +29 -0
- package/dist/components/alert/alert.module.scss.js.map +1 -0
- package/dist/components/alert/icon.d.ts +9 -0
- package/dist/components/alert/icon.js +34 -0
- package/dist/components/alert/icon.js.map +1 -0
- package/dist/components/alert/index.d.ts +62 -0
- package/dist/components/alert/index.js +97 -0
- package/dist/components/alert/index.js.map +1 -0
- package/dist/components/badge/index.d.ts +30 -0
- package/dist/components/badge/index.js +50 -0
- package/dist/components/badge/index.js.map +1 -0
- package/dist/components/badge/style.module.scss +130 -0
- package/dist/components/badge/style.module.scss.js +22 -0
- package/dist/components/badge/style.module.scss.js.map +1 -0
- package/dist/components/badge-count/index.d.ts +16 -0
- package/dist/components/badge-count/index.js +29 -0
- package/dist/components/badge-count/index.js.map +1 -0
- package/dist/components/badge-count/style.module.scss +108 -0
- package/dist/components/badge-count/style.module.scss.js +15 -0
- package/dist/components/badge-count/style.module.scss.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +7 -0
- package/dist/components/breadcrumbs/index.js +38 -0
- package/dist/components/breadcrumbs/index.js.map +1 -0
- package/dist/components/breadcrumbs/item/index.d.ts +2 -0
- package/dist/components/breadcrumbs/item/index.js +32 -0
- package/dist/components/breadcrumbs/item/index.js.map +1 -0
- package/dist/components/breadcrumbs/style.module.scss +183 -0
- package/dist/components/breadcrumbs/style.module.scss.js +27 -0
- package/dist/components/breadcrumbs/style.module.scss.js.map +1 -0
- package/dist/components/breadcrumbs/truncation-button/index.d.ts +3 -0
- package/dist/components/breadcrumbs/truncation-button/index.js +25 -0
- package/dist/components/breadcrumbs/truncation-button/index.js.map +1 -0
- package/dist/components/breadcrumbs/types/index.d.ts +51 -0
- package/dist/components/button/index.d.ts +31 -0
- package/dist/components/button/index.js +119 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/button/styles.module.scss +221 -0
- package/dist/components/button/styles.module.scss.js +32 -0
- package/dist/components/button/styles.module.scss.js.map +1 -0
- package/dist/components/card/card-thumbnail/card-thumbnail.module.css +10 -0
- package/dist/components/card/card-thumbnail/card-thumbnail.module.css.js +8 -0
- package/dist/components/card/card-thumbnail/card-thumbnail.module.css.js.map +1 -0
- package/dist/components/card/card-thumbnail/index.d.ts +2 -0
- package/dist/components/card/card-thumbnail/index.js +23 -0
- package/dist/components/card/card-thumbnail/index.js.map +1 -0
- package/dist/components/card/index.d.ts +3 -0
- package/dist/components/card/index.js +157 -0
- package/dist/components/card/index.js.map +1 -0
- package/dist/components/card/styles.module.css +98 -0
- package/dist/components/card/styles.module.css.js +29 -0
- package/dist/components/card/styles.module.css.js.map +1 -0
- package/dist/components/card/types.d.ts +52 -0
- package/dist/components/code-block/code-block.module.scss +511 -0
- package/dist/components/code-block/code-block.module.scss.js +34 -0
- package/dist/components/code-block/code-block.module.scss.js.map +1 -0
- package/dist/components/code-block/code-lines/index.d.ts +12 -0
- package/dist/components/code-block/code-lines/index.js +59 -0
- package/dist/components/code-block/code-lines/index.js.map +1 -0
- package/dist/components/code-block/code-lines/utils/split-html-into-lines.d.ts +19 -0
- package/dist/components/code-block/code-lines/utils/split-html-into-lines.js +19 -0
- package/dist/components/code-block/code-lines/utils/split-html-into-lines.js.map +1 -0
- package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.d.ts +21 -0
- package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.js +31 -0
- package/dist/components/code-block/code-lines/utils/split-jsx-into-lines.js.map +1 -0
- package/dist/components/code-block/hidden-copy-content/index.d.ts +5 -0
- package/dist/components/code-block/hidden-copy-content/index.js +13 -0
- package/dist/components/code-block/hidden-copy-content/index.js.map +1 -0
- package/dist/components/code-block/index.d.ts +55 -0
- package/dist/components/code-block/index.js +88 -0
- package/dist/components/code-block/index.js.map +1 -0
- package/dist/components/code-block/utils/parse-highlighted-lines.d.ts +2 -0
- package/dist/components/code-block/utils/parse-highlighted-lines.js +39 -0
- package/dist/components/code-block/utils/parse-highlighted-lines.js.map +1 -0
- package/dist/components/code-block/utils/process-snippet.d.ts +12 -0
- package/dist/components/code-block/utils/process-snippet.js +20 -0
- package/dist/components/code-block/utils/process-snippet.js.map +1 -0
- package/dist/components/code-block/utils/shellwords.d.ts +14 -0
- package/dist/components/code-block/utils/shellwords.js +33 -0
- package/dist/components/code-block/utils/shellwords.js.map +1 -0
- package/dist/components/combo-box-primitive/index.d.ts +69 -0
- package/dist/components/combo-box-primitive/index.js +302 -0
- package/dist/components/combo-box-primitive/index.js.map +1 -0
- package/dist/components/dialog-primitive/dialog.module.scss +38 -0
- package/dist/components/dialog-primitive/dialog.module.scss.js +12 -0
- package/dist/components/dialog-primitive/dialog.module.scss.js.map +1 -0
- package/dist/components/dialog-primitive/index.d.ts +12 -0
- package/dist/components/dialog-primitive/index.js +15 -0
- package/dist/components/dialog-primitive/index.js.map +1 -0
- package/dist/components/disclosure-primitive/index.d.ts +19 -0
- package/dist/components/disclosure-primitive/index.js +57 -0
- package/dist/components/disclosure-primitive/index.js.map +1 -0
- package/dist/components/disclosure-primitive/styles.module.css +3 -0
- package/dist/components/disclosure-primitive/styles.module.css.js +7 -0
- package/dist/components/disclosure-primitive/styles.module.css.js.map +1 -0
- package/dist/components/disclosure-primitive/use-disclosure-primitive.d.ts +11 -0
- package/dist/components/disclosure-primitive/use-disclosure-primitive.js +17 -0
- package/dist/components/disclosure-primitive/use-disclosure-primitive.js.map +1 -0
- package/dist/components/dismiss-button/index.d.ts +9 -0
- package/dist/components/dismiss-button/index.js +22 -0
- package/dist/components/dismiss-button/index.js.map +1 -0
- package/dist/components/dismiss-button/styles.module.scss +31 -0
- package/dist/components/dismiss-button/styles.module.scss.js +7 -0
- package/dist/components/dismiss-button/styles.module.scss.js.map +1 -0
- package/dist/components/dropdown/index.d.ts +72 -0
- package/dist/components/dropdown/index.js +79 -0
- package/dist/components/dropdown/index.js.map +1 -0
- package/dist/components/dropdown/list-item/custom.d.ts +10 -0
- package/dist/components/dropdown/list-item/custom.js +9 -0
- package/dist/components/dropdown/list-item/custom.js.map +1 -0
- package/dist/components/dropdown/list-item/index.d.ts +19 -0
- package/dist/components/dropdown/list-item/index.js +14 -0
- package/dist/components/dropdown/list-item/index.js.map +1 -0
- package/dist/components/dropdown/list-item/interactive.d.ts +29 -0
- package/dist/components/dropdown/list-item/interactive.js +49 -0
- package/dist/components/dropdown/list-item/interactive.js.map +1 -0
- package/dist/components/dropdown/list-item/separator.d.ts +8 -0
- package/dist/components/dropdown/list-item/separator.js +17 -0
- package/dist/components/dropdown/list-item/separator.js.map +1 -0
- package/dist/components/dropdown/list-item/styles.module.css +222 -0
- package/dist/components/dropdown/list-item/styles.module.css.js +26 -0
- package/dist/components/dropdown/list-item/styles.module.css.js.map +1 -0
- package/dist/components/dropdown/list-item/title.d.ts +10 -0
- package/dist/components/dropdown/list-item/title.js +9 -0
- package/dist/components/dropdown/list-item/title.js.map +1 -0
- package/dist/components/dropdown/styles.module.css +74 -0
- package/dist/components/dropdown/styles.module.css.js +24 -0
- package/dist/components/dropdown/styles.module.css.js.map +1 -0
- package/dist/components/dropdown/toggle-button/index.d.ts +30 -0
- package/dist/components/dropdown/toggle-button/index.js +54 -0
- package/dist/components/dropdown/toggle-button/index.js.map +1 -0
- package/dist/components/dropdown/toggle-button/styles.module.scss +54 -0
- package/dist/components/dropdown/toggle-button/styles.module.scss.js +14 -0
- package/dist/components/dropdown/toggle-button/styles.module.scss.js.map +1 -0
- package/dist/components/flight-icon/flight-icon.module.css +31 -0
- package/dist/components/flight-icon/flight-icon.module.css.js +12 -0
- package/dist/components/flight-icon/flight-icon.module.css.js.map +1 -0
- package/dist/components/flight-icon/index.d.ts +44 -0
- package/dist/components/flight-icon/index.js +58 -0
- package/dist/components/flight-icon/index.js.map +1 -0
- package/dist/components/form/checkbox/form-checkbox.module.css +88 -0
- package/dist/components/form/checkbox/form-checkbox.module.css.js +8 -0
- package/dist/components/form/checkbox/form-checkbox.module.css.js.map +1 -0
- package/dist/components/form/checkbox/index.d.ts +45 -0
- package/dist/components/form/checkbox/index.js +109 -0
- package/dist/components/form/checkbox/index.js.map +1 -0
- package/dist/components/form/error/form-error.module.css +23 -0
- package/dist/components/form/error/form-error.module.css.js +14 -0
- package/dist/components/form/error/form-error.module.css.js.map +1 -0
- package/dist/components/form/error/index.d.ts +16 -0
- package/dist/components/form/error/index.js +22 -0
- package/dist/components/form/error/index.js.map +1 -0
- package/dist/components/form/field/form-field.module.css +79 -0
- package/dist/components/form/field/form-field.module.css.js +17 -0
- package/dist/components/form/field/form-field.module.css.js.map +1 -0
- package/dist/components/form/field/index.d.ts +19 -0
- package/dist/components/form/field/index.js +46 -0
- package/dist/components/form/field/index.js.map +1 -0
- package/dist/components/form/fieldset/form-fieldset.module.css +48 -0
- package/dist/components/form/fieldset/form-fieldset.module.css.js +19 -0
- package/dist/components/form/fieldset/form-fieldset.module.css.js.map +1 -0
- package/dist/components/form/fieldset/index.d.ts +19 -0
- package/dist/components/form/fieldset/index.js +65 -0
- package/dist/components/form/fieldset/index.js.map +1 -0
- package/dist/components/form/file-input/form-file-input.module.scss +81 -0
- package/dist/components/form/file-input/form-file-input.module.scss.js +7 -0
- package/dist/components/form/file-input/form-file-input.module.scss.js.map +1 -0
- package/dist/components/form/file-input/index.d.ts +27 -0
- package/dist/components/form/file-input/index.js +68 -0
- package/dist/components/form/file-input/index.js.map +1 -0
- package/dist/components/form/helper-text/form-helper-text.module.css +10 -0
- package/dist/components/form/helper-text/form-helper-text.module.css.js +7 -0
- package/dist/components/form/helper-text/form-helper-text.module.css.js.map +1 -0
- package/dist/components/form/helper-text/index.d.ts +11 -0
- package/dist/components/form/helper-text/index.js +22 -0
- package/dist/components/form/helper-text/index.js.map +1 -0
- package/dist/components/form/indicator/form-indicator.module.css +10 -0
- package/dist/components/form/indicator/form-indicator.module.css.js +8 -0
- package/dist/components/form/indicator/form-indicator.module.css.js.map +1 -0
- package/dist/components/form/indicator/index.d.ts +9 -0
- package/dist/components/form/indicator/index.js +22 -0
- package/dist/components/form/indicator/index.js.map +1 -0
- package/dist/components/form/label/form-label.module.css +15 -0
- package/dist/components/form/label/form-label.module.css.js +10 -0
- package/dist/components/form/label/form-label.module.css.js.map +1 -0
- package/dist/components/form/label/index.d.ts +14 -0
- package/dist/components/form/label/index.js +33 -0
- package/dist/components/form/label/index.js.map +1 -0
- package/dist/components/form/legend/form-legend.module.css +17 -0
- package/dist/components/form/legend/form-legend.module.css.js +10 -0
- package/dist/components/form/legend/form-legend.module.css.js.map +1 -0
- package/dist/components/form/legend/index.d.ts +12 -0
- package/dist/components/form/legend/index.js +19 -0
- package/dist/components/form/legend/index.js.map +1 -0
- package/dist/components/form/radio/form-radio.module.scss +74 -0
- package/dist/components/form/radio/form-radio.module.scss.js +8 -0
- package/dist/components/form/radio/form-radio.module.scss.js.map +1 -0
- package/dist/components/form/radio/index.d.ts +44 -0
- package/dist/components/form/radio/index.js +100 -0
- package/dist/components/form/radio/index.js.map +1 -0
- package/dist/components/form/radio-card/description.d.ts +3 -0
- package/dist/components/form/radio-card/description.js +10 -0
- package/dist/components/form/radio-card/description.js.map +1 -0
- package/dist/components/form/radio-card/form-radio-card.module.css +153 -0
- package/dist/components/form/radio-card/form-radio-card.module.css.js +30 -0
- package/dist/components/form/radio-card/form-radio-card.module.css.js.map +1 -0
- package/dist/components/form/radio-card/group.d.ts +11 -0
- package/dist/components/form/radio-card/group.js +31 -0
- package/dist/components/form/radio-card/group.js.map +1 -0
- package/dist/components/form/radio-card/index.d.ts +48 -0
- package/dist/components/form/radio-card/index.js +67 -0
- package/dist/components/form/radio-card/index.js.map +1 -0
- package/dist/components/form/radio-card/label.d.ts +3 -0
- package/dist/components/form/radio-card/label.js +10 -0
- package/dist/components/form/radio-card/label.js.map +1 -0
- package/dist/components/form/select/form-select.module.css +89 -0
- package/dist/components/form/select/form-select.module.css.js +14 -0
- package/dist/components/form/select/form-select.module.css.js.map +1 -0
- package/dist/components/form/select/index.d.ts +21 -0
- package/dist/components/form/select/index.js +79 -0
- package/dist/components/form/select/index.js.map +1 -0
- package/dist/components/form/super-select/form-super-select.module.css +155 -0
- package/dist/components/form/super-select/form-super-select.module.css.js +22 -0
- package/dist/components/form/super-select/form-super-select.module.css.js.map +1 -0
- package/dist/components/form/super-select/index.d.ts +55 -0
- package/dist/components/form/super-select/index.js +170 -0
- package/dist/components/form/super-select/index.js.map +1 -0
- package/dist/components/form/text-input/index.d.ts +98 -0
- package/dist/components/form/text-input/index.js +91 -0
- package/dist/components/form/text-input/index.js.map +1 -0
- package/dist/components/form/text-input/styles.module.css +158 -0
- package/dist/components/form/text-input/styles.module.css.js +15 -0
- package/dist/components/form/text-input/styles.module.css.js.map +1 -0
- package/dist/components/form/textarea/form-textarea.module.css +88 -0
- package/dist/components/form/textarea/form-textarea.module.css.js +14 -0
- package/dist/components/form/textarea/form-textarea.module.css.js.map +1 -0
- package/dist/components/form/textarea/index.d.ts +19 -0
- package/dist/components/form/textarea/index.js +74 -0
- package/dist/components/form/textarea/index.js.map +1 -0
- package/dist/components/form/toggle/form-toggle.module.scss +164 -0
- package/dist/components/form/toggle/form-toggle.module.scss.js +12 -0
- package/dist/components/form/toggle/form-toggle.module.scss.js.map +1 -0
- package/dist/components/form/toggle/index.d.ts +78 -0
- package/dist/components/form/toggle/index.js +102 -0
- package/dist/components/form/toggle/index.js.map +1 -0
- package/dist/components/hds/wrappers/tooltip.d.ts +13 -0
- package/dist/components/hds/wrappers/tooltip.js +51 -0
- package/dist/components/hds/wrappers/tooltip.js.map +1 -0
- package/dist/components/icon-tile/index.d.ts +21 -0
- package/dist/components/icon-tile/index.js +50 -0
- package/dist/components/icon-tile/index.js.map +1 -0
- package/dist/components/icon-tile/style.module.scss +136 -0
- package/dist/components/icon-tile/style.module.scss.js +29 -0
- package/dist/components/icon-tile/style.module.scss.js.map +1 -0
- package/dist/components/index.d.ts +60 -0
- package/dist/components/index.js +119 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/inline-link/index.d.ts +40 -0
- package/dist/components/inline-link/index.js +33 -0
- package/dist/components/inline-link/index.js.map +1 -0
- package/dist/components/inline-link/inline-link.module.css +49 -0
- package/dist/components/inline-link/inline-link.module.css.js +11 -0
- package/dist/components/inline-link/inline-link.module.css.js.map +1 -0
- package/dist/components/interactive/index.d.ts +26 -0
- package/dist/components/interactive/index.js +59 -0
- package/dist/components/interactive/index.js.map +1 -0
- package/dist/components/legacy-button/index.d.ts +5 -0
- package/dist/components/legacy-button/index.js +65 -0
- package/dist/components/legacy-button/index.js.map +1 -0
- package/dist/components/legacy-button/types.d.ts +37 -0
- package/dist/components/legacy-button/utils.d.ts +9 -0
- package/dist/components/legacy-button/utils.js +39 -0
- package/dist/components/legacy-button/utils.js.map +1 -0
- package/dist/components/menu-primitive/index.d.ts +14 -0
- package/dist/components/menu-primitive/index.js +68 -0
- package/dist/components/menu-primitive/index.js.map +1 -0
- package/dist/components/menu-primitive/styles.module.css +16 -0
- package/dist/components/menu-primitive/styles.module.css.js +12 -0
- package/dist/components/menu-primitive/styles.module.css.js.map +1 -0
- package/dist/components/menu-primitive/use-menu-primitive.d.ts +9 -0
- package/dist/components/menu-primitive/use-menu-primitive.js +17 -0
- package/dist/components/menu-primitive/use-menu-primitive.js.map +1 -0
- package/dist/components/modal/index.d.ts +13 -0
- package/dist/components/modal/index.js +61 -0
- package/dist/components/modal/index.js.map +1 -0
- package/dist/components/modal/modal.module.css +22 -0
- package/dist/components/modal/modal.module.css.js +8 -0
- package/dist/components/modal/modal.module.css.js.map +1 -0
- package/dist/components/modal/use-modal.d.ts +8 -0
- package/dist/components/modal/use-modal.js +17 -0
- package/dist/components/modal/use-modal.js.map +1 -0
- package/dist/components/separator/index.d.ts +10 -0
- package/dist/components/separator/index.js +15 -0
- package/dist/components/separator/index.js.map +1 -0
- package/dist/components/separator/separator.module.css +15 -0
- package/dist/components/separator/separator.module.css.js +10 -0
- package/dist/components/separator/separator.module.css.js.map +1 -0
- package/dist/components/standalone-link/index.d.ts +23 -0
- package/dist/components/standalone-link/index.js +54 -0
- package/dist/components/standalone-link/index.js.map +1 -0
- package/dist/components/standalone-link/styles.module.scss +166 -0
- package/dist/components/standalone-link/styles.module.scss.js +17 -0
- package/dist/components/standalone-link/styles.module.scss.js.map +1 -0
- package/dist/components/table/index.d.ts +58 -0
- package/dist/components/table/index.js +52 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/table.module.scss +192 -0
- package/dist/components/table/table.module.scss.js +33 -0
- package/dist/components/table/table.module.scss.js.map +1 -0
- package/dist/components/table/td.d.ts +17 -0
- package/dist/components/table/td.js +28 -0
- package/dist/components/table/td.js.map +1 -0
- package/dist/components/table/th-button-tooltip.d.ts +6 -0
- package/dist/components/table/th-button-tooltip.js +24 -0
- package/dist/components/table/th-button-tooltip.js.map +1 -0
- package/dist/components/table/th.d.ts +34 -0
- package/dist/components/table/th.js +43 -0
- package/dist/components/table/th.js.map +1 -0
- package/dist/components/table/tr.d.ts +12 -0
- package/dist/components/table/tr.js +9 -0
- package/dist/components/table/tr.js.map +1 -0
- package/dist/components/table/utils.d.ts +16 -0
- package/dist/components/table/utils.js +28 -0
- package/dist/components/table/utils.js.map +1 -0
- package/dist/components/tabs/index.d.ts +21 -0
- package/dist/components/tabs/index.js +117 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/tabs/tab-panel.d.ts +5 -0
- package/dist/components/tabs/tab-panel.js +35 -0
- package/dist/components/tabs/tab-panel.js.map +1 -0
- package/dist/components/tabs/tab.d.ts +24 -0
- package/dist/components/tabs/tab.js +70 -0
- package/dist/components/tabs/tab.js.map +1 -0
- package/dist/components/tabs/tabs.module.scss +163 -0
- package/dist/components/tabs/tabs.module.scss.js +22 -0
- package/dist/components/tabs/tabs.module.scss.js.map +1 -0
- package/dist/components/tabs/use-tabs-context.d.ts +15 -0
- package/dist/components/tabs/use-tabs-context.js +16 -0
- package/dist/components/tabs/use-tabs-context.js.map +1 -0
- package/dist/components/text/index.d.ts +44 -0
- package/dist/components/text/index.js +112 -0
- package/dist/components/text/index.js.map +1 -0
- package/dist/components/text/style.module.scss +11 -0
- package/dist/components/text/style.module.scss.js +9 -0
- package/dist/components/text/style.module.scss.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.d.ts +8 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js +62 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/index.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css +76 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js +20 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/dataset-value/style.module.css.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/index.d.ts +44 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/index.js +104 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/index.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.d.ts +10 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.js +13 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/index.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css +29 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js +14 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/legend/style.module.css.js.map +1 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css +76 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css.js +28 -0
- package/dist/components/visualizations/bar-chart/horizontal-chart/style.module.css.js.map +1 -0
- package/dist/components/visualizations/bar-chart/index.d.ts +13 -0
- package/dist/components/visualizations/bar-chart/index.js +37 -0
- package/dist/components/visualizations/bar-chart/index.js.map +1 -0
- package/dist/components/visualizations/bar-chart/style.module.css +39 -0
- package/dist/components/visualizations/bar-chart/style.module.css.js +12 -0
- package/dist/components/visualizations/bar-chart/style.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.d.ts +3 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.js +14 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/index.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css +14 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js +10 -0
- package/dist/components/visualizations/donut-chart/components/arc-tooltip/styles.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/index.d.ts +3 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/index.js +58 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/index.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css +32 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js +16 -0
- package/dist/components/visualizations/donut-chart/components/external-arc-label/styles.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/index.d.ts +3 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.d.ts +3 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.js +42 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/index.js.map +1 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css +20 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js +14 -0
- package/dist/components/visualizations/donut-chart/components/internal-arc-label/styles.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/index.d.ts +10 -0
- package/dist/components/visualizations/donut-chart/index.js +90 -0
- package/dist/components/visualizations/donut-chart/index.js.map +1 -0
- package/dist/components/visualizations/donut-chart/styles.module.css +73 -0
- package/dist/components/visualizations/donut-chart/styles.module.css.js +20 -0
- package/dist/components/visualizations/donut-chart/styles.module.css.js.map +1 -0
- package/dist/components/visualizations/donut-chart/types.d.ts +16 -0
- package/dist/hooks/use-media-query/index.js +16 -0
- package/dist/hooks/use-media-query/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +158 -0
- package/dist/index.js.map +1 -0
- package/dist/patterns/card/index.d.ts +5 -0
- package/dist/patterns/card/newsroom-card/index.d.ts +15 -0
- package/dist/patterns/card/newsroom-card/index.js +26 -0
- package/dist/patterns/card/newsroom-card/index.js.map +1 -0
- package/dist/patterns/card/newsroom-card/style.module.css +12 -0
- package/dist/patterns/card/newsroom-card/style.module.css.js +8 -0
- package/dist/patterns/card/newsroom-card/style.module.css.js.map +1 -0
- package/dist/patterns/card/partner-card/index.d.ts +18 -0
- package/dist/patterns/card/partner-card/index.js +42 -0
- package/dist/patterns/card/partner-card/index.js.map +1 -0
- package/dist/patterns/card/partner-card/style.module.css +24 -0
- package/dist/patterns/card/partner-card/style.module.css.js +12 -0
- package/dist/patterns/card/partner-card/style.module.css.js.map +1 -0
- package/dist/patterns/card/person-card/index.d.ts +15 -0
- package/dist/patterns/card/person-card/index.js +52 -0
- package/dist/patterns/card/person-card/index.js.map +1 -0
- package/dist/patterns/card/person-card/style.module.css +28 -0
- package/dist/patterns/card/person-card/style.module.css.js +12 -0
- package/dist/patterns/card/person-card/style.module.css.js.map +1 -0
- package/dist/patterns/card/primitives.d.ts +37 -0
- package/dist/patterns/card/primitives.js +77 -0
- package/dist/patterns/card/primitives.js.map +1 -0
- package/dist/patterns/card/promo-card/index.d.ts +18 -0
- package/dist/patterns/card/promo-card/index.js +36 -0
- package/dist/patterns/card/promo-card/index.js.map +1 -0
- package/dist/patterns/card/resource-card/index.d.ts +16 -0
- package/dist/patterns/card/resource-card/index.js +26 -0
- package/dist/patterns/card/resource-card/index.js.map +1 -0
- package/dist/patterns/card/style.module.css +121 -0
- package/dist/patterns/card/style.module.css.js +30 -0
- package/dist/patterns/card/style.module.css.js.map +1 -0
- package/dist/patterns/card/thumbnails/index.d.ts +13 -0
- package/dist/patterns/card/thumbnails/index.js +25 -0
- package/dist/patterns/card/thumbnails/index.js.map +1 -0
- package/dist/patterns/card/types.d.ts +41 -0
- package/dist/patterns/card/unified-card/index.d.ts +10 -0
- package/dist/patterns/card/unified-card/index.js +37 -0
- package/dist/patterns/card/unified-card/index.js.map +1 -0
- package/dist/patterns/copy-button/clipboard.d.ts +16 -0
- package/dist/patterns/copy-button/clipboard.js +78 -0
- package/dist/patterns/copy-button/clipboard.js.map +1 -0
- package/dist/patterns/copy-button/index.d.ts +19 -0
- package/dist/patterns/copy-button/index.js +57 -0
- package/dist/patterns/copy-button/index.js.map +1 -0
- package/dist/patterns/copy-button/style.module.css +23 -0
- package/dist/patterns/copy-button/style.module.css.js +13 -0
- package/dist/patterns/copy-button/style.module.css.js.map +1 -0
- package/dist/patterns/index.d.ts +15 -0
- package/dist/patterns/index.js +35 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/patterns/layout/index.d.ts +69 -0
- package/dist/patterns/layout/index.js +47 -0
- package/dist/patterns/layout/index.js.map +1 -0
- package/dist/patterns/layout/layout.module.css +72 -0
- package/dist/patterns/layout/layout.module.css.js +20 -0
- package/dist/patterns/layout/layout.module.css.js.map +1 -0
- package/dist/patterns/product-badge/index.d.ts +11 -0
- package/dist/patterns/product-badge/index.js +22 -0
- package/dist/patterns/product-badge/index.js.map +1 -0
- package/dist/patterns/product-badge/style.module.css +3 -0
- package/dist/patterns/product-badge/style.module.css.js +8 -0
- package/dist/patterns/product-badge/style.module.css.js.map +1 -0
- package/dist/patterns/product-logo/index.d.ts +48 -0
- package/dist/patterns/product-logo/index.js +130 -0
- package/dist/patterns/product-logo/index.js.map +1 -0
- package/dist/patterns/product-logo/product-logo.module.css +24 -0
- package/dist/patterns/product-logo/product-logo.module.css.js +13 -0
- package/dist/patterns/product-logo/product-logo.module.css.js.map +1 -0
- package/dist/patterns/related-content/index.d.ts +6 -0
- package/dist/patterns/related-content/index.js +65 -0
- package/dist/patterns/related-content/index.js.map +1 -0
- package/dist/patterns/related-content/style.module.css +74 -0
- package/dist/patterns/related-content/style.module.css.js +22 -0
- package/dist/patterns/related-content/style.module.css.js.map +1 -0
- package/dist/patterns/related-content/types.d.ts +14 -0
- package/dist/style.css +1 -0
- package/dist/styles/mixins/button.scss +284 -0
- package/dist/styles/mixins/focus-ring.scss +75 -0
- package/dist/utils/get-contrast-yiq.d.ts +20 -0
- package/dist/utils/get-contrast-yiq.js +13 -0
- package/dist/utils/get-contrast-yiq.js.map +1 -0
- package/dist/utils/hooks/use-screen-size.d.ts +5 -0
- package/dist/utils/hooks/use-screen-size.js +10 -0
- package/dist/utils/hooks/use-screen-size.js.map +1 -0
- package/dist/utils/i18n/index.d.ts +1 -0
- package/dist/utils/i18n/index.js +41 -0
- package/dist/utils/i18n/index.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/make-normalizer/index.d.ts +30 -0
- package/dist/utils/make-normalizer/index.js +34 -0
- package/dist/utils/make-normalizer/index.js.map +1 -0
- package/dist/utils/mds-context/index.d.ts +59 -0
- package/dist/utils/mds-context/index.js +85 -0
- package/dist/utils/mds-context/index.js.map +1 -0
- package/package.json +113 -0
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CODE-BLOCK
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
@use 'styles/mixins/focus-ring' as *;
|
|
6
|
+
|
|
7
|
+
// CODE-BLOCK PARENT/WRAPPER
|
|
8
|
+
.code-block {
|
|
9
|
+
--code-block-code-padding: 16px;
|
|
10
|
+
|
|
11
|
+
position: relative;
|
|
12
|
+
color: var(--code-block-color-foreground-primary);
|
|
13
|
+
background-color: var(--code-block-color-surface-primary);
|
|
14
|
+
border: 1px solid var(--code-block-color-border-strong);
|
|
15
|
+
|
|
16
|
+
pre,
|
|
17
|
+
code {
|
|
18
|
+
line-height: 1.4286;
|
|
19
|
+
white-space: pre;
|
|
20
|
+
text-align: left;
|
|
21
|
+
text-shadow: none;
|
|
22
|
+
word-wrap: normal;
|
|
23
|
+
word-break: normal;
|
|
24
|
+
word-spacing: normal;
|
|
25
|
+
tab-size: 4;
|
|
26
|
+
hyphens: none;
|
|
27
|
+
|
|
28
|
+
@media print {
|
|
29
|
+
text-shadow: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@media print {
|
|
34
|
+
.line-highlight {
|
|
35
|
+
/*
|
|
36
|
+
* This will prevent browsers from replacing the background color with white.
|
|
37
|
+
* It's necessary because the element is layered on top of the displayed code.
|
|
38
|
+
*/
|
|
39
|
+
-webkit-print-color-adjust: exact;
|
|
40
|
+
print-color-adjust: exact;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dark {
|
|
46
|
+
// COLORS
|
|
47
|
+
|
|
48
|
+
// Descriptive color names:
|
|
49
|
+
|
|
50
|
+
--code-block-color-blue: #2d8eff;
|
|
51
|
+
--code-block-color-cyan: #32fff7;
|
|
52
|
+
--code-block-color-green: #86ff13;
|
|
53
|
+
--code-block-color-orange: #ffa800;
|
|
54
|
+
--code-block-color-purple: #c76cff;
|
|
55
|
+
--code-block-color-red: #ff3b20;
|
|
56
|
+
|
|
57
|
+
// Semantic color names:
|
|
58
|
+
|
|
59
|
+
// Base UI colors:
|
|
60
|
+
--code-block-color-foreground-primary: #d5d7db;
|
|
61
|
+
--code-block-color-foreground-faint: #b2b6bd;
|
|
62
|
+
--code-block-color-surface-primary: #0d0e12;
|
|
63
|
+
--code-block-color-surface-faint: #15181e;
|
|
64
|
+
// status ----
|
|
65
|
+
--code-block-color-foreground-success: #009241;
|
|
66
|
+
--code-block-color-foreground-critical: #ef3016;
|
|
67
|
+
// interactive ---
|
|
68
|
+
--code-block-color-foreground-interactive: #dedfe3;
|
|
69
|
+
--code-block-color-foreground-interactive-hover: #fff;
|
|
70
|
+
--code-block-color-foreground-interactive-active: #f1f2f3;
|
|
71
|
+
--code-block-color-surface-interactive-active: #2b303c;
|
|
72
|
+
// actions ---
|
|
73
|
+
--code-block-color-foreground-action: #2b89ff;
|
|
74
|
+
--code-block-color-foreground-action-hover: #389aff;
|
|
75
|
+
--code-block-color-foreground-action-active: #4ca1ff;
|
|
76
|
+
// borders
|
|
77
|
+
--code-block-color-border-strong: rgba(178, 182, 189, 40%); // #b2b6bd66
|
|
78
|
+
--code-block-color-border-primary: rgba(178, 182, 189, 20%); // #b2b6bd33
|
|
79
|
+
// selection
|
|
80
|
+
--code-block-color-foreground-selection: #0d0e12;
|
|
81
|
+
--code-block-color-surface-selection: #86ff13;
|
|
82
|
+
|
|
83
|
+
// CodeBlock UI:
|
|
84
|
+
// lines of code - highlighted ----
|
|
85
|
+
--code-block-color-line-highlight: rgba(0, 74, 222, 20%);
|
|
86
|
+
--code-block-color-line-highlight-border: #1555d4;
|
|
87
|
+
|
|
88
|
+
// Syntax highlighting tokens:
|
|
89
|
+
// general ----
|
|
90
|
+
--code-block-color-token: var(--code-block-color-foreground-primary);
|
|
91
|
+
// specific ----
|
|
92
|
+
--code-block-color-atrule: var(--code-block-color-blue);
|
|
93
|
+
--code-block-color-code-block-attr-name: var(--code-block-color-blue);
|
|
94
|
+
--code-block-color-attr-value: var(--code-block-color-blue);
|
|
95
|
+
--code-block-color-boolean: var(--code-block-color-purple);
|
|
96
|
+
--code-block-color-builtin: var(--code-block-color-orange);
|
|
97
|
+
--code-block-color-char: var(--code-block-color-orange);
|
|
98
|
+
--code-block-color-class-name: var(--code-block-color-blue);
|
|
99
|
+
--code-block-color-comment: var(--code-block-color-foreground-faint);
|
|
100
|
+
--code-block-color-control: var(--code-block-color-cyan);
|
|
101
|
+
--code-block-color-constant: var(--code-block-color-purple);
|
|
102
|
+
--code-block-color-deleted: var(--code-block-color-red);
|
|
103
|
+
--code-block-color-entity: var(--code-block-color-green);
|
|
104
|
+
--code-block-color-function: var(--code-block-color-blue);
|
|
105
|
+
--code-block-color-important: var(--code-block-color-red);
|
|
106
|
+
--code-block-color-keyword: var(--code-block-color-green);
|
|
107
|
+
--code-block-color-namespace: var(--code-block-color-red);
|
|
108
|
+
--code-block-color-number: var(--code-block-color-purple);
|
|
109
|
+
--code-block-color-operator: var(--code-block-color-cyan);
|
|
110
|
+
--code-block-color-prolog: var(--code-block-color-foreground-primary);
|
|
111
|
+
--code-block-color-property: var(--code-block-color-blue);
|
|
112
|
+
--code-block-color-punctuation: var(--code-block-color-foreground-primary);
|
|
113
|
+
--code-block-color-regex: var(--code-block-color-orange);
|
|
114
|
+
--code-block-color-script: var(--code-block-color-foreground-primary);
|
|
115
|
+
--code-block-color-selector: var(--code-block-color-green);
|
|
116
|
+
--code-block-color-string: var(--code-block-color-orange);
|
|
117
|
+
--code-block-color-symbol: var(--code-block-color-orange);
|
|
118
|
+
--code-block-color-tag: var(--code-block-color-green);
|
|
119
|
+
--code-block-color-url: var(--code-block-color-cyan);
|
|
120
|
+
// language-scoped:
|
|
121
|
+
// css ----
|
|
122
|
+
--code-block-color-lang-css: var(--code-block-color-purple);
|
|
123
|
+
--code-block-color-lang-css-token: var(--code-block-color-green);
|
|
124
|
+
--code-block-color-lang-css-atrule: var(--code-block-color-purple);
|
|
125
|
+
--code-block-color-lang-css-entity: var(--code-block-color-blue);
|
|
126
|
+
--code-block-color-lang-css-function: var(--code-block-color-cyan);
|
|
127
|
+
--code-block-color-lang-css-property: var(--code-block-color-cyan);
|
|
128
|
+
--code-block-color-lang-css-punctuation: var(--code-block-color-orange);
|
|
129
|
+
--code-block-color-lang-css-not-atrule: var(
|
|
130
|
+
--code-block-color-foreground-primary
|
|
131
|
+
);
|
|
132
|
+
--code-block-color-lang-css-selector: var(--code-block-color-blue);
|
|
133
|
+
--code-block-color-lang-css-url: var(--code-block-color-orange);
|
|
134
|
+
// javascript ----
|
|
135
|
+
--code-block-color-lang-js-constant: var(--code-block-color-orange);
|
|
136
|
+
// markup/html ----
|
|
137
|
+
--code-block-color-lang-markup-attr-value: var(--code-block-color-yellow);
|
|
138
|
+
--code-block-color-lang-markup-entity-named: var(--code-block-color-purple);
|
|
139
|
+
--code-block-color-lang-markup-entity-not-named: var(
|
|
140
|
+
--code-block-color-green
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Syntax highlighting ----
|
|
145
|
+
// General
|
|
146
|
+
.code-block {
|
|
147
|
+
// Common tokens
|
|
148
|
+
:global(.token.bold) {
|
|
149
|
+
font-weight: bold;
|
|
150
|
+
}
|
|
151
|
+
:global(.token.italic) {
|
|
152
|
+
font-style: italic;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// General tokens
|
|
156
|
+
:global(.token) {
|
|
157
|
+
color: var(--code-block-color-token);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:global(.token.atrule) {
|
|
161
|
+
color: var(--code-block-color-atrule);
|
|
162
|
+
}
|
|
163
|
+
:global(.token.attr-name) {
|
|
164
|
+
color: var(--code-block-color-attr-name);
|
|
165
|
+
}
|
|
166
|
+
:global(.token.attr-value) {
|
|
167
|
+
color: var(--code-block-color-attr-value);
|
|
168
|
+
}
|
|
169
|
+
:global(.token.boolean) {
|
|
170
|
+
color: var(--code-block-color-boolean);
|
|
171
|
+
}
|
|
172
|
+
:global(.token.builtin) {
|
|
173
|
+
color: var(--code-block-color-builtin);
|
|
174
|
+
}
|
|
175
|
+
:global(.token.char) {
|
|
176
|
+
color: var(--code-block-color-char);
|
|
177
|
+
}
|
|
178
|
+
:global(.token.class-name) {
|
|
179
|
+
color: var(--code-block-color-class-name);
|
|
180
|
+
}
|
|
181
|
+
:global(.token.comment) {
|
|
182
|
+
color: var(--code-block-color-comment);
|
|
183
|
+
}
|
|
184
|
+
:global(.token.constant) {
|
|
185
|
+
color: var(--code-block-color-constant);
|
|
186
|
+
}
|
|
187
|
+
:global(.token.deleted) {
|
|
188
|
+
color: var(--code-block-color-deleted);
|
|
189
|
+
}
|
|
190
|
+
:global(.token.entity) {
|
|
191
|
+
color: var(--code-block-color-entity);
|
|
192
|
+
}
|
|
193
|
+
:global(.token.function) {
|
|
194
|
+
color: var(--code-block-color-function);
|
|
195
|
+
}
|
|
196
|
+
:global(.token.important) {
|
|
197
|
+
color: var(--code-block-color-important);
|
|
198
|
+
}
|
|
199
|
+
:global(.token.keyword) {
|
|
200
|
+
color: var(--code-block-color-keyword);
|
|
201
|
+
}
|
|
202
|
+
:global(.token.namespace) {
|
|
203
|
+
color: var(--code-block-color-namespace);
|
|
204
|
+
}
|
|
205
|
+
:global(.token.number) {
|
|
206
|
+
color: var(--code-block-color-number);
|
|
207
|
+
}
|
|
208
|
+
:global(.token.operator) {
|
|
209
|
+
color: var(--code-block-color-operator);
|
|
210
|
+
}
|
|
211
|
+
:global(.token.punctuation) {
|
|
212
|
+
color: var(--code-block-color-punctuation);
|
|
213
|
+
}
|
|
214
|
+
:global(.token.prolog) {
|
|
215
|
+
color: var(--code-block-color-prolog);
|
|
216
|
+
}
|
|
217
|
+
:global(.token.property) {
|
|
218
|
+
color: var(--code-block-color-property);
|
|
219
|
+
}
|
|
220
|
+
:global(.token.regex) {
|
|
221
|
+
color: var(--code-block-color-regex);
|
|
222
|
+
}
|
|
223
|
+
:global(.token.script) {
|
|
224
|
+
color: var(--code-block-color-script);
|
|
225
|
+
}
|
|
226
|
+
:global(.token.selector) {
|
|
227
|
+
color: var(--code-block-color-selector);
|
|
228
|
+
}
|
|
229
|
+
:global(.token.string) {
|
|
230
|
+
color: var(--code-block-color-string);
|
|
231
|
+
}
|
|
232
|
+
:global(.token.symbol) {
|
|
233
|
+
color: var(--code-block-color-symbol);
|
|
234
|
+
}
|
|
235
|
+
:global(.token.tag) {
|
|
236
|
+
color: var(--code-block-color-tag);
|
|
237
|
+
}
|
|
238
|
+
:global(.token.url) {
|
|
239
|
+
color: var(--code-block-color-url);
|
|
240
|
+
}
|
|
241
|
+
:global(.token.variable) {
|
|
242
|
+
color: var(--code-block-color-comment);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Language-specific
|
|
246
|
+
.language-css {
|
|
247
|
+
color: var(--code-block-color-lang-css);
|
|
248
|
+
|
|
249
|
+
.token {
|
|
250
|
+
color: var(--code-block-color-lang-css-token);
|
|
251
|
+
}
|
|
252
|
+
:global(.token.atrule) {
|
|
253
|
+
color: var(--code-block-color-lang-css-atrule);
|
|
254
|
+
}
|
|
255
|
+
:global(.token.rule:not(.atrule)) {
|
|
256
|
+
color: var(--code-block-color-lang-css-not-atrule);
|
|
257
|
+
}
|
|
258
|
+
:global(.token.entity) {
|
|
259
|
+
color: var(--code-block-color-lang-css-entity);
|
|
260
|
+
}
|
|
261
|
+
:global(.token.function) {
|
|
262
|
+
color: var(--code-block-color-lang-css-function);
|
|
263
|
+
}
|
|
264
|
+
:global(.token.property) {
|
|
265
|
+
color: var(--code-block-color-lang-css-property);
|
|
266
|
+
}
|
|
267
|
+
:global(.token.punctuation) {
|
|
268
|
+
color: var(--code-block-color-lang-css-punctuatione);
|
|
269
|
+
}
|
|
270
|
+
:global(.token.selector) {
|
|
271
|
+
color: var(--code-block-color-lang-css-selector);
|
|
272
|
+
}
|
|
273
|
+
:global(.token.url) {
|
|
274
|
+
color: var(--code-block-color-lang-css-url);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
.language-javascript {
|
|
278
|
+
:global(.token.constant) {
|
|
279
|
+
color: var(--code-block-color-lang-js-constant);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
.language-markup,
|
|
283
|
+
.language-html {
|
|
284
|
+
:global(.token.attr-value) {
|
|
285
|
+
color: var(--code-block-color-lang-markup-attr-value);
|
|
286
|
+
}
|
|
287
|
+
:global(.token.entity.named-entity) {
|
|
288
|
+
color: var(--code-block-color-lang-markup-entity-named);
|
|
289
|
+
}
|
|
290
|
+
:global(.token.entity:not(.named-entity)) {
|
|
291
|
+
color: var(--code-block-color-lang-markup-entity-not-named);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// isStandalone
|
|
296
|
+
.is-standalone {
|
|
297
|
+
border-radius: 6px;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// CHILD COMPONENTS / ELEMENTS
|
|
301
|
+
|
|
302
|
+
// Header (contains title & description)
|
|
303
|
+
|
|
304
|
+
.title {
|
|
305
|
+
color: var(--code-block-color-foreground-primary);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.description {
|
|
309
|
+
color: var(--code-block-color-foreground-faint);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.header {
|
|
313
|
+
display: flex;
|
|
314
|
+
flex-direction: column;
|
|
315
|
+
gap: 4px;
|
|
316
|
+
padding: 8px var(--code-block-code-padding);
|
|
317
|
+
background-color: var(--code-block-color-surface-faint);
|
|
318
|
+
border-bottom: 1px solid var(--code-block-color-border-primary);
|
|
319
|
+
border-top-left-radius: inherit;
|
|
320
|
+
border-top-right-radius: inherit;
|
|
321
|
+
|
|
322
|
+
&:empty {
|
|
323
|
+
display: none;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// we add very basic styling for elements that may be yielded in the "title"/"description" elements
|
|
327
|
+
|
|
328
|
+
strong {
|
|
329
|
+
font-weight: var(--mds-typography-font-weight-semibold);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
code,
|
|
333
|
+
pre {
|
|
334
|
+
display: inline;
|
|
335
|
+
font-size: 0.9em; // as discussed with designers, we reduce the size for optical/visual balance
|
|
336
|
+
font-family: var(--mds-typography-font-stack-mono);
|
|
337
|
+
line-height: 1em;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
a {
|
|
341
|
+
color: var(--code-block-color-foreground-action);
|
|
342
|
+
|
|
343
|
+
&:focus,
|
|
344
|
+
&:focus-visible {
|
|
345
|
+
text-decoration: none;
|
|
346
|
+
outline: 2px solid var(--mds-color-focus-action-internal);
|
|
347
|
+
outline-offset: 1px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
&:hover {
|
|
351
|
+
color: var(--mds-color-foreground-action-hover);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&:active {
|
|
355
|
+
color: var(--mds-color-foreground-action-active);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.body {
|
|
361
|
+
position: relative;
|
|
362
|
+
border-radius: inherit;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Code
|
|
366
|
+
.code {
|
|
367
|
+
@include hds-focus-ring-basic();
|
|
368
|
+
display: block;
|
|
369
|
+
margin: 0;
|
|
370
|
+
padding: var(--code-block-code-padding) 0;
|
|
371
|
+
overflow: auto;
|
|
372
|
+
font-size: 0.8125rem;
|
|
373
|
+
font-family: var(--mds-typography-font-stack-mono);
|
|
374
|
+
border-radius: inherit;
|
|
375
|
+
|
|
376
|
+
::selection {
|
|
377
|
+
color: var(--code-block-color-foreground-selection);
|
|
378
|
+
background-color: var(--code-block-color-surface-selection);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// CopyButton
|
|
383
|
+
.copy-button {
|
|
384
|
+
--copy-button-token-idle: var(--code-block-color-foreground-primary);
|
|
385
|
+
--copy-button-token-success: var(--code-block-color-foreground-success);
|
|
386
|
+
--copy-button-token-error: var(--code-block-color-foreground-success);
|
|
387
|
+
|
|
388
|
+
position: absolute !important;
|
|
389
|
+
top: 11px; // 12px -1px accounting for border
|
|
390
|
+
right: 12px; // 12px -1px accounting for border
|
|
391
|
+
// Overriding default colors must have !important due to style modules
|
|
392
|
+
color: var(--code-block-color-foreground-primary) !important;
|
|
393
|
+
background-color: var(--code-block-color-surface-faint) !important;
|
|
394
|
+
border: 1px solid var(--code-block-color-border-strong) !important;
|
|
395
|
+
|
|
396
|
+
&:hover {
|
|
397
|
+
background-color: var(--code-block-color-surface-primary) !important;
|
|
398
|
+
border-color: var(--code-block-color-border-strong) !important;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
&:active {
|
|
402
|
+
background-color: var(
|
|
403
|
+
--code-block-color-surface-interactive-active
|
|
404
|
+
) !important;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
&:focus,
|
|
408
|
+
&:focus-visible {
|
|
409
|
+
background-color: var(--code-block-color-surface-faint) !important;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Highlighted Lines
|
|
414
|
+
.line-highlight {
|
|
415
|
+
right: 0;
|
|
416
|
+
left: 0;
|
|
417
|
+
margin-top: 0px;
|
|
418
|
+
background-color: var(--code-block-color-line-highlight);
|
|
419
|
+
border: solid var(--code-block-color-line-highlight-border);
|
|
420
|
+
border-width: 0 0 0 4px;
|
|
421
|
+
mix-blend-mode: screen;
|
|
422
|
+
pointer-events: none;
|
|
423
|
+
|
|
424
|
+
// Enable the top border if this is the first line in a group of lines
|
|
425
|
+
&.line-highlight-first {
|
|
426
|
+
border-top-width: 1px;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Enable the bottom border if this is the last line in a group of lines
|
|
430
|
+
&.line-highlight-last {
|
|
431
|
+
border-bottom-width: 1px;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.line-numbers {
|
|
436
|
+
counter-reset: linenumber;
|
|
437
|
+
|
|
438
|
+
.code {
|
|
439
|
+
position: relative;
|
|
440
|
+
padding-left: 49px;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.line-numbers-rows {
|
|
444
|
+
position: absolute;
|
|
445
|
+
top: 0;
|
|
446
|
+
left: 0;
|
|
447
|
+
min-width: 49px;
|
|
448
|
+
min-height: 100%;
|
|
449
|
+
padding: var(--code-block-code-padding) 0;
|
|
450
|
+
border-right: 1px solid var(--code-block-color-border-primary);
|
|
451
|
+
user-select: none;
|
|
452
|
+
pointer-events: none;
|
|
453
|
+
|
|
454
|
+
> span {
|
|
455
|
+
display: block;
|
|
456
|
+
counter-increment: linenumber;
|
|
457
|
+
|
|
458
|
+
&::before {
|
|
459
|
+
display: block;
|
|
460
|
+
padding-right: var(--code-block-code-padding);
|
|
461
|
+
text-align: right;
|
|
462
|
+
content: counter(linenumber);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.line-of-code.line-highlight {
|
|
468
|
+
// This disables the thicker left border on highlighted lines.
|
|
469
|
+
border-width: 0;
|
|
470
|
+
|
|
471
|
+
// This resets the left padding to the original value.
|
|
472
|
+
padding-left: var(--mds-spacing-05);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.line-of-code {
|
|
477
|
+
// Lines of code are <span> elements which are inline by default, but
|
|
478
|
+
// we want them to take up the full width of the code block.
|
|
479
|
+
display: block;
|
|
480
|
+
|
|
481
|
+
// When we're rendering line numbers, we need to add padding to the
|
|
482
|
+
// left of lines of code to make room for the line numbers.
|
|
483
|
+
padding-left: var(--mds-spacing-05);
|
|
484
|
+
|
|
485
|
+
&.line-highlight {
|
|
486
|
+
// This accounts for the 4px margin on the left side so the content
|
|
487
|
+
// does not get moved by the margin.
|
|
488
|
+
padding-left: var(--mds-spacing-04);
|
|
489
|
+
|
|
490
|
+
// Enable the top border if this is the first line in a group of lines
|
|
491
|
+
&.line-highlight-first {
|
|
492
|
+
border-top-width: 1px;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// Enable the bottom border if this is the last line in a group of lines
|
|
496
|
+
&.line-highlight-last {
|
|
497
|
+
border-bottom-width: 1px;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
& > span {
|
|
502
|
+
padding-right: var(--mds-spacing-09);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.line-number {
|
|
507
|
+
// Line numbers are <span> elements which are inline by default, but we
|
|
508
|
+
// want them to behave like block elements.
|
|
509
|
+
display: block;
|
|
510
|
+
color: #999;
|
|
511
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const e = "dark__aBMo7", n = "token__aGMSy", t = "title__nX-Ny", i = "description__-44hG", _ = "header__42Fek", a = "body__pLFmP", l = "code__J06se", o = {
|
|
2
|
+
"code-block": "code-block__dOm6M",
|
|
3
|
+
"line-highlight": "line-highlight__a84m6",
|
|
4
|
+
dark: e,
|
|
5
|
+
"language-css": "language-css__8iYaN",
|
|
6
|
+
token: n,
|
|
7
|
+
"language-javascript": "language-javascript__EWK5u",
|
|
8
|
+
"language-markup": "language-markup__E7NSA",
|
|
9
|
+
"language-html": "language-html__rLwMK",
|
|
10
|
+
"is-standalone": "is-standalone__WLWxy",
|
|
11
|
+
title: t,
|
|
12
|
+
description: i,
|
|
13
|
+
header: _,
|
|
14
|
+
body: a,
|
|
15
|
+
code: l,
|
|
16
|
+
"copy-button": "copy-button__nMsTD",
|
|
17
|
+
"line-highlight-first": "line-highlight-first__OMDUP",
|
|
18
|
+
"line-highlight-last": "line-highlight-last__qC6nm",
|
|
19
|
+
"line-numbers": "line-numbers__a9m-I",
|
|
20
|
+
"line-numbers-rows": "line-numbers-rows__MjGTO",
|
|
21
|
+
"line-of-code": "line-of-code__mDztA",
|
|
22
|
+
"line-number": "line-number__-g7V-"
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
a as body,
|
|
26
|
+
l as code,
|
|
27
|
+
e as dark,
|
|
28
|
+
o as default,
|
|
29
|
+
i as description,
|
|
30
|
+
_ as header,
|
|
31
|
+
t as title,
|
|
32
|
+
n as token
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=code-block.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface CodeLinesProps {
|
|
3
|
+
value: ReactNode;
|
|
4
|
+
hasLineNumbers?: boolean;
|
|
5
|
+
highlightLines?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Render the provided code into separate line elements,
|
|
9
|
+
* accounting for all provided options.
|
|
10
|
+
*/
|
|
11
|
+
declare const CodeLines: ({ value, hasLineNumbers: lineNumbers, highlightLines: highlight, }: CodeLinesProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { CodeLines };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as c, Fragment as L, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as d } from "react";
|
|
4
|
+
import u from "classnames";
|
|
5
|
+
import G from "../utils/parse-highlighted-lines.js";
|
|
6
|
+
import N from "./utils/split-jsx-into-lines.js";
|
|
7
|
+
import b from "./utils/split-html-into-lines.js";
|
|
8
|
+
import h from "../code-block.module.scss.js";
|
|
9
|
+
const S = ({
|
|
10
|
+
value: n,
|
|
11
|
+
hasLineNumbers: I,
|
|
12
|
+
highlightLines: f
|
|
13
|
+
}) => {
|
|
14
|
+
const o = G(f), m = d(() => (typeof n == "string" ? b(n) : N(n)).map((g, l) => {
|
|
15
|
+
const t = l + 1, s = o.indexOf(t) !== -1;
|
|
16
|
+
return { children: g, highlight: s };
|
|
17
|
+
}).map(({ highlight: g, ...l }, t, s) => {
|
|
18
|
+
const p = t === 0 ? null : s[t - 1], a = t === s.length - 1 ? null : s[t + 1];
|
|
19
|
+
return {
|
|
20
|
+
...l,
|
|
21
|
+
highlight: g,
|
|
22
|
+
highlightIsFirstInGroup: !p || !p.highlight,
|
|
23
|
+
highlightIsLastInGroup: !a || !a.highlight
|
|
24
|
+
};
|
|
25
|
+
}), [n, o]);
|
|
26
|
+
return /* @__PURE__ */ c(L, { children: [
|
|
27
|
+
I ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: h["line-numbers-rows"], children: m.map((i, r) => /* @__PURE__ */ e(
|
|
28
|
+
"span",
|
|
29
|
+
{
|
|
30
|
+
className: u(h["line-number"], {
|
|
31
|
+
[h["line-highlight"]]: i.highlight,
|
|
32
|
+
[h["line-highlight-first"]]: i.highlightIsFirstInGroup,
|
|
33
|
+
[h["line-highlight-last"]]: i.highlightIsLastInGroup
|
|
34
|
+
})
|
|
35
|
+
},
|
|
36
|
+
r
|
|
37
|
+
)) }) : null,
|
|
38
|
+
/* @__PURE__ */ e("span", { children: m.map((i, r) => /* @__PURE__ */ c(
|
|
39
|
+
"span",
|
|
40
|
+
{
|
|
41
|
+
className: u(h["line-of-code"], {
|
|
42
|
+
[h["line-highlight"]]: i.highlight,
|
|
43
|
+
[h["line-highlight-first"]]: i.highlightIsFirstInGroup,
|
|
44
|
+
[h["line-highlight-last"]]: i.highlightIsLastInGroup
|
|
45
|
+
}),
|
|
46
|
+
children: [
|
|
47
|
+
i.children,
|
|
48
|
+
`
|
|
49
|
+
`
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
r
|
|
53
|
+
)) })
|
|
54
|
+
] });
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
S as CodeLines
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/code-block/code-lines/index.tsx"],"sourcesContent":["'use client'\n\n/**\n * Note: lines of code are expected to be stable. If we need to work with\n * dynamic code blocks in the future, we could assign random unique IDs\n * to each line during the `linesOfCode` `useMemo` function.\n *\n * For now, we disable react/no-array-index key for the entire file.\n */\n/* eslint-disable react/no-array-index-key */\n\nimport { useMemo, type ReactNode } from 'react'\nimport classNames from 'classnames'\nimport parseHighlightedLines from '../utils/parse-highlighted-lines'\nimport splitJsxIntoLines from './utils/split-jsx-into-lines'\nimport splitHtmlIntoLines from './utils/split-html-into-lines'\nimport s from '../code-block.module.scss'\n\ninterface CodeLinesProps {\n\tvalue: ReactNode\n\thasLineNumbers?: boolean\n\thighlightLines?: string\n}\n\n/**\n * Render the provided code into separate line elements,\n * accounting for all provided options.\n */\nconst CodeLines = ({\n\tvalue,\n\thasLineNumbers: lineNumbers,\n\thighlightLines: highlight,\n}: CodeLinesProps) => {\n\t// Parse out an array of integers representing which lines to highlight\n\tconst highlightedLines = parseHighlightedLines(highlight) as number[]\n\n\t/**\n\t * Split the incoming code into lines.\n\t * We need to do this in order to render each line of code in a\n\t * separate element, which is necessary for features such as highlighting\n\t * specific lines and allowing code to wrap.\n\t */\n\tconst linesOfCode = useMemo(() => {\n\t\tconst isHtmlString = typeof value === 'string'\n\t\tconst lineElements = isHtmlString\n\t\t\t? splitHtmlIntoLines(value)\n\t\t\t: splitJsxIntoLines(value)\n\t\treturn lineElements\n\t\t\t.map((children, index) => {\n\t\t\t\tconst number = index + 1\n\t\t\t\tconst highlight = highlightedLines.indexOf(number) !== -1\n\t\t\t\treturn { children, highlight }\n\t\t\t})\n\t\t\t.map(({ highlight, ...rest }, index, lines) => {\n\t\t\t\t// Add properties to help with highlighting adjacent lines of code,\n\t\t\t\t// in which case we want to apply a border to the first and last lines,\n\t\t\t\t// but not the lines in the middle of the group.\n\t\t\t\tconst prevLine = index === 0 ? null : lines[index - 1]\n\t\t\t\tconst nextLine = index === lines.length - 1 ? null : lines[index + 1]\n\t\t\t\treturn {\n\t\t\t\t\t...rest,\n\t\t\t\t\thighlight,\n\t\t\t\t\thighlightIsFirstInGroup: !prevLine || !prevLine.highlight,\n\t\t\t\t\thighlightIsLastInGroup: !nextLine || !nextLine.highlight,\n\t\t\t\t}\n\t\t\t})\n\t}, [value, highlightedLines])\n\n\t/**\n\t * For overflowing code, we use a two-column layout.\n\t * The first column contains line numbers, and is effectively fixed.\n\t * The second column contains the lines themselves, and is an overflow\n\t * container to allow extra long lines to scroll as needed.\n\t */\n\treturn (\n\t\t<>\n\t\t\t{lineNumbers ? (\n\t\t\t\t<span aria-hidden=\"true\" className={s['line-numbers-rows']}>\n\t\t\t\t\t{linesOfCode.map((line, idx) => (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\t\tclassName={classNames(s['line-number'], {\n\t\t\t\t\t\t\t\t[s['line-highlight']]: line.highlight,\n\t\t\t\t\t\t\t\t[s['line-highlight-first']]: line.highlightIsFirstInGroup,\n\t\t\t\t\t\t\t\t[s['line-highlight-last']]: line.highlightIsLastInGroup,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t<span>\n\t\t\t\t{linesOfCode.map((line, idx) => (\n\t\t\t\t\t<span\n\t\t\t\t\t\tkey={idx}\n\t\t\t\t\t\tclassName={classNames(s['line-of-code'], {\n\t\t\t\t\t\t\t[s['line-highlight']]: line.highlight,\n\t\t\t\t\t\t\t[s['line-highlight-first']]: line.highlightIsFirstInGroup,\n\t\t\t\t\t\t\t[s['line-highlight-last']]: line.highlightIsLastInGroup,\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{line.children}\n\t\t\t\t\t\t{/* We are _not_ rendering our lines as block elements, so we need\n\t\t\t\t\t\t to add a trailing newline to all lines. As well, trailing\n\t\t\t\t\t\t\t\tnewlines are necessary for some browsers (FireFox)\n\t\t\t\t\t\t to preserve whitespace during select-and-copy of code */}\n\t\t\t\t\t\t{'\\n'}\n\t\t\t\t\t</span>\n\t\t\t\t))}\n\t\t\t</span>\n\t\t</>\n\t)\n}\n\nexport { CodeLines }\n"],"names":["CodeLines","value","lineNumbers","highlight","highlightedLines","parseHighlightedLines","useMemo","splitHtmlIntoLines","splitJsxIntoLines","children","index","number","highlight2","rest","prevLine","lines","nextLine","jsxs","Fragment","jsx","s","linesOfCode","line","idx","classNames"],"mappings":";;;;;;;;AA4BmB,MAClBA,IAAA,CAAA;AAAA,EACA,OAAAC;AAAA,EACA,gBAAgBC;AAAA,EACjB,gBAAsBC;AAErB;AAQA,QAAMC,IAAcC,EAAcF,CAAA,OAC3BG,EAAe,OACA,OAAAL,KAClB,WAGcM,EAAUN,CAAA,IAAAO,EAAAP,CAAA,GACV,KAAQQ,GAAAC,MAAA;AACvB,UAAMP,IAAAA,IAAY,OACCC,UAAUO,CAAA,MAAA;AAC7B,aACO,UAAAF,GAAAN,WAAAA;EAIP,CAAA,EAAA,IAAA,CAAM,EAAA,WAAWS,GAAc,GAAAC,EAAO,GAAAH,SAAe;AACrD,UAAMI,IAAWJ,MAAU,IAAA,OAAMK,MAAa,CAAO,GACrDC,IAAON,MAAAK,EAAA,SAAA,IAAA,OAAAA,EAAAL,IAAA,CAAA;AAAA,WACH;AAAA,MACH,GAAAG;AAAA,MACA,WAAAD;AAAA,MACA,yBAAyB,MAAa,GAAS;AAAA,MAChD,wBAAA,CAAAI,KAAA,CAAAA,EAAA;AAAA,IACA;AAAA,EACH,CAAG,QASF,CAAA;AACE,SAAA,gBAAAC,EAAAC,GACC,EAAA,UAAK;AAAA,IAEJhB,IAAC,gBAAAiB,EAAA,QAAA,EAAA,eAAA,QAAA,WAAAC,EAAA,mBAAA,GAAA,UAAAC,EAAA,IAAA,CAAAC,GAAAC,MAAA,gBAAAJ;AAAA,MAAA;AAAA,MAAA;AAAA,QAEwC,WACpCK,EAAiBJ,EAAA,aAAQ,GAAA;AAAA,UAC5B,CAACA,EAAE,gBAAA,CAAA,GAAAE,EAAuB;AAAA,UAC1B,CAACF,EAAE,sBAAsB,CAAA,KAAQ;AAAA,UACjC,CAAAA,EAAA,qBAAA,CAAA,GAAAE,EAAA;AAAA,QAAA,CAAA;AAAA,MALI;AAAA;IASL,CAAA,EAAA,CAAA,IAAA;AAAA,IAGD,gBAAAH,EAAA,QAAA,EAAA,UAAAE,EAAA,IAAA,CAAAC,GAAAC,MAAA,gBAAAN;AAAA,MAAA;AAAA,MAAA;AAAA,QAEyC,WACrCO,EAAiBJ,EAAA,cAAQ,GAAA;AAAA,UAC5B,CAACA,EAAE,gBAAA,CAAA,GAAAE,EAAuB;AAAA,UAC1B,CAACF,EAAE,sBAAsB,CAAA,KAAQ;AAAA,UACjC,CAAAA,EAAA,qBAAA,CAAA,GAAAE,EAAA;AAAA,QAEA;QAAA,UAAK;AAAA,UAKLA,EAAA;AAAA,UAAA;AAAA;AAAA,QAAA;AAAA,MAZI;AAAA,MAcNC;AAAA,KAEH,EAAA,CAAA;AAAA,EAEF,EAAA,CAAA;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Given a string of HTML, split it on newlines,
|
|
4
|
+
* and return an array of React <span> elements,
|
|
5
|
+
* each of which will contain a single line.
|
|
6
|
+
*
|
|
7
|
+
* Note that HTML tokens should not be multi-line,
|
|
8
|
+
* ie, all newline characters should be surfaced
|
|
9
|
+
* to the top level rather than nested in syntax
|
|
10
|
+
* highlighting tokens (otherwise the line-by-line
|
|
11
|
+
* markup we render would be invalid). We have
|
|
12
|
+
* a rehype plugin we use with our highlightString()
|
|
13
|
+
* utility to ensure newlines are surfaced in this way.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} codeHtml String of HTML
|
|
16
|
+
* @returns Array of JSX <span> elements
|
|
17
|
+
*/
|
|
18
|
+
declare function splitHtmlIntoLines(codeHtml: string): (ReactNode | null)[];
|
|
19
|
+
export default splitHtmlIntoLines;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
const r = '<span class="line"></span>';
|
|
3
|
+
function p(t) {
|
|
4
|
+
const s = t.split(`
|
|
5
|
+
`);
|
|
6
|
+
return s.map((n, i) => i == s.length - 1 && n == "" ? null : /* @__PURE__ */ e(
|
|
7
|
+
"span",
|
|
8
|
+
{
|
|
9
|
+
dangerouslySetInnerHTML: {
|
|
10
|
+
__html: n === "" || n === r ? " " : n
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
i
|
|
14
|
+
));
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
p as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=split-html-into-lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-html-into-lines.js","sources":["../../../../../src/components/code-block/code-lines/utils/split-html-into-lines.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nconst SHIKI_BLANK_LINE = '<span class=\"line\"></span>'\n/**\n * Given a string of HTML, split it on newlines,\n * and return an array of React <span> elements,\n * each of which will contain a single line.\n *\n * Note that HTML tokens should not be multi-line,\n * ie, all newline characters should be surfaced\n * to the top level rather than nested in syntax\n * highlighting tokens (otherwise the line-by-line\n * markup we render would be invalid). We have\n * a rehype plugin we use with our highlightString()\n * utility to ensure newlines are surfaced in this way.\n *\n * @param {string} codeHtml String of HTML\n * @returns Array of JSX <span> elements\n */\nfunction splitHtmlIntoLines(codeHtml: string): (ReactNode | null)[] {\n\tconst lineParts = codeHtml.split('\\n')\n\treturn lineParts.map((lineHtml, stableIdx) => {\n\t\t// Cut trailing newlines\n\t\tconst isLastLine = stableIdx == lineParts.length - 1\n\t\tconst isTrailingNewline = isLastLine && lineHtml == ''\n\t\tif (isTrailingNewline) return null\n\t\t// Otherwise, render the line\n\t\treturn (\n\t\t\t<span\n\t\t\t\t// This array is stable, so we can use index as key\n\t\t\t\t// eslint-disable-next-line react/no-array-index-key\n\t\t\t\tkey={stableIdx}\n\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t__html:\n\t\t\t\t\t\tlineHtml === '' || lineHtml === SHIKI_BLANK_LINE\n\t\t\t\t\t\t\t? ' '\n\t\t\t\t\t\t\t: lineHtml,\n\t\t\t\t}}\n\t\t\t/>\n\t\t)\n\t})\n}\n\nexport default splitHtmlIntoLines\n"],"names":["SHIKI_BLANK_LINE","splitHtmlIntoLines","codeHtml","lineParts","lineHtml","stableIdx","jsx"],"mappings":";AAEA,MAAMA,IAAmB;AAiBzB,SAASC,EAAmBC,GAAwC;AACnE,QAAMC,IAAYD,EAAS,MAAM;AAAA,CAAI;AACrC,SAAOC,EAAU,IAAI,CAACC,GAAUC,MAEZA,KAAaF,EAAU,SAAS,KACXC,KAAY,KACtB,OAG7B,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MAIA,yBAAyB;AAAA,QACxB,QACCF,MAAa,MAAMA,MAAaJ,IAC7B,WACAI;AAAA,MAAA;AAAA,IACL;AAAA,IANKC;AAAA,EAAA,CASP;AACF;"}
|