@stealthscale/component-actions 0.1.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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Stealth Scale B.V.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # @stealthscale/component-actions
2
+
3
+ Draws what a person presses: the button, and the square button that holds one glyph. Every component
4
+ binds a recipe and draws nothing of its own, so a theme restyles all of them by extending the
5
+ recipe. The preset under `./theme` registers the recipes with an application's compiler.
6
+
7
+ Every value a theme can change on a component is an axis of its recipe, so a caller sets it as a
8
+ prop and writes no style. A caller changes the element a component draws with `as`.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pnpm add @stealthscale/component-actions
14
+ ```
15
+
16
+ The package peers on `react` and `@stealthscale/theme`. An application lists the preset under
17
+ `./theme` among the presets its compiler installs.
18
+
19
+ ## Button
20
+
21
+ Draws the element a person presses, in a look, a size and a status, raised off the page and glowing
22
+ or rippling where a page sets that effect. Under a press the look fills to its pressed colour, the
23
+ box scales to 98 percent, and an elevated button drops towards the page. A button that opens with a
24
+ mark leads with one step less inset, so the room before the mark is the width of the gap after it
25
+ rather than a word's worth. The element is `button`, and `type` defaults to `button` so one inside a
26
+ form does not send it.
27
+
28
+ ```tsx
29
+ import { Button, ButtonPropsProvider } from "@stealthscale/component-actions";
30
+
31
+ <Button size="lg" variant="outline">
32
+ Save
33
+ </Button>;
34
+ <Button as="a">Read on</Button>;
35
+ <ButtonPropsProvider value={{ size: "sm", variant: "subtle" }}>
36
+ <Button>Cancel</Button>
37
+ <Button variant="solid">Save</Button>
38
+ </ButtonPropsProvider>;
39
+ ```
40
+
41
+ `ButtonPropsProvider` sets the variants of every button below it. A prop on the button itself
42
+ overrides the provider's.
43
+
44
+ The `glass` look is translucent, so the contrast of its label depends on what sits behind it. The
45
+ theme's contrast gate measures the opaque looks alone, and a page puts a glass button on a surface
46
+ it has checked.
47
+
48
+ | Axis | Values | Default |
49
+ | ----------- | ------------------------------------------------------------------ | ------- |
50
+ | `variant` | `solid`, `subtle`, `surface`, `outline`, `ghost`, `plain`, `glass` | `solid` |
51
+ | `size` | `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `3xl`, `4xl` | `md` |
52
+ | `status` | `info`, `success`, `warning`, `error` | primary |
53
+ | `shape` | `square` | none |
54
+ | `effect` | `glow`, `ripple` | none |
55
+ | `elevation` | `raised`, `floating` | flat |
56
+
57
+ ## IconButton
58
+
59
+ Draws a button that holds one glyph and no words. It binds the button's recipe with the square shape
60
+ as its default, so it takes every axis a button takes and a theme that moves the button moves it
61
+ too. A glyph names nothing, so the props require an accessible name: `aria-label`, or
62
+ `aria-labelledby` pointing at the element that holds the words. The type refuses an icon button
63
+ without one.
64
+
65
+ ```tsx
66
+ import { IconButton } from "@stealthscale/component-actions";
67
+ import { Icon } from "@stealthscale/component-typography";
68
+
69
+ <IconButton aria-label="Close" variant="ghost">
70
+ <Icon>
71
+ <path d="M6 6l12 12M18 6L6 18" />
72
+ </Icon>
73
+ </IconButton>;
74
+ ```
75
+
76
+ ## Licence
77
+
78
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1 @@
1
+ {"$schema":"http://cyclonedx.org/schema/bom-1.7.schema.json","bomFormat":"CycloneDX","specVersion":"1.7","version":1,"metadata":{"lifecycles":[{"phase":"build"}],"tools":{"components":[{"type":"application","name":"rolldown","version":"1.2.7"},{"type":"application","name":"vite","version":"8.2.2"},{"type":"library","name":"core","group":"@arethetypeswrong","version":"0.18.5","bom-ref":"pkg:npm/%40arethetypeswrong/core@0.18.5","author":"Andrew Branch","description":"The API behind arethetypeswrong.github.io","hashes":[{"alg":"SHA-512","content":"f72b63cc6c318e6f54cfb23d6af7dbb79be542deae93db914444b3263aabce797a58abc8e9dc184e8faf277534d96aeafe64778aa97f3f386f1e129d2480230d"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40arethetypeswrong/core@0.18.5","externalReferences":[{"url":"https://github.com/arethetypeswrong/arethetypeswrong.github.io.git#packages/core","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=20"}]},{"type":"library","name":"theme","group":"@stealthscale","version":"0.3.0","bom-ref":"pkg:npm/%40stealthscale/theme@0.3.0","description":"Publishes the foundation every recipe is written against, the runtime every component binds its recipe with, and the vocabulary a theme is written in.","licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40stealthscale/theme@0.3.0","externalReferences":[{"url":"https://github.com/stealth-scale/config/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs\""},{"url":"git+https://github.com/stealth-scale/config.git#foundations/theme","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://github.com/stealth-scale/config/tree/main/foundations/theme#readme","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=26.0.0"}]},{"type":"library","name":"vite-config-react","group":"@stealthscale","version":"0.8.0","bom-ref":"pkg:npm/%40stealthscale/vite-config-react@0.8.0","description":"Adds the JSX transform, the React lint rules, a test document and an MDX compiler to a package that renders.","licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40stealthscale/vite-config-react@0.8.0","externalReferences":[{"url":"https://github.com/stealth-scale/config/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs\""},{"url":"git+https://github.com/stealth-scale/config.git#packages/vite-config-react","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://github.com/stealth-scale/config/tree/main/packages/vite-config-react#readme","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=26.0.0"}]},{"type":"library","name":"vite-config-theme","group":"@stealthscale","version":"0.1.0","bom-ref":"pkg:npm/%40stealthscale/vite-config-theme@0.1.0","description":"Adds the runtime generator to a design-system package and the stylesheet compiler to an application.","licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40stealthscale/vite-config-theme@0.1.0","externalReferences":[{"url":"https://github.com/stealth-scale/config/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs\""},{"url":"git+https://github.com/stealth-scale/config.git#packages/vite-config-theme","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://github.com/stealth-scale/config/tree/main/packages/vite-config-theme#readme","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=26.0.0"}]},{"type":"library","name":"vite-config-typescript","group":"@stealthscale","version":"0.3.0","bom-ref":"pkg:npm/%40stealthscale/vite-config-typescript@0.3.0","description":"Sets the TypeScript options every stealthscale package compiles with.","licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40stealthscale/vite-config-typescript@0.3.0","externalReferences":[{"url":"https://github.com/stealth-scale/config/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs\""},{"url":"git+https://github.com/stealth-scale/config.git#packages/vite-config-typescript","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://github.com/stealth-scale/config/tree/main/packages/vite-config-typescript#readme","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=26.0.0"}]},{"type":"library","name":"vite-config","group":"@stealthscale","version":"0.6.0","bom-ref":"pkg:npm/%40stealthscale/vite-config@0.6.0","description":"Configures a package from five Vite+ tiers and a named layer for every block.","licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40stealthscale/vite-config@0.6.0","externalReferences":[{"url":"https://github.com/stealth-scale/config/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs\""},{"url":"git+https://github.com/stealth-scale/config.git#packages/vite-config","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://github.com/stealth-scale/config/tree/main/packages/vite-config#readme","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=26.0.0"}]},{"type":"library","name":"react","group":"@testing-library","version":"16.3.3","bom-ref":"pkg:npm/%40testing-library/react@16.3.3","author":"Kent C. Dodds <me@kentcdodds.com> (https://kentcdodds.com)","description":"Simple and complete React DOM testing utilities that encourage good testing practices.","hashes":[{"alg":"SHA-512","content":"528d7ddcd8106cf333ea5aeb86d45040570c0ba45efc42cb15b6ee54bdf4583959c65a597fdfe53074c05713d12f0d6ad62bbd389991d5cd812e210d46cb5d06"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40testing-library/react@16.3.3","externalReferences":[{"url":"https://github.com/testing-library/react-testing-library/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs.url\""},{"url":"https://github.com/testing-library/react-testing-library","type":"vcs","comment":"as detected from PackageJson property \"repository.url\""},{"url":"https://github.com/testing-library/react-testing-library#readme","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=18"}]},{"type":"library","name":"react-dom","group":"@types","version":"19.3.0","bom-ref":"pkg:npm/%40types/react-dom@19.3.0","description":"TypeScript definitions for react-dom","hashes":[{"alg":"SHA-512","content":"648edb538da66575ca1e7fea34b130d88adb888354ed7e7ebdf81d8b10479023696165e32a07d0fcffaec866f90a338b07d51c9d37a0debca542d5768729b8e1"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40types/react-dom@19.3.0","externalReferences":[{"url":"https://github.com/DefinitelyTyped/DefinitelyTyped.git#types/react-dom","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom","type":"website","comment":"as detected from PackageJson property \"homepage\""}]},{"type":"library","name":"react","group":"@types","version":"19.3.0","bom-ref":"pkg:npm/%40types/react@19.3.0","description":"TypeScript definitions for react","hashes":[{"alg":"SHA-512","content":"374ac50ae1fd628c46f7f9bad65f4c7e924a7e62ce554d1e9bb8a9233e9346049292f45e2c1f6f2fce4607ecabf01b3995eaa9be0f7a252c05e194b5b38be242"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40types/react@19.3.0","externalReferences":[{"url":"https://github.com/DefinitelyTyped/DefinitelyTyped.git#types/react","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react","type":"website","comment":"as detected from PackageJson property \"homepage\""}]},{"type":"library","name":"babel-plugin-react-compiler","version":"1.0.0","bom-ref":"pkg:npm/babel-plugin-react-compiler@1.0.0","description":"Babel plugin for React Compiler.","hashes":[{"alg":"SHA-512","content":"2319bcb457e828a20f61d0822984ecaaff85778209d0342a3321229a8fa9c5438c511f5c54f9704eb16df40beefb771be99a77980ce5fadd4cac6d9fc712acc7"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/babel-plugin-react-compiler@1.0.0","externalReferences":[{"url":"git+https://github.com/facebook/react.git#compiler/packages/babel-plugin-react-compiler","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""}]},{"type":"library","name":"happy-dom","version":"20.14.5","bom-ref":"pkg:npm/happy-dom@20.14.5","author":"David Ortner","description":"Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. It includes many web standards from WHATWG DOM and HTML.","hashes":[{"alg":"SHA-512","content":"c7f47392958ee346d38c8a13df4890b6deb814b2e61ff89171408dd97fff6cbc7b1f789f91d7cf5f2aacae8fce62dab32008622cc300ee69a2391f42dcd38a8d"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/happy-dom@20.14.5","externalReferences":[{"url":"https://github.com/capricorn86/happy-dom","type":"vcs","comment":"as detected from PackageJson property \"repository\""},{"url":"https://github.com/capricorn86/happy-dom","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=20.0.0"}]},{"type":"library","name":"oxc-transform-react","version":"0.149.0","bom-ref":"pkg:npm/oxc-transform-react@0.149.0","author":"Boshen and oxc contributors","description":"Oxc React Compiler Node API","hashes":[{"alg":"SHA-512","content":"69bdddc5c3ed90349f211f6d35dc4752d9a974bd258479ddb010fd214014e41c6d26dc061bff39367473b367f62b0a2e3641e5edc692b3030b41e52fc3714447"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/oxc-transform-react@0.149.0","externalReferences":[{"url":"https://github.com/oxc-project/oxc/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs\""},{"url":"git+https://github.com/oxc-project/oxc.git#napi/transform-react","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://oxc.rs","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":"^20.19.0 || >=22.12.0"}]},{"type":"library","name":"react-dom","version":"19.3.0","bom-ref":"pkg:npm/react-dom@19.3.0","description":"React package for working with the DOM.","hashes":[{"alg":"SHA-512","content":"24393c76089fe753a31680c4ef4f8e4fd202c98afeebd1e59a284dc29d7e36c7db9dadede6c22209af59264b43990e3fd5bfeb9f6ea1200476b985c332be6bd1"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/react-dom@19.3.0","externalReferences":[{"url":"https://github.com/react/react/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs.url\""},{"url":"https://github.com/react/react.git#packages/react-dom","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://react.dev/","type":"website","comment":"as detected from PackageJson property \"homepage\""}]},{"type":"library","name":"react","version":"19.3.0","bom-ref":"pkg:npm/react@19.3.0","description":"React is a JavaScript library for building user interfaces.","hashes":[{"alg":"SHA-512","content":"13c2d471bb415addb46db9766281dfc7864305dc554df38ab42667f5c0d227897afe7ba8029729201723e3bb76c19a155fc836647b8c1db892860091d53e52a2"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/react@19.3.0","externalReferences":[{"url":"https://github.com/react/react/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs\""},{"url":"https://github.com/react/react.git#packages/react","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://react.dev/","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=0.10.0"}]},{"type":"library","name":"typescript","version":"7.0.2","bom-ref":"pkg:npm/typescript@7.0.2","author":"Microsoft Corp.","description":"TypeScript is a language for application scale JavaScript development","hashes":[{"alg":"SHA-512","content":"f0561abbdea8dcd28e85b8ca8bfa8dbc6fd6e63873c646dd9b9b23f406d9ff94f9b16aa7de12602df1b1dbbb11299593bf2cc23fc74b4414dfe6d05349155434"}],"licenses":[{"license":{"id":"Apache-2.0"}}],"purl":"pkg:npm/typescript@7.0.2","externalReferences":[{"url":"https://github.com/microsoft/TypeScript/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs.url\""},{"url":"https://github.com/microsoft/TypeScript.git","type":"vcs","comment":"as detected from PackageJson property \"repository.url\""},{"url":"https://www.typescriptlang.org/","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=16.20.0"}]},{"type":"library","name":"vitest","version":"4.1.11","bom-ref":"pkg:npm/vitest@4.1.11","author":"Anthony Fu <anthonyfu117@hotmail.com>","description":"Next generation testing framework powered by Vite","hashes":[{"alg":"SHA-512","content":"7e1002acd5d489d21b19206be4595bb8190eed5582d59c8b9740cee025360eb42800fc57f3862cc6cf877864298a2e656565754388016534eee3d985f80e8477"}],"licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/vitest@4.1.11","externalReferences":[{"url":"https://github.com/vitest-dev/vitest/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs.url\""},{"url":"git+https://github.com/vitest-dev/vitest.git#packages/vitest","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://vitest.dev","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":"^20.0.0 || ^22.0.0 || >=24.0.0"}]}]},"component":{"type":"library","name":"component-actions","group":"@stealthscale","version":"0.1.0","bom-ref":"pkg:npm/%40stealthscale/component-actions@0.1.0","description":"Draws what a person presses: a button, a toggle, and the triggers that carry an action.","licenses":[{"license":{"id":"MIT"}}],"purl":"pkg:npm/%40stealthscale/component-actions@0.1.0","externalReferences":[{"url":"https://github.com/stealth-scale/config/issues","type":"issue-tracker","comment":"as detected from PackageJson property \"bugs\""},{"url":"git+https://github.com/stealth-scale/config.git#components/actions","type":"vcs","comment":"as detected from PackageJson property \"repository.url\" and \"repository.directory\""},{"url":"https://github.com/stealth-scale/config/tree/main/components/actions#readme","type":"website","comment":"as detected from PackageJson property \"homepage\""}],"properties":[{"name":"cdx:npm:package:constraint:engine:node","value":">=26.0.0"}],"evidence":{"licenses":[{"license":{"name":"file: LICENSE","text":{"content":"TUlUIExpY2Vuc2UKCkNvcHlyaWdodCAoYykgMjAyNiBTdGVhbHRoIFNjYWxlIEIuVi4KClBlcm1pc3Npb24gaXMgaGVyZWJ5IGdyYW50ZWQsIGZyZWUgb2YgY2hhcmdlLCB0byBhbnkgcGVyc29uIG9idGFpbmluZyBhIGNvcHkKb2YgdGhpcyBzb2Z0d2FyZSBhbmQgYXNzb2NpYXRlZCBkb2N1bWVudGF0aW9uIGZpbGVzICh0aGUgIlNvZnR3YXJlIiksIHRvIGRlYWwKaW4gdGhlIFNvZnR3YXJlIHdpdGhvdXQgcmVzdHJpY3Rpb24sIGluY2x1ZGluZyB3aXRob3V0IGxpbWl0YXRpb24gdGhlIHJpZ2h0cwp0byB1c2UsIGNvcHksIG1vZGlmeSwgbWVyZ2UsIHB1Ymxpc2gsIGRpc3RyaWJ1dGUsIHN1YmxpY2Vuc2UsIGFuZC9vciBzZWxsCmNvcGllcyBvZiB0aGUgU29mdHdhcmUsIGFuZCB0byBwZXJtaXQgcGVyc29ucyB0byB3aG9tIHRoZSBTb2Z0d2FyZSBpcwpmdXJuaXNoZWQgdG8gZG8gc28sIHN1YmplY3QgdG8gdGhlIGZvbGxvd2luZyBjb25kaXRpb25zOgoKVGhlIGFib3ZlIGNvcHlyaWdodCBub3RpY2UgYW5kIHRoaXMgcGVybWlzc2lvbiBub3RpY2Ugc2hhbGwgYmUgaW5jbHVkZWQgaW4gYWxsCmNvcGllcyBvciBzdWJzdGFudGlhbCBwb3J0aW9ucyBvZiB0aGUgU29mdHdhcmUuCgpUSEUgU09GVFdBUkUgSVMgUFJPVklERUQgIkFTIElTIiwgV0lUSE9VVCBXQVJSQU5UWSBPRiBBTlkgS0lORCwgRVhQUkVTUyBPUgpJTVBMSUVELCBJTkNMVURJTkcgQlVUIE5PVCBMSU1JVEVEIFRPIFRIRSBXQVJSQU5USUVTIE9GIE1FUkNIQU5UQUJJTElUWSwKRklUTkVTUyBGT1IgQSBQQVJUSUNVTEFSIFBVUlBPU0UgQU5EIE5PTklORlJJTkdFTUVOVC4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFCkFVVEhPUlMgT1IgQ09QWVJJR0hUIEhPTERFUlMgQkUgTElBQkxFIEZPUiBBTlkgQ0xBSU0sIERBTUFHRVMgT1IgT1RIRVIKTElBQklMSVRZLCBXSEVUSEVSIElOIEFOIEFDVElPTiBPRiBDT05UUkFDVCwgVE9SVCBPUiBPVEhFUldJU0UsIEFSSVNJTkcgRlJPTSwKT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgU09GVFdBUkUgT1IgVEhFIFVTRSBPUiBPVEhFUiBERUFMSU5HUyBJTiBUSEUKU09GVFdBUkUuCg==","contentType":"text/plain","encoding":"base64"}}}]}},"supplier":{"name":"Stealth Scale B.V.","url":["https://stealthscale.io"]}},"components":[],"dependencies":[{"ref":"pkg:npm/%40stealthscale/component-actions@0.1.0"}]}
@@ -0,0 +1,99 @@
1
+ import { ComponentProps, JSX } from "react";
2
+ //#region src/button/button.d.ts
3
+ /**
4
+ * Draws a button in a look, a size and a status, square where it holds one glyph.
5
+ */
6
+ export declare const Button: import("@stealthscale/theme").StyledComponent<"button", {
7
+ readonly effect?: "glow" | "ripple";
8
+ readonly elevation?: import("@stealthscale/theme/authoring").Lift;
9
+ readonly shape?: "square";
10
+ readonly size?: import("@stealthscale/theme/authoring").Scale;
11
+ readonly status?: "error" | "info" | "success" | "warning";
12
+ readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
13
+ }>;
14
+ /**
15
+ * Describes what a button takes: the variants its recipe offers, and everything a styled button
16
+ * element takes.
17
+ */
18
+ type ButtonProps = ComponentProps<typeof Button>;
19
+ //#endregion
20
+ //#region src/button/context.d.ts
21
+ /**
22
+ * Binds the button's recipe to the elements that draw it.
23
+ *
24
+ * @remarks
25
+ * Apart from the recipe, because an application's compiler reads the recipe at build time and
26
+ * the binding needs the runtime. A recipe file that also bound one would put the runtime behind
27
+ * every compiler configuration that reads it.
28
+ */
29
+ /**
30
+ * Binds the recipe once, for the button, for the square that holds one glyph, and for whatever
31
+ * sets their variants from above.
32
+ */
33
+ declare const PropsProvider: import("react").Provider<import("@stealthscale/theme").DataAttrs & Partial<{
34
+ readonly effect?: "glow" | "ripple";
35
+ readonly elevation?: import("@stealthscale/theme/authoring").Lift;
36
+ readonly shape?: "square";
37
+ readonly size?: import("@stealthscale/theme/authoring").Scale;
38
+ readonly status?: "error" | "info" | "success" | "warning";
39
+ readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
40
+ }>>, withContext: <Tag extends import("react").ElementType>(Component: Tag, options?: import("@stealthscale/theme").JsxFactoryOptions<import("@stealthscale/theme").ComponentProps<Tag> & Partial<{
41
+ readonly effect?: "glow" | "ripple";
42
+ readonly elevation?: import("@stealthscale/theme/authoring").Lift;
43
+ readonly shape?: "square";
44
+ readonly size?: import("@stealthscale/theme/authoring").Scale;
45
+ readonly status?: "error" | "info" | "success" | "warning";
46
+ readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
47
+ }>> | undefined) => import("@stealthscale/theme").StyledComponent<Tag, {
48
+ readonly effect?: "glow" | "ripple";
49
+ readonly elevation?: import("@stealthscale/theme/authoring").Lift;
50
+ readonly shape?: "square";
51
+ readonly size?: import("@stealthscale/theme/authoring").Scale;
52
+ readonly status?: "error" | "info" | "success" | "warning";
53
+ readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
54
+ }>;
55
+ //#endregion
56
+ //#region src/button/icon-button.d.ts
57
+ /**
58
+ * Binds the button's recipe with the square shape fixed, beside the button's own default type.
59
+ */
60
+ declare const Square: import("@stealthscale/theme").StyledComponent<"button", {
61
+ readonly effect?: "glow" | "ripple";
62
+ readonly elevation?: import("@stealthscale/theme/authoring").Lift;
63
+ readonly shape?: "square";
64
+ readonly size?: import("@stealthscale/theme/authoring").Scale;
65
+ readonly status?: "error" | "info" | "success" | "warning";
66
+ readonly variant?: "ghost" | "glass" | "outline" | "plain" | "solid" | "subtle" | "surface";
67
+ }>;
68
+ /**
69
+ * Gives the control a label of its own.
70
+ */
71
+ interface Labelled {
72
+ /**
73
+ * The words that name the control.
74
+ */
75
+ "aria-label": string;
76
+ }
77
+ /**
78
+ * Points the control at the element that holds its name.
79
+ */
80
+ interface LabelledBy {
81
+ /**
82
+ * The id of the element that holds the words.
83
+ */
84
+ "aria-labelledby": string;
85
+ }
86
+ /**
87
+ * Requires an accessible name for a control whose content gives it none.
88
+ */
89
+ type Named = Labelled | LabelledBy;
90
+ /**
91
+ * Describes what an icon button takes: everything a button takes, and an accessible name.
92
+ */
93
+ type IconButtonProps = ComponentProps<typeof Square> & Named;
94
+ /**
95
+ * Draws a square button in a look, a size and a status, named in words for the glyph it holds.
96
+ */
97
+ export declare const IconButton: (props: IconButtonProps) => JSX.Element;
98
+ //#endregion
99
+ export { type ButtonProps, PropsProvider as ButtonPropsProvider, type IconButtonProps };
package/dist/index.js ADDED
@@ -0,0 +1,32 @@
1
+ import { t as recipe } from "./recipe-19HSwhAG.js";
2
+ import "react";
3
+ import { createRecipeContext } from "@stealthscale/theme";
4
+ //#region src/button/context.ts
5
+ /**
6
+ * Binds the button's recipe to the elements that draw it.
7
+ *
8
+ * @remarks
9
+ * Apart from the recipe, because an application's compiler reads the recipe at build time and
10
+ * the binding needs the runtime. A recipe file that also bound one would put the runtime behind
11
+ * every compiler configuration that reads it.
12
+ */
13
+ /**
14
+ * Binds the recipe once, for the button, for the square that holds one glyph, and for whatever
15
+ * sets their variants from above.
16
+ */
17
+ const { PropsProvider, withContext } = createRecipeContext(recipe);
18
+ //#endregion
19
+ //#region src/button/button.ts
20
+ /**
21
+ * Draws a button in a look, a size and a status, square where it holds one glyph.
22
+ */
23
+ const Button = withContext("button", { defaultProps: { type: "button" } });
24
+ /**
25
+ * Draws a square button in a look, a size and a status, named in words for the glyph it holds.
26
+ */
27
+ const IconButton = withContext("button", { defaultProps: {
28
+ shape: "square",
29
+ type: "button"
30
+ } });
31
+ //#endregion
32
+ export { Button, PropsProvider as ButtonPropsProvider, IconButton };
@@ -0,0 +1,70 @@
1
+ import { controlSizes, defineRecipe, interactive, liftVariants, lookVariants, statusVariants, touchTarget } from "@stealthscale/theme/authoring";
2
+ //#region src/button/recipe.ts
3
+ /**
4
+ * States what a button is: the element a person presses, drawn in a look and a size, in the
5
+ * palette of its status, square where it holds one glyph, and glowing where a page asks.
6
+ *
7
+ * @remarks
8
+ * Every value is a layer style, a semantic control height, a semantic inset, a label role or a
9
+ * palette, so a theme moves all of them. The interactive fragment gives the cursor, the focus
10
+ * ring, the disabled layer and the transitions every control shares, and the touch target widens
11
+ * the hit area on a coarse pointer without moving the box. The border is drawn transparent at the
12
+ * small width in every look, so the outline look changes its colour and not its size. A press is
13
+ * read from the look's own pressed fill and from the elevation dropping under the pointer. The
14
+ * box scales rather than shifting, because a control that shifts under a press is one a reader
15
+ * can miss. The square is listed under `staticCss`, because the icon button fixes it through a
16
+ * default prop and no JSX literal writes it for the compiler to extract.
17
+ */
18
+ /**
19
+ * Draws a button on the primary palette in the solid look and the middle size until a caller says
20
+ * otherwise, set inline so it sits in a line of controls.
21
+ */
22
+ const recipe = defineRecipe({
23
+ base: {
24
+ ...interactive(),
25
+ ...touchTarget(),
26
+ alignItems: "center",
27
+ appearance: "none",
28
+ borderColor: "transparent",
29
+ borderRadius: "l2",
30
+ borderWidth: "sm",
31
+ colorPalette: "primary",
32
+ display: "inline-flex",
33
+ flexShrink: "0",
34
+ fontWeight: "medium",
35
+ justifyContent: "center",
36
+ verticalAlign: "middle",
37
+ whiteSpace: "nowrap"
38
+ },
39
+ className: "button",
40
+ compoundVariants: [{
41
+ css: { "&:has(> svg:first-child)": { paddingInline: "0" } },
42
+ name: "squared",
43
+ shape: "square"
44
+ }],
45
+ defaultVariants: {
46
+ size: "md",
47
+ variant: "solid"
48
+ },
49
+ jsx: [/Button$/u],
50
+ staticCss: [{ shape: ["square"] }],
51
+ variants: {
52
+ effect: {
53
+ glow: { layerStyle: "glow.md" },
54
+ ripple: { layerStyle: "ripple" }
55
+ },
56
+ elevation: liftVariants(),
57
+ shape: { square: {
58
+ aspectRatio: "square",
59
+ paddingInline: "0"
60
+ } },
61
+ size: controlSizes(),
62
+ status: statusVariants(),
63
+ variant: {
64
+ ...lookVariants(),
65
+ glass: { layerStyle: "glass" }
66
+ }
67
+ }
68
+ });
69
+ //#endregion
70
+ export { recipe as t };
@@ -0,0 +1,12 @@
1
+ //#region src/theme.d.ts
2
+ /**
3
+ * Publishes the preset that registers every recipe in this package, for an application's compiler
4
+ * to install.
5
+ *
6
+ * @remarks
7
+ * The list is written by hand. The package's own specification reports a recipe file the list
8
+ * leaves out, so no generator runs here.
9
+ */
10
+ declare const _default: import("@stealthscale/theme/authoring").Preset;
11
+ //#endregion
12
+ export { _default as default };
package/dist/theme.js ADDED
@@ -0,0 +1,17 @@
1
+ import { t as recipe } from "./recipe-19HSwhAG.js";
2
+ import { definePreset } from "@stealthscale/theme/authoring";
3
+ //#region src/theme.ts
4
+ /**
5
+ * Publishes the preset that registers every recipe in this package, for an application's compiler
6
+ * to install.
7
+ *
8
+ * @remarks
9
+ * The list is written by hand. The package's own specification reports a recipe file the list
10
+ * leaves out, so no generator runs here.
11
+ */
12
+ var theme_default = definePreset({
13
+ name: "@stealthscale/component-actions",
14
+ theme: { extend: { recipes: { button: recipe } } }
15
+ });
16
+ //#endregion
17
+ export { theme_default as default };
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@stealthscale/component-actions",
3
+ "version": "0.1.0",
4
+ "description": "Draws what a person presses: a button, a toggle, and the triggers that carry an action.",
5
+ "keywords": [
6
+ "actions",
7
+ "button",
8
+ "components",
9
+ "react"
10
+ ],
11
+ "homepage": "https://github.com/stealth-scale/config/tree/main/components/actions#readme",
12
+ "bugs": "https://github.com/stealth-scale/config/issues",
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/stealth-scale/config.git",
17
+ "directory": "components/actions"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "LICENSE",
22
+ "README.md"
23
+ ],
24
+ "type": "module",
25
+ "sideEffects": false,
26
+ "imports": {
27
+ "#*": "./src/*"
28
+ },
29
+ "exports": {
30
+ ".": "./dist/index.js",
31
+ "./theme": "./dist/theme.js",
32
+ "./package.json": "./package.json"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "devDependencies": {
38
+ "@arethetypeswrong/core": "^0.18.5",
39
+ "@rolldown/plugin-babel": "^0.2.4",
40
+ "@stealthscale/theme": "^0.3.0",
41
+ "@stealthscale/vite-config": "^0.6.0",
42
+ "@stealthscale/vite-config-react": "^0.8.0",
43
+ "@stealthscale/vite-config-theme": "^0.1.0",
44
+ "@stealthscale/vite-config-typescript": "^0.3.0",
45
+ "@testing-library/react": "^16.3.0",
46
+ "@types/react": "^19.3.0",
47
+ "@types/react-dom": "^19.3.0",
48
+ "babel-plugin-react-compiler": "^1.0.0",
49
+ "happy-dom": "^20.14.3",
50
+ "oxc-transform-react": "^0.149.0",
51
+ "publint": "^0.3.24",
52
+ "react": "^19.3.0",
53
+ "react-dom": "^19.3.0",
54
+ "typescript": "^7.0.2",
55
+ "vitest": "4.1.11"
56
+ },
57
+ "peerDependencies": {
58
+ "@stealthscale/theme": "^0.3.0",
59
+ "react": "^19.3.0"
60
+ },
61
+ "engines": {
62
+ "node": ">=26.0.0"
63
+ },
64
+ "scripts": {
65
+ "build": "vp pack",
66
+ "check": "vp check",
67
+ "test": "vp test"
68
+ }
69
+ }