@atomic-ui/ui-react 0.0.0-stage → 0.1.1

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 CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # @atomic-ui/ui-react
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
+ React components for the `@atomic-ui/ui` custom elements. Each one has typed props and typed events, and sets properties on the element where React 18 would otherwise only set attributes.
4
+
5
+ ```tsx
6
+ import '@atomic-ui/ui';
7
+ import { Button, TextInput } from '@atomic-ui/ui-react';
8
+
9
+ <TextInput label="Postcode" onChange={(e) => setPostcode(e.detail.value)} />
10
+ <Button variant="primary">Continue</Button>
11
+ ```
12
+
13
+ Import `@atomic-ui/ui` once, so the custom elements are defined before React renders them.
@@ -0,0 +1,29 @@
1
+ import { type EventName } from '@lit/react';
2
+ import { ImpktButton, ImpktTextInput, ImpktSelect, ImpktCheckbox, ImpktRadioGroup, ImpktAlert, ImpktStack, ImpktCard, ImpktHeading, ImpktText, ImpktGrid, ImpktHelp } from '@atomic-ui/ui';
3
+ /** What a control reports when its value changes. */
4
+ export type ImpktChangeEvent = CustomEvent<{
5
+ value: string;
6
+ }>;
7
+ export declare const Button: import("@lit/react").ReactWebComponent<ImpktButton, {
8
+ onClick: EventName<MouseEvent>;
9
+ }>;
10
+ export declare const TextInput: import("@lit/react").ReactWebComponent<ImpktTextInput, {
11
+ onChange: EventName<ImpktChangeEvent>;
12
+ }>;
13
+ export declare const Select: import("@lit/react").ReactWebComponent<ImpktSelect, {
14
+ onChange: EventName<ImpktChangeEvent>;
15
+ }>;
16
+ export declare const Checkbox: import("@lit/react").ReactWebComponent<ImpktCheckbox, {
17
+ onChange: EventName<ImpktChangeEvent>;
18
+ }>;
19
+ export declare const RadioGroup: import("@lit/react").ReactWebComponent<ImpktRadioGroup, {
20
+ onChange: EventName<ImpktChangeEvent>;
21
+ }>;
22
+ export declare const Alert: import("@lit/react").ReactWebComponent<ImpktAlert, {}>;
23
+ export declare const Stack: import("@lit/react").ReactWebComponent<ImpktStack, {}>;
24
+ export declare const Card: import("@lit/react").ReactWebComponent<ImpktCard, {}>;
25
+ export declare const Heading: import("@lit/react").ReactWebComponent<ImpktHeading, {}>;
26
+ export declare const Text: import("@lit/react").ReactWebComponent<ImpktText, {}>;
27
+ export type { RadioOption, SelectOption, AlertTone, HelpKind } from '@atomic-ui/ui';
28
+ export declare const Grid: import("@lit/react").ReactWebComponent<ImpktGrid, {}>;
29
+ export declare const Help: import("@lit/react").ReactWebComponent<ImpktHelp, {}>;
package/dist/index.js ADDED
@@ -0,0 +1,70 @@
1
+ // packages/ui-react/src/index.ts
2
+ import * as React from "react";
3
+ import { createComponent } from "@lit/react";
4
+ import {
5
+ ImpktButton,
6
+ ImpktTextInput,
7
+ ImpktSelect,
8
+ ImpktCheckbox,
9
+ ImpktRadioGroup,
10
+ ImpktAlert,
11
+ ImpktStack,
12
+ ImpktCard,
13
+ ImpktHeading,
14
+ ImpktText,
15
+ ImpktGrid,
16
+ ImpktHelp
17
+ } from "@atomic-ui/ui";
18
+ var changeEvents = { onChange: "impkt-change" };
19
+ var Button = createComponent({
20
+ react: React,
21
+ tagName: "impkt-button",
22
+ elementClass: ImpktButton,
23
+ events: { onClick: "click" }
24
+ });
25
+ var TextInput = createComponent({
26
+ react: React,
27
+ tagName: "impkt-text-input",
28
+ elementClass: ImpktTextInput,
29
+ events: changeEvents
30
+ });
31
+ var Select = createComponent({
32
+ react: React,
33
+ tagName: "impkt-select",
34
+ elementClass: ImpktSelect,
35
+ events: changeEvents
36
+ });
37
+ var Checkbox = createComponent({
38
+ react: React,
39
+ tagName: "impkt-checkbox",
40
+ elementClass: ImpktCheckbox,
41
+ events: changeEvents
42
+ });
43
+ var RadioGroup = createComponent({
44
+ react: React,
45
+ tagName: "impkt-radio-group",
46
+ elementClass: ImpktRadioGroup,
47
+ events: changeEvents
48
+ });
49
+ var Alert = createComponent({ react: React, tagName: "impkt-alert", elementClass: ImpktAlert });
50
+ var Stack = createComponent({ react: React, tagName: "impkt-stack", elementClass: ImpktStack });
51
+ var Card = createComponent({ react: React, tagName: "impkt-card", elementClass: ImpktCard });
52
+ var Heading = createComponent({ react: React, tagName: "impkt-heading", elementClass: ImpktHeading });
53
+ var Text = createComponent({ react: React, tagName: "impkt-text", elementClass: ImpktText });
54
+ var Grid = createComponent({ react: React, tagName: "impkt-grid", elementClass: ImpktGrid });
55
+ var Help = createComponent({ react: React, tagName: "impkt-help", elementClass: ImpktHelp });
56
+ export {
57
+ Alert,
58
+ Button,
59
+ Card,
60
+ Checkbox,
61
+ Grid,
62
+ Heading,
63
+ Help,
64
+ RadioGroup,
65
+ Select,
66
+ Stack,
67
+ Text,
68
+ TextInput
69
+ };
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * React bindings for `@impkt/ui`.\n *\n * ## Why a wrapper exists at all\n *\n * React 18 sets everything it does not recognise as an HTML *attribute*, which\n * means a prop holding an array or an object arrives at a custom element as\n * the string `[object Object]`. `impkt-radio-group`'s options are an array, so\n * without this the component that most needs structured data is the one that\n * cannot receive it. React 19 fixed that, and the wrapper stays regardless for\n * the second reason: custom events. `@lit/react` maps `impkt-change` onto an\n * `onUinChange` prop with a type, rather than leaving every consumer to reach\n * for a ref and `addEventListener`.\n *\n * ## Why these are written out rather than generated\n *\n * Generation needs a machine-readable description of each component, and that\n * is the Custom Elements Manifest the CMS palette will also be built from\n * (phase 2 of [the plan](../../../docs/SITE-BUILDER.md)). Until that pipeline\n * exists, generating from nothing would mean inventing a second source of\n * truth about the components. Eleven explicit calls are cheap, and they get\n * replaced wholesale when the manifest arrives.\n */\nimport * as React from 'react';\nimport { createComponent, type EventName } from '@lit/react';\nimport {\n ImpktButton,\n ImpktTextInput,\n ImpktSelect,\n ImpktCheckbox,\n ImpktRadioGroup,\n ImpktAlert,\n ImpktStack,\n ImpktCard,\n ImpktHeading,\n ImpktText,\n ImpktGrid,\n ImpktHelp,\n} from '@impkt/ui';\n\n/** What a control reports when its value changes. */\nexport type ImpktChangeEvent = CustomEvent<{ value: string }>;\n\nconst changeEvents = { onChange: 'impkt-change' as EventName<ImpktChangeEvent> };\n\nexport const Button = createComponent({\n react: React,\n tagName: 'impkt-button',\n elementClass: ImpktButton,\n events: { onClick: 'click' as EventName<MouseEvent> },\n});\n\nexport const TextInput = createComponent({\n react: React,\n tagName: 'impkt-text-input',\n elementClass: ImpktTextInput,\n events: changeEvents,\n});\n\nexport const Select = createComponent({\n react: React,\n tagName: 'impkt-select',\n elementClass: ImpktSelect,\n events: changeEvents,\n});\n\nexport const Checkbox = createComponent({\n react: React,\n tagName: 'impkt-checkbox',\n elementClass: ImpktCheckbox,\n events: changeEvents,\n});\n\nexport const RadioGroup = createComponent({\n react: React,\n tagName: 'impkt-radio-group',\n elementClass: ImpktRadioGroup,\n events: changeEvents,\n});\n\nexport const Alert = createComponent({ react: React, tagName: 'impkt-alert', elementClass: ImpktAlert });\nexport const Stack = createComponent({ react: React, tagName: 'impkt-stack', elementClass: ImpktStack });\nexport const Card = createComponent({ react: React, tagName: 'impkt-card', elementClass: ImpktCard });\nexport const Heading = createComponent({ react: React, tagName: 'impkt-heading', elementClass: ImpktHeading });\nexport const Text = createComponent({ react: React, tagName: 'impkt-text', elementClass: ImpktText });\n\nexport type { RadioOption, SelectOption, AlertTone, HelpKind } from '@impkt/ui';\n\nexport const Grid = createComponent({ react: React, tagName: 'impkt-grid', elementClass: ImpktGrid });\n\nexport const Help = createComponent({ react: React, tagName: 'impkt-help', elementClass: ImpktHelp });\n"],"mappings":";AAuBA,YAAY,WAAW;AACvB,SAAS,uBAAuC;AAChD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "React bindings for @atomic-ui/ui: typed props, typed events, and the attribute handling React 18 does not do for custom elements.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "@lit/react": "^1.0.8",
16
+ "@atomic-ui/ui": "0.1.1"
17
+ },
18
+ "peerDependencies": {
19
+ "react": "^18.3.0 || ^19.0.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/react": "^18.3.0",
23
+ "react": "^18.3.0",
24
+ "typescript": "^5.5.0"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "scripts": {
34
+ "build": "tsc -p tsconfig.json",
35
+ "typecheck": "tsc -p tsconfig.json",
36
+ "test": "echo \"(covered by @impkt/ui; wrappers are generated shape, not behaviour)\""
37
+ }
38
+ }