@brandrail/kit 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/LICENSE.md +19 -0
  2. package/README.md +80 -2
  3. package/custom-elements.json +3487 -0
  4. package/dist/elements-manifest.js +92 -0
  5. package/dist/elements-tags.d.ts +34 -0
  6. package/dist/elements.js +5695 -0
  7. package/dist/index.js +1847 -0
  8. package/dist/styles.css +1 -0
  9. package/dist/types/components/Avatar/Avatar.d.ts +28 -0
  10. package/dist/types/components/Avatar/AvatarGroup.d.ts +16 -0
  11. package/dist/types/components/Avatar/AvatarLabel.d.ts +20 -0
  12. package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +27 -0
  13. package/dist/types/components/Button/Button.d.ts +30 -0
  14. package/dist/types/components/ButtonGroup/ButtonGroup.d.ts +13 -0
  15. package/dist/types/components/Checkbox/Checkbox.d.ts +9 -0
  16. package/dist/types/components/Checkbox/CheckboxButton.d.ts +15 -0
  17. package/dist/types/components/Checkbox/CheckboxInternal.d.ts +21 -0
  18. package/dist/types/components/CheckboxGroup/CheckboxGroup.d.ts +26 -0
  19. package/dist/types/components/DatePicker/Calendar.d.ts +26 -0
  20. package/dist/types/components/DatePicker/DatePicker.d.ts +35 -0
  21. package/dist/types/components/DatePicker/InternalCalendar.d.ts +31 -0
  22. package/dist/types/components/Divider/Divider.d.ts +17 -0
  23. package/dist/types/components/Dropdown/Dropdown.d.ts +22 -0
  24. package/dist/types/components/Dropdown/List.d.ts +19 -0
  25. package/dist/types/components/Dropdown/ListItem.d.ts +29 -0
  26. package/dist/types/components/InputText/Caption.d.ts +33 -0
  27. package/dist/types/components/InputText/InputText.d.ts +39 -0
  28. package/dist/types/components/InputText/InputTextArea.d.ts +28 -0
  29. package/dist/types/components/Loader/Loader.d.ts +13 -0
  30. package/dist/types/components/Notification/Notification.d.ts +29 -0
  31. package/dist/types/components/ProgressBar/ProgressBar.d.ts +17 -0
  32. package/dist/types/components/Radio/Radio.d.ts +9 -0
  33. package/dist/types/components/Radio/RadioButton.d.ts +15 -0
  34. package/dist/types/components/Radio/RadioInternal.d.ts +19 -0
  35. package/dist/types/components/RadioGroup/RadioGroup.d.ts +26 -0
  36. package/dist/types/components/Scrollbar/Scrollbar.d.ts +17 -0
  37. package/dist/types/components/Toggle/Toggle.d.ts +16 -0
  38. package/dist/types/components/Toggle/ToggleInternal.d.ts +19 -0
  39. package/dist/types/components/Tooltip/Tooltip.d.ts +36 -0
  40. package/dist/types/components/VideoPlayer/VideoPlayer.d.ts +15 -0
  41. package/dist/types/elements/css.d.ts +2 -0
  42. package/dist/types/elements/define.d.ts +29 -0
  43. package/dist/types/elements/index.d.ts +9 -0
  44. package/dist/types/elements/manifest.d.ts +41 -0
  45. package/dist/types/index.d.ts +41 -0
  46. package/dist/types/lib.d.ts +2 -0
  47. package/dist/types/types/global.d.ts +33 -0
  48. package/package.json +55 -4
package/LICENSE.md ADDED
@@ -0,0 +1,19 @@
1
+ # @brandrail/kit licence
2
+
3
+ Copyright © 2026 Thiago Baptistella. All rights reserved.
4
+
5
+ This package is proprietary software. It is published on npm so that customers of Brandrail
6
+ (https://www.brandrail.com.au) can install it; publication does not make it open source.
7
+
8
+ 1. **Use.** You may install and use this package, unmodified, in applications you build, for as long as you
9
+ (or the organisation you work for) have a Brandrail account and comply with the Brandrail Terms of Service.
10
+ You may also evaluate it for up to 30 days without an account.
11
+ 2. **Restrictions.** You may not sell, sublicense or redistribute the package or any part of it on its own
12
+ (for example as a component library, template or design kit), modify it and distribute the result, or
13
+ remove this notice. Shipping it inside your own application's built output is allowed.
14
+ 3. **No warranty.** The package is provided "as is", without warranty of any kind. To the extent permitted by law,
15
+ the author is not liable for any claim, damages or other liability arising from its use.
16
+ 4. **Termination.** These rights end automatically if you breach these terms or your Brandrail account ends,
17
+ except for application builds already deployed.
18
+
19
+ Questions: support@brandrail.com.au
package/README.md CHANGED
@@ -1,3 +1,81 @@
1
- # Temporary Holding Version
1
+ # @brandrail/kit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Brandrail UI kit: React components, and the same components as custom elements for any framework. They follow your Brand Kit through CSS variables.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i @brandrail/kit
9
+ ```
10
+
11
+ React apps also need `react` and `react-dom` 19. Angular, Vue and plain HTML apps use the custom elements (below) and need nothing else. Use is covered by [LICENSE.md](LICENSE.md): free with a Brandrail account.
12
+
13
+ ## Use
14
+
15
+ ```tsx
16
+ import "@brandrail/kit/styles.css";
17
+ import "./brandrail.tokens.css"; // written by `npx brandrail init`: maps your Brand Kit onto the kit
18
+ import { Button, ColorMode } from "@brandrail/kit";
19
+
20
+ export default function App() {
21
+ return (
22
+ <div className="brandrail light">
23
+ <Button theme="brandrail" colorMode={ColorMode.LIGHT} label="Save" />
24
+ </div>
25
+ );
26
+ }
27
+ ```
28
+
29
+ `brandrail init` writes `brandrail.tokens.css` with your published Brand Kit: colours, spacing, radius, type and font. The kit picks them up automatically, whatever order the stylesheets load in.
30
+
31
+ ## Use in any framework (custom elements)
32
+
33
+ Every component is also a custom element: `Button` is `<br-button>`, `DatePicker` is `<br-date-picker>`, and so on (`br-` + the name in kebab-case). One import registers them all; it carries its own small React-compatible runtime (Preact), so the page needs no React. About 59 KB gzipped for all 28.
34
+
35
+ ```js
36
+ import "@brandrail/kit/elements"; // once, at the app entry
37
+ import "./brandrail.tokens.css"; // from `npx brandrail init`: your Brand Kit
38
+ ```
39
+
40
+ - **Attributes** are the React props in kebab-case: `<br-button label="Save" type="cta" size="small">`. Lists and objects take JSON (`items='[{"label":"Home"}]'`) or a property (`el.items = [...]`).
41
+ - **Events** are the callback props as DOM events with the value in `event.detail`: `onChange` → `br-change`, `onClick` → `br-click`. Inputs, checkboxes, toggles, dropdowns and date pickers keep their own value, and expose it as a property (`el.value`, `el.checked`, `el.selected`, `el.selectedDate`).
42
+ - **Children**: containers take kit elements: `<br-button-group><br-button label="Day"></br-button-group>`, `<br-dropdown><br-list-item label="Brake" value="brake"></br-dropdown>`, `<br-radio-group>` with `<br-radio>`, `<br-checkbox-group>` with `<br-checkbox>`. `<br-tooltip content="…">` wraps any content.
43
+ - **Theme**: `theme="brandrail"` is the default; dark mode with `color-mode="dark"` or a `dark` class on any ancestor.
44
+ - **Styles** are added to the page once by the import. With a strict Content Security Policy (no inline styles), link `dist/styles.css` yourself with a `data-brandrail-kit` attribute and nothing is injected.
45
+
46
+ **Angular** (any version with Ivy, including 14):
47
+
48
+ ```ts
49
+ @NgModule({ /* … */ schemas: [CUSTOM_ELEMENTS_SCHEMA] }) // or in a standalone component's `schemas`
50
+ ```
51
+ ```html
52
+ <br-input-text label="Truck ID" [value]="id" (br-change)="id = $any($event).detail"></br-input-text>
53
+ <br-breadcrumb [items]="crumbs"></br-breadcrumb>
54
+ <!-- Angular types $event on unknown elements as Event: read the value with $any($event).detail. -->
55
+ ```
56
+
57
+ **Vue 3**: tell the compiler the tags are custom elements, then bind as usual:
58
+
59
+ ```js
60
+ // vite.config.js
61
+ vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.startsWith("br-") } } })
62
+ ```
63
+ ```html
64
+ <br-toggle label="Alerts" :checked="on" @br-change="on = $event.detail" />
65
+ ```
66
+
67
+ **Plain HTML, PHP, Twig, Mustache**: copy `dist/elements.js` into your assets and load it once with `<script type="module" src="/assets/elements.js"></script>`.
68
+
69
+ Editors: `custom-elements.json` (in the package) gives VS Code and JetBrains attribute completion; `dist/elements-tags.d.ts` types `document.querySelector("br-button")`.
70
+
71
+ ## Publishing (maintainers)
72
+
73
+ Published to the public npm registry as `@brandrail/kit` (built files only: minified, no source maps, no TypeScript source; the script refuses to publish if any slip in). Needs an npm account in the `brandrail` npm organisation (`npm login` first).
74
+
75
+ ```bash
76
+ cd packages/kit
77
+ pnpm run publish:npm -- --dry-run # lists exactly what would be published
78
+ pnpm run publish:npm
79
+ ```
80
+
81
+ Bump `version` in `package.json` before each release. Inside the monorepo the web app uses the TypeScript source directly. (`publish:github` still publishes the old private GitHub Packages copy.)