@nilloq/ouds-web 0.1.6 → 0.1.8
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 +17 -115
- package/dist/{alert-bsnEmrzb.js → alert-B4w3fDHo.js} +2 -2
- package/dist/{alert-By364Om4.js → alert-Chns046l.js} +1 -1
- package/dist/alert.js +1 -1
- package/dist/{badge-fffoaFuZ.js → badge-CDpWg-AO.js} +1 -1
- package/dist/badge.js +1 -1
- package/dist/{button-BUziAVbu.js → button-OgsnDYrO.js} +4 -3
- package/dist/{button-nN1Pcwm6.js → button-gcQ7CyWb.js} +3 -2
- package/dist/button.js +1 -1
- package/dist/checkbox-D7TFFuw3.js +196 -0
- package/dist/checkbox-DfYlHYR2.js +155 -0
- package/dist/checkbox.js +1 -1
- package/dist/chip-B3v4pWZD.js +92 -0
- package/dist/chip-DGfqitrQ.js +115 -0
- package/dist/chip.js +2 -0
- package/dist/{control-item-slots-BNXNsI1e.js → control-item-slots-BDoeNuk4.js} +5 -2
- package/dist/{control-item-slots-XV8Gjvf1.js → control-item-slots-Ddp7c8w8.js} +4 -1
- package/dist/elements-alert.js +1 -1
- package/dist/elements-badge.js +1 -1
- package/dist/elements-button.js +1 -1
- package/dist/elements-checkbox.js +1 -1
- package/dist/elements-chip.js +2 -0
- package/dist/elements-modal.js +1 -1
- package/dist/elements-radio.js +1 -1
- package/dist/elements-select.js +1 -1
- package/dist/elements-switch.js +1 -1
- package/dist/elements-tag.js +1 -1
- package/dist/elements-text-area.js +1 -1
- package/dist/elements-text-input.js +1 -1
- package/dist/elements.js +14 -13
- package/dist/index.js +13 -12
- package/dist/{modal-IEXNB8St.js → modal-BAvMVUIE.js} +2 -2
- package/dist/{modal-CHjaB_yR.js → modal-BnT5Kxjg.js} +1 -1
- package/dist/modal.js +1 -1
- package/dist/radio-CDq4r1_L.js +155 -0
- package/dist/radio-TaYThYkI.js +199 -0
- package/dist/radio.js +1 -1
- package/dist/{runtime-dom.esm-bundler-BeOO_l6v.js → runtime-dom.esm-bundler-DLryEdgJ.js} +1 -1
- package/dist/select-BWhJ-QB-.js +195 -0
- package/dist/select-BbeCpnsY.js +136 -0
- package/dist/select.js +1 -1
- package/dist/switch-BmxLKPbL.js +179 -0
- package/dist/switch-D5N-j5F7.js +140 -0
- package/dist/switch.js +1 -1
- package/dist/{tag-Un7w0uDf.js → tag--KKxqOf8.js} +17 -16
- package/dist/tag-D6j9yaoI.js +85 -0
- package/dist/tag.js +1 -1
- package/dist/text-area-Cmn22-fj.js +108 -0
- package/dist/text-area-Cr8RssdQ.js +165 -0
- package/dist/text-area.js +1 -1
- package/dist/text-input-DgFIuIOA.js +235 -0
- package/dist/text-input-i559HVOP.js +163 -0
- package/dist/text-input.js +1 -1
- package/dist/types/chip.d.ts +1 -0
- package/dist/types/components/alert/Alert.vue.d.ts +3 -3
- package/dist/types/components/badge/Badge.vue.d.ts +1 -1
- package/dist/types/components/button/Button.vue.d.ts +3 -1
- package/dist/types/components/button/button.types.d.ts +1 -0
- package/dist/types/components/checkbox/Checkbox.vue.d.ts +4 -15
- package/dist/types/components/checkbox/VueCheckbox.vue.d.ts +9 -3
- package/dist/types/components/checkbox/checkbox.types.d.ts +16 -0
- package/dist/types/components/chip/Chip.vue.d.ts +38 -0
- package/dist/types/components/chip/VueChip.vue.d.ts +32 -0
- package/dist/types/components/chip/chip.context.d.ts +2 -0
- package/dist/types/components/chip/chip.types.d.ts +27 -0
- package/dist/types/components/modal/Modal.vue.d.ts +8 -8
- package/dist/types/components/radio/Radio.vue.d.ts +2 -17
- package/dist/types/components/radio/VueRadio.vue.d.ts +8 -6
- package/dist/types/components/radio/radio.types.d.ts +16 -0
- package/dist/types/components/select/Select.vue.d.ts +2 -19
- package/dist/types/components/select/VueSelect.vue.d.ts +9 -3
- package/dist/types/components/select/select.types.d.ts +24 -0
- package/dist/types/components/shared/control-item-slots.d.ts +1 -0
- package/dist/types/components/switch/Switch.vue.d.ts +2 -14
- package/dist/types/components/switch/VueSwitch.vue.d.ts +9 -3
- package/dist/types/components/switch/switch.types.d.ts +13 -0
- package/dist/types/components/tag/Tag.vue.d.ts +3 -1
- package/dist/types/components/tag/tag.types.d.ts +1 -0
- package/dist/types/components/text-area/TextArea.vue.d.ts +2 -16
- package/dist/types/components/text-area/VueTextArea.vue.d.ts +9 -3
- package/dist/types/components/text-area/text-area.types.d.ts +18 -0
- package/dist/types/components/text-input/TextInput.vue.d.ts +2 -19
- package/dist/types/components/text-input/VueTextInput.vue.d.ts +9 -3
- package/dist/types/components/text-input/text-input.types.d.ts +25 -0
- package/dist/types/elements/chip.d.ts +4 -0
- package/dist/types/elements/index.d.ts +2 -0
- package/dist/types/vue/checkbox.d.ts +1 -1
- package/dist/types/vue/chip.d.ts +2 -0
- package/dist/types/vue/index.d.ts +8 -6
- package/dist/types/vue/radio.d.ts +1 -1
- package/dist/types/vue/select.d.ts +1 -1
- package/dist/types/vue/switch.d.ts +1 -1
- package/dist/types/vue/text-area.d.ts +1 -1
- package/dist/types/vue/text-input.d.ts +1 -1
- package/dist/vue-alert.js +1 -1
- package/dist/vue-button.js +1 -1
- package/dist/vue-checkbox.js +1 -1
- package/dist/vue-chip.js +2 -0
- package/dist/vue-modal.js +1 -1
- package/dist/vue-radio.js +1 -1
- package/dist/vue-select.js +1 -1
- package/dist/vue-switch.js +1 -1
- package/dist/vue-tag.js +1 -1
- package/dist/vue-text-area.js +1 -1
- package/dist/vue-text-input.js +1 -1
- package/dist/vue.js +12 -11
- package/package.json +15 -2
- package/dist/checkbox-PAgQqiIw.js +0 -145
- package/dist/checkbox-g6cqR6wz.js +0 -170
- package/dist/radio-Cmrtred_.js +0 -147
- package/dist/radio-CqVqsZ7n.js +0 -175
- package/dist/select-Bpou1HIY.js +0 -167
- package/dist/select-CWjTpHGb.js +0 -126
- package/dist/switch-CFv0JUeq.js +0 -132
- package/dist/switch-DEYsTCw5.js +0 -157
- package/dist/tag-BdB0YDBJ.js +0 -84
- package/dist/text-area-DkjEGpHg.js +0 -99
- package/dist/text-area-DqBoz2_d.js +0 -139
- package/dist/text-input-DnWjB1vE.js +0 -207
- package/dist/text-input-DxzwRS2R.js +0 -157
package/README.md
CHANGED
|
@@ -1,124 +1,26 @@
|
|
|
1
1
|
# @nilloq/ouds-web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Vue components and framework-independent custom elements styled with OUDS Web 1.6.0.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Components
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Alert
|
|
8
|
+
- Badge
|
|
9
|
+
- Button
|
|
10
|
+
- Checkbox
|
|
11
|
+
- Chip
|
|
12
|
+
- Modal
|
|
13
|
+
- Radio
|
|
14
|
+
- Select
|
|
15
|
+
- Switch
|
|
16
|
+
- Tag
|
|
17
|
+
- Text Area
|
|
18
|
+
- Text Input
|
|
8
19
|
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import { OudsButton } from "@nilloq/ouds-web/vue";
|
|
12
|
-
</script>
|
|
20
|
+
## Documentation and examples
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
<OudsButton>Continue</OudsButton>
|
|
16
|
-
</template>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Use the same pattern for the other components by importing their `Ouds…` component from the Vue entry point. For individual imports, use the matching subpath, such as `@nilloq/ouds-web/vue/button` or `@nilloq/ouds-web/vue/select`. Vue is an optional peer dependency, required only when using this API. Load OUDS Web CSS in the consuming app.
|
|
20
|
-
|
|
21
|
-
## Web components (custom elements)
|
|
22
|
-
|
|
23
|
-
Custom elements can be used without a framework. They render in the light DOM so the page's OUDS stylesheet can style their native HTML. Vue is bundled into the custom element build, so consumers do not need to install or use Vue.
|
|
24
|
-
|
|
25
|
-
Install the package:
|
|
26
|
-
|
|
27
|
-
```sh
|
|
28
|
-
npm install @nilloq/ouds-web
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Include the OUDS Web Orange stylesheet in the consuming page. The components do not load global design-system styles automatically.
|
|
32
|
-
|
|
33
|
-
```html
|
|
34
|
-
<link
|
|
35
|
-
href="https://cdn.jsdelivr.net/npm/@ouds/web-orange@1.6.0/dist/css/ouds-web.min.css"
|
|
36
|
-
rel="stylesheet"
|
|
37
|
-
integrity="sha384-/CYsyb9K6r8k5oSHG3szNxLYPR1OclHp84CIR093c9+junu5Wt5IWbhIweVxLGUZ"
|
|
38
|
-
crossorigin="anonymous"
|
|
39
|
-
/>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
When using a bundler, import the package once to register all custom elements. Then use the matching HTML tag. For example:
|
|
43
|
-
|
|
44
|
-
```js
|
|
45
|
-
import "@nilloq/ouds-web";
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
```html
|
|
49
|
-
<ouds-button>Continue</ouds-button>
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
The same pattern applies to the other elements: `<ouds-modal>`, `<ouds-alert>`, `<ouds-badge>`, `<ouds-tag>`, `<ouds-checkbox>`, `<ouds-radio>`, `<ouds-switch>`, `<ouds-select>`, `<ouds-text-input>`, and `<ouds-text-area>`. Without a bundler, load the published ES module directly:
|
|
53
|
-
|
|
54
|
-
```html
|
|
55
|
-
<script
|
|
56
|
-
type="module"
|
|
57
|
-
src="https://cdn.jsdelivr.net/npm/@nilloq/ouds-web@{{libraryVersion}}/dist/index.js"
|
|
58
|
-
></script>
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
To register only one custom element, import its subpath and call its `defineOuds…()` helper. For example:
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
import { defineOudsButton } from "@nilloq/ouds-web/button";
|
|
65
|
-
|
|
66
|
-
defineOudsButton();
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
The subpath exports the component constructor and types without registering it automatically. The same subpath pattern is available for `modal`, `alert`, `badge`, `tag`, `checkbox`, `radio`, `switch`, `select`, `text-input`, and `text-area`; the corresponding `components/…` subpaths are equivalent.
|
|
70
|
-
|
|
71
|
-
## Modal dialogs
|
|
72
|
-
|
|
73
|
-
`OudsModal` uses a native `<dialog>` for focus handling and background inertness. It needs OUDS CSS and no OUDS JavaScript or invoker/closedby polyfills.
|
|
74
|
-
|
|
75
|
-
```vue
|
|
76
|
-
<script setup lang="ts">
|
|
77
|
-
import { ref } from "vue";
|
|
78
|
-
import { OudsModal, OudsButton } from "@nilloq/ouds-web/vue";
|
|
79
|
-
const open = ref(false);
|
|
80
|
-
</script>
|
|
81
|
-
|
|
82
|
-
<template>
|
|
83
|
-
<OudsButton @click="open = true">Edit preferences</OudsButton>
|
|
84
|
-
<OudsModal v-model:open="open" label="Preferences" description="Review your settings.">
|
|
85
|
-
<template #actions="{ close }">
|
|
86
|
-
<OudsButton variant="strong" @click="close('saved')">Save</OudsButton>
|
|
87
|
-
<OudsButton @click="close()">Cancel</OudsButton>
|
|
88
|
-
</template>
|
|
89
|
-
</OudsModal>
|
|
90
|
-
</template>
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
For custom elements, register with `defineOudsModal` from `@nilloq/ouds-web/modal`. After the element mounts, call `element.showModal()` / `element.close(returnValue?)`, or set its boolean `open` property. The `open` attribute also opens it. A `form method="dialog"` inside a slot closes it with the submit button's value. Set Boolean properties to `false` to disable defaults; an attribute such as `dismissible="false"` is still present and does not disable the option.
|
|
94
|
-
|
|
95
|
-
| Property | Default | Purpose |
|
|
96
|
-
| ------------------------------------ | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
97
|
-
| `label`, `description`, `subtitle` | `Dialog`, empty, empty | Dialog text; the title, description, and subtitle slots override these. |
|
|
98
|
-
| `headingLevel` | `h2` | Heading tag, `h1` through `h6`. |
|
|
99
|
-
| `type` | `dialog` | `dialog` or `fullscreen`. |
|
|
100
|
-
| `size` | `default` | `default` or `small`; standard dialogs only. |
|
|
101
|
-
| `fixedHeight`, `nonBlurred` | `false` | Standard dialog height and backdrop variants. |
|
|
102
|
-
| `variant` | `neutral` | `neutral`, `negative`, `positive`, `info`, or `warning`. |
|
|
103
|
-
| `iconLabel` | Status name | Localized accessible status label for functional icons. |
|
|
104
|
-
| `stickyActions`, `horizontalActions` | `false` | Footer placement and mobile action layout. Sticky actions require description or body content; otherwise the footer stays in the body. |
|
|
105
|
-
| `dismissible` | `true` | Show the close button. |
|
|
106
|
-
| `closeLabel` | `Close dialog` | Localized close button label. |
|
|
107
|
-
| `closeOnEscape` | `true` | Allow Escape dismissal. |
|
|
108
|
-
| `closeOnBackdrop` | `false` | Allow clicks outside the dialog to dismiss it. |
|
|
109
|
-
|
|
110
|
-
Slots: `title`, `subtitle`, `description`, `icon` (neutral variant), `previous`, `actions`, and the default rich body slot. Vue's `actions` slot receives `close(returnValue?)`. Supply actions in primary, secondary, tertiary order. Use `autofocus` on content that should receive initial focus. Rounded corners use the global OUDS parent class `use-rounded-corner-modal`.
|
|
111
|
-
|
|
112
|
-
Events: `show` after opening; `close` with the return value; `cancel` for Escape. Vue receives the return value directly and the native cancel event. Custom elements expose the return value as `event.detail[0]` and a cancellable `cancel` event. Calling `preventDefault()` in a cancel listener keeps the dialog open. Vue also emits `update:open` for model synchronization. Use the component methods for opening so state stays synchronized. Separate Vue applications sharing a document should configure unique `app.config.idPrefix` values for generated IDs.
|
|
22
|
+
The [playground](https://nilloq.github.io/ouds-web/) has live examples and documents each component's attributes, slots, and events. Its getting-started guide covers installation and integration for Vue and custom elements.
|
|
113
23
|
|
|
114
24
|
## Development
|
|
115
25
|
|
|
116
|
-
|
|
117
|
-
vp install
|
|
118
|
-
vp run check
|
|
119
|
-
vp test
|
|
120
|
-
vp run build
|
|
121
|
-
vp run playground
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
`vp run playground` builds the custom element and starts the Vue demo app in `playground/`.
|
|
26
|
+
Run `vp install` to install dependencies. Use `vp run check` and `vp test` to validate changes, `vp run build` to build the library, and `vp run playground` to start the local playground.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as e, E as t,
|
|
2
|
-
import {
|
|
1
|
+
import { A as e, E as t, N as n, O as r, a as i, c as a, d as o, f as s, g as c, i as l, j as u, l as d, o as f, r as p, t as m, u as h, v as g } from "./runtime-dom.esm-bundler-DLryEdgJ.js";
|
|
2
|
+
import { r as _, t as v } from "./control-item-slots-BDoeNuk4.js";
|
|
3
3
|
//#region src/components/alert/alert.context.ts
|
|
4
4
|
var y = Symbol("ouds-alert-element"), b = {
|
|
5
5
|
key: 0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as e } from "./control-item-slots-Ddp7c8w8.js";
|
|
2
2
|
import { Fragment as t, computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, inject as c, normalizeClass as l, openBlock as u, ref as d, renderSlot as f, toDisplayString as p, unref as m, vShow as h, withDirectives as g } from "vue";
|
|
3
3
|
//#region src/components/alert/alert.context.ts
|
|
4
4
|
var _ = Symbol("ouds-alert-element"), v = {
|
package/dist/alert.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./alert-
|
|
1
|
+
import { n as e, r as t, t as n } from "./alert-B4w3fDHo.js";
|
|
2
2
|
export { n as OudsAlert, t as alertVariants, e as defineOudsAlert };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as e, a as t, c as n, d as r, g as i, i as a, j as o, l as s, o as c, t as l, u, v as d } from "./runtime-dom.esm-bundler-DLryEdgJ.js";
|
|
2
2
|
//#region src/components/badge/Badge.vue?vue&type=script&setup=true&lang.ts
|
|
3
3
|
var f = {
|
|
4
4
|
key: 0,
|
package/dist/badge.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "./badge-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./badge-CDpWg-AO.js";
|
|
2
2
|
export { r as OudsBadge, n as badgeSizes, e as badgeVariants, t as defineOudsBadge };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as e, a as t, b as n, c as r, d as i, g as a, j as o, l as s, o as c, t as l, v as u } from "./runtime-dom.esm-bundler-DLryEdgJ.js";
|
|
2
2
|
//#region src/components/button/Button.vue?vue&type=script&setup=true&lang.ts
|
|
3
3
|
var d = [
|
|
4
4
|
"type",
|
|
@@ -43,7 +43,8 @@ var d = [
|
|
|
43
43
|
loading: {
|
|
44
44
|
type: Boolean,
|
|
45
45
|
default: !1
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
loadingText: { default: "Loading" }
|
|
47
48
|
},
|
|
48
49
|
setup(i) {
|
|
49
50
|
let l = n(), h = () => l["aria-label"] || l.ariaLabel, g = t(() => [
|
|
@@ -72,7 +73,7 @@ var d = [
|
|
|
72
73
|
cy: "20",
|
|
73
74
|
r: "17"
|
|
74
75
|
}, null, -1)]])) : r("", !0),
|
|
75
|
-
i.loading ? (a(), s("span", m,
|
|
76
|
+
i.loading ? (a(), s("span", m, e(i.loadingText), 1)) : r("", !0)
|
|
76
77
|
], 10, d));
|
|
77
78
|
}
|
|
78
79
|
}), g = [
|
|
@@ -43,7 +43,8 @@ var u = [
|
|
|
43
43
|
loading: {
|
|
44
44
|
type: Boolean,
|
|
45
45
|
default: !1
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
loadingText: { default: "Loading" }
|
|
47
48
|
},
|
|
48
49
|
setup(i) {
|
|
49
50
|
let m = l(), h = () => m["aria-label"] || m.ariaLabel, g = e(() => [
|
|
@@ -72,7 +73,7 @@ var u = [
|
|
|
72
73
|
cy: "20",
|
|
73
74
|
r: "17"
|
|
74
75
|
}, null, -1)]])) : t("", !0),
|
|
75
|
-
i.loading ? (o(), n("span", p,
|
|
76
|
+
i.loading ? (o(), n("span", p, c(i.loadingText), 1)) : t("", !0)
|
|
76
77
|
], 10, u));
|
|
77
78
|
}
|
|
78
79
|
}), h = [
|
package/dist/button.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "./button-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./button-OgsnDYrO.js";
|
|
2
2
|
export { a as OudsButton, i as buttonNavigations, t as buttonSizes, e as buttonTypes, r as buttonVariants, n as defineOudsButton };
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { n as e } from "./control-item-slots-Ddp7c8w8.js";
|
|
2
|
+
import { Fragment as t, computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createSlots as s, createTextVNode as c, defineComponent as l, inject as u, mergeModels as d, mergeProps as f, normalizeClass as p, normalizeStyle as m, openBlock as h, ref as g, renderSlot as _, resolveDynamicComponent as v, toDisplayString as y, toRef as b, unref as x, useAttrs as S, useId as C, useModel as w, watchEffect as T, withCtx as E } from "vue";
|
|
3
|
+
//#region src/components/checkbox/checkbox.context.ts
|
|
4
|
+
var D = Symbol("ouds-checkbox-element-id"), O = ["id"], k = { class: "control-item-assets-container" }, A = { class: "control-item-text-container" }, j = ["id"], M = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "control-item-assets-container"
|
|
7
|
+
}, N = /* @__PURE__ */ l({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "Checkbox",
|
|
10
|
+
props: {
|
|
11
|
+
label: { default: "Checkbox" },
|
|
12
|
+
description: { default: "" },
|
|
13
|
+
value: { default: "" },
|
|
14
|
+
checked: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !1
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !1
|
|
21
|
+
},
|
|
22
|
+
required: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: !1
|
|
25
|
+
},
|
|
26
|
+
divider: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !1
|
|
29
|
+
},
|
|
30
|
+
indeterminate: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
readonly: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !1
|
|
37
|
+
},
|
|
38
|
+
invalid: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !1
|
|
41
|
+
},
|
|
42
|
+
reverse: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: !1
|
|
45
|
+
},
|
|
46
|
+
maxWidth: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !1
|
|
49
|
+
},
|
|
50
|
+
standalone: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: !1
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
setup(s) {
|
|
56
|
+
let l = S();
|
|
57
|
+
function d() {
|
|
58
|
+
let { class: e, style: t, ...n } = l;
|
|
59
|
+
return n;
|
|
60
|
+
}
|
|
61
|
+
let w = b(() => l.id), N = g(), P = C(), F = u(D, void 0), I = e(F !== void 0), L = b(() => F ? `${w.value || F}-input` : w.value || `ouds-checkbox-${P}`), R = b(() => `${L.value}-label`), z = b(() => `${L.value}-description`);
|
|
62
|
+
function B() {
|
|
63
|
+
return !s.standalone && !!(s.description || I("description"));
|
|
64
|
+
}
|
|
65
|
+
function V() {
|
|
66
|
+
let e = [l["aria-describedby"]];
|
|
67
|
+
return B() && e.push(z.value), e.filter(Boolean).join(" ") || void 0;
|
|
68
|
+
}
|
|
69
|
+
function H() {
|
|
70
|
+
return [l["aria-labelledby"], R.value].filter(Boolean).join(" ");
|
|
71
|
+
}
|
|
72
|
+
function U() {
|
|
73
|
+
let e = {
|
|
74
|
+
...d(),
|
|
75
|
+
id: L.value,
|
|
76
|
+
"aria-describedby": V(),
|
|
77
|
+
"aria-invalid": s.invalid || l["aria-invalid"]
|
|
78
|
+
};
|
|
79
|
+
return s.readonly ? {
|
|
80
|
+
...e,
|
|
81
|
+
role: "checkbox",
|
|
82
|
+
"aria-readonly": "true",
|
|
83
|
+
"aria-disabled": "true",
|
|
84
|
+
tabindex: 0,
|
|
85
|
+
"aria-checked": s.indeterminate ? "mixed" : s.checked,
|
|
86
|
+
"aria-labelledby": H()
|
|
87
|
+
} : {
|
|
88
|
+
...e,
|
|
89
|
+
type: "checkbox",
|
|
90
|
+
value: s.value,
|
|
91
|
+
checked: s.checked,
|
|
92
|
+
disabled: s.disabled,
|
|
93
|
+
required: s.required
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
let W = n(() => s.standalone ? s.readonly ? "span" : "label" : "div"), G = n(() => s.standalone ? ["checkbox-standalone", { "component-max-width": s.maxWidth }] : ["checkbox-item", {
|
|
97
|
+
"control-item-divider": s.divider,
|
|
98
|
+
"control-item-reverse": s.reverse,
|
|
99
|
+
"component-max-width": s.maxWidth
|
|
100
|
+
}]);
|
|
101
|
+
return T(() => {
|
|
102
|
+
N.value && "indeterminate" in N.value && (N.value.indeterminate = s.indeterminate);
|
|
103
|
+
}), (e, n) => (h(), r(v(W.value), {
|
|
104
|
+
class: p([G.value, x(l).class]),
|
|
105
|
+
style: m(x(l).style)
|
|
106
|
+
}, {
|
|
107
|
+
default: E(() => [s.standalone ? (h(), a(t, { key: 0 }, [(h(), r(v(s.readonly ? "span" : "input"), f({
|
|
108
|
+
ref_key: "input",
|
|
109
|
+
ref: N,
|
|
110
|
+
class: "control-item-indicator"
|
|
111
|
+
}, U()), null, 16)), o("span", {
|
|
112
|
+
id: R.value,
|
|
113
|
+
class: "visually-hidden"
|
|
114
|
+
}, [_(e.$slots, "label", {}, () => [c(y(s.label), 1)])], 8, O)], 64)) : (h(), a(t, { key: 1 }, [
|
|
115
|
+
o("div", k, [(h(), r(v(s.readonly ? "span" : "input"), f({
|
|
116
|
+
ref_key: "input",
|
|
117
|
+
ref: N,
|
|
118
|
+
class: "control-item-indicator"
|
|
119
|
+
}, U()), null, 16))]),
|
|
120
|
+
o("div", A, [(h(), r(v(s.readonly ? "span" : "label"), {
|
|
121
|
+
id: R.value,
|
|
122
|
+
class: p(["control-item-label", { "is-required": s.required }]),
|
|
123
|
+
for: s.readonly ? void 0 : L.value
|
|
124
|
+
}, {
|
|
125
|
+
default: E(() => [_(e.$slots, "label", {}, () => [c(y(s.label), 1)])]),
|
|
126
|
+
_: 3
|
|
127
|
+
}, 8, [
|
|
128
|
+
"id",
|
|
129
|
+
"class",
|
|
130
|
+
"for"
|
|
131
|
+
])), B() ? (h(), a("p", {
|
|
132
|
+
key: 0,
|
|
133
|
+
id: z.value,
|
|
134
|
+
class: "control-item-description"
|
|
135
|
+
}, [_(e.$slots, "description", {}, () => [c(y(s.description), 1)])], 8, j)) : i("", !0)]),
|
|
136
|
+
x(I)("asset") ? (h(), a("div", M, [_(e.$slots, "asset")])) : i("", !0)
|
|
137
|
+
], 64))]),
|
|
138
|
+
_: 3
|
|
139
|
+
}, 8, ["class", "style"]));
|
|
140
|
+
}
|
|
141
|
+
}), P = /* @__PURE__ */ l({
|
|
142
|
+
inheritAttrs: !1,
|
|
143
|
+
__name: "VueCheckbox",
|
|
144
|
+
props: /*@__PURE__*/ d({
|
|
145
|
+
label: {},
|
|
146
|
+
description: {},
|
|
147
|
+
value: {},
|
|
148
|
+
disabled: { type: Boolean },
|
|
149
|
+
required: { type: Boolean },
|
|
150
|
+
divider: { type: Boolean },
|
|
151
|
+
indeterminate: { type: Boolean },
|
|
152
|
+
readonly: { type: Boolean },
|
|
153
|
+
invalid: { type: Boolean },
|
|
154
|
+
reverse: { type: Boolean },
|
|
155
|
+
maxWidth: { type: Boolean },
|
|
156
|
+
standalone: { type: Boolean }
|
|
157
|
+
}, {
|
|
158
|
+
modelValue: {
|
|
159
|
+
type: Boolean,
|
|
160
|
+
default: !1
|
|
161
|
+
},
|
|
162
|
+
modelModifiers: {}
|
|
163
|
+
}),
|
|
164
|
+
emits: /*@__PURE__*/ d(["change"], ["update:modelValue"]),
|
|
165
|
+
setup(e, { emit: t }) {
|
|
166
|
+
let n = e, i = w(e, "modelValue"), a = t;
|
|
167
|
+
function o(e) {
|
|
168
|
+
i.value = e.target.checked, a("change", e);
|
|
169
|
+
}
|
|
170
|
+
return (e, t) => (h(), r(N, f({
|
|
171
|
+
...e.$attrs,
|
|
172
|
+
...n
|
|
173
|
+
}, {
|
|
174
|
+
checked: i.value,
|
|
175
|
+
onChange: o
|
|
176
|
+
}), s({ _: 2 }, [
|
|
177
|
+
e.$slots.label ? {
|
|
178
|
+
name: "label",
|
|
179
|
+
fn: E(() => [_(e.$slots, "label")]),
|
|
180
|
+
key: "0"
|
|
181
|
+
} : void 0,
|
|
182
|
+
e.$slots.asset ? {
|
|
183
|
+
name: "asset",
|
|
184
|
+
fn: E(() => [_(e.$slots, "asset")]),
|
|
185
|
+
key: "1"
|
|
186
|
+
} : void 0,
|
|
187
|
+
e.$slots.description ? {
|
|
188
|
+
name: "description",
|
|
189
|
+
fn: E(() => [_(e.$slots, "description")]),
|
|
190
|
+
key: "2"
|
|
191
|
+
} : void 0
|
|
192
|
+
]), 1040, ["checked"]));
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
//#endregion
|
|
196
|
+
export { P as t };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { A as e, M as t, N as n, O as r, T as i, a, b as o, c as s, d as c, f as l, g as u, i as d, j as f, k as p, l as m, o as h, p as g, s as _, t as v, u as y, v as b, w as x, x as S, y as C } from "./runtime-dom.esm-bundler-DLryEdgJ.js";
|
|
2
|
+
import { r as w, t as T } from "./control-item-slots-BDoeNuk4.js";
|
|
3
|
+
//#region src/components/checkbox/checkbox.context.ts
|
|
4
|
+
var E = Symbol("ouds-checkbox-element-id"), D = ["id"], O = { class: "control-item-assets-container" }, k = { class: "control-item-text-container" }, A = ["id"], j = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "control-item-assets-container"
|
|
7
|
+
}, M = /* @__PURE__ */ c({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "Checkbox",
|
|
10
|
+
props: {
|
|
11
|
+
label: { default: "Checkbox" },
|
|
12
|
+
description: { default: "" },
|
|
13
|
+
value: { default: "" },
|
|
14
|
+
checked: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !1
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !1
|
|
21
|
+
},
|
|
22
|
+
required: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: !1
|
|
25
|
+
},
|
|
26
|
+
divider: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !1
|
|
29
|
+
},
|
|
30
|
+
indeterminate: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !1
|
|
33
|
+
},
|
|
34
|
+
readonly: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: !1
|
|
37
|
+
},
|
|
38
|
+
invalid: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !1
|
|
41
|
+
},
|
|
42
|
+
reverse: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: !1
|
|
45
|
+
},
|
|
46
|
+
maxWidth: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !1
|
|
49
|
+
},
|
|
50
|
+
standalone: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: !1
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
setup(c) {
|
|
56
|
+
let v = o();
|
|
57
|
+
function T() {
|
|
58
|
+
let { class: e, style: t, ...n } = v;
|
|
59
|
+
return n;
|
|
60
|
+
}
|
|
61
|
+
let M = p(() => v.id), N = r(), P = S(), F = l(E, void 0), I = w(F !== void 0), L = p(() => F ? `${M.value || F}-input` : M.value || `ouds-checkbox-${P}`), R = p(() => `${L.value}-label`), z = p(() => `${L.value}-description`);
|
|
62
|
+
function B() {
|
|
63
|
+
return !c.standalone && !!(c.description || I("description"));
|
|
64
|
+
}
|
|
65
|
+
function V() {
|
|
66
|
+
let e = [v["aria-describedby"]];
|
|
67
|
+
return B() && e.push(z.value), e.filter(Boolean).join(" ") || void 0;
|
|
68
|
+
}
|
|
69
|
+
function H() {
|
|
70
|
+
return [v["aria-labelledby"], R.value].filter(Boolean).join(" ");
|
|
71
|
+
}
|
|
72
|
+
function U() {
|
|
73
|
+
let e = {
|
|
74
|
+
...T(),
|
|
75
|
+
id: L.value,
|
|
76
|
+
"aria-describedby": V(),
|
|
77
|
+
"aria-invalid": c.invalid || v["aria-invalid"]
|
|
78
|
+
};
|
|
79
|
+
return c.readonly ? {
|
|
80
|
+
...e,
|
|
81
|
+
role: "checkbox",
|
|
82
|
+
"aria-readonly": "true",
|
|
83
|
+
"aria-disabled": "true",
|
|
84
|
+
tabindex: 0,
|
|
85
|
+
"aria-checked": c.indeterminate ? "mixed" : c.checked,
|
|
86
|
+
"aria-labelledby": H()
|
|
87
|
+
} : {
|
|
88
|
+
...e,
|
|
89
|
+
type: "checkbox",
|
|
90
|
+
value: c.value,
|
|
91
|
+
checked: c.checked,
|
|
92
|
+
disabled: c.disabled,
|
|
93
|
+
required: c.required
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
let W = a(() => c.standalone ? c.readonly ? "span" : "label" : "div"), G = a(() => c.standalone ? ["checkbox-standalone", { "component-max-width": c.maxWidth }] : ["checkbox-item", {
|
|
97
|
+
"control-item-divider": c.divider,
|
|
98
|
+
"control-item-reverse": c.reverse,
|
|
99
|
+
"component-max-width": c.maxWidth
|
|
100
|
+
}]);
|
|
101
|
+
return x(() => {
|
|
102
|
+
N.value && "indeterminate" in N.value && (N.value.indeterminate = c.indeterminate);
|
|
103
|
+
}), (r, a) => (u(), _(C(W.value), {
|
|
104
|
+
class: f([G.value, e(v).class]),
|
|
105
|
+
style: t(e(v).style)
|
|
106
|
+
}, {
|
|
107
|
+
default: i(() => [c.standalone ? (u(), m(d, { key: 0 }, [(u(), _(C(c.readonly ? "span" : "input"), g({
|
|
108
|
+
ref_key: "input",
|
|
109
|
+
ref: N,
|
|
110
|
+
class: "control-item-indicator"
|
|
111
|
+
}, U()), null, 16)), h("span", {
|
|
112
|
+
id: R.value,
|
|
113
|
+
class: "visually-hidden"
|
|
114
|
+
}, [b(r.$slots, "label", {}, () => [y(n(c.label), 1)])], 8, D)], 64)) : (u(), m(d, { key: 1 }, [
|
|
115
|
+
h("div", O, [(u(), _(C(c.readonly ? "span" : "input"), g({
|
|
116
|
+
ref_key: "input",
|
|
117
|
+
ref: N,
|
|
118
|
+
class: "control-item-indicator"
|
|
119
|
+
}, U()), null, 16))]),
|
|
120
|
+
h("div", k, [(u(), _(C(c.readonly ? "span" : "label"), {
|
|
121
|
+
id: R.value,
|
|
122
|
+
class: f(["control-item-label", { "is-required": c.required }]),
|
|
123
|
+
for: c.readonly ? void 0 : L.value
|
|
124
|
+
}, {
|
|
125
|
+
default: i(() => [b(r.$slots, "label", {}, () => [y(n(c.label), 1)])]),
|
|
126
|
+
_: 3
|
|
127
|
+
}, 8, [
|
|
128
|
+
"id",
|
|
129
|
+
"class",
|
|
130
|
+
"for"
|
|
131
|
+
])), B() ? (u(), m("p", {
|
|
132
|
+
key: 0,
|
|
133
|
+
id: z.value,
|
|
134
|
+
class: "control-item-description"
|
|
135
|
+
}, [b(r.$slots, "description", {}, () => [y(n(c.description), 1)])], 8, A)) : s("", !0)]),
|
|
136
|
+
e(I)("asset") ? (u(), m("div", j, [b(r.$slots, "asset")])) : s("", !0)
|
|
137
|
+
], 64))]),
|
|
138
|
+
_: 3
|
|
139
|
+
}, 8, ["class", "style"]));
|
|
140
|
+
}
|
|
141
|
+
}), N = 0, P = v(M, {
|
|
142
|
+
shadowRoot: !1,
|
|
143
|
+
configureApp(e) {
|
|
144
|
+
e.provide(E, `ouds-checkbox-element-${N++}`);
|
|
145
|
+
}
|
|
146
|
+
}), F = class extends P {
|
|
147
|
+
connectedCallback() {
|
|
148
|
+
T(this), super.connectedCallback();
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
function I() {
|
|
152
|
+
typeof customElements < "u" && (customElements.get("ouds-checkbox") || customElements.define("ouds-checkbox", F));
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
155
|
+
export { I as n, F as t };
|
package/dist/checkbox.js
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { A as e, C as t, M as n, N as r, O as i, S as a, b as o, d as s, f as c, g as l, i as u, j as d, k as f, l as p, n as m, o as h, p as g, t as _, u as v, v as y, x as b } from "./runtime-dom.esm-bundler-DLryEdgJ.js";
|
|
2
|
+
import { n as x, t as S } from "./control-item-slots-BDoeNuk4.js";
|
|
3
|
+
//#region src/components/chip/chip.context.ts
|
|
4
|
+
var C = Symbol("ouds-chip-element-id"), w = ["aria-label"], T = [
|
|
5
|
+
"id",
|
|
6
|
+
"type",
|
|
7
|
+
"name",
|
|
8
|
+
"value",
|
|
9
|
+
"checked",
|
|
10
|
+
"disabled"
|
|
11
|
+
], E = ["for"], D = ["disabled"], O = /* @__PURE__ */ s({
|
|
12
|
+
inheritAttrs: !1,
|
|
13
|
+
__name: "Chip",
|
|
14
|
+
props: {
|
|
15
|
+
variant: { default: "filter" },
|
|
16
|
+
inputType: { default: "checkbox" },
|
|
17
|
+
label: { default: "Chip" },
|
|
18
|
+
ariaLabel: { default: "" },
|
|
19
|
+
checked: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !1
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !1
|
|
26
|
+
},
|
|
27
|
+
name: { default: "" },
|
|
28
|
+
value: { default: "" },
|
|
29
|
+
iconOnly: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: !1
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
emits: ["change", "update:checked"],
|
|
35
|
+
setup(s, { emit: _ }) {
|
|
36
|
+
let S = s, O = _, k = o(), A = b(), j = c(C, void 0), M = m(), N = a();
|
|
37
|
+
function P() {
|
|
38
|
+
return j && M ? x(M, "default") : !!N.default;
|
|
39
|
+
}
|
|
40
|
+
let F = f(() => j ? `${k.id || j}-input` : String(k.id || `ouds-chip-${A}`)), I = i(S.checked);
|
|
41
|
+
t(() => S.checked, (e) => {
|
|
42
|
+
I.value = e;
|
|
43
|
+
});
|
|
44
|
+
function L() {
|
|
45
|
+
let { class: e, style: t, id: n, "aria-label": r, ...i } = k;
|
|
46
|
+
return i;
|
|
47
|
+
}
|
|
48
|
+
function R(e) {
|
|
49
|
+
I.value = e.target.checked, O("update:checked", I.value), O("change", e);
|
|
50
|
+
}
|
|
51
|
+
return (t, i) => (l(), p("ul", {
|
|
52
|
+
class: d(["chips-container", e(k).class]),
|
|
53
|
+
style: n(e(k).style),
|
|
54
|
+
"aria-label": s.ariaLabel || (s.variant === "filter" ? "Filter options" : "Suggestions")
|
|
55
|
+
}, [h("li", { class: d(["chip", `chip-${s.variant}`]) }, [s.variant === "filter" ? (l(), p(u, { key: 0 }, [h("input", g(L(), {
|
|
56
|
+
id: F.value,
|
|
57
|
+
type: s.inputType,
|
|
58
|
+
name: s.name || void 0,
|
|
59
|
+
value: s.value,
|
|
60
|
+
checked: I.value,
|
|
61
|
+
disabled: s.disabled,
|
|
62
|
+
onChange: R
|
|
63
|
+
}), null, 16, T), h("label", {
|
|
64
|
+
for: F.value,
|
|
65
|
+
class: d(["chip-interactive", { "chip-icon": s.iconOnly }])
|
|
66
|
+
}, [h("span", { class: d({ "visually-hidden": s.iconOnly }) }, [P() ? y(t.$slots, "default", {}, void 0, void 0, 0) : (l(), p(u, { key: 1 }, [v(r(s.label), 1)], 64))], 2), y(t.$slots, "icon")], 10, E)], 64)) : (l(), p("button", g({ key: 1 }, L(), {
|
|
67
|
+
class: ["chip-interactive", { "chip-icon": s.iconOnly }],
|
|
68
|
+
type: "button",
|
|
69
|
+
disabled: s.disabled
|
|
70
|
+
}), [y(t.$slots, "icon"), h("span", { class: d({ "visually-hidden": s.iconOnly }) }, [P() ? y(t.$slots, "default", {}, void 0, void 0, 0) : (l(), p(u, { key: 1 }, [v(r(s.label), 1)], 64))], 2)], 16, D))], 2)], 14, w));
|
|
71
|
+
}
|
|
72
|
+
}), k = 0, A = _(O, {
|
|
73
|
+
shadowRoot: !1,
|
|
74
|
+
configureApp(e) {
|
|
75
|
+
e.provide(C, `ouds-chip-element-${k++}`);
|
|
76
|
+
}
|
|
77
|
+
}), j = class extends A {
|
|
78
|
+
onChecked = (e) => {
|
|
79
|
+
this.checked = e.detail[0];
|
|
80
|
+
};
|
|
81
|
+
connectedCallback() {
|
|
82
|
+
S(this), this.addEventListener("update:checked", this.onChecked), super.connectedCallback();
|
|
83
|
+
}
|
|
84
|
+
disconnectedCallback() {
|
|
85
|
+
this.removeEventListener("update:checked", this.onChecked), super.disconnectedCallback();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
function M() {
|
|
89
|
+
typeof customElements < "u" && (customElements.get("ouds-chip") || customElements.define("ouds-chip", j));
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { M as n, j as t };
|