@tooark/web-components 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Tooark
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,12 @@
1
+ Tooark Web Components
2
+ Copyright 2026 Tooark
3
+
4
+ This product includes software developed as part of the Tooark project
5
+ (https://github.com/Tooark/web-components).
6
+
7
+ Licensed under the Apache License, Version 2.0.
8
+
9
+ This product does not bundle third-party source code in its distributed
10
+ artifacts; all runtime dependencies are declared as external packages and
11
+ installed separately by consumers under their own licenses. See
12
+ THIRD-PARTY-NOTICES.md for an overview of those dependencies and licenses.
package/README.md ADDED
@@ -0,0 +1,193 @@
1
+ # @tooark/web-components
2
+
3
+ [![npm](https://img.shields.io/npm/v/@tooark/web-components?logo=npm&color=CB3837)](https://www.npmjs.com/package/@tooark/web-components)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/Tooark/web-components/blob/main/LICENSE)
5
+
6
+ The native Custom Elements (`ark-*`) of the Tooark design system, styled with Tailwind v4 on top of design tokens — accessibility, keyboard support and motion built in, one stylesheet, no framework required.
7
+
8
+ 🌍 **Languages:** ![USA Flag](https://flagcdn.com/w20/us.png) **English (this file)** · [![Brazil Flag](https://flagcdn.com/w20/br.png) Português](./README.pt-BR.md)
9
+
10
+ ---
11
+
12
+ ## Contents
13
+
14
+ - [Overview](#-overview)
15
+ - [Installation](#-installation)
16
+ - [Configuration](#️-configuration)
17
+ - [Components](#-components)
18
+ - [Usage examples](#-usage-examples)
19
+ - [Dependencies](#-dependencies)
20
+ - [Contributing](#-contributing)
21
+ - [License](#-license)
22
+
23
+ ---
24
+
25
+ ## 📖 Overview
26
+
27
+ The `@tooark/web-components` package provides:
28
+
29
+ - 41 elements: buttons and toggles, form fields (input, textarea, select, checkbox, radio, switch, file input, datepicker, key/value editor), overlays on the Popover API (dialog, drawer, menu, tooltip, command palette, toaster), layout (card, tabs, split pane, carousel), feedback (alert, badge, progress, spinner, skeleton, empty, status dot) and the calendar/clock/scheduler family;
30
+ - light DOM: components never move or wrap your children; the host is the control or container;
31
+ - `styles.css` is the only stylesheet you need: tokens, motion presets and component styles, all prefixed (`ark:*`, `--ark-*`), with no global reset;
32
+ - themes by `color-scheme` (`theme="light|dark"` per element), sizes `xs…xl`, intents `primary…neutral`, `rounded`;
33
+ - events as `CustomEvent`s (`change`, `ark-change`, `ark-select`, …), `testid` forwarded as `data-testid` on every internal part for E2E.
34
+
35
+ ---
36
+
37
+ ## 🔧 Installation
38
+
39
+ ```bash
40
+ pnpm add @tooark/web-components # brings @tooark/core and @tooark/tokens
41
+ ```
42
+
43
+ Using React, Vue or Angular? Install `@tooark/react`, `@tooark/vue` or `@tooark/angular` instead: they depend on this package and add typed wrappers.
44
+
45
+ ---
46
+
47
+ ## ⚙️ Configuration
48
+
49
+ Import the stylesheet once and register the elements before using them:
50
+
51
+ ```ts
52
+ import { registerTooarkComponents } from "@tooark/web-components";
53
+ import "@tooark/web-components/styles.css";
54
+
55
+ registerTooarkComponents(); // idempotent
56
+ ```
57
+
58
+ Declare the page's `color-scheme` to pick the theme (`light`, `dark` or `light dark` to follow the system); set `theme="light|dark"` on an element to force one side, and `lang="en|pt|es"` (or `locale-json`) on the elements that show text.
59
+
60
+ ---
61
+
62
+ ## 📦 Components
63
+
64
+ - `ark-alert` — Alert/banner: the host is the box in the intent's soft color, your children are the message (free text or elements), `slot="icon"` left, `slot="action"` right, `heading`, `dismissible` with animated exit, `live` region (`status`/`alert`).
65
+ - `ark-avatar` — Avatar (`role="img"` named by `name`): initials from `name`, `src` image that falls back to the initials on load error, `size`, `shape` circle/square, custom `color`.
66
+ - `ark-badge` — Short status/category label: intents, `soft`/`solid`/`outline`, `xs`–`md`, `rounded`, custom `color` via `color-mix`. The host is the badge; icon and text stay as its children.
67
+ - `ark-button` — Intents, sizes, style variants (solid/outline/ghost), `rounded` (up to `full`), `loading`/`icon-only`/`full-width` states, `status` feedback (success/error glyph + announcement), link mode (`href`).
68
+ - `ark-calendar` — Inline month grid (MUI DateCalendar-style): localized, WAI-ARIA keyboard navigation, motion, month/year views from the title and colored events (`dots`/`count`/`list`).
69
+ - `ark-card` — Card: the host is the box (`surface`, `border`, `rounded`) and a grid: `heading` (h2) or `slot="header"` with `slot="actions"` on the top row, unslotted children as the body, `slot="footer"` last with a divider; `padding` none–lg.
70
+ - `ark-carousel` — Native CSS scroll snap (touch/trackpad scroll natively, mouse drag emulated), autoplay, loop, dots and arrows. Slides stay as your direct children.
71
+ - `ark-checkbox` — Checkbox drawn by the component (`role="checkbox"` button + hidden native input for forms and `<fieldset disabled>`): `checked`, `indeterminate`, `label`/`aria-label`/free children as the label, sizes, intents. Emits `change`.
72
+ - `ark-clock` — Time selection with scrollable digital columns (hours/minutes/seconds), 24h/12h, minute step, localized.
73
+ - `ark-color-swatches` — Color palette as a `radiogroup`: swatches from `colors` (`{ name, value }[]`, JSON attribute or JS property), `value`, arrows navigate, `disabled`, `size`. Emits `change` with the value.
74
+ - `ark-command-item` — Command palette item (the host is the `role="option"`): free children, `slot="trailing"` for a shortcut, `value`, `group`, `label` (filter text), `disabled`. Emits `ark-select`.
75
+ - `ark-command-palette` — Command palette on the Popover API: search field (an `ark-input` of its own), `ark-command-item` children grouped and filtered (`filter`) or searched by the app (`ark-query`), arrows + Enter, `hotkey` (`/`, `mod+k`). Emits `ark-select`, `ark-query`, `ark-open`, `ark-close`.
76
+ - `ark-copy-button` — Copy button: extends `ark-button` (same variants, sizes, `icon-only`, forms, hooks); copies `value` or the `for` element, swaps the icon for a check and the text/`title` for "copied" for `feedback-ms`, announces it. Emits `ark-copy`.
77
+ - `ark-datepicker` — Date picker: inline (embeds `ark-calendar`) or `input` mode with field + popup, localized formatting, typed input parsing, forms.
78
+ - `ark-dialog` — Modal dialog on the Popover API (top layer, `::backdrop` scrim, no portal): the host is the panel, your children are the body, `slot="footer"` is the footer; header from `label`, focus trap, Esc/scrim, `sm`–`xl`.
79
+ - `ark-drawer` — Drawer anchored to an edge: `overlay` (Popover API, scrim, focus trap, Esc) or `inline` (in the page flow, e.g. a bottom console); `side`, `size` preset or CSS length, header from `label`, `slot="footer"`, slide with the `sheet` easing. Emits `ark-open`/`ark-close`.
80
+ - `ark-empty` — Empty state: dashed box with a dimmed `slot="icon"`, `heading` (h3), `description` and an optional `slot="action"` button; children stay in place, ordered by CSS.
81
+ - `ark-file-input` — File field with the `ark-input` grid (label, helper/error): hidden native `<input type="file">` for forms, drop zone with `dragover` highlight, keyboard-accessible choose button, list of selected names, `accept`/`multiple`. Emits `change` with the files and announces them.
82
+ - `ark-input` — Standardized text field: label, helper/error with aria, prefix/suffix via `slot`, password `reveal`, native attributes passed through, sizes, intents, `rounded`.
83
+ - `ark-kbd` — Keyboard key: the host is the key (mono, border, `surface-muted`, bottom edge) around your text; `size`.
84
+ - `ark-kv-editor` — Key/value editor: rows `{ id, key, value, enabled }` (JS property) to enable, edit, delete and add, optional `types`/`secret`/`description` columns, bulk mode as `key:value` lines or JSON. Composes other ark-\* controls. Emits `change`, `ark-add`, `ark-delete`.
85
+ - `ark-mark` — Scope mark: one of six shapes (`circle`, `square`, `triangle`, `diamond`, `star`, `hexagon`) in a `color`, color and shape together so identity never relies on color alone; `size`, `label`.
86
+ - `ark-menu` — Dropdown/context menu on the Popover API (`role="menu"`, `popover="auto"`): anchored to a trigger by `for`, `align`/`direction` with flip, keyboard, `openAt(x, y)`; items stay as children. Emits `ark-select`.
87
+ - `ark-menu-item` — Menu item (the host is the item): free children, `slot="trailing"`, `disabled`, `intent`, `checked` (checkbox item), `divider`, `static` (non-interactive content).
88
+ - `ark-progress` — Progress bar (`role="progressbar"` on the host): `value`/`max` with token-driven width transition, `show-value`, `indeterminate` loop exempt from reduced motion, `label`, sizes, intents.
89
+ - `ark-radio` — Radio drawn by the component (`role="radio"` button + hidden native input): groups by `name` in the same form, one tab stop per group, arrows move and check, `label`/children as the label. Emits `change` on the one checked.
90
+ - `ark-scheduler` — Scheduler with `week`/`day` views (time grid with overlap resolved into columns), plus `month` and `agenda`; colored, clickable events.
91
+ - `ark-select` — Native `<select>` styled like `ark-input`: label, helper/error with aria, `placeholder`, options from data (`options` JSON attribute or JS property, `group` → `<optgroup>`), sizes, intents, `rounded`.
92
+ - `ark-shape-picker` — Shape picker as a `radiogroup`: the six `ark-mark` shapes drawn in `color`, `value`, arrows navigate, localized shape names, `disabled`, `size`. Emits `change` with the shape.
93
+ - `ark-skeleton` — Loading placeholder: the host is the block (`.ark-skeleton`, `aria-hidden`), sized by your class/style; `rows` renders bars, `animated` opts into the pulse, `rounded`.
94
+ - `ark-spinner` — Standalone loading indicator (`role="status"`): the button's spinner SVG on `.ark-animate-spin` (keeps spinning under reduced motion), screen-reader label by `lang` or `label`, `size`, optional `intent` (inherits the text color otherwise).
95
+ - `ark-split-pane` — Resizable panels: your children are the panels, the handles are the component's own nodes at the end of the host; `direction`, `sizes` (percentages, rewritten on every change), `data-min`/`data-max` per panel, keyboard and pointer-capture drag. Emits `ark-resize`.
96
+ - `ark-status-dot` — Status dot: the host is the circle in the intent color (default `neutral`); `label` makes it a named `role="img"`, without it it is decorative; `size`. Static, never pulses.
97
+ - `ark-switch` — Accessible on/off switch (`role="switch"`): optional ON/OFF text and ✓/✕ icons, intents, form participation via hidden checkbox.
98
+ - `ark-tab` — Tab item (`role="tab"`, the host is the control): free children, `disabled`, `controls`, `closable` and `dirty` in the editor variant. Emits `ark-close`.
99
+ - `ark-tabs` — Tab strip (`role="tablist"`): `underline`/`chips`/`editor`, roving tabindex with arrows/Home/End, `slot="actions"` at the end, `change` with the active value. Panels stay with the app.
100
+ - `ark-textarea` — Multi-line field with the `ark-input` grid: `rows`, `autosize` (native `field-sizing`, JS fallback), `monospace`, `resize`, helper/error with aria, sizes, intents, `rounded`.
101
+ - `ark-toaster` — Sonner-style toasts: programmatic API, positions, rich colors, actions, animated enter/exit, localized close button.
102
+ - `ark-toggle` — Pressed-state button (`aria-pressed`), standalone (outline/tinted per intent) or as a group item.
103
+ - `ark-toggle-group` — Segmented control: exclusive (default) or multiple selection, synced `value`, propagates `size`/`intent`/`theme`/`disabled` to items.
104
+ - `ark-tooltip` — Tooltip on the Popover API: wraps your trigger without moving it, text via `content` or rich `slot="content"`, `side` with flip, `delay`, hover/focus/Esc, `aria-describedby` on the trigger.
105
+
106
+ Full attribute reference, theming guide and E2E hooks: [https://github.com/Tooark/web-components#readme](https://github.com/Tooark/web-components#readme) · live examples with interaction tests: [Storybook](https://tooark.com/web-components/).
107
+
108
+ ---
109
+
110
+ ## 📝 Usage examples
111
+
112
+ ### A form with a confirmation dialog and a toast
113
+
114
+ ```html
115
+ <form id="profile">
116
+ <ark-input name="name" label="Name" placeholder="Your full name" required></ark-input>
117
+ <ark-select
118
+ name="role"
119
+ label="Role"
120
+ options='[{"value":"dev","label":"Developer"},{"value":"ops","label":"Operations"}]'
121
+ ></ark-select>
122
+ <ark-datepicker input mode="date" lang="en" name="since"></ark-datepicker>
123
+ <ark-button type="submit" intent="primary">Save</ark-button>
124
+ </form>
125
+
126
+ <ark-dialog id="confirm" label="Publish changes?">
127
+ <p>Your profile will be visible to the whole team.</p>
128
+ <div slot="footer">
129
+ <ark-button variant="ghost" data-action="cancel">Cancel</ark-button>
130
+ <ark-button intent="primary" data-action="publish">Publish</ark-button>
131
+ </div>
132
+ </ark-dialog>
133
+
134
+ <ark-toaster position="bottom-right"></ark-toaster>
135
+ ```
136
+
137
+ ### Wiring it up
138
+
139
+ ```ts
140
+ import { toast } from "@tooark/core";
141
+
142
+ const form = document.querySelector<HTMLFormElement>("#profile")!;
143
+ const dialog = document.querySelector("ark-dialog")!;
144
+
145
+ form.addEventListener("submit", (event) => {
146
+ event.preventDefault();
147
+ dialog.show(); // top layer, focus trapped, Esc and the scrim close it
148
+ });
149
+
150
+ dialog.addEventListener("click", (event) => {
151
+ const action = (event.target as HTMLElement).closest("[data-action]")?.getAttribute("data-action");
152
+ if (action === "publish") {
153
+ const data = Object.fromEntries(new FormData(form)); // { name, role, since }
154
+ toast.success("Profile published", { description: `Welcome, ${data.name}.` });
155
+ }
156
+ if (action) dialog.close();
157
+ });
158
+ ```
159
+
160
+ ### Data through JS properties and consolidated events
161
+
162
+ ```ts
163
+ const editor = document.querySelector("ark-kv-editor")!;
164
+ editor.rows = [{ id: "1", key: "Accept", value: "application/json", enabled: true }];
165
+ editor.addEventListener("change", (event) => save((event as CustomEvent<{ rows: unknown[] }>).detail.rows));
166
+
167
+ const menu = document.querySelector("ark-menu")!; // for="trigger-id"
168
+ menu.addEventListener("ark-select", (event) => run((event as CustomEvent<{ value: string }>).detail.value));
169
+ ```
170
+
171
+ ---
172
+
173
+ ## 📋 Dependencies
174
+
175
+ Installed automatically unless marked as peer; peer dependencies are yours to install (the ranges are what the package declares).
176
+
177
+ | Package | Version | Description |
178
+ | ---------------------------------------------------------------- | ------- | ---------------------------------------------------------------- |
179
+ | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.0.0 | Types, i18n, toast/announce services, motion and overlay helpers |
180
+ | [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.0.0 | Design tokens (colors, sizes, radii, motion) and primitive types |
181
+ | [`tslib`](https://www.npmjs.com/package/tslib) | ^2.8.1 | TypeScript runtime helpers |
182
+
183
+ ---
184
+
185
+ ## 🪪 Contributing
186
+
187
+ Contributions are welcome! Open issues and pull requests in the [Tooark/web-components](https://github.com/Tooark/web-components/issues) repository; [CONTRIBUTING.md](https://github.com/Tooark/web-components/blob/main/CONTRIBUTING.md) covers the workflow, the commit convention and the checklist. `@tooark/web-components` is released in lockstep with every other `@tooark/*` package.
188
+
189
+ ---
190
+
191
+ ## 📄 License
192
+
193
+ This project is licensed under the Apache License 2.0. See the [LICENSE](https://github.com/Tooark/web-components/blob/main/LICENSE) file for details.
@@ -0,0 +1,193 @@
1
+ # @tooark/web-components
2
+
3
+ [![npm](https://img.shields.io/npm/v/@tooark/web-components?logo=npm&color=CB3837)](https://www.npmjs.com/package/@tooark/web-components)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/Tooark/web-components/blob/main/LICENSE)
5
+
6
+ Os Custom Elements nativos (`ark-*`) do design system Tooark, estilizados com Tailwind v4 sobre design tokens — acessibilidade, teclado e motion embutidos, uma única folha de estilo, nenhum framework necessário.
7
+
8
+ 🌍 **Idiomas:** [![USA Flag](https://flagcdn.com/w20/us.png) English](./README.md) · ![Brazil Flag](https://flagcdn.com/w20/br.png) **Português (este arquivo)**
9
+
10
+ ---
11
+
12
+ ## Conteúdo
13
+
14
+ - [Visão Geral](#-visão-geral)
15
+ - [Instalação](#-instalação)
16
+ - [Configuração](#️-configuração)
17
+ - [Componentes](#-componentes)
18
+ - [Exemplos de Uso](#-exemplos-de-uso)
19
+ - [Dependências](#-dependências)
20
+ - [Contribuição](#-contribuição)
21
+ - [Licença](#-licença)
22
+
23
+ ---
24
+
25
+ ## 📖 Visão Geral
26
+
27
+ O pacote `@tooark/web-components` fornece:
28
+
29
+ - 41 elementos: botões e toggles, campos de formulário (input, textarea, select, checkbox, radio, switch, file input, datepicker, editor chave/valor), overlays sobre a Popover API (dialog, drawer, menu, tooltip, paleta de comandos, toaster), layout (card, tabs, split pane, carousel), feedback (alert, badge, progress, spinner, skeleton, empty, status dot) e a família calendário/relógio/agenda;
30
+ - light DOM: os componentes nunca movem nem envolvem os seus filhos; o host é o controle ou o container;
31
+ - `styles.css` é a única folha de estilo necessária: tokens, presets de motion e estilos dos componentes, tudo com prefixo (`ark:*`, `--ark-*`), sem reset global;
32
+ - temas por `color-scheme` (`theme="light|dark"` por elemento), tamanhos `xs…xl`, intents `primary…neutral`, `rounded`;
33
+ - eventos como `CustomEvent` (`change`, `ark-change`, `ark-select`, …), `testid` repassado como `data-testid` a cada parte interna para E2E.
34
+
35
+ ---
36
+
37
+ ## 🔧 Instalação
38
+
39
+ ```bash
40
+ pnpm add @tooark/web-components # traz @tooark/core e @tooark/tokens
41
+ ```
42
+
43
+ Usa React, Vue ou Angular? Instale `@tooark/react`, `@tooark/vue` ou `@tooark/angular`: eles dependem deste pacote e acrescentam wrappers tipados.
44
+
45
+ ---
46
+
47
+ ## ⚙️ Configuração
48
+
49
+ Importe a folha de estilo uma vez e registre os elementos antes de usá-los:
50
+
51
+ ```ts
52
+ import { registerTooarkComponents } from "@tooark/web-components";
53
+ import "@tooark/web-components/styles.css";
54
+
55
+ registerTooarkComponents(); // idempotente
56
+ ```
57
+
58
+ Declare o `color-scheme` da página para escolher o tema (`light`, `dark` ou `light dark` para seguir o sistema); `theme="light|dark"` num elemento força um lado, e `lang="en|pt|es"` (ou `locale-json`) nos elementos que mostram texto.
59
+
60
+ ---
61
+
62
+ ## 📦 Componentes
63
+
64
+ - `ark-alert` — Alerta/banner: o host é a caixa na cor suave do intent, os filhos são a mensagem (texto livre ou elementos), `slot="icon"` à esquerda, `slot="action"` à direita, `heading`, `dismissible` com saída animada, live region (`status`/`alert`).
65
+ - `ark-avatar` — Avatar (`role="img"` nomeado por `name`): iniciais de `name`, imagem `src` que cai para as iniciais em erro de carga, `size`, `shape` circle/square, `color` própria.
66
+ - `ark-badge` — Rótulo curto de status/categoria: intents, `soft`/`solid`/`outline`, `xs`–`md`, `rounded`, `color` própria via `color-mix`. O host é o badge; ícone e texto ficam como filhos.
67
+ - `ark-button` — Intents, tamanhos, variantes (solid/outline/ghost), `rounded` (até `full`), estados `loading`/`icon-only`/`full-width`, feedback `status` (glifo de sucesso/erro + anúncio) e modo link (`href`).
68
+ - `ark-calendar` — Grid de mês inline: localizado, teclado WAI-ARIA, motion, views de mês/ano no título e eventos com cor (`dots`/`count`/`list`).
69
+ - `ark-card` — Cartão: o host é a caixa (`surface`, `border`, `rounded`) e uma grid: `heading` (h2) ou `slot="header"` com `slot="actions"` na linha de cima, filhos sem slot como corpo, `slot="footer"` por último com divisor; `padding` none–lg.
70
+ - `ark-carousel` — CSS scroll snap nativo (touch/trackpad rolam nativamente, arrasto com mouse emulado), autoplay, loop, dots e setas. Os slides continuam sendo seus filhos diretos.
71
+ - `ark-checkbox` — Checkbox desenhado pelo componente (botão `role="checkbox"` + input nativo oculto para formulário e `<fieldset disabled>`): `checked`, `indeterminate`, `label`/`aria-label`/filhos livres como rótulo, tamanhos, intents. Emite `change`.
72
+ - `ark-clock` — Seleção de hora em colunas digitais (hora/minuto/segundo), 24h/12h, step de minutos, localizado.
73
+ - `ark-color-swatches` — Paleta de cores como `radiogroup`: amostras de `colors` (`{ name, value }[]`, atributo JSON ou propriedade JS), `value`, setas navegam, `disabled`, `size`. Emite `change` com o valor.
74
+ - `ark-command-item` — Item da paleta de comandos (o host é o `role="option"`): filhos livres, `slot="trailing"` para o atalho, `value`, `group`, `label` (texto do filtro), `disabled`. Emite `ark-select`.
75
+ - `ark-command-palette` — Paleta de comandos sobre a Popover API: campo de busca (um `ark-input` próprio), filhos `ark-command-item` agrupados e filtrados (`filter`) ou buscados pelo app (`ark-query`), setas + Enter, `hotkey` (`/`, `mod+k`). Emite `ark-select`, `ark-query`, `ark-open`, `ark-close`.
76
+ - `ark-copy-button` — Botão de copiar: estende o `ark-button` (mesmas variantes, tamanhos, `icon-only`, formulário, hooks); copia `value` ou o elemento de `for`, troca o ícone por um check e o texto/`title` por "copiado" durante `feedback-ms`, anuncia. Emite `ark-copy`.
77
+ - `ark-datepicker` — Compõe `ark-input` + `ark-calendar` + `ark-clock`: `mode` datetime (padrão)/date/time, inline ou campo+popup, parse de digitação, formulário.
78
+ - `ark-dialog` — Diálogo modal sobre a Popover API (top layer, scrim por `::backdrop`, sem portal): o host é o painel, seus filhos são o corpo, `slot="footer"` é o rodapé; cabeçalho de `label`, focus trap, Esc/scrim, `sm`–`xl`.
79
+ - `ark-drawer` — Gaveta ancorada numa borda: `overlay` (Popover API, scrim, focus trap, Esc) ou `inline` (no fluxo da página, ex.: console inferior); `side`, `size` preset ou comprimento CSS, cabeçalho de `label`, `slot="footer"`, slide com o easing `sheet`. Emite `ark-open`/`ark-close`.
80
+ - `ark-empty` — Estado vazio: caixa tracejada com `slot="icon"` apagado, `heading` (h3), `description` e um botão opcional em `slot="action"`; os filhos ficam no lugar, ordenados por CSS.
81
+ - `ark-file-input` — Campo de arquivo com a grid do `ark-input` (label, helper/erro): `<input type="file">` nativo oculto para o formulário, zona de soltar com realce em `dragover`, botão de escolher acessível por teclado, lista dos nomes escolhidos, `accept`/`multiple`. Emite `change` com os arquivos e os anuncia.
82
+ - `ark-input` — Campo de texto padronizado: label, helper/erro com aria, prefixo/sufixo via `slot`, `reveal` de senha, atributos nativos repassados, tamanhos, intents, `rounded`.
83
+ - `ark-kbd` — Tecla de atalho: o host é a tecla (mono, borda, `surface-muted`, aresta inferior) em volta do seu texto; `size`.
84
+ - `ark-kv-editor` — Editor chave/valor: linhas `{ id, key, value, enabled }` (propriedade JS) com ativar, editar, remover, adicionar, colunas opcionais `types`/`secret`/`description`, modo em massa em linhas `chave:valor` ou JSON. Compõe outros controles ark-\*. Emite `change`, `ark-add`, `ark-delete`.
85
+ - `ark-mark` — Marca de escopo: uma de seis formas (`circle`, `square`, `triangle`, `diamond`, `star`, `hexagon`) numa `color`, cor e forma juntas para a identidade nunca depender só da cor; `size`, `label`.
86
+ - `ark-menu` — Menu suspenso/de contexto sobre a Popover API (`role="menu"`, `popover="auto"`): ancorado ao gatilho por `for`, `align`/`direction` com flip, teclado, `openAt(x, y)`; itens ficam como filhos. Emite `ark-select`.
87
+ - `ark-menu-item` — Item de menu (o host é o item): filhos livres, `slot="trailing"`, `disabled`, `intent`, `checked` (item checkbox), `divider`, `static` (conteúdo não interativo).
88
+ - `ark-progress` — Barra de progresso (`role="progressbar"` no host): `value`/`max` com transição de largura pelos tokens, `show-value`, `indeterminate` em loop isento de movimento reduzido, `label`, tamanhos, intents.
89
+ - `ark-radio` — Radio desenhado pelo componente (botão `role="radio"` + input nativo oculto): agrupa por `name` no mesmo form, um tab stop por grupo, setas movem e marcam, `label`/filhos como rótulo. Emite `change` na que marcou.
90
+ - `ark-scheduler` — Agenda com views `week`/`day` (timeline por horário e sobreposição em colunas), `month` e `agenda`; eventos coloridos e clicáveis.
91
+ - `ark-select` — `<select>` nativo estilizado como o `ark-input`: label, helper/erro com aria, `placeholder`, opções por dados (atributo `options` em JSON ou propriedade JS, `group` → `<optgroup>`), tamanhos, intents, `rounded`.
92
+ - `ark-shape-picker` — Seletor de forma como `radiogroup`: as seis formas do `ark-mark` desenhadas em `color`, `value`, setas navegam, nomes das formas localizados, `disabled`, `size`. Emite `change` com a forma.
93
+ - `ark-skeleton` — Placeholder de carregamento: o host é o bloco (`.ark-skeleton`, `aria-hidden`), dimensionado pela sua class/style; `rows` renderiza barras, `animated` liga o pulso, `rounded`.
94
+ - `ark-spinner` — Indicador de carregamento solto (`role="status"`): o SVG do spinner do botão em `.ark-animate-spin` (continua girando sob movimento reduzido), rótulo para leitor de tela por `lang` ou `label`, `size`, `intent` opcional (senão herda a cor do texto).
95
+ - `ark-split-pane` — Painéis redimensionáveis: os seus filhos são os painéis, as alças são nós próprios do componente ao fim do host; `direction`, `sizes` (percentuais, reescritos a cada mudança), `data-min`/`data-max` por painel, teclado e arrasto com pointer capture. Emite `ark-resize`.
96
+ - `ark-status-dot` — Ponto de status: o host é o círculo na cor do intent (padrão `neutral`); `label` o torna um `role="img"` nomeado, sem ele é decorativo; `size`. Estático, nunca pulsa.
97
+ - `ark-switch` — Switch on/off acessível (`role="switch"`): texto ON/OFF e ícones ✓/✕ opcionais, intents, participação em formulário via checkbox oculto.
98
+ - `ark-tab` — Aba (`role="tab"`, o host é o controle): filhos livres, `disabled`, `controls`, `closable` e `dirty` na variante editor. Emite `ark-close`.
99
+ - `ark-tabs` — Faixa de abas (`role="tablist"`): `underline`/`chips`/`editor`, roving tabindex com setas/Home/End, `slot="actions"` no fim, `change` com o value ativo. Painéis ficam com o app.
100
+ - `ark-textarea` — Campo multilinha com a grid do `ark-input`: `rows`, `autosize` (`field-sizing` nativo, fallback JS), `monospace`, `resize`, helper/erro com aria, tamanhos, intents, `rounded`.
101
+ - `ark-toaster` — Toasts no estilo Sonner: API programática, posições, rich colors, ações, entrada/saída animadas, botão de fechar localizado.
102
+ - `ark-toggle` — Botão de estado pressionado (`aria-pressed`), standalone (outline/tinted por intent) ou como item de grupo.
103
+ - `ark-toggle-group` — Segmented control: seleção exclusiva (padrão) ou múltipla, `value` sincronizado, propaga `size`/`intent`/`theme`/`disabled` aos itens.
104
+ - `ark-tooltip` — Tooltip sobre a Popover API: envolve o gatilho sem movê-lo, texto por `content` ou `slot="content"` rico, `side` com flip, `delay`, hover/foco/Esc, `aria-describedby` no gatilho.
105
+
106
+ Referência completa de atributos, guia de tema e hooks de E2E: [https://github.com/Tooark/web-components/blob/main/README.pt-BR.md](https://github.com/Tooark/web-components/blob/main/README.pt-BR.md) · exemplos vivos com testes de interação: [Storybook](https://tooark.com/web-components/).
107
+
108
+ ---
109
+
110
+ ## 📝 Exemplos de Uso
111
+
112
+ ### Um formulário com diálogo de confirmação e toast
113
+
114
+ ```html
115
+ <form id="perfil">
116
+ <ark-input name="nome" label="Nome" placeholder="Seu nome completo" required></ark-input>
117
+ <ark-select
118
+ name="papel"
119
+ label="Papel"
120
+ options='[{"value":"dev","label":"Desenvolvimento"},{"value":"ops","label":"Operações"}]'
121
+ ></ark-select>
122
+ <ark-datepicker input mode="date" lang="pt" name="desde"></ark-datepicker>
123
+ <ark-button type="submit" intent="primary">Salvar</ark-button>
124
+ </form>
125
+
126
+ <ark-dialog id="confirmar" label="Publicar alterações?" lang="pt">
127
+ <p>Seu perfil ficará visível para todo o time.</p>
128
+ <div slot="footer">
129
+ <ark-button variant="ghost" data-action="cancel">Cancelar</ark-button>
130
+ <ark-button intent="primary" data-action="publish">Publicar</ark-button>
131
+ </div>
132
+ </ark-dialog>
133
+
134
+ <ark-toaster position="bottom-right" lang="pt"></ark-toaster>
135
+ ```
136
+
137
+ ### Ligando tudo
138
+
139
+ ```ts
140
+ import { toast } from "@tooark/core";
141
+
142
+ const form = document.querySelector<HTMLFormElement>("#perfil")!;
143
+ const dialog = document.querySelector("ark-dialog")!;
144
+
145
+ form.addEventListener("submit", (event) => {
146
+ event.preventDefault();
147
+ dialog.show(); // top layer, foco preso, Esc e o scrim fecham
148
+ });
149
+
150
+ dialog.addEventListener("click", (event) => {
151
+ const action = (event.target as HTMLElement).closest("[data-action]")?.getAttribute("data-action");
152
+ if (action === "publish") {
153
+ const data = Object.fromEntries(new FormData(form)); // { nome, papel, desde }
154
+ toast.success("Perfil publicado", { description: `Bem-vindo, ${data.nome}.` });
155
+ }
156
+ if (action) dialog.close();
157
+ });
158
+ ```
159
+
160
+ ### Dados por propriedade JS e eventos consolidados
161
+
162
+ ```ts
163
+ const editor = document.querySelector("ark-kv-editor")!;
164
+ editor.rows = [{ id: "1", key: "Accept", value: "application/json", enabled: true }];
165
+ editor.addEventListener("change", (event) => salvar((event as CustomEvent<{ rows: unknown[] }>).detail.rows));
166
+
167
+ const menu = document.querySelector("ark-menu")!; // for="id-do-gatilho"
168
+ menu.addEventListener("ark-select", (event) => executar((event as CustomEvent<{ value: string }>).detail.value));
169
+ ```
170
+
171
+ ---
172
+
173
+ ## 📋 Dependências
174
+
175
+ Instaladas automaticamente, salvo as marcadas como peer, que ficam por sua conta (os ranges são os que o pacote declara).
176
+
177
+ | Pacote | Versão | Descrição |
178
+ | ---------------------------------------------------------------- | ------ | -------------------------------------------------------------------- |
179
+ | [`@tooark/core`](https://www.npmjs.com/package/@tooark/core) | ^1.0.0 | Tipos, i18n, serviços de toast/announce, motion e helpers de overlay |
180
+ | [`@tooark/tokens`](https://www.npmjs.com/package/@tooark/tokens) | ^1.0.0 | Design tokens (cores, tamanhos, raios, motion) e tipos primitivos |
181
+ | [`tslib`](https://www.npmjs.com/package/tslib) | ^2.8.1 | Helpers de runtime do TypeScript |
182
+
183
+ ---
184
+
185
+ ## 🪪 Contribuição
186
+
187
+ Contribuições são bem-vindas! Abra issues e pull requests no repositório [Tooark/web-components](https://github.com/Tooark/web-components/issues); o [CONTRIBUTING.md](https://github.com/Tooark/web-components/blob/main/CONTRIBUTING.md) cobre o fluxo, a convenção de commits e o checklist. O `@tooark/web-components` é publicado em conjunto com todos os outros pacotes `@tooark/*`, numa única versão.
188
+
189
+ ---
190
+
191
+ ## 📄 Licença
192
+
193
+ Este projeto está licenciado sob a licença Apache 2.0. Veja o arquivo [LICENSE](https://github.com/Tooark/web-components/blob/main/LICENSE) para mais detalhes.