@campo-design/react 0.0.0-stage → 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 +21 -0
- package/README.md +145 -2
- package/dist/badge.d.ts +36 -0
- package/dist/badge.js +7 -0
- package/dist/button.d.ts +46 -0
- package/dist/button.js +7 -0
- package/dist/callout.d.ts +67 -0
- package/dist/callout.js +7 -0
- package/dist/card.d.ts +24 -0
- package/dist/card.js +7 -0
- package/dist/checkbox.d.ts +10 -0
- package/dist/checkbox.js +7 -0
- package/dist/dialog.d.ts +10 -0
- package/dist/dialog.js +7 -0
- package/dist/icon.d.ts +16 -0
- package/dist/icon.js +7 -0
- package/dist/input.d.ts +20 -0
- package/dist/input.js +7 -0
- package/dist/option.d.ts +10 -0
- package/dist/option.js +7 -0
- package/dist/progress-bar.d.ts +10 -0
- package/dist/progress-bar.js +7 -0
- package/dist/radio-group.d.ts +10 -0
- package/dist/radio-group.js +7 -0
- package/dist/radio.d.ts +19 -0
- package/dist/radio.js +7 -0
- package/dist/select.d.ts +20 -0
- package/dist/select.js +7 -0
- package/dist/switch.d.ts +10 -0
- package/dist/switch.js +7 -0
- package/dist/tab-group.d.ts +10 -0
- package/dist/tab-group.js +7 -0
- package/dist/tab-panel.d.ts +10 -0
- package/dist/tab-panel.js +7 -0
- package/dist/tab.d.ts +10 -0
- package/dist/tab.js +7 -0
- package/dist/textarea.d.ts +20 -0
- package/dist/textarea.js +7 -0
- package/dist/tooltip.d.ts +10 -0
- package/dist/tooltip.js +7 -0
- package/package.json +46 -3
- package/src/server-attributes.js +53 -0
- package/src/setup.d.ts +16 -0
- package/src/setup.js +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joshua Litchfield
|
|
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
CHANGED
|
@@ -1,3 +1,146 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @campo-design/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Campo's components for React 19. In the browser, each one is Web Awesome's own
|
|
4
|
+
React wrapper, unchanged; on the server it renders its element with its
|
|
5
|
+
attributes (see *Server rendering*). Its types are generated from Campo's
|
|
6
|
+
[component contracts](../webawesome/contracts). Your editor and compiler
|
|
7
|
+
reject what Campo doesn't style:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
<WaButton variant="brand">Save</WaButton> // ✓ the main action
|
|
11
|
+
<WaButton variant="neutral" appearance="outlined">Cancel</WaButton> // ✓
|
|
12
|
+
<WaButton variant="danger" appearance="accent">Delete</WaButton> // ✗ a gap: solid feedback fills
|
|
13
|
+
<WaIcon name="circle-check" /> // ✗ a Font Awesome name; Phosphor's is check-circle
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Hovering a component shows the contract's description, each supported
|
|
17
|
+
combination with when to use it, and each gap with what to use instead.
|
|
18
|
+
|
|
19
|
+
## Why this package exists
|
|
20
|
+
|
|
21
|
+
[Web Awesome](https://webawesome.com) already ships React wrappers
|
|
22
|
+
(`@awesome.me/webawesome/dist/react/<name>`, made with
|
|
23
|
+
[`@lit/react`](https://lit.dev/docs/frameworks/react/)), so this package
|
|
24
|
+
doesn't wrap anything again. What upstream can't know is what Campo has
|
|
25
|
+
decided:
|
|
26
|
+
|
|
27
|
+
- **Which combinations Campo styles.** In the docs and site, `pnpm check`
|
|
28
|
+
fails on a gap. A product in React gets the same check from TypeScript.
|
|
29
|
+
- **That icons are Phosphor.** A Font Awesome name draws nothing, with no
|
|
30
|
+
error. Here it doesn't compile.
|
|
31
|
+
- **Which components Campo has checked.** Only components with a contract are
|
|
32
|
+
exported. A new one appears when its contract lands.
|
|
33
|
+
- **The fixed setup**, as one call.
|
|
34
|
+
|
|
35
|
+
## Setup
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
npm install @campo-design/react @campo-design/webawesome @campo-design/tokens @campo-design/css @awesome.me/webawesome react
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
1. Put the theme classes on `<html>` (in Next.js, in the root layout):
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<html class="wa-theme-default campo-wa">
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. Import the CSS once, in this order, in your app's entry or global stylesheet:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
import '@campo-design/tokens/css';
|
|
51
|
+
import '@campo-design/tokens/css/theme-dark.css';
|
|
52
|
+
import '@campo-design/css';
|
|
53
|
+
import '@campo-design/webawesome/theme.css';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
3. Call `setupCampo()` once, before the first render. It registers Campo's
|
|
57
|
+
icons and keeps Web Awesome's color scheme in step with `data-theme`. It
|
|
58
|
+
does nothing on the server, and warns if step 1 is missing.
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
import { setupCampo } from '@campo-design/react';
|
|
62
|
+
setupCampo();
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Use
|
|
66
|
+
|
|
67
|
+
Import each component from its own path. That loads only the components you
|
|
68
|
+
use, as the rest of Campo does (there's no autoloader):
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { WaButton } from '@campo-design/react/button';
|
|
72
|
+
import { WaCallout } from '@campo-design/react/callout';
|
|
73
|
+
import { WaIcon } from '@campo-design/react/icon';
|
|
74
|
+
|
|
75
|
+
<WaCallout variant="success">
|
|
76
|
+
<WaIcon slot="icon" name="check-circle" />
|
|
77
|
+
Your changes were saved.
|
|
78
|
+
</WaCallout>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Names match Web Awesome's: `<wa-radio-group>` is `WaRadioGroup` from
|
|
82
|
+
`@campo-design/react/radio-group`. Attributes, slots and events are Web
|
|
83
|
+
Awesome's, so its docs and `llms.txt` still apply. Events are camel-cased
|
|
84
|
+
props (`wa-hide` is `onWaHide`), and `ref` is typed to the element.
|
|
85
|
+
|
|
86
|
+
Everything in [*Building with Campo*](../../AGENTS.md#building-with-campo)
|
|
87
|
+
still holds: semantic tokens for your own layout, no `--wa-*` overrides, and
|
|
88
|
+
no dark-mode handling of your own.
|
|
89
|
+
|
|
90
|
+
## Server rendering
|
|
91
|
+
|
|
92
|
+
The components can be server-rendered (in Next.js, Remix or React Router,
|
|
93
|
+
or with `renderToString` yourself). On the server, each one renders its
|
|
94
|
+
element with every prop that has an HTML attribute written as that
|
|
95
|
+
attribute: `<WaButton variant="brand" withCaret>` becomes
|
|
96
|
+
`<wa-button variant="brand" with-caret="">`. Handlers, refs and object
|
|
97
|
+
props wait for the browser. When the component's JavaScript loads, the
|
|
98
|
+
element upgrades from those attributes, so it already has the right variant
|
|
99
|
+
before React hydrates, and hydrating raises no warnings.
|
|
100
|
+
|
|
101
|
+
Why it's needed: Web Awesome's wrappers set props as element properties,
|
|
102
|
+
which exist only in the browser, so on the server they render a bare
|
|
103
|
+
`<wa-button>`. In a server-rendered app, a brand button would draw as
|
|
104
|
+
neutral until hydration.
|
|
105
|
+
|
|
106
|
+
What it doesn't do: the shadow DOM still draws in the browser, once the
|
|
107
|
+
component's JavaScript loads, as for any web component. Rendering it on the
|
|
108
|
+
server too (declarative shadow DOM) needs Lit's experimental framework
|
|
109
|
+
plugins, which Campo doesn't take on. `setupCampo()` does nothing on the
|
|
110
|
+
server, so call it in code that runs in the browser too (in Next.js, a
|
|
111
|
+
client component).
|
|
112
|
+
|
|
113
|
+
## What's checked
|
|
114
|
+
|
|
115
|
+
- `pnpm --filter @campo-design/react check` writes the modules, then compiles
|
|
116
|
+
every combination Web Awesome allows for each contracted component. A gap
|
|
117
|
+
must fail to compile, and a supported combination must compile. It fails
|
|
118
|
+
either way the types and the contract disagree.
|
|
119
|
+
- `pnpm --filter @campo-design/react test` covers the generator, and what a
|
|
120
|
+
server render writes (`scripts/server-render.test.js`).
|
|
121
|
+
- `pnpm test` renders the package through React 19 in Chromium
|
|
122
|
+
(`packages/browser-tests/tests/react.spec.js`). Every module must render an
|
|
123
|
+
upgraded `<wa-*>` element. A button's props must reach it with Campo's look
|
|
124
|
+
in both themes. `onClick`, Web Awesome events such as `onWaTabShow` and
|
|
125
|
+
`ref` must work. `setupCampo()` must follow `data-theme`, draw Phosphor
|
|
126
|
+
icons, run once and warn about missing classes. A small screen rendered
|
|
127
|
+
this way is scanned by axe in both themes. A screen rendered on the server
|
|
128
|
+
must keep Campo's look before React hydrates, then hydrate onto the same
|
|
129
|
+
DOM with no errors. The bundle reads this package's
|
|
130
|
+
`dist/`, so a new contract's module is tested without anyone adding it.
|
|
131
|
+
- How each binding looks is the bridge's job, and the bridge tests cover it
|
|
132
|
+
element by element. The React test checks one binding, to prove the look
|
|
133
|
+
survives the trip through React.
|
|
134
|
+
|
|
135
|
+
## Not covered yet
|
|
136
|
+
|
|
137
|
+
- **React 18.** Not supported: the types and tests assume React 19. It's a
|
|
138
|
+
*Not yet* in [`CONTRIBUTING.md`](../../CONTRIBUTING.md#not-yet), with what
|
|
139
|
+
would reopen it.
|
|
140
|
+
- **Declarative shadow DOM on the server.** See *Server rendering*.
|
|
141
|
+
|
|
142
|
+
## Generated, not written
|
|
143
|
+
|
|
144
|
+
`dist/` is generated by `pnpm build` from the contracts
|
|
145
|
+
(`scripts/build.js`, using `lib/generate.js`). Don't edit it: change the
|
|
146
|
+
contract, and the types follow.
|
package/dist/badge.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from badge.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/badge/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The variant × appearance combinations Campo styles (badge.contract.json).
|
|
8
|
+
*
|
|
9
|
+
* Not styled by Campo, so they don't type-check:
|
|
10
|
+
* - variant=brand appearance=filled|filled-outlined: Uses Web Awesome's normal brand fill. Campo's action.primary covers the loud fill only. Use variant="brand" appearance="outlined" instead.
|
|
11
|
+
* - variant=neutral appearance=filled-outlined: Uses Web Awesome's normal neutral border, which the bridge doesn't map. Use variant="neutral" appearance="filled" instead.
|
|
12
|
+
* - variant=success|warning|danger appearance=accent|filled|filled-outlined: Solid feedback fills. Campo's feedback tokens cover the quiet style only. This includes the default appearance, accent. Use appearance="outlined" instead.
|
|
13
|
+
*/
|
|
14
|
+
export type WaBadgeCombination =
|
|
15
|
+
/** Draws the eye to something new or featured, such as New on a menu item. Use sparingly: it's as loud as a primary button. */
|
|
16
|
+
| { variant?: 'brand'; appearance?: 'accent' }
|
|
17
|
+
/** Information that shouldn't compete with the content, such as Beta. */
|
|
18
|
+
| { variant?: 'brand'; appearance: 'outlined' }
|
|
19
|
+
/** A strong neutral marker, such as a count on a tab. */
|
|
20
|
+
| { variant: 'neutral'; appearance?: 'accent' }
|
|
21
|
+
/** A quiet label, such as a tag or a category. */
|
|
22
|
+
| { variant: 'neutral'; appearance: 'filled' }
|
|
23
|
+
/** The quietest label, such as Draft. */
|
|
24
|
+
| { variant: 'neutral'; appearance: 'outlined' }
|
|
25
|
+
/** A good status, such as Published or Paid. */
|
|
26
|
+
| { variant: 'success'; appearance: 'outlined' }
|
|
27
|
+
/** A status that needs attention, such as Expiring. */
|
|
28
|
+
| { variant: 'warning'; appearance: 'outlined' }
|
|
29
|
+
/** A failed or blocked status, such as Failed or Overdue. */
|
|
30
|
+
| { variant: 'danger'; appearance: 'outlined' };
|
|
31
|
+
|
|
32
|
+
export type WaBadgeProps = Omit<ComponentProps<typeof Base>, 'variant' | 'appearance'> & WaBadgeCombination;
|
|
33
|
+
|
|
34
|
+
/** A short label that marks something's status or count, such as New or 3. Keep it to a word or a number; for a sentence, use a callout. */
|
|
35
|
+
export declare const WaBadge: ForwardRefExoticComponent<WaBadgeProps>;
|
|
36
|
+
export default WaBadge;
|
package/dist/badge.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from badge.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/badge/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaBadge = withServerAttributes(Base, 'wa-badge', {"variant":"variant","appearance":"appearance","pill":"pill","attention":"attention","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaBadge, WaBadge as default };
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from button.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/button/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The variant × appearance combinations Campo styles (button.contract.json).
|
|
8
|
+
*
|
|
9
|
+
* Not styled by Campo, so they don't type-check:
|
|
10
|
+
* - variant=neutral|brand appearance=filled-outlined: Uses Web Awesome's normal fill and border, which the bridge maps for neutral fills only and for no variant's border. Use appearance="outlined" instead.
|
|
11
|
+
* - variant=brand appearance=filled: Uses Web Awesome's normal brand fill. Campo's action.primary covers the loud fill only. Use variant="brand" appearance="accent" instead.
|
|
12
|
+
* - variant=success|warning|danger appearance=accent|filled|filled-outlined: Solid feedback fills. Campo's feedback tokens cover the quiet style only. Use appearance="outlined" (the loudest Campo styles) or "plain" instead.
|
|
13
|
+
*/
|
|
14
|
+
export type WaButtonCombination =
|
|
15
|
+
/** The main action in a view, such as Save or Publish. Keep to one per view. */
|
|
16
|
+
| { variant: 'brand'; appearance?: 'accent' }
|
|
17
|
+
/** A main-action style that should weigh less than a filled one, such as a second call to action on a landing page. */
|
|
18
|
+
| { variant: 'brand'; appearance: 'outlined' }
|
|
19
|
+
/** A low-weight action in the brand colour, such as Learn more inside a callout. */
|
|
20
|
+
| { variant: 'brand'; appearance: 'plain' }
|
|
21
|
+
/** An emphasised action that isn't the main one, such as Export in a toolbar. Web Awesome's default, so a bare <wa-button> looks like this. Weighs more than outlined: next to a brand accent button, prefer outlined. */
|
|
22
|
+
| { variant?: 'neutral'; appearance?: 'accent' }
|
|
23
|
+
/** A supporting action next to a primary one, such as Back. Campo's action.secondary style. */
|
|
24
|
+
| { variant?: 'neutral'; appearance: 'filled' }
|
|
25
|
+
/** A supporting action, such as Save draft or Cancel. The usual partner to a brand accent button. */
|
|
26
|
+
| { variant?: 'neutral'; appearance: 'outlined' }
|
|
27
|
+
/** The lightest action, such as Cancel in a dialog or a toolbar action. */
|
|
28
|
+
| { variant?: 'neutral'; appearance: 'plain' }
|
|
29
|
+
/** An action that confirms a good outcome and needs more weight than plain, such as Approve. */
|
|
30
|
+
| { variant: 'success'; appearance: 'outlined' }
|
|
31
|
+
/** An action that needs care and more weight than plain, such as Override settings. */
|
|
32
|
+
| { variant: 'warning'; appearance: 'outlined' }
|
|
33
|
+
/** A destructive action that should be easy to find but not the main action, such as Delete project. */
|
|
34
|
+
| { variant: 'danger'; appearance: 'outlined' }
|
|
35
|
+
/** A low-weight action that confirms a good outcome, such as Mark as resolved. */
|
|
36
|
+
| { variant: 'success'; appearance: 'plain' }
|
|
37
|
+
/** A low-weight action that needs care, such as Override. */
|
|
38
|
+
| { variant: 'warning'; appearance: 'plain' }
|
|
39
|
+
/** A destructive action that should stay quiet, such as Remove in a list row. */
|
|
40
|
+
| { variant: 'danger'; appearance: 'plain' };
|
|
41
|
+
|
|
42
|
+
export type WaButtonProps = Omit<ComponentProps<typeof Base>, 'variant' | 'appearance'> & WaButtonCombination;
|
|
43
|
+
|
|
44
|
+
/** Triggers an action. Pick the variant and appearance by the action's weight: one brand accent button for the main action in a view, neutral outlined or plain for the rest. Use a link, not a button, to go somewhere. */
|
|
45
|
+
export declare const WaButton: ForwardRefExoticComponent<WaButtonProps>;
|
|
46
|
+
export default WaButton;
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from button.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/button/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaButton = withServerAttributes(Base, 'wa-button', {"title":"title","variant":"variant","appearance":"appearance","size":"size","withCaret":"with-caret","withStart":"with-start","withEnd":"with-end","disabled":"disabled","loading":"loading","pill":"pill","type":"type","name":"name","value":"value","href":"href","target":"target","rel":"rel","download":"download","formAction":"formaction","formEnctype":"formenctype","formMethod":"formmethod","formNoValidate":"formnovalidate","formTarget":"formtarget","customError":"custom-error","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaButton, WaButton as default };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from callout.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/callout/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The variant × appearance combinations Campo styles (callout.contract.json).
|
|
8
|
+
*
|
|
9
|
+
* Not styled by Campo, so they don't type-check:
|
|
10
|
+
* - variant=neutral appearance=(unset)|filled|filled-outlined: Uses Web Awesome's quiet neutral fill and normal neutral border, which the bridge doesn't map. This includes leaving appearance unset. Use variant="neutral" appearance="outlined", or variant="brand" for information instead.
|
|
11
|
+
* - variant=success|warning|danger appearance=accent: Solid feedback fills. Campo's feedback tokens cover the quiet style only. Use leave appearance unset instead.
|
|
12
|
+
*/
|
|
13
|
+
export type WaCalloutCombination =
|
|
14
|
+
/** Information or a tip. The usual choice: brand is how Web Awesome shows information, and Campo maps it to feedback.info on purpose (#27). */
|
|
15
|
+
| { variant?: 'brand'; appearance?: undefined }
|
|
16
|
+
/** The same as leaving appearance unset. Prefer unset. */
|
|
17
|
+
| { variant?: 'brand'; appearance: 'filled-outlined' }
|
|
18
|
+
/** Information without an edge, such as inside a card that already has one. */
|
|
19
|
+
| { variant?: 'brand'; appearance: 'filled' }
|
|
20
|
+
/** Information on a surface where a fill would be heavy. */
|
|
21
|
+
| { variant?: 'brand'; appearance: 'outlined' }
|
|
22
|
+
/** An inline note, with only the icon in colour. */
|
|
23
|
+
| { variant?: 'brand'; appearance: 'plain' }
|
|
24
|
+
/** An announcement that must be seen, such as a page-wide notice. As loud as a primary button, so one per page at most. */
|
|
25
|
+
| { variant?: 'brand'; appearance: 'accent' }
|
|
26
|
+
/** A strong message with no status, such as a cookie notice. */
|
|
27
|
+
| { variant: 'neutral'; appearance: 'accent' }
|
|
28
|
+
/** A message with no status, set apart from the content around it. */
|
|
29
|
+
| { variant: 'neutral'; appearance: 'outlined' }
|
|
30
|
+
/** An aside with no status, such as a footnote with an icon. */
|
|
31
|
+
| { variant: 'neutral'; appearance: 'plain' }
|
|
32
|
+
/** A completed action, such as Saved. The usual choice. */
|
|
33
|
+
| { variant: 'success'; appearance?: undefined }
|
|
34
|
+
/** A completed action, such as Saved. The same as leaving appearance unset. Prefer unset. */
|
|
35
|
+
| { variant: 'success'; appearance: 'filled-outlined' }
|
|
36
|
+
/** A completed action, such as Saved, without an edge, such as inside a card that already has one. */
|
|
37
|
+
| { variant: 'success'; appearance: 'filled' }
|
|
38
|
+
/** A completed action, such as Saved, on a surface where a fill would be heavy. */
|
|
39
|
+
| { variant: 'success'; appearance: 'outlined' }
|
|
40
|
+
/** A completed action, such as Saved, as an inline note with only the icon in colour. */
|
|
41
|
+
| { variant: 'success'; appearance: 'plain' }
|
|
42
|
+
/** Something that needs attention but doesn't block, such as an expiring plan. The usual choice. */
|
|
43
|
+
| { variant: 'warning'; appearance?: undefined }
|
|
44
|
+
/** Something that needs attention but doesn't block, such as an expiring plan. The same as leaving appearance unset. Prefer unset. */
|
|
45
|
+
| { variant: 'warning'; appearance: 'filled-outlined' }
|
|
46
|
+
/** Something that needs attention but doesn't block, such as an expiring plan, without an edge, such as inside a card that already has one. */
|
|
47
|
+
| { variant: 'warning'; appearance: 'filled' }
|
|
48
|
+
/** Something that needs attention but doesn't block, such as an expiring plan, on a surface where a fill would be heavy. */
|
|
49
|
+
| { variant: 'warning'; appearance: 'outlined' }
|
|
50
|
+
/** Something that needs attention but doesn't block, such as an expiring plan, as an inline note with only the icon in colour. */
|
|
51
|
+
| { variant: 'warning'; appearance: 'plain' }
|
|
52
|
+
/** An error or a destructive consequence, such as Payment failed. The usual choice. */
|
|
53
|
+
| { variant: 'danger'; appearance?: undefined }
|
|
54
|
+
/** An error or a destructive consequence, such as Payment failed. The same as leaving appearance unset. Prefer unset. */
|
|
55
|
+
| { variant: 'danger'; appearance: 'filled-outlined' }
|
|
56
|
+
/** An error or a destructive consequence, such as Payment failed, without an edge, such as inside a card that already has one. */
|
|
57
|
+
| { variant: 'danger'; appearance: 'filled' }
|
|
58
|
+
/** An error or a destructive consequence, such as Payment failed, on a surface where a fill would be heavy. */
|
|
59
|
+
| { variant: 'danger'; appearance: 'outlined' }
|
|
60
|
+
/** An error or a destructive consequence, such as Payment failed, as an inline note with only the icon in colour. */
|
|
61
|
+
| { variant: 'danger'; appearance: 'plain' };
|
|
62
|
+
|
|
63
|
+
export type WaCalloutProps = Omit<ComponentProps<typeof Base>, 'variant' | 'appearance'> & WaCalloutCombination;
|
|
64
|
+
|
|
65
|
+
/** A message in the flow of the page: what happened, or what to know, and what to do next. Pick the variant by meaning: brand for information, success, warning or danger for outcomes. Leave appearance unset unless the message needs more or less weight. For a word or a number on its own, such as a status or a count, use a badge. For a decision that has to be made before going on, such as confirming a delete, use a dialog. */
|
|
66
|
+
export declare const WaCallout: ForwardRefExoticComponent<WaCalloutProps>;
|
|
67
|
+
export default WaCallout;
|
package/dist/callout.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from callout.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/callout/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaCallout = withServerAttributes(Base, 'wa-callout', {"variant":"variant","appearance":"appearance","size":"size","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaCallout, WaCallout as default };
|
package/dist/card.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from card.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/card/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The appearance combinations Campo styles (card.contract.json).
|
|
8
|
+
*
|
|
9
|
+
* Not styled by Campo, so they don't type-check:
|
|
10
|
+
* - appearance=filled|filled-outlined: Uses Web Awesome's quiet neutral fill, which the bridge doesn't map. Use appearance="outlined" instead.
|
|
11
|
+
*/
|
|
12
|
+
export type WaCardCombination =
|
|
13
|
+
/** The usual card: an edge on the page's own background. */
|
|
14
|
+
| { appearance?: 'outlined' }
|
|
15
|
+
/** Content grouped by layout alone, with no edge or fill. */
|
|
16
|
+
| { appearance: 'plain' }
|
|
17
|
+
/** A card that must stand out, such as a featured plan. It inverts the page, so use one at most. */
|
|
18
|
+
| { appearance: 'accent' };
|
|
19
|
+
|
|
20
|
+
export type WaCardProps = Omit<ComponentProps<typeof Base>, 'appearance'> & WaCardCombination;
|
|
21
|
+
|
|
22
|
+
/** A surface that groups related content, such as a summary with its actions. Leave appearance as its default, outlined, unless the card needs more or less weight. */
|
|
23
|
+
export declare const WaCard: ForwardRefExoticComponent<WaCardProps>;
|
|
24
|
+
export default WaCard;
|
package/dist/card.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from card.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/card/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaCard = withServerAttributes(Base, 'wa-card', {"appearance":"appearance","withHeader":"with-header","withMedia":"with-media","withFooter":"with-footer","withHeaderActions":"with-header-actions","withFooterActions":"with-footer-actions","orientation":"orientation","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaCard, WaCard as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from checkbox.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/checkbox/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaCheckboxProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** Turns one option on or off, as part of a form the person submits. For a setting that takes effect at once, use a switch. */
|
|
9
|
+
export declare const WaCheckbox: ForwardRefExoticComponent<WaCheckboxProps>;
|
|
10
|
+
export default WaCheckbox;
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from checkbox.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/checkbox/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaCheckbox = withServerAttributes(Base, 'wa-checkbox', {"title":"title","value":"value","size":"size","disabled":"disabled","indeterminate":"indeterminate","defaultChecked":"checked","required":"required","hint":"hint","name":"name","customError":"custom-error","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaCheckbox, WaCheckbox as default };
|
package/dist/dialog.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from dialog.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/dialog/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaDialogProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** Asks for a decision or details that must be dealt with before going back to the page, such as confirming a delete. Give it a label, and put its actions in the footer slot. For information that doesn't need an answer, use a callout in the page instead. */
|
|
9
|
+
export declare const WaDialog: ForwardRefExoticComponent<WaDialogProps>;
|
|
10
|
+
export default WaDialog;
|
package/dist/dialog.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from dialog.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/dialog/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaDialog = withServerAttributes(Base, 'wa-dialog', {"open":"open","label":"label","withoutHeader":"without-header","lightDismiss":"light-dismiss","withFooter":"with-footer","withLabel":"with-label","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaDialog, WaDialog as default };
|
package/dist/icon.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from icon.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/icon/index.js';
|
|
5
|
+
import type { IconName, IconWeight } from '@campo-design/icons';
|
|
6
|
+
|
|
7
|
+
export type WaIconProps = Omit<ComponentProps<typeof Base>, 'name' | 'variant'> & {
|
|
8
|
+
/** A Phosphor icon name, such as `check-circle` (not Font Awesome's `circle-check`). */
|
|
9
|
+
name?: IconName;
|
|
10
|
+
/** The Phosphor weight. Campo's default is `regular`. */
|
|
11
|
+
variant?: IconWeight;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** A Phosphor icon, named by Phosphor's names. It takes the colour of the text around it. Give it a label only when it's the only thing carrying the meaning. */
|
|
15
|
+
export declare const WaIcon: ForwardRefExoticComponent<WaIconProps>;
|
|
16
|
+
export default WaIcon;
|
package/dist/icon.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from icon.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/icon/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaIcon = withServerAttributes(Base, 'wa-icon', {"name":"name","family":"family","variant":"variant","canvas":"canvas","autoWidth":"auto-width","swapOpacity":"swap-opacity","src":"src","label":"label","library":"library","rotate":"rotate","flip":"flip","animation":"animation","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaIcon, WaIcon as default };
|
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from input.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/input/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The appearance combinations Campo styles (input.contract.json).
|
|
8
|
+
*
|
|
9
|
+
* Not styled by Campo, so they don't type-check:
|
|
10
|
+
* - appearance=filled|filled-outlined: Uses Web Awesome's quiet neutral fill, which the bridge doesn't map for form controls. Use appearance="outlined", or leave it unset instead.
|
|
11
|
+
*/
|
|
12
|
+
export type WaInputCombination =
|
|
13
|
+
/** The usual field. Web Awesome's default. */
|
|
14
|
+
| { appearance?: 'outlined' };
|
|
15
|
+
|
|
16
|
+
export type WaInputProps = Omit<ComponentProps<typeof Base>, 'appearance'> & WaInputCombination;
|
|
17
|
+
|
|
18
|
+
/** A single line of text the person types, such as a name or an email address. Give it a label. For text that may run to several lines, such as a message, use a textarea. */
|
|
19
|
+
export declare const WaInput: ForwardRefExoticComponent<WaInputProps>;
|
|
20
|
+
export default WaInput;
|
package/dist/input.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from input.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/input/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaInput = withServerAttributes(Base, 'wa-input', {"title":"title","type":"type","defaultValue":"value","size":"size","appearance":"appearance","pill":"pill","label":"label","hint":"hint","withClear":"with-clear","placeholder":"placeholder","readonly":"readonly","passwordToggle":"password-toggle","passwordVisible":"password-visible","withoutSpinButtons":"without-spin-buttons","required":"required","pattern":"pattern","minlength":"minlength","maxlength":"maxlength","min":"min","max":"max","step":"step","autocapitalize":"autocapitalize","autocorrect":"autocorrect","autocomplete":"autocomplete","autofocus":"autofocus","enterkeyhint":"enterkeyhint","spellcheck":"spellcheck","inputmode":"inputmode","withLabel":"with-label","withHint":"with-hint","name":"name","disabled":"disabled","customError":"custom-error","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaInput, WaInput as default };
|
package/dist/option.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from option.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/option/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaOptionProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** One choice inside a select. */
|
|
9
|
+
export declare const WaOption: ForwardRefExoticComponent<WaOptionProps>;
|
|
10
|
+
export default WaOption;
|
package/dist/option.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from option.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/option/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaOption = withServerAttributes(Base, 'wa-option', {"value":"value","disabled":"disabled","defaultSelected":"selected","label":"label","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaOption, WaOption as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from progress-bar.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/progress-bar/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaProgressBarProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** Shows how far a task of known length has got, such as an upload. Give it a label that says what's in progress. For a wait of unknown length, set indeterminate rather than guessing a value. */
|
|
9
|
+
export declare const WaProgressBar: ForwardRefExoticComponent<WaProgressBarProps>;
|
|
10
|
+
export default WaProgressBar;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from progress-bar.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/progress-bar/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaProgressBar = withServerAttributes(Base, 'wa-progress-bar', {"value":"value","indeterminate":"indeterminate","label":"label","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaProgressBar, WaProgressBar as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from radio-group.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/radio-group/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaRadioGroupProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** Choosing exactly one option from a few, with every option visible at once, such as a delivery speed. Give it a label. For more than about five options, use a select; for a single yes or no, use a checkbox. */
|
|
9
|
+
export declare const WaRadioGroup: ForwardRefExoticComponent<WaRadioGroupProps>;
|
|
10
|
+
export default WaRadioGroup;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from radio-group.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/radio-group/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaRadioGroup = withServerAttributes(Base, 'wa-radio-group', {"label":"label","hint":"hint","name":"name","disabled":"disabled","orientation":"orientation","defaultValue":"value","size":"size","required":"required","withLabel":"with-label","withHint":"with-hint","customError":"custom-error","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaRadioGroup, WaRadioGroup as default };
|
package/dist/radio.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from radio.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/radio/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The appearance combinations Campo styles (radio.contract.json).
|
|
8
|
+
*/
|
|
9
|
+
export type WaRadioCombination =
|
|
10
|
+
/** The usual choice, in forms. Checked, the circle and its dot take action.primary.bg. */
|
|
11
|
+
| { appearance?: 'default' }
|
|
12
|
+
/** A small set of choices that reads like a row of buttons, such as a list or grid view switch. Checked, it fills with feedback.info.bg and its edge takes action.primary.bg. */
|
|
13
|
+
| { appearance: 'button' };
|
|
14
|
+
|
|
15
|
+
export type WaRadioProps = Omit<ComponentProps<typeof Base>, 'appearance'> & WaRadioCombination;
|
|
16
|
+
|
|
17
|
+
/** One option in a radio group. A radio is only checked inside a <wa-radio-group>, which sets it from the group's value, so never use one on its own. */
|
|
18
|
+
export declare const WaRadio: ForwardRefExoticComponent<WaRadioProps>;
|
|
19
|
+
export default WaRadio;
|
package/dist/radio.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from radio.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/radio/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaRadio = withServerAttributes(Base, 'wa-radio', {"value":"value","appearance":"appearance","size":"size","disabled":"disabled","name":"name","customError":"custom-error","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaRadio, WaRadio as default };
|
package/dist/select.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from select.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/select/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The appearance combinations Campo styles (select.contract.json).
|
|
8
|
+
*
|
|
9
|
+
* Not styled by Campo, so they don't type-check:
|
|
10
|
+
* - appearance=filled|filled-outlined: Uses Web Awesome's quiet neutral fill, which the bridge doesn't map for form controls. Use appearance="outlined", or leave it unset instead.
|
|
11
|
+
*/
|
|
12
|
+
export type WaSelectCombination =
|
|
13
|
+
/** The usual field. Web Awesome's default. */
|
|
14
|
+
| { appearance?: 'outlined' };
|
|
15
|
+
|
|
16
|
+
export type WaSelectProps = Omit<ComponentProps<typeof Base>, 'appearance'> & WaSelectCombination;
|
|
17
|
+
|
|
18
|
+
/** A choice from a list of options, such as a country. Give it a label; for a handful of options that should all be visible, use a radio group instead. */
|
|
19
|
+
export declare const WaSelect: ForwardRefExoticComponent<WaSelectProps>;
|
|
20
|
+
export default WaSelect;
|
package/dist/select.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from select.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/select/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaSelect = withServerAttributes(Base, 'wa-select', {"name":"name","value":"value","size":"size","placeholder":"placeholder","multiple":"multiple","maxOptionsVisible":"max-options-visible","disabled":"disabled","withClear":"with-clear","open":"open","appearance":"appearance","pill":"pill","label":"label","placement":"placement","hint":"hint","withLabel":"with-label","withHint":"with-hint","required":"required","customError":"custom-error","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaSelect, WaSelect as default };
|
package/dist/switch.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from switch.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/switch/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaSwitchProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** Turns a setting on or off, taking effect at once, such as Reduce motion. For an option in a form the person submits, use a checkbox. */
|
|
9
|
+
export declare const WaSwitch: ForwardRefExoticComponent<WaSwitchProps>;
|
|
10
|
+
export default WaSwitch;
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from switch.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/switch/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaSwitch = withServerAttributes(Base, 'wa-switch', {"title":"title","name":"name","value":"value","size":"size","disabled":"disabled","defaultChecked":"checked","required":"required","hint":"hint","withHint":"with-hint","customError":"custom-error","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaSwitch, WaSwitch as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from tab-group.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/tab-group/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaTabGroupProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** Switches between views of the same thing without leaving the page, such as the sections of a settings page. Each <wa-tab> names a <wa-tab-panel>. To move between pages, use links. */
|
|
9
|
+
export declare const WaTabGroup: ForwardRefExoticComponent<WaTabGroupProps>;
|
|
10
|
+
export default WaTabGroup;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from tab-group.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/tab-group/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaTabGroup = withServerAttributes(Base, 'wa-tab-group', {"active":"active","placement":"placement","activation":"activation","withoutScrollControls":"without-scroll-controls","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaTabGroup, WaTabGroup as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from tab-panel.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/tab-panel/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaTabPanelProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** The content for one tab in a tab group. Its name matches its tab's panel attribute. */
|
|
9
|
+
export declare const WaTabPanel: ForwardRefExoticComponent<WaTabPanelProps>;
|
|
10
|
+
export default WaTabPanel;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from tab-panel.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/tab-panel/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaTabPanel = withServerAttributes(Base, 'wa-tab-panel', {"name":"name","active":"active","role":"role","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaTabPanel, WaTabPanel as default };
|
package/dist/tab.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from tab.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/tab/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaTabProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** One tab in a tab group. Its label says what the panel shows, in a word or two, and its panel attribute names the <wa-tab-panel> it opens. The tab group marks the open tab, in feedback.info.text: don't set that yourself. */
|
|
9
|
+
export declare const WaTab: ForwardRefExoticComponent<WaTabProps>;
|
|
10
|
+
export default WaTab;
|
package/dist/tab.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from tab.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/tab/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaTab = withServerAttributes(Base, 'wa-tab', {"panel":"panel","disabled":"disabled","role":"role","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaTab, WaTab as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from textarea.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/textarea/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The appearance combinations Campo styles (textarea.contract.json).
|
|
8
|
+
*
|
|
9
|
+
* Not styled by Campo, so they don't type-check:
|
|
10
|
+
* - appearance=filled|filled-outlined: Uses Web Awesome's quiet neutral fill, which the bridge doesn't map for form controls. Use appearance="outlined", or leave it unset instead.
|
|
11
|
+
*/
|
|
12
|
+
export type WaTextareaCombination =
|
|
13
|
+
/** The usual field. Web Awesome's default. */
|
|
14
|
+
| { appearance?: 'outlined' };
|
|
15
|
+
|
|
16
|
+
export type WaTextareaProps = Omit<ComponentProps<typeof Base>, 'appearance'> & WaTextareaCombination;
|
|
17
|
+
|
|
18
|
+
/** Several lines of text the person types, such as a message. Give it a label. For a short value on one line, such as a name or an email address, use an input. */
|
|
19
|
+
export declare const WaTextarea: ForwardRefExoticComponent<WaTextareaProps>;
|
|
20
|
+
export default WaTextarea;
|
package/dist/textarea.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from textarea.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/textarea/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaTextarea = withServerAttributes(Base, 'wa-textarea', {"title":"title","name":"name","defaultValue":"value","size":"size","appearance":"appearance","label":"label","hint":"hint","placeholder":"placeholder","rows":"rows","resize":"resize","disabled":"disabled","readonly":"readonly","required":"required","minlength":"minlength","maxlength":"maxlength","autocapitalize":"autocapitalize","autocorrect":"autocorrect","autocomplete":"autocomplete","autofocus":"autofocus","enterkeyhint":"enterkeyhint","spellcheck":"spellcheck","inputmode":"inputmode","withLabel":"with-label","withHint":"with-hint","withCount":"with-count","customError":"custom-error","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaTextarea, WaTextarea as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from tooltip.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import type Base from '@awesome.me/webawesome/dist/react/tooltip/index.js';
|
|
5
|
+
|
|
6
|
+
export type WaTooltipProps = ComponentProps<typeof Base>;
|
|
7
|
+
|
|
8
|
+
/** A short name for a control whose purpose its icon alone doesn't make clear, shown on hover and focus. Never put anything a person needs in order to act in a tooltip: it can't be reached on touch screens, and it disappears. */
|
|
9
|
+
export declare const WaTooltip: ForwardRefExoticComponent<WaTooltipProps>;
|
|
10
|
+
export default WaTooltip;
|
package/dist/tooltip.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Generated by @campo-design/react's scripts/build.js from tooltip.contract.json. Do not edit.
|
|
2
|
+
|
|
3
|
+
import Base from '@awesome.me/webawesome/dist/react/tooltip/index.js';
|
|
4
|
+
import { withServerAttributes } from '../src/server-attributes.js';
|
|
5
|
+
|
|
6
|
+
const WaTooltip = withServerAttributes(Base, 'wa-tooltip', {"placement":"placement","disabled":"disabled","distance":"distance","open":"open","skidding":"skidding","showDelay":"show-delay","hideDelay":"hide-delay","trigger":"trigger","withoutArrow":"without-arrow","for":"for","dir":"dir","lang":"lang","didSSR":"did-ssr"});
|
|
7
|
+
export { WaTooltip, WaTooltip as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@campo-design/react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Campo's components for React 19: Web Awesome's React wrappers, typed from Campo's contracts so unsupported combinations and non-Phosphor icon names fail to compile, plus Campo's setup in one call.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"src",
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./src/setup.d.ts",
|
|
14
|
+
"default": "./src/setup.js"
|
|
15
|
+
},
|
|
16
|
+
"./package.json": "./package.json",
|
|
17
|
+
"./*": {
|
|
18
|
+
"types": "./dist/*.d.ts",
|
|
19
|
+
"default": "./dist/*.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"./dist/*.js"
|
|
24
|
+
],
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@campo-design/icons": "^0.1.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@awesome.me/webawesome": "^3.14.0",
|
|
30
|
+
"@campo-design/tokens": ">=0.3.0 <1.0.0",
|
|
31
|
+
"@campo-design/webawesome": ">=0.3.0 <1.0.0",
|
|
32
|
+
"react": "^19.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@awesome.me/webawesome": "3.14.0",
|
|
36
|
+
"@types/react": "^19.1.10",
|
|
37
|
+
"react": "^19.1.1",
|
|
38
|
+
"react-dom": "^19.3.1",
|
|
39
|
+
"typescript": "^5.9.0",
|
|
40
|
+
"@campo-design/tokens": "^0.3.1",
|
|
41
|
+
"@campo-design/webawesome": "^0.4.0"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "node scripts/build.js",
|
|
45
|
+
"check": "node scripts/check-types.js",
|
|
46
|
+
"test": "node --test scripts/*.test.js",
|
|
47
|
+
"clean": "rm -rf dist .check"
|
|
48
|
+
}
|
|
6
49
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Server rendering for Web Awesome's React wrappers.
|
|
3
|
+
*
|
|
4
|
+
* Web Awesome's wrappers (made with @lit/react) set a component's props as
|
|
5
|
+
* element properties, which only exist in the browser. On the server they
|
|
6
|
+
* drop them, so <WaButton variant="brand"> renders as a bare <wa-button>, and
|
|
7
|
+
* in a server-rendered app the button can draw as neutral between the
|
|
8
|
+
* component loading and React hydrating.
|
|
9
|
+
*
|
|
10
|
+
* So on the server each Campo module renders the element itself, with every
|
|
11
|
+
* prop that has an HTML attribute written as that attribute
|
|
12
|
+
* (`variant="brand"`, `withCaret` as `with-caret`). In the browser it is Web
|
|
13
|
+
* Awesome's wrapper itself, unchanged, which marks its element
|
|
14
|
+
* suppressHydrationWarning, so the attributes from the server don't warn.
|
|
15
|
+
*
|
|
16
|
+
* The shadow DOM still draws only once the component's JavaScript loads.
|
|
17
|
+
* Rendering that on the server too (declarative shadow DOM) needs Lit's
|
|
18
|
+
* framework plugins, which Campo doesn't take on.
|
|
19
|
+
*/
|
|
20
|
+
import { createElement, forwardRef } from 'react';
|
|
21
|
+
|
|
22
|
+
const isServer = typeof document === 'undefined';
|
|
23
|
+
|
|
24
|
+
/** A prop that only means something to the live element: an event handler, a callback or an object. */
|
|
25
|
+
const browserOnly = (key, value) =>
|
|
26
|
+
/^on[A-Z]/.test(key) || typeof value === 'function' || (value !== null && typeof value === 'object' && key !== 'style');
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* `Component` in the browser; on the server, a component that renders `tag`
|
|
30
|
+
* with its attributes.
|
|
31
|
+
*
|
|
32
|
+
* @param {import('react').ComponentType<any>} Component Web Awesome's wrapper.
|
|
33
|
+
* @param {string} tag The element, such as `wa-button`.
|
|
34
|
+
* @param {Record<string, string>} attributes Each prop that has an attribute → the attribute (`withCaret` → `with-caret`).
|
|
35
|
+
*/
|
|
36
|
+
export function withServerAttributes(Component, tag, attributes) {
|
|
37
|
+
if (!isServer) return Component;
|
|
38
|
+
const Server = forwardRef(function Server({ children, ...props }, _ref) {
|
|
39
|
+
const element = {};
|
|
40
|
+
for (const [key, value] of Object.entries(props)) {
|
|
41
|
+
if (key in attributes) {
|
|
42
|
+
// HTML's rules: a true boolean is the attribute with no value; false or unset is no attribute.
|
|
43
|
+
if (value === true) element[attributes[key]] = '';
|
|
44
|
+
else if (typeof value === 'string' || typeof value === 'number') element[attributes[key]] = String(value);
|
|
45
|
+
} else if (value !== undefined && !browserOnly(key, value)) {
|
|
46
|
+
element[key] = value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return createElement(tag, element, children);
|
|
50
|
+
});
|
|
51
|
+
Server.displayName = Component.displayName;
|
|
52
|
+
return Server;
|
|
53
|
+
}
|
package/src/setup.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Campo's fixed setup for a React app: registers Campo's icons (Phosphor) and
|
|
3
|
+
* keeps Web Awesome's color scheme in step with Campo's `data-theme`. Call it
|
|
4
|
+
* once in the app's entry file, before the first render. It does nothing on
|
|
5
|
+
* the server, and nothing if it has already run.
|
|
6
|
+
*
|
|
7
|
+
* The app still adds `class="wa-theme-default campo-wa"` to `<html>` and
|
|
8
|
+
* imports `@campo-design/webawesome/theme.css`; it warns if the classes are
|
|
9
|
+
* missing.
|
|
10
|
+
*
|
|
11
|
+
* @param options.icons Passed to `registerCampoIcons()`: `base` self-hosts the
|
|
12
|
+
* icons instead of using the CDN.
|
|
13
|
+
* @param options.root Passed to `connectColorScheme()`. Defaults to `<html>`.
|
|
14
|
+
* @returns A function that stops following the color scheme.
|
|
15
|
+
*/
|
|
16
|
+
export declare function setupCampo(options?: { icons?: { base?: string }; root?: Element }): () => void;
|
package/src/setup.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Campo's fixed setup, for a React app, in one call.
|
|
3
|
+
*
|
|
4
|
+
* Call setupCampo() once in the app's entry file, before the first render, so
|
|
5
|
+
* icons are registered before anything draws one. It runs only in a browser,
|
|
6
|
+
* so a server render can import it safely. It doesn't import theme.css: CSS
|
|
7
|
+
* imports work differently in each bundler, so the app imports that itself.
|
|
8
|
+
*/
|
|
9
|
+
import { connectColorScheme } from '@campo-design/webawesome';
|
|
10
|
+
import { registerCampoIcons } from '@campo-design/webawesome/icons';
|
|
11
|
+
|
|
12
|
+
const CLASSES = ['wa-theme-default', 'campo-wa'];
|
|
13
|
+
let stop = null;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Register Campo's icons and keep Web Awesome's color scheme in step with
|
|
17
|
+
* Campo's `data-theme`. Calling it again does nothing until the returned
|
|
18
|
+
* function has been called.
|
|
19
|
+
*
|
|
20
|
+
* @param {{ icons?: { base?: string }, root?: Element }} [options]
|
|
21
|
+
* @returns {() => void} Stops following the color scheme.
|
|
22
|
+
*/
|
|
23
|
+
export function setupCampo(options = {}) {
|
|
24
|
+
if (typeof document === 'undefined') return () => {};
|
|
25
|
+
if (stop) return stop;
|
|
26
|
+
|
|
27
|
+
registerCampoIcons(options.icons);
|
|
28
|
+
const disconnect = connectColorScheme(options.root);
|
|
29
|
+
stop = () => {
|
|
30
|
+
disconnect();
|
|
31
|
+
stop = null;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const missing = CLASSES.filter((c) => !document.documentElement.classList.contains(c));
|
|
35
|
+
if (missing.length) {
|
|
36
|
+
console.warn(
|
|
37
|
+
`Campo: <html> is missing class ${missing.join(' and ')}, so Web Awesome components won't take Campo's look. ` +
|
|
38
|
+
`Add class="${CLASSES.join(' ')}" to <html> (in Next.js, in the root layout).`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return stop;
|
|
42
|
+
}
|