@timmo001/groundwork-ui 0.9.20 → 0.9.22

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.
@@ -629,7 +629,7 @@
629
629
  {
630
630
  "kind": "variable",
631
631
  "name": "fieldStyles",
632
- "default": "css` :where(gw-input, gw-select, gw-switch, gw-checkbox) { display: flex; flex-direction: column; gap: var(--gw-space-2); font-family: var(--gw-font-sans); color: var(--gw-color-text-primary); } :where(gw-input, gw-select) .gw-field-heading { display: flex; gap: var(--gw-space-1); align-items: center; } :where(gw-input, gw-select) .gw-field-heading > label { font-size: var(--gw-font-size-s); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-strong); } /* The (i) button by the label that opens a field's longer help */ :where(gw-input, gw-select) .gw-info { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; padding: 0; color: var(--gw-color-text-secondary); cursor: pointer; background: none; border: 0; border-radius: var(--gw-radius-pill); transition: color var(--gw-motion-fast) var(--gw-motion-easing), background-color var(--gw-motion-fast) var(--gw-motion-easing); } :where(gw-input, gw-select) .gw-info:hover { color: var(--gw-color-text-strong); background: var(--gw-color-fill-neutral-hovered); } :where(gw-input, gw-select) .gw-info:focus-visible { outline: var(--gw-focus-width) solid var(--gw-color-focus); outline-offset: var(--gw-focus-offset); } :where(gw-input, gw-select) .gw-info[hidden] { display: none; } :where(gw-input, gw-select) .gw-info > .icon { width: 1rem; height: 1rem; fill: currentColor; } /* Sizes run xs to xl through --gw-field-scale, around 1 for medium, and the control's height follows the theme's density too */ :where(gw-input, gw-select)[size=\"xs\"] { --gw-field-scale: 0.6; } :where(gw-input, gw-select)[size=\"small\"] { --gw-field-scale: 0.8; } :where(gw-input, gw-select)[size=\"large\"] { --gw-field-scale: 1.2; } :where(gw-input, gw-select)[size=\"xl\"] { --gw-field-scale: 1.4; } :where(gw-input, gw-select) :where(input, .gw-select-trigger) { --gw-field-size: var(--gw-field-scale, 1); --gw-icon-size: calc( 1.25rem * var(--gw-field-size) * var(--gw-control-scale, 1) ); width: 100%; min-height: calc( 2.5rem * var(--gw-field-size) * var(--gw-control-scale, 1) ); padding: 0 calc(var(--gw-space-3) * var(--gw-field-size)); font: inherit; font-size: calc(var(--gw-font-size-s) * var(--gw-field-size)); color: var(--gw-color-text-strong); background: var(--gw-color-surface-lower); border: var(--gw-border-width) solid var(--gw-color-border-normal); border-radius: var(--gw-radius-control); transition: border-color var(--gw-motion-fast) var(--gw-motion-easing); } /* An icon inside the field, before the text, with the text moved clear of it */ gw-input .gw-input-control { position: relative; display: flex; align-items: center; } gw-input .gw-input-control > .icon { position: absolute; inset-inline-start: calc(var(--gw-space-3) * var(--gw-field-scale, 1)); width: calc(1.125rem * var(--gw-field-scale, 1)); height: calc(1.125rem * var(--gw-field-scale, 1)); color: var(--gw-color-text-secondary); pointer-events: none; fill: currentColor; } gw-input .gw-input-control > .icon[hidden] { display: none; } gw-input .gw-input-control > .icon:not([hidden]) + input { padding-inline-start: calc( (var(--gw-space-3) * 2 + 1.125rem) * var(--gw-field-scale, 1) ); } /* The trigger shows the chosen option, with its icon, and a chevron with room around it that turns over while the list is open */ gw-select .gw-select-trigger { display: flex; gap: calc(var(--gw-space-2) * var(--gw-field-size)); align-items: center; padding-inline-end: calc(var(--gw-space-3) * var(--gw-field-size)); text-align: start; cursor: pointer; } gw-select .gw-select-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* With an inline label the select sits among toolbar controls, so it's a pill that fits its content, like the toggles and buttons beside it */ gw-select[inline-label] { display: inline-flex; } gw-select[inline-label] .gw-select-trigger { width: auto; padding-inline: calc(var(--gw-space-4) * var(--gw-field-size)) calc(var(--gw-space-3) * var(--gw-field-size)); border-radius: var(--gw-radius-pill); } /* An inline label reads as a quiet prefix to the value */ gw-select .gw-select-inline-label { flex: none; color: var(--gw-color-text-secondary); } gw-select .gw-select-inline-label[hidden] { display: none; } gw-select .gw-select-value[data-placeholder] { color: var(--gw-color-text-secondary); } gw-select .gw-select-trigger > .icon { flex: none; width: var(--gw-icon-size, 1.25rem); height: var(--gw-icon-size, 1.25rem); fill: currentColor; } gw-select .gw-select-trigger > .icon:last-child { color: var(--gw-color-text-secondary); transition: rotate var(--gw-motion-normal) var(--gw-motion-easing); } gw-select[open] .gw-select-trigger > .icon:last-child { rotate: 180deg; } gw-select .gw-select-trigger > .icon[hidden] { display: none; } /* The list opens under the trigger, growing from it, or as a bottom sheet sliding up on phones */ gw-select .gw-select-popup { position: fixed; inset: unset; box-sizing: border-box; max-width: calc(100vw - 12px); padding: 0; margin: 0; overflow: hidden; color: var(--gw-color-text-primary); background: var(--gw-color-surface-overlay); border: max(var(--gw-border-width), 1px) solid var(--gw-color-border-normal); border-radius: var(--gw-radius-panel); box-shadow: var(--gw-shadow-l); opacity: 0; scale: 1 0.96; transform-origin: top; transition: opacity var(--gw-motion-fast) var(--gw-motion-easing), scale var(--gw-motion-normal) var(--gw-motion-easing), translate var(--gw-motion-normal) var(--gw-motion-easing), display var(--gw-motion-normal) allow-discrete, overlay var(--gw-motion-normal) allow-discrete; } gw-select .gw-select-popup[data-placement=\"above\"] { transform-origin: bottom; } gw-select .gw-select-popup:popover-open { opacity: 1; scale: 1; } @starting-style { gw-select .gw-select-popup:popover-open { opacity: 0; scale: 1 0.96; } } gw-select .gw-select-popup[data-placement=\"sheet\"] { inset: auto 0 0; width: 100%; max-width: none; padding-block-end: env(safe-area-inset-bottom); border-end-start-radius: 0; border-end-end-radius: 0; scale: 1; translate: 0 100%; --gw-option-list-height: 60vh; } gw-select .gw-select-popup[data-placement=\"sheet\"]:popover-open { translate: 0 0; } @starting-style { gw-select .gw-select-popup[data-placement=\"sheet\"]:popover-open { translate: 0 100%; } } gw-select .gw-select-popup[data-placement=\"sheet\"]::backdrop { background: rgb(0 0 0 / 40%); } /* With multiple, a full-width Clear under the list empties the choice */ gw-select .gw-select-clear { display: block; width: 100%; min-height: 2.5rem; padding: 0 var(--gw-space-3); font: inherit; font-size: var(--gw-font-size-s); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-secondary); cursor: pointer; background: none; border: 0; border-block-start: var(--gw-border-width) solid var(--gw-color-border-quiet); transition: color var(--gw-motion-fast) var(--gw-motion-easing), background-color var(--gw-motion-fast) var(--gw-motion-easing); } gw-select .gw-select-clear:hover { color: var(--gw-color-text-strong); background: var(--gw-color-fill-neutral-hovered); } gw-select .gw-select-clear:focus-visible { outline: var(--gw-focus-width) solid var(--gw-color-focus); outline-offset: calc(var(--gw-focus-width) * -1); } gw-select .gw-select-clear[hidden] { display: none; } :where(gw-input) .gw-input-control:focus-within > .icon { color: var(--gw-color-text-strong); } :where(gw-input, gw-select) :where(input, .gw-select-trigger):hover { border-color: var(--gw-color-border-loud); } :where(gw-input, gw-select, gw-switch, gw-checkbox) :where(input, .gw-select-trigger):focus-visible { outline: var(--gw-focus-width) solid var(--gw-color-focus); outline-offset: var(--gw-focus-offset); } :where(gw-input, gw-select) [aria-invalid=\"true\"] { border-color: var(--gw-color-border-danger); } :where(gw-input, gw-select, gw-switch, gw-checkbox) :disabled { color: var(--gw-color-text-disabled); cursor: not-allowed; } :where(gw-input, gw-select, gw-switch, gw-checkbox) .gw-hint { margin: 0; font-size: var(--gw-font-size-xs); color: var(--gw-color-text-secondary); } :where(gw-input, gw-select, gw-switch, gw-checkbox) .gw-error { margin: 0; font-size: var(--gw-font-size-xs); color: var(--gw-color-danger); } :where(gw-switch, gw-checkbox) > label { display: inline-flex; gap: var(--gw-space-3); align-items: center; font-size: var(--gw-font-size-s); cursor: pointer; } :where(gw-input, gw-switch, gw-checkbox, gw-select) .gw-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } gw-checkbox input { width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--gw-color-fill-accent-resting); } gw-switch input { position: relative; flex: none; width: 2.5rem; height: 1.5rem; margin: 0; cursor: pointer; appearance: none; background: var(--gw-color-surface-lower); border: var(--gw-border-width) solid var(--gw-color-border-loud); border-radius: var(--gw-radius-pill); transition: background-color var(--gw-motion-normal) var(--gw-motion-easing), border-color var(--gw-motion-normal) var(--gw-motion-easing); } gw-switch input::after { position: absolute; inset-block-start: 0.1875rem; inset-inline-start: 0.1875rem; width: 1rem; height: 1rem; content: \"\"; background: var(--gw-color-text-secondary); border-radius: 50%; transition: translate var(--gw-motion-normal) var(--gw-motion-easing), background-color var(--gw-motion-normal) var(--gw-motion-easing); } gw-switch input:checked { background: var(--gw-color-fill-accent-resting); border-color: transparent; } gw-switch input:checked::after { translate: 1rem 0; background: var(--gw-color-on-accent); } gw-switch input:disabled { opacity: 0.5; } `",
632
+ "default": "css` :where(gw-input, gw-select, gw-switch, gw-checkbox) { display: flex; flex-direction: column; gap: var(--gw-space-2); font-family: var(--gw-font-sans); color: var(--gw-color-text-primary); } :where(gw-input, gw-select) .gw-field-heading { display: flex; gap: var(--gw-space-1); align-items: center; } :where(gw-input, gw-select) .gw-field-heading > label { font-size: var(--gw-font-size-s); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-strong); } /* The (i) button by the label that opens a field's longer help */ :where(gw-input, gw-select) .gw-info { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; padding: 0; color: var(--gw-color-text-secondary); cursor: pointer; background: none; border: 0; border-radius: var(--gw-radius-pill); transition: color var(--gw-motion-fast) var(--gw-motion-easing), background-color var(--gw-motion-fast) var(--gw-motion-easing); } :where(gw-input, gw-select) .gw-info:hover { color: var(--gw-color-text-strong); background: var(--gw-color-fill-neutral-hovered); } :where(gw-input, gw-select) .gw-info:focus-visible { outline: var(--gw-focus-width) solid var(--gw-color-focus); outline-offset: var(--gw-focus-offset); } :where(gw-input, gw-select) .gw-info[hidden] { display: none; } :where(gw-input, gw-select) .gw-info > .icon { width: 1rem; height: 1rem; fill: currentColor; } /* Sizes run xs to xl through --gw-field-scale, around 1 for medium, and the control's height follows the theme's density too */ :where(gw-input, gw-select)[size=\"xs\"] { --gw-field-scale: 0.6; } :where(gw-input, gw-select)[size=\"small\"] { --gw-field-scale: 0.8; } :where(gw-input, gw-select)[size=\"large\"] { --gw-field-scale: 1.2; } :where(gw-input, gw-select)[size=\"xl\"] { --gw-field-scale: 1.4; } :where(gw-input, gw-select) :where(input, .gw-select-trigger) { --gw-field-size: var(--gw-field-scale, 1); --gw-icon-size: calc( 1.25rem * var(--gw-field-size) * var(--gw-control-scale, 1) ); width: 100%; min-height: calc( 2.5rem * var(--gw-field-size) * var(--gw-control-scale, 1) ); padding: 0 calc(var(--gw-space-3) * var(--gw-field-size)); font: inherit; font-size: calc(var(--gw-font-size-s) * var(--gw-field-size)); color: var(--gw-color-text-strong); background: var(--gw-color-surface-lower); border: var(--gw-border-width) solid var(--gw-color-border-normal); border-radius: var(--gw-radius-control); transition: border-color var(--gw-motion-fast) var(--gw-motion-easing); } /* An icon inside the field, before the text, with the text moved clear of it */ gw-input .gw-input-control { position: relative; display: flex; align-items: center; } gw-input .gw-input-control > .icon { position: absolute; inset-inline-start: calc(var(--gw-space-3) * var(--gw-field-scale, 1)); width: calc(1.125rem * var(--gw-field-scale, 1)); height: calc(1.125rem * var(--gw-field-scale, 1)); color: var(--gw-color-text-secondary); pointer-events: none; fill: currentColor; } gw-input .gw-input-control > .icon[hidden] { display: none; } gw-input .gw-input-control > .icon:not([hidden]) + input { padding-inline-start: calc( (var(--gw-space-3) * 2 + 1.125rem) * var(--gw-field-scale, 1) ); } /* The trigger shows the chosen option, with its icon, and a chevron with room around it that turns over while the list is open */ gw-select .gw-select-trigger { display: flex; gap: calc(var(--gw-space-2) * var(--gw-field-size)); align-items: center; padding-inline-end: calc(var(--gw-space-3) * var(--gw-field-size)); text-align: start; cursor: pointer; } gw-select .gw-select-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* With an inline label the select sits among toolbar controls, so it's a pill that fits its content, like the toggles and buttons beside it */ gw-select[inline-label] { display: inline-flex; } gw-select[inline-label] .gw-select-trigger { width: auto; padding-inline: calc(var(--gw-space-4) * var(--gw-field-size)) calc(var(--gw-space-3) * var(--gw-field-size)); border-radius: var(--gw-radius-pill); } /* An inline label reads as a quiet prefix to the value */ gw-select .gw-select-inline-label { flex: none; color: var(--gw-color-text-secondary); } gw-select .gw-select-inline-label[hidden] { display: none; } gw-select .gw-select-value[data-placeholder] { color: var(--gw-color-text-secondary); } gw-select .gw-select-trigger > .icon { flex: none; width: var(--gw-icon-size, 1.25rem); height: var(--gw-icon-size, 1.25rem); fill: currentColor; } gw-select .gw-select-trigger > .icon:last-child { color: var(--gw-color-text-secondary); transition: rotate var(--gw-motion-normal) var(--gw-motion-easing); } gw-select[open] .gw-select-trigger > .icon:last-child { rotate: 180deg; } gw-select .gw-select-trigger > .icon[hidden] { display: none; } /* The list opens under the trigger, growing from it, or as a bottom sheet sliding up on phones */ gw-select .gw-select-popup { position: fixed; inset: unset; box-sizing: border-box; max-width: calc(100vw - 12px); padding: 0; margin: 0; overflow: hidden; color: var(--gw-color-text-primary); background: var(--gw-color-surface-overlay); border: max(var(--gw-border-width), 1px) solid var(--gw-color-border-normal); border-radius: var(--gw-radius-panel); box-shadow: var(--gw-shadow-l); opacity: 0; scale: 1 0.96; transform-origin: top; transition: opacity var(--gw-motion-fast) var(--gw-motion-easing), scale var(--gw-motion-normal) var(--gw-motion-easing), translate var(--gw-motion-normal) var(--gw-motion-easing), display var(--gw-motion-normal) allow-discrete, overlay var(--gw-motion-normal) allow-discrete; } gw-select .gw-select-popup[data-placement=\"above\"] { transform-origin: bottom; } gw-select .gw-select-popup:popover-open { opacity: 1; scale: 1; } @starting-style { gw-select .gw-select-popup:popover-open { opacity: 0; scale: 1 0.96; } } gw-select .gw-select-popup[data-placement=\"sheet\"] { inset: auto 0 0; width: 100%; max-width: none; padding-block-end: env(safe-area-inset-bottom); border-end-start-radius: 0; border-end-end-radius: 0; scale: 1; translate: 0 100%; --gw-option-list-height: 60vh; } gw-select .gw-select-popup[data-placement=\"sheet\"]:popover-open { translate: 0 0; } @starting-style { gw-select .gw-select-popup[data-placement=\"sheet\"]:popover-open { translate: 0 100%; } } gw-select .gw-select-popup[data-placement=\"sheet\"]::backdrop { background: rgb(0 0 0 / 40%); } /* With multiple, a full-width Clear under the list empties the choice */ gw-select .gw-select-clear { display: block; width: 100%; min-height: 2.5rem; padding: 0 var(--gw-space-3); font: inherit; font-size: var(--gw-font-size-s); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-secondary); cursor: pointer; background: none; border: 0; border-block-start: var(--gw-border-width) solid var(--gw-color-border-quiet); transition: color var(--gw-motion-fast) var(--gw-motion-easing), background-color var(--gw-motion-fast) var(--gw-motion-easing); } gw-select .gw-select-clear:hover { color: var(--gw-color-text-strong); background: var(--gw-color-fill-neutral-hovered); } gw-select .gw-select-clear:focus-visible { outline: var(--gw-focus-width) solid var(--gw-color-focus); outline-offset: calc(var(--gw-focus-width) * -1); } gw-select .gw-select-clear[hidden] { display: none; } :where(gw-input) .gw-input-control:focus-within > .icon { color: var(--gw-color-text-strong); } :where(gw-input, gw-select) :where(input, .gw-select-trigger):hover { border-color: var(--gw-color-border-loud); } :where(gw-input, gw-select, gw-switch, gw-checkbox) :where(input, .gw-select-trigger):focus-visible { outline: var(--gw-focus-width) solid var(--gw-color-focus); outline-offset: var(--gw-focus-offset); } :where(gw-input, gw-select) [aria-invalid=\"true\"] { border-color: var(--gw-color-border-danger); } :where(gw-input, gw-select, gw-switch, gw-checkbox) :disabled { color: var(--gw-color-text-disabled); cursor: not-allowed; } :where(gw-input, gw-select, gw-switch, gw-checkbox) .gw-hint { margin: 0; font-size: var(--gw-font-size-xs); color: var(--gw-color-text-secondary); } :where(gw-input, gw-select, gw-switch, gw-checkbox) .gw-error { margin: 0; font-size: var(--gw-font-size-xs); color: var(--gw-color-danger); } :where(gw-switch, gw-checkbox) > label { display: inline-flex; gap: var(--gw-space-3); align-items: center; font-size: var(--gw-font-size-s); cursor: pointer; } :where(gw-input, gw-switch, gw-checkbox, gw-select) .gw-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } gw-checkbox input { width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--gw-color-fill-accent-resting); } gw-switch input { position: relative; flex: none; width: 2.5rem; height: 1.5rem; margin: 0; cursor: pointer; appearance: none; background: var(--gw-color-surface-lower); border: var(--gw-border-width) solid var(--gw-color-border-loud); border-radius: var(--gw-radius-pill); transition: background-color var(--gw-motion-normal) var(--gw-motion-easing), border-color var(--gw-motion-normal) var(--gw-motion-easing); } gw-switch input::after { position: absolute; inset-block-start: 0.1875rem; inset-inline-start: 0.1875rem; width: 1rem; height: 1rem; content: \"\"; background: var(--gw-color-text-secondary); border-radius: 50%; transition: translate var(--gw-motion-normal) var(--gw-motion-easing), background-color var(--gw-motion-normal) var(--gw-motion-easing); } gw-switch input:checked { background: var(--gw-color-fill-accent-resting); border-color: transparent; } gw-switch input:checked::after { translate: 1rem 0; background: var(--gw-color-on-accent); } gw-switch input:disabled { opacity: 0.5; } gw-range { display: flex; flex-direction: column; gap: var(--gw-space-2); min-width: 0; font-family: var(--gw-font-sans); color: var(--gw-color-text-primary); } gw-range > label { font-size: var(--gw-font-size-s); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-strong); } gw-range .gw-range-control { position: relative; display: block; } gw-range input { display: block; width: 100%; margin: 0; accent-color: var(--gw-color-fill-accent-resting); cursor: pointer; } gw-range input:focus-visible { outline: var(--gw-focus-width) solid var(--gw-color-focus); outline-offset: var(--gw-focus-offset); } gw-range input:disabled { cursor: not-allowed; opacity: 0.5; } /* The value above the thumb while it's held */ gw-range .gw-range-bubble { position: absolute; bottom: calc(100% + var(--gw-space-1)); padding: var(--gw-space-1) var(--gw-space-2); font-size: var(--gw-font-size-xs); font-variant-numeric: tabular-nums; color: var(--gw-color-on-accent); white-space: nowrap; pointer-events: none; background: var(--gw-color-fill-accent-resting); border-radius: var(--gw-radius-control); box-shadow: var(--gw-shadow-s); translate: -50% 0; } gw-range .gw-range-bubble[hidden] { display: none; } gw-range .gw-hint { margin: 0; font-size: var(--gw-font-size-xs); color: var(--gw-color-text-secondary); } gw-range .gw-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } `",
633
633
  "description": "Field components render their native control in light DOM, never in a\nshadow root: password managers and `<label for>` can't reach across one,\nand a form only submits controls it can see. Their styles are adopted into\nwhichever document or shadow root they sit in."
634
634
  },
635
635
  {
@@ -3722,9 +3722,17 @@
3722
3722
  "description": "The heading.",
3723
3723
  "name": "heading"
3724
3724
  },
3725
+ {
3726
+ "description": "The line under the heading.",
3727
+ "name": "description"
3728
+ },
3725
3729
  {
3726
3730
  "description": "The content.",
3727
3731
  "name": "body"
3732
+ },
3733
+ {
3734
+ "description": "The area under the divider.",
3735
+ "name": "footer"
3728
3736
  }
3729
3737
  ],
3730
3738
  "slots": [
@@ -3739,6 +3747,10 @@
3739
3747
  {
3740
3748
  "description": "Buttons beside the heading.",
3741
3749
  "name": "actions"
3750
+ },
3751
+ {
3752
+ "description": "Content under a divider at the bottom, such as a control for the whole card.",
3753
+ "name": "footer"
3742
3754
  }
3743
3755
  ],
3744
3756
  "members": [
@@ -3749,7 +3761,7 @@
3749
3761
  "text": "Properties"
3750
3762
  },
3751
3763
  "static": true,
3752
- "default": "{ heading: {}, href: {}, flush: { type: \"boolean\", reflect: true }, loading: { type: \"boolean\", reflect: true }, lines: { type: \"number\" }, }",
3764
+ "default": "{ heading: {}, description: {}, level: { type: \"number\" }, href: {}, flush: { type: \"boolean\", reflect: true }, loading: { type: \"boolean\", reflect: true }, lines: { type: \"number\" }, }",
3753
3765
  "inheritedFrom": {
3754
3766
  "name": "GwElement",
3755
3767
  "module": "src/element.ts"
@@ -3762,7 +3774,7 @@
3762
3774
  "text": "readonly CSSStyleSheet[]"
3763
3775
  },
3764
3776
  "static": true,
3765
- "default": "[ base, css` :host { display: block; } .card { display: flex; flex-direction: column; gap: var(--gw-space-3); height: 100%; padding: var(--gw-space-4); color: inherit; text-decoration: none; background: var(--gw-color-surface-raised); border: var(--gw-border-width) solid var(--gw-color-border-normal); border-radius: var(--gw-radius-panel); box-shadow: var(--gw-shadow-s); } :host([flush]) .card { padding: 0; overflow: hidden; } a.card { transition: border-color var(--gw-motion-fast) var(--gw-motion-easing); } a.card:hover, .card.linked:hover { border-color: var(--gw-color-border-accent); } /* A card following a link in its heading slot */ .card.linked { cursor: pointer; transition: border-color var(--gw-motion-fast) var(--gw-motion-easing); } .card.focused { outline: var(--gw-focus-width) solid var(--gw-color-focus); outline-offset: var(--gw-focus-offset); } ::slotted([slot=\"heading\"]) { font: inherit; color: inherit; } ::slotted(a[slot=\"heading\"]) { text-decoration: none; outline: none; } header { display: flex; gap: var(--gw-space-2); align-items: center; } h2 { flex: 1; margin: 0; font-size: var(--gw-font-size-m); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-strong); } .body:not([hidden]) { display: flex; flex-direction: column; gap: inherit; } `, ]",
3777
+ "default": "[ base, css` :host { display: block; } .card { display: flex; flex-direction: column; gap: var(--gw-space-3); height: 100%; padding: var(--gw-space-4); color: inherit; text-decoration: none; background: var(--gw-color-surface-raised); border: var(--gw-border-width) solid var(--gw-color-border-normal); border-radius: var(--gw-radius-panel); box-shadow: var(--gw-shadow-s); } :host([flush]) .card { padding: 0; overflow: hidden; } a.card { transition: border-color var(--gw-motion-fast) var(--gw-motion-easing); } a.card:hover, .card.linked:hover { border-color: var(--gw-color-border-accent); } /* A card following a link in its heading slot */ .card.linked { cursor: pointer; transition: border-color var(--gw-motion-fast) var(--gw-motion-easing); } .card.focused { outline: var(--gw-focus-width) solid var(--gw-color-focus); outline-offset: var(--gw-focus-offset); } ::slotted([slot=\"heading\"]) { font: inherit; color: inherit; } ::slotted(a[slot=\"heading\"]) { text-decoration: none; outline: none; } header { display: flex; gap: var(--gw-space-2); align-items: center; } .titles { display: flex; flex: 1; flex-direction: column; gap: var(--gw-space-0-5); min-width: 0; } .title { margin: 0; font-size: var(--gw-font-size-m); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-strong); } .description { font-size: var(--gw-font-size-xs); color: var(--gw-color-text-secondary); } /* The divider runs to the card's edges */ footer:not([hidden]) { display: flex; flex-direction: column; gap: inherit; margin-inline: calc(-1 * var(--gw-space-4)); padding: var(--gw-space-3) var(--gw-space-4) 0; border-top: var(--gw-border-width) solid var(--gw-color-border-normal); } :host([flush]) footer:not([hidden]) { margin-inline: 0; padding-bottom: var(--gw-space-3); } .body:not([hidden]) { display: flex; flex-direction: column; gap: inherit; } `, ]",
3766
3778
  "inheritedFrom": {
3767
3779
  "name": "GwElement",
3768
3780
  "module": "src/element.ts"
@@ -3776,6 +3788,23 @@
3776
3788
  },
3777
3789
  "default": "\"\""
3778
3790
  },
3791
+ {
3792
+ "kind": "field",
3793
+ "name": "description",
3794
+ "type": {
3795
+ "text": "string"
3796
+ },
3797
+ "default": "\"\""
3798
+ },
3799
+ {
3800
+ "kind": "field",
3801
+ "name": "level",
3802
+ "type": {
3803
+ "text": "number"
3804
+ },
3805
+ "description": "The heading's level for assistive tech.",
3806
+ "default": "2"
3807
+ },
3779
3808
  {
3780
3809
  "kind": "field",
3781
3810
  "name": "href",
@@ -3827,6 +3856,18 @@
3827
3856
  "privacy": "private",
3828
3857
  "readonly": true
3829
3858
  },
3859
+ {
3860
+ "kind": "field",
3861
+ "name": "#heading",
3862
+ "privacy": "private",
3863
+ "readonly": true
3864
+ },
3865
+ {
3866
+ "kind": "field",
3867
+ "name": "#description",
3868
+ "privacy": "private",
3869
+ "readonly": true
3870
+ },
3830
3871
  {
3831
3872
  "kind": "field",
3832
3873
  "name": "#header",
@@ -3836,6 +3877,21 @@
3836
3877
  },
3837
3878
  "readonly": true
3838
3879
  },
3880
+ {
3881
+ "kind": "field",
3882
+ "name": "#footerSlot",
3883
+ "privacy": "private",
3884
+ "readonly": true
3885
+ },
3886
+ {
3887
+ "kind": "field",
3888
+ "name": "#footer",
3889
+ "privacy": "private",
3890
+ "type": {
3891
+ "text": "HTMLElement"
3892
+ },
3893
+ "readonly": true
3894
+ },
3839
3895
  {
3840
3896
  "kind": "field",
3841
3897
  "name": "#skeleton",
@@ -4208,6 +4264,20 @@
4208
4264
  "description": "The card's heading.",
4209
4265
  "name": "heading"
4210
4266
  },
4267
+ {
4268
+ "type": {
4269
+ "text": "string"
4270
+ },
4271
+ "description": "A line under the heading.",
4272
+ "name": "description"
4273
+ },
4274
+ {
4275
+ "type": {
4276
+ "text": "number"
4277
+ },
4278
+ "description": "The heading's level for assistive tech, 2 by default. Use 3 for a card under a section heading.",
4279
+ "name": "level"
4280
+ },
4211
4281
  {
4212
4282
  "type": {
4213
4283
  "text": "string"
@@ -14524,26 +14594,16 @@
14524
14594
  },
14525
14595
  {
14526
14596
  "kind": "javascript-module",
14527
- "path": "src/gw-section-title.ts",
14597
+ "path": "src/gw-range.ts",
14528
14598
  "declarations": [
14529
14599
  {
14530
14600
  "kind": "class",
14531
- "description": "A small heading between groups on a page, as an `<h2>` unless `level` says otherwise.",
14532
- "name": "GwSectionTitle",
14533
- "cssParts": [
14534
- {
14535
- "description": "The heading.",
14536
- "name": "heading"
14537
- }
14538
- ],
14539
- "slots": [
14540
- {
14541
- "description": "The heading text.",
14542
- "name": ""
14543
- },
14601
+ "description": "A labeled native range slider. While it's pressed or dragged, a bubble\nabove the thumb shows the value, so a slider without a readout beside it\nstill says where it is. The native `input` and `change` events bubble out\nas usual.",
14602
+ "name": "GwRange",
14603
+ "cssProperties": [
14544
14604
  {
14545
- "description": "Buttons at the end of the row.",
14546
- "name": "actions"
14605
+ "description": "The thumb's size. Defaults to 1rem.",
14606
+ "name": "--gw-range-thumb"
14547
14607
  }
14548
14608
  ],
14549
14609
  "members": [
@@ -14554,7 +14614,7 @@
14554
14614
  "text": "Properties"
14555
14615
  },
14556
14616
  "static": true,
14557
- "default": "{ level: { type: \"number\" }, }",
14617
+ "default": "{ label: {}, labelHidden: { type: \"boolean\", attribute: \"label-hidden\" }, name: {}, value: { type: \"number\" }, min: { type: \"number\" }, max: { type: \"number\" }, step: { type: \"number\" }, unit: {}, hint: {}, disabled: { type: \"boolean\" }, }",
14558
14618
  "inheritedFrom": {
14559
14619
  "name": "GwElement",
14560
14620
  "module": "src/element.ts"
@@ -14562,32 +14622,143 @@
14562
14622
  },
14563
14623
  {
14564
14624
  "kind": "field",
14565
- "name": "styles",
14625
+ "name": "label",
14566
14626
  "type": {
14567
- "text": "readonly CSSStyleSheet[]"
14627
+ "text": "string"
14568
14628
  },
14569
- "static": true,
14570
- "default": "[ base, css` :host { display: flex; gap: var(--gw-space-2); align-items: center; } [role=\"heading\"] { flex: 1; margin: 0; font-size: var(--gw-font-size-xs); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-secondary); text-transform: uppercase; letter-spacing: 0.04em; } `, ]",
14571
- "inheritedFrom": {
14572
- "name": "GwElement",
14573
- "module": "src/element.ts"
14574
- }
14629
+ "default": "\"\""
14575
14630
  },
14576
14631
  {
14577
14632
  "kind": "field",
14578
- "name": "level",
14633
+ "name": "labelHidden",
14634
+ "type": {
14635
+ "text": "boolean"
14636
+ },
14637
+ "description": "Keeps the label for assistive technology but hides it.",
14638
+ "default": "false"
14639
+ },
14640
+ {
14641
+ "kind": "field",
14642
+ "name": "name",
14643
+ "type": {
14644
+ "text": "string"
14645
+ },
14646
+ "default": "\"\""
14647
+ },
14648
+ {
14649
+ "kind": "field",
14650
+ "name": "value",
14579
14651
  "type": {
14580
14652
  "text": "number"
14581
14653
  },
14582
- "default": "2"
14654
+ "default": "0"
14583
14655
  },
14584
14656
  {
14585
14657
  "kind": "field",
14586
- "name": "#heading",
14587
- "privacy": "private",
14658
+ "name": "min",
14588
14659
  "type": {
14589
- "text": "HTMLDivElement"
14660
+ "text": "number"
14661
+ },
14662
+ "default": "0"
14663
+ },
14664
+ {
14665
+ "kind": "field",
14666
+ "name": "max",
14667
+ "type": {
14668
+ "text": "number"
14669
+ },
14670
+ "default": "100"
14671
+ },
14672
+ {
14673
+ "kind": "field",
14674
+ "name": "step",
14675
+ "type": {
14676
+ "text": "number"
14677
+ },
14678
+ "default": "1"
14679
+ },
14680
+ {
14681
+ "kind": "field",
14682
+ "name": "unit",
14683
+ "type": {
14684
+ "text": "string"
14685
+ },
14686
+ "description": "Shown after the value, such as `%`.",
14687
+ "default": "\"\""
14688
+ },
14689
+ {
14690
+ "kind": "field",
14691
+ "name": "hint",
14692
+ "type": {
14693
+ "text": "string"
14694
+ },
14695
+ "default": "\"\""
14696
+ },
14697
+ {
14698
+ "kind": "field",
14699
+ "name": "disabled",
14700
+ "type": {
14701
+ "text": "boolean"
14702
+ },
14703
+ "default": "false"
14704
+ },
14705
+ {
14706
+ "kind": "field",
14707
+ "name": "#id",
14708
+ "privacy": "private",
14709
+ "readonly": true
14710
+ },
14711
+ {
14712
+ "kind": "field",
14713
+ "name": "#label",
14714
+ "privacy": "private",
14715
+ "readonly": true
14716
+ },
14717
+ {
14718
+ "kind": "field",
14719
+ "name": "#input",
14720
+ "privacy": "private",
14721
+ "readonly": true
14722
+ },
14723
+ {
14724
+ "kind": "field",
14725
+ "name": "#bubble",
14726
+ "privacy": "private",
14727
+ "readonly": true
14728
+ },
14729
+ {
14730
+ "kind": "field",
14731
+ "name": "#hint",
14732
+ "privacy": "private",
14733
+ "readonly": true
14734
+ },
14735
+ {
14736
+ "kind": "method",
14737
+ "name": "#text",
14738
+ "privacy": "private",
14739
+ "return": {
14740
+ "type": {
14741
+ "text": "string"
14742
+ }
14590
14743
  },
14744
+ "parameters": [
14745
+ {
14746
+ "name": "value",
14747
+ "type": {
14748
+ "text": "number"
14749
+ }
14750
+ }
14751
+ ]
14752
+ },
14753
+ {
14754
+ "kind": "method",
14755
+ "name": "#placeBubble",
14756
+ "privacy": "private"
14757
+ },
14758
+ {
14759
+ "kind": "field",
14760
+ "name": "#release",
14761
+ "privacy": "private",
14591
14762
  "readonly": true
14592
14763
  },
14593
14764
  {
@@ -14598,7 +14769,7 @@
14598
14769
  {
14599
14770
  "name": "root",
14600
14771
  "type": {
14601
- "text": "ShadowRoot"
14772
+ "text": "HTMLElement"
14602
14773
  }
14603
14774
  }
14604
14775
  ],
@@ -14633,13 +14804,26 @@
14633
14804
  "text": "boolean"
14634
14805
  },
14635
14806
  "static": true,
14636
- "default": "true",
14807
+ "default": "false",
14637
14808
  "description": "Whether to attach a shadow root. Light DOM elements set this false.",
14638
14809
  "inheritedFrom": {
14639
14810
  "name": "GwElement",
14640
14811
  "module": "src/element.ts"
14641
14812
  }
14642
14813
  },
14814
+ {
14815
+ "kind": "field",
14816
+ "name": "styles",
14817
+ "type": {
14818
+ "text": "readonly CSSStyleSheet[]"
14819
+ },
14820
+ "static": true,
14821
+ "default": "[]",
14822
+ "inheritedFrom": {
14823
+ "name": "GwElement",
14824
+ "module": "src/element.ts"
14825
+ }
14826
+ },
14643
14827
  {
14644
14828
  "kind": "field",
14645
14829
  "name": "shadowRootOptions",
@@ -14903,17 +15087,489 @@
14903
15087
  }
14904
15088
  ],
14905
15089
  "attributes": [
15090
+ {
15091
+ "type": {
15092
+ "text": "string"
15093
+ },
15094
+ "description": "The label, also its accessible name.",
15095
+ "name": "label"
15096
+ },
15097
+ {
15098
+ "type": {
15099
+ "text": "boolean"
15100
+ },
15101
+ "description": "Hides the label but keeps it for assistive technology.",
15102
+ "name": "label-hidden"
15103
+ },
15104
+ {
15105
+ "type": {
15106
+ "text": "string"
15107
+ },
15108
+ "description": "The form field name.",
15109
+ "name": "name"
15110
+ },
14906
15111
  {
14907
15112
  "type": {
14908
15113
  "text": "number"
14909
15114
  },
14910
- "description": "The heading level. Defaults to 2.",
14911
- "name": "level"
14912
- }
14913
- ],
14914
- "superclass": {
14915
- "name": "GwElement",
14916
- "module": "/src/element.js"
15115
+ "description": "The value.",
15116
+ "name": "value"
15117
+ },
15118
+ {
15119
+ "type": {
15120
+ "text": "number"
15121
+ },
15122
+ "description": "The lowest value. Defaults to 0.",
15123
+ "name": "min"
15124
+ },
15125
+ {
15126
+ "type": {
15127
+ "text": "number"
15128
+ },
15129
+ "description": "The highest value. Defaults to 100.",
15130
+ "name": "max"
15131
+ },
15132
+ {
15133
+ "type": {
15134
+ "text": "number"
15135
+ },
15136
+ "description": "The step between values. Defaults to 1.",
15137
+ "name": "step"
15138
+ },
15139
+ {
15140
+ "type": {
15141
+ "text": "string"
15142
+ },
15143
+ "description": "Shown after the value in the bubble and for assistive technology, such as `%`. Empty for a plain number.",
15144
+ "name": "unit"
15145
+ },
15146
+ {
15147
+ "type": {
15148
+ "text": "string"
15149
+ },
15150
+ "description": "One line of help under it.",
15151
+ "name": "hint"
15152
+ },
15153
+ {
15154
+ "type": {
15155
+ "text": "boolean"
15156
+ },
15157
+ "description": "Disables it.",
15158
+ "name": "disabled"
15159
+ }
15160
+ ],
15161
+ "superclass": {
15162
+ "name": "LightElement",
15163
+ "module": "/src/fields.js"
15164
+ },
15165
+ "tagName": "gw-range",
15166
+ "customElement": true,
15167
+ "summary": "A labeled slider in light DOM, so forms see it."
15168
+ }
15169
+ ],
15170
+ "exports": [
15171
+ {
15172
+ "kind": "js",
15173
+ "name": "GwRange",
15174
+ "declaration": {
15175
+ "name": "GwRange",
15176
+ "module": "src/gw-range.ts"
15177
+ }
15178
+ }
15179
+ ]
15180
+ },
15181
+ {
15182
+ "kind": "javascript-module",
15183
+ "path": "src/gw-section-title.ts",
15184
+ "declarations": [
15185
+ {
15186
+ "kind": "class",
15187
+ "description": "A small heading between groups on a page, as an `<h2>` unless `level` says otherwise.",
15188
+ "name": "GwSectionTitle",
15189
+ "cssParts": [
15190
+ {
15191
+ "description": "The heading.",
15192
+ "name": "heading"
15193
+ }
15194
+ ],
15195
+ "slots": [
15196
+ {
15197
+ "description": "The heading text.",
15198
+ "name": ""
15199
+ },
15200
+ {
15201
+ "description": "Buttons at the end of the row.",
15202
+ "name": "actions"
15203
+ }
15204
+ ],
15205
+ "members": [
15206
+ {
15207
+ "kind": "field",
15208
+ "name": "properties",
15209
+ "type": {
15210
+ "text": "Properties"
15211
+ },
15212
+ "static": true,
15213
+ "default": "{ level: { type: \"number\" }, }",
15214
+ "inheritedFrom": {
15215
+ "name": "GwElement",
15216
+ "module": "src/element.ts"
15217
+ }
15218
+ },
15219
+ {
15220
+ "kind": "field",
15221
+ "name": "styles",
15222
+ "type": {
15223
+ "text": "readonly CSSStyleSheet[]"
15224
+ },
15225
+ "static": true,
15226
+ "default": "[ base, css` :host { display: flex; gap: var(--gw-space-2); align-items: center; } [role=\"heading\"] { flex: 1; margin: 0; font-size: var(--gw-font-size-xs); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-secondary); text-transform: uppercase; letter-spacing: 0.04em; } `, ]",
15227
+ "inheritedFrom": {
15228
+ "name": "GwElement",
15229
+ "module": "src/element.ts"
15230
+ }
15231
+ },
15232
+ {
15233
+ "kind": "field",
15234
+ "name": "level",
15235
+ "type": {
15236
+ "text": "number"
15237
+ },
15238
+ "default": "2"
15239
+ },
15240
+ {
15241
+ "kind": "field",
15242
+ "name": "#heading",
15243
+ "privacy": "private",
15244
+ "type": {
15245
+ "text": "HTMLDivElement"
15246
+ },
15247
+ "readonly": true
15248
+ },
15249
+ {
15250
+ "kind": "method",
15251
+ "name": "create",
15252
+ "privacy": "protected",
15253
+ "parameters": [
15254
+ {
15255
+ "name": "root",
15256
+ "type": {
15257
+ "text": "ShadowRoot"
15258
+ }
15259
+ }
15260
+ ],
15261
+ "description": "Builds the shadow root's content once, on first connection.",
15262
+ "inheritedFrom": {
15263
+ "name": "GwElement",
15264
+ "module": "src/element.ts"
15265
+ }
15266
+ },
15267
+ {
15268
+ "kind": "method",
15269
+ "name": "update",
15270
+ "privacy": "protected",
15271
+ "parameters": [
15272
+ {
15273
+ "name": "_changed",
15274
+ "type": {
15275
+ "text": "ReadonlySet<string>"
15276
+ }
15277
+ }
15278
+ ],
15279
+ "description": "Sets what the changed properties affect.",
15280
+ "inheritedFrom": {
15281
+ "name": "GwElement",
15282
+ "module": "src/element.ts"
15283
+ }
15284
+ },
15285
+ {
15286
+ "kind": "field",
15287
+ "name": "shadow",
15288
+ "type": {
15289
+ "text": "boolean"
15290
+ },
15291
+ "static": true,
15292
+ "default": "true",
15293
+ "description": "Whether to attach a shadow root. Light DOM elements set this false.",
15294
+ "inheritedFrom": {
15295
+ "name": "GwElement",
15296
+ "module": "src/element.ts"
15297
+ }
15298
+ },
15299
+ {
15300
+ "kind": "field",
15301
+ "name": "shadowRootOptions",
15302
+ "type": {
15303
+ "text": "ShadowRootInit"
15304
+ },
15305
+ "static": true,
15306
+ "default": "{ mode: \"open\" }",
15307
+ "description": "How the shadow root is attached.",
15308
+ "inheritedFrom": {
15309
+ "name": "GwElement",
15310
+ "module": "src/element.ts"
15311
+ }
15312
+ },
15313
+ {
15314
+ "kind": "method",
15315
+ "name": "define",
15316
+ "static": true,
15317
+ "parameters": [
15318
+ {
15319
+ "name": "tag",
15320
+ "type": {
15321
+ "text": "string"
15322
+ }
15323
+ }
15324
+ ],
15325
+ "description": "Adds the property accessors, then defines the element.",
15326
+ "inheritedFrom": {
15327
+ "name": "GwElement",
15328
+ "module": "src/element.ts"
15329
+ }
15330
+ },
15331
+ {
15332
+ "kind": "field",
15333
+ "name": "#values",
15334
+ "privacy": "private",
15335
+ "readonly": true,
15336
+ "default": "new Map<string, PropertyValue>()",
15337
+ "inheritedFrom": {
15338
+ "name": "GwElement",
15339
+ "module": "src/element.ts"
15340
+ }
15341
+ },
15342
+ {
15343
+ "kind": "field",
15344
+ "name": "#defaults",
15345
+ "privacy": "private",
15346
+ "readonly": true,
15347
+ "default": "new Map<string, PropertyValue>()",
15348
+ "inheritedFrom": {
15349
+ "name": "GwElement",
15350
+ "module": "src/element.ts"
15351
+ }
15352
+ },
15353
+ {
15354
+ "kind": "field",
15355
+ "name": "#changed",
15356
+ "privacy": "private",
15357
+ "readonly": true,
15358
+ "default": "new Set<string>()",
15359
+ "inheritedFrom": {
15360
+ "name": "GwElement",
15361
+ "module": "src/element.ts"
15362
+ }
15363
+ },
15364
+ {
15365
+ "kind": "field",
15366
+ "name": "#unreflected",
15367
+ "privacy": "private",
15368
+ "readonly": true,
15369
+ "default": "new Set<string>()",
15370
+ "inheritedFrom": {
15371
+ "name": "GwElement",
15372
+ "module": "src/element.ts"
15373
+ }
15374
+ },
15375
+ {
15376
+ "kind": "field",
15377
+ "name": "#created",
15378
+ "privacy": "private",
15379
+ "type": {
15380
+ "text": "boolean"
15381
+ },
15382
+ "default": "false",
15383
+ "inheritedFrom": {
15384
+ "name": "GwElement",
15385
+ "module": "src/element.ts"
15386
+ }
15387
+ },
15388
+ {
15389
+ "kind": "field",
15390
+ "name": "#queued",
15391
+ "privacy": "private",
15392
+ "type": {
15393
+ "text": "boolean"
15394
+ },
15395
+ "default": "false",
15396
+ "inheritedFrom": {
15397
+ "name": "GwElement",
15398
+ "module": "src/element.ts"
15399
+ }
15400
+ },
15401
+ {
15402
+ "kind": "field",
15403
+ "name": "#pending",
15404
+ "privacy": "private",
15405
+ "type": {
15406
+ "text": "Promise<void> | undefined"
15407
+ },
15408
+ "inheritedFrom": {
15409
+ "name": "GwElement",
15410
+ "module": "src/element.ts"
15411
+ }
15412
+ },
15413
+ {
15414
+ "kind": "field",
15415
+ "name": "#reflecting",
15416
+ "privacy": "private",
15417
+ "type": {
15418
+ "text": "boolean"
15419
+ },
15420
+ "default": "false",
15421
+ "inheritedFrom": {
15422
+ "name": "GwElement",
15423
+ "module": "src/element.ts"
15424
+ }
15425
+ },
15426
+ {
15427
+ "kind": "field",
15428
+ "name": "#resolveUpdated",
15429
+ "privacy": "private",
15430
+ "type": {
15431
+ "text": "() => void"
15432
+ },
15433
+ "inheritedFrom": {
15434
+ "name": "GwElement",
15435
+ "module": "src/element.ts"
15436
+ }
15437
+ },
15438
+ {
15439
+ "kind": "field",
15440
+ "name": "#updated",
15441
+ "privacy": "private",
15442
+ "readonly": true,
15443
+ "default": "new Promise<void>((resolve) => { this.#resolveUpdated = resolve; })",
15444
+ "inheritedFrom": {
15445
+ "name": "GwElement",
15446
+ "module": "src/element.ts"
15447
+ }
15448
+ },
15449
+ {
15450
+ "kind": "field",
15451
+ "name": "renderRoot",
15452
+ "type": {
15453
+ "text": "ShadowRoot | HTMLElement"
15454
+ },
15455
+ "readonly": true,
15456
+ "description": "The shadow root, or the element itself for a light DOM element.",
15457
+ "inheritedFrom": {
15458
+ "name": "GwElement",
15459
+ "module": "src/element.ts"
15460
+ }
15461
+ },
15462
+ {
15463
+ "kind": "field",
15464
+ "name": "#own",
15465
+ "privacy": "private",
15466
+ "type": {
15467
+ "text": "typeof GwElement"
15468
+ },
15469
+ "readonly": true,
15470
+ "description": "The element's own class, for its static properties and styles.",
15471
+ "default": "new.target",
15472
+ "inheritedFrom": {
15473
+ "name": "GwElement",
15474
+ "module": "src/element.ts"
15475
+ }
15476
+ },
15477
+ {
15478
+ "kind": "field",
15479
+ "name": "updateComplete",
15480
+ "description": "Resolves once the pending update has run, or the first one before it connects.",
15481
+ "readonly": true,
15482
+ "inheritedFrom": {
15483
+ "name": "GwElement",
15484
+ "module": "src/element.ts"
15485
+ }
15486
+ },
15487
+ {
15488
+ "kind": "method",
15489
+ "name": "defaultOf",
15490
+ "privacy": "protected",
15491
+ "parameters": [
15492
+ {
15493
+ "name": "name",
15494
+ "type": {
15495
+ "text": "string"
15496
+ }
15497
+ }
15498
+ ],
15499
+ "description": "The value a property returns to when its attribute is removed. Defaults\nto the value it was given in the constructor.",
15500
+ "inheritedFrom": {
15501
+ "name": "GwElement",
15502
+ "module": "src/element.ts"
15503
+ }
15504
+ },
15505
+ {
15506
+ "kind": "method",
15507
+ "name": "requestUpdate",
15508
+ "parameters": [
15509
+ {
15510
+ "name": "names",
15511
+ "type": {
15512
+ "text": "readonly string[]"
15513
+ }
15514
+ }
15515
+ ],
15516
+ "description": "Asks for an update with the given properties marked as changed.",
15517
+ "inheritedFrom": {
15518
+ "name": "GwElement",
15519
+ "module": "src/element.ts"
15520
+ }
15521
+ },
15522
+ {
15523
+ "kind": "method",
15524
+ "name": "#flush",
15525
+ "privacy": "private",
15526
+ "inheritedFrom": {
15527
+ "name": "GwElement",
15528
+ "module": "src/element.ts"
15529
+ }
15530
+ },
15531
+ {
15532
+ "kind": "method",
15533
+ "name": "#setProperty",
15534
+ "privacy": "private",
15535
+ "parameters": [
15536
+ {
15537
+ "name": "name",
15538
+ "type": {
15539
+ "text": "string"
15540
+ }
15541
+ },
15542
+ {
15543
+ "name": "options",
15544
+ "type": {
15545
+ "text": "PropertyOptions"
15546
+ }
15547
+ },
15548
+ {
15549
+ "name": "value",
15550
+ "type": {
15551
+ "text": "PropertyValue"
15552
+ }
15553
+ }
15554
+ ],
15555
+ "inheritedFrom": {
15556
+ "name": "GwElement",
15557
+ "module": "src/element.ts"
15558
+ }
15559
+ }
15560
+ ],
15561
+ "attributes": [
15562
+ {
15563
+ "type": {
15564
+ "text": "number"
15565
+ },
15566
+ "description": "The heading level. Defaults to 2.",
15567
+ "name": "level"
15568
+ }
15569
+ ],
15570
+ "superclass": {
15571
+ "name": "GwElement",
15572
+ "module": "/src/element.js"
14917
15573
  },
14918
15574
  "tagName": "gw-section-title",
14919
15575
  "customElement": true,
@@ -21140,6 +21796,14 @@
21140
21796
  "module": "src/gw-popover.js"
21141
21797
  }
21142
21798
  },
21799
+ {
21800
+ "kind": "js",
21801
+ "name": "*",
21802
+ "declaration": {
21803
+ "name": "*",
21804
+ "module": "src/gw-range.js"
21805
+ }
21806
+ },
21143
21807
  {
21144
21808
  "kind": "js",
21145
21809
  "name": "*",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmo001/groundwork-ui",
3
- "version": "0.9.20",
3
+ "version": "0.9.22",
4
4
  "description": "Groundwork's framework-free web components, styled by the --gw-* tokens",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/src/fields.ts CHANGED
@@ -406,6 +406,79 @@ export const fieldStyles = css`
406
406
  gw-switch input:disabled {
407
407
  opacity: 0.5;
408
408
  }
409
+
410
+ gw-range {
411
+ display: flex;
412
+ flex-direction: column;
413
+ gap: var(--gw-space-2);
414
+ min-width: 0;
415
+ font-family: var(--gw-font-sans);
416
+ color: var(--gw-color-text-primary);
417
+ }
418
+
419
+ gw-range > label {
420
+ font-size: var(--gw-font-size-s);
421
+ font-weight: var(--gw-font-weight-strong);
422
+ color: var(--gw-color-text-strong);
423
+ }
424
+
425
+ gw-range .gw-range-control {
426
+ position: relative;
427
+ display: block;
428
+ }
429
+
430
+ gw-range input {
431
+ display: block;
432
+ width: 100%;
433
+ margin: 0;
434
+ accent-color: var(--gw-color-fill-accent-resting);
435
+ cursor: pointer;
436
+ }
437
+
438
+ gw-range input:focus-visible {
439
+ outline: var(--gw-focus-width) solid var(--gw-color-focus);
440
+ outline-offset: var(--gw-focus-offset);
441
+ }
442
+
443
+ gw-range input:disabled {
444
+ cursor: not-allowed;
445
+ opacity: 0.5;
446
+ }
447
+
448
+ /* The value above the thumb while it's held */
449
+ gw-range .gw-range-bubble {
450
+ position: absolute;
451
+ bottom: calc(100% + var(--gw-space-1));
452
+ padding: var(--gw-space-1) var(--gw-space-2);
453
+ font-size: var(--gw-font-size-xs);
454
+ font-variant-numeric: tabular-nums;
455
+ color: var(--gw-color-on-accent);
456
+ white-space: nowrap;
457
+ pointer-events: none;
458
+ background: var(--gw-color-fill-accent-resting);
459
+ border-radius: var(--gw-radius-control);
460
+ box-shadow: var(--gw-shadow-s);
461
+ translate: -50% 0;
462
+ }
463
+
464
+ gw-range .gw-range-bubble[hidden] {
465
+ display: none;
466
+ }
467
+
468
+ gw-range .gw-hint {
469
+ margin: 0;
470
+ font-size: var(--gw-font-size-xs);
471
+ color: var(--gw-color-text-secondary);
472
+ }
473
+
474
+ gw-range .gw-visually-hidden {
475
+ position: absolute;
476
+ width: 1px;
477
+ height: 1px;
478
+ overflow: hidden;
479
+ clip-path: inset(50%);
480
+ white-space: nowrap;
481
+ }
409
482
  `;
410
483
 
411
484
  const adoptStyles = (element: Element, sheet: CSSStyleSheet) => {
package/src/gw-card.ts CHANGED
@@ -25,6 +25,8 @@ import { base } from "./styles.js";
25
25
  * @summary A surface for one group of content, or a link to more.
26
26
  *
27
27
  * @attr {string} heading - The card's heading.
28
+ * @attr {string} description - A line under the heading.
29
+ * @attr {number} level - The heading's level for assistive tech, 2 by default. Use 3 for a card under a section heading.
28
30
  * @attr {string} href - Makes the whole card a link to this address.
29
31
  * @attr {boolean} flush - Drops the padding, for content that runs to the edges.
30
32
  * @attr {boolean} loading - Shows skeleton lines for the content and any unknown heading.
@@ -33,15 +35,20 @@ import { base } from "./styles.js";
33
35
  * @slot - The content.
34
36
  * @slot heading - The heading, in place of `heading`. An `<a>` here makes the whole card follow it.
35
37
  * @slot actions - Buttons beside the heading.
38
+ * @slot footer - Content under a divider at the bottom, such as a control for the whole card.
36
39
  *
37
40
  * @csspart card - The card's surface.
38
41
  * @csspart header - The row with the heading and actions.
39
42
  * @csspart heading - The heading.
43
+ * @csspart description - The line under the heading.
40
44
  * @csspart body - The content.
45
+ * @csspart footer - The area under the divider.
41
46
  */
42
47
  export class GwCard extends GwElement {
43
48
  static override properties = {
44
49
  heading: {},
50
+ description: {},
51
+ level: { type: "number" },
45
52
  href: {},
46
53
  flush: { type: "boolean", reflect: true },
47
54
  loading: { type: "boolean", reflect: true },
@@ -110,14 +117,41 @@ export class GwCard extends GwElement {
110
117
  align-items: center;
111
118
  }
112
119
 
113
- h2 {
120
+ .titles {
121
+ display: flex;
114
122
  flex: 1;
123
+ flex-direction: column;
124
+ gap: var(--gw-space-0-5);
125
+ min-width: 0;
126
+ }
127
+
128
+ .title {
115
129
  margin: 0;
116
130
  font-size: var(--gw-font-size-m);
117
131
  font-weight: var(--gw-font-weight-strong);
118
132
  color: var(--gw-color-text-strong);
119
133
  }
120
134
 
135
+ .description {
136
+ font-size: var(--gw-font-size-xs);
137
+ color: var(--gw-color-text-secondary);
138
+ }
139
+
140
+ /* The divider runs to the card's edges */
141
+ footer:not([hidden]) {
142
+ display: flex;
143
+ flex-direction: column;
144
+ gap: inherit;
145
+ margin-inline: calc(-1 * var(--gw-space-4));
146
+ padding: var(--gw-space-3) var(--gw-space-4) 0;
147
+ border-top: var(--gw-border-width) solid var(--gw-color-border-normal);
148
+ }
149
+
150
+ :host([flush]) footer:not([hidden]) {
151
+ margin-inline: 0;
152
+ padding-bottom: var(--gw-space-3);
153
+ }
154
+
121
155
  .body:not([hidden]) {
122
156
  display: flex;
123
157
  flex-direction: column;
@@ -127,6 +161,9 @@ export class GwCard extends GwElement {
127
161
  ];
128
162
 
129
163
  declare heading: string;
164
+ declare description: string;
165
+ /** The heading's level for assistive tech. */
166
+ declare level: number;
130
167
  declare href: string;
131
168
  declare flush: boolean;
132
169
  declare loading: boolean;
@@ -139,19 +176,34 @@ export class GwCard extends GwElement {
139
176
 
140
177
  readonly #headingSlot = h("slot", { name: "heading" });
141
178
 
179
+ readonly #heading = h(
180
+ "div",
181
+ { class: "title", part: "heading", role: "heading", "aria-level": "2" },
182
+ this.#title,
183
+ this.#headingSlot,
184
+ this.#titleSkeleton,
185
+ );
186
+
187
+ readonly #description = h("span", {
188
+ class: "description",
189
+ part: "description",
190
+ });
191
+
142
192
  readonly #header: HTMLElement = h(
143
193
  "header",
144
194
  { part: "header" },
145
- h(
146
- "h2",
147
- { part: "heading" },
148
- this.#title,
149
- this.#headingSlot,
150
- this.#titleSkeleton,
151
- ),
195
+ h("div", { class: "titles" }, this.#heading, this.#description),
152
196
  h("slot", { name: "actions" }),
153
197
  );
154
198
 
199
+ readonly #footerSlot = h("slot", { name: "footer" });
200
+
201
+ readonly #footer: HTMLElement = h(
202
+ "footer",
203
+ { part: "footer", hidden: "" },
204
+ this.#footerSlot,
205
+ );
206
+
155
207
  readonly #skeleton = h("gw-skeleton-lines");
156
208
 
157
209
  readonly #body: HTMLDivElement = h(
@@ -169,6 +221,8 @@ export class GwCard extends GwElement {
169
221
  constructor() {
170
222
  super();
171
223
  this.heading = "";
224
+ this.description = "";
225
+ this.level = 2;
172
226
  this.href = "";
173
227
  this.flush = false;
174
228
  this.loading = false;
@@ -215,6 +269,11 @@ export class GwCard extends GwElement {
215
269
  this.#headingSlot.addEventListener("slotchange", () => {
216
270
  this.requestUpdate("heading");
217
271
  });
272
+
273
+ this.#footerSlot.addEventListener("slotchange", () => {
274
+ this.#footer.hidden =
275
+ this.#footerSlot.assignedNodes({ flatten: true }).length === 0;
276
+ });
218
277
  }
219
278
 
220
279
  /** The `<a>` in the heading slot, or holding it, when there is one. */
@@ -227,7 +286,7 @@ export class GwCard extends GwElement {
227
286
  }
228
287
 
229
288
  protected override create(root: ShadowRoot) {
230
- this.#card.append(this.#header, this.#skeleton, this.#body);
289
+ this.#card.append(this.#header, this.#skeleton, this.#body, this.#footer);
231
290
  root.append(this.#card);
232
291
  }
233
292
 
@@ -260,9 +319,14 @@ export class GwCard extends GwElement {
260
319
 
261
320
  this.#card.classList.toggle("linked", this.#link() !== null && !this.href);
262
321
  this.#title.textContent = this.heading;
322
+ this.#heading.setAttribute("aria-level", String(this.level || 2));
323
+ this.#description.textContent = this.description;
324
+ this.#description.hidden = !this.description;
263
325
  this.#titleSkeleton.hidden =
264
326
  this.heading !== "" || slotted || !this.loading;
265
- this.#header.hidden = !this.heading && !slotted && !this.loading;
327
+ this.#header.hidden =
328
+ !this.heading && !this.description && !slotted && !this.loading;
329
+ this.#heading.hidden = !this.heading && !slotted && !this.loading;
266
330
  this.#skeleton.lines = this.lines;
267
331
  this.#skeleton.hidden = !this.loading;
268
332
  this.#body.hidden = this.loading;
@@ -0,0 +1,164 @@
1
+ /**
2
+ * `gw-range`: a labeled native range slider in light DOM.
3
+ * Docs: https://groundwork.timmo.dev/components/inputs/#range
4
+ *
5
+ * @module
6
+ */
7
+ import { h, setAttribute } from "./element.js";
8
+ import { LightElement, fieldId } from "./fields.js";
9
+
10
+ /**
11
+ * A labeled native range slider. While it's pressed or dragged, a bubble
12
+ * above the thumb shows the value, so a slider without a readout beside it
13
+ * still says where it is. The native `input` and `change` events bubble out
14
+ * as usual.
15
+ *
16
+ * @element gw-range
17
+ * @summary A labeled slider in light DOM, so forms see it.
18
+ *
19
+ * @attr {string} label - The label, also its accessible name.
20
+ * @attr {boolean} label-hidden - Hides the label but keeps it for assistive technology.
21
+ * @attr {string} name - The form field name.
22
+ * @attr {number} value - The value.
23
+ * @attr {number} min - The lowest value. Defaults to 0.
24
+ * @attr {number} max - The highest value. Defaults to 100.
25
+ * @attr {number} step - The step between values. Defaults to 1.
26
+ * @attr {string} unit - Shown after the value in the bubble and for assistive technology, such as `%`. Empty for a plain number.
27
+ * @attr {string} hint - One line of help under it.
28
+ * @attr {boolean} disabled - Disables it.
29
+ *
30
+ * @cssprop --gw-range-thumb - The thumb's size. Defaults to 1rem.
31
+ */
32
+ export class GwRange extends LightElement {
33
+ static override properties = {
34
+ label: {},
35
+ labelHidden: { type: "boolean", attribute: "label-hidden" },
36
+ name: {},
37
+ value: { type: "number" },
38
+ min: { type: "number" },
39
+ max: { type: "number" },
40
+ step: { type: "number" },
41
+ unit: {},
42
+ hint: {},
43
+ disabled: { type: "boolean" },
44
+ } as const;
45
+
46
+ declare label: string;
47
+ /** Keeps the label for assistive technology but hides it. */
48
+ declare labelHidden: boolean;
49
+ declare name: string;
50
+ declare value: number;
51
+ declare min: number;
52
+ declare max: number;
53
+ declare step: number;
54
+ /** Shown after the value, such as `%`. */
55
+ declare unit: string;
56
+ declare hint: string;
57
+ declare disabled: boolean;
58
+
59
+ readonly #id = fieldId();
60
+
61
+ readonly #label = h("label", { for: this.#id });
62
+
63
+ readonly #input = h("input", { type: "range", id: this.#id });
64
+
65
+ readonly #bubble = h("span", {
66
+ class: "gw-range-bubble",
67
+ "aria-hidden": "true",
68
+ hidden: "",
69
+ });
70
+
71
+ readonly #hint = h("p", { class: "gw-hint", id: `${this.#id}-hint` });
72
+
73
+ constructor() {
74
+ super();
75
+ this.label = "";
76
+ this.labelHidden = false;
77
+ this.name = "";
78
+ this.value = 0;
79
+ this.min = 0;
80
+ this.max = 100;
81
+ this.step = 1;
82
+ this.unit = "";
83
+ this.hint = "";
84
+ this.disabled = false;
85
+ }
86
+
87
+ #text(value: number): string {
88
+ if (!this.unit) return String(value);
89
+
90
+ return this.unit === "%" ? `${value}%` : `${value} ${this.unit}`;
91
+ }
92
+
93
+ #placeBubble() {
94
+ const value = this.#input.valueAsNumber;
95
+ const span = this.max - this.min;
96
+ const fraction = span > 0 ? (value - this.min) / span : 0;
97
+
98
+ this.#bubble.textContent = this.#text(value);
99
+ // Follows the thumb's center, which travels a thumb's width less than the track
100
+ this.#bubble.style.left = `calc(${fraction * 100}% + (0.5 - ${fraction}) * var(--gw-range-thumb, 1rem))`;
101
+ }
102
+
103
+ readonly #release = () => {
104
+ this.#bubble.hidden = true;
105
+ window.removeEventListener("pointerup", this.#release);
106
+ window.removeEventListener("pointercancel", this.#release);
107
+ };
108
+
109
+ protected override create(root: HTMLElement) {
110
+ this.#input.addEventListener("pointerdown", () => {
111
+ if (this.#input.disabled) return;
112
+
113
+ this.#placeBubble();
114
+ this.#bubble.hidden = false;
115
+ window.addEventListener("pointerup", this.#release);
116
+ window.addEventListener("pointercancel", this.#release);
117
+ });
118
+ this.#input.addEventListener("input", () => {
119
+ this.value = this.#input.valueAsNumber;
120
+ this.#placeBubble();
121
+ });
122
+ root.append(
123
+ this.#label,
124
+ h("span", { class: "gw-range-control" }, this.#input, this.#bubble),
125
+ this.#hint,
126
+ );
127
+ }
128
+
129
+ override disconnectedCallback() {
130
+ super.disconnectedCallback();
131
+ this.#release();
132
+ }
133
+
134
+ protected override update() {
135
+ const input = this.#input;
136
+
137
+ this.#label.textContent = this.label;
138
+ this.#label.className = this.labelHidden ? "gw-visually-hidden" : "";
139
+ setAttribute(input, "name", this.name || null);
140
+ input.min = String(this.min);
141
+ input.max = String(this.max);
142
+ input.step = String(this.step);
143
+ input.disabled = this.disabled;
144
+
145
+ if (input.valueAsNumber !== this.value) input.value = String(this.value);
146
+
147
+ setAttribute(
148
+ input,
149
+ "aria-valuetext",
150
+ this.unit ? this.#text(this.value) : null,
151
+ );
152
+ setAttribute(input, "aria-describedby", this.hint ? this.#hint.id : null);
153
+ this.#hint.textContent = this.hint;
154
+ this.#hint.hidden = !this.hint;
155
+ }
156
+ }
157
+
158
+ GwRange.define("gw-range");
159
+
160
+ declare global {
161
+ interface HTMLElementTagNameMap {
162
+ "gw-range": GwRange;
163
+ }
164
+ }
package/src/index.ts CHANGED
@@ -67,6 +67,8 @@ export * from "./gw-page-header.js";
67
67
 
68
68
  export * from "./gw-popover.js";
69
69
 
70
+ export * from "./gw-range.js";
71
+
70
72
  export * from "./gw-section-title.js";
71
73
 
72
74
  export * from "./gw-segmented.js";