@oxide/design-system 3.2.0--canary.151.18510677674.0 → 3.2.0--canary.151.18510956047.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/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 +6 -6
- package/dist/components/src/index.js.map +0 -1
|
@@ -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"]}
|