@nilloq/ouds-web 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/README.md +103 -2
- package/dist/button-BxUIuMAv.js +38 -0
- package/dist/button-C5MSESb5.js +35 -0
- package/dist/button.js +2 -0
- package/dist/elements-button.js +2 -0
- package/dist/elements-tag.js +2 -0
- package/dist/elements.js +5 -0
- package/dist/index.js +4 -0
- package/dist/runtime-dom.esm-bundler-aqFyuQnx.js +2599 -0
- package/dist/tag-BGpa_wYn.js +37 -0
- package/dist/tag-XX1_lffX.js +34 -0
- package/dist/tag.js +2 -0
- package/dist/types/button.d.ts +1 -0
- package/dist/types/components/button/Button.vue.d.ts +21 -0
- package/dist/types/components/button/button.types.d.ts +9 -0
- package/dist/types/components/tag/Tag.vue.d.ts +20 -0
- package/dist/types/components/tag/tag.types.d.ts +9 -0
- package/dist/types/elements/button.d.ts +4 -0
- package/dist/types/elements/index.d.ts +4 -0
- package/dist/types/elements/tag.d.ts +4 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/tag.d.ts +1 -0
- package/dist/types/vue/button.d.ts +2 -0
- package/dist/types/vue/index.d.ts +4 -0
- package/dist/types/vue/tag.d.ts +2 -0
- package/dist/vue-button.js +2 -0
- package/dist/vue-tag.js +2 -0
- package/dist/vue.js +3 -0
- package/package.json +87 -3
package/README.md
CHANGED
|
@@ -1,3 +1,104 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nilloq/ouds-web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vue components and framework-independent custom elements built from the same Vue source and styled with [OUDS Web 1.5](https://web.unified-design-system.orange.com/orange/docs/1.5/).
|
|
4
|
+
|
|
5
|
+
## Vue components
|
|
6
|
+
|
|
7
|
+
Import Vue components from `@nilloq/ouds-web/vue`. These are regular Vue components, so Nuxt can render their native markup during SSR and hydrate it as part of the Vue app.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { OudsButton, OudsTag } from "@nilloq/ouds-web/vue";
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<OudsButton variant="brand">Continue</OudsButton>
|
|
16
|
+
<OudsTag variant="positive">Ready</OudsTag>
|
|
17
|
+
</template>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
For individual imports, use `@nilloq/ouds-web/vue/button` or `@nilloq/ouds-web/vue/tag`. Vue is an optional peer dependency, required only when using this Vue API. Load OUDS Web CSS in the consuming app.
|
|
21
|
+
|
|
22
|
+
## Button
|
|
23
|
+
|
|
24
|
+
The package provides `<ouds-button>` as a custom element. It is generated from the same Vue single-file component as the Vue API. Vue is bundled into the custom element build, so consumers do not need to use or install Vue. It renders into the light DOM so the page's OUDS stylesheet styles its native button.
|
|
25
|
+
|
|
26
|
+
### Install and load OUDS styles
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
npm install @nilloq/ouds-web
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Include the OUDS Web Orange stylesheet in the consuming page. The button element does not load global design-system styles automatically.
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<link
|
|
36
|
+
href="https://cdn.jsdelivr.net/npm/@ouds/web-orange@1.5.0/dist/css/ouds-web.min.css"
|
|
37
|
+
rel="stylesheet"
|
|
38
|
+
integrity="sha384-pASwsNEkGwpJibll6DpHIhi7kAiLDGTLmBJ5GVL1ZZe1iAGMLtrNQwksOznxX+gV"
|
|
39
|
+
crossorigin="anonymous"
|
|
40
|
+
/>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Use in plain HTML
|
|
44
|
+
|
|
45
|
+
When using a bundler, import the package once to register `<ouds-button>`:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
import "@nilloq/ouds-web";
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Then use it like any HTML element:
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<ouds-button>Default</ouds-button>
|
|
55
|
+
<ouds-button variant="brand">Continue</ouds-button>
|
|
56
|
+
<ouds-button variant="negative" disabled>Delete</ouds-button>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Without a bundler, load the published ES module directly:
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<script
|
|
63
|
+
type="module"
|
|
64
|
+
src="https://cdn.jsdelivr.net/npm/@nilloq/ouds-web@0.1.0/dist/index.js"
|
|
65
|
+
></script>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The root import registers all components. You can also import the explicit custom element API from `@nilloq/ouds-web/components`. To import only one component, use its subpath and call its registration helper:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { defineOudsButton, OudsButton } from "@nilloq/ouds-web/button";
|
|
72
|
+
|
|
73
|
+
defineOudsButton();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The subpath exports the `OudsButton` custom-element constructor and types without registering it automatically. `@nilloq/ouds-web/components/button` and `@nilloq/ouds-web/button` are equivalent. The tag equivalents are `@nilloq/ouds-web/components/tag` and `@nilloq/ouds-web/tag`.
|
|
77
|
+
|
|
78
|
+
Supported `variant` values are `default` (the default), `strong`, `brand`, `minimal`, and `negative`. Unknown values fall back to `default`. The `disabled` attribute disables the native button. `type` accepts `button` (the default), `submit`, or `reset`; unknown values fall back to `button`.
|
|
79
|
+
|
|
80
|
+
OUDS button classes are `.btn` and `.btn-default`, `.btn-strong`, `.btn-brand`, `.btn-minimal`, or `.btn-negative`. See the [OUDS Web button guidance](https://web.unified-design-system.orange.com/orange/docs/1.5/components/buttons/) for design and accessibility details.
|
|
81
|
+
|
|
82
|
+
## Tag
|
|
83
|
+
|
|
84
|
+
`<ouds-tag>` is an informational tag. It renders a native `<span>` with OUDS classes and does not add interaction. The `variant` attribute accepts `neutral` (default), `accent`, `positive`, `info`, `warning`, or `negative`. Functional variants include OUDS's status icon. Set `muted` for the muted appearance or `size="small"` for the smaller size.
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<ouds-tag>Category</ouds-tag>
|
|
88
|
+
<ouds-tag variant="accent" muted>Featured</ouds-tag>
|
|
89
|
+
<ouds-tag variant="warning" size="small">Maintenance</ouds-tag>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The tag subpath exports the `OudsTag` custom-element constructor and `defineOudsTag()` registration function. For removable tags, use a separate interactive input-tag component rather than this informational tag. See the [OUDS Web tag examples](https://web.unified-design-system.orange.com/orange/docs/1.5/components/table/) for current variant markup.
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
vp install
|
|
98
|
+
vp run check
|
|
99
|
+
vp test
|
|
100
|
+
vp run build
|
|
101
|
+
vp run playground
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
`vp run playground` builds the custom element and starts the Vue demo app in `playground/`.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, s as o, t as s } from "./runtime-dom.esm-bundler-aqFyuQnx.js";
|
|
2
|
+
//#region src/components/button/Button.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var c = ["type", "disabled"], l = s(/* @__PURE__ */ a({
|
|
4
|
+
__name: "Button",
|
|
5
|
+
props: {
|
|
6
|
+
type: { default: "button" },
|
|
7
|
+
variant: { default: "default" },
|
|
8
|
+
size: { default: "medium" },
|
|
9
|
+
iconOnly: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
},
|
|
13
|
+
disabled: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: !1
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(a) {
|
|
19
|
+
let s = i(() => [
|
|
20
|
+
"btn",
|
|
21
|
+
`btn-${a.variant}`,
|
|
22
|
+
{
|
|
23
|
+
"btn-icon": a.iconOnly,
|
|
24
|
+
"btn-small": a.size === "small"
|
|
25
|
+
}
|
|
26
|
+
]), l = i(() => a.type === "submit" || a.type === "reset" ? a.type : "button");
|
|
27
|
+
return (i, u) => (o(), n("button", {
|
|
28
|
+
class: r(s.value),
|
|
29
|
+
type: l.value,
|
|
30
|
+
disabled: a.disabled
|
|
31
|
+
}, [t(i.$slots, "default", {}, () => [u[0] ||= e("Button", -1)])], 10, c));
|
|
32
|
+
}
|
|
33
|
+
}), { shadowRoot: !1 });
|
|
34
|
+
function u() {
|
|
35
|
+
typeof customElements < "u" && (customElements.get("ouds-button") || customElements.define("ouds-button", l));
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { u as n, l as t };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { computed as e, createElementBlock as t, createTextVNode as n, defineComponent as r, normalizeClass as i, openBlock as a, renderSlot as o } from "vue";
|
|
2
|
+
//#region src/components/button/Button.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var s = ["type", "disabled"], c = /* @__PURE__ */ r({
|
|
4
|
+
__name: "Button",
|
|
5
|
+
props: {
|
|
6
|
+
type: { default: "button" },
|
|
7
|
+
variant: { default: "default" },
|
|
8
|
+
size: { default: "medium" },
|
|
9
|
+
iconOnly: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
},
|
|
13
|
+
disabled: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: !1
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(r) {
|
|
19
|
+
let c = e(() => [
|
|
20
|
+
"btn",
|
|
21
|
+
`btn-${r.variant}`,
|
|
22
|
+
{
|
|
23
|
+
"btn-icon": r.iconOnly,
|
|
24
|
+
"btn-small": r.size === "small"
|
|
25
|
+
}
|
|
26
|
+
]), l = e(() => r.type === "submit" || r.type === "reset" ? r.type : "button");
|
|
27
|
+
return (e, u) => (a(), t("button", {
|
|
28
|
+
class: i(c.value),
|
|
29
|
+
type: l.value,
|
|
30
|
+
disabled: r.disabled
|
|
31
|
+
}, [o(e.$slots, "default", {}, () => [u[0] ||= n("Button", -1)])], 10, s));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//#endregion
|
|
35
|
+
export { c as t };
|
package/dist/button.js
ADDED
package/dist/elements.js
ADDED
package/dist/index.js
ADDED