@uh-design-system/component-library 0.5.1 → 0.5.2
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 +1 -1
- package/dist/cjs/ds-accordion_3.cjs.entry.js +8 -5
- package/dist/cjs/ds-checkbox-group.cjs.entry.js +2 -3
- package/dist/cjs/ds-checkbox.cjs.entry.js +6 -4
- package/dist/cjs/ds-link-with-arrow.cjs.entry.js +2 -3
- package/dist/cjs/ds-link.cjs.entry.js +2 -3
- package/dist/cjs/ds-text-input.cjs.entry.js +10 -6
- package/dist/cjs/ds-visually-hidden.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{attributes-5f5b58be.js → utils-3412cbed.js} +41 -2
- package/dist/collection/components/00-foundations/icons/categories/actions.js +2 -0
- package/dist/collection/components/01-base-components/ds-button/ds-button.js +4 -3
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.css +4 -0
- package/dist/collection/components/01-base-components/ds-checkbox/ds-checkbox.js +5 -2
- package/dist/collection/components/01-base-components/ds-text-input/ds-text-input.js +11 -6
- package/dist/collection/components/01-base-components/ds-text-input/stories/ds-text-input.stories.js +2 -2
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.css +1 -1
- package/dist/collection/components/01-base-components/ds-visually-hidden/ds-visually-hidden.js +1 -1
- package/dist/collection/utils/attributes/attributes.js +14 -3
- 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-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/{attributes-7d09be1b.js → utils-cfc536bc.js} +1 -1
- package/dist/components/attributes.js +15 -3
- package/dist/components/ds-button2.js +4 -3
- package/dist/components/ds-checkbox2.js +6 -3
- package/dist/components/ds-icon2.js +3 -0
- package/dist/components/ds-text-input.js +11 -6
- package/dist/components/ds-visually-hidden2.js +2 -2
- package/dist/esm/component-library.js +1 -1
- package/dist/esm/ds-accordion_3.entry.js +7 -4
- package/dist/esm/ds-checkbox-group.entry.js +1 -2
- package/dist/esm/ds-checkbox.entry.js +6 -4
- package/dist/esm/ds-link-with-arrow.entry.js +1 -2
- package/dist/esm/ds-link.entry.js +1 -2
- package/dist/esm/ds-text-input.entry.js +10 -6
- package/dist/esm/ds-visually-hidden.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{attributes-7d09be1b.js → utils-cfc536bc.js} +38 -3
- package/dist/types/components/01-base-components/ds-text-input/ds-text-input.d.ts +2 -1
- package/dist/types/components.d.ts +2 -2
- package/dist/types/utils/attributes/attributes.d.ts +2 -1
- package/package.json +2 -2
- package/dist/cjs/utils-2ba5e075.js +0 -28
- package/dist/component-library/utils-5daa5bc0.js +0 -1
- package/dist/esm/utils-5daa5bc0.js +0 -24
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
const kebabToCamelCase = (str) => str.replace(/-./g, x => x[1].toUpperCase());
|
|
2
|
+
export const inheritSpecifiedAttributes = (el, attributes = []) => {
|
|
2
3
|
const attributeObject = {};
|
|
3
4
|
attributes.forEach(attr => {
|
|
4
5
|
if (el.hasAttribute(attr)) {
|
|
@@ -64,12 +65,22 @@ export const ariaAttributes = [
|
|
|
64
65
|
'aria-valuenow',
|
|
65
66
|
'aria-valuetext',
|
|
66
67
|
];
|
|
67
|
-
const kebabToCamelCase = (attr) => attr.replace(/-./g, x => x[1].toUpperCase());
|
|
68
68
|
export const getAriaAttributeArgTypes = (attrs) => attrs.reduce((acc, curr) => ((acc[kebabToCamelCase(curr)] = { control: 'text', name: curr }), acc), {});
|
|
69
69
|
export const inheritAriaAttributes = (el, ignoreList) => {
|
|
70
70
|
let attributesToInherit = [...ariaAttributes];
|
|
71
71
|
if (ignoreList && ignoreList.length > 0) {
|
|
72
72
|
attributesToInherit = attributesToInherit.filter(attr => !ignoreList.includes(attr));
|
|
73
73
|
}
|
|
74
|
-
return
|
|
74
|
+
return inheritSpecifiedAttributes(el, attributesToInherit);
|
|
75
|
+
};
|
|
76
|
+
export const inheritAttributes = (component, elem) => {
|
|
77
|
+
const attributesToIgnore = new Set(['class', 'style', ...ariaAttributes]);
|
|
78
|
+
const propsToIgnore = new Set(Object.keys(component));
|
|
79
|
+
const attributes = {};
|
|
80
|
+
for (const attr of elem.attributes) {
|
|
81
|
+
if (!propsToIgnore.has(kebabToCamelCase(attr.name)) && !attributesToIgnore.has(attr.name)) {
|
|
82
|
+
attributes[attr.name] = attr.value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return attributes;
|
|
75
86
|
};
|
|
@@ -1 +1 @@
|
|
|
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"],
|
|
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))));
|