@oxide/design-system 3.2.0--canary.151.18510677674.0 → 4.0.0--canary.151.18511380774.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/README.md +19 -14
- package/dist/chunk-7VKKHVZC.js +45 -0
- package/dist/chunk-7VKKHVZC.js.map +1 -0
- package/dist/chunk-BTKC2KJ2.js +5472 -0
- package/dist/chunk-BTKC2KJ2.js.map +1 -0
- package/dist/components/src/{index.d.ts → asciidoc/index.d.ts} +0 -4
- package/dist/components/src/{index.js → asciidoc/index.js} +46 -547
- package/dist/components/src/asciidoc/index.js.map +1 -0
- package/dist/components/src/ui/index.js +32 -124
- package/dist/components/src/ui/index.js.map +1 -1
- package/dist/icons/react/index.js +175 -5295
- package/dist/icons/react/index.js.map +1 -1
- package/package.json +3 -11
- package/dist/components/src/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -71,24 +71,33 @@ Subsequently, you can use it as follows:
|
|
|
71
71
|
|
|
72
72
|
This is type-checked, and will throw an error if the corresponding icon doesn't exist.
|
|
73
73
|
|
|
74
|
-
##
|
|
74
|
+
## Usage
|
|
75
75
|
|
|
76
|
-
This
|
|
77
|
-
[`@oxide/react-asciidoc`](https://github.com/oxidecomputer/react-asciidoc) components that
|
|
78
|
-
are reused across multiple internal sites such as docs.oxide.computer, oxide.computer, and
|
|
79
|
-
eventually the rfd.shared.oxide.computer (when its conversion to `react-asciidoc` is
|
|
80
|
-
complete). The associated stylesheet `asciidoc.css` is also included.
|
|
76
|
+
This package provides two main entry points:
|
|
81
77
|
|
|
82
|
-
|
|
78
|
+
### UI Components (`@oxide/design-system/ui`)
|
|
79
|
+
|
|
80
|
+
Basic UI components like Badge, Button, Checkbox, Listbox, Spinner, and Tabs. These are
|
|
81
|
+
lightweight components without dependencies on AsciiDoc processing.
|
|
83
82
|
|
|
84
83
|
```ts
|
|
85
|
-
import {
|
|
84
|
+
import { Button, Badge } from '@oxide/design-system/ui'
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### AsciiDoc Components (`@oxide/design-system/asciidoc`)
|
|
88
|
+
|
|
89
|
+
[`@oxide/react-asciidoc`](https://github.com/oxidecomputer/react-asciidoc) components for
|
|
90
|
+
rendering AsciiDoc content, reused across docs.oxide.computer, oxide.computer, and
|
|
91
|
+
rfd.shared.oxide.computer. The associated stylesheet `asciidoc.css` is also included.
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { AsciiDocBlocks } from '@oxide/design-system/asciidoc'
|
|
86
95
|
|
|
87
96
|
export const opts: Options = {
|
|
88
97
|
overrides: {
|
|
89
98
|
admonition: AsciiDocBlocks.Admonition,
|
|
90
99
|
table: AsciiDocBlocks.Table,
|
|
91
|
-
|
|
100
|
+
section: AsciiDocBlocks.Section,
|
|
92
101
|
},
|
|
93
102
|
}
|
|
94
103
|
```
|
|
@@ -97,11 +106,7 @@ export const opts: Options = {
|
|
|
97
106
|
<Asciidoc content={document} options={opts} />
|
|
98
107
|
```
|
|
99
108
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
The full UI library is housed within the web console repo. The components included in this
|
|
103
|
-
package are those reused across other Oxide sites. When using them, remember to also import
|
|
104
|
-
their associated stylesheets.
|
|
109
|
+
When using these components, remember to also import their associated stylesheets.
|
|
105
110
|
|
|
106
111
|
Be sure to add the components path to the `tailwind.config.js` to ensure the appropriate
|
|
107
112
|
styles are included. For example:
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// components/src/utils.ts
|
|
2
|
+
import cn from "classnames";
|
|
3
|
+
import { createElement } from "react";
|
|
4
|
+
var titleCase = (text) => {
|
|
5
|
+
return text.replace(
|
|
6
|
+
/\w\S*/g,
|
|
7
|
+
(text2) => text2.charAt(0).toUpperCase() + text2.substring(1).toLowerCase()
|
|
8
|
+
);
|
|
9
|
+
};
|
|
10
|
+
var make = (tag) => (
|
|
11
|
+
// only one argument here means string interpolations are not allowed
|
|
12
|
+
(strings) => {
|
|
13
|
+
const Comp = ({ className, children, ...rest }) => createElement(tag, { className: cn(strings[0], className), ...rest }, children);
|
|
14
|
+
Comp.displayName = `classed.${tag}`;
|
|
15
|
+
return Comp;
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
var classed = {
|
|
19
|
+
button: make("button"),
|
|
20
|
+
div: make("div"),
|
|
21
|
+
h1: make("h1"),
|
|
22
|
+
h2: make("h2"),
|
|
23
|
+
h3: make("h3"),
|
|
24
|
+
h4: make("h4"),
|
|
25
|
+
hr: make("hr"),
|
|
26
|
+
header: make("header"),
|
|
27
|
+
input: make("input"),
|
|
28
|
+
label: make("label"),
|
|
29
|
+
li: make("li"),
|
|
30
|
+
main: make("main"),
|
|
31
|
+
ol: make("ol"),
|
|
32
|
+
p: make("p"),
|
|
33
|
+
span: make("span"),
|
|
34
|
+
table: make("table"),
|
|
35
|
+
tbody: make("tbody"),
|
|
36
|
+
td: make("td"),
|
|
37
|
+
th: make("th"),
|
|
38
|
+
tr: make("tr")
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
titleCase,
|
|
43
|
+
classed
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=chunk-7VKKHVZC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../components/src/utils.ts"],"sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, you can obtain one at https://mozilla.org/MPL/2.0/.\n *\n * Copyright Oxide Computer Company\n */\nimport cn from 'classnames'\nimport { createElement, type JSX } from 'react'\n\nconst titleCase = (text: string): string => {\n return text.replace(\n /\\w\\S*/g,\n (text) => text.charAt(0).toUpperCase() + text.substring(1).toLowerCase(),\n )\n}\n\n// all the cuteness of tw.span`text-secondary uppercase` with zero magic\n\nconst make =\n <T extends keyof JSX.IntrinsicElements>(tag: T) =>\n // only one argument here means string interpolations are not allowed\n (strings: TemplateStringsArray) => {\n const Comp = ({ className, children, ...rest }: JSX.IntrinsicElements[T]) =>\n createElement(tag, { className: cn(strings[0], className), ...rest }, children)\n Comp.displayName = `classed.${tag}`\n return Comp\n }\n\n// JSX.IntrinsicElements[T] ensures same props as the real DOM element. For example,\n// classed.span doesn't allow a type attr but classed.input does.\n\nconst classed = {\n button: make('button'),\n div: make('div'),\n h1: make('h1'),\n h2: make('h2'),\n h3: make('h3'),\n h4: make('h4'),\n hr: make('hr'),\n header: make('header'),\n input: make('input'),\n label: make('label'),\n li: make('li'),\n main: make('main'),\n ol: make('ol'),\n p: make('p'),\n span: make('span'),\n table: make('table'),\n tbody: make('tbody'),\n td: make('td'),\n th: make('th'),\n tr: make('tr'),\n} as const\n\n// result: classed.button`text-secondary uppercase` returns a component with those classes\n\nexport { titleCase, classed }\n"],"mappings":";AAOA,OAAO,QAAQ;AACf,SAAS,qBAA+B;AAExC,IAAM,YAAY,CAAC,SAAyB;AAC1C,SAAO,KAAK;AAAA,IACV;AAAA,IACA,CAACA,UAASA,MAAK,OAAO,CAAC,EAAE,YAAY,IAAIA,MAAK,UAAU,CAAC,EAAE,YAAY;AAAA,EACzE;AACF;AAIA,IAAM,OACJ,CAAwC;AAAA;AAAA,EAExC,CAAC,YAAkC;AACjC,UAAM,OAAO,CAAC,EAAE,WAAW,UAAU,GAAG,KAAK,MAC3C,cAAc,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC,GAAG,SAAS,GAAG,GAAG,KAAK,GAAG,QAAQ;AAChF,SAAK,cAAc,WAAW,GAAG;AACjC,WAAO;AAAA,EACT;AAAA;AAKF,IAAM,UAAU;AAAA,EACd,QAAQ,KAAK,QAAQ;AAAA,EACrB,KAAK,KAAK,KAAK;AAAA,EACf,IAAI,KAAK,IAAI;AAAA,EACb,IAAI,KAAK,IAAI;AAAA,EACb,IAAI,KAAK,IAAI;AAAA,EACb,IAAI,KAAK,IAAI;AAAA,EACb,IAAI,KAAK,IAAI;AAAA,EACb,QAAQ,KAAK,QAAQ;AAAA,EACrB,OAAO,KAAK,OAAO;AAAA,EACnB,OAAO,KAAK,OAAO;AAAA,EACnB,IAAI,KAAK,IAAI;AAAA,EACb,MAAM,KAAK,MAAM;AAAA,EACjB,IAAI,KAAK,IAAI;AAAA,EACb,GAAG,KAAK,GAAG;AAAA,EACX,MAAM,KAAK,MAAM;AAAA,EACjB,OAAO,KAAK,OAAO;AAAA,EACnB,OAAO,KAAK,OAAO;AAAA,EACnB,IAAI,KAAK,IAAI;AAAA,EACb,IAAI,KAAK,IAAI;AAAA,EACb,IAAI,KAAK,IAAI;AACf;","names":["text"]}
|