@simpleplatform/ui-kit 0.2.0 → 0.2.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 +56 -14
- package/package.json +1 -1
- package/theme.css +4 -0
package/README.md
CHANGED
|
@@ -30,9 +30,11 @@ by itself.
|
|
|
30
30
|
|
|
31
31
|
## Current component: StatusBadge
|
|
32
32
|
|
|
33
|
+
Load the stylesheet as described in [Loading the stylesheet](#loading-the-stylesheet)
|
|
34
|
+
before using this example.
|
|
35
|
+
|
|
33
36
|
```tsx
|
|
34
37
|
import { StatusBadge } from '@simpleplatform/ui-kit/react'
|
|
35
|
-
import '@simpleplatform/ui-kit/theme.css'
|
|
36
38
|
|
|
37
39
|
export function DeploymentState() {
|
|
38
40
|
return <StatusBadge label="Ready" tone="success" />
|
|
@@ -59,26 +61,62 @@ Both exports are also available from the package root, `@simpleplatform/ui-kit`.
|
|
|
59
61
|
props; the package provides no React provider or implicit SDK client.
|
|
60
62
|
|
|
61
63
|
The Web Component can also be used without React. Import the `elements`
|
|
62
|
-
entry once before using its tag in HTML
|
|
64
|
+
entry once before using its tag in HTML, and load the stylesheet as described
|
|
65
|
+
in [Loading the stylesheet](#loading-the-stylesheet):
|
|
63
66
|
|
|
64
67
|
```ts
|
|
65
68
|
import '@simpleplatform/ui-kit/elements'
|
|
66
|
-
import '@simpleplatform/ui-kit/theme.css'
|
|
67
69
|
```
|
|
68
70
|
|
|
69
71
|
```html
|
|
70
72
|
<simple-status-badge label="Ready" tone="success"></simple-status-badge>
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
### Loading the stylesheet
|
|
76
|
+
|
|
77
|
+
In a Space that uses Tailwind 4, import the kit's stylesheet inside the Space's
|
|
78
|
+
Tailwind stylesheet, directly after `@import "tailwindcss";`. For example,
|
|
79
|
+
`src/styles/theme.css` should begin with:
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
@import "tailwindcss";
|
|
83
|
+
@import "@simpleplatform/ui-kit/theme.css";
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Import that Space stylesheet once from the entry point, such as `src/main.tsx`:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import './styles/theme.css'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The kit contains an `@theme` block that maps Tailwind names to the platform's
|
|
93
|
+
theme tokens and an `@layer utilities` block, so both stylesheets need to pass
|
|
94
|
+
through Tailwind together. Importing the kit's stylesheet separately from
|
|
95
|
+
JavaScript can leave its `@theme` block unprocessed, which the browser ignores,
|
|
96
|
+
and place the utilities layer before Tailwind's base layer. The base reset then
|
|
97
|
+
overrides utilities, removing padding, margins, and borders.
|
|
98
|
+
|
|
99
|
+
In a Space without Tailwind, import `@simpleplatform/ui-kit/theme.css` in the
|
|
100
|
+
Space's own stylesheet and import that stylesheet once from the entry point.
|
|
101
|
+
A plain import supplies the Geist and Geist Mono font files, the `:root`
|
|
102
|
+
platform theme tokens and `.dark` color overrides, the responsive `.container`
|
|
103
|
+
width rules, and the Lucide icon sizing rules. These are ordinary CSS and work
|
|
104
|
+
without Tailwind; the browser ignores the `@theme` block, so a plain import does
|
|
105
|
+
not generate Tailwind utilities or provide its theme aliases. The kit's
|
|
106
|
+
stylesheet does not bundle Tailwind or its base reset.
|
|
107
|
+
|
|
108
|
+
The fonts are bundled with the Space so they load inside its cross-origin
|
|
109
|
+
iframe. `StatusBadge` uses the shared platform tokens for its light and dark
|
|
110
|
+
colors and dimensions. Its neutral tone uses `--simple-color-surface-sunken`
|
|
111
|
+
for the background, `--simple-color-border-default` for the border, and
|
|
112
|
+
`--simple-color-text-secondary` for the text; these tokens contain complete
|
|
113
|
+
CSS color values, not bare HSL triplets. The other tones use the corresponding
|
|
114
|
+
`--simple-color-status-info*`, `--simple-color-status-success*`,
|
|
115
|
+
`--simple-color-status-warning*`, and `--simple-color-status-danger*` tokens.
|
|
116
|
+
A Space may override the `--simple-*` tokens in its own CSS after the imports,
|
|
117
|
+
including `--simple-font-family-sans` for the font stack. These tokens are shared
|
|
118
|
+
with other UI that uses the platform theme; they are not component-local
|
|
119
|
+
`--simple-status-badge-*` variables.
|
|
82
120
|
|
|
83
121
|
### Runtime boundary
|
|
84
122
|
|
|
@@ -113,12 +151,14 @@ itself remains available only through the React entry point.
|
|
|
113
151
|
`RecordForm` is the default choice for a Record Space that wants the complete
|
|
114
152
|
Simple record experience without rebuilding it.
|
|
115
153
|
|
|
154
|
+
Load the stylesheet as described in [Loading the stylesheet](#loading-the-stylesheet)
|
|
155
|
+
before using this example.
|
|
156
|
+
|
|
116
157
|
```tsx
|
|
117
158
|
import type { RecordHandle } from '@simpleplatform/sdk/space'
|
|
118
159
|
import { connect } from '@simpleplatform/sdk/space'
|
|
119
160
|
import { RecordForm } from '@simpleplatform/ui-kit/react'
|
|
120
161
|
import { useEffect, useState } from 'react'
|
|
121
|
-
import '@simpleplatform/ui-kit/theme.css'
|
|
122
162
|
|
|
123
163
|
const client = connect({ targetOrigin: new URL(document.referrer).origin })
|
|
124
164
|
|
|
@@ -209,12 +249,14 @@ customer Spaces to track internal form contracts.
|
|
|
209
249
|
`RecordActivity` is the managed component for displaying the platform activity
|
|
210
250
|
stream (audit log changes and notes) for a record handle.
|
|
211
251
|
|
|
252
|
+
Load the stylesheet as described in [Loading the stylesheet](#loading-the-stylesheet)
|
|
253
|
+
before using this example.
|
|
254
|
+
|
|
212
255
|
```tsx
|
|
213
256
|
import type { RecordHandle } from '@simpleplatform/sdk/space'
|
|
214
257
|
import { connect } from '@simpleplatform/sdk/space'
|
|
215
258
|
import { RecordActivity } from '@simpleplatform/ui-kit/react'
|
|
216
259
|
import { useEffect, useState } from 'react'
|
|
217
|
-
import '@simpleplatform/ui-kit/theme.css'
|
|
218
260
|
|
|
219
261
|
const client = connect({ targetOrigin: new URL(document.referrer).origin })
|
|
220
262
|
|
package/package.json
CHANGED
package/theme.css
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* customers can override them in their own stylesheet.
|
|
8
8
|
*/
|
|
9
9
|
:root {
|
|
10
|
+
/* Native controls, scrollbars and autofill follow the mode; the SDK only toggles .dark. */
|
|
11
|
+
color-scheme: light;
|
|
10
12
|
/* Local-development defaults. A host may replace these with a resolved tenant theme snapshot. */
|
|
11
13
|
--simple-color-canvas: hsl(0 0% 100%);
|
|
12
14
|
--simple-color-canvas-inverse: hsl(240 10% 3.9%);
|
|
@@ -151,6 +153,8 @@
|
|
|
151
153
|
|
|
152
154
|
|
|
153
155
|
.dark {
|
|
156
|
+
/* Native controls, scrollbars and autofill follow the mode; the SDK only toggles .dark. */
|
|
157
|
+
color-scheme: dark;
|
|
154
158
|
--simple-color-action-danger: hsl(0 62.8% 30.6%);
|
|
155
159
|
--simple-color-action-danger-active: hsl(0 62.8% 25%);
|
|
156
160
|
--simple-color-action-danger-hover: hsl(0 62.8% 27%);
|