@atomic-ui/ui 0.13.2 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/custom-elements.json +71 -2
  2. package/dist/base/motion.d.ts +44 -0
  3. package/dist/{chunk-DKVLA7AF.js → chunk-22XEQ4HD.js} +2 -2
  4. package/dist/{chunk-X57BTN6V.js → chunk-46DONRMK.js} +11 -1
  5. package/dist/chunk-46DONRMK.js.map +1 -0
  6. package/dist/{chunk-H5HWJ2D4.js → chunk-7RZYC2IX.js} +2 -2
  7. package/dist/chunk-FF6GQADC.js +241 -0
  8. package/dist/chunk-FF6GQADC.js.map +1 -0
  9. package/dist/{chunk-WGFHYSXH.js → chunk-FJOZL25F.js} +3 -2
  10. package/dist/{chunk-WGFHYSXH.js.map → chunk-FJOZL25F.js.map} +1 -1
  11. package/dist/{chunk-NCVBRUJM.js → chunk-FQ4I6TD6.js} +11 -6
  12. package/dist/chunk-FQ4I6TD6.js.map +1 -0
  13. package/dist/{chunk-K5QFVLCI.js → chunk-GHUVRNWS.js} +8 -3
  14. package/dist/chunk-GHUVRNWS.js.map +1 -0
  15. package/dist/{chunk-VR543SMV.js → chunk-IBBW4CVA.js} +2 -2
  16. package/dist/{chunk-EFP7PJ6C.js → chunk-J3XAAGFG.js} +7 -2
  17. package/dist/chunk-J3XAAGFG.js.map +1 -0
  18. package/dist/{chunk-JDKOHA3B.js → chunk-JBEPS77S.js} +2 -2
  19. package/dist/chunk-K542UBDD.js +100 -0
  20. package/dist/chunk-K542UBDD.js.map +1 -0
  21. package/dist/{chunk-C767LTJE.js → chunk-KBCCL45Y.js} +3 -3
  22. package/dist/chunk-KBCCL45Y.js.map +1 -0
  23. package/dist/{chunk-BTACNWU6.js → chunk-KXHRD4FK.js} +2 -2
  24. package/dist/{chunk-CN4J5RS2.js → chunk-LRDK2G3E.js} +2 -2
  25. package/dist/{chunk-JX5RJRME.js → chunk-MXPFOBXZ.js} +15 -3
  26. package/dist/chunk-MXPFOBXZ.js.map +1 -0
  27. package/dist/{chunk-KDU2POFS.js → chunk-NN6L3HLD.js} +2 -2
  28. package/dist/{chunk-GIIJ32FN.js → chunk-NTRIND3W.js} +2 -2
  29. package/dist/{chunk-6IQIFKY6.js → chunk-SLNHUYGJ.js} +2 -2
  30. package/dist/{chunk-273AYERA.js → chunk-YOJF5ESL.js} +2 -2
  31. package/dist/components/app-bar.js +2 -2
  32. package/dist/components/app-ui.js +2 -2
  33. package/dist/components/button.js +2 -1
  34. package/dist/components/checkbox-group.js +2 -2
  35. package/dist/components/checkbox.js +2 -2
  36. package/dist/components/chip-group.js +3 -2
  37. package/dist/components/chip.js +1 -1
  38. package/dist/components/date-input.js +2 -2
  39. package/dist/components/journey.js +2 -2
  40. package/dist/components/link.js +2 -1
  41. package/dist/components/navigation.d.ts +3 -2
  42. package/dist/components/navigation.js +1 -1
  43. package/dist/components/page.js +1 -1
  44. package/dist/components/radio-group.js +2 -2
  45. package/dist/components/select.js +2 -2
  46. package/dist/components/switch.js +2 -2
  47. package/dist/components/text-input.js +2 -2
  48. package/dist/components/textarea.js +2 -2
  49. package/dist/index.d.ts +2 -0
  50. package/dist/index.js +41 -17
  51. package/dist/reveal.d.ts +54 -0
  52. package/dist/reveal.js +19 -0
  53. package/dist/reveal.js.map +1 -0
  54. package/dist/standalone/atomic-ui-reveal.js +3 -0
  55. package/dist/standalone/atomic-ui-reveal.js.map +7 -0
  56. package/dist/standalone/atomic-ui.js +773 -689
  57. package/dist/standalone/atomic-ui.js.map +4 -4
  58. package/package.json +10 -2
  59. package/dist/chunk-C767LTJE.js.map +0 -1
  60. package/dist/chunk-EFP7PJ6C.js.map +0 -1
  61. package/dist/chunk-JX5RJRME.js.map +0 -1
  62. package/dist/chunk-K5QFVLCI.js.map +0 -1
  63. package/dist/chunk-NCVBRUJM.js.map +0 -1
  64. package/dist/chunk-X57BTN6V.js.map +0 -1
  65. /package/dist/{chunk-DKVLA7AF.js.map → chunk-22XEQ4HD.js.map} +0 -0
  66. /package/dist/{chunk-H5HWJ2D4.js.map → chunk-7RZYC2IX.js.map} +0 -0
  67. /package/dist/{chunk-VR543SMV.js.map → chunk-IBBW4CVA.js.map} +0 -0
  68. /package/dist/{chunk-JDKOHA3B.js.map → chunk-JBEPS77S.js.map} +0 -0
  69. /package/dist/{chunk-BTACNWU6.js.map → chunk-KXHRD4FK.js.map} +0 -0
  70. /package/dist/{chunk-CN4J5RS2.js.map → chunk-LRDK2G3E.js.map} +0 -0
  71. /package/dist/{chunk-KDU2POFS.js.map → chunk-NN6L3HLD.js.map} +0 -0
  72. /package/dist/{chunk-GIIJ32FN.js.map → chunk-NTRIND3W.js.map} +0 -0
  73. /package/dist/{chunk-6IQIFKY6.js.map → chunk-SLNHUYGJ.js.map} +0 -0
  74. /package/dist/{chunk-273AYERA.js.map → chunk-YOJF5ESL.js.map} +0 -0
@@ -3,7 +3,12 @@ import {
3
3
  } from "./chunk-XX6JZW5N.js";
4
4
  import {
5
5
  FieldElement
6
- } from "./chunk-X57BTN6V.js";
6
+ } from "./chunk-46DONRMK.js";
7
+ import {
8
+ R,
9
+ revealAt,
10
+ revealStyles
11
+ } from "./chunk-K542UBDD.js";
7
12
  import {
8
13
  space,
9
14
  t
@@ -33,7 +38,10 @@ var ImpaktChipGroup = class extends FieldElement {
33
38
  static {
34
39
  this.styles = [
35
40
  ...FieldElement.styles,
41
+ revealStyles,
36
42
  css`
43
+ /* Given \`data-reveal\`, the chips drop 12px into place one after another, once, as the group is reached (impkt-web#51). */
44
+ :host([data-motion]) .chip { animation: ik-reveal-drop ${R.drop} ${R.arrive} ${revealAt()} both; }
37
45
  fieldset {
38
46
  border: 0;
39
47
  margin: 0;
@@ -71,6 +79,10 @@ var ImpaktChipGroup = class extends FieldElement {
71
79
  border-radius: 0;
72
80
  cursor: pointer;
73
81
  }
82
+ /* The site's chips (10:547, 15:945) are 8 by 14 inside: "Mobile app" is 100px wide. */
83
+ :host([look='site']) .chip {
84
+ padding-inline: 14px;
85
+ }
74
86
  .chip input {
75
87
  position: absolute;
76
88
  inset: 0;
@@ -152,7 +164,7 @@ var ImpaktChipGroup = class extends FieldElement {
152
164
  return html`<div class="chips">
153
165
  ${this.options.map((option, i) => {
154
166
  const on = this.chosen(option.value);
155
- return html`<label class="chip ${on ? "on" : ""}" part="chip">
167
+ return html`<label class="chip ${on ? "on" : ""}" part="chip" style=${`--i:${i}`}>
156
168
  <input
157
169
  type=${type}
158
170
  id=${i === 0 ? this.controlId : this.id_(`opt-${i}`)}
@@ -199,4 +211,4 @@ customElements.define("impakt-chip-group", ImpaktChipGroup);
199
211
  export {
200
212
  ImpaktChipGroup
201
213
  };
202
- //# sourceMappingURL=chunk-JX5RJRME.js.map
214
+ //# sourceMappingURL=chunk-MXPFOBXZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chip-group.ts"],"sourcesContent":["/**\n * A choice made with square chips: one, or several.\n */\nimport { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { R, revealAt, revealStyles } from '../base/motion';\nimport { space, t } from '../base/tokens';\nimport { kit } from './tool-kit-tokens';\n\nexport interface ChipOption {\n value: string;\n label: string;\n}\n\n/**\n * A short choice drawn as a row of square chips, such as \"What do you need\"\n * or \"Budget\" on a brief form, or the answers in an estimator.\n *\n * **Under each chip is a native control.** A single choice is a set of radios\n * and several is a set of checkboxes, so a single choice has the arrow keys,\n * Home and End and the right announcement without any script, and each\n * checkbox is its own tab stop, as it should be. The control lies over its\n * chip, invisible, so the whole chip is what is pressed and a screen reader\n * exploring by touch finds it where it is drawn.\n *\n * The question is a `legend` in a `fieldset`, because it is asked of the set.\n * `look=\"site\"` draws it in the site's form style: mono, uppercase, 11px.\n *\n * It joins its form like the other fields. A single choice submits its value;\n * several submit their values joined with commas, in the options' order.\n * `required` with nothing chosen makes the form invalid.\n *\n * Figma: site brief form `20:1157`; estimator `10:547`, `10:557`; mobile `15:945`.\n *\n * @category form\n * @icon checkbox\n * @csspart chip - Each chip.\n * @csspart fieldset - The fieldset.\n * @cssprop --impakt-chip-group-gap - The space between the chips, 6px unless set; the estimator sets 8px, as its frame does (`10:547`).\n */\nexport class ImpaktChipGroup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n options: { type: Array },\n values: { type: Array },\n multiple: { type: Boolean, reflect: true },\n look: { type: String, reflect: true },\n missingText: { type: String, attribute: 'missing-text' },\n };\n\n declare options: ChipOption[];\n /** What is chosen when `multiple` is set. */\n declare values: string[];\n /** Choose several, as checkboxes, rather than one, as radios. */\n declare multiple: boolean;\n /** `default` takes the product's field label; `site` is the mono uppercase label of the site's forms. */\n declare look: 'default' | 'site';\n /** What the browser says when a required choice is missing. */\n declare missingText: string;\n\n constructor() {\n super();\n this.options = [];\n this.values = [];\n this.multiple = false;\n this.look = 'default';\n this.missingText = 'Choose an option';\n }\n\n static styles = [\n ...FieldElement.styles,\n revealStyles,\n css`\n /* Given \\`data-reveal\\`, the chips drop 12px into place one after another, once, as the group is reached (impkt-web#51). */\n :host([data-motion]) .chip { animation: ik-reveal-drop ${R.drop} ${R.arrive} ${revealAt()} both; }\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n :host([look='site']) legend {\n font-family: ${t.fontMono};\n /* G2 Mono S is 11px (20:1100); the ramp's 2xs is 12px, so the size is set here, as the text fields' site label is. */\n font-size: 0.6875rem;\n font-weight: ${kit.medium};\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-block-end: ${space(2)};\n }\n .chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--impakt-chip-group-gap, ${space(1.5)});\n }\n .chip {\n position: relative;\n display: inline-flex;\n align-items: center;\n min-block-size: 35px;\n padding: 0 ${space(3)};\n font-family: ${t.fontBody};\n font-size: ${kit.small};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: 1px solid ${t.text};\n border-radius: 0;\n cursor: pointer;\n }\n /* The site's chips (10:547, 15:945) are 8 by 14 inside: \"Mobile app\" is 100px wide. */\n :host([look='site']) .chip {\n padding-inline: 14px;\n }\n .chip input {\n position: absolute;\n inset: 0;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n opacity: 0;\n cursor: inherit;\n }\n .chip:hover {\n background: ${t.surfaceSubtle};\n }\n .chip.on {\n color: ${kit.onInverse};\n background: ${kit.inverse};\n }\n .chip:has(input:focus-visible) {\n outline: 2px solid transparent;\n outline-offset: ${t.focusOffset};\n box-shadow: ${t.focusShadow};\n }\n :host([disabled]) .chip {\n opacity: 0.6;\n cursor: not-allowed;\n }\n :host([invalid]) .chip {\n border-color: ${t.danger};\n }\n @media (pointer: coarse) {\n .chip {\n min-block-size: 44px;\n }\n }\n @media (forced-colors: active) {\n .chip {\n border-color: ButtonText;\n }\n .chip.on {\n forced-color-adjust: none;\n color: HighlightText;\n background: Highlight;\n border-color: Highlight;\n }\n .chip:has(input:focus-visible) {\n outline-color: Highlight;\n }\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n private chosen(value: string): boolean {\n return this.multiple ? this.values.includes(value) : this.value === value;\n }\n\n private choose(value: string, checked: boolean): void {\n if (this.multiple) {\n const next = checked ? [...this.values, value] : this.values.filter((v) => v !== value);\n this.values = this.options.filter((o) => next.includes(o.value)).map((o) => o.value);\n this.setFormValue(this.values.join(','));\n } else this.setFormValue(value);\n this.syncValidity();\n }\n\n private syncValidity(): void {\n const empty = this.multiple ? this.values.length === 0 : !this.value;\n try {\n if (this.required && empty) {\n const anchor = this.renderRoot?.querySelector?.('input') ?? undefined;\n this.internals?.setValidity({ valueMissing: true }, this.missingText, anchor as HTMLElement | undefined);\n } else this.internals?.setValidity({});\n } catch {\n // An engine without ElementInternals validity still has a working control.\n }\n }\n\n protected renderControl(): TemplateResult {\n const type = this.multiple ? 'checkbox' : 'radio';\n return html`<div class=\"chips\">\n ${this.options.map((option, i) => {\n const on = this.chosen(option.value);\n return html`<label class=\"chip ${on ? 'on' : ''}\" part=\"chip\" style=${`--i:${i}`}>\n <input\n type=${type}\n id=${i === 0 ? this.controlId : this.id_(`opt-${i}`)}\n name=${this.uid}\n value=${option.value}\n .checked=${on}\n ?disabled=${this.disabled}\n ?required=${!this.multiple && this.required && i === 0}\n @change=${(e: Event) => this.choose(option.value, (e.target as HTMLInputElement).checked)}\n /><span>${option.label}</span>\n </label>`;\n })}\n </div>`;\n }\n\n render(): TemplateResult {\n return html`\n <fieldset part=\"fieldset\" aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}>\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>\n `;\n }\n\n firstUpdated(): void {\n const initial = this.multiple ? this.values.join(',') : this.value;\n this.internals?.setFormValue(initial || null);\n this.syncValidity();\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n if (changed.has('required') || changed.has('multiple')) this.syncValidity();\n }\n\n /** A form reset clears the choice. */\n formResetCallback(): void {\n this.value = '';\n this.values = [];\n this.internals?.setFormValue(null);\n this.syncValidity();\n }\n}\n\ncustomElements.define('impakt-chip-group', ImpaktChipGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-chip-group': ImpaktChipGroup;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,SAAS,MAAM,KAAK,eAAoC;AAqCjD,IAAM,kBAAN,cAA8B,aAAa;AAAA,EAChD;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,SAAS,EAAE,MAAM,MAAM;AAAA,MACvB,QAAQ,EAAE,MAA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Aa,IAAI;AACjC,SAAK,aAAa;AAAA,EACpB;AACF;AAEA,eAAe,OAAO,qBAAqB,eAAe;","names":[]}
@@ -3,7 +3,7 @@ import {
3
3
  FieldElement,
4
4
  fieldControl,
5
5
  fieldWidths
6
- } from "./chunk-X57BTN6V.js";
6
+ } from "./chunk-46DONRMK.js";
7
7
 
8
8
  // packages/ui/src/components/textarea.ts
9
9
  import { html, css, nothing } from "lit";
@@ -101,4 +101,4 @@ customElements.define("impakt-textarea", ImpaktTextarea);
101
101
  export {
102
102
  ImpaktTextarea
103
103
  };
104
- //# sourceMappingURL=chunk-KDU2POFS.js.map
104
+ //# sourceMappingURL=chunk-NN6L3HLD.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FieldElement
3
- } from "./chunk-X57BTN6V.js";
3
+ } from "./chunk-46DONRMK.js";
4
4
  import {
5
5
  say
6
6
  } from "./chunk-72WNCCDC.js";
@@ -137,4 +137,4 @@ customElements.define("impakt-date-input", ImpaktDateInput);
137
137
  export {
138
138
  ImpaktDateInput
139
139
  };
140
- //# sourceMappingURL=chunk-GIIJ32FN.js.map
140
+ //# sourceMappingURL=chunk-NTRIND3W.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FieldElement
3
- } from "./chunk-X57BTN6V.js";
3
+ } from "./chunk-46DONRMK.js";
4
4
  import {
5
5
  targetSize,
6
6
  touchTarget
@@ -89,4 +89,4 @@ customElements.define("impakt-checkbox", ImpaktCheckbox);
89
89
  export {
90
90
  ImpaktCheckbox
91
91
  };
92
- //# sourceMappingURL=chunk-6IQIFKY6.js.map
92
+ //# sourceMappingURL=chunk-SLNHUYGJ.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  FieldElement,
6
6
  fieldWidths
7
- } from "./chunk-X57BTN6V.js";
7
+ } from "./chunk-46DONRMK.js";
8
8
  import {
9
9
  ImpaktElement,
10
10
  focusRing,
@@ -557,4 +557,4 @@ export {
557
557
  ImpaktRangeInput,
558
558
  ImpaktTaskList
559
559
  };
560
- //# sourceMappingURL=chunk-273AYERA.js.map
560
+ //# sourceMappingURL=chunk-YOJF5ESL.js.map
@@ -2,9 +2,9 @@ import {
2
2
  ImpaktAppBar
3
3
  } from "../chunk-DJLUWM3C.js";
4
4
  import "../chunk-XX6JZW5N.js";
5
- import "../chunk-VR543SMV.js";
5
+ import "../chunk-IBBW4CVA.js";
6
6
  import "../chunk-UNGAG44M.js";
7
- import "../chunk-X57BTN6V.js";
7
+ import "../chunk-46DONRMK.js";
8
8
  import "../chunk-2YRTFWW2.js";
9
9
  import "../chunk-5OYQZWP2.js";
10
10
  import "../chunk-72WNCCDC.js";
@@ -8,9 +8,9 @@ import {
8
8
  ImpaktSlotPicker,
9
9
  ImpaktToast,
10
10
  pageWindow
11
- } from "../chunk-VR543SMV.js";
11
+ } from "../chunk-IBBW4CVA.js";
12
12
  import "../chunk-UNGAG44M.js";
13
- import "../chunk-X57BTN6V.js";
13
+ import "../chunk-46DONRMK.js";
14
14
  import "../chunk-2YRTFWW2.js";
15
15
  import "../chunk-5OYQZWP2.js";
16
16
  import "../chunk-72WNCCDC.js";
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ImpaktButton
3
- } from "../chunk-EFP7PJ6C.js";
3
+ } from "../chunk-J3XAAGFG.js";
4
+ import "../chunk-K542UBDD.js";
4
5
  import "../chunk-5OYQZWP2.js";
5
6
  import "../chunk-72WNCCDC.js";
6
7
  import "../chunk-JTCTQBAX.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktCheckboxGroup
3
- } from "../chunk-DKVLA7AF.js";
4
- import "../chunk-X57BTN6V.js";
3
+ } from "../chunk-22XEQ4HD.js";
4
+ import "../chunk-46DONRMK.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktCheckbox
3
- } from "../chunk-6IQIFKY6.js";
4
- import "../chunk-X57BTN6V.js";
3
+ } from "../chunk-SLNHUYGJ.js";
4
+ import "../chunk-46DONRMK.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  ImpaktChipGroup
3
- } from "../chunk-JX5RJRME.js";
3
+ } from "../chunk-MXPFOBXZ.js";
4
4
  import "../chunk-XX6JZW5N.js";
5
- import "../chunk-X57BTN6V.js";
5
+ import "../chunk-46DONRMK.js";
6
+ import "../chunk-K542UBDD.js";
6
7
  import "../chunk-72WNCCDC.js";
7
8
  import "../chunk-JTCTQBAX.js";
8
9
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ImpaktChip
3
- } from "../chunk-C767LTJE.js";
3
+ } from "../chunk-KBCCL45Y.js";
4
4
  import "../chunk-72WNCCDC.js";
5
5
  import "../chunk-JTCTQBAX.js";
6
6
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktDateInput
3
- } from "../chunk-GIIJ32FN.js";
4
- import "../chunk-X57BTN6V.js";
3
+ } from "../chunk-NTRIND3W.js";
4
+ import "../chunk-46DONRMK.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -6,9 +6,9 @@ import {
6
6
  ImpaktRangeInput,
7
7
  ImpaktTaskList,
8
8
  groupDigits
9
- } from "../chunk-273AYERA.js";
9
+ } from "../chunk-YOJF5ESL.js";
10
10
  import "../chunk-UNGAG44M.js";
11
- import "../chunk-X57BTN6V.js";
11
+ import "../chunk-46DONRMK.js";
12
12
  import "../chunk-72WNCCDC.js";
13
13
  import "../chunk-JTCTQBAX.js";
14
14
  export {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ImpaktLink
3
- } from "../chunk-K5QFVLCI.js";
3
+ } from "../chunk-GHUVRNWS.js";
4
+ import "../chunk-K542UBDD.js";
4
5
  import "../chunk-5OYQZWP2.js";
5
6
  import "../chunk-72WNCCDC.js";
6
7
  import "../chunk-JTCTQBAX.js";
@@ -100,8 +100,9 @@ export declare class ImpaktNav extends ImpaktElement {
100
100
  actionHref: string;
101
101
  /**
102
102
  * `links` is a row of words. `tabs` is the G2 site header's file tabs: a
103
- * bordered group on the soft surface, each tab 42px tall, and the page you
104
- * are on a white tab with a dot before it (frame 9:264). The current tab is
103
+ * bordered group on the soft surface as wide as its tabs, each tab 32px
104
+ * tall, and the page you are on a white 34px tab with a dot before it
105
+ * (frame 9:264). The current tab is
105
106
  * still `aria-current`, so it is not said by colour alone.
106
107
  */
107
108
  look: 'links' | 'tabs';
@@ -2,7 +2,7 @@ import {
2
2
  ImpaktBreadcrumbs,
3
3
  ImpaktNav,
4
4
  linkCurrent
5
- } from "../chunk-NCVBRUJM.js";
5
+ } from "../chunk-FQ4I6TD6.js";
6
6
  import "../chunk-5OYQZWP2.js";
7
7
  import "../chunk-72WNCCDC.js";
8
8
  import "../chunk-JTCTQBAX.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktPage,
3
3
  ImpaktSection
4
- } from "../chunk-WGFHYSXH.js";
4
+ } from "../chunk-FJOZL25F.js";
5
5
  import "../chunk-6WVL3HOC.js";
6
6
  import "../chunk-72WNCCDC.js";
7
7
  import "../chunk-JTCTQBAX.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktRadioGroup
3
- } from "../chunk-H5HWJ2D4.js";
4
- import "../chunk-X57BTN6V.js";
3
+ } from "../chunk-7RZYC2IX.js";
4
+ import "../chunk-46DONRMK.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktSelect
3
- } from "../chunk-BTACNWU6.js";
4
- import "../chunk-X57BTN6V.js";
3
+ } from "../chunk-KXHRD4FK.js";
4
+ import "../chunk-46DONRMK.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ImpaktSegmentedControl,
3
3
  ImpaktSwitch
4
- } from "../chunk-CN4J5RS2.js";
5
- import "../chunk-X57BTN6V.js";
4
+ } from "../chunk-LRDK2G3E.js";
5
+ import "../chunk-46DONRMK.js";
6
6
  import "../chunk-72WNCCDC.js";
7
7
  import "../chunk-JTCTQBAX.js";
8
8
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktTextInput
3
- } from "../chunk-JDKOHA3B.js";
4
- import "../chunk-X57BTN6V.js";
3
+ } from "../chunk-JBEPS77S.js";
4
+ import "../chunk-46DONRMK.js";
5
5
  import "../chunk-5OYQZWP2.js";
6
6
  import "../chunk-72WNCCDC.js";
7
7
  import "../chunk-JTCTQBAX.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktTextarea
3
- } from "../chunk-KDU2POFS.js";
4
- import "../chunk-X57BTN6V.js";
3
+ } from "../chunk-NN6L3HLD.js";
4
+ import "../chunk-46DONRMK.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
package/dist/index.d.ts CHANGED
@@ -52,6 +52,8 @@ export { ImpaktElement } from './base/ImpaktElement';
52
52
  export { FieldElement, fieldWidths } from './base/FieldElement';
53
53
  export * from './base/tokens';
54
54
  export * from './base/styles';
55
+ export { R, revealAt, revealStyles } from './base/motion';
56
+ export { startReveal, replayReveal, revealTargets, revealAllowed, revealMode, REVEAL_SELECTOR, REVEAL_STATE } from './reveal';
55
57
  export { say } from './base/say';
56
58
  export { pageLocale } from './base/locale';
57
59
  export { lockScroll, unlockScroll } from './base/scroll-lock';
package/dist/index.js CHANGED
@@ -1,19 +1,28 @@
1
1
  import {
2
2
  ImpaktSegmentedControl,
3
3
  ImpaktSwitch
4
- } from "./chunk-CN4J5RS2.js";
4
+ } from "./chunk-LRDK2G3E.js";
5
5
  import {
6
6
  ImpaktTable
7
7
  } from "./chunk-KE6WCXQP.js";
8
8
  import {
9
9
  ImpaktTextInput
10
- } from "./chunk-JDKOHA3B.js";
10
+ } from "./chunk-JBEPS77S.js";
11
11
  import {
12
12
  ImpaktTextarea
13
- } from "./chunk-KDU2POFS.js";
13
+ } from "./chunk-NN6L3HLD.js";
14
14
  import {
15
15
  ImpaktToolCard
16
16
  } from "./chunk-5PRB7P7N.js";
17
+ import {
18
+ REVEAL_SELECTOR,
19
+ REVEAL_STATE,
20
+ replayReveal,
21
+ revealAllowed,
22
+ revealMode,
23
+ revealTargets,
24
+ startReveal
25
+ } from "./chunk-FF6GQADC.js";
17
26
  import {
18
27
  ImpaktRedaction
19
28
  } from "./chunk-LBHTXY7K.js";
@@ -25,7 +34,7 @@ import {
25
34
  } from "./chunk-EIWICFXL.js";
26
35
  import {
27
36
  ImpaktSelect
28
- } from "./chunk-BTACNWU6.js";
37
+ } from "./chunk-KXHRD4FK.js";
29
38
  import {
30
39
  ImpaktSource
31
40
  } from "./chunk-QPOM7W3D.js";
@@ -48,11 +57,11 @@ import {
48
57
  ImpaktBreadcrumbs,
49
58
  ImpaktNav,
50
59
  linkCurrent
51
- } from "./chunk-NCVBRUJM.js";
60
+ } from "./chunk-FQ4I6TD6.js";
52
61
  import {
53
62
  ImpaktPage,
54
63
  ImpaktSection
55
- } from "./chunk-WGFHYSXH.js";
64
+ } from "./chunk-FJOZL25F.js";
56
65
  import {
57
66
  ImpaktPrice
58
67
  } from "./chunk-EKPTMRBG.js";
@@ -61,7 +70,7 @@ import {
61
70
  } from "./chunk-LP4RTYTL.js";
62
71
  import {
63
72
  ImpaktRadioGroup
64
- } from "./chunk-H5HWJ2D4.js";
73
+ } from "./chunk-7RZYC2IX.js";
65
74
  import {
66
75
  ImpaktFieldset
67
76
  } from "./chunk-F4IXELLK.js";
@@ -79,7 +88,7 @@ import {
79
88
  ImpaktRangeInput,
80
89
  ImpaktTaskList,
81
90
  groupDigits
82
- } from "./chunk-273AYERA.js";
91
+ } from "./chunk-YOJF5ESL.js";
83
92
  import {
84
93
  ImpaktLanguageSwitch
85
94
  } from "./chunk-NHEU5FT6.js";
@@ -91,31 +100,31 @@ import {
91
100
  } from "./chunk-LVBYNQ45.js";
92
101
  import {
93
102
  ImpaktLink
94
- } from "./chunk-K5QFVLCI.js";
103
+ } from "./chunk-GHUVRNWS.js";
95
104
  import {
96
105
  ImpaktCheckboxGroup
97
- } from "./chunk-DKVLA7AF.js";
106
+ } from "./chunk-22XEQ4HD.js";
98
107
  import {
99
108
  ImpaktCheckbox
100
- } from "./chunk-6IQIFKY6.js";
109
+ } from "./chunk-SLNHUYGJ.js";
101
110
  import {
102
111
  ImpaktChecked
103
112
  } from "./chunk-UFENSIWD.js";
104
113
  import {
105
114
  ImpaktChipGroup
106
- } from "./chunk-JX5RJRME.js";
115
+ } from "./chunk-MXPFOBXZ.js";
107
116
  import {
108
117
  CYCLE,
109
118
  ImpaktChip,
110
119
  TONE,
111
120
  toneOf
112
- } from "./chunk-C767LTJE.js";
121
+ } from "./chunk-KBCCL45Y.js";
113
122
  import {
114
123
  ImpaktCodeDiff
115
124
  } from "./chunk-7UI3OBXL.js";
116
125
  import {
117
126
  ImpaktDateInput
118
- } from "./chunk-GIIJ32FN.js";
127
+ } from "./chunk-NTRIND3W.js";
119
128
  import {
120
129
  ImpaktDialog
121
130
  } from "./chunk-ZOWOKIE4.js";
@@ -143,14 +152,14 @@ import {
143
152
  ImpaktPagination,
144
153
  ImpaktSlotPicker,
145
154
  ImpaktToast
146
- } from "./chunk-VR543SMV.js";
155
+ } from "./chunk-IBBW4CVA.js";
147
156
  import {
148
157
  pageLocale
149
158
  } from "./chunk-UNGAG44M.js";
150
159
  import {
151
160
  FieldElement,
152
161
  fieldWidths
153
- } from "./chunk-X57BTN6V.js";
162
+ } from "./chunk-46DONRMK.js";
154
163
  import {
155
164
  lockScroll,
156
165
  unlockScroll
@@ -173,7 +182,12 @@ import {
173
182
  } from "./chunk-N6EEW2GF.js";
174
183
  import {
175
184
  ImpaktButton
176
- } from "./chunk-EFP7PJ6C.js";
185
+ } from "./chunk-J3XAAGFG.js";
186
+ import {
187
+ R,
188
+ revealAt,
189
+ revealStyles
190
+ } from "./chunk-K542UBDD.js";
177
191
  import {
178
192
  ICONS,
179
193
  ICON_NAMES,
@@ -279,6 +293,9 @@ export {
279
293
  ImpaktToast,
280
294
  ImpaktToolCard,
281
295
  ImpaktVisuallyHidden,
296
+ R,
297
+ REVEAL_SELECTOR,
298
+ REVEAL_STATE,
282
299
  TONE,
283
300
  announceNavigate,
284
301
  base,
@@ -295,9 +312,16 @@ export {
295
312
  lockScroll,
296
313
  pageLocale,
297
314
  reducedMotion,
315
+ replayReveal,
316
+ revealAllowed,
317
+ revealAt,
318
+ revealMode,
319
+ revealStyles,
320
+ revealTargets,
298
321
  say,
299
322
  space,
300
323
  spaceAround,
324
+ startReveal,
301
325
  t,
302
326
  targetSize,
303
327
  token,
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Reveal once: the page draws itself in as the reader reaches it, once, and then holds still.
3
+ *
4
+ * This is the one mechanism behind the G2 Noire motion set (impkt-web#51). It has no dependency, not
5
+ * even Lit, so a page drawn on the server can load it on its own (`atomic-ui-reveal.js`, a few KB)
6
+ * and have its blocks draw themselves in without hydrating anything.
7
+ *
8
+ * How it works:
9
+ *
10
+ * - Every element is drawn in its final state, on the server and in the browser. A page with no
11
+ * script, or with reduced motion asked for, shows that and nothing else moves.
12
+ * - With motion, each element the reader has not reached yet is marked `data-motion="armed"`. An
13
+ * element's own styles start its animations under `[data-motion]` and pause them while it is
14
+ * armed, so it waits at its first frame, out of sight below the fold.
15
+ * - When its top reaches the middle of the screen (or it is wholly on the screen, at the foot of a
16
+ * page), it is marked `data-motion="play"` and its animations run. Elements that arrive together
17
+ * go one after another, `motion.reveal.stagger` apart, in the order they are drawn on the screen.
18
+ * - When they have finished the mark is taken off, so the element is in the state it was drawn in,
19
+ * and it is never animated again, however often it is scrolled past.
20
+ * - An element already on the screen when the page has been painted is left as it is: nothing moves
21
+ * under words someone may be reading. An element scrolled past without being reached, such as by
22
+ * following a link to a section further down, is let go in its final state.
23
+ *
24
+ * The brand decides whether any of this happens: only a brand whose `--impakt-motion-reveal-mode`
25
+ * is `once` arms anything. Every brand derives `none`, and Impakt sets `once`, so Harbour holds still.
26
+ *
27
+ * Figures count up: an element marked `data-ik-count` has the first number in its words counted
28
+ * from 0 over `motion.reveal.count.duration`. The words themselves never change, so a screen
29
+ * reader reads the real figure throughout: the count is drawn over them, from `data-count`, by the
30
+ * element's styles. `data-ik-count="text"` counts in the words themselves, for decoration that is
31
+ * hidden from a screen reader, such as a size label.
32
+ */
33
+ /** The blocks that draw themselves in, and any element that asks to with `data-reveal`. */
34
+ export declare const REVEAL_SELECTOR: string;
35
+ /** The attribute that carries an element's state: `armed`, then `play`, then none. */
36
+ export declare const REVEAL_STATE = "data-motion";
37
+ /** The brand's choice, read from the theme: `once` turns the set on. */
38
+ export declare function revealMode(doc?: Document): string;
39
+ /** Whether this page should move at all: the brand turns the set on, and the reader has not asked for less motion. */
40
+ export declare function revealAllowed(doc?: Document): boolean;
41
+ /** Every element that draws itself in, under `root` and inside the shadow roots of the elements there, such as a section head's stage tag. */
42
+ export declare function revealTargets(root: Document | Element | ShadowRoot): Element[];
43
+ /**
44
+ * Start the set on a page: arm what the reader has not reached, and draw each in as it is reached.
45
+ * Safe to call more than once; the second call does nothing. Does nothing at all when the brand has
46
+ * the set off, when reduced motion is asked for, or with no IntersectionObserver.
47
+ */
48
+ export declare function startReveal(doc?: Document): void;
49
+ /**
50
+ * Draw the elements under `root` in again now, whether or not they are on the screen, and resolve
51
+ * when they have finished: for a page that shows the set, such as the Storybook's Motion stories.
52
+ * It does nothing, and resolves at once, when the brand has the set off or reduced motion is asked for.
53
+ */
54
+ export declare function replayReveal(root?: Element | ShadowRoot | Document): Promise<void>;
package/dist/reveal.js ADDED
@@ -0,0 +1,19 @@
1
+ import {
2
+ REVEAL_SELECTOR,
3
+ REVEAL_STATE,
4
+ replayReveal,
5
+ revealAllowed,
6
+ revealMode,
7
+ revealTargets,
8
+ startReveal
9
+ } from "./chunk-FF6GQADC.js";
10
+ export {
11
+ REVEAL_SELECTOR,
12
+ REVEAL_STATE,
13
+ replayReveal,
14
+ revealAllowed,
15
+ revealMode,
16
+ revealTargets,
17
+ startReveal
18
+ };
19
+ //# sourceMappingURL=reveal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ /* @atomic-ui/ui version 0.14.0, the reveal set, standalone. */
2
+ var P=["impakt-highlight","impakt-process-line","impakt-section-head","impakt-stage-tag","impakt-service-card","impakt-stat-row","impakt-work-list","[data-reveal]"].join(", "),E="data-motion";function V(e=document){let t=e.defaultView;return t&&t.getComputedStyle(e.documentElement).getPropertyValue("--impakt-motion-reveal-mode").trim()||"none"}function S(e=document){let t=e.defaultView;return!t||typeof t.IntersectionObserver!="function"||t.matchMedia?.("(prefers-reduced-motion: reduce)").matches?!1:V(e)==="once"}function L(e){let t=[],n=i=>{i.nodeType===1&&i.matches(P)&&t.push(i);for(let r of Array.from(i.querySelectorAll("*")))r.matches(P)&&t.push(r),r.shadowRoot&&n(r.shadowRoot)};return n(e),[...new Set(t)]}var y=(e,t)=>{let n=e.trim();if(!n)return t;let i=parseFloat(n);return Number.isFinite(i)?n.endsWith("ms")?i:n.endsWith("s")?i*1e3:i:t};function B(e){let t=e.match(/cubic-bezier\(([^)]+)\)/),[n,i,r,l]=t?t[1].split(",").map(o=>parseFloat(o)):[.22,1,.36,1],c=(o,u,s)=>3*o*(1-s)*(1-s)*s+3*u*(1-s)*s*s+s*s*s;return o=>{if(o<=0)return 0;if(o>=1)return 1;let u=0,s=1,p=o;for(let g=0;g<30;g++){let h=c(n,r,p);if(Math.abs(h-o)<1e-5)break;h<o?u=p:s=p,p=(u+s)/2}return c(i,l,p)}}function D(e){let t=[],n=i=>t.push(...Array.from(i.querySelectorAll("[data-ik-count]")));return e.matches("[data-ik-count]")?t.push(e):e.matches('[data-reveal~="count"]')&&(e.setAttribute("data-ik-count",""),t.push(e)),n(e),e.shadowRoot&&n(e.shadowRoot),t}var H=/\d[\d,]*(?:\.\d+)?/,O=/\d[\d,]*(?:\.\d+)?/g;function W(e,t,n){let i=e.getAttribute("data-ik-count")==="text",r=i?_(e):null,l=(i?r?.data:e.textContent)?.replace(/\s+/g," ").trim()??"",c=[...l.matchAll(O)].sort((b,f)=>parseFloat(f[0].replace(/,/g,""))-parseFloat(b[0].replace(/,/g,"")))[0];if(!c||i&&!r)return Promise.resolve();let o=c[0],u=parseFloat(o.replace(/,/g,"")),s=(o.split(".")[1]??"").length,p=o.includes(","),g=n.getComputedStyle(e),h=y(g.getPropertyValue("--ik-count-duration"),y(g.getPropertyValue("--impakt-motion-reveal-count-duration"),900)),a=B(g.getPropertyValue("--impakt-motion-reveal-arrive")),m=r?.data??"",d=r?m.lastIndexOf(o,m.length):0,v=b=>{let f=b.toFixed(s);p&&(f=Number(f).toLocaleString("en-GB",{minimumFractionDigits:s,maximumFractionDigits:s})),r?r.data=m.slice(0,d)+f+m.slice(d+o.length):e.setAttribute("data-count",l.slice(0,c.index)+f+l.slice(c.index+o.length))},F=()=>{r?r.data=m:e.removeAttribute("data-count")};return v(0),new Promise(b=>{let f=0,k=T=>{f||(f=T+t);let x=(T-f)/h;if(x>=1||!e.isConnected){F(),b();return}v(x<=0?0:u*a(x)),n.requestAnimationFrame(k)};n.requestAnimationFrame(k)})}function _(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let n=t.nextNode();n;n=t.nextNode())if(H.test(n.data))return n;return null}function A(e){e.setAttribute(E,"armed"),e.matches('[data-reveal~="drop"]')&&Array.from(e.children).forEach((t,n)=>t.style.setProperty("--ik-reveal-i",String(n)))}function R(e){e.removeAttribute(E),e.style?.removeProperty("--ik-reveal-delay")}function N(e){let t=new Set(e.getAnimations?.({subtree:!0})??[]);for(let n of e.shadowRoot?.getAnimations?.()??[])t.add(n);return[...t]}function M(e,t,n){e.hasAttribute(E)||A(e),e.style.setProperty("--ik-reveal-delay",`${Math.round(t)}ms`),e.setAttribute(E,"play");let i=D(e).map(r=>{let l=Number(n.getComputedStyle(r).getPropertyValue("--i"))||0,c=y(n.getComputedStyle(r).getPropertyValue("--impakt-motion-reveal-stagger"),60);return W(r,t+l*c,n)});return new Promise(r=>{n.requestAnimationFrame(()=>{let l=new Promise(o=>n.setTimeout(o,t+4e3)),c=Promise.all([...N(e).map(o=>o.finished.catch(()=>{})),...i]);Promise.race([c,l]).then(()=>{R(e),r()})})})}var C=(e,t)=>Math.abs(e.top-t.top)>4?e.top-t.top:e.left-t.left;function w(e=document){let t=e.defaultView;if(!t||t.__impaktReveal||!S(e))return;let n=new Set,i=()=>t.innerHeight||e.documentElement.clientHeight,r=()=>y(t.getComputedStyle(e.documentElement).getPropertyValue("--impakt-motion-reveal-stagger"),60),l=a=>{let m=a.map(d=>({el:d,box:d.getBoundingClientRect()}));m.sort((d,v)=>C(d.box,v.box)),m.forEach(({el:d},v)=>{n.delete(d),o.unobserve(d),u.unobserve(d),M(d,Math.min(v,8)*r(),t)})},c=a=>l(a.filter(m=>m.isIntersecting&&n.has(m.target)).map(m=>m.target)),o=new t.IntersectionObserver(c,{rootMargin:"0px 0px -50% 0px"}),u=new t.IntersectionObserver(c,{threshold:.98}),s=0,p=()=>{s||(s=t.requestAnimationFrame(()=>{s=0;for(let a of n)a.getBoundingClientRect().bottom<0&&(n.delete(a),o.unobserve(a),u.unobserve(a),R(a))}))},g=(t.performance?.getEntriesByType?.("paint")??[]).length>0;for(let a of L(e)){if(a.hasAttribute(E))continue;let m=a.getBoundingClientRect();m.width===0&&m.height===0||m.bottom<0||m.top<i()&&g||(A(a),n.add(a),o.observe(a),u.observe(a))}let h=()=>{o.disconnect(),u.disconnect(),t.removeEventListener("scroll",p);for(let a of n)R(a);n.clear()};t.addEventListener("scroll",p,{passive:!0}),t.matchMedia?.("(prefers-reduced-motion: reduce)").addEventListener?.("change",a=>{a.matches&&h()}),t.__impaktReveal={armed:n,stop:h}}function q(e=document){let t=e.nodeType===9?e:e.ownerDocument,n=t.defaultView;if(!n||!S(t))return Promise.resolve();let i=L(e);return i.forEach(A),new Promise(r=>n.requestAnimationFrame(()=>{let l=i.map(o=>({el:o,box:o.getBoundingClientRect()})).sort((o,u)=>C(o.box,u.box)),c=y(n.getComputedStyle(t.documentElement).getPropertyValue("--impakt-motion-reveal-stagger"),60);Promise.all(l.map(({el:o},u)=>M(o,u*c,n))).then(()=>r())}))}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>w(),{once:!0}):w());export{q as replayReveal,w as startReveal};
3
+ //# sourceMappingURL=atomic-ui-reveal.js.map