@nldd/design-system 0.8.80 → 0.8.83
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/custom-elements.json +1138 -71
- package/dist/components/actions/button/button.d.ts +5 -0
- package/dist/components/actions/button/button.d.ts.map +1 -1
- package/dist/components/actions/button/button.js +8 -0
- package/dist/components/actions/button/button.js.map +1 -1
- package/dist/components/actions/button/button.template.d.ts.map +1 -1
- package/dist/components/actions/button/button.template.js +2 -0
- package/dist/components/actions/button/button.template.js.map +1 -1
- package/dist/components/actions/icon-button/icon-button.d.ts +1 -1
- package/dist/components/actions/icon-button/icon-button.js +1 -1
- package/dist/components/actions/menu/menu.d.ts +25 -2
- package/dist/components/actions/menu/menu.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.js +31 -8
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/actions/menu/menu.template.d.ts +1 -1
- package/dist/components/actions/menu/menu.template.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.template.js +7 -3
- package/dist/components/actions/menu/menu.template.js.map +1 -1
- package/dist/components/actions/toolbar/toolbar.d.ts +20 -0
- package/dist/components/actions/toolbar/toolbar.d.ts.map +1 -1
- package/dist/components/actions/toolbar/toolbar.js +54 -0
- package/dist/components/actions/toolbar/toolbar.js.map +1 -1
- package/dist/components/breakpoints-CkxsiRgH.js +10 -0
- package/dist/components/components.js +52643 -117
- package/dist/components/content/avatar/avatar.styles.d.ts.map +1 -1
- package/dist/components/content/avatar/avatar.styles.js +5 -1
- package/dist/components/content/avatar/avatar.styles.js.map +1 -1
- package/dist/components/content/icon/icon-aliases.d.ts.map +1 -1
- package/dist/components/content/icon/icon-aliases.js +78 -6
- package/dist/components/content/icon/icon-aliases.js.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.d.ts.map +1 -1
- package/dist/components/content/icon/icon-gallery-status.js +63 -92
- package/dist/components/content/icon/icon-gallery-status.js.map +1 -1
- package/dist/components/content/icon/icon-registry.d.ts.map +1 -1
- package/dist/components/content/icon/icon-registry.js +44 -6
- package/dist/components/content/icon/icon-registry.js.map +1 -1
- package/dist/components/content/icon/icon.d.ts +8 -2
- package/dist/components/content/icon/icon.d.ts.map +1 -1
- package/dist/components/content/icon/icon.js +17 -2
- package/dist/components/content/icon/icon.js.map +1 -1
- package/dist/components/content/icon/icon.styles.d.ts.map +1 -1
- package/dist/components/content/icon/icon.styles.js +8 -0
- package/dist/components/content/icon/icon.styles.js.map +1 -1
- package/dist/components/content/text/text.d.ts +50 -0
- package/dist/components/content/text/text.d.ts.map +1 -0
- package/dist/components/content/text/text.js +81 -0
- package/dist/components/content/text/text.js.map +1 -0
- package/dist/components/content/text/text.styles.d.ts +2 -0
- package/dist/components/content/text/text.styles.d.ts.map +1 -0
- package/dist/components/content/text/text.styles.js +116 -0
- package/dist/components/content/text/text.styles.js.map +1 -0
- package/dist/components/content/text/text.template.d.ts +3 -0
- package/dist/components/content/text/text.template.d.ts.map +1 -0
- package/dist/components/content/text/text.template.js +7 -0
- package/dist/components/content/text/text.template.js.map +1 -0
- package/dist/components/content/title/title.styles.d.ts.map +1 -1
- package/dist/components/content/title/title.styles.js +9 -13
- package/dist/components/content/title/title.styles.js.map +1 -1
- package/dist/components/decorate-BKn10QQi.js +9 -0
- package/dist/components/dist-BYVOPNHp.js +381 -0
- package/dist/components/dist-Bq4xc7Bm.js +624 -0
- package/dist/components/dist-C0PiB1dr.js +870 -0
- package/dist/components/dist-C400RcFU.js +1498 -0
- package/dist/components/dist-CCg5Mso_.js +390 -0
- package/dist/components/dist-CJR_Rwhh.js +464 -0
- package/dist/components/dist-Ccw7ZfsU.js +18481 -0
- package/dist/components/dist-OBifyiJS.js +887 -0
- package/dist/components/dist-TpIL8G4G.js +1480 -0
- package/dist/components/dist-afrAoubg.js +1181 -0
- package/dist/components/dist-bO14jlsr.js +78 -0
- package/dist/components/forms/form-field/form-field.d.ts +59 -2
- package/dist/components/forms/form-field/form-field.d.ts.map +1 -1
- package/dist/components/forms/form-field/form-field.js +120 -35
- package/dist/components/forms/form-field/form-field.js.map +1 -1
- package/dist/components/gherkin-uCVRxsGf.js +108 -0
- package/dist/components/icon-C1Kikpol.js +841 -0
- package/dist/components/icon-button-BYy6hnAY.js +1676 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/input-modality-DhTeUxKi.js +43 -0
- package/dist/components/inputs/checkbox/checkbox.d.ts +8 -0
- package/dist/components/inputs/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/inputs/checkbox/checkbox.js +10 -0
- package/dist/components/inputs/checkbox/checkbox.js.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.d.ts +9 -0
- package/dist/components/inputs/checkbox-field/checkbox-field.d.ts.map +1 -1
- package/dist/components/inputs/checkbox-field/checkbox-field.js +11 -0
- package/dist/components/inputs/checkbox-field/checkbox-field.js.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.d.ts +3 -0
- package/dist/components/inputs/code-editor/code-editor.d.ts.map +1 -1
- package/dist/components/inputs/code-editor/code-editor.js +3 -0
- package/dist/components/inputs/code-editor/code-editor.js.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.d.ts +8 -0
- package/dist/components/inputs/combo-box/combo-box.d.ts.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.js +36 -0
- package/dist/components/inputs/combo-box/combo-box.js.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.styles.d.ts.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.styles.js +5 -0
- package/dist/components/inputs/combo-box/combo-box.styles.js.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.template.d.ts.map +1 -1
- package/dist/components/inputs/combo-box/combo-box.template.js +23 -20
- package/dist/components/inputs/combo-box/combo-box.template.js.map +1 -1
- package/dist/components/inputs/date-field/date-field.d.ts +6 -0
- package/dist/components/inputs/date-field/date-field.d.ts.map +1 -1
- package/dist/components/inputs/date-field/date-field.js +11 -0
- package/dist/components/inputs/date-field/date-field.js.map +1 -1
- package/dist/components/inputs/date-field/date-field.template.d.ts.map +1 -1
- package/dist/components/inputs/date-field/date-field.template.js +7 -1
- package/dist/components/inputs/date-field/date-field.template.js.map +1 -1
- package/dist/components/inputs/date-picker/date-picker.d.ts +3 -0
- package/dist/components/inputs/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/inputs/date-picker/date-picker.js +4 -1
- package/dist/components/inputs/date-picker/date-picker.js.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.d.ts +29 -0
- package/dist/components/inputs/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.js +44 -1
- package/dist/components/inputs/dropdown/dropdown.js.map +1 -1
- package/dist/components/inputs/file-field/file-field.d.ts +3 -0
- package/dist/components/inputs/file-field/file-field.d.ts.map +1 -1
- package/dist/components/inputs/file-field/file-field.js +3 -0
- package/dist/components/inputs/file-field/file-field.js.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.d.ts +11 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.d.ts.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.js +11 -0
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.js.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.template.d.ts.map +1 -1
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.template.js +2 -0
- package/dist/components/inputs/multi-line-text-field/multi-line-text-field.template.js.map +1 -1
- package/dist/components/inputs/number-field/number-field.d.ts +9 -0
- package/dist/components/inputs/number-field/number-field.d.ts.map +1 -1
- package/dist/components/inputs/number-field/number-field.js +12 -0
- package/dist/components/inputs/number-field/number-field.js.map +1 -1
- package/dist/components/inputs/number-field/number-field.template.d.ts.map +1 -1
- package/dist/components/inputs/number-field/number-field.template.js +1 -0
- package/dist/components/inputs/number-field/number-field.template.js.map +1 -1
- package/dist/components/inputs/password-field/password-field.d.ts +9 -0
- package/dist/components/inputs/password-field/password-field.d.ts.map +1 -1
- package/dist/components/inputs/password-field/password-field.js +12 -0
- package/dist/components/inputs/password-field/password-field.js.map +1 -1
- package/dist/components/inputs/password-field/password-field.template.d.ts.map +1 -1
- package/dist/components/inputs/password-field/password-field.template.js +1 -0
- package/dist/components/inputs/password-field/password-field.template.js.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.d.ts +8 -0
- package/dist/components/inputs/radio-button/radio-button.d.ts.map +1 -1
- package/dist/components/inputs/radio-button/radio-button.js +10 -0
- package/dist/components/inputs/radio-button/radio-button.js.map +1 -1
- package/dist/components/inputs/radio-button-field/radio-button-field.d.ts +9 -0
- package/dist/components/inputs/radio-button-field/radio-button-field.d.ts.map +1 -1
- package/dist/components/inputs/radio-button-field/radio-button-field.js +11 -0
- package/dist/components/inputs/radio-button-field/radio-button-field.js.map +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.d.ts +16 -0
- package/dist/components/inputs/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/dist/components/inputs/radio-button-group/radio-button-group.js +33 -0
- package/dist/components/inputs/radio-button-group/radio-button-group.js.map +1 -1
- package/dist/components/inputs/search-field/search-field.d.ts +6 -0
- package/dist/components/inputs/search-field/search-field.d.ts.map +1 -1
- package/dist/components/inputs/search-field/search-field.js +6 -0
- package/dist/components/inputs/search-field/search-field.js.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.d.ts +16 -0
- package/dist/components/inputs/segmented-control/segmented-control.d.ts.map +1 -1
- package/dist/components/inputs/segmented-control/segmented-control.js +26 -7
- package/dist/components/inputs/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/inputs/stepper/stepper.d.ts +17 -0
- package/dist/components/inputs/stepper/stepper.d.ts.map +1 -1
- package/dist/components/inputs/stepper/stepper.js +22 -0
- package/dist/components/inputs/stepper/stepper.js.map +1 -1
- package/dist/components/inputs/stepper/stepper.template.js +1 -1
- package/dist/components/inputs/stepper/stepper.template.js.map +1 -1
- package/dist/components/inputs/switch/switch.d.ts +3 -0
- package/dist/components/inputs/switch/switch.d.ts.map +1 -1
- package/dist/components/inputs/switch/switch.js +3 -0
- package/dist/components/inputs/switch/switch.js.map +1 -1
- package/dist/components/inputs/switch-field/switch-field.d.ts +3 -0
- package/dist/components/inputs/switch-field/switch-field.d.ts.map +1 -1
- package/dist/components/inputs/switch-field/switch-field.js +3 -0
- package/dist/components/inputs/switch-field/switch-field.js.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.d.ts +3 -0
- package/dist/components/inputs/text-editor/text-editor.d.ts.map +1 -1
- package/dist/components/inputs/text-editor/text-editor.js +4 -1
- package/dist/components/inputs/text-editor/text-editor.js.map +1 -1
- package/dist/components/inputs/text-field/text-field.d.ts +30 -0
- package/dist/components/inputs/text-field/text-field.d.ts.map +1 -1
- package/dist/components/inputs/text-field/text-field.js +60 -0
- package/dist/components/inputs/text-field/text-field.js.map +1 -1
- package/dist/components/inputs/text-field/text-field.template.d.ts.map +1 -1
- package/dist/components/inputs/text-field/text-field.template.js +3 -0
- package/dist/components/inputs/text-field/text-field.template.js.map +1 -1
- package/dist/components/inputs/time-field/time-field.d.ts +6 -0
- package/dist/components/inputs/time-field/time-field.d.ts.map +1 -1
- package/dist/components/inputs/time-field/time-field.js +11 -0
- package/dist/components/inputs/time-field/time-field.js.map +1 -1
- package/dist/components/inputs/time-field/time-field.template.d.ts.map +1 -1
- package/dist/components/inputs/time-field/time-field.template.js +7 -1
- package/dist/components/inputs/time-field/time-field.template.js.map +1 -1
- package/dist/components/inputs/time-picker/time-picker.d.ts +3 -0
- package/dist/components/inputs/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/inputs/time-picker/time-picker.js +4 -1
- package/dist/components/inputs/time-picker/time-picker.js.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.d.ts +10 -0
- package/dist/components/inputs/toggle-button/toggle-button.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button/toggle-button.js +14 -0
- package/dist/components/inputs/toggle-button/toggle-button.js.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts +11 -0
- package/dist/components/inputs/toggle-button-group/toggle-button-group.d.ts.map +1 -1
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js +16 -6
- package/dist/components/inputs/toggle-button-group/toggle-button-group.js.map +1 -1
- package/dist/components/inputs/token-field/token-field.d.ts +6 -0
- package/dist/components/inputs/token-field/token-field.d.ts.map +1 -1
- package/dist/components/inputs/token-field/token-field.js +13 -0
- package/dist/components/inputs/token-field/token-field.js.map +1 -1
- package/dist/components/layout/box/box.d.ts +3 -3
- package/dist/components/layout/box/box.d.ts.map +1 -1
- package/dist/components/layout/box/box.js +3 -3
- package/dist/components/layout/box/box.js.map +1 -1
- package/dist/components/layout/box/box.styles.d.ts.map +1 -1
- package/dist/components/layout/box/box.styles.js +3 -6
- package/dist/components/layout/box/box.styles.js.map +1 -1
- package/dist/components/layout/sheet/sheet.styles.d.ts.map +1 -1
- package/dist/components/layout/sheet/sheet.styles.js +10 -3
- package/dist/components/layout/sheet/sheet.styles.js.map +1 -1
- package/dist/components/lists-and-tables/list/list.d.ts +60 -45
- package/dist/components/lists-and-tables/list/list.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list/list.js +94 -80
- package/dist/components/lists-and-tables/list/list.js.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.d.ts +94 -21
- package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.js +275 -48
- package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.styles.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.styles.js +116 -34
- package/dist/components/lists-and-tables/list-item/list-item.styles.js.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.template.d.ts +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.template.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.template.js +5 -2
- package/dist/components/lists-and-tables/list-item/list-item.template.js.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts +116 -0
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts.map +1 -0
- package/dist/components/lists-and-tables/{list-item-action/list-item-action.js → list-item-segment/list-item-segment.js} +77 -52
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js.map +1 -0
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.styles.d.ts +2 -0
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.styles.d.ts.map +1 -0
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.styles.js +179 -0
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.styles.js.map +1 -0
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.d.ts +3 -0
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.d.ts.map +1 -0
- package/dist/components/lists-and-tables/{list-item-action/list-item-action.template.js → list-item-segment/list-item-segment.template.js} +5 -4
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.js.map +1 -0
- package/dist/components/reflect-non-default-OLaK60rT.js +37 -0
- package/dist/components/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/components/shadow-resets-aG-rgyNQ.js +61 -0
- package/dist/components/shell-C61GCsJA.js +223 -0
- package/dist/components/status-and-feedback/badge/badge.d.ts +8 -2
- package/dist/components/status-and-feedback/badge/badge.d.ts.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.js +17 -1
- package/dist/components/status-and-feedback/badge/badge.js.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/badge/badge.styles.js +35 -6
- package/dist/components/status-and-feedback/badge/badge.styles.js.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.styles.d.ts.map +1 -1
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.styles.js +7 -0
- package/dist/components/status-and-feedback/modal-dialog/modal-dialog.styles.js.map +1 -1
- package/dist/components/toml-C2HBbPgG.js +59 -0
- package/dist/components/visibility-mixin-GxbwkBb1.js +104 -0
- package/dist/components/with-translations-DzAdFTK8.js +48 -0
- package/dist/css/variables.css +25 -1
- package/dist/nldd.min.js +2797 -2355
- package/dist/types/vue.d.ts +106 -48
- package/dist/utilities/implicit-submission.d.ts +31 -0
- package/dist/utilities/implicit-submission.d.ts.map +1 -0
- package/dist/utilities/implicit-submission.js +65 -0
- package/dist/utilities/implicit-submission.js.map +1 -0
- package/dist/utilities/owned-attribute.d.ts +19 -0
- package/dist/utilities/owned-attribute.d.ts.map +1 -0
- package/dist/utilities/owned-attribute.js +32 -0
- package/dist/utilities/owned-attribute.js.map +1 -0
- package/dist/utilities/scroll-mode-controller.d.ts +9 -1
- package/dist/utilities/scroll-mode-controller.d.ts.map +1 -1
- package/dist/utilities/scroll-mode-controller.js +10 -2
- package/dist/utilities/scroll-mode-controller.js.map +1 -1
- package/package.json +10 -6
- package/dist/components/gherkin-DhZlEZiy.js +0 -115
- package/dist/components/index-8pDDdMeW.js +0 -384
- package/dist/components/index-C7QocEcT.js +0 -81
- package/dist/components/index-CDz7-C9c.js +0 -177
- package/dist/components/index-CWQunWUb.js +0 -75039
- package/dist/components/index-CoY3JfIy.js +0 -688
- package/dist/components/index-DP9dl7P7.js +0 -703
- package/dist/components/index-DV_2YpaH.js +0 -405
- package/dist/components/lists-and-tables/list-item-action/list-item-action.d.ts +0 -108
- package/dist/components/lists-and-tables/list-item-action/list-item-action.d.ts.map +0 -1
- package/dist/components/lists-and-tables/list-item-action/list-item-action.js.map +0 -1
- package/dist/components/lists-and-tables/list-item-action/list-item-action.styles.d.ts +0 -2
- package/dist/components/lists-and-tables/list-item-action/list-item-action.styles.d.ts.map +0 -1
- package/dist/components/lists-and-tables/list-item-action/list-item-action.styles.js +0 -145
- package/dist/components/lists-and-tables/list-item-action/list-item-action.styles.js.map +0 -1
- package/dist/components/lists-and-tables/list-item-action/list-item-action.template.d.ts +0 -3
- package/dist/components/lists-and-tables/list-item-action/list-item-action.template.d.ts.map +0 -1
- package/dist/components/lists-and-tables/list-item-action/list-item-action.template.js.map +0 -1
- package/dist/components/shell-BlsXDxCn.js +0 -222
- package/dist/components/toml-BOuWGMcf.js +0 -76
|
@@ -8,60 +8,60 @@ import { LitElement } from 'lit';
|
|
|
8
8
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
9
9
|
import { reflectNonDefault } from '../../../utilities/reflect-non-default.js';
|
|
10
10
|
import { isPointerMode } from '../../../utilities/input-modality.js';
|
|
11
|
-
import {
|
|
12
|
-
import { template } from './list-item-
|
|
11
|
+
import { listItemSegmentStyles } from './list-item-segment.styles.js';
|
|
12
|
+
import { template } from './list-item-segment.template.js';
|
|
13
13
|
/**
|
|
14
|
-
* A
|
|
14
|
+
* A segment inside an `nldd-list-item`: it groups a run of cells
|
|
15
15
|
* and makes just that run clickable. Use it when a row needs more than one
|
|
16
|
-
*
|
|
16
|
+
* segment — a tree row whose chevron expands while the label toggles a checkbox,
|
|
17
17
|
* or a row that navigates with a separate button beside it.
|
|
18
18
|
*
|
|
19
19
|
* Put it in the row where its cells would go: the item has one flat slot, and a
|
|
20
|
-
*
|
|
20
|
+
* segment takes the place of the cells it covers. Where the divider
|
|
21
21
|
* starts or stops is marked on the cells themselves (`divider-start` /
|
|
22
|
-
* `divider-end`), not by the slot
|
|
22
|
+
* `divider-end`), not by the slot a segment sits in.
|
|
23
23
|
*
|
|
24
24
|
* A row is EITHER row-level interactive (`href` / `button` / `checkbox` on the
|
|
25
25
|
* `nldd-list-item`) OR segmented (one or more of these). Both at once nests
|
|
26
26
|
* a control inside a control, which is invalid HTML; the item DEV-warns.
|
|
27
27
|
*
|
|
28
|
-
* Unlike the row-wide action this does not bleed outward: a
|
|
28
|
+
* Unlike the row-wide action this does not bleed outward: a segment sits
|
|
29
29
|
* between siblings, so an outward inset would overlap them. It owns its inline
|
|
30
30
|
* padding and never drops below the row's control size, so an icon-only one still
|
|
31
31
|
* meets the WCAG 2.5.8 target size — do not add spacer cells inside it for room
|
|
32
32
|
* or hit area, that doubles the space.
|
|
33
33
|
*
|
|
34
|
-
* In a `type="listbox"` list the
|
|
34
|
+
* In a `type="listbox"` list the segment renders as a plain container (no
|
|
35
35
|
* control, not focusable) and DEV-warns: an `option` may not contain
|
|
36
36
|
* interactive descendants. The cells render unchanged, so nothing shifts.
|
|
37
37
|
*
|
|
38
|
-
* @element nldd-list-item-
|
|
38
|
+
* @element nldd-list-item-segment
|
|
39
39
|
*
|
|
40
|
-
* @attr {boolean} button - Renders the
|
|
41
|
-
* @attr {string} href - Renders the
|
|
40
|
+
* @attr {boolean} button - Renders the segment as a `<button>`. Last of the three: `href` and `checkbox` both win over it.
|
|
41
|
+
* @attr {string} href - Renders the segment as an `<a>` with this URL. Wins over `checkbox` and `button`.
|
|
42
42
|
* @attr {string} target - Link target forwarded to the `<a>`; only applies with `href`
|
|
43
43
|
* @attr {string} rel - Link rel forwarded to the `<a>`; only applies with `href`
|
|
44
|
-
* @attr {boolean} checkbox - Makes the
|
|
45
|
-
* @attr {boolean} checked - Checked state of a `checkbox`
|
|
46
|
-
* @attr {boolean} expanded - Disclosure state, reflected as `aria-expanded` on the control. Set it on the
|
|
47
|
-
* @attr {boolean} disclosure - Marks the
|
|
48
|
-
* @attr {boolean} current - Marks the
|
|
49
|
-
* @attr {boolean} disabled -
|
|
50
|
-
* @attr {'fit-content'|'full'} width - `full` lets the
|
|
51
|
-
* @attr {string} accessible-label - Accessible name for the control. Set it when the
|
|
44
|
+
* @attr {boolean} checkbox - Makes the segment a `role="checkbox"` control. Wins over `button`, loses to `href`.
|
|
45
|
+
* @attr {boolean} checked - Checked state of a `checkbox` segment; it toggles on activation
|
|
46
|
+
* @attr {boolean} expanded - Disclosure state, reflected as `aria-expanded` on the control, and painted: the segment stays lit a step above hover for as long as what it opened is on screen, so a menu reads as hanging off this row rather than floating over the list. Set it on the segment that opens something (a tree row's chevron, a menu). Leave it off entirely when the segment discloses nothing — an absent attribute emits no aria-expanded.
|
|
47
|
+
* @attr {boolean} disclosure - Marks the segment as the row's disclosure control: `aria-expanded` comes from the parent item's `expanded`, so the state lives in one place. A slotted `nldd-icon-cell` rotates a quarter turn while the row is open
|
|
48
|
+
* @attr {boolean} current - Marks the segment as the current page (`aria-current="page"`). The row it sits in paints itself as the current row from it, so on a segmented row this is the only place it has to be set.
|
|
49
|
+
* @attr {boolean} disabled - Switches the segment off: a `button` or `checkbox` segment stops responding and dims, a `href` segment gets `aria-disabled` and its click is blocked (a link cannot be disabled natively). The arrow keys skip a row whose only segment is off.
|
|
50
|
+
* @attr {'fit-content'|'full'} width - `full` lets the segment grow to fill the row (default: 'fit-content')
|
|
51
|
+
* @attr {string} accessible-label - Accessible name for the control. Set it when the segment holds only an icon, or when the cell text does not describe the action.
|
|
52
52
|
*
|
|
53
|
-
* @slot - The cells that belong to this
|
|
53
|
+
* @slot - The cells that belong to this segment
|
|
54
54
|
*
|
|
55
|
-
* @fires change - On a `checkbox`
|
|
55
|
+
* @fires change - On a `checkbox` segment after it toggles; detail: { checked: boolean }
|
|
56
56
|
*/
|
|
57
|
-
let
|
|
57
|
+
let NLDDListItemSegment = class NLDDListItemSegment extends LitElement {
|
|
58
58
|
constructor() {
|
|
59
59
|
super(...arguments);
|
|
60
60
|
this.button = false;
|
|
61
61
|
this.checkbox = false;
|
|
62
62
|
this.checked = false;
|
|
63
63
|
/**
|
|
64
|
-
* Marks this
|
|
64
|
+
* Marks this segment as the row's disclosure control: it takes `aria-expanded`
|
|
65
65
|
* from the parent item's `expanded` instead of its own. Use it on a tree row's
|
|
66
66
|
* chevron, so the open/closed state is written once — on the row, where it also
|
|
67
67
|
* drives the children group — rather than kept in step in two places.
|
|
@@ -77,8 +77,13 @@ let NLDDListItemAction = class NLDDListItemAction extends LitElement {
|
|
|
77
77
|
/** Set by the parent nldd-list-item, mirroring its list's type. */
|
|
78
78
|
this._parentType = 'list';
|
|
79
79
|
this._handleClick = (e) => {
|
|
80
|
-
|
|
80
|
+
// A disabled <button> never gets here, but a link does: there is no such
|
|
81
|
+
// thing as a disabled <a>, so the segment stops the navigation itself.
|
|
82
|
+
if (this.disabled) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
e.stopPropagation();
|
|
81
85
|
return;
|
|
86
|
+
}
|
|
82
87
|
// Safari and Firefox on Mac don't focus buttons on click. Force focus so
|
|
83
88
|
// the :focus-visible styling below stays reliable.
|
|
84
89
|
this._control?.focus();
|
|
@@ -102,10 +107,28 @@ let NLDDListItemAction = class NLDDListItemAction extends LitElement {
|
|
|
102
107
|
this._handleFocusOut = () => {
|
|
103
108
|
this._control?.classList.remove('is-pointer-focus');
|
|
104
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* Safari moves focus to the body on mousedown and only puts it on a button
|
|
112
|
+
* when the mouse comes up, so a row whose paint follows the focus in it
|
|
113
|
+
* flickers back to its resting state for as long as you hold the button
|
|
114
|
+
* down. Preventing the default stops that hand-off; we set the focus
|
|
115
|
+
* ourselves in the pointerdown above, and the click still fires.
|
|
116
|
+
*/
|
|
117
|
+
this._onMouseDown = (e) => {
|
|
118
|
+
if (e.button > 0 || this.disabled)
|
|
119
|
+
return;
|
|
120
|
+
e.preventDefault();
|
|
121
|
+
};
|
|
105
122
|
this._onPointerDown = (e) => {
|
|
106
123
|
if (e.button > 0 || this.disabled)
|
|
107
124
|
return;
|
|
108
125
|
this._control?.classList.add('is-pressed');
|
|
126
|
+
// Safari does not focus a <button> on click, so a row whose paint follows
|
|
127
|
+
// the focus in it (see nldd-list-item's current rules) would stay unlit
|
|
128
|
+
// there while every other browser lights up. Focusing on the press makes
|
|
129
|
+
// the three browsers agree; the ring stays hidden because this is a
|
|
130
|
+
// pointer focus, which .is-pointer-focus already marks.
|
|
131
|
+
this._control?.focus({ preventScroll: true });
|
|
109
132
|
};
|
|
110
133
|
this._clearPressed = () => {
|
|
111
134
|
this._control?.classList.remove('is-pressed');
|
|
@@ -117,6 +140,7 @@ let NLDDListItemAction = class NLDDListItemAction extends LitElement {
|
|
|
117
140
|
this.addEventListener('focusout', this._handleFocusOut);
|
|
118
141
|
this.addEventListener('click', this._handleClick);
|
|
119
142
|
this.addEventListener('pointerdown', this._onPointerDown);
|
|
143
|
+
this.addEventListener('mousedown', this._onMouseDown);
|
|
120
144
|
this.addEventListener('pointerup', this._clearPressed);
|
|
121
145
|
this.addEventListener('pointercancel', this._clearPressed);
|
|
122
146
|
}
|
|
@@ -126,6 +150,7 @@ let NLDDListItemAction = class NLDDListItemAction extends LitElement {
|
|
|
126
150
|
this.removeEventListener('focusout', this._handleFocusOut);
|
|
127
151
|
this.removeEventListener('click', this._handleClick);
|
|
128
152
|
this.removeEventListener('pointerdown', this._onPointerDown);
|
|
153
|
+
this.removeEventListener('mousedown', this._onMouseDown);
|
|
129
154
|
this.removeEventListener('pointerup', this._clearPressed);
|
|
130
155
|
this.removeEventListener('pointercancel', this._clearPressed);
|
|
131
156
|
}
|
|
@@ -138,10 +163,10 @@ let NLDDListItemAction = class NLDDListItemAction extends LitElement {
|
|
|
138
163
|
_applyParentType(type) {
|
|
139
164
|
this._parentType = type;
|
|
140
165
|
if (import.meta.env?.DEV && type === 'listbox' && this._wantsControl) {
|
|
141
|
-
console.warn('nldd-list-item-
|
|
166
|
+
console.warn('nldd-list-item-segment: rendered as a plain container because the parent nldd-list is type="listbox". An `option` may not contain interactive descendants — move the segment out of the listbox, or drive selection from the option itself.');
|
|
142
167
|
}
|
|
143
168
|
}
|
|
144
|
-
/** Whether the consumer asked for an interactive
|
|
169
|
+
/** Whether the consumer asked for an interactive segment at all. */
|
|
145
170
|
get _wantsControl() {
|
|
146
171
|
return Boolean(this.href) || this.button || this.checkbox;
|
|
147
172
|
}
|
|
@@ -159,7 +184,7 @@ let NLDDListItemAction = class NLDDListItemAction extends LitElement {
|
|
|
159
184
|
this._control?.focus(options);
|
|
160
185
|
}
|
|
161
186
|
/** The open state has to reach the styles, and it lives in a property (the
|
|
162
|
-
* row's, for a disclosure
|
|
187
|
+
* row's, for a disclosure segment) that CSS cannot see. A host class is the
|
|
163
188
|
* hook — the same mechanism nldd-list already uses for .is-boxed / .is-first. */
|
|
164
189
|
updated() {
|
|
165
190
|
const expanded = this.disclosure ? this._rowExpanded : this.expanded;
|
|
@@ -167,62 +192,62 @@ let NLDDListItemAction = class NLDDListItemAction extends LitElement {
|
|
|
167
192
|
}
|
|
168
193
|
render() {
|
|
169
194
|
if (import.meta.env?.DEV && this.disclosure && this.expanded !== undefined) {
|
|
170
|
-
console.warn('nldd-list-item-
|
|
195
|
+
console.warn('nldd-list-item-segment: `disclosure` takes aria-expanded from the row, so the `expanded` on this action is ignored. Drop one of the two.');
|
|
171
196
|
}
|
|
172
197
|
return template(this._controlType, this.href, this.target, this.rel, this.checked, this.disclosure ? this._rowExpanded : this.expanded, this.current, this.disabled, this.accessibleLabel, this._tabbable === undefined ? undefined : (this._tabbable ? '0' : '-1'));
|
|
173
198
|
}
|
|
174
199
|
};
|
|
175
|
-
|
|
200
|
+
NLDDListItemSegment.styles = [listItemSegmentStyles];
|
|
176
201
|
__decorate([
|
|
177
202
|
property({ type: Boolean, reflect: true })
|
|
178
|
-
],
|
|
203
|
+
], NLDDListItemSegment.prototype, "button", void 0);
|
|
179
204
|
__decorate([
|
|
180
205
|
property({ reflect: true })
|
|
181
|
-
],
|
|
206
|
+
], NLDDListItemSegment.prototype, "href", void 0);
|
|
182
207
|
__decorate([
|
|
183
208
|
property({ reflect: true })
|
|
184
|
-
],
|
|
209
|
+
], NLDDListItemSegment.prototype, "target", void 0);
|
|
185
210
|
__decorate([
|
|
186
211
|
property({ reflect: true })
|
|
187
|
-
],
|
|
212
|
+
], NLDDListItemSegment.prototype, "rel", void 0);
|
|
188
213
|
__decorate([
|
|
189
214
|
property({ type: Boolean, reflect: true })
|
|
190
|
-
],
|
|
215
|
+
], NLDDListItemSegment.prototype, "checkbox", void 0);
|
|
191
216
|
__decorate([
|
|
192
217
|
property({ type: Boolean, reflect: true })
|
|
193
|
-
],
|
|
218
|
+
], NLDDListItemSegment.prototype, "checked", void 0);
|
|
194
219
|
__decorate([
|
|
195
220
|
property({ type: Boolean, reflect: true })
|
|
196
|
-
],
|
|
221
|
+
], NLDDListItemSegment.prototype, "expanded", void 0);
|
|
197
222
|
__decorate([
|
|
198
223
|
property({ type: Boolean, reflect: true })
|
|
199
|
-
],
|
|
224
|
+
], NLDDListItemSegment.prototype, "disclosure", void 0);
|
|
200
225
|
__decorate([
|
|
201
226
|
property({ type: Boolean, reflect: true })
|
|
202
|
-
],
|
|
227
|
+
], NLDDListItemSegment.prototype, "current", void 0);
|
|
203
228
|
__decorate([
|
|
204
229
|
property({ type: Boolean, reflect: true })
|
|
205
|
-
],
|
|
230
|
+
], NLDDListItemSegment.prototype, "disabled", void 0);
|
|
206
231
|
__decorate([
|
|
207
232
|
property({ reflect: true, converter: reflectNonDefault('fit-content') })
|
|
208
|
-
],
|
|
233
|
+
], NLDDListItemSegment.prototype, "width", void 0);
|
|
209
234
|
__decorate([
|
|
210
235
|
property({ attribute: 'accessible-label' })
|
|
211
|
-
],
|
|
236
|
+
], NLDDListItemSegment.prototype, "accessibleLabel", void 0);
|
|
212
237
|
__decorate([
|
|
213
238
|
state()
|
|
214
|
-
],
|
|
239
|
+
], NLDDListItemSegment.prototype, "_parentType", void 0);
|
|
215
240
|
__decorate([
|
|
216
241
|
state()
|
|
217
|
-
],
|
|
242
|
+
], NLDDListItemSegment.prototype, "_tabbable", void 0);
|
|
218
243
|
__decorate([
|
|
219
244
|
state()
|
|
220
|
-
],
|
|
221
|
-
__decorate([
|
|
222
|
-
query('.list-item-
|
|
223
|
-
],
|
|
224
|
-
|
|
225
|
-
customElement('nldd-list-item-
|
|
226
|
-
],
|
|
227
|
-
export {
|
|
228
|
-
//# sourceMappingURL=list-item-
|
|
245
|
+
], NLDDListItemSegment.prototype, "_rowExpanded", void 0);
|
|
246
|
+
__decorate([
|
|
247
|
+
query('.list-item-segment')
|
|
248
|
+
], NLDDListItemSegment.prototype, "_control", void 0);
|
|
249
|
+
NLDDListItemSegment = __decorate([
|
|
250
|
+
customElement('nldd-list-item-segment')
|
|
251
|
+
], NLDDListItemSegment);
|
|
252
|
+
export { NLDDListItemSegment };
|
|
253
|
+
//# sourceMappingURL=list-item-segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item-segment.js","sourceRoot":"","sources":["../../../../src/components/lists-and-tables/list-item-segment/list-item-segment.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,QAAQ,EAA+B,MAAM,iCAAiC,CAAC;AAKxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,UAAU;IAA5C;;QAIN,WAAM,GAAG,KAAK,CAAC;QAYf,aAAQ,GAAG,KAAK,CAAC;QAGjB,YAAO,GAAG,KAAK,CAAC;QAMhB;;;;;;;;WAQG;QAEH,eAAU,GAAG,KAAK,CAAC;QAGnB,YAAO,GAAG,KAAK,CAAC;QAGhB,aAAQ,GAAG,KAAK,CAAC;QAGjB,UAAK,GAAyB,aAAa,CAAC;QAG5C,oBAAe,GAAG,EAAE,CAAC;QAErB,mEAAmE;QAEnE,gBAAW,GAAG,MAAM,CAAC;QA+Db,iBAAY,GAAG,CAAC,CAAQ,EAAE,EAAE;YACnC,yEAAyE;YACzE,uEAA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":["../../../../src/components/lists-and-tables/list-item-segment/list-item-segment.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB,yBAgLjC,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const listItemSegmentStyles = css `
|
|
3
|
+
:host {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
--_background-color: transparent;
|
|
9
|
+
--_min-size: var(--context-list-item-size, var(--semantics-controls-md-min-size));
|
|
10
|
+
--_expanded-rotation: 90deg;
|
|
11
|
+
--_fill-z-index: -1;
|
|
12
|
+
|
|
13
|
+
display: flex;
|
|
14
|
+
position: relative;
|
|
15
|
+
/* Its own stacking context, so the fill below (z-index -1) stays behind
|
|
16
|
+
this segment's content but in front of the row's fill. Without it the
|
|
17
|
+
two -1 layers land in the same context — the row's while it is lit —
|
|
18
|
+
and the segment's disappears underneath. */
|
|
19
|
+
isolation: isolate;
|
|
20
|
+
align-items: stretch;
|
|
21
|
+
/* The row's areas center their children; this must span instead, so its hit
|
|
22
|
+
area and fill reach the row's top and bottom edges. */
|
|
23
|
+
align-self: stretch;
|
|
24
|
+
flex-grow: 0;
|
|
25
|
+
flex-shrink: 1;
|
|
26
|
+
/* Square floor from the row's control size, so an icon-only action is still
|
|
27
|
+
a touch target. On the host, not the control: the host is the flex item,
|
|
28
|
+
so a floor on the control would be measured against a host that had
|
|
29
|
+
already shrunk to zero. */
|
|
30
|
+
min-width: var(--_min-size);
|
|
31
|
+
min-height: var(--_min-size);
|
|
32
|
+
-webkit-tap-highlight-color: transparent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([hidden]) {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* A growing action needs no floor and needs min-width: 0, so its text can
|
|
40
|
+
truncate instead of pushing its siblings out. */
|
|
41
|
+
:host([width="full"]) {
|
|
42
|
+
flex-grow: 1;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:host([width="full"]) .list-item-segment {
|
|
47
|
+
justify-content: flex-start;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* The cell rotates, not the icon — ::slotted reaches a direct child only, and
|
|
51
|
+
rotating the cell turns the glyph in place. */
|
|
52
|
+
:host([disclosure]) ::slotted(nldd-icon-cell) {
|
|
53
|
+
rotate: 0deg;
|
|
54
|
+
transition: rotate var(--primitives-transition-duration-fast) var(--primitives-transition-easing-default);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([disclosure].is-expanded) ::slotted(nldd-icon-cell) {
|
|
58
|
+
rotate: var(--_expanded-rotation);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@media (prefers-reduced-motion: reduce) {
|
|
62
|
+
:host([disclosure]) ::slotted(nldd-icon-cell) {
|
|
63
|
+
transition: none;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* The control owns its inline padding, fixed at the indicator inset. Do not
|
|
68
|
+
add spacer cells for room or hit area: that doubles the space. */
|
|
69
|
+
.list-item-segment {
|
|
70
|
+
box-sizing: border-box;
|
|
71
|
+
display: flex;
|
|
72
|
+
position: relative;
|
|
73
|
+
margin: 0;
|
|
74
|
+
outline: none;
|
|
75
|
+
border: none;
|
|
76
|
+
background: none;
|
|
77
|
+
width: 100%;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
padding: 0;
|
|
80
|
+
padding-inline: var(--components-list-item-indicator-inline-inset);
|
|
81
|
+
flex-direction: row;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
color: inherit;
|
|
85
|
+
text-align: start;
|
|
86
|
+
text-decoration: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
a.list-item-segment {
|
|
90
|
+
cursor: var(--semantics-controls-link-cursor);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* There is no disabled attribute for an anchor, so the segment blocks the
|
|
94
|
+
click itself and aria-disabled carries the state. */
|
|
95
|
+
button.list-item-segment:disabled,
|
|
96
|
+
:host([disabled]) a.list-item-segment {
|
|
97
|
+
cursor: default;
|
|
98
|
+
opacity: var(--primitives-opacity-disabled);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.list-item-segment::before {
|
|
102
|
+
content: '';
|
|
103
|
+
display: block;
|
|
104
|
+
position: absolute;
|
|
105
|
+
z-index: var(--_fill-z-index);
|
|
106
|
+
inset-block: 0;
|
|
107
|
+
inset-inline: 0;
|
|
108
|
+
border-radius: var(--components-list-item-indicator-corner-radius);
|
|
109
|
+
background-color: var(--_background-color);
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* The row hands down which fill a hovered segment takes. Unset on an ordinary
|
|
114
|
+
row, where the fallback answers. */
|
|
115
|
+
@media (hover: hover) {
|
|
116
|
+
:host(:not([disabled])) a.list-item-segment:hover,
|
|
117
|
+
button.list-item-segment:not(:disabled):hover {
|
|
118
|
+
--_background-color: var(--context-list-item-hovered-background-color, var(--components-list-item-is-hovered-background-color));
|
|
119
|
+
--context-content-color: var(--context-list-item-hovered-content-color, var(--components-list-item-is-hovered-content-color));
|
|
120
|
+
--context-content-secondary-color: var(--context-list-item-hovered-content-color, var(--components-list-item-is-hovered-content-color));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Press feedback — works on touch where :hover doesn't. JS-driven so a touch
|
|
125
|
+
that turns into a scroll clears it (pointercancel) instead of flashing. */
|
|
126
|
+
/* The element selectors match the weight of the hover rule above: a pointer
|
|
127
|
+
that presses is hovering as well, and the press has to win. */
|
|
128
|
+
:host(:not([disabled])) a.list-item-segment.is-pressed,
|
|
129
|
+
button.list-item-segment:not(:disabled).is-pressed,
|
|
130
|
+
:host(:not([disabled])) .list-item-segment.is-pressed {
|
|
131
|
+
--_background-color: var(--context-list-item-active-background-color, var(--components-list-item-is-active-background-color));
|
|
132
|
+
--context-content-color: var(--context-list-item-active-content-color, var(--context-list-item-hovered-content-color, var(--components-list-item-is-active-content-color)));
|
|
133
|
+
--context-content-secondary-color: var(--context-list-item-active-content-color, var(--context-list-item-hovered-content-color, var(--components-list-item-is-active-content-color)));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* After the hover rule on purpose: hovering back over the segment must not
|
|
137
|
+
dim it while what it opened is still on screen. */
|
|
138
|
+
:host([expanded]) .list-item-segment {
|
|
139
|
+
--_background-color: var(--components-list-item-is-expanded-background-color);
|
|
140
|
+
--context-content-color: var(--components-list-item-is-expanded-content-color);
|
|
141
|
+
--context-content-secondary-color: var(--components-list-item-is-expanded-content-color);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@media (hover: hover) {
|
|
145
|
+
:host([expanded]:not([disabled])) a.list-item-segment:hover,
|
|
146
|
+
:host([expanded]) button.list-item-segment:not(:disabled):hover {
|
|
147
|
+
--_background-color: var(--components-list-item-is-expanded-is-hovered-background-color);
|
|
148
|
+
--context-content-color: var(--components-list-item-is-expanded-content-color);
|
|
149
|
+
--context-content-secondary-color: var(--components-list-item-is-expanded-content-color);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
:host([expanded]:not([disabled])) a.list-item-segment.is-pressed,
|
|
154
|
+
:host([expanded]) button.list-item-segment:not(:disabled).is-pressed,
|
|
155
|
+
:host([expanded]:not([disabled])) .list-item-segment.is-pressed {
|
|
156
|
+
--_background-color: var(--components-list-item-is-expanded-is-active-background-color);
|
|
157
|
+
--context-content-color: var(--components-list-item-is-expanded-content-color);
|
|
158
|
+
--context-content-secondary-color: var(--components-list-item-is-expanded-content-color);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host([checked]) .list-item-segment {
|
|
162
|
+
--_background-color: var(--components-list-item-is-selected-background-color);
|
|
163
|
+
--context-content-color: var(--components-list-item-is-selected-content-color);
|
|
164
|
+
--context-content-secondary-color: var(--components-list-item-is-selected-content-color);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.list-item-segment:focus-visible:not(.is-pointer-focus)::after {
|
|
168
|
+
content: '';
|
|
169
|
+
display: block;
|
|
170
|
+
position: absolute;
|
|
171
|
+
inset: 0;
|
|
172
|
+
border-radius: var(--components-list-item-indicator-corner-radius);
|
|
173
|
+
outline: var(--semantics-focus-ring-outline);
|
|
174
|
+
outline-offset: var(--semantics-focus-ring-outline-offset);
|
|
175
|
+
box-shadow: var(--semantics-focus-ring-box-shadow);
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
}
|
|
178
|
+
`;
|
|
179
|
+
//# sourceMappingURL=list-item-segment.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item-segment.styles.js","sourceRoot":"","sources":["../../../../src/components/lists-and-tables/list-item-segment/list-item-segment.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgLvC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type ListItemSegmentControl = 'link' | 'button' | 'checkbox' | 'plain';
|
|
2
|
+
export declare function template(control: ListItemSegmentControl, href: string | undefined, target: string | undefined, rel: string | undefined, checked: boolean, expanded: boolean | undefined, current: boolean, disabled: boolean, accessibleLabel: string, actionTabindex?: string): import("lit-html").TemplateResult<1>;
|
|
3
|
+
//# sourceMappingURL=list-item-segment.template.d.ts.map
|
package/dist/components/lists-and-tables/list-item-segment/list-item-segment.template.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item-segment.template.d.ts","sourceRoot":"","sources":["../../../../src/components/lists-and-tables/list-item-segment/list-item-segment.template.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAE9E,wBAAgB,QAAQ,CACvB,OAAO,EAAE,sBAAsB,EAC/B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,OAAO,EACjB,eAAe,EAAE,MAAM,EACvB,cAAc,CAAC,EAAE,MAAM,wCAqCvB"}
|
|
@@ -5,10 +5,11 @@ export function template(control, href, target, rel, checked, expanded, current,
|
|
|
5
5
|
const ariaCurrent = current ? 'page' : nothing;
|
|
6
6
|
const label = accessibleLabel || nothing;
|
|
7
7
|
if (control === 'link') {
|
|
8
|
-
return html `<a class="list-item-
|
|
8
|
+
return html `<a class="list-item-segment"
|
|
9
9
|
href=${href ?? nothing}
|
|
10
10
|
target=${target ?? nothing}
|
|
11
11
|
rel=${rel ?? nothing}
|
|
12
|
+
aria-disabled=${disabled ? 'true' : nothing}
|
|
12
13
|
aria-expanded=${ariaExpanded}
|
|
13
14
|
aria-current=${ariaCurrent}
|
|
14
15
|
aria-label=${label}
|
|
@@ -16,7 +17,7 @@ export function template(control, href, target, rel, checked, expanded, current,
|
|
|
16
17
|
>${content}</a>`;
|
|
17
18
|
}
|
|
18
19
|
if (control === 'checkbox' || control === 'button') {
|
|
19
|
-
return html `<button class="list-item-
|
|
20
|
+
return html `<button class="list-item-segment"
|
|
20
21
|
type="button"
|
|
21
22
|
role=${control === 'checkbox' ? 'checkbox' : nothing}
|
|
22
23
|
aria-checked=${control === 'checkbox' ? String(checked) : nothing}
|
|
@@ -30,6 +31,6 @@ export function template(control, href, target, rel, checked, expanded, current,
|
|
|
30
31
|
// Plain: no control at all. Used in a listbox parent, where an `option` may
|
|
31
32
|
// not contain interactive descendants — the cells still render, so the row
|
|
32
33
|
// looks unchanged, it just isn't operable.
|
|
33
|
-
return html `<div class="list-item-
|
|
34
|
+
return html `<div class="list-item-segment">${content}</div>`;
|
|
34
35
|
}
|
|
35
|
-
//# sourceMappingURL=list-item-
|
|
36
|
+
//# sourceMappingURL=list-item-segment.template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item-segment.template.js","sourceRoot":"","sources":["../../../../src/components/lists-and-tables/list-item-segment/list-item-segment.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAIpC,MAAM,UAAU,QAAQ,CACvB,OAA+B,EAC/B,IAAwB,EACxB,MAA0B,EAC1B,GAAuB,EACvB,OAAgB,EAChB,QAA6B,EAC7B,OAAgB,EAChB,QAAiB,EACjB,eAAuB,EACvB,cAAuB;IAEvB,MAAM,OAAO,GAAG,IAAI,CAAA,eAAe,CAAC;IACpC,MAAM,YAAY,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzE,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC/C,MAAM,KAAK,GAAG,eAAe,IAAI,OAAO,CAAC;IAEzC,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACxB,OAAO,IAAI,CAAA;UACH,IAAI,IAAI,OAAO;YACb,MAAM,IAAI,OAAO;SACpB,GAAG,IAAI,OAAO;mBACJ,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;mBAC3B,YAAY;kBACb,WAAW;gBACb,KAAK;cACP,cAAc,IAAI,OAAO;KAClC,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,IAAI,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACpD,OAAO,IAAI,CAAA;;UAEH,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO;kBACrC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;mBACjD,YAAY;kBACb,WAAW;gBACb,KAAK;eACN,QAAQ;cACT,cAAc,IAAI,OAAO;KAClC,OAAO,WAAW,CAAC;IACvB,CAAC;IAED,4EAA4E;IAC5E,2EAA2E;IAC3E,2CAA2C;IAC3C,OAAO,IAAI,CAAA,kCAAkC,OAAO,QAAQ,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
//#region src/utilities/reflect-non-default.ts
|
|
2
|
+
/**
|
|
3
|
+
* A Lit attribute converter for a reflected property whose DEFAULT value should
|
|
4
|
+
* not appear in the DOM. Works for an enum (a string union) and for a number.
|
|
5
|
+
*
|
|
6
|
+
* It reflects any non-default value to the attribute (so `:host([prop="x"])`
|
|
7
|
+
* styling and framework property binding keep working), but maps the default to
|
|
8
|
+
* *no* attribute (`toAttribute` returns null), so the DOM isn't polluted with a
|
|
9
|
+
* redundant `prop="<default>"` on every instance.
|
|
10
|
+
*
|
|
11
|
+
* Pair it with `reflect: true`. The component's default styling must then live
|
|
12
|
+
* on the bare `:host` (not `:host([prop="<default>"])`), since a default-valued
|
|
13
|
+
* element carries no attribute to select on.
|
|
14
|
+
*
|
|
15
|
+
* Known edge: if markup writes the default *explicitly* (e.g. `<nldd-button
|
|
16
|
+
* size="md">`), `fromAttribute` resolves the property to the value it already
|
|
17
|
+
* holds, so Lit's default `hasChanged` sees no change, schedules no update, and
|
|
18
|
+
* `toAttribute` never runs to strip the attribute — so that one authored default
|
|
19
|
+
* attribute stays in the DOM. Visual behavior is unaffected (styling keys off the
|
|
20
|
+
* bare `:host`); it only matters to code matching `[prop="<default>"]`, which
|
|
21
|
+
* should read the property instead. Not worth a fragile `hasChanged` workaround.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* @property({ reflect: true, converter: reflectNonDefault<Size>('md') })
|
|
26
|
+
* size: Size = 'md';
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
function reflectNonDefault(defaultValue) {
|
|
30
|
+
const parse = typeof defaultValue === "number" ? (value) => Number(value) : (value) => value;
|
|
31
|
+
return {
|
|
32
|
+
fromAttribute: (value) => value === null ? defaultValue : parse(value),
|
|
33
|
+
toAttribute: (value) => value === defaultValue ? null : String(value)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { reflectNonDefault as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
//#region src/assets/styles/shadow-resets.ts
|
|
3
|
+
/**
|
|
4
|
+
* Reset for slotted (light-DOM) content in shadow-DOM components.
|
|
5
|
+
*
|
|
6
|
+
* Slotted nodes live in the consumer's document, so document-level CSS —
|
|
7
|
+
* Tailwind Preflight, Bootstrap Reboot, a bespoke host reset — beats a
|
|
8
|
+
* component's `::slotted()` rules for any *normal* declaration, regardless of
|
|
9
|
+
* specificity. That bleeds host styling into our components and breaks visual
|
|
10
|
+
* consistency across consumers.
|
|
11
|
+
*
|
|
12
|
+
* `all: revert !important` closes that gap: an *important* declaration from the
|
|
13
|
+
* shadow tree beats document declarations (even important ones), and `revert`
|
|
14
|
+
* rolls each property back to its user-agent default — a stable, host-independent
|
|
15
|
+
* baseline. Properties a host might weaponise (`display: none`,
|
|
16
|
+
* `pointer-events: none`, stray margins/decoration) fall back to UA defaults.
|
|
17
|
+
*
|
|
18
|
+
* Usage — place at the START of a `::slotted()` rule, then declare the
|
|
19
|
+
* properties the component owns, each `!important` so it wins over the revert:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* css`
|
|
23
|
+
* ::slotted(:not([slot])) {
|
|
24
|
+
* ${slottedReset}
|
|
25
|
+
* ${inheritedTextReset}
|
|
26
|
+
* color: var(--semantics-content-color) !important;
|
|
27
|
+
* font: var(--_font) !important;
|
|
28
|
+
* }
|
|
29
|
+
* `
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* NOTE: `revert` does NOT isolate *inherited* properties — they still flow in
|
|
33
|
+
* from the host via the chain `body → host → :host → slot`. For slotted text,
|
|
34
|
+
* add {@link inheritedTextReset} to seal the inherited typography that `font`
|
|
35
|
+
* does not cover.
|
|
36
|
+
*/
|
|
37
|
+
var slottedReset = css`
|
|
38
|
+
all: revert !important;
|
|
39
|
+
`;
|
|
40
|
+
/**
|
|
41
|
+
* Inherited typography that the `font` shorthand does NOT cover and that a host
|
|
42
|
+
* can otherwise leak into our text — directly (`a { text-decoration }`) or via
|
|
43
|
+
* inheritance (`body { letter-spacing }`). Used in two places:
|
|
44
|
+
*
|
|
45
|
+
* - inside `::slotted(…)` to lock the consumer's slotted text (pair with
|
|
46
|
+
* {@link slottedReset}), and
|
|
47
|
+
* - inside `:host`, as a guard block right after the `--_*` vars, to lock the
|
|
48
|
+
* component's OWN shadow text against host inheritance (no `all: revert` there).
|
|
49
|
+
*
|
|
50
|
+
* `text-align` is locked to `start` (logical, RTL-safe) — a host cannot center or
|
|
51
|
+
* justify our text. A component that needs a different alignment sets it
|
|
52
|
+
* explicitly on its own element, which overrides this inherited default.
|
|
53
|
+
*/
|
|
54
|
+
var inheritedTextReset = css`
|
|
55
|
+
text-align: start !important;
|
|
56
|
+
letter-spacing: normal !important;
|
|
57
|
+
word-spacing: normal !important;
|
|
58
|
+
text-transform: none !important;
|
|
59
|
+
`;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { slottedReset as n, inheritedTextReset as t };
|