@uh-design-system/component-library 0.4.1 → 0.5.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/cjs/component-library.cjs.js +3 -3
- package/dist/cjs/ds-accordion_3.cjs.entry.js +10 -10
- package/dist/cjs/ds-checkbox-group.cjs.entry.js +16 -17
- package/dist/cjs/ds-checkbox.cjs.entry.js +42 -35
- package/dist/cjs/ds-input-validity.cjs.entry.js +4 -6
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +5 -5
- package/dist/cjs/ds-link.cjs.entry.js +5 -5
- package/dist/cjs/ds-text-input.cjs.entry.js +51 -23
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
- package/dist/cjs/{index-b1d61146.js → index-bf84b124.js} +237 -134
- package/dist/cjs/index.cjs.js +8 -0
- package/dist/cjs/{linkUtils-e911e899.js → linkUtils-695da37c.js} +0 -10
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/store-9bd20f3c.js +207 -0
- package/dist/cjs/{utils-c9113835.js → utils-2ba5e075.js} +10 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/00-foundations/types.js +1 -0
- package/dist/collection/components/01-base-components/ds-accordion/ds-accordion.js +6 -6
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +1 -172
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +68 -56
- package/dist/collection/components/01-base-components/ds-checkbox/stories/ds-checkbox.stories.js +1 -0
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.css +1 -1
- package/dist/collection/components/01-base-components/ds-checkbox-group/ds-checkbox-group.js +27 -67
- package/dist/collection/components/01-base-components/ds-icon/ds-icon.js +1 -1
- package/dist/collection/components/01-base-components/ds-input-validity/ds-input-validity.js +6 -9
- package/dist/collection/components/01-base-components/ds-input-validity/stories/ds-input-validity.stories.js +1 -0
- package/dist/collection/components/01-base-components/ds-link/ds-link.css +0 -138
- package/dist/collection/components/01-base-components/ds-link/ds-link.js +4 -4
- package/dist/collection/components/01-base-components/ds-link/stories/ds-link.stories.js +4 -1
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.css +0 -138
- package/dist/collection/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.js +4 -4
- package/dist/collection/components/01-base-components/ds-link-with-arrow/stories/ds-link-with-arrow.stories.js +4 -1
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +73 -27
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.js +82 -13
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +6 -7
- package/dist/collection/components/01-base-components/ds-text-input/utils.js +1 -10
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/index.js +1 -1
- package/dist/collection/store.js +13 -0
- package/dist/collection/utils/link/linkUtils.js +0 -9
- package/dist/collection/utils/utils.js +9 -0
- package/dist/component-library/component-library.esm.js +1 -1
- package/dist/component-library/ds-accordion_3.entry.js +1 -1
- package/dist/component-library/ds-checkbox-group.entry.js +1 -1
- package/dist/component-library/ds-checkbox.entry.js +1 -1
- package/dist/component-library/ds-input-validity.entry.js +1 -1
- package/dist/component-library/ds-link-with-arrow.entry.js +1 -1
- package/dist/component-library/ds-link.entry.js +1 -1
- package/dist/component-library/ds-text-input.entry.js +1 -1
- package/dist/component-library/ds-visually-hidden.entry.js +1 -1
- package/dist/component-library/index-434995e1.js +2 -0
- package/dist/component-library/index.esm.js +1 -0
- package/dist/component-library/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -1
- package/dist/component-library/store-b8d17c10.js +1 -0
- package/dist/component-library/utils-5daa5bc0.js +1 -0
- package/dist/components/ds-accordion.js +6 -6
- package/dist/components/ds-button2.js +1 -1
- package/dist/components/ds-checkbox-group.js +22 -24
- package/dist/components/ds-checkbox2.js +44 -37
- package/dist/components/ds-icon2.js +11 -2
- package/dist/components/ds-input-validity2.js +5 -7
- package/dist/components/ds-link-with-arrow.js +4 -4
- package/dist/components/ds-link.js +4 -4
- package/dist/components/ds-text-input.js +57 -28
- package/dist/components/ds-visually-hidden2.js +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +218 -136
- package/dist/components/linkUtils.js +1 -10
- package/dist/components/store.js +204 -0
- package/dist/esm/component-library.js +4 -4
- package/dist/esm/ds-accordion_3.entry.js +10 -10
- package/dist/esm/ds-checkbox-group.entry.js +16 -17
- package/dist/esm/ds-checkbox.entry.js +42 -35
- package/dist/esm/ds-input-validity.entry.js +4 -6
- package/dist/esm/ds-link-with-arrow.entry.js +5 -5
- package/dist/esm/ds-link.entry.js +5 -5
- package/dist/esm/ds-text-input.entry.js +51 -23
- package/dist/esm/ds-visually-hidden.entry.js +2 -2
- package/dist/esm/{index-aaccd233.js → index-434995e1.js} +236 -135
- package/dist/esm/index.js +2 -1
- package/dist/esm/{linkUtils-fe63ff72.js → linkUtils-3d1b28cf.js} +1 -10
- package/dist/esm/loader.js +3 -3
- package/dist/esm/store-b8d17c10.js +204 -0
- package/dist/esm/{utils-b5843ae1.js → utils-5daa5bc0.js} +10 -1
- package/dist/types/components/00-foundations/types.d.ts +3 -0
- package/dist/types/components/01-base-components/ds-checkbox/ds-checkbox.d.ts +14 -14
- package/dist/types/components/01-base-components/ds-checkbox-group/ds-checkbox-group.d.ts +14 -16
- package/dist/types/components/01-base-components/ds-input-validity/ds-input-validity.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-link/ds-link.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-link-with-arrow/ds-link-with-arrow.d.ts +1 -1
- package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +17 -8
- package/dist/types/components/01-base-components/ds-text-input/stories/ds-text-input.examples.stories.d.ts +1 -0
- package/dist/types/components/01-base-components/ds-text-input/utils.d.ts +1 -1
- package/dist/types/components.d.ts +42 -28
- package/dist/types/index.d.ts +1 -0
- package/dist/types/store.d.ts +10 -0
- package/dist/types/utils/link/linkUtils.d.ts +0 -1
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +19 -18
- package/dist/component-library/index-aaccd233.js +0 -2
- package/dist/component-library/utils-b5843ae1.js +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { html } from "lit";
|
|
2
|
+
import { getDsElem } from "../../../../utils/tests/testUtils";
|
|
3
|
+
import { litTemplateResultToString } from "../../../../utils/utils";
|
|
2
4
|
const meta = {
|
|
3
5
|
title: 'Base Components/TextInput/Examples',
|
|
4
6
|
component: 'ds-text-input',
|
|
@@ -27,12 +29,31 @@ export const UsingSlots = {
|
|
|
27
29
|
<p slot='help-text'>Lorem ipsum</p>
|
|
28
30
|
<ds-icon name='archive' slot='prefix'></ds-icon>
|
|
29
31
|
<small slot='suffix'>Suffix</small>
|
|
30
|
-
<div slot='
|
|
31
|
-
<div slot='success-text'>Success text slot</div>
|
|
32
|
+
<div slot='input-validity'>Validity slot</div>
|
|
32
33
|
</ds-text-input>
|
|
33
34
|
`,
|
|
34
35
|
};
|
|
36
|
+
const formValidationDOM = html `
|
|
37
|
+
<form class="ds-sb-form-validation">
|
|
38
|
+
<ds-text-input type="number" label="Minimum value" id="min" name="min" min="5" required></ds-text-input>
|
|
39
|
+
<ds-text-input type="number" label="Maximum value" id="max" name="max" min="100" required></ds-text-input>
|
|
40
|
+
<ds-text-input type="email" label="Email" id="email" name="email" required></ds-text-input>
|
|
41
|
+
<ds-text-input type="tel" label="Telephone" id="tel" name="tel" required></ds-text-input>
|
|
42
|
+
<ds-text-input type="password" label="Password" id="password" name="password" required action-button-aria-label="password toggle"></ds-text-input>
|
|
43
|
+
<ds-text-input type="url" label="Url" id="url" name="url" required></ds-text-input>
|
|
44
|
+
<div class="button-group ds-sb-form-validation__buttons">
|
|
45
|
+
<ds-button type="submit" value="Submit"></ds-button>
|
|
46
|
+
</div>
|
|
47
|
+
</form>
|
|
48
|
+
`;
|
|
35
49
|
export const FormValidation = {
|
|
50
|
+
parameters: {
|
|
51
|
+
docs: {
|
|
52
|
+
source: {
|
|
53
|
+
code: litTemplateResultToString(formValidationDOM),
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
36
57
|
render: () => html `
|
|
37
58
|
<style>
|
|
38
59
|
.ds-sb-form-validation {
|
|
@@ -44,16 +65,64 @@ export const FormValidation = {
|
|
|
44
65
|
align-self: flex-end;
|
|
45
66
|
}
|
|
46
67
|
</style>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<ds-text-input
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
</
|
|
68
|
+
${formValidationDOM}
|
|
69
|
+
`,
|
|
70
|
+
};
|
|
71
|
+
const clientSideValidationDOM = html `
|
|
72
|
+
<div class="ds-sb-client-side-validation">
|
|
73
|
+
<div id="example-error-container">
|
|
74
|
+
<ds-text-input id="example-error" label="Error message" assistive-text='Type "error" and move to next input to display a validation message.'></ds-text-input>
|
|
75
|
+
</div>
|
|
76
|
+
<div id="example-success-container">
|
|
77
|
+
<ds-text-input id="example-success" label="Success message" assistive-text='Type "success" and move to next input to display a validation message.'></ds-text-input>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
`;
|
|
81
|
+
export const ClientSideValidation = {
|
|
82
|
+
parameters: {
|
|
83
|
+
docs: {
|
|
84
|
+
source: {
|
|
85
|
+
code: litTemplateResultToString(clientSideValidationDOM),
|
|
86
|
+
},
|
|
87
|
+
story: {
|
|
88
|
+
autoplay: true,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
render: () => html `
|
|
93
|
+
<style>
|
|
94
|
+
.ds-sb-client-side-validation {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
gap: 1rem;
|
|
98
|
+
}
|
|
99
|
+
</style>
|
|
100
|
+
${clientSideValidationDOM}
|
|
58
101
|
`,
|
|
102
|
+
play: async ({ canvasElement }) => {
|
|
103
|
+
const errorContainerElem = canvasElement.querySelector('#example-error-container');
|
|
104
|
+
const successContainerElem = canvasElement.querySelector('#example-success-container');
|
|
105
|
+
const errorElem = await getDsElem(canvasElement, 'ds-text-input#example-error');
|
|
106
|
+
const successElem = await getDsElem(canvasElement, 'ds-text-input#example-success');
|
|
107
|
+
errorContainerElem.addEventListener('input', (e) => {
|
|
108
|
+
const target = e.target;
|
|
109
|
+
switch (target.value) {
|
|
110
|
+
case 'error':
|
|
111
|
+
return errorElem.errorText = 'Error message';
|
|
112
|
+
default:
|
|
113
|
+
errorElem.errorText = "";
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
successContainerElem.addEventListener('input', (e) => {
|
|
118
|
+
const target = e.target;
|
|
119
|
+
switch (target.value) {
|
|
120
|
+
case 'success':
|
|
121
|
+
return successElem.successText = 'Success message';
|
|
122
|
+
default:
|
|
123
|
+
successElem.successText = "";
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
},
|
|
59
128
|
};
|
package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { textInputTypes } from "../utils";
|
|
2
1
|
import { icons } from "../../../00-foundations/icons/iconList";
|
|
2
|
+
import { textInputTypes } from "../utils";
|
|
3
3
|
const meta = {
|
|
4
4
|
title: 'Base Components/TextInput',
|
|
5
5
|
component: 'ds-text-input',
|
|
@@ -17,7 +17,7 @@ export const Playground = {
|
|
|
17
17
|
argTypes: {
|
|
18
18
|
label: { control: 'text' },
|
|
19
19
|
placeholder: { control: 'text' },
|
|
20
|
-
|
|
20
|
+
identifier: { control: 'text' },
|
|
21
21
|
name: { control: 'text' },
|
|
22
22
|
disabled: { control: 'boolean' },
|
|
23
23
|
required: { control: 'boolean' },
|
|
@@ -40,15 +40,15 @@ export const Playground = {
|
|
|
40
40
|
control: 'select',
|
|
41
41
|
options: textInputTypes,
|
|
42
42
|
},
|
|
43
|
-
ariaLabel: { control: 'text' },
|
|
44
|
-
ariaLabelledBy: { control: 'text' },
|
|
45
|
-
ariaDescribedby: { control: 'text' },
|
|
43
|
+
ariaLabel: { name: 'aria-label', control: 'text' },
|
|
44
|
+
ariaLabelledBy: { name: 'aria-labelledby', control: 'text' },
|
|
45
|
+
ariaDescribedby: { name: 'aria-describedby', control: 'text' },
|
|
46
46
|
autocomplete: { control: 'text' },
|
|
47
47
|
},
|
|
48
48
|
args: {
|
|
49
49
|
label: 'Label',
|
|
50
50
|
placeholder: '',
|
|
51
|
-
|
|
51
|
+
identifier: 'input',
|
|
52
52
|
name: '',
|
|
53
53
|
disabled: false,
|
|
54
54
|
required: false,
|
|
@@ -57,7 +57,6 @@ export const Playground = {
|
|
|
57
57
|
min: -1,
|
|
58
58
|
max: -1,
|
|
59
59
|
maxlength: -1,
|
|
60
|
-
pattern: '',
|
|
61
60
|
assistiveText: '',
|
|
62
61
|
prefixText: '',
|
|
63
62
|
suffixText: '',
|
package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
export class DsVisuallyHidden {
|
|
3
3
|
render() {
|
|
4
|
-
return (h("slot", { key: '
|
|
4
|
+
return (h("slot", { key: '083eaed9210a85360479b367769c8904a6089f64' }));
|
|
5
5
|
}
|
|
6
6
|
static get is() { return "ds-visually-hidden"; }
|
|
7
7
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { configure } from './store';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createStore } from "@stencil/store";
|
|
2
|
+
;
|
|
3
|
+
const initialState = {
|
|
4
|
+
validation: 'client',
|
|
5
|
+
};
|
|
6
|
+
const { state, set } = createStore({
|
|
7
|
+
...initialState,
|
|
8
|
+
});
|
|
9
|
+
export const isValidation = (validation) => state.validation === validation;
|
|
10
|
+
export const configure = ({ validation }) => {
|
|
11
|
+
set('validation', validation || initialState.validation);
|
|
12
|
+
};
|
|
13
|
+
export default state;
|
|
@@ -9,12 +9,3 @@ export const visuallyHiddenAssistiveText = (lang) => {
|
|
|
9
9
|
return 'Opens in a new tab';
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
export const getAriaLabel = (text, ariaLabel) => {
|
|
13
|
-
if (!ariaLabel) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
if (ariaLabel.startsWith(text)) {
|
|
17
|
-
return ariaLabel;
|
|
18
|
-
}
|
|
19
|
-
return [text, ariaLabel].join(' ');
|
|
20
|
-
};
|
|
@@ -56,3 +56,12 @@ export function* idGenerator(id) {
|
|
|
56
56
|
yield `${id}-${currentId++}`;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
export const getAriaLabel = (text, ariaLabel) => {
|
|
60
|
+
if (!ariaLabel) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
if (ariaLabel.startsWith(text)) {
|
|
64
|
+
return ariaLabel;
|
|
65
|
+
}
|
|
66
|
+
return [text, ariaLabel].join(' ');
|
|
67
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as i}from"./index-
|
|
1
|
+
import{p as e,b as i}from"./index-434995e1.js";export{s as setNonce}from"./index-434995e1.js";import{g as t}from"./app-globals-0f993ce5.js";(()=>{const i=import.meta.url,t={};return""!==i&&(t.resourcesUrl=new URL(".",i).href),e(t)})().then((async e=>(await t(),i([["ds-accordion_3",[[1,"ds-accordion",{variant:[1],borderAligned:[4,"border-aligned"],openByDefault:[4,"open-by-default"],accordionId:[1,"accordion-id"],headingLevel:[2,"heading-level"],useCloseButton:[4,"use-close-button"],closeButtonLabel:[1,"close-button-label"],hideTopBorder:[4,"hide-top-border"],isExpanded:[32]},null,{isExpanded:["watchHandler"]}],[6,"ds-button",{value:[1],variant:[1],colour:[1],size:[1],fontWeight:[1,"font-weight"],icon:[1],iconPosition:[1,"icon-position"],type:[1],disabled:[4],fullWidth:[4,"full-width"],ariaDisabled:[1,"aria-disabled"]}],[1,"ds-icon",{name:[1],colour:[1],size:[1],dsTitle:[1,"title"],role:[1],hidden:[4],message:[32]}]]],["ds-input-validity",[[0,"ds-input-validity",{text:[1],type:[1],validityRole:[1,"role"],identifier:[32]}]]],["ds-text-input",[[70,"ds-text-input",{label:[1],placeholder:[1],identifier:[1,"id"],name:[1],disabled:[4],optional:[4],required:[4],readonly:[4],value:[1],min:[2],max:[2],maxlength:[2],pattern:[1],autocomplete:[1],optionalText:[1,"optional-text"],errorText:[1,"error-text"],successText:[1,"success-text"],assistiveText:[1,"assistive-text"],actionButtonAriaLabel:[1,"action-button-aria-label"],hiddenAssistiveText:[1,"hidden-assistive-text"],prefixText:[1,"prefix-text"],suffixText:[1,"suffix-text"],icon:[1],type:[1],ariaLabel:[1,"aria-label"],ariaLabelledBy:[1,"aria-labelledby"],ariaDescribedby:[1,"aria-describedby"],hasFocus:[32],clearButtonVisible:[32],passwordInputVisible:[32],inputActive:[32],validationMessage:[32],togglePasswordVisibility:[64],clearInput:[64]}]]],["ds-checkbox",[[65,"ds-checkbox",{identifier:[1,"id"],checked:[1028],legend:[1],assistiveText:[1,"assistive-text"],text:[1],indeterminate:[4],disabled:[4],errorText:[1,"error-text"],errorsDisabled:[4,"data-errors-disabled"],required:[4],optional:[4],optionalText:[1,"optional-text"],ariaLabel:[1,"aria-label"],value:[32],validationMessage:[32]}]]],["ds-checkbox-group",[[1,"ds-checkbox-group",{legend:[1],assistiveText:[1,"assistive-text"],direction:[1],errorText:[1,"error-text"],text:[1],checked:[4],disabled:[4],childElementsCount:[32],checkedChildElementCount:[32],isIndeterminate:[32],indeterminateChildCheckboxCount:[32],setChecked:[64]},[[0,"dsCheckboxGroupIndeterminateChildChange","listenIndeterminateChildChange"],[0,"dsCheckboxInput","listenCheckboxChange"],[0,"dsCheckboxGroupChange","listenCheckboxGroupChange"]],{disabled:["watchCheckboxDisabledChange"],checked:["watchCheckedChange"],isIndeterminate:["watchIndeterminateChange"],checkedChildElementCount:["watchCheckedChildElementCountChange"]}]]],["ds-visually-hidden",[[1,"ds-visually-hidden"]]],["ds-link",[[1,"ds-link",{text:[1],size:[1],variant:[1],weight:[1],icon:[1025],iconPosition:[1025,"icon-position"],iconTitle:[1,"icon-title"],iconHidden:[4,"icon-hidden"],href:[1],target:[1],download:[4],language:[1,"lang"],ariaLabel:[1,"aria-label"]}]]],["ds-link-with-arrow",[[1,"ds-link-with-arrow",{text:[1],iconPosition:[1,"icon-position"],href:[1],target:[1],language:[1,"lang"],ariaLabel:[1,"aria-label"]}]]]],e))));
|