@atomic-ui/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -96
- package/custom-elements.json +851 -56
- package/dist/base/FieldElement.d.ts +11 -0
- package/dist/base/scroll-lock.d.ts +2 -0
- package/dist/base/styles.d.ts +24 -5
- package/dist/chunk-2YRTFWW2.js +26 -0
- package/dist/chunk-2YRTFWW2.js.map +1 -0
- package/dist/{chunk-UNVL3CNM.js → chunk-37PA72FC.js} +4 -4
- package/dist/{chunk-UNVL3CNM.js.map → chunk-37PA72FC.js.map} +1 -1
- package/dist/{chunk-D6C7XEY4.js → chunk-3KO55PZK.js} +7 -2
- package/dist/chunk-3KO55PZK.js.map +1 -0
- package/dist/{chunk-7BSZPUE3.js → chunk-3RE4H2XO.js} +2 -2
- package/dist/{chunk-R67PDFKE.js → chunk-46BYUQ5A.js} +2 -2
- package/dist/{chunk-NCASAXQT.js → chunk-4OYHT4BN.js} +2 -2
- package/dist/{chunk-3IQ73WNW.js → chunk-55DK75QF.js} +6 -4
- package/dist/chunk-55DK75QF.js.map +1 -0
- package/dist/{chunk-TGT7J4EG.js → chunk-5QSTXIPG.js} +2 -2
- package/dist/{chunk-HYPPG4NF.js → chunk-7P4Z4CLK.js} +55 -16
- package/dist/chunk-7P4Z4CLK.js.map +1 -0
- package/dist/{chunk-26O27BQS.js → chunk-APJ5JGRW.js} +3 -3
- package/dist/{chunk-WFKSOM6O.js → chunk-AUVIOU5G.js} +38 -14
- package/dist/chunk-AUVIOU5G.js.map +1 -0
- package/dist/{chunk-FFCIY7NM.js → chunk-CUUBAETM.js} +2 -2
- package/dist/{chunk-OMJMUFOW.js → chunk-DAH7RLW3.js} +3 -3
- package/dist/{chunk-6YYAOKNI.js → chunk-DJEZW7AC.js} +2 -2
- package/dist/{chunk-E3XJK7MY.js → chunk-DKZ425AM.js} +5 -3
- package/dist/chunk-DKZ425AM.js.map +1 -0
- package/dist/{chunk-EDSZI227.js → chunk-F4YQWKK2.js} +7 -4
- package/dist/chunk-F4YQWKK2.js.map +1 -0
- package/dist/chunk-FVCM4WHD.js +328 -0
- package/dist/chunk-FVCM4WHD.js.map +1 -0
- package/dist/{chunk-7XEPNEVQ.js → chunk-GBRML4RF.js} +2 -2
- package/dist/chunk-GBRML4RF.js.map +1 -0
- package/dist/{chunk-MVEFM5QI.js → chunk-HXINWP3V.js} +42 -13
- package/dist/chunk-HXINWP3V.js.map +1 -0
- package/dist/{chunk-OB7WULFK.js → chunk-IOBSIAHB.js} +2 -2
- package/dist/{chunk-4X723QBD.js → chunk-IZOTGWWI.js} +4 -4
- package/dist/{chunk-4X723QBD.js.map → chunk-IZOTGWWI.js.map} +1 -1
- package/dist/{chunk-QB2KMV6S.js → chunk-J2FACXYI.js} +3 -3
- package/dist/{chunk-UCHJCUYI.js → chunk-KKJEEKL2.js} +33 -7
- package/dist/chunk-KKJEEKL2.js.map +1 -0
- package/dist/{chunk-7OXTZJR4.js → chunk-KMCGX76Y.js} +2 -2
- package/dist/{chunk-KFD4O7VA.js → chunk-NKMVICB5.js} +2 -2
- package/dist/{chunk-OHDPGIJ3.js → chunk-OFLMG6RN.js} +3 -3
- package/dist/chunk-OFLMG6RN.js.map +1 -0
- package/dist/{chunk-XJXCTGDR.js → chunk-P6GDMZK4.js} +3 -3
- package/dist/{chunk-FJRHZA3C.js → chunk-PO6FCAIS.js} +3 -3
- package/dist/{chunk-2CFVV2NZ.js → chunk-PWLZFGS3.js} +3 -3
- package/dist/{chunk-J4JULXUG.js → chunk-QJIB36DM.js} +3 -3
- package/dist/chunk-QJIB36DM.js.map +1 -0
- package/dist/{chunk-OLLZFNO6.js → chunk-R7FKGFW6.js} +2 -2
- package/dist/{chunk-GQDUHZE3.js → chunk-RWWRTURA.js} +3 -3
- package/dist/{chunk-NKTMMJYD.js → chunk-RYBY35QE.js} +6 -5
- package/dist/chunk-RYBY35QE.js.map +1 -0
- package/dist/{chunk-UHLRXI6J.js → chunk-S7F5VKWU.js} +2 -2
- package/dist/chunk-S7F5VKWU.js.map +1 -0
- package/dist/{chunk-YK5QI57J.js → chunk-T5W3FDSF.js} +3 -3
- package/dist/chunk-T5W3FDSF.js.map +1 -0
- package/dist/{chunk-YD6IZ2C5.js → chunk-TCXKZDMR.js} +2 -2
- package/dist/{chunk-E2VBUWJ4.js → chunk-WGPB3QQU.js} +3 -3
- package/dist/{chunk-XEJMFFIM.js → chunk-XPCU4KUY.js} +3 -3
- package/dist/{chunk-XEJMFFIM.js.map → chunk-XPCU4KUY.js.map} +1 -1
- package/dist/{chunk-RZSZQMSE.js → chunk-YRYZUYY7.js} +2 -2
- package/dist/{chunk-7AJN2TIS.js → chunk-ZOTAAYO5.js} +12 -2
- package/dist/chunk-ZOTAAYO5.js.map +1 -0
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert.js +2 -2
- package/dist/components/app-ui.d.ts +28 -12
- package/dist/components/app-ui.js +5 -4
- package/dist/components/blocks.d.ts +28 -2
- package/dist/components/blocks.js +3 -3
- package/dist/components/button.js +3 -3
- package/dist/components/changelog.js +4 -4
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +3 -3
- package/dist/components/date-input.js +3 -3
- package/dist/components/dialog.d.ts +15 -0
- package/dist/components/dialog.js +3 -2
- package/dist/components/estimator.d.ts +1 -1
- package/dist/components/estimator.js +5 -5
- package/dist/components/fieldset.js +2 -2
- package/dist/components/grid.js +2 -2
- package/dist/components/help.js +2 -2
- package/dist/components/icon.js +2 -2
- package/dist/components/journey.d.ts +15 -1
- package/dist/components/journey.js +3 -3
- package/dist/components/layout.js +2 -2
- package/dist/components/link.js +3 -3
- package/dist/components/list.js +2 -2
- package/dist/components/marketing.d.ts +1 -1
- package/dist/components/marketing.js +3 -3
- package/dist/components/media.js +2 -2
- package/dist/components/navigation.js +3 -3
- package/dist/components/organisms.d.ts +1 -1
- package/dist/components/organisms.js +3 -3
- package/dist/components/page.js +2 -2
- package/dist/components/price.js +2 -2
- package/dist/components/progress.js +2 -2
- package/dist/components/property.d.ts +1 -1
- package/dist/components/property.js +3 -3
- package/dist/components/radio-group.js +3 -3
- package/dist/components/scene.d.ts +1 -1
- package/dist/components/scene.js +2 -2
- package/dist/components/scrubber.js +2 -2
- package/dist/components/select.js +3 -3
- package/dist/components/selling.d.ts +2 -0
- package/dist/components/selling.js +2 -2
- package/dist/components/site.d.ts +1 -1
- package/dist/components/site.js +7 -7
- package/dist/components/summary-list.js +2 -2
- package/dist/components/table.d.ts +94 -2
- package/dist/components/table.js +4 -2
- package/dist/components/text-input.js +3 -3
- package/dist/components/textarea.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -39
- package/dist/standalone/atomic-ui.js +3134 -0
- package/dist/standalone/atomic-ui.js.map +7 -0
- package/dist/standalone/index.html +174 -0
- package/package.json +18 -6
- package/scripts/copy-to-product.mjs +52 -0
- package/specimen/index.html +174 -0
- package/dist/chunk-3IQ73WNW.js.map +0 -1
- package/dist/chunk-7AJN2TIS.js.map +0 -1
- package/dist/chunk-7XEPNEVQ.js.map +0 -1
- package/dist/chunk-D6C7XEY4.js.map +0 -1
- package/dist/chunk-E3XJK7MY.js.map +0 -1
- package/dist/chunk-EDSZI227.js.map +0 -1
- package/dist/chunk-HYPPG4NF.js.map +0 -1
- package/dist/chunk-J4JULXUG.js.map +0 -1
- package/dist/chunk-MVEFM5QI.js.map +0 -1
- package/dist/chunk-NKTMMJYD.js.map +0 -1
- package/dist/chunk-OHDPGIJ3.js.map +0 -1
- package/dist/chunk-UCHJCUYI.js.map +0 -1
- package/dist/chunk-UHLRXI6J.js.map +0 -1
- package/dist/chunk-WDDWWCHN.js +0 -104
- package/dist/chunk-WDDWWCHN.js.map +0 -1
- package/dist/chunk-WFKSOM6O.js.map +0 -1
- package/dist/chunk-YK5QI57J.js.map +0 -1
- /package/dist/{chunk-7BSZPUE3.js.map → chunk-3RE4H2XO.js.map} +0 -0
- /package/dist/{chunk-R67PDFKE.js.map → chunk-46BYUQ5A.js.map} +0 -0
- /package/dist/{chunk-NCASAXQT.js.map → chunk-4OYHT4BN.js.map} +0 -0
- /package/dist/{chunk-TGT7J4EG.js.map → chunk-5QSTXIPG.js.map} +0 -0
- /package/dist/{chunk-26O27BQS.js.map → chunk-APJ5JGRW.js.map} +0 -0
- /package/dist/{chunk-FFCIY7NM.js.map → chunk-CUUBAETM.js.map} +0 -0
- /package/dist/{chunk-OMJMUFOW.js.map → chunk-DAH7RLW3.js.map} +0 -0
- /package/dist/{chunk-6YYAOKNI.js.map → chunk-DJEZW7AC.js.map} +0 -0
- /package/dist/{chunk-OB7WULFK.js.map → chunk-IOBSIAHB.js.map} +0 -0
- /package/dist/{chunk-QB2KMV6S.js.map → chunk-J2FACXYI.js.map} +0 -0
- /package/dist/{chunk-7OXTZJR4.js.map → chunk-KMCGX76Y.js.map} +0 -0
- /package/dist/{chunk-KFD4O7VA.js.map → chunk-NKMVICB5.js.map} +0 -0
- /package/dist/{chunk-XJXCTGDR.js.map → chunk-P6GDMZK4.js.map} +0 -0
- /package/dist/{chunk-FJRHZA3C.js.map → chunk-PO6FCAIS.js.map} +0 -0
- /package/dist/{chunk-2CFVV2NZ.js.map → chunk-PWLZFGS3.js.map} +0 -0
- /package/dist/{chunk-OLLZFNO6.js.map → chunk-R7FKGFW6.js.map} +0 -0
- /package/dist/{chunk-GQDUHZE3.js.map → chunk-RWWRTURA.js.map} +0 -0
- /package/dist/{chunk-YD6IZ2C5.js.map → chunk-TCXKZDMR.js.map} +0 -0
- /package/dist/{chunk-E2VBUWJ4.js.map → chunk-WGPB3QQU.js.map} +0 -0
- /package/dist/{chunk-RZSZQMSE.js.map → chunk-YRYZUYY7.js.map} +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en-GB">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Impkt components in a plain HTML product</title>
|
|
7
|
+
<!--
|
|
8
|
+
A plain HTML product needs two files beside this page: theme.css from
|
|
9
|
+
@atomic-ui/theme (pnpm theme:copy) and atomic-ui.js from @atomic-ui/ui
|
|
10
|
+
(pnpm ui:copy). The theme gives the page the Impkt look and gives the
|
|
11
|
+
components their tokens, in light and in dark. The script defines every
|
|
12
|
+
element when it loads.
|
|
13
|
+
-->
|
|
14
|
+
<link rel="stylesheet" href="theme.css">
|
|
15
|
+
<script type="module" src="atomic-ui.js"></script>
|
|
16
|
+
<style>
|
|
17
|
+
main { max-width: 1040px; margin: 0 auto; padding: var(--ik-space-6) var(--ik-gutter) var(--ik-space-12); }
|
|
18
|
+
section { margin-bottom: var(--ik-space-8); }
|
|
19
|
+
.lede { color: var(--ik-ink-muted); max-width: 60ch; margin: 0 0 var(--ik-space-6); }
|
|
20
|
+
.toolbar { display: flex; flex-wrap: wrap; gap: var(--ik-space-3); align-items: flex-end; margin-bottom: var(--ik-space-4); }
|
|
21
|
+
.toolbar impkt-text-input { flex: 1 1 16rem; margin: 0; }
|
|
22
|
+
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ik-space-4); }
|
|
23
|
+
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
|
|
24
|
+
.row { display: flex; flex-wrap: wrap; gap: var(--ik-space-2); align-items: center; }
|
|
25
|
+
</style>
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<a class="ik-skip" href="#main">Skip to the content</a>
|
|
29
|
+
<header class="ik-header">
|
|
30
|
+
<a class="ik-brand" href="./"><span class="ik-mark" aria-hidden="true"></span><span><b>Impkt</b> <span class="ik-product">Components</span></span></a>
|
|
31
|
+
<div class="row">
|
|
32
|
+
<label for="theme" class="ik-sr-only">Theme</label>
|
|
33
|
+
<select id="theme" style="min-height:44px;padding:4px 10px;font-size:16px">
|
|
34
|
+
<option value="">Auto</option>
|
|
35
|
+
<option value="light">Light</option>
|
|
36
|
+
<option value="dark">Dark</option>
|
|
37
|
+
</select>
|
|
38
|
+
<impkt-menu id="account" label="Account" edge="end" items='[{"text":"Profile","href":"#profile","icon":"user"},{"text":"Settings","value":"settings"},{"text":"Sign out","value":"sign-out","tone":"danger"}]'></impkt-menu>
|
|
39
|
+
</div>
|
|
40
|
+
</header>
|
|
41
|
+
|
|
42
|
+
<main id="main">
|
|
43
|
+
<h1>Components for the products</h1>
|
|
44
|
+
<p class="lede">The parts the apps and the AI tools use most, drawn by the Impkt components on a page styled by the product theme. Change the theme at the top to see the dark version, and narrow the window to see the phone layout.</p>
|
|
45
|
+
|
|
46
|
+
<impkt-error-summary id="problems"></impkt-error-summary>
|
|
47
|
+
|
|
48
|
+
<section aria-labelledby="h-cases">
|
|
49
|
+
<h2 id="h-cases">A table with search, sorting, selection and pages</h2>
|
|
50
|
+
<div class="card">
|
|
51
|
+
<div class="toolbar">
|
|
52
|
+
<impkt-text-input id="search" type="search" label="Search cases" description="By name or reference"></impkt-text-input>
|
|
53
|
+
<impkt-menu id="bulk" label="With selected" items='[{"text":"Export","value":"export","icon":"download"},{"text":"Archive","value":"archive"}]'></impkt-menu>
|
|
54
|
+
</div>
|
|
55
|
+
<impkt-table id="cases" caption="Open cases" stack selectable sort-key="opened" sort-direction="descending" empty-text="No cases match your search."
|
|
56
|
+
columns='[{"key":"ref","label":"Reference","sortable":true},{"key":"name","label":"Client","sortable":true},{"key":"status","label":"Status"},{"key":"opened","label":"Opened","sortable":true},{"key":"fee","label":"Fee","numeric":true,"sortable":true}]'
|
|
57
|
+
rows='[{"id":"c1","ref":"HB-1042","name":"Amira Hassan","status":"In progress","opened":"2026-11-02","fee":"£1,250"},{"id":"c2","ref":"HB-1043","name":"Tom Price","status":"Waiting","opened":"2026-11-09","fee":"£480"},{"id":"c3","ref":"HB-1044","name":"Sofia Rossi","status":"Done","opened":"2026-10-21","fee":"£12,400"},{"id":"c4","ref":"HB-1045","name":"Ben Okafor","status":"In progress","opened":"2026-11-15","fee":"£990"}]'>
|
|
58
|
+
<impkt-badge slot="cell:c1:status" tone="info">In progress</impkt-badge>
|
|
59
|
+
<impkt-badge slot="cell:c2:status" tone="warning">Waiting</impkt-badge>
|
|
60
|
+
<impkt-badge slot="cell:c3:status" tone="success">Done</impkt-badge>
|
|
61
|
+
<impkt-badge slot="cell:c4:status" tone="info">In progress</impkt-badge>
|
|
62
|
+
</impkt-table>
|
|
63
|
+
<impkt-pagination id="pages" page="2" pages="9"></impkt-pagination>
|
|
64
|
+
</div>
|
|
65
|
+
<impkt-empty-state framed heading="No documents yet" lead="Documents you upload for this case appear here." heading-level="3" icon="document"><impkt-button slot="actions" variant="secondary" href="#upload">Upload a document</impkt-button></impkt-empty-state>
|
|
66
|
+
</section>
|
|
67
|
+
|
|
68
|
+
<section aria-labelledby="h-tabs">
|
|
69
|
+
<h2 id="h-tabs">Tabs</h2>
|
|
70
|
+
<impkt-tabs id="tabs" label="Case" two-rows selected="files"
|
|
71
|
+
items='[{"id":"summary","label":"Summary","body":"The case at a glance."},{"id":"tasks","label":"Tasks","body":""},{"id":"files","label":"Files","body":""},{"id":"messages","label":"Messages","body":"No messages yet."},{"id":"payments","label":"Payments","body":"Nothing to pay."},{"id":"history","label":"History","body":"Opened on 2 November 2026."}]'>
|
|
72
|
+
<div slot="tasks">
|
|
73
|
+
<impkt-task-list heading="Your import" heading-level="3"
|
|
74
|
+
items='[{"id":"t1","title":"Vehicle details","href":"#vehicle","status":"done"},{"id":"t2","title":"Proof of ownership","href":"#upload","status":"in-progress","hint":"Takes about five minutes"},{"id":"t3","title":"Payment","href":"#pay","status":"not-started"},{"id":"t4","title":"Registration","status":"cannot-start"}]'></impkt-task-list>
|
|
75
|
+
</div>
|
|
76
|
+
<div slot="files">
|
|
77
|
+
<impkt-document-link href="#v5c" label="V5C registration certificate" file-type="PDF" byte-size="245760"></impkt-document-link>
|
|
78
|
+
<impkt-file-upload id="upload" label="Add proof of ownership" description="PDF, JPG or PNG, up to 10 MB each" many-files></impkt-file-upload>
|
|
79
|
+
</div>
|
|
80
|
+
</impkt-tabs>
|
|
81
|
+
</section>
|
|
82
|
+
|
|
83
|
+
<section aria-labelledby="h-summary" class="grid2">
|
|
84
|
+
<div class="card">
|
|
85
|
+
<h2 id="h-summary">Summary list</h2>
|
|
86
|
+
<impkt-summary-list rows='[{"key":"Vehicle","value":"2019 Toyota Land Cruiser","changeHref":"#vehicle"},{"key":"Port","value":"Southampton","changeHref":"#port"},{"key":"Arriving","value":"12 December 2026"}]'></impkt-summary-list>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="card">
|
|
89
|
+
<h2>Badges, steps and progress</h2>
|
|
90
|
+
<div class="row">
|
|
91
|
+
<impkt-badge>Draft</impkt-badge><impkt-badge tone="brand">New</impkt-badge><impkt-badge tone="success" icon="check">Paid</impkt-badge><impkt-badge tone="warning">Due soon</impkt-badge><impkt-badge tone="danger">Overdue</impkt-badge><impkt-badge tone="info">Shipped</impkt-badge>
|
|
92
|
+
</div>
|
|
93
|
+
<impkt-progress steps='[{"id":"a","label":"Details"},{"id":"b","label":"Documents"},{"id":"c","label":"Payment"}]' current="b"></impkt-progress>
|
|
94
|
+
<impkt-steps orientation="vertical" heading-level="3" items='[{"heading":"Shipped","text":"Left Yokohama on 3 November.","meta":"Done"},{"heading":"At sea","text":"About five weeks."},{"heading":"Customs","text":"We clear it for you."}]'></impkt-steps>
|
|
95
|
+
</div>
|
|
96
|
+
</section>
|
|
97
|
+
|
|
98
|
+
<section aria-labelledby="h-form">
|
|
99
|
+
<h2 id="h-form">A form</h2>
|
|
100
|
+
<form class="card" id="form" novalidate>
|
|
101
|
+
<impkt-text-input id="name" name="name" label="Full name" required autocomplete="name"></impkt-text-input>
|
|
102
|
+
<impkt-date-input id="arrival" name="arrival" label="Arrival date" description="For example, 12 12 2026"></impkt-date-input>
|
|
103
|
+
<impkt-money-input id="value" name="value" label="Value of the vehicle" lowest="1000"></impkt-money-input>
|
|
104
|
+
<impkt-select name="port" label="Port" options='[{"value":"sou","label":"Southampton"},{"value":"til","label":"Tilbury"}]'></impkt-select>
|
|
105
|
+
<impkt-textarea name="notes" label="Anything else we should know"></impkt-textarea>
|
|
106
|
+
<impkt-checkbox name="agree" label="I confirm these details are correct"></impkt-checkbox>
|
|
107
|
+
<div class="row">
|
|
108
|
+
<impkt-button id="submit" variant="primary" type="submit">Save and continue</impkt-button>
|
|
109
|
+
<impkt-button id="open-dialog" variant="secondary">Cancel the import</impkt-button>
|
|
110
|
+
<impkt-button id="open-drawer" variant="secondary">Filters</impkt-button>
|
|
111
|
+
<impkt-button id="show-toast" variant="secondary">Save a draft</impkt-button>
|
|
112
|
+
</div>
|
|
113
|
+
</form>
|
|
114
|
+
</section>
|
|
115
|
+
|
|
116
|
+
<section aria-labelledby="h-alerts">
|
|
117
|
+
<h2 id="h-alerts">Alerts</h2>
|
|
118
|
+
<impkt-alert tone="info" heading="Your vehicle has shipped">It left Yokohama on 3 November.</impkt-alert>
|
|
119
|
+
<impkt-alert tone="success" heading="Payment received">Thank you. We have sent a receipt.</impkt-alert>
|
|
120
|
+
<impkt-alert tone="warning" heading="A document is missing">Upload proof of ownership before 1 December.</impkt-alert>
|
|
121
|
+
<impkt-alert tone="danger" heading="Payment failed">Try another card.</impkt-alert>
|
|
122
|
+
</section>
|
|
123
|
+
</main>
|
|
124
|
+
|
|
125
|
+
<impkt-dialog id="dialog" heading="Cancel this import?" phone-full-screen>
|
|
126
|
+
<p>We keep your details for 30 days, so you can start again.</p>
|
|
127
|
+
<div class="row">
|
|
128
|
+
<impkt-button id="dialog-keep" variant="primary">Keep the import</impkt-button>
|
|
129
|
+
<impkt-button id="dialog-cancel" variant="secondary">Cancel it</impkt-button>
|
|
130
|
+
</div>
|
|
131
|
+
</impkt-dialog>
|
|
132
|
+
|
|
133
|
+
<impkt-drawer id="drawer" heading="Filters">
|
|
134
|
+
<impkt-checkbox-group label="Status" options='[{"value":"open","label":"Open"},{"value":"waiting","label":"Waiting"},{"value":"done","label":"Done"}]'></impkt-checkbox-group>
|
|
135
|
+
<impkt-button slot="footer" id="drawer-apply" variant="primary">Show cases</impkt-button>
|
|
136
|
+
</impkt-drawer>
|
|
137
|
+
|
|
138
|
+
<impkt-toast id="toast" tone="success" message="Draft saved" action-text="Undo"></impkt-toast>
|
|
139
|
+
|
|
140
|
+
<script type="module">
|
|
141
|
+
const $ = (id) => document.getElementById(id);
|
|
142
|
+
const sel = $('theme');
|
|
143
|
+
sel.addEventListener('change', () => {
|
|
144
|
+
if (sel.value) document.documentElement.dataset.theme = sel.value;
|
|
145
|
+
else delete document.documentElement.dataset.theme;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// Search filters the table. With nothing left, the table says so.
|
|
149
|
+
const table = $('cases');
|
|
150
|
+
const all = table.rows;
|
|
151
|
+
$('search').addEventListener('impkt-change', (e) => {
|
|
152
|
+
const q = e.detail.value.trim().toLowerCase();
|
|
153
|
+
table.rows = all.filter((r) => !q || `${r.ref} ${r.name}`.toLowerCase().includes(q));
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
$('open-dialog').addEventListener('click', () => { $('dialog').open = true; });
|
|
157
|
+
$('dialog-keep').addEventListener('click', () => { $('dialog').open = false; });
|
|
158
|
+
$('dialog-cancel').addEventListener('click', () => { $('dialog').open = false; });
|
|
159
|
+
$('open-drawer').addEventListener('click', () => { $('drawer').open = true; });
|
|
160
|
+
$('drawer-apply').addEventListener('click', () => { $('drawer').open = false; });
|
|
161
|
+
$('show-toast').addEventListener('click', () => { $('toast').open = true; });
|
|
162
|
+
|
|
163
|
+
// Saving with a field empty lists the mistakes at the top, each linking to its field.
|
|
164
|
+
$('form').addEventListener('submit', (e) => {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
const items = [];
|
|
167
|
+
const name = $('name');
|
|
168
|
+
name.error = name.value ? '' : 'Enter your full name';
|
|
169
|
+
if (name.error) items.push({ id: 'name', text: name.error, href: '#name' });
|
|
170
|
+
$('problems').items = items;
|
|
171
|
+
});
|
|
172
|
+
</script>
|
|
173
|
+
</body>
|
|
174
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomic-ui/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The Impkt component library: standard custom elements, styled only from design tokens, built to WCAG 2.2 AA.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,11 +18,20 @@
|
|
|
18
18
|
"./components/*": {
|
|
19
19
|
"types": "./dist/components/*.d.ts",
|
|
20
20
|
"import": "./dist/components/*.js"
|
|
21
|
-
}
|
|
21
|
+
},
|
|
22
|
+
"./standalone": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/standalone/atomic-ui.js"
|
|
25
|
+
},
|
|
26
|
+
"./custom-elements.json": "./custom-elements.json",
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"bin": {
|
|
30
|
+
"impkt-ui-copy": "./scripts/copy-to-product.mjs"
|
|
22
31
|
},
|
|
23
32
|
"dependencies": {
|
|
24
33
|
"lit": "^3.3.3",
|
|
25
|
-
"@atomic-ui/design-tokens": "^0.
|
|
34
|
+
"@atomic-ui/design-tokens": "^0.3.0"
|
|
26
35
|
},
|
|
27
36
|
"devDependencies": {
|
|
28
37
|
"@types/node": "^20.14.0",
|
|
@@ -38,17 +47,20 @@
|
|
|
38
47
|
"files": [
|
|
39
48
|
"dist",
|
|
40
49
|
"README.md",
|
|
41
|
-
"custom-elements.json"
|
|
50
|
+
"custom-elements.json",
|
|
51
|
+
"scripts/copy-to-product.mjs",
|
|
52
|
+
"specimen"
|
|
42
53
|
],
|
|
43
54
|
"publishConfig": {
|
|
44
55
|
"registry": "https://registry.npmjs.org",
|
|
45
56
|
"access": "public"
|
|
46
57
|
},
|
|
47
58
|
"scripts": {
|
|
48
|
-
"build": "tsc -p tsconfig.json",
|
|
59
|
+
"build": "custom-elements-manifest analyze && tsc -p tsconfig.json",
|
|
49
60
|
"typecheck": "tsc -p tsconfig.json",
|
|
50
61
|
"test": "vitest run",
|
|
51
62
|
"test:browser": "playwright test",
|
|
52
|
-
"manifest": "custom-elements-manifest analyze"
|
|
63
|
+
"manifest": "custom-elements-manifest analyze",
|
|
64
|
+
"standalone": "node scripts/standalone.mjs"
|
|
53
65
|
}
|
|
54
66
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copy the standalone components file into a plain HTML product.
|
|
4
|
+
*
|
|
5
|
+
* pnpm ui:copy ../impkt-tender
|
|
6
|
+
* node packages/ui/scripts/copy-to-product.mjs /path/to/product [public folder]
|
|
7
|
+
*
|
|
8
|
+
* Copies dist/standalone/atomic-ui.js and its source map into the product's public
|
|
9
|
+
* folder, which is `public` unless a second argument names another. The first line
|
|
10
|
+
* of the copy names the version and the design system's commit, so anyone can see
|
|
11
|
+
* which components a product carries. It replaces the build's own first line rather
|
|
12
|
+
* than adding one, so the source map still lines up. Build first with `pnpm build`.
|
|
13
|
+
*/
|
|
14
|
+
import { execFileSync } from 'node:child_process';
|
|
15
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
17
|
+
import { fileURLToPath } from 'node:url';
|
|
18
|
+
|
|
19
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
20
|
+
const [product, folder = 'public'] = process.argv.slice(2);
|
|
21
|
+
if (!product) {
|
|
22
|
+
console.error('Use: copy-to-product.mjs <product folder> [public folder]');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const built = join(root, 'dist', 'standalone', 'atomic-ui.js');
|
|
27
|
+
if (!existsSync(built)) {
|
|
28
|
+
console.error('There is no dist/standalone/atomic-ui.js. Run pnpm build first.');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const { version } = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
|
|
33
|
+
// The commit is the design system's own, so it is read only in a checkout of it, not in an installed package.
|
|
34
|
+
const inRepository = basename(dirname(root)) === 'packages' && existsSync(join(root, '..', '..', 'pnpm-workspace.yaml'));
|
|
35
|
+
let commit = inRepository ? 'uncommitted' : 'as published';
|
|
36
|
+
if (inRepository) try {
|
|
37
|
+
commit = execFileSync('git', ['rev-parse', '--short', 'HEAD'], { cwd: root, encoding: 'utf8' }).trim();
|
|
38
|
+
const dirty = execFileSync('git', ['status', '--porcelain', '--', '.'], { cwd: root, encoding: 'utf8' }).trim();
|
|
39
|
+
if (dirty) commit += ' with uncommitted changes';
|
|
40
|
+
} catch {
|
|
41
|
+
// git is not installed: the version is enough.
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// pnpm runs a root script from the repository root, so a relative path is read from where it was typed.
|
|
45
|
+
const target = resolve(process.env.INIT_CWD ?? process.cwd(), product, folder);
|
|
46
|
+
if (!existsSync(target)) mkdirSync(target, { recursive: true });
|
|
47
|
+
const source = readFileSync(built, 'utf8');
|
|
48
|
+
const rest = source.slice(source.indexOf('\n') + 1);
|
|
49
|
+
const first = `/* Copied from matthill8286/impkt-design-system, @atomic-ui/ui version ${version}, commit ${commit}. To update, build the design system and run pnpm ui:copy again. */\n`;
|
|
50
|
+
writeFileSync(join(target, 'atomic-ui.js'), first + rest);
|
|
51
|
+
writeFileSync(join(target, 'atomic-ui.js.map'), readFileSync(`${built}.map`));
|
|
52
|
+
console.log(`copied @atomic-ui/ui ${version} (${commit}) to ${join(target, 'atomic-ui.js')} and its source map`);
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en-GB">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Impkt components in a plain HTML product</title>
|
|
7
|
+
<!--
|
|
8
|
+
A plain HTML product needs two files beside this page: theme.css from
|
|
9
|
+
@atomic-ui/theme (pnpm theme:copy) and atomic-ui.js from @atomic-ui/ui
|
|
10
|
+
(pnpm ui:copy). The theme gives the page the Impkt look and gives the
|
|
11
|
+
components their tokens, in light and in dark. The script defines every
|
|
12
|
+
element when it loads.
|
|
13
|
+
-->
|
|
14
|
+
<link rel="stylesheet" href="theme.css">
|
|
15
|
+
<script type="module" src="atomic-ui.js"></script>
|
|
16
|
+
<style>
|
|
17
|
+
main { max-width: 1040px; margin: 0 auto; padding: var(--ik-space-6) var(--ik-gutter) var(--ik-space-12); }
|
|
18
|
+
section { margin-bottom: var(--ik-space-8); }
|
|
19
|
+
.lede { color: var(--ik-ink-muted); max-width: 60ch; margin: 0 0 var(--ik-space-6); }
|
|
20
|
+
.toolbar { display: flex; flex-wrap: wrap; gap: var(--ik-space-3); align-items: flex-end; margin-bottom: var(--ik-space-4); }
|
|
21
|
+
.toolbar impkt-text-input { flex: 1 1 16rem; margin: 0; }
|
|
22
|
+
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ik-space-4); }
|
|
23
|
+
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
|
|
24
|
+
.row { display: flex; flex-wrap: wrap; gap: var(--ik-space-2); align-items: center; }
|
|
25
|
+
</style>
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<a class="ik-skip" href="#main">Skip to the content</a>
|
|
29
|
+
<header class="ik-header">
|
|
30
|
+
<a class="ik-brand" href="./"><span class="ik-mark" aria-hidden="true"></span><span><b>Impkt</b> <span class="ik-product">Components</span></span></a>
|
|
31
|
+
<div class="row">
|
|
32
|
+
<label for="theme" class="ik-sr-only">Theme</label>
|
|
33
|
+
<select id="theme" style="min-height:44px;padding:4px 10px;font-size:16px">
|
|
34
|
+
<option value="">Auto</option>
|
|
35
|
+
<option value="light">Light</option>
|
|
36
|
+
<option value="dark">Dark</option>
|
|
37
|
+
</select>
|
|
38
|
+
<impkt-menu id="account" label="Account" edge="end" items='[{"text":"Profile","href":"#profile","icon":"user"},{"text":"Settings","value":"settings"},{"text":"Sign out","value":"sign-out","tone":"danger"}]'></impkt-menu>
|
|
39
|
+
</div>
|
|
40
|
+
</header>
|
|
41
|
+
|
|
42
|
+
<main id="main">
|
|
43
|
+
<h1>Components for the products</h1>
|
|
44
|
+
<p class="lede">The parts the apps and the AI tools use most, drawn by the Impkt components on a page styled by the product theme. Change the theme at the top to see the dark version, and narrow the window to see the phone layout.</p>
|
|
45
|
+
|
|
46
|
+
<impkt-error-summary id="problems"></impkt-error-summary>
|
|
47
|
+
|
|
48
|
+
<section aria-labelledby="h-cases">
|
|
49
|
+
<h2 id="h-cases">A table with search, sorting, selection and pages</h2>
|
|
50
|
+
<div class="card">
|
|
51
|
+
<div class="toolbar">
|
|
52
|
+
<impkt-text-input id="search" type="search" label="Search cases" description="By name or reference"></impkt-text-input>
|
|
53
|
+
<impkt-menu id="bulk" label="With selected" items='[{"text":"Export","value":"export","icon":"download"},{"text":"Archive","value":"archive"}]'></impkt-menu>
|
|
54
|
+
</div>
|
|
55
|
+
<impkt-table id="cases" caption="Open cases" stack selectable sort-key="opened" sort-direction="descending" empty-text="No cases match your search."
|
|
56
|
+
columns='[{"key":"ref","label":"Reference","sortable":true},{"key":"name","label":"Client","sortable":true},{"key":"status","label":"Status"},{"key":"opened","label":"Opened","sortable":true},{"key":"fee","label":"Fee","numeric":true,"sortable":true}]'
|
|
57
|
+
rows='[{"id":"c1","ref":"HB-1042","name":"Amira Hassan","status":"In progress","opened":"2026-11-02","fee":"£1,250"},{"id":"c2","ref":"HB-1043","name":"Tom Price","status":"Waiting","opened":"2026-11-09","fee":"£480"},{"id":"c3","ref":"HB-1044","name":"Sofia Rossi","status":"Done","opened":"2026-10-21","fee":"£12,400"},{"id":"c4","ref":"HB-1045","name":"Ben Okafor","status":"In progress","opened":"2026-11-15","fee":"£990"}]'>
|
|
58
|
+
<impkt-badge slot="cell:c1:status" tone="info">In progress</impkt-badge>
|
|
59
|
+
<impkt-badge slot="cell:c2:status" tone="warning">Waiting</impkt-badge>
|
|
60
|
+
<impkt-badge slot="cell:c3:status" tone="success">Done</impkt-badge>
|
|
61
|
+
<impkt-badge slot="cell:c4:status" tone="info">In progress</impkt-badge>
|
|
62
|
+
</impkt-table>
|
|
63
|
+
<impkt-pagination id="pages" page="2" pages="9"></impkt-pagination>
|
|
64
|
+
</div>
|
|
65
|
+
<impkt-empty-state framed heading="No documents yet" lead="Documents you upload for this case appear here." heading-level="3" icon="document"><impkt-button slot="actions" variant="secondary" href="#upload">Upload a document</impkt-button></impkt-empty-state>
|
|
66
|
+
</section>
|
|
67
|
+
|
|
68
|
+
<section aria-labelledby="h-tabs">
|
|
69
|
+
<h2 id="h-tabs">Tabs</h2>
|
|
70
|
+
<impkt-tabs id="tabs" label="Case" two-rows selected="files"
|
|
71
|
+
items='[{"id":"summary","label":"Summary","body":"The case at a glance."},{"id":"tasks","label":"Tasks","body":""},{"id":"files","label":"Files","body":""},{"id":"messages","label":"Messages","body":"No messages yet."},{"id":"payments","label":"Payments","body":"Nothing to pay."},{"id":"history","label":"History","body":"Opened on 2 November 2026."}]'>
|
|
72
|
+
<div slot="tasks">
|
|
73
|
+
<impkt-task-list heading="Your import" heading-level="3"
|
|
74
|
+
items='[{"id":"t1","title":"Vehicle details","href":"#vehicle","status":"done"},{"id":"t2","title":"Proof of ownership","href":"#upload","status":"in-progress","hint":"Takes about five minutes"},{"id":"t3","title":"Payment","href":"#pay","status":"not-started"},{"id":"t4","title":"Registration","status":"cannot-start"}]'></impkt-task-list>
|
|
75
|
+
</div>
|
|
76
|
+
<div slot="files">
|
|
77
|
+
<impkt-document-link href="#v5c" label="V5C registration certificate" file-type="PDF" byte-size="245760"></impkt-document-link>
|
|
78
|
+
<impkt-file-upload id="upload" label="Add proof of ownership" description="PDF, JPG or PNG, up to 10 MB each" many-files></impkt-file-upload>
|
|
79
|
+
</div>
|
|
80
|
+
</impkt-tabs>
|
|
81
|
+
</section>
|
|
82
|
+
|
|
83
|
+
<section aria-labelledby="h-summary" class="grid2">
|
|
84
|
+
<div class="card">
|
|
85
|
+
<h2 id="h-summary">Summary list</h2>
|
|
86
|
+
<impkt-summary-list rows='[{"key":"Vehicle","value":"2019 Toyota Land Cruiser","changeHref":"#vehicle"},{"key":"Port","value":"Southampton","changeHref":"#port"},{"key":"Arriving","value":"12 December 2026"}]'></impkt-summary-list>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="card">
|
|
89
|
+
<h2>Badges, steps and progress</h2>
|
|
90
|
+
<div class="row">
|
|
91
|
+
<impkt-badge>Draft</impkt-badge><impkt-badge tone="brand">New</impkt-badge><impkt-badge tone="success" icon="check">Paid</impkt-badge><impkt-badge tone="warning">Due soon</impkt-badge><impkt-badge tone="danger">Overdue</impkt-badge><impkt-badge tone="info">Shipped</impkt-badge>
|
|
92
|
+
</div>
|
|
93
|
+
<impkt-progress steps='[{"id":"a","label":"Details"},{"id":"b","label":"Documents"},{"id":"c","label":"Payment"}]' current="b"></impkt-progress>
|
|
94
|
+
<impkt-steps orientation="vertical" heading-level="3" items='[{"heading":"Shipped","text":"Left Yokohama on 3 November.","meta":"Done"},{"heading":"At sea","text":"About five weeks."},{"heading":"Customs","text":"We clear it for you."}]'></impkt-steps>
|
|
95
|
+
</div>
|
|
96
|
+
</section>
|
|
97
|
+
|
|
98
|
+
<section aria-labelledby="h-form">
|
|
99
|
+
<h2 id="h-form">A form</h2>
|
|
100
|
+
<form class="card" id="form" novalidate>
|
|
101
|
+
<impkt-text-input id="name" name="name" label="Full name" required autocomplete="name"></impkt-text-input>
|
|
102
|
+
<impkt-date-input id="arrival" name="arrival" label="Arrival date" description="For example, 12 12 2026"></impkt-date-input>
|
|
103
|
+
<impkt-money-input id="value" name="value" label="Value of the vehicle" lowest="1000"></impkt-money-input>
|
|
104
|
+
<impkt-select name="port" label="Port" options='[{"value":"sou","label":"Southampton"},{"value":"til","label":"Tilbury"}]'></impkt-select>
|
|
105
|
+
<impkt-textarea name="notes" label="Anything else we should know"></impkt-textarea>
|
|
106
|
+
<impkt-checkbox name="agree" label="I confirm these details are correct"></impkt-checkbox>
|
|
107
|
+
<div class="row">
|
|
108
|
+
<impkt-button id="submit" variant="primary" type="submit">Save and continue</impkt-button>
|
|
109
|
+
<impkt-button id="open-dialog" variant="secondary">Cancel the import</impkt-button>
|
|
110
|
+
<impkt-button id="open-drawer" variant="secondary">Filters</impkt-button>
|
|
111
|
+
<impkt-button id="show-toast" variant="secondary">Save a draft</impkt-button>
|
|
112
|
+
</div>
|
|
113
|
+
</form>
|
|
114
|
+
</section>
|
|
115
|
+
|
|
116
|
+
<section aria-labelledby="h-alerts">
|
|
117
|
+
<h2 id="h-alerts">Alerts</h2>
|
|
118
|
+
<impkt-alert tone="info" heading="Your vehicle has shipped">It left Yokohama on 3 November.</impkt-alert>
|
|
119
|
+
<impkt-alert tone="success" heading="Payment received">Thank you. We have sent a receipt.</impkt-alert>
|
|
120
|
+
<impkt-alert tone="warning" heading="A document is missing">Upload proof of ownership before 1 December.</impkt-alert>
|
|
121
|
+
<impkt-alert tone="danger" heading="Payment failed">Try another card.</impkt-alert>
|
|
122
|
+
</section>
|
|
123
|
+
</main>
|
|
124
|
+
|
|
125
|
+
<impkt-dialog id="dialog" heading="Cancel this import?" phone-full-screen>
|
|
126
|
+
<p>We keep your details for 30 days, so you can start again.</p>
|
|
127
|
+
<div class="row">
|
|
128
|
+
<impkt-button id="dialog-keep" variant="primary">Keep the import</impkt-button>
|
|
129
|
+
<impkt-button id="dialog-cancel" variant="secondary">Cancel it</impkt-button>
|
|
130
|
+
</div>
|
|
131
|
+
</impkt-dialog>
|
|
132
|
+
|
|
133
|
+
<impkt-drawer id="drawer" heading="Filters">
|
|
134
|
+
<impkt-checkbox-group label="Status" options='[{"value":"open","label":"Open"},{"value":"waiting","label":"Waiting"},{"value":"done","label":"Done"}]'></impkt-checkbox-group>
|
|
135
|
+
<impkt-button slot="footer" id="drawer-apply" variant="primary">Show cases</impkt-button>
|
|
136
|
+
</impkt-drawer>
|
|
137
|
+
|
|
138
|
+
<impkt-toast id="toast" tone="success" message="Draft saved" action-text="Undo"></impkt-toast>
|
|
139
|
+
|
|
140
|
+
<script type="module">
|
|
141
|
+
const $ = (id) => document.getElementById(id);
|
|
142
|
+
const sel = $('theme');
|
|
143
|
+
sel.addEventListener('change', () => {
|
|
144
|
+
if (sel.value) document.documentElement.dataset.theme = sel.value;
|
|
145
|
+
else delete document.documentElement.dataset.theme;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// Search filters the table. With nothing left, the table says so.
|
|
149
|
+
const table = $('cases');
|
|
150
|
+
const all = table.rows;
|
|
151
|
+
$('search').addEventListener('impkt-change', (e) => {
|
|
152
|
+
const q = e.detail.value.trim().toLowerCase();
|
|
153
|
+
table.rows = all.filter((r) => !q || `${r.ref} ${r.name}`.toLowerCase().includes(q));
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
$('open-dialog').addEventListener('click', () => { $('dialog').open = true; });
|
|
157
|
+
$('dialog-keep').addEventListener('click', () => { $('dialog').open = false; });
|
|
158
|
+
$('dialog-cancel').addEventListener('click', () => { $('dialog').open = false; });
|
|
159
|
+
$('open-drawer').addEventListener('click', () => { $('drawer').open = true; });
|
|
160
|
+
$('drawer-apply').addEventListener('click', () => { $('drawer').open = false; });
|
|
161
|
+
$('show-toast').addEventListener('click', () => { $('toast').open = true; });
|
|
162
|
+
|
|
163
|
+
// Saving with a field empty lists the mistakes at the top, each linking to its field.
|
|
164
|
+
$('form').addEventListener('submit', (e) => {
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
const items = [];
|
|
167
|
+
const name = $('name');
|
|
168
|
+
name.error = name.value ? '' : 'Enter your full name';
|
|
169
|
+
if (name.error) items.push({ id: 'name', text: name.error, href: '#name' });
|
|
170
|
+
$('problems').items = items;
|
|
171
|
+
});
|
|
172
|
+
</script>
|
|
173
|
+
</body>
|
|
174
|
+
</html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/checkbox.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\n/**\n * A single checkbox — a consent, an opt-in, a confirmation.\n *\n * The label sits beside the box rather than above it, so this overrides the\n * base layout. The whole `<label>` is the hit area: a 20px box is legal under\n * 2.5.8 and still unkind, and the row costs nothing.\n\n *\n * @category form\n * @icon checkbox\n */\nexport class ImpktCheckbox extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n checked: { type: Boolean, reflect: true },\n };\n\n declare checked: boolean;\n\n constructor() {\n super();\n this.checked = false;\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n .row {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n cursor: pointer;\n }\n input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .text {\n font-size: ${fontSize('md')};\n }\n :host([invalid]) .row {\n color: ${t.dangerText};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <label class=\"row\" part=\"row\" for=${this.controlId}>\n <input\n type=\"checkbox\"\n id=${this.controlId}\n part=\"input\"\n name=${this.name || nothing}\n .checked=${this.checked}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => {\n this.checked = (e.target as HTMLInputElement).checked;\n this.setFormValue(this.checked ? 'on' : '');\n }}\n />\n <span class=\"text\">\n ${this.label}${this.required\n ? html`<span class=\"required\"> (${this.requiredText})</span>`\n : nothing}\n </span>\n </label>\n `;\n }\n\n /** The label is inside the control here, so the base class's is suppressed. */\n protected renderLabel(): TemplateResult {\n return html`${nothing}`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impkt-checkbox', ImpktCheckbox);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-checkbox': ImpktCheckbox;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAgBjD,IAAM,gBAAN,cAA4B,aAAa;AAAA,EAC9C;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,IAC1C;AAAA;AAAA,EAIA,cAAc;AACZ,UAAM;AACN,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA;AAAA;AAAA;AAAA,eAIW,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,UAIb,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,wBAKI,EAAE,KAAK;AAAA;AAAA;AAAA,qBAGV,SAAS,IAAI,CAAC;AAAA;AAAA;AAAA,iBAGlB,EAAE,UAAU;AAAA;AAAA;AAAA,IAG3B;AAAA;AAAA,EAEU,gBAAgC;AACxC,WAAO;AAAA,0CAC+B,KAAK,SAAS;AAAA;AAAA;AAAA,eAGzC,KAAK,SAAS;AAAA;AAAA,iBAEZ,KAAK,QAAQ,OAAO;AAAA,qBAChB,KAAK,OAAO;AAAA,sBACX,KAAK,QAAQ;AAAA,sBACb,KAAK,QAAQ;AAAA,6BACN,KAAK,WAAW;AAAA,yBACpB,KAAK,QAAQ,SAAS,OAAO;AAAA,oBAClC,CAAC,MAAa;AACtB,WAAK,UAAW,EAAE,OAA4B;AAC9C,WAAK,aAAa,KAAK,UAAU,OAAO,EAAE;AAAA,IAC5C,CAAC;AAAA;AAAA;AAAA,YAGC,KAAK,KAAK,GAAG,KAAK,WAChB,gCAAgC,KAAK,YAAY,aACjD,OAAO;AAAA;AAAA;AAAA;AAAA,EAInB;AAAA;AAAA,EAGU,cAA8B;AACtC,WAAO,OAAO,OAAO;AAAA,EACvB;AAAA,EAEA,QAAQ,SAAqC;AAC3C,QAAI,QAAQ,IAAI,OAAO,EAAG,MAAK,gBAAgB,WAAW,QAAQ,KAAK,KAAK,CAAC;AAAA,EAC/E;AACF;AAEA,eAAe,OAAO,kBAAkB,aAAa;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/base/FieldElement.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from './ImpktElement';\nimport { focusRing, visuallyHidden } from './styles';\nimport { fontSize, fontWeight, lineHeight, space, t } from './tokens';\n\n/**\n * The shared anatomy of a form control: a label, an optional description, a\n * control, and an error.\n *\n * This exists because the ARIA wiring between those four is where accessible\n * forms actually fail, and it fails the same way every time — a description\n * that is never announced, an error that appears silently, a label that points\n * at nothing. Written once, it is right once.\n *\n * Everything is rendered inside this component's own shadow root, including\n * the native control. That is not an implementation detail: `aria-describedby`\n * cannot cross a shadow boundary, so a component that slotted the input from\n * outside could not describe it. Keeping the whole relationship in one tree is\n * what makes the wiring work at all.\n */\n/**\n * How wide a single-line control is, from what it holds: a postcode is short,\n * an email address is long. A width that matches the answer is a hint about\n * what to type (1.3.5 is about the purpose, this is about the size). Applied by\n * the controls that take a `width`, through `--impkt-field-width`.\n */\nexport const fieldWidths = css`\n :host { --impkt-field-width: 100%; }\n :host([width='xs']) { --impkt-field-width: 8ch; }\n :host([width='sm']) { --impkt-field-width: 14ch; }\n :host([width='md']) { --impkt-field-width: 24ch; }\n :host([width='lg']) { --impkt-field-width: 40ch; }\n`;\n\nexport abstract class FieldElement extends ImpktElement {\n /** Form controls participate in a `<form>` like native ones. */\n static formAssociated = true;\n\n static properties = {\n label: { type: String },\n name: { type: String },\n value: { type: String },\n description: { type: String },\n error: { type: String },\n required: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n readonly: { type: Boolean, reflect: true },\n requiredText: { type: String, attribute: 'required-text' },\n };\n\n declare label: string;\n declare name: string;\n declare value: string;\n declare description: string;\n declare error: string;\n declare required: boolean;\n declare disabled: boolean;\n declare readonly: boolean;\n /**\n * How \"you must answer this\" is said.\n *\n * Words, not an asterisk. 3.3.2 asks for labels or instructions, and an\n * asterisk is neither until a legend explains it — which puts the\n * explanation somewhere other than the field it explains. It is a property\n * so a partner can reword it, not so they can empty it.\n */\n declare requiredText: string;\n\n protected internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.label = '';\n this.name = '';\n this.value = '';\n this.description = '';\n this.error = '';\n this.required = false;\n this.disabled = false;\n this.readonly = false;\n this.requiredText = 'required';\n // happy-dom and older engines do not implement attachInternals. A control\n // that cannot associate with a form is still a usable control, so this\n // degrades rather than throwing on construction.\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .label {\n display: block;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('semibold')};\n line-height: ${lineHeight('normal')};\n margin-block-end: ${space(1)};\n color: ${t.text};\n }\n .required {\n font-weight: ${fontWeight('regular')};\n color: ${t.textMuted};\n }\n .description {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.textMuted};\n margin-block-end: ${space(2)};\n }\n .error {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.dangerText};\n margin-block-start: ${space(1)};\n display: flex;\n gap: ${space(1)};\n }\n .error:empty {\n display: none;\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n :host([disabled]) {\n opacity: 0.6;\n }\n `,\n ];\n\n protected get controlId(): string {\n return this.id_('control');\n }\n\n /**\n * What the control points `aria-describedby` at.\n *\n * The error id is included only while there is an error. A describedby that\n * always names an empty element trains a screen-reader user to expect\n * nothing after the description, and then the one time it matters they have\n * already learned to ignore it.\n */\n protected get describedBy(): string | typeof nothing {\n const ids = [\n this.description ? this.id_('description') : '',\n this.error ? this.id_('error') : '',\n ].filter(Boolean);\n return ids.length ? ids.join(' ') : nothing;\n }\n\n /** Subclasses render the control itself; everything round it is here. */\n protected abstract renderControl(): TemplateResult;\n\n /**\n * `<label for>` by default. A group of controls — radios, checkboxes —\n * cannot use one, because `for` names a single control, so those override\n * this and render a `<fieldset>` and `<legend>` instead.\n */\n protected renderLabel(): TemplateResult {\n return html`\n <label class=\"label\" for=${this.controlId} part=\"label\">\n ${this.label}${this.required\n ? html`<span class=\"required\"> (${this.requiredText})</span>`\n : nothing}\n </label>\n `;\n }\n\n render(): TemplateResult {\n return html`\n ${this.renderLabel()}\n ${this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">\n ${this.description}\n </div>`\n : nothing}\n ${this.renderControl()}\n <!--\n The error region is always present, even when empty. A live region\n inserted at the same moment as its content is announced unreliably\n across screen readers; one that already exists and is then filled is\n announced consistently. \"polite\" rather than \"assertive\" because a\n validation message should not interrupt what is being read.\n -->\n <div\n class=\"error\"\n id=${this.id_('error')}\n part=\"error\"\n aria-live=\"polite\"\n >\n ${this.error || nothing}\n </div>\n `;\n }\n\n /** Keep the form value in step with the control. */\n protected setFormValue(value: string): void {\n this.value = value;\n this.internals?.setFormValue(value);\n this.dispatchEvent(new CustomEvent('impkt-change', { detail: { value }, bubbles: true, composed: true }));\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA0BjD,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQpB,IAAe,eAAf,cAAoC,aAAa;AAAA,EAoCtD,cAAc;AACZ,UAAM;AAHR,SAAU,YAAqC;AAI7C,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,cAAc;AACnB,SAAK,QAAQ;AACb,SAAK,WAAW;AAChB,SAAK,WAAW;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names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/scene.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult, type PropertyValues } from 'lit';\nimport { say } from '../base/say';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\n\nexport type SceneDrive = 'view' | 'page' | 'loop' | 'scrubber';\nexport type SceneLayout = 'stage' | 'split';\n\nconst clamp = (n: number) => Math.min(1, Math.max(0, n));\n\n/**\n * A scene: a stage whose children move along a progress from 0 to 1.\n *\n * The children declare timelines in their `motion` block, and `@atomic-ui/motion`\n * compiles them to keyframes. This element owns only the progress, and where it\n * comes from is the `drive` (ADR 0027):\n *\n * - `view` — the scene's own passage through the viewport. The stage pins\n * while the scene scrolls past, for `length` screens, or beside the content\n * in the default slot when `layout` is `split`.\n * - `page` — the scroll position of the whole page.\n * - `loop` — time, over `duration` seconds, repeating. **It always shows a\n * pause button**, because anything that moves on its own for more than five\n * seconds must be pausable (WCAG 2.2.2), and a scene that could forget that\n * is one the gate would have to catch on every page.\n * - `scrubber` — an `impkt-scrubber` placed in the `controls` slot.\n *\n * Progress is published three ways: the `progress` property, the\n * `--impkt-scene-progress` custom property on the host, and an\n * `impkt-scene-progress` event. Engines with scroll-driven animations run `view`\n * and `page` scenes natively, and the runtime ignores the event for them.\n *\n * Under reduced motion a `loop` does not start, and nothing pins: the stage\n * and the content stack, so every state of the scene can be read in order.\n *\n * @category layout\n * @icon layers\n * @slot stage - What moves, layered one over another. Pinned while the scene plays,\n * beside the content in `split` layout, after it, so the words are read first.\n * @slot - Content that scrolls past the stage, such as chapters.\n * @slot controls - An `impkt-scrubber`, for a scene driven by one.\n * @fires impkt-scene-progress - `{ progress }` whenever the progress changes.\n */\nexport class ImpktScene extends ImpktElement {\n static properties = {\n drive: { type: String, reflect: true },\n layout: { type: String, reflect: true },\n length: { type: Number },\n duration: { type: Number },\n label: { type: String },\n progress: { type: Number },\n controls: { type: String, reflect: true },\n bleed: { type: Boolean, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n\n /** Where the progress comes from. */\n declare drive: 'view' | 'page' | 'loop' | 'scrubber';\n /** `stage` pins one full-width stage; `split` pins it beside the content. */\n declare layout: 'stage' | 'split';\n /** How many screens of scrolling a `view` scene lasts, in `stage` layout. */\n declare length: number;\n /** Seconds per cycle of a `loop` scene. */\n declare duration: number;\n /** The scene's accessible name. Also names its pause button. */\n declare label: string;\n /** From 0 to 1. Set it to seek a `scrubber` scene, or where one starts. */\n declare progress: number;\n /**\n * Where the controls sit: `below` the stage, or `over` its foot, floating\n * on what it shows, as a video's do. Under reduced motion they sit below.\n */\n declare controls: 'below' | 'over';\n /** Run the stage to the window's edges, past the page's margins, as a hero drawn edge to edge does. */\n declare bleed: boolean;\n /**\n * Leave it out on a phone, or on anything wider, for a picture drawn twice:\n * once for a wide screen and once for a narrow one. Never both.\n */\n declare hideOn: 'never' | 'phone' | 'wide';\n /**\n * Whether a loop is paused: the scene's own state, set by its pause button\n * or by `pause()`. A plain field rather than a property, so it is never one\n * of the settings an author is offered.\n */\n private paused = false;\n\n private frame = 0;\n private started = 0;\n private reduced = false;\n private seekFrom = 0;\n private seekTo = 0;\n private seekStart = 0;\n private seekMs = 0;\n\n constructor() {\n super();\n this.drive = 'view';\n this.layout = 'stage';\n this.length = 3;\n this.duration = 8;\n this.label = 'Animation';\n this.progress = 0;\n this.controls = 'below';\n this.bleed = false;\n this.hideOn = 'never';\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n position: relative;\n }\n :host([drive='view'][layout='stage']) {\n min-height: calc(var(--impkt-scene-length, 3) * 100svh);\n }\n .frame {\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n }\n :host([layout='split']) .frame {\n grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);\n gap: ${space(8)};\n }\n .stage {\n position: sticky;\n top: 0;\n height: 100svh;\n display: grid;\n place-items: center;\n overflow: clip;\n }\n /* What is on the stage is layered, as in a motion tool: each thing sits\n over the one before, so a later layer's timeline can reveal it over an\n earlier one. */\n .stage ::slotted(*) {\n grid-area: 1 / 1;\n max-width: 100%;\n }\n :host([drive='loop']) .stage,\n :host([drive='scrubber']) .stage {\n position: relative;\n height: auto;\n min-height: 60svh;\n }\n .controls {\n display: flex;\n gap: ${space(3)};\n align-items: center;\n justify-content: center;\n padding-block: ${space(3)};\n }\n :host([bleed]) { margin-inline: calc(50% - 50vw); }\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none; } }\n /* Over the stage, the controls float at its foot, above the layers and clear of its edges. */\n .stage > .controls { position: absolute; inset-inline: ${space(6)}; inset-block-end: ${space(6)}; z-index: 2; padding: 0; }\n .stage > .controls ::slotted(*) { box-shadow: 0 12px 32px rgb(16 19 23 / 14%); border-radius: 16px; background: var(--impkt-color-surface-card, #fff); }\n /* A control takes the row, so a graph scrubber spans the stage; a narrower one centres itself. */\n .controls ::slotted(*) { flex: 1 1 auto; min-width: 0; }\n .pause {\n min-width: ${token('target.min', '24px')};\n min-height: ${token('target.min', '24px')};\n padding: ${space(2)} ${space(4)};\n border-radius: ${token('radius.full', '9999px')};\n border: 1px solid ${t.border};\n background: ${t.surfaceCard};\n color: ${t.text};\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('medium')};\n cursor: pointer;\n }\n .pause:focus-visible {\n outline: none;\n box-shadow: ${token('focus.ring.shadow', '0 0 0 2px #fff, 0 0 0 4px #1a1a1a')};\n }\n @media (max-width: 48rem) {\n :host([layout='split']) .frame {\n grid-template-columns: minmax(0, 1fr);\n }\n :host([layout='split']) .stage {\n height: 50svh;\n z-index: 1;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n :host {\n min-height: 0 !important;\n }\n .stage {\n position: relative;\n height: auto;\n gap: ${space(6)};\n }\n /* With less motion the layers are shown one after another, so every\n state the scene would have moved through can still be seen. */\n .stage ::slotted(*) {\n grid-area: auto;\n }\n }\n `,\n ];\n\n /** @ignore */\n connectedCallback(): void {\n super.connectedCallback();\n try {\n this.reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n } catch {\n this.reduced = false;\n }\n window.addEventListener('scroll', this.onScroll, { passive: true, capture: true });\n window.addEventListener('resize', this.onScroll);\n this.schedule();\n }\n\n /** @ignore */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('scroll', this.onScroll, { capture: true });\n window.removeEventListener('resize', this.onScroll);\n if (this.frame) cancelAnimationFrame(this.frame);\n this.frame = 0;\n }\n\n /** @ignore */\n protected updated(changed: PropertyValues<this>): void {\n if (changed.has('length')) this.style.setProperty('--impkt-scene-length', String(this.length));\n if (changed.has('progress')) this.publish();\n if (changed.has('drive')) {\n this.started = 0;\n this.schedule();\n }\n }\n\n /**\n * Move to a progress. With `ms`, ease there; without, jump. A scrubber seeks\n * a scene to a named stop this way.\n */\n seek(to: number, ms = 0): void {\n if (ms <= 0 || this.reduced) {\n this.progress = clamp(to);\n return;\n }\n this.seekFrom = this.progress;\n this.seekTo = clamp(to);\n this.seekStart = 0;\n this.seekMs = ms;\n this.schedule();\n }\n\n private onScroll = () => {\n if (this.drive === 'view' || this.drive === 'page') this.schedule();\n };\n\n private schedule(): void {\n if (!this.frame && typeof requestAnimationFrame === 'function') this.frame = requestAnimationFrame(this.tick);\n }\n\n private tick = (now: number) => {\n this.frame = 0;\n if (this.seekMs) {\n if (!this.seekStart) this.seekStart = now;\n const p = Math.min(1, (now - this.seekStart) / this.seekMs);\n // ease-in-out, so a jump between stops reads as travel rather than a cut\n const e = p < 0.5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2;\n this.progress = this.seekFrom + (this.seekTo - this.seekFrom) * e;\n if (p < 1) this.schedule();\n else this.seekMs = 0;\n return;\n }\n if (this.drive === 'view') {\n const r = this.getBoundingClientRect();\n const vh = window.innerHeight || 1;\n this.progress = clamp(-r.top / Math.max(1, r.height - vh));\n } else if (this.drive === 'page') {\n const doc = document.documentElement;\n this.progress = clamp(window.scrollY / Math.max(1, doc.scrollHeight - (window.innerHeight || 0)));\n } else if (this.drive === 'loop' && !this.paused && !this.reduced) {\n if (!this.started) this.started = now - this.progress * this.duration * 1000;\n this.progress = ((now - this.started) / (this.duration * 1000)) % 1;\n this.schedule();\n }\n };\n\n private publish(): void {\n this.style.setProperty('--impkt-scene-progress', this.progress.toFixed(4));\n this.dispatchEvent(new CustomEvent('impkt-scene-progress', { detail: { progress: this.progress }, bubbles: true, composed: true }));\n }\n\n private setPaused(paused: boolean): void {\n if (this.paused === paused) return;\n this.paused = paused;\n this.started = 0;\n this.schedule();\n this.requestUpdate();\n }\n\n private togglePause = () => this.setPaused(!this.paused);\n\n /** Stop a loop where it is, as its pause button does. An editor scrubbing the scene calls it. */\n pause(): void {\n this.setPaused(true);\n }\n\n render(): TemplateResult {\n const loop = this.drive === 'loop';\n const over = this.controls === 'over' && !this.reduced;\n const controls = html`<div class=\"controls\" part=\"controls\">\n <slot name=\"controls\"></slot>\n ${loop && !this.reduced\n ? html`<button class=\"pause\" type=\"button\" aria-pressed=${this.paused ? 'true' : 'false'} @click=${this.togglePause}>\n ${this.paused ? say('Play {name}', { name: this.label }) : say('Pause {name}', { name: this.label })}\n </button>`\n : nothing}\n </div>`;\n const stage = html`<div class=\"stage\" part=\"stage\"><slot name=\"stage\"></slot>${over ? controls : nothing}</div>`;\n return html`\n <div class=\"frame\" part=\"frame\" role=\"region\" aria-label=${this.label}>\n ${this.layout === 'split'\n ? html`<div class=\"content\" part=\"content\"><slot></slot></div>${stage}`\n : html`${stage}<div class=\"content\" part=\"content\"><slot></slot></div>`}\n </div>\n ${over ? nothing : controls}\n `;\n }\n}\n\ncustomElements.define('impkt-scene', ImpktScene);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-scene': ImpktScene }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAy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,CAAC,KAAK,UACZ,wDAAwD,KAAK,SAAS,SAAS,OAAO,WAAW,KAAK,WAAW;AAAA,gBAC7G,KAAK,SAAS,IAAI,eAAe,EAAE,MAAM,KAAK,MAAM,CAAC,IAAI,IAAI,gBAAgB,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;AAAA,yBAEtG,OAAO;AAAA;AAEf,UAAM,QAAQ,iEAAiE,OAAO,WAAW,OAAO;AACxG,WAAO;AAAA,iEACsD,KAAK,KAAK;AAAA,UACjE,KAAK,WAAW,UACd,8DAA8D,KAAK,KACnE,OAAO,KAAK,yDAAyD;AAAA;AAAA,QAEzE,OAAO,UAAU,QAAQ;AAAA;AAAA,EAE/B;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/base/tokens.ts","../src/base/styles.ts","../src/base/say.ts","../src/base/ImpktElement.ts"],"sourcesContent":["/**\n * Token helpers.\n *\n * Components never name a colour, a size or a radius. They name a token, and a\n * brand decides what it holds — which is what makes a rebrand a content\n * publish rather than a rebuild\n * ([ADR 0005](https://github.com/matthill8286/strata/blob/main/docs/decisions/0005-design-tokens.md)).\n *\n * Every reference carries a fallback so that a component dropped onto a page\n * with no token stylesheet still renders something legible. An unstyled\n * component is indistinguishable from a broken one, and the fallback is what\n * keeps a missing stylesheet a visible annoyance rather than a blank screen.\n *\n * These return `CSSResult` rather than strings. Lit's `css` tag refuses plain\n * interpolated strings, which is a deliberate guard against injecting\n * attacker-controlled text into a stylesheet; `unsafeCSS` is the documented\n * way past it and is safe here because every value is a literal in this file,\n * never anything authored or fetched.\n */\nimport { css, unsafeCSS, type CSSResult } from 'lit';\n\n/** `color.brand.default` → `var(--impkt-color-brand-default, <fallback>)`. */\nexport const token = (path: string, fallback: string): CSSResult =>\n unsafeCSS(`var(--impkt-${path.replace(/\\./g, '-')}, ${fallback})`);\n\nexport const t = {\n brand: token('color.brand.default', '#1f4ed8'),\n brandHover: token('color.brand.hover', '#1b45be'),\n brandActive: token('color.brand.active', '#183ba4'),\n brandSubtle: token('color.brand.subtle', '#e4eafa'),\n onBrand: token('color.text.on-brand', '#ffffff'),\n\n surfaceCard: token('color.surface.card', '#ffffff'),\n surfaceInset: token('color.surface.inset', '#f4f4f4'),\n surfaceSubtle: token('color.surface.subtle', '#e4eafa'),\n\n text: token('color.text.default', '#1a1a1a'),\n textMuted: token('color.text.muted', '#717171'),\n textPlaceholder: token('color.text.placeholder', '#767676'),\n textHeading: token('color.text.heading', '#1f4ed8'),\n link: token('color.text.link', '#1f4ed8'),\n linkHover: token('color.text.link-hover', '#193ead'),\n\n border: token('color.border.default', '#929292'),\n borderStrong: token('color.border.strong', '#818181'),\n\n danger: token('color.status.danger.default', '#c8102e'),\n dangerText: token('color.status.danger.text', '#c8102e'),\n dangerSubtle: token('color.status.danger.subtle', '#f8e2e6'),\n warning: token('color.status.warning.default', '#b45309'),\n warningText: token('color.status.warning.text', '#b45309'),\n warningSubtle: token('color.status.warning.subtle', '#f6eae1'),\n success: token('color.status.success.default', '#047857'),\n successText: token('color.status.success.text', '#047857'),\n successSubtle: token('color.status.success.subtle', '#e0f0ea'),\n info: token('color.status.info.default', '#1f4ed8'),\n infoText: token('color.status.info.text', '#1f4ed8'),\n infoSubtle: token('color.status.info.subtle', '#e4eafa'),\n\n fontBody: token('font.family.body', 'system-ui, sans-serif'),\n fontHeading: token('font.family.heading', 'system-ui, sans-serif'),\n /** Code-like labels: hashes, branches, version lines. */\n fontMono: token('font.family.mono', 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace'),\n /** The small line above a heading: the body face, or the code face for a brand that asks. */\n fontEyebrow: token('font.family.eyebrow', 'inherit'),\n\n focusShadow: token('focus.ring.shadow', '0 0 0 2px #ffffff, 0 0 0 4px #1a1a1a'),\n focusOffset: token('focus.ring.offset', '2px'),\n\n targetMin: token('target.min', '24px'),\n\n radiusSm: token('radius.sm', '2px'),\n radius: token('radius.md', '4px'),\n radiusLg: token('radius.lg', '8px'),\n\n borderThin: token('border.width.thin', '1px'),\n borderThick: token('border.width.thick', '2px'),\n\n radiusXs: token('radius.xs', '2px'),\n radiusXl: token('radius.xl', '12px'),\n radius2xl: token('radius.2xl', '16px'),\n\n /** Hairline borders and rings, from the text colour, so they suit any surface. */\n hairline: unsafeCSS('color-mix(in srgb, var(--impkt-color-text-default, #1a1a1a) 10%, transparent)'),\n rule: unsafeCSS('color-mix(in srgb, var(--impkt-color-text-default, #1a1a1a) 15%, transparent)'),\n /** A wash of the text colour, for hover and pressed states on quiet controls. */\n wash: unsafeCSS('color-mix(in srgb, var(--impkt-color-text-default, #1a1a1a) 5%, transparent)'),\n /** The brand at a fifth, for focus halos round fields. */\n brandHalo: unsafeCSS('color-mix(in srgb, var(--impkt-color-brand-default, #1f4ed8) 22%, transparent)'),\n\n shadowXs: token('shadow.xs', '0 1px 2px 0 rgb(0 0 0 / 0.05)'),\n shadowSm: token('shadow.sm', '0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)'),\n shadowMd: token('shadow.md', '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)'),\n shadowLg: token('shadow.lg', '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)'),\n shadowXl: token('shadow.xl', '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)'),\n\n trackingTight: token('font.tracking.tight', '-0.02em'),\n trackingWide: token('font.tracking.wide', '0.06em'),\n} as const;\n\n/**\n * A size on the type scale with its own line height, so text drawn at\n * `type('xl')` has the leading that size reads best at.\n */\nexport const type = (name: string): CSSResult =>\n unsafeCSS(`font-size: var(--impkt-font-size-${name}, 1rem); line-height: var(--impkt-font-leading-${name}, 1.5);`);\n\n/** `space(3)` → `space.3`, `space(0.5)` → `space.0-5`. Spacing is always a token, never a number. */\nexport const space = (step: number): CSSResult => token(`space.${String(step).replace('.', '-')}`, `${step * 4}px`);\n/** `font.size.lg` → the custom property. */\nexport const fontSize = (name: string): CSSResult => token(`font.size.${name}`, '1rem');\nexport const lineHeight = (name: string): CSSResult => token(`font.line-height.${name}`, '1.5');\nexport const fontWeight = (name: string): CSSResult => token(`font.weight.${name}`, '400');\n\n/**\n * Space above and below a section, from the spacing scale: `none`, `sm`,\n * `md`, `lg` or `xl`, set by `space-above` and `space-below`. A section names\n * a step rather than a size, so a page keeps the brand's rhythm.\n */\nexport const spaceAround: CSSResult = css`\n :host([space-above='sm']) { margin-block-start: ${space(2)}; }\n :host([space-above='md']) { margin-block-start: ${space(4)}; }\n :host([space-above='lg']) { margin-block-start: ${space(6)}; }\n :host([space-above='xl']) { margin-block-start: ${space(8)}; }\n :host([space-above='2xl']) { margin-block-start: clamp(${space(14)}, 8vw, ${space(28)}); }\n :host([space-below='sm']) { margin-block-end: ${space(2)}; }\n :host([space-below='md']) { margin-block-end: ${space(4)}; }\n :host([space-below='lg']) { margin-block-end: ${space(6)}; }\n :host([space-below='xl']) { margin-block-end: ${space(8)}; }\n :host([space-below='2xl']) { margin-block-end: clamp(${space(14)}, 8vw, ${space(28)}); }\n`;\n","/**\n * Shared style fragments.\n *\n * Three of these carry an accessibility guarantee and are therefore not\n * negotiable per component: the focus ring, the minimum target size and the\n * reduced-motion rule. A component that wants its own focus treatment is a\n * component that will get it subtly wrong on one brand, so there is one.\n */\nimport { css } from 'lit';\nimport { t } from './tokens';\n\n/**\n * The focus ring.\n *\n * `:focus-visible` rather than `:focus`, so a mouse click on a button does not\n * draw a ring the user did not ask for while keyboard focus still does.\n *\n * The ring is two-tone — a light inner band inside a dark outer one — drawn\n * with `box-shadow` and a transparent `outline` behind it. The outline is not\n * decoration: it is what survives Windows High Contrast Mode, where box-shadow\n * is dropped entirely and a shadow-only ring disappears for exactly the users\n * who most need it.\n *\n * The colours come from locked tokens a brand cannot reach\n * ([ADR 0010](https://github.com/matthill8286/strata/blob/main/docs/decisions/0010-what-a-brand-may-set.md)).\n */\nexport const focusRing = css`\n :host(:focus-visible),\n :host(:not([disabled])) :focus-visible {\n outline: 2px solid transparent;\n outline-offset: ${t.focusOffset};\n box-shadow: ${t.focusShadow};\n }\n`;\n\n/**\n * WCAG 2.2, 2.5.8 Target Size (Minimum): 24 by 24 CSS pixels.\n *\n * Applied as a minimum rather than a fixed size so a control grows with its\n * content and never shrinks below the floor. It reads the locked token, which\n * is deliberately outside the spacing scale — otherwise a brand tightening its\n * spacing unit would shrink every tap target with it.\n */\nexport const targetSize = css`\n min-block-size: ${t.targetMin};\n min-inline-size: ${t.targetMin};\n`;\n\n/**\n * Visible to a screen reader, invisible on screen.\n *\n * `clip-path` with a 1px box rather than `display: none` or `visibility:\n * hidden`, both of which remove the text from the accessibility tree — which\n * is the one thing this must not do.\n */\nexport const visuallyHidden = css`\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n`;\n\n/**\n * 2.3.3 Animation from Interactions, and plain decency.\n *\n * `0.01ms` rather than `0` because a zero-duration transition does not fire a\n * `transitionend` event in every engine, and components that wait for one hang.\n */\nexport const reducedMotion = css`\n @media (prefers-reduced-motion: reduce) {\n :host,\n :host *,\n :host *::before,\n :host *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n`;\n\n/** The base every component starts from. */\nexport const base = css`\n :host {\n box-sizing: border-box;\n font-family: ${t.fontBody};\n color: ${t.text};\n }\n :host([hidden]) {\n display: none !important;\n }\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n`;\n","/**\n * The library's own words, in the page's language (ADR 0026).\n *\n * Every word a component shows that a page did not give it, such as \"Skip to\n * content\", \"Next slide\" or \"There is a problem\", goes through `say`. The\n * renderer puts the site's wording in place before it draws a page\n * (`applySiteLanguage` in `@atomic-ui/renderer-core`), translated into the page's\n * language and with any of the site's own rewording. Without it, the English\n * here is shown, which is what every site did before it had languages.\n *\n * The English is the key, with `{name}` for a value put in, so the list of\n * words to translate (`SITE_WORDING` in `@atomic-ui/content-schemas`) can be\n * checked against this library by a test.\n */\nconst WORDING = Symbol.for('strata.wording');\n\ntype Store = { words?: Record<string, string> };\n\nexport function say(english: string, values?: Record<string, string | number>): string {\n const words = ((globalThis as Record<symbol, Store | undefined>)[WORDING])?.words;\n const chosen = words?.[english];\n const text = typeof chosen === 'string' && chosen.trim() ? chosen : english;\n return values ? text.replace(/\\{(\\w+)\\}/g, (whole, name: string) => (name in values ? String(values[name]) : whole)) : text;\n}\n","import { LitElement, css } from 'lit';\nimport { base, reducedMotion } from './styles';\nimport { say } from './say';\n\nlet counter = 0;\n\n/**\n * The base every Impkt component extends.\n *\n * It carries the two style fragments that are not a per-component choice — the\n * reset and the reduced-motion rule — and a stable id generator for the ARIA\n * wiring. It deliberately carries nothing else: a base class that grows\n * behaviour becomes the place every component's exceptions are negotiated.\n */\nexport class ImpktElement extends LitElement {\n static styles = [base, reducedMotion, css``];\n\n /**\n * A unique id for this instance, for `aria-describedby` and friends.\n *\n * Generated once in the constructor rather than in `render`, because an id\n * that changes between renders breaks the relationship it exists to express\n * — and it breaks it silently, since the markup still looks correct.\n */\n protected readonly uid = `impkt-${(counter += 1)}`;\n\n protected id_(part: string): string {\n return `${this.uid}-${part}`;\n }\n\n /** @ignore */\n connectedCallback(): void {\n super.connectedCallback();\n this.sayDefaults();\n }\n\n /**\n * The words a component ships with, in the page's language (ADR 0026).\n *\n * Defaults stay plain English in the constructor, so the component manifest\n * still sees them (a prop with no default is read as required). When the\n * element joins the page, each word it holds is looked up in the site's\n * wording; anything that is not one of Strata's own words, such as a page's\n * own text or a variant name, is left exactly as it is.\n *\n * @ignore\n */\n private sayDefaults(): void {\n const props = (this.constructor as typeof LitElement).elementProperties;\n const self = this as unknown as Record<string, unknown>;\n for (const name of props.keys()) {\n const value = self[name as string];\n if (typeof value !== 'string' || !value) continue;\n const said = say(value);\n if (said !== value) self[name as string] = said;\n }\n }\n}\n"],"mappings":";AAmBA,SAAS,KAAK,iBAAiC;AAGxC,IAAM,QAAQ,CAAC,MAAc,aAClC,UAAU,eAAe,KAAK,QAAQ,OAAO,GAAG,CAAC,KAAK,QAAQ,GAAG;AAE5D,IAAM,IAAI;AAAA,EACf,OAAO,MAAM,uBAAuB,SAAS;AAAA,EAC7C,YAAY,MAAM,qBAAqB,SAAS;AAAA,EAChD,aAAa,MAAM,sBAAsB,SAAS;AAAA,EAClD,aAAa,MAAM,sBAAsB,SAAS;AAAA,EAClD,SAAS,MAAM,uBAAuB,SAAS;AAAA,EAE/C,aAAa,MAAM,sBAAsB,SAAS;AAAA,EAClD,cAAc,MAAM,uBAAuB,SAAS;AAAA,EACpD,eAAe,MAAM,wBAAwB,SAAS;AAAA,EAEtD,MAAM,MAAM,sBAAsB,SAAS;AAAA,EAC3C,WAAW,MAAM,oBAAoB,SAAS;AAAA,EAC9C,iBAAiB,MAAM,0BAA0B,SAAS;AAAA,EAC1D,aAAa,MAAM,sBAAsB,SAAS;AAAA,EAClD,MAAM,MAAM,mBAAmB,SAAS;AAAA,EACxC,WAAW,MAAM,yBAAyB,SAAS;AAAA,EAEnD,QAAQ,MAAM,wBAAwB,SAAS;AAAA,EAC/C,cAAc,MAAM,uBAAuB,SAAS;AAAA,EAEpD,QAAQ,MAAM,+BAA+B,SAAS;AAAA,EACtD,YAAY,MAAM,4BAA4B,SAAS;AAAA,EACvD,cAAc,MAAM,8BAA8B,SAAS;AAAA,EAC3D,SAAS,MAAM,gCAAgC,SAAS;AAAA,EACxD,aAAa,MAAM,6BAA6B,SAAS;AAAA,EACzD,eAAe,MAAM,+BAA+B,SAAS;AAAA,EAC7D,SAAS,MAAM,gCAAgC,SAAS;AAAA,EACxD,aAAa,MAAM,6BAA6B,SAAS;AAAA,EACzD,eAAe,MAAM,+BAA+B,SAAS;AAAA,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