@politiet/sheriff-web-components 2.0.2 → 2.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/dist/frameworks/preact.d.ts +4 -1
- package/dist/frameworks/preact.d.ts.map +1 -1
- package/dist/frameworks/react.d.ts +8 -5
- package/dist/frameworks/react.d.ts.map +1 -1
- package/dist/frameworks/solidjs.d.ts +1 -0
- package/dist/frameworks/solidjs.d.ts.map +1 -1
- package/dist/frameworks/svelte.d.ts +1 -0
- package/dist/frameworks/svelte.d.ts.map +1 -1
- package/dist/frameworks/vue.d.ts +1 -0
- package/dist/frameworks/vue.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/react-wrappers/SDSCheckboxGroupWrapper.d.ts +1 -0
- package/dist/react-wrappers/SDSCheckboxGroupWrapper.d.ts.map +1 -1
- package/dist/react-wrappers/SDSCheckboxGroupWrapper.js +1 -0
- package/dist/react-wrappers/SDSCheckboxGroupWrapper.js.map +1 -1
- package/dist/react-wrappers/SDSDetailsWrapper.d.ts +6 -0
- package/dist/react-wrappers/SDSDetailsWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSDetailsWrapper.js +12 -0
- package/dist/react-wrappers/SDSDetailsWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSRadioGroupWrapper.d.ts +1 -0
- package/dist/react-wrappers/SDSRadioGroupWrapper.d.ts.map +1 -1
- package/dist/react-wrappers/SDSRadioGroupWrapper.js +1 -0
- package/dist/react-wrappers/SDSRadioGroupWrapper.js.map +1 -1
- package/dist/react-wrappers/index.d.ts +1 -0
- package/dist/react-wrappers/index.d.ts.map +1 -1
- package/dist/react-wrappers/index.js +1 -0
- package/dist/react-wrappers/index.js.map +1 -1
- package/dist/sds-alert/sds-alert.styles.d.ts.map +1 -1
- package/dist/sds-alert/sds-alert.styles.js +27 -3
- package/dist/sds-alert/sds-alert.styles.js.map +1 -1
- package/dist/sds-button/sds-button.styles.d.ts.map +1 -1
- package/dist/sds-button/sds-button.styles.js +13 -1
- package/dist/sds-button/sds-button.styles.js.map +1 -1
- package/dist/sds-checkbox/sds-checkbox.d.ts +20 -1
- package/dist/sds-checkbox/sds-checkbox.d.ts.map +1 -1
- package/dist/sds-checkbox/sds-checkbox.js +54 -2
- package/dist/sds-checkbox/sds-checkbox.js.map +1 -1
- package/dist/sds-checkbox/sds-checkbox.styles.js +1 -1
- package/dist/sds-checkbox/sds-checkbox.styles.js.map +1 -1
- package/dist/sds-checkbox-group/sds-checkbox-group.d.ts +2 -0
- package/dist/sds-checkbox-group/sds-checkbox-group.d.ts.map +1 -1
- package/dist/sds-checkbox-group/sds-checkbox-group.js +37 -24
- package/dist/sds-checkbox-group/sds-checkbox-group.js.map +1 -1
- package/dist/sds-checkbox-group/sds-checkbox-group.styles.js +6 -6
- package/dist/sds-checkbox-group/sds-checkbox-group.styles.js.map +1 -1
- package/dist/sds-chip/sds-chip.d.ts.map +1 -1
- package/dist/sds-chip/sds-chip.js +2 -3
- package/dist/sds-chip/sds-chip.js.map +1 -1
- package/dist/sds-chip/sds-chip.styles.d.ts.map +1 -1
- package/dist/sds-chip/sds-chip.styles.js +7 -3
- package/dist/sds-chip/sds-chip.styles.js.map +1 -1
- package/dist/sds-details/sds-details.d.ts +21 -0
- package/dist/sds-details/sds-details.d.ts.map +1 -0
- package/dist/sds-details/sds-details.js +60 -0
- package/dist/sds-details/sds-details.js.map +1 -0
- package/dist/sds-details/sds-details.styles.d.ts +2 -0
- package/dist/sds-details/sds-details.styles.d.ts.map +1 -0
- package/dist/sds-details/sds-details.styles.js +139 -0
- package/dist/sds-details/sds-details.styles.js.map +1 -0
- package/dist/sds-icon/sds-icon-names.d.ts +1 -1
- package/dist/sds-icon/sds-icon-names.d.ts.map +1 -1
- package/dist/sds-icon/sds-icon-names.js +1 -0
- package/dist/sds-icon/sds-icon-names.js.map +1 -1
- package/dist/sds-icon/sds-icon.system.d.ts +1 -1
- package/dist/sds-icon/sds-icon.system.d.ts.map +1 -1
- package/dist/sds-icon/sds-icon.system.js +2 -0
- package/dist/sds-icon/sds-icon.system.js.map +1 -1
- package/dist/sds-notification/sds-notification.styles.js +1 -1
- package/dist/sds-notification/sds-notification.styles.js.map +1 -1
- package/dist/sds-radio/sds-radio.d.ts +17 -4
- package/dist/sds-radio/sds-radio.d.ts.map +1 -1
- package/dist/sds-radio/sds-radio.js +76 -21
- package/dist/sds-radio/sds-radio.js.map +1 -1
- package/dist/sds-radio-group/sds-radio-group.d.ts +1 -0
- package/dist/sds-radio-group/sds-radio-group.d.ts.map +1 -1
- package/dist/sds-radio-group/sds-radio-group.js +14 -10
- package/dist/sds-radio-group/sds-radio-group.js.map +1 -1
- package/dist/sds-radio-group/sds-radio-group.styles.js +6 -6
- package/dist/sds-radio-group/sds-radio-group.styles.js.map +1 -1
- package/dist/sds-switch/sds-switch.js +2 -2
- package/dist/sds-switch/sds-switch.js.map +1 -1
- package/dist/sds-switch/sds-switch.styles.js +6 -6
- package/dist/sds-switch/sds-switch.styles.js.map +1 -1
- package/dist/sds-text/sds-text.styles.js +2 -2
- package/dist/sds-text/sds-text.styles.js.map +1 -1
- package/dist/sds-textarea/sds-textarea.d.ts +1 -1
- package/dist/sds-textarea/sds-textarea.d.ts.map +1 -1
- package/dist/sds-textarea/sds-textarea.js +14 -12
- package/dist/sds-textarea/sds-textarea.js.map +1 -1
- package/dist/sds-textarea/sds-textarea.styles.js +15 -15
- package/dist/sds-textarea/sds-textarea.styles.js.map +1 -1
- package/dist/sds-textfield/sds-textfield.d.ts +1 -1
- package/dist/sds-textfield/sds-textfield.d.ts.map +1 -1
- package/dist/sds-textfield/sds-textfield.js +16 -14
- package/dist/sds-textfield/sds-textfield.js.map +1 -1
- package/dist/sheriff-web-components.js +578 -233
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ICON_NAMES } from './sds-icon-names';
|
|
2
2
|
export type SystemIcon = Extract<(typeof ICON_NAMES)[number], (typeof SYSTEM_ICONS)[number]>;
|
|
3
|
-
export declare const SYSTEM_ICONS: readonly ["arrow_forward-material-outlined", "check_circle-material-filled", "close-material-outlined", "dangerous-material-filled", "InformationSquareFill-aksel-filled", "lock-material-filled", "search-material-filled", "warning-material-filled"];
|
|
3
|
+
export declare const SYSTEM_ICONS: readonly ["arrow_forward-material-outlined", "check_circle-material-filled", "close-material-outlined", "dangerous-material-filled", "InformationSquareFill-aksel-filled", "lock-material-filled", "search-material-filled", "warning-material-filled", "chevron_up-material-filled"];
|
|
4
4
|
export declare const isSystemIcon: (name: string) => name is SystemIcon;
|
|
5
5
|
export declare const systemIcons: Record<SystemIcon, string>;
|
|
6
6
|
//# sourceMappingURL=sds-icon.system.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-icon.system.d.ts","sourceRoot":"","sources":["../../src/sds-icon/sds-icon.system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7F,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"sds-icon.system.d.ts","sourceRoot":"","sources":["../../src/sds-icon/sds-icon.system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7F,eAAO,MAAM,YAAY,uRAUf,CAAC;AAEX,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,UAEnD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAUlD,CAAC"}
|
|
@@ -7,6 +7,7 @@ export const SYSTEM_ICONS = [
|
|
|
7
7
|
'lock-material-filled',
|
|
8
8
|
'search-material-filled',
|
|
9
9
|
'warning-material-filled',
|
|
10
|
+
'chevron_up-material-filled',
|
|
10
11
|
];
|
|
11
12
|
export const isSystemIcon = (name) => {
|
|
12
13
|
return SYSTEM_ICONS.includes(name);
|
|
@@ -20,5 +21,6 @@ export const systemIcons = {
|
|
|
20
21
|
'lock-material-filled': `<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 -960 960 960"><path d="M225.09-67q-32.68 0-55.95-23.27t-23.27-55.95v-423.82q0-32.91 23.27-56.35t55.95-23.44h58.69v-83.56q0-82.44 57.17-140.18 57.16-57.73 139.02-57.73t139.05 57.73q57.2 57.74 57.2 140.18v83.56h58.69q32.91 0 56.35 23.44t23.44 56.35v423.82q0 32.68-23.44 55.95T734.91-67zm255.08-214.13q31.83 0 54.33-22.03t22.5-52.97q0-30-22.67-54.5t-54.5-24.5-54.33 24.5-22.5 55 22.67 52.5 54.5 22M363-649.83h234v-83.43q0-49.96-33.79-84.11-33.8-34.15-82.96-34.15t-83.21 34.15Q363-783.22 363-733.26z"/></svg>`,
|
|
21
22
|
'search-material-filled': `<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 -960 960 960"><path d="M795.43-105.17 529.04-371q-29.43 24.26-69.11 37.94-39.67 13.67-85.32 13.67-112.12 0-189.87-77.83Q107-475.04 107-585t77.83-187.78q77.82-77.83 188.28-77.83t187.78 77.83q77.33 77.82 77.33 187.93 0 43.98-13.15 83.13-13.16 39.15-39.46 73.59L853-162.74zM373.81-398.61q77.66 0 131.42-54.53Q559-507.67 559-585t-53.85-131.86-131.34-54.53q-78.33 0-132.96 54.53T186.22-585t54.55 131.86 133.04 54.53"/></svg>`,
|
|
22
23
|
'warning-material-filled': `<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 -960 960 960"><path d="M27.56-112.65 480-894.7l452.44 782.05zm456.62-125.48q13.15 0 22.61-9.64 9.47-9.65 9.47-22.8t-9.64-22.33q-9.65-9.19-22.8-9.19t-22.61 9.36q-9.47 9.36-9.47 22.51t9.64 22.62q9.65 9.47 22.8 9.47M454-348h60v-219.48h-60z"/></svg>`,
|
|
24
|
+
'chevron_up-material-filled': `<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 32 32"><path d="m16 11.5 8 8-1.867 1.867L16 15.233l-6.133 6.134L8 19.5z"/></svg>`,
|
|
23
25
|
};
|
|
24
26
|
//# sourceMappingURL=sds-icon.system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-icon.system.js","sourceRoot":"","sources":["../../src/sds-icon/sds-icon.system.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,iCAAiC;IACjC,8BAA8B;IAC9B,yBAAyB;IACzB,2BAA2B;IAC3B,oCAAoC;IACpC,sBAAsB;IACtB,wBAAwB;IACxB,yBAAyB;
|
|
1
|
+
{"version":3,"file":"sds-icon.system.js","sourceRoot":"","sources":["../../src/sds-icon/sds-icon.system.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,iCAAiC;IACjC,8BAA8B;IAC9B,yBAAyB;IACzB,2BAA2B;IAC3B,oCAAoC;IACpC,sBAAsB;IACtB,wBAAwB;IACxB,yBAAyB;IACzB,4BAA4B;CACnB,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAsB,EAAE;IAChE,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAkB,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAA+B;IACtD,iCAAiC,EAAE,uMAAuM;IAC1O,8BAA8B,EAAE,khBAAkhB;IACljB,yBAAyB,EAAE,2NAA2N;IACtP,2BAA2B,EAAE,2VAA2V;IACxX,oCAAoC,EAAE,wZAAwZ;IAC9b,sBAAsB,EAAE,ikBAAikB;IACzlB,wBAAwB,EAAE,4eAA4e;IACtgB,yBAAyB,EAAE,8TAA8T;IACzV,4BAA4B,EAAE,2JAA2J;CACzL,CAAC","sourcesContent":["import { ICON_NAMES } from './sds-icon-names';\n\nexport type SystemIcon = Extract<(typeof ICON_NAMES)[number], (typeof SYSTEM_ICONS)[number]>;\n\nexport const SYSTEM_ICONS = [\n\t'arrow_forward-material-outlined',\n\t'check_circle-material-filled',\n\t'close-material-outlined',\n\t'dangerous-material-filled',\n\t'InformationSquareFill-aksel-filled',\n\t'lock-material-filled',\n\t'search-material-filled',\n\t'warning-material-filled',\n\t'chevron_up-material-filled',\n] as const;\n\nexport const isSystemIcon = (name: string): name is SystemIcon => {\n\treturn SYSTEM_ICONS.includes(name as SystemIcon);\n};\n\nexport const systemIcons: Record<SystemIcon, string> = {\n\t'arrow_forward-material-outlined': `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" viewBox=\"0 -960 960 960\"><path d=\"M662.82-440.39H145.87v-79.22h516.95L423.87-758.57 480-814.7 814.7-480 480-145.87l-56.13-55.56z\"/></svg>`,\n\t'check_circle-material-filled': `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" viewBox=\"0 -960 960 960\"><path d=\"m419.87-289.52 289.22-289.22-57.31-56.87L419.87-403.7 304.96-518.61l-56.31 56.87zm60.21 223.65q-85.47 0-161.01-32.39-75.53-32.4-131.97-88.84T98.26-318.99q-32.39-75.46-32.39-160.93 0-86.47 32.39-162.01 32.4-75.53 88.75-131.5t131.85-88.62 161.01-32.65q86.52 0 162.12 32.61 75.61 32.6 131.53 88.5 55.93 55.89 88.55 131.45Q894.7-566.58 894.7-480q0 85.55-32.65 161.07-32.65 75.53-88.62 131.9T642.01-98.26q-75.46 32.39-161.93 32.39\"/></svg>`,\n\t'close-material-outlined': `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" viewBox=\"0 -960 960 960\"><path d=\"M249-193.43 193.43-249l231-231-231-231L249-766.57l231 231 231-231L766.57-711l-231 231 231 231L711-193.43l-231-231z\"/></svg>`,\n\t'dangerous-material-filled': `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" viewBox=\"0 -960 960 960\"><path d=\"M324.35-105.87 105.87-324.35v-311.87L324.35-854.7h311.87L854.7-636.22v311.87L636.22-105.87zm34.91-206.87L480-433.48l120.74 120.74 47.09-46.52L526.52-480l121.31-120.74-47.09-47.09L480-526.52 359.26-647.83l-46.52 47.09L433.48-480 312.74-359.26z\"/></svg>`,\n\t'InformationSquareFill-aksel-filled': `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" viewBox=\"0 0 24 24\"><path fill-rule=\"evenodd\" d=\"M3.25 4A.75.75 0 0 1 4 3.25h16a.75.75 0 0 1 .75.75v16a.75.75 0 0 1-.75.75H4a.75.75 0 0 1-.75-.75zM11 7.75a1 1 0 1 1 2 0 1 1 0 0 1-2 0m-1.25 3a.75.75 0 0 1 .75-.75H12a.75.75 0 0 1 .75.75v4.75h.75a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1 0-1.5h.75v-4h-.75a.75.75 0 0 1-.75-.75\" clip-rule=\"evenodd\"/></svg>`,\n\t'lock-material-filled': `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" viewBox=\"0 -960 960 960\"><path d=\"M225.09-67q-32.68 0-55.95-23.27t-23.27-55.95v-423.82q0-32.91 23.27-56.35t55.95-23.44h58.69v-83.56q0-82.44 57.17-140.18 57.16-57.73 139.02-57.73t139.05 57.73q57.2 57.74 57.2 140.18v83.56h58.69q32.91 0 56.35 23.44t23.44 56.35v423.82q0 32.68-23.44 55.95T734.91-67zm255.08-214.13q31.83 0 54.33-22.03t22.5-52.97q0-30-22.67-54.5t-54.5-24.5-54.33 24.5-22.5 55 22.67 52.5 54.5 22M363-649.83h234v-83.43q0-49.96-33.79-84.11-33.8-34.15-82.96-34.15t-83.21 34.15Q363-783.22 363-733.26z\"/></svg>`,\n\t'search-material-filled': `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" viewBox=\"0 -960 960 960\"><path d=\"M795.43-105.17 529.04-371q-29.43 24.26-69.11 37.94-39.67 13.67-85.32 13.67-112.12 0-189.87-77.83Q107-475.04 107-585t77.83-187.78q77.82-77.83 188.28-77.83t187.78 77.83q77.33 77.82 77.33 187.93 0 43.98-13.15 83.13-13.16 39.15-39.46 73.59L853-162.74zM373.81-398.61q77.66 0 131.42-54.53Q559-507.67 559-585t-53.85-131.86-131.34-54.53q-78.33 0-132.96 54.53T186.22-585t54.55 131.86 133.04 54.53\"/></svg>`,\n\t'warning-material-filled': `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" viewBox=\"0 -960 960 960\"><path d=\"M27.56-112.65 480-894.7l452.44 782.05zm456.62-125.48q13.15 0 22.61-9.64 9.47-9.65 9.47-22.8t-9.64-22.33q-9.65-9.19-22.8-9.19t-22.61 9.36q-9.47 9.36-9.47 22.51t9.64 22.62q9.65 9.47 22.8 9.47M454-348h60v-219.48h-60z\"/></svg>`,\n\t'chevron_up-material-filled': `<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" viewBox=\"0 0 32 32\"><path d=\"m16 11.5 8 8-1.867 1.867L16 15.233l-6.133 6.134L8 19.5z\"/></svg>`,\n};\n"]}
|
|
@@ -11,7 +11,7 @@ export const styles = css `
|
|
|
11
11
|
--_sds-notification-content-gap: var(--sds-notification-content-gap, var(--sds-spacing-3xs));
|
|
12
12
|
|
|
13
13
|
--_sds-notification-font-family: var(--sds-notification-font-family, var(--sds-typography-font-family-roboto));
|
|
14
|
-
--_sds-notification-font-size: var(--sds-notification-font-size, var(--sds-components-font-size-md));
|
|
14
|
+
--_sds-notification-font-size: var(--sds-notification-font-size, var(--sds-components-font-size-content-md));
|
|
15
15
|
--_sds-notification-font-weight: var(--sds-notification-font-weight, var(--sds-typography-body-md-desktop-font-weight));
|
|
16
16
|
--_sds-notification-line-height: var(--sds-notification-line-height, var(--sds-components-line-height-squeezed-md));
|
|
17
17
|
--_sds-notification-text-color: var(--sds-notification-text-color, var(--sds-color-alert-info-text-default));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-notification.styles.js","sourceRoot":"","sources":["../../src/sds-notification/sds-notification.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyIxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t--_sds-notification-background-color: var(--sds-notification-background-color, var(--sds-color-alert-info-surface-tinted));\n\n\t\t--_sds-notification-border-color: var(--sds-notification-border-color, var(--sds-color-alert-info-border-default));\n\t\t--_sds-notification-border-radius: var(--sds-notification-border-radius, var(--sds-radius-sm));\n\t\t--_sds-notification-border-width: var(--sds-notification-border-width, var(--sds-border-sm));\n\n\t\t--_sds-notification-column-gap: var(--sds-notification-column-gap, var(--sds-spacing-2xs));\n\t\t--_sds-notification-content-gap: var(--sds-notification-content-gap, var(--sds-spacing-3xs));\n\n\t\t--_sds-notification-font-family: var(--sds-notification-font-family, var(--sds-typography-font-family-roboto));\n\t\t--_sds-notification-font-size: var(--sds-notification-font-size, var(--sds-components-font-size-md));\n\t\t--_sds-notification-font-weight: var(--sds-notification-font-weight, var(--sds-typography-body-md-desktop-font-weight));\n\t\t--_sds-notification-line-height: var(--sds-notification-line-height, var(--sds-components-line-height-squeezed-md));\n\t\t--_sds-notification-text-color: var(--sds-notification-text-color, var(--sds-color-alert-info-text-default));\n\n\t\t--_sds-notification-title-font-size: var(--sds-notification-title-font-size, var(--sds-typography-body-lg-desktop-tall-font-size));\n\t\t--_sds-notification-title-font-weight: var(--sds-notification-title-font-weight, var(--sds-typography-body-lg-strong-tall-desktop-font-weight));\n\t\t--_sds-notification-title-line-height: var(--sds-notification-title-line-height, var(--sds-typography-body-lg-strong-tall-desktop-line-height));\n\n\t\t--_sds-notification-icon-color: var(--sds-notification-icon-color, var(--sds-color-alert-info-text-subtle));\n\t\t--_sds-notification-max-line-width: var(--sds-notification-max-line-width, var(--sds-typography-max-line-width));\n\t\t--_sds-notification-padding: var(--sds-notification-padding, var(--sds-spacing-sm));\n\t\t--_sds-notification-remove-btn-radius: var(--sds-notification-remove-btn-radius, var(--sds-radius-xs));\n\n\t\tdisplay: block;\n\t}\n\n\t.sds-notification {\n\t\tdisplay: flex;\n\t\tgap: var(--_sds-notification-column-gap);\n\t\tpadding: var(--_sds-notification-padding);\n\n\t\tbackground-color: var(--_sds-notification-background-color);\n\t\tborder: var(--_sds-notification-border-width) solid var(--_sds-notification-border-color);\n\t\tborder-radius: var(--_sds-notification-border-radius);\n\t\tcolor: var(--_sds-notification-text-color);\n\n\t\tfont-family: var(--_sds-notification-font-family);\n\t\ttext-align: left;\n\t}\n\n\t.sds-notification__type {\n\t\tcolor: var(--_sds-notification-icon-color);\n\t}\n\n\t.sds-notification__content {\n\t\talign-self: center;\n\t\tdisplay: flex;\n\t\tflex: 1;\n\t\tflex-direction: column;\n\t\tgap: var(--_sds-notification-content-gap);\n\t}\n\n\t.sds-notification__actions {\n\t\t--sds-button-padding-inline: 0;\n\t}\n\n\t.sds-notification__icon {\n\t\tdisplay: block;\n\t\tposition: relative;\n\t\tz-index: 1;\n\t}\n\n\t:host([variant='success']) {\n\t\t--_sds-notification-background-color: var(--sds-notification-background-color, var(--sds-color-alert-success-surface-tinted));\n\t\t--_sds-notification-border-color: var(--sds-notification-border-color, var(--sds-color-alert-success-border-default));\n\t\t--_sds-notification-text-color: var(--sds-notification-text-color, var(--sds-color-alert-attention-text-default));\n\t\t--_sds-notification-icon-color: var(--sds-notification-icon-color, var(--sds-color-alert-success-text-subtle));\n\n\t\tsds-button {\n\t\t\t--sds-button-text-color: var(--sds-color-alert-success-action-default);\n\t\t}\n\n\t\tsds-button:hover {\n\t\t\t--sds-button-background-color: var(--sds-color-alert-success-surface-hover);\n\t\t\t--sds-button-border-color: var(--sds-color-alert-success-surface-hover);\n\t\t}\n\n\t\tsds-button:active {\n\t\t\t--sds-button-background-color: var(--sds-color-alert-success-surface-active);\n\t\t\t--sds-button-border-color: var(--sds-color-alert-success-surface-active);\n\t\t}\n\t}\n\n\t:host([variant='warning']), /* Deprecated */\n\t:host([variant='attention']) {\n\t\t--_sds-notification-background-color: var(--sds-notification-background-color, var(--sds-color-alert-attention-surface-tinted));\n\t\t--_sds-notification-border-color: var(--sds-notification-border-color, var(--sds-color-alert-attention-border-default));\n\t\t--_sds-notification-text-color: var(--sds-notification-text-color, var(--sds-color-alert-attention-text-default));\n\t\t--_sds-notification-icon-color: var(--sds-notification-icon-color, var(--sds-color-alert-attention-text-subtle));\n\n\t\tsds-button {\n\t\t\t--sds-button-text-color: var(--sds-color-alert-attention-border-default);\n\t\t}\n\n\t\tsds-button:hover {\n\t\t\t--sds-button-background-color: var(--sds-color-alert-attention-surface-hover);\n\t\t\t--sds-button-border-color: var(--sds-color-alert-attention-surface-hover);\n\t\t}\n\n\t\tsds-button:active {\n\t\t\t--sds-button-background-color: var(--sds-color-alert-attention-surface-active);\n\t\t\t--sds-button-border-color: var(--sds-color-alert-attention-surface-active);\n\t\t}\n\t}\n\n\t:host([variant='critical']), /* Deprecated */\n\t:host([variant='danger']) {\n\t\t--_sds-notification-background-color: var(--sds-notification-background-color, var(--sds-color-alert-danger-surface-tinted));\n\t\t--_sds-notification-border-color: var(--sds-notification-border-color, var(--sds-color-alert-danger-border-default));\n\t\t--_sds-notification-text-color: var(--sds-notification-text-color, var(--sds-color-alert-danger-text-default));\n\t\t--_sds-notification-icon-color: var(--sds-notification-icon-color, var(--sds-color-alert-danger-text-subtle));\n\t}\n\n\t::slotted([slot='title']),\n\t::slotted(:is(h1, h2, h3, h4, h5, h6)) {\n\t\tcolor: var(--_sds-notification-text-color) !important;\n\t\tfont-size: var(--_sds-notification-title-font-size) !important;\n\t\tfont-style: normal !important;\n\t\tfont-weight: var(--_sds-notification-title-font-weight) !important;\n\t\tline-height: var(--_sds-notification-title-line-height) !important;\n\t\tmargin: 0 !important;\n\t\tmax-width: var(--_sds-notification-max-line-width) !important;\n\t}\n\n\t::slotted([slot='message']),\n\t::slotted(:is(p)) {\n\t\tcolor: var(--_sds-notification-text-color) !important;\n\t\tfont-size: var(--_sds-notification-font-size) !important;\n\t\tfont-style: normal !important;\n\t\tfont-weight: var(--_sds-notification-font-weight) !important;\n\t\tline-height: var(--_sds-notification-line-height) !important;\n\t\tmargin: 0 !important;\n\t\tmax-width: var(--_sds-notification-max-line-width) !important;\n\t}\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"sds-notification.styles.js","sourceRoot":"","sources":["../../src/sds-notification/sds-notification.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyIxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t--_sds-notification-background-color: var(--sds-notification-background-color, var(--sds-color-alert-info-surface-tinted));\n\n\t\t--_sds-notification-border-color: var(--sds-notification-border-color, var(--sds-color-alert-info-border-default));\n\t\t--_sds-notification-border-radius: var(--sds-notification-border-radius, var(--sds-radius-sm));\n\t\t--_sds-notification-border-width: var(--sds-notification-border-width, var(--sds-border-sm));\n\n\t\t--_sds-notification-column-gap: var(--sds-notification-column-gap, var(--sds-spacing-2xs));\n\t\t--_sds-notification-content-gap: var(--sds-notification-content-gap, var(--sds-spacing-3xs));\n\n\t\t--_sds-notification-font-family: var(--sds-notification-font-family, var(--sds-typography-font-family-roboto));\n\t\t--_sds-notification-font-size: var(--sds-notification-font-size, var(--sds-components-font-size-content-md));\n\t\t--_sds-notification-font-weight: var(--sds-notification-font-weight, var(--sds-typography-body-md-desktop-font-weight));\n\t\t--_sds-notification-line-height: var(--sds-notification-line-height, var(--sds-components-line-height-squeezed-md));\n\t\t--_sds-notification-text-color: var(--sds-notification-text-color, var(--sds-color-alert-info-text-default));\n\n\t\t--_sds-notification-title-font-size: var(--sds-notification-title-font-size, var(--sds-typography-body-lg-desktop-tall-font-size));\n\t\t--_sds-notification-title-font-weight: var(--sds-notification-title-font-weight, var(--sds-typography-body-lg-strong-tall-desktop-font-weight));\n\t\t--_sds-notification-title-line-height: var(--sds-notification-title-line-height, var(--sds-typography-body-lg-strong-tall-desktop-line-height));\n\n\t\t--_sds-notification-icon-color: var(--sds-notification-icon-color, var(--sds-color-alert-info-text-subtle));\n\t\t--_sds-notification-max-line-width: var(--sds-notification-max-line-width, var(--sds-typography-max-line-width));\n\t\t--_sds-notification-padding: var(--sds-notification-padding, var(--sds-spacing-sm));\n\t\t--_sds-notification-remove-btn-radius: var(--sds-notification-remove-btn-radius, var(--sds-radius-xs));\n\n\t\tdisplay: block;\n\t}\n\n\t.sds-notification {\n\t\tdisplay: flex;\n\t\tgap: var(--_sds-notification-column-gap);\n\t\tpadding: var(--_sds-notification-padding);\n\n\t\tbackground-color: var(--_sds-notification-background-color);\n\t\tborder: var(--_sds-notification-border-width) solid var(--_sds-notification-border-color);\n\t\tborder-radius: var(--_sds-notification-border-radius);\n\t\tcolor: var(--_sds-notification-text-color);\n\n\t\tfont-family: var(--_sds-notification-font-family);\n\t\ttext-align: left;\n\t}\n\n\t.sds-notification__type {\n\t\tcolor: var(--_sds-notification-icon-color);\n\t}\n\n\t.sds-notification__content {\n\t\talign-self: center;\n\t\tdisplay: flex;\n\t\tflex: 1;\n\t\tflex-direction: column;\n\t\tgap: var(--_sds-notification-content-gap);\n\t}\n\n\t.sds-notification__actions {\n\t\t--sds-button-padding-inline: 0;\n\t}\n\n\t.sds-notification__icon {\n\t\tdisplay: block;\n\t\tposition: relative;\n\t\tz-index: 1;\n\t}\n\n\t:host([variant='success']) {\n\t\t--_sds-notification-background-color: var(--sds-notification-background-color, var(--sds-color-alert-success-surface-tinted));\n\t\t--_sds-notification-border-color: var(--sds-notification-border-color, var(--sds-color-alert-success-border-default));\n\t\t--_sds-notification-text-color: var(--sds-notification-text-color, var(--sds-color-alert-attention-text-default));\n\t\t--_sds-notification-icon-color: var(--sds-notification-icon-color, var(--sds-color-alert-success-text-subtle));\n\n\t\tsds-button {\n\t\t\t--sds-button-text-color: var(--sds-color-alert-success-action-default);\n\t\t}\n\n\t\tsds-button:hover {\n\t\t\t--sds-button-background-color: var(--sds-color-alert-success-surface-hover);\n\t\t\t--sds-button-border-color: var(--sds-color-alert-success-surface-hover);\n\t\t}\n\n\t\tsds-button:active {\n\t\t\t--sds-button-background-color: var(--sds-color-alert-success-surface-active);\n\t\t\t--sds-button-border-color: var(--sds-color-alert-success-surface-active);\n\t\t}\n\t}\n\n\t:host([variant='warning']), /* Deprecated */\n\t:host([variant='attention']) {\n\t\t--_sds-notification-background-color: var(--sds-notification-background-color, var(--sds-color-alert-attention-surface-tinted));\n\t\t--_sds-notification-border-color: var(--sds-notification-border-color, var(--sds-color-alert-attention-border-default));\n\t\t--_sds-notification-text-color: var(--sds-notification-text-color, var(--sds-color-alert-attention-text-default));\n\t\t--_sds-notification-icon-color: var(--sds-notification-icon-color, var(--sds-color-alert-attention-text-subtle));\n\n\t\tsds-button {\n\t\t\t--sds-button-text-color: var(--sds-color-alert-attention-border-default);\n\t\t}\n\n\t\tsds-button:hover {\n\t\t\t--sds-button-background-color: var(--sds-color-alert-attention-surface-hover);\n\t\t\t--sds-button-border-color: var(--sds-color-alert-attention-surface-hover);\n\t\t}\n\n\t\tsds-button:active {\n\t\t\t--sds-button-background-color: var(--sds-color-alert-attention-surface-active);\n\t\t\t--sds-button-border-color: var(--sds-color-alert-attention-surface-active);\n\t\t}\n\t}\n\n\t:host([variant='critical']), /* Deprecated */\n\t:host([variant='danger']) {\n\t\t--_sds-notification-background-color: var(--sds-notification-background-color, var(--sds-color-alert-danger-surface-tinted));\n\t\t--_sds-notification-border-color: var(--sds-notification-border-color, var(--sds-color-alert-danger-border-default));\n\t\t--_sds-notification-text-color: var(--sds-notification-text-color, var(--sds-color-alert-danger-text-default));\n\t\t--_sds-notification-icon-color: var(--sds-notification-icon-color, var(--sds-color-alert-danger-text-subtle));\n\t}\n\n\t::slotted([slot='title']),\n\t::slotted(:is(h1, h2, h3, h4, h5, h6)) {\n\t\tcolor: var(--_sds-notification-text-color) !important;\n\t\tfont-size: var(--_sds-notification-title-font-size) !important;\n\t\tfont-style: normal !important;\n\t\tfont-weight: var(--_sds-notification-title-font-weight) !important;\n\t\tline-height: var(--_sds-notification-title-line-height) !important;\n\t\tmargin: 0 !important;\n\t\tmax-width: var(--_sds-notification-max-line-width) !important;\n\t}\n\n\t::slotted([slot='message']),\n\t::slotted(:is(p)) {\n\t\tcolor: var(--_sds-notification-text-color) !important;\n\t\tfont-size: var(--_sds-notification-font-size) !important;\n\t\tfont-style: normal !important;\n\t\tfont-weight: var(--_sds-notification-font-weight) !important;\n\t\tline-height: var(--_sds-notification-line-height) !important;\n\t\tmargin: 0 !important;\n\t\tmax-width: var(--_sds-notification-max-line-width) !important;\n\t}\n`;\n"]}
|
|
@@ -13,33 +13,46 @@ export interface SDSRadioProps {
|
|
|
13
13
|
readonly?: boolean;
|
|
14
14
|
size?: RadioSize;
|
|
15
15
|
'help-text'?: string;
|
|
16
|
+
parentRequestDisabled?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export declare class SDSRadio extends LitElement {
|
|
18
19
|
static styles: import("lit").CSSResult[];
|
|
19
20
|
static formAssociated: boolean;
|
|
20
21
|
readonly internals: ElementInternals;
|
|
21
|
-
|
|
22
|
-
required: SDSRadioProps['disabled'];
|
|
22
|
+
required: SDSRadioProps['required'];
|
|
23
23
|
label: SDSRadioProps['label'];
|
|
24
24
|
hideLabel: SDSRadioProps['hide-label'];
|
|
25
25
|
name?: SDSRadioProps['name'];
|
|
26
26
|
value: SDSRadioProps['value'];
|
|
27
|
-
checked: SDSRadioProps['
|
|
27
|
+
checked: SDSRadioProps['checked'];
|
|
28
28
|
error: SDSRadioProps['error'];
|
|
29
29
|
readOnly: SDSRadioProps['readonly'];
|
|
30
30
|
size: SDSRadioProps['size'];
|
|
31
31
|
helpText?: SDSRadioProps['help-text'];
|
|
32
|
+
get disabled(): SDSRadioProps['disabled'];
|
|
33
|
+
set disabled(value: SDSRadioProps['disabled']);
|
|
34
|
+
/**
|
|
35
|
+
* parentRequestDisabled:
|
|
36
|
+
* - Set by SDSRadioGroup to request disabled/enabled.
|
|
37
|
+
* - Only applied if SDSRadio is NOT self-controlled.
|
|
38
|
+
*/
|
|
39
|
+
get parentRequestDisabled(): SDSRadioProps['parentRequestDisabled'];
|
|
40
|
+
set parentRequestDisabled(value: SDSRadioProps['parentRequestDisabled']);
|
|
32
41
|
control: HTMLInputElement;
|
|
42
|
+
private _disabled;
|
|
43
|
+
private _disabledIsAuthorControlled;
|
|
44
|
+
private _settingDisabledFromParent;
|
|
45
|
+
private _parentRequestDisabled;
|
|
33
46
|
private _initialChecked;
|
|
34
47
|
constructor();
|
|
35
48
|
connectedCallback(): void;
|
|
36
49
|
disconnectedCallback(): void;
|
|
37
50
|
firstUpdated(_changedProperties: PropertyValues): void;
|
|
51
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
38
52
|
private _getGroupRadios;
|
|
39
53
|
private _updateGroupValidation;
|
|
40
54
|
private readonly _handleKeydown;
|
|
41
55
|
formResetCallback(): void;
|
|
42
|
-
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
43
56
|
private _uncheckSiblings;
|
|
44
57
|
private readonly _handleChange;
|
|
45
58
|
private readonly _handleFocus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-radio.d.ts","sourceRoot":"","sources":["../../src/sds-radio/sds-radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAiB,MAAM,KAAK,CAAC;AAMhE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,KAAK,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAExD,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"sds-radio.d.ts","sourceRoot":"","sources":["../../src/sds-radio/sds-radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAiB,MAAM,KAAK,CAAC;AAMhE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,K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AIb,MAAM;CAkCf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,WAAW,EAAE,QAAQ,CAAC;KACtB;CACD"}
|
|
@@ -11,9 +11,43 @@ import { classMap } from 'lit/directives/class-map.js';
|
|
|
11
11
|
import { guardedCustomElement } from '../utils/guarded-custom-element';
|
|
12
12
|
import { styles } from './sds-radio.styles';
|
|
13
13
|
let SDSRadio = class SDSRadio extends LitElement {
|
|
14
|
+
get disabled() {
|
|
15
|
+
return this._disabled;
|
|
16
|
+
}
|
|
17
|
+
set disabled(value) {
|
|
18
|
+
const newVal = value ?? false;
|
|
19
|
+
const oldVal = this._disabled;
|
|
20
|
+
if (oldVal === newVal)
|
|
21
|
+
return;
|
|
22
|
+
this._disabled = newVal;
|
|
23
|
+
this.requestUpdate('disabled', oldVal);
|
|
24
|
+
if (!this._settingDisabledFromParent) {
|
|
25
|
+
this._disabledIsAuthorControlled = newVal;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* parentRequestDisabled:
|
|
30
|
+
* - Set by SDSRadioGroup to request disabled/enabled.
|
|
31
|
+
* - Only applied if SDSRadio is NOT self-controlled.
|
|
32
|
+
*/
|
|
33
|
+
get parentRequestDisabled() {
|
|
34
|
+
return this._parentRequestDisabled;
|
|
35
|
+
}
|
|
36
|
+
set parentRequestDisabled(value) {
|
|
37
|
+
const newVal = value ?? false;
|
|
38
|
+
const oldVal = this._parentRequestDisabled;
|
|
39
|
+
if (oldVal === newVal)
|
|
40
|
+
return;
|
|
41
|
+
this._parentRequestDisabled = newVal;
|
|
42
|
+
this.requestUpdate('parentRequestDisabled', oldVal);
|
|
43
|
+
if (this._disabledIsAuthorControlled)
|
|
44
|
+
return;
|
|
45
|
+
this._settingDisabledFromParent = true;
|
|
46
|
+
this.disabled = newVal;
|
|
47
|
+
this._settingDisabledFromParent = false;
|
|
48
|
+
}
|
|
14
49
|
constructor() {
|
|
15
50
|
super();
|
|
16
|
-
this.disabled = false;
|
|
17
51
|
this.required = false;
|
|
18
52
|
this.label = '';
|
|
19
53
|
this.hideLabel = false;
|
|
@@ -22,6 +56,10 @@ let SDSRadio = class SDSRadio extends LitElement {
|
|
|
22
56
|
this.error = false;
|
|
23
57
|
this.readOnly = false;
|
|
24
58
|
this.size = 'md';
|
|
59
|
+
this._disabled = false;
|
|
60
|
+
this._disabledIsAuthorControlled = false;
|
|
61
|
+
this._settingDisabledFromParent = false;
|
|
62
|
+
this._parentRequestDisabled = false;
|
|
25
63
|
this._initialChecked = false;
|
|
26
64
|
this._handleKeydown = (event) => {
|
|
27
65
|
if (!this.name || this.disabled || this.readOnly)
|
|
@@ -90,6 +128,27 @@ let SDSRadio = class SDSRadio extends LitElement {
|
|
|
90
128
|
super.firstUpdated(_changedProperties);
|
|
91
129
|
this._updateGroupValidation();
|
|
92
130
|
}
|
|
131
|
+
updated(changedProperties) {
|
|
132
|
+
super.updated(changedProperties);
|
|
133
|
+
if (changedProperties.has('checked')) {
|
|
134
|
+
if (this.checked) {
|
|
135
|
+
this._uncheckSiblings();
|
|
136
|
+
this.internals.setFormValue(this.value ?? null);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
this.internals.setFormValue(null);
|
|
140
|
+
}
|
|
141
|
+
this._updateGroupValidation();
|
|
142
|
+
}
|
|
143
|
+
if (changedProperties.has('required') && this.control) {
|
|
144
|
+
this.control.required = this.required ?? false;
|
|
145
|
+
}
|
|
146
|
+
if (!this._disabledIsAuthorControlled && this.disabled !== this._parentRequestDisabled) {
|
|
147
|
+
this._settingDisabledFromParent = true;
|
|
148
|
+
this.disabled = this._parentRequestDisabled ?? false;
|
|
149
|
+
this._settingDisabledFromParent = false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
93
152
|
_getGroupRadios() {
|
|
94
153
|
if (!this.name)
|
|
95
154
|
return [this];
|
|
@@ -118,22 +177,6 @@ let SDSRadio = class SDSRadio extends LitElement {
|
|
|
118
177
|
this.internals.setFormValue(this.checked ? this.value ?? 'on' : null);
|
|
119
178
|
this._updateGroupValidation();
|
|
120
179
|
}
|
|
121
|
-
updated(changedProperties) {
|
|
122
|
-
super.updated(changedProperties);
|
|
123
|
-
if (changedProperties.has('checked')) {
|
|
124
|
-
if (this.checked) {
|
|
125
|
-
this._uncheckSiblings();
|
|
126
|
-
this.internals.setFormValue(this.value ?? null);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
this.internals.setFormValue(null);
|
|
130
|
-
}
|
|
131
|
-
this._updateGroupValidation();
|
|
132
|
-
}
|
|
133
|
-
if (changedProperties.has('required') && this.control) {
|
|
134
|
-
this.control.required = this.required ?? false;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
180
|
_uncheckSiblings() {
|
|
138
181
|
if (!this.name)
|
|
139
182
|
return;
|
|
@@ -170,7 +213,9 @@ let SDSRadio = class SDSRadio extends LitElement {
|
|
|
170
213
|
this.internals.setValidity({ customError: !!message }, message);
|
|
171
214
|
}
|
|
172
215
|
formDisabledCallback(disabled) {
|
|
216
|
+
this._settingDisabledFromParent = true;
|
|
173
217
|
this.disabled = disabled;
|
|
218
|
+
this._settingDisabledFromParent = false;
|
|
174
219
|
if (this.control)
|
|
175
220
|
this.control.disabled = disabled;
|
|
176
221
|
}
|
|
@@ -204,7 +249,8 @@ let SDSRadio = class SDSRadio extends LitElement {
|
|
|
204
249
|
value="${ifDefined(this.value)}"
|
|
205
250
|
?checked="${this.checked ?? false}"
|
|
206
251
|
.checked="${this.checked ?? false}"
|
|
207
|
-
?disabled="${this.disabled}"
|
|
252
|
+
?disabled="${this.disabled ?? false}"
|
|
253
|
+
.disabled="${this.disabled ?? false}"
|
|
208
254
|
?required="${this.required}"
|
|
209
255
|
?readonly="${this.readOnly}"
|
|
210
256
|
@change="${this._handleChange}"
|
|
@@ -221,9 +267,6 @@ let SDSRadio = class SDSRadio extends LitElement {
|
|
|
221
267
|
// Styling
|
|
222
268
|
SDSRadio.styles = [styles];
|
|
223
269
|
SDSRadio.formAssociated = true;
|
|
224
|
-
__decorate([
|
|
225
|
-
property({ type: Boolean, reflect: true })
|
|
226
|
-
], SDSRadio.prototype, "disabled", void 0);
|
|
227
270
|
__decorate([
|
|
228
271
|
property({ type: Boolean, reflect: true })
|
|
229
272
|
], SDSRadio.prototype, "required", void 0);
|
|
@@ -254,6 +297,18 @@ __decorate([
|
|
|
254
297
|
__decorate([
|
|
255
298
|
property({ type: String, attribute: 'help-text' })
|
|
256
299
|
], SDSRadio.prototype, "helpText", void 0);
|
|
300
|
+
__decorate([
|
|
301
|
+
property({ type: Boolean, reflect: true })
|
|
302
|
+
/**
|
|
303
|
+
* disabled:
|
|
304
|
+
* - If set directly (prop/attr), this radio becomes "self-controlled"
|
|
305
|
+
* and ignores parentRequestDisabled.
|
|
306
|
+
* - If not self-controlled, this follows parentRequestDisabled (group/form).
|
|
307
|
+
*/
|
|
308
|
+
], SDSRadio.prototype, "disabled", null);
|
|
309
|
+
__decorate([
|
|
310
|
+
property({ type: Boolean, attribute: false })
|
|
311
|
+
], SDSRadio.prototype, "parentRequestDisabled", null);
|
|
257
312
|
__decorate([
|
|
258
313
|
query('#control')
|
|
259
314
|
], SDSRadio.prototype, "control", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-radio.js","sourceRoot":"","sources":["../../src/sds-radio/sds-radio.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAoBrC,IAAM,QA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C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAsC;AACrB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAA4C;AAC3C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAAuC;AACf;IAAlE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAA6C;AACpE;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAAoC;AAC1B;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;0CAAuC;AAEvE;IAAlB,KAAK,CAAC,UAAU,CAAC;yCAA4B;AAnBlC,QAAQ;IADpB,oBAAoB,CAAC,WAAW,CAAC;GACrB,QAAQ,CAmPpB","sourcesContent":["import { LitElement, PropertyValues, html, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-radio.styles';\nimport { SDS_SIZES } from '../types';\n\ntype RadioSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;\n\nexport interface SDSRadioProps {\n\tdisabled?: boolean;\n\trequired?: boolean;\n\tlabel?: string;\n\t'hide-label'?: boolean;\n\tname?: string;\n\tvalue?: string;\n\tchecked?: boolean;\n\terror?: boolean;\n\treadonly?: boolean;\n\tsize?: RadioSize;\n\t'help-text'?: string;\n}\n\n@guardedCustomElement('sds-radio')\nexport class SDSRadio extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\tstatic formAssociated = true;\n\tpublic readonly internals: ElementInternals;\n\n\t@property({ type: Boolean, reflect: true }) disabled: SDSRadioProps['disabled'] = false;\n\t@property({ type: Boolean, reflect: true }) required: SDSRadioProps['disabled'] = false;\n\t@property({ type: String, reflect: true }) label: SDSRadioProps['label'] = '';\n\t@property({ type: Boolean, reflect: true, attribute: 'hide-label' }) hideLabel: SDSRadioProps['hide-label'] = false;\n\t@property({ type: String, reflect: true }) name?: SDSRadioProps['name'];\n\t@property({ type: String }) value: SDSRadioProps['value'] = 'on';\n\t@property({ type: Boolean, reflect: true }) checked: SDSRadioProps['disabled'] = false;\n\t@property({ type: Boolean, reflect: true }) error: SDSRadioProps['error'] = false;\n\t@property({ type: Boolean, attribute: 'readonly', reflect: true }) readOnly: SDSRadioProps['readonly'] = false;\n\t@property({ type: String, reflect: true }) size: SDSRadioProps['size'] = 'md';\n\t@property({ type: String, attribute: 'help-text' }) helpText?: SDSRadioProps['help-text'];\n\n\t@query('#control') control!: HTMLInputElement;\n\n\tprivate _initialChecked: boolean = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.internals = this.attachInternals();\n\t\tthis.attachShadow({ mode: 'open', delegatesFocus: true });\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis.internals.role = 'radio';\n\t\tif (!this._initialChecked) {\n\t\t\tthis._initialChecked = this.checked ?? false;\n\t\t}\n\t\tthis.addEventListener('keydown', this._handleKeydown);\n\t}\n\n\toverride disconnectedCallback() {\n\t\tsuper.disconnectedCallback();\n\t\tthis.removeEventListener('keydown', this._handleKeydown);\n\t}\n\n\toverride firstUpdated(_changedProperties: PropertyValues): void {\n\t\tsuper.firstUpdated(_changedProperties);\n\t\tthis._updateGroupValidation();\n\t}\n\n\tprivate _getGroupRadios(): SDSRadio[] {\n\t\tif (!this.name) return [this];\n\t\tconst root = this.getRootNode() as Document | ShadowRoot;\n\t\tconst radioGroup = Array.from(root.querySelectorAll<SDSRadio>(`sds-radio[name=\"${this.name}\"]`));\n\t\treturn radioGroup;\n\t}\n\n\tprivate _updateGroupValidation() {\n\t\tconst group: Array<SDSRadio> = this._getGroupRadios();\n\t\tconst isAnyChecked = group.some((radio) => radio.checked);\n\t\tconst isAnyRequired = group.some((radio) => radio.required);\n\t\tgroup.forEach((radio) => {\n\t\t\tif (!radio.control) return;\n\t\t\tif (isAnyRequired) {\n\t\t\t\tradio.internals.setValidity(isAnyChecked ? {} : { valueMissing: true }, isAnyChecked ? '' : radio.control.validationMessage, radio.control);\n\t\t\t} else {\n\t\t\t\tradio.internals.setValidity({});\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate readonly _handleKeydown = (event: KeyboardEvent) => {\n\t\tif (!this.name || this.disabled || this.readOnly) return;\n\n\t\tconst root = this.getRootNode() as Document | ShadowRoot;\n\t\tconst radios = Array.from(root.querySelectorAll<SDSRadio>(`sds-radio[name=\"${this.name}\"]`));\n\t\tconst currentIndex = radios.indexOf(this);\n\n\t\tif (currentIndex === -1) return;\n\n\t\tlet targetIndex: number | null = null;\n\n\t\tswitch (event.key) {\n\t\t\tcase 'ArrowUp':\n\t\t\tcase 'ArrowLeft':\n\t\t\t\ttargetIndex = currentIndex > 0 ? currentIndex - 1 : radios.length - 1;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\tcase 'ArrowRight':\n\t\t\t\ttargetIndex = currentIndex < radios.length - 1 ? currentIndex + 1 : 0;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\tconst targetRadio = radios[targetIndex];\n\t\ttargetRadio?.focus();\n\t\ttargetRadio?.click();\n\t\tevent.preventDefault();\n\t};\n\n\tformResetCallback() {\n\t\tthis.checked = this._initialChecked;\n\t\tthis.control.checked = this._initialChecked;\n\t\tthis.internals.setFormValue(this.checked ? this.value ?? 'on' : null);\n\t\tthis._updateGroupValidation();\n\t}\n\n\toverride updated(changedProperties: Map<string | number | symbol, unknown>) {\n\t\tsuper.updated(changedProperties);\n\t\tif (changedProperties.has('checked')) {\n\t\t\tif (this.checked) {\n\t\t\t\tthis._uncheckSiblings();\n\t\t\t\tthis.internals.setFormValue(this.value ?? null);\n\t\t\t} else {\n\t\t\t\tthis.internals.setFormValue(null);\n\t\t\t}\n\t\t\tthis._updateGroupValidation();\n\t\t}\n\n\t\tif (changedProperties.has('required') && this.control) {\n\t\t\tthis.control.required = this.required ?? false;\n\t\t}\n\t}\n\n\tprivate _uncheckSiblings() {\n\t\tif (!this.name) return;\n\t\tconst radios: Array<SDSRadio> = this._getGroupRadios();\n\n\t\tfor (const radio of radios) {\n\t\t\tif (radio !== this && radio.checked) {\n\t\t\t\tradio.checked = false;\n\t\t\t\tradio.internals.setFormValue(null);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readonly _handleChange = (event: Event) => {\n\t\tif (this.disabled || this.readOnly) {\n\t\t\t(event.target as HTMLInputElement).checked = this.checked ?? false;\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst elem = event.target as HTMLInputElement;\n\t\tthis.checked = elem.checked;\n\t\tif (this.checked) {\n\t\t\tthis._uncheckSiblings();\n\t\t}\n\t\tthis._updateGroupValidation();\n\t\tthis.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));\n\t};\n\n\tprivate readonly _handleFocus = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.dispatchEvent(new CustomEvent('focus', { bubbles: true, composed: true }));\n\t};\n\n\tprivate readonly _handleBlur = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.dispatchEvent(new CustomEvent('blur', { bubbles: true, composed: true }));\n\t};\n\n\tget form() {\n\t\treturn this.internals.form;\n\t}\n\n\tget type(): string {\n\t\treturn 'radio';\n\t}\n\n\tget validity() {\n\t\treturn this.internals.validity;\n\t}\n\n\tget validationMessage() {\n\t\treturn this.internals.validationMessage;\n\t}\n\n\tget willValidate() {\n\t\treturn this.internals.willValidate;\n\t}\n\n\tcheckValidity(): boolean {\n\t\treturn this.internals.checkValidity();\n\t}\n\n\treportValidity(): boolean {\n\t\treturn this.internals.reportValidity();\n\t}\n\n\tsetCustomValidity(message: string): void {\n\t\tthis.internals.setValidity({ customError: !!message }, message);\n\t}\n\n\tformDisabledCallback(disabled: boolean): void {\n\t\tthis.disabled = disabled;\n\t\tif (this.control) this.control.disabled = disabled;\n\t}\n\n\toverride focus(): void {\n\t\tif (!this.disabled) this.shadowRoot?.querySelector('input')?.focus();\n\t}\n\n\toverride blur(): void {\n\t\tif (!this.disabled) this.shadowRoot?.querySelector('input')?.blur();\n\t}\n\n\toverride click(): void {\n\t\tif (!this.disabled && !this.readOnly) this.shadowRoot?.querySelector('input')?.click();\n\t}\n\n\toverride render() {\n\t\tconst radioClasses = {\n\t\t\t'sds-radio': true,\n\t\t\t'sds-radio--error': Boolean(this.error),\n\t\t};\n\n\t\tconst inputClasses = {\n\t\t\t'sds-radio__input': true,\n\t\t\t'sds-radio__input--error': Boolean(this.error),\n\t\t};\n\n\t\treturn html`\n\t\t\t<div class=\"${classMap(radioClasses)}\">\n\t\t\t\t<input\n\t\t\t\t\tid=\"control\"\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\tname=\"${ifDefined(this.name)}\"\n\t\t\t\t\tvalue=\"${ifDefined(this.value)}\"\n\t\t\t\t\t?checked=\"${this.checked ?? false}\"\n\t\t\t\t\t.checked=\"${this.checked ?? false}\"\n\t\t\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t\t\t?required=\"${this.required}\"\n\t\t\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t\t\t@change=\"${this._handleChange}\"\n\t\t\t\t\t@focus=\"${this._handleFocus}\"\n\t\t\t\t\t@blur=\"${this._handleBlur}\"\n\t\t\t\t\tclass=\"${classMap(inputClasses)}\"\n\t\t\t\t/>\n\t\t\t\t${this.label ? html`<label class=\"sds-radio__label\" for=\"control\">${this.label}</label>` : nothing}\n\t\t\t\t${this.helpText ? html`<span class=\"sds-radio__help-text\">${this.helpText}</span>` : nothing}\n\t\t\t</div>\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-radio': SDSRadio;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sds-radio.js","sourceRoot":"","sources":["../../src/sds-radio/sds-radio.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAkB,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAqBrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAyBvC,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IACD,IAAI,QAAQ,CAAC,KAAgC;QAC5C,MAAM,MAAM,GAAG,KAAK,IAAI,KAAK,CAAC;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;QAE9B,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO;QAE9B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC;QACxB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAEvC,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,CAAC;YACtC,IAAI,CAAC,2BAA2B,GAAG,MAAM,CAAC;QAC3C,CAAC;IACF,CAAC;IAED;;;;OAIG;IAEH,IAAI,qBAAqB;QACxB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACpC,CAAC;IACD,IAAI,qBAAqB,CAAC,KAA6C;QACtE,MAAM,MAAM,GAAG,KAAK,I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AE,IAAI,EAAE,CAAC;sCAAoC;AAC1B;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;0CAAuC;AAS1F;IARC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAE3C;;;;;OAKG;wCAGF;AAqBD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDAG7C;AAiBkB;IAAlB,KAAK,CAAC,UAAU,CAAC;yCAA4B;AAnElC,QAAQ;IADpB,oBAAoB,CAAC,WAAW,CAAC;GACrB,QAAQ,CAkTpB","sourcesContent":["import { LitElement, PropertyValues, html, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-radio.styles';\nimport { SDS_SIZES } from '../types';\n\ntype RadioSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;\n\nexport interface SDSRadioProps {\n\tdisabled?: boolean;\n\trequired?: boolean;\n\tlabel?: string;\n\t'hide-label'?: boolean;\n\tname?: string;\n\tvalue?: string;\n\tchecked?: boolean;\n\terror?: boolean;\n\treadonly?: boolean;\n\tsize?: RadioSize;\n\t'help-text'?: string;\n\tparentRequestDisabled?: boolean;\n}\n\n@guardedCustomElement('sds-radio')\nexport class SDSRadio extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\tstatic formAssociated = true;\n\tpublic readonly internals: ElementInternals;\n\n\t@property({ type: Boolean, reflect: true }) required: SDSRadioProps['required'] = false;\n\t@property({ type: String, reflect: true }) label: SDSRadioProps['label'] = '';\n\t@property({ type: Boolean, reflect: true, attribute: 'hide-label' }) hideLabel: SDSRadioProps['hide-label'] = false;\n\t@property({ type: String, reflect: true }) name?: SDSRadioProps['name'];\n\t@property({ type: String }) value: SDSRadioProps['value'] = 'on';\n\t@property({ type: Boolean, reflect: true }) checked: SDSRadioProps['checked'] = false;\n\t@property({ type: Boolean, reflect: true }) error: SDSRadioProps['error'] = false;\n\t@property({ type: Boolean, attribute: 'readonly', reflect: true }) readOnly: SDSRadioProps['readonly'] = false;\n\t@property({ type: String, reflect: true }) size: SDSRadioProps['size'] = 'md';\n\t@property({ type: String, attribute: 'help-text' }) helpText?: SDSRadioProps['help-text'];\n\t@property({ type: Boolean, reflect: true })\n\n\t/**\n\t * disabled:\n\t * - If set directly (prop/attr), this radio becomes \"self-controlled\"\n\t * and ignores parentRequestDisabled.\n\t * - If not self-controlled, this follows parentRequestDisabled (group/form).\n\t */\n\tget disabled(): SDSRadioProps['disabled'] {\n\t\treturn this._disabled;\n\t}\n\tset disabled(value: SDSRadioProps['disabled']) {\n\t\tconst newVal = value ?? false;\n\t\tconst oldVal = this._disabled;\n\n\t\tif (oldVal === newVal) return;\n\n\t\tthis._disabled = newVal;\n\t\tthis.requestUpdate('disabled', oldVal);\n\n\t\tif (!this._settingDisabledFromParent) {\n\t\t\tthis._disabledIsAuthorControlled = newVal;\n\t\t}\n\t}\n\n\t/**\n\t * parentRequestDisabled:\n\t * - Set by SDSRadioGroup to request disabled/enabled.\n\t * - Only applied if SDSRadio is NOT self-controlled.\n\t */\n\t@property({ type: Boolean, attribute: false })\n\tget parentRequestDisabled(): SDSRadioProps['parentRequestDisabled'] {\n\t\treturn this._parentRequestDisabled;\n\t}\n\tset parentRequestDisabled(value: SDSRadioProps['parentRequestDisabled']) {\n\t\tconst newVal = value ?? false;\n\t\tconst oldVal = this._parentRequestDisabled;\n\n\t\tif (oldVal === newVal) return;\n\n\t\tthis._parentRequestDisabled = newVal;\n\t\tthis.requestUpdate('parentRequestDisabled', oldVal);\n\n\t\tif (this._disabledIsAuthorControlled) return;\n\n\t\tthis._settingDisabledFromParent = true;\n\t\tthis.disabled = newVal;\n\t\tthis._settingDisabledFromParent = false;\n\t}\n\n\t@query('#control') control!: HTMLInputElement;\n\n\tprivate _disabled: SDSRadioProps['disabled'] = false;\n\tprivate _disabledIsAuthorControlled: boolean = false;\n\tprivate _settingDisabledFromParent: boolean = false;\n\tprivate _parentRequestDisabled: SDSRadioProps['parentRequestDisabled'] = false;\n\tprivate _initialChecked: boolean = false;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.internals = this.attachInternals();\n\t\tthis.attachShadow({ mode: 'open', delegatesFocus: true });\n\t}\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback();\n\t\tthis.internals.role = 'radio';\n\t\tif (!this._initialChecked) {\n\t\t\tthis._initialChecked = this.checked ?? false;\n\t\t}\n\t\tthis.addEventListener('keydown', this._handleKeydown);\n\t}\n\n\toverride disconnectedCallback() {\n\t\tsuper.disconnectedCallback();\n\t\tthis.removeEventListener('keydown', this._handleKeydown);\n\t}\n\n\toverride firstUpdated(_changedProperties: PropertyValues): void {\n\t\tsuper.firstUpdated(_changedProperties);\n\t\tthis._updateGroupValidation();\n\t}\n\n\toverride updated(changedProperties: Map<string | number | symbol, unknown>) {\n\t\tsuper.updated(changedProperties);\n\n\t\tif (changedProperties.has('checked')) {\n\t\t\tif (this.checked) {\n\t\t\t\tthis._uncheckSiblings();\n\t\t\t\tthis.internals.setFormValue(this.value ?? null);\n\t\t\t} else {\n\t\t\t\tthis.internals.setFormValue(null);\n\t\t\t}\n\t\t\tthis._updateGroupValidation();\n\t\t}\n\n\t\tif (changedProperties.has('required') && this.control) {\n\t\t\tthis.control.required = this.required ?? false;\n\t\t}\n\n\t\tif (!this._disabledIsAuthorControlled && this.disabled !== this._parentRequestDisabled) {\n\t\t\tthis._settingDisabledFromParent = true;\n\t\t\tthis.disabled = this._parentRequestDisabled ?? false;\n\t\t\tthis._settingDisabledFromParent = false;\n\t\t}\n\t}\n\n\tprivate _getGroupRadios(): SDSRadio[] {\n\t\tif (!this.name) return [this];\n\t\tconst root = this.getRootNode() as Document | ShadowRoot;\n\t\tconst radioGroup = Array.from(root.querySelectorAll<SDSRadio>(`sds-radio[name=\"${this.name}\"]`));\n\t\treturn radioGroup;\n\t}\n\n\tprivate _updateGroupValidation() {\n\t\tconst group: Array<SDSRadio> = this._getGroupRadios();\n\t\tconst isAnyChecked = group.some((radio) => radio.checked);\n\t\tconst isAnyRequired = group.some((radio) => radio.required);\n\t\tgroup.forEach((radio) => {\n\t\t\tif (!radio.control) return;\n\t\t\tif (isAnyRequired) {\n\t\t\t\tradio.internals.setValidity(isAnyChecked ? {} : { valueMissing: true }, isAnyChecked ? '' : radio.control.validationMessage, radio.control);\n\t\t\t} else {\n\t\t\t\tradio.internals.setValidity({});\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate readonly _handleKeydown = (event: KeyboardEvent) => {\n\t\tif (!this.name || this.disabled || this.readOnly) return;\n\n\t\tconst root = this.getRootNode() as Document | ShadowRoot;\n\t\tconst radios = Array.from(root.querySelectorAll<SDSRadio>(`sds-radio[name=\"${this.name}\"]`));\n\t\tconst currentIndex = radios.indexOf(this);\n\n\t\tif (currentIndex === -1) return;\n\n\t\tlet targetIndex: number | null = null;\n\n\t\tswitch (event.key) {\n\t\t\tcase 'ArrowUp':\n\t\t\tcase 'ArrowLeft':\n\t\t\t\ttargetIndex = currentIndex > 0 ? currentIndex - 1 : radios.length - 1;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\tcase 'ArrowRight':\n\t\t\t\ttargetIndex = currentIndex < radios.length - 1 ? currentIndex + 1 : 0;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\tconst targetRadio = radios[targetIndex];\n\t\ttargetRadio?.focus();\n\t\ttargetRadio?.click();\n\t\tevent.preventDefault();\n\t};\n\n\tformResetCallback() {\n\t\tthis.checked = this._initialChecked;\n\t\tthis.control.checked = this._initialChecked;\n\t\tthis.internals.setFormValue(this.checked ? this.value ?? 'on' : null);\n\t\tthis._updateGroupValidation();\n\t}\n\n\tprivate _uncheckSiblings() {\n\t\tif (!this.name) return;\n\t\tconst radios: Array<SDSRadio> = this._getGroupRadios();\n\n\t\tfor (const radio of radios) {\n\t\t\tif (radio !== this && radio.checked) {\n\t\t\t\tradio.checked = false;\n\t\t\t\tradio.internals.setFormValue(null);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readonly _handleChange = (event: Event) => {\n\t\tif (this.disabled || this.readOnly) {\n\t\t\t(event.target as HTMLInputElement).checked = this.checked ?? false;\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst elem = event.target as HTMLInputElement;\n\t\tthis.checked = elem.checked;\n\t\tif (this.checked) {\n\t\t\tthis._uncheckSiblings();\n\t\t}\n\t\tthis._updateGroupValidation();\n\t\tthis.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }));\n\t};\n\n\tprivate readonly _handleFocus = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.dispatchEvent(new CustomEvent('focus', { bubbles: true, composed: true }));\n\t};\n\n\tprivate readonly _handleBlur = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.dispatchEvent(new CustomEvent('blur', { bubbles: true, composed: true }));\n\t};\n\n\tget form() {\n\t\treturn this.internals.form;\n\t}\n\n\tget type(): string {\n\t\treturn 'radio';\n\t}\n\n\tget validity() {\n\t\treturn this.internals.validity;\n\t}\n\n\tget validationMessage() {\n\t\treturn this.internals.validationMessage;\n\t}\n\n\tget willValidate() {\n\t\treturn this.internals.willValidate;\n\t}\n\n\tcheckValidity(): boolean {\n\t\treturn this.internals.checkValidity();\n\t}\n\n\treportValidity(): boolean {\n\t\treturn this.internals.reportValidity();\n\t}\n\n\tsetCustomValidity(message: string): void {\n\t\tthis.internals.setValidity({ customError: !!message }, message);\n\t}\n\n\tformDisabledCallback(disabled: boolean): void {\n\t\tthis._settingDisabledFromParent = true;\n\t\tthis.disabled = disabled;\n\t\tthis._settingDisabledFromParent = false;\n\n\t\tif (this.control) this.control.disabled = disabled;\n\t}\n\n\toverride focus(): void {\n\t\tif (!this.disabled) this.shadowRoot?.querySelector('input')?.focus();\n\t}\n\n\toverride blur(): void {\n\t\tif (!this.disabled) this.shadowRoot?.querySelector('input')?.blur();\n\t}\n\n\toverride click(): void {\n\t\tif (!this.disabled && !this.readOnly) this.shadowRoot?.querySelector('input')?.click();\n\t}\n\n\toverride render() {\n\t\tconst radioClasses = {\n\t\t\t'sds-radio': true,\n\t\t\t'sds-radio--error': Boolean(this.error),\n\t\t};\n\n\t\tconst inputClasses = {\n\t\t\t'sds-radio__input': true,\n\t\t\t'sds-radio__input--error': Boolean(this.error),\n\t\t};\n\n\t\treturn html`\n\t\t\t<div class=\"${classMap(radioClasses)}\">\n\t\t\t\t<input\n\t\t\t\t\tid=\"control\"\n\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\tname=\"${ifDefined(this.name)}\"\n\t\t\t\t\tvalue=\"${ifDefined(this.value)}\"\n\t\t\t\t\t?checked=\"${this.checked ?? false}\"\n\t\t\t\t\t.checked=\"${this.checked ?? false}\"\n\t\t\t\t\t?disabled=\"${this.disabled ?? false}\"\n\t\t\t\t\t.disabled=\"${this.disabled ?? false}\"\n\t\t\t\t\t?required=\"${this.required}\"\n\t\t\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t\t\t@change=\"${this._handleChange}\"\n\t\t\t\t\t@focus=\"${this._handleFocus}\"\n\t\t\t\t\t@blur=\"${this._handleBlur}\"\n\t\t\t\t\tclass=\"${classMap(inputClasses)}\"\n\t\t\t\t/>\n\t\t\t\t${this.label ? html`<label class=\"sds-radio__label\" for=\"control\">${this.label}</label>` : nothing}\n\t\t\t\t${this.helpText ? html`<span class=\"sds-radio__help-text\">${this.helpText}</span>` : nothing}\n\t\t\t</div>\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-radio': SDSRadio;\n\t}\n}\n"]}
|
|
@@ -32,6 +32,7 @@ export declare class SDSRadioGroup extends LitElement {
|
|
|
32
32
|
private _slotElement;
|
|
33
33
|
private readonly _handleRadioChange;
|
|
34
34
|
private _handleSlotChange;
|
|
35
|
+
private _getChildRadios;
|
|
35
36
|
private _updateChildProps;
|
|
36
37
|
updated(changedProps: Map<string | number | symbol, unknown>): void;
|
|
37
38
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-radio-group.d.ts","sourceRoot":"","sources":["../../src/sds-radio-group/sds-radio-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AAKhD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,KAAK,cAAc,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAI7D,OAAO,wBAAwB,CAAC;AAChC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,wBAAwB,CAAC;AAGhC;;;GAGG;AAEH,MAAM,WAAW,kBAAkB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBACa,aAAc,SAAQ,UAAU;IAC5C,OAAgB,MAAM,4BAAY;IAEN,MAAM,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACd,QAAQ,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACxC,QAAQ,EAA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,CAAC,CAAC;IACd,QAAQ,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACxC,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAS;IACxF,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAY;IACvB,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAS;IACjD,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAS;IAClD,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAQ;IAE1E,OAAO,CAAC,cAAc,CAAuB;IACvC,OAAO,CAAC,YAAY,CAAmB;IAEtD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAOjC;IAEF,OAAO,CAAC,iBAAiB,CAEvB;IAEF,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,iBAAiB;IA0BhB,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC;IAS5D,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAevF,MAAM;IA+Bf,IAAI,KAAK,IAAI,EAAE,CAEd;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,iBAAiB,EAAE,aAAa,CAAC;KACjC;CACD"}
|
|
@@ -33,28 +33,32 @@ let SDSRadioGroup = class SDSRadioGroup extends LitElement {
|
|
|
33
33
|
this._updateChildProps([...updatableRadioProps]);
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
+
_getChildRadios() {
|
|
37
|
+
return this._slotElement?.assignedElements({ flatten: true }).filter((element) => element.tagName === 'SDS-RADIO') ?? [];
|
|
38
|
+
}
|
|
36
39
|
_updateChildProps(changedAttributes) {
|
|
37
|
-
const radios = this.
|
|
38
|
-
radios
|
|
39
|
-
|
|
40
|
+
const radios = this._getChildRadios();
|
|
41
|
+
for (const childRadio of radios) {
|
|
42
|
+
for (const attribute of changedAttributes) {
|
|
40
43
|
switch (attribute) {
|
|
41
44
|
case 'readOnly':
|
|
42
|
-
|
|
45
|
+
childRadio.readOnly = this.readOnly;
|
|
43
46
|
break;
|
|
44
47
|
case 'disabled':
|
|
45
|
-
|
|
48
|
+
childRadio.parentRequestDisabled = this.disabled;
|
|
46
49
|
break;
|
|
47
50
|
case 'errorMessage':
|
|
48
|
-
|
|
51
|
+
childRadio.error = Boolean(this.errorMessage);
|
|
49
52
|
break;
|
|
50
53
|
case 'required':
|
|
51
|
-
|
|
54
|
+
childRadio.required = this.required;
|
|
52
55
|
break;
|
|
53
56
|
case 'size':
|
|
54
|
-
|
|
57
|
+
childRadio.size = this.size;
|
|
58
|
+
break;
|
|
55
59
|
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
58
62
|
}
|
|
59
63
|
updated(changedProps) {
|
|
60
64
|
super.updated(changedProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-radio-group.js","sourceRoot":"","sources":["../../src/sds-radio-group/sds-radio-group.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAIlD,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAU,CAAC;AAGlG,OAAO,wBAAwB,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M,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAEN;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAuC;AACd;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;+CAA4C;AACvC;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;mDAAoD;AACxC;IAAlE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkD;AACxF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAwC;AACvB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkD;AACjD;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkD;AAClD;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAyC;AAElE;IAAhB,KAAK,EAAE;qDAA8C;AAC/B;IAAtB,KAAK,CAAC,MAAM,CAAC;mDAAwC;AAb1C,aAAa;IADzB,oBAAoB,CAAC,iBAAiB,CAAC;GAC3B,aAAa,CA8GzB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, state, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-radio-group.styles';\nimport { SDS_SIZES } from '../types';\n\ntype RadioGroupSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;\nconst updatableRadioProps = ['disabled', 'errorMessage', 'readOnly', 'required', 'size'] as const;\ntype UpdatableRadioProp = (typeof updatableRadioProps)[number];\n\nimport '../sds-radio/sds-radio';\nimport '../sds-icon/sds-icon';\nimport '../sds-alert/sds-alert';\nimport { SDSRadio } from '../sds-radio/sds-radio';\n\n/**\n * TODO: Implement keyboard navigation behavior according to\n * https://www.w3.org/WAI/ARIA/apg/patterns/radio/\n */\n\nexport interface SDSRadioGroupProps {\n\tlegend?: string;\n\t'help-text'?: string;\n\t'error-message'?: string;\n\treadonly?: boolean;\n\tdirection?: 'column' | 'row';\n\tdisabled?: boolean;\n\tsize?: RadioGroupSize;\n\trequired?: boolean;\n}\n\n@guardedCustomElement('sds-radio-group')\nexport class SDSRadioGroup extends LitElement {\n\tstatic override styles = [styles];\n\n\t@property({ type: String }) legend?: SDSRadioGroupProps['legend'];\n\t@property({ type: String, attribute: 'help-text' }) helpText?: SDSRadioGroupProps['help-text'];\n\t@property({ type: String, attribute: 'error-message' }) errorMessage?: SDSRadioGroupProps['error-message'];\n\t@property({ type: Boolean, attribute: 'readonly', reflect: true }) readOnly: SDSRadioGroupProps['readonly'] = false;\n\t@property({ type: String }) direction: 'column' | 'row' = 'column';\n\t@property({ type: Boolean, reflect: true }) disabled: SDSRadioGroupProps['disabled'] = false;\n\t@property({ type: Boolean, reflect: true }) required: SDSRadioGroupProps['required'] = false;\n\t@property({ type: String, reflect: true }) size: SDSRadioGroupProps['size'] = 'md';\n\n\t@state() private _selectedValue: string | null = null;\n\t@query('slot') private _slotElement!: HTMLSlotElement;\n\n\tprivate readonly _handleRadioChange = (event: Event): void => {\n\t\tconst target = event.composedPath().find((el) => el instanceof HTMLElement && el.tagName === 'SDS-RADIO') as HTMLElement & { value: string };\n\n\t\tif (target) {\n\t\t\tthis._selectedValue = target.getAttribute('value') || null;\n\t\t\tthis.dispatchEvent(new CustomEvent('sds-update', { bubbles: true, composed: true }));\n\t\t}\n\t};\n\n\tprivate _handleSlotChange = () => {\n\t\tthis._updateChildProps([...updatableRadioProps]);\n\t};\n\n\tprivate _updateChildProps(changedAttributes: Array<UpdatableRadioProp>) {\n\t\tconst radios = this._slotElement?.assignedElements({ flatten: true }).filter((element): element is SDSRadio => element.tagName === 'SDS-RADIO') ?? [];\n\t\tradios.forEach((radio) => {\n\t\t\tchangedAttributes.forEach((attribute) => {\n\t\t\t\tswitch (attribute) {\n\t\t\t\t\tcase 'readOnly':\n\t\t\t\t\t\tradio.readOnly = this.readOnly;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'disabled':\n\t\t\t\t\t\tradio.disabled = this.disabled;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'errorMessage':\n\t\t\t\t\t\tradio.error = Boolean(this.errorMessage);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'required':\n\t\t\t\t\t\tradio.required = this.required;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'size':\n\t\t\t\t\t\tradio.size = this.size;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\toverride updated(changedProps: Map<string | number | symbol, unknown>) {\n\t\tsuper.updated(changedProps);\n\n\t\tconst changedKeys = Array.from(changedProps.keys());\n\t\tif (changedKeys.includes('errorMessage') || changedKeys.includes('error-message')) {\n\t\t\tthis._updateChildProps(['errorMessage']);\n\t\t}\n\t}\n\n\toverride attributeChangedCallback(name: string, _old: string | null, value: string | null): void {\n\t\tsuper.attributeChangedCallback(name, _old, value);\n\n\t\t// DOM attribute for readonly has different casing than our types\n\t\tif (name === 'readonly') {\n\t\t\tthis._updateChildProps(['readOnly']);\n\t\t\treturn;\n\t\t}\n\n\t\tconst property = name as UpdatableRadioProp;\n\t\tif (updatableRadioProps.includes(property)) {\n\t\t\tthis._updateChildProps([property]);\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst radioGroupClasses = {\n\t\t\t'sds-radio-group': true,\n\t\t\t'sds-radio-group--readonly': this.readOnly ?? false,\n\t\t\t'sds-radio-group--disabled': this.disabled ?? false,\n\t\t};\n\n\t\tconst radioClasses = {\n\t\t\t'sds-radio-group__radios': true,\n\t\t\t'sds-radio-group--column': this.direction === 'column',\n\t\t\t'sds-radio-group--row': this.direction === 'row',\n\t\t};\n\n\t\treturn html`\n\t\t\t<fieldset class=\"${classMap(radioGroupClasses)}\">\n\t\t\t\t${this.legend\n\t\t\t\t\t? html`<legend class=\"sds-radio-group__legend\">${this.readOnly ? html`<sds-icon name=\"lock-material-filled\" size=\"md\"></sds-icon>` : nothing}${this.legend}</legend>`\n\t\t\t\t\t: nothing}\n\t\t\t\t${this.helpText ? html`<p class=\"sds-radio-group__help-text\">${this.helpText}</p>` : nothing}\n\t\t\t\t<div class=\"${classMap(radioClasses)}\" @change=${this._handleRadioChange}>\n\t\t\t\t\t<slot @slotchange=${this._handleSlotChange}></slot>\n\t\t\t\t</div>\n\t\t\t\t${this.errorMessage\n\t\t\t\t\t? html`<sds-alert variant=\"secondary\" data-palette=\"danger\">\n\t\t\t\t\t\t\t<p slot=\"message\">${this.errorMessage}</p>\n\t\t\t\t\t\t</sds-alert>`\n\t\t\t\t\t: nothing}\n\t\t\t</fieldset>\n\t\t`;\n\t}\n\n\tget value(): {} {\n\t\treturn { selectedValue: this._selectedValue };\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-radio-group': SDSRadioGroup;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sds-radio-group.js","sourceRoot":"","sources":["../../src/sds-radio-group/sds-radio-group.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAIlD,MAAM,mBAAmB,GAAG,CAAC,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O;;GAEX,CAAC;IACH,CAAC;IAED,IAAI,KAAK;QACR,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;IAC/C,CAAC;;AAlHe,oBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAEN;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAuC;AACd;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;+CAA4C;AACvC;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;mDAAoD;AACxC;IAAlE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkD;AACxF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAwC;AACvB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkD;AACjD;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkD;AAClD;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAyC;AAElE;IAAhB,KAAK,EAAE;qDAA8C;AAC/B;IAAtB,KAAK,CAAC,MAAM,CAAC;mDAAwC;AAb1C,aAAa;IADzB,oBAAoB,CAAC,iBAAiB,CAAC;GAC3B,aAAa,CAoHzB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property, state, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { guardedCustomElement } from '../utils/guarded-custom-element';\nimport { styles } from './sds-radio-group.styles';\nimport { SDS_SIZES } from '../types';\n\ntype RadioGroupSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;\nconst updatableRadioProps = ['disabled', 'errorMessage', 'readOnly', 'required', 'size'] as const;\ntype UpdatableRadioProp = (typeof updatableRadioProps)[number];\n\nimport '../sds-radio/sds-radio';\nimport '../sds-icon/sds-icon';\nimport '../sds-alert/sds-alert';\nimport { SDSRadio } from '../sds-radio/sds-radio';\n\n/**\n * TODO: Implement keyboard navigation behavior according to\n * https://www.w3.org/WAI/ARIA/apg/patterns/radio/\n */\n\nexport interface SDSRadioGroupProps {\n\tlegend?: string;\n\t'help-text'?: string;\n\t'error-message'?: string;\n\treadonly?: boolean;\n\tdirection?: 'column' | 'row';\n\tdisabled?: boolean;\n\tsize?: RadioGroupSize;\n\trequired?: boolean;\n}\n\n@guardedCustomElement('sds-radio-group')\nexport class SDSRadioGroup extends LitElement {\n\tstatic override styles = [styles];\n\n\t@property({ type: String }) legend?: SDSRadioGroupProps['legend'];\n\t@property({ type: String, attribute: 'help-text' }) helpText?: SDSRadioGroupProps['help-text'];\n\t@property({ type: String, attribute: 'error-message' }) errorMessage?: SDSRadioGroupProps['error-message'];\n\t@property({ type: Boolean, attribute: 'readonly', reflect: true }) readOnly: SDSRadioGroupProps['readonly'] = false;\n\t@property({ type: String }) direction: 'column' | 'row' = 'column';\n\t@property({ type: Boolean, reflect: true }) disabled: SDSRadioGroupProps['disabled'] = false;\n\t@property({ type: Boolean, reflect: true }) required: SDSRadioGroupProps['required'] = false;\n\t@property({ type: String, reflect: true }) size: SDSRadioGroupProps['size'] = 'md';\n\n\t@state() private _selectedValue: string | null = null;\n\t@query('slot') private _slotElement!: HTMLSlotElement;\n\n\tprivate readonly _handleRadioChange = (event: Event): void => {\n\t\tconst target = event.composedPath().find((el) => el instanceof HTMLElement && el.tagName === 'SDS-RADIO') as HTMLElement & { value: string };\n\n\t\tif (target) {\n\t\t\tthis._selectedValue = target.getAttribute('value') || null;\n\t\t\tthis.dispatchEvent(new CustomEvent('sds-update', { bubbles: true, composed: true }));\n\t\t}\n\t};\n\n\tprivate _handleSlotChange = () => {\n\t\tthis._updateChildProps([...updatableRadioProps]);\n\t};\n\n\tprivate _getChildRadios(): SDSRadio[] {\n\t\treturn this._slotElement?.assignedElements({ flatten: true }).filter((element): element is SDSRadio => element.tagName === 'SDS-RADIO') ?? [];\n\t}\n\n\tprivate _updateChildProps(changedAttributes: Array<UpdatableRadioProp>) {\n\t\tconst radios = this._getChildRadios();\n\n\t\tfor (const childRadio of radios) {\n\t\t\tfor (const attribute of changedAttributes) {\n\t\t\t\tswitch (attribute) {\n\t\t\t\t\tcase 'readOnly':\n\t\t\t\t\t\tchildRadio.readOnly = this.readOnly;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'disabled':\n\t\t\t\t\t\tchildRadio.parentRequestDisabled = this.disabled;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'errorMessage':\n\t\t\t\t\t\tchildRadio.error = Boolean(this.errorMessage);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'required':\n\t\t\t\t\t\tchildRadio.required = this.required;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'size':\n\t\t\t\t\t\tchildRadio.size = this.size;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\toverride updated(changedProps: Map<string | number | symbol, unknown>) {\n\t\tsuper.updated(changedProps);\n\n\t\tconst changedKeys = Array.from(changedProps.keys());\n\t\tif (changedKeys.includes('errorMessage') || changedKeys.includes('error-message')) {\n\t\t\tthis._updateChildProps(['errorMessage']);\n\t\t}\n\t}\n\n\toverride attributeChangedCallback(name: string, _old: string | null, value: string | null): void {\n\t\tsuper.attributeChangedCallback(name, _old, value);\n\n\t\t// DOM attribute for readonly has different casing than our types\n\t\tif (name === 'readonly') {\n\t\t\tthis._updateChildProps(['readOnly']);\n\t\t\treturn;\n\t\t}\n\n\t\tconst property = name as UpdatableRadioProp;\n\t\tif (updatableRadioProps.includes(property)) {\n\t\t\tthis._updateChildProps([property]);\n\t\t}\n\t}\n\n\toverride render() {\n\t\tconst radioGroupClasses = {\n\t\t\t'sds-radio-group': true,\n\t\t\t'sds-radio-group--readonly': this.readOnly ?? false,\n\t\t\t'sds-radio-group--disabled': this.disabled ?? false,\n\t\t};\n\n\t\tconst radioClasses = {\n\t\t\t'sds-radio-group__radios': true,\n\t\t\t'sds-radio-group--column': this.direction === 'column',\n\t\t\t'sds-radio-group--row': this.direction === 'row',\n\t\t};\n\n\t\treturn html`\n\t\t\t<fieldset class=\"${classMap(radioGroupClasses)}\">\n\t\t\t\t${this.legend\n\t\t\t\t\t? html`<legend class=\"sds-radio-group__legend\">${this.readOnly ? html`<sds-icon name=\"lock-material-filled\" size=\"md\"></sds-icon>` : nothing}${this.legend}</legend>`\n\t\t\t\t\t: nothing}\n\t\t\t\t${this.helpText ? html`<p class=\"sds-radio-group__help-text\">${this.helpText}</p>` : nothing}\n\t\t\t\t<div class=\"${classMap(radioClasses)}\" @change=${this._handleRadioChange}>\n\t\t\t\t\t<slot @slotchange=${this._handleSlotChange}></slot>\n\t\t\t\t</div>\n\t\t\t\t${this.errorMessage\n\t\t\t\t\t? html`<sds-alert variant=\"secondary\" data-palette=\"danger\">\n\t\t\t\t\t\t\t<p slot=\"message\">${this.errorMessage}</p>\n\t\t\t\t\t\t</sds-alert>`\n\t\t\t\t\t: nothing}\n\t\t\t</fieldset>\n\t\t`;\n\t}\n\n\tget value(): {} {\n\t\treturn { selectedValue: this._selectedValue };\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-radio-group': SDSRadioGroup;\n\t}\n}\n"]}
|
|
@@ -4,7 +4,7 @@ export const styles = css `
|
|
|
4
4
|
--_sds-radio-group-gap: var(--sds-radio-group-gap, var(--sds-spacing-xs));
|
|
5
5
|
--_sds-radio-group-row-gap: var(--sds-radio-group-row-gap, var(--sds-spacing-md));
|
|
6
6
|
--_sds-radio-group-font-family: var(--sds-radio-group-font-family, var(--sds-typography-font-family-roboto));
|
|
7
|
-
--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-md));
|
|
7
|
+
--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-content-md));
|
|
8
8
|
--_sds-radio-group-text-color: var(--sds-radio-group-text-color, var(--sds-color-text-default, var(--sds-color-neutral-text-default)));
|
|
9
9
|
--_sds-radio-group-max-line-width: var(--sds-radio-group-max-line-width, var(--sds-typography-max-line-width));
|
|
10
10
|
--_sds-radio-group-disabled-opacity: var(--sds-radio-group-disabled-opacity, var(--sds-color-states-disabled-opacity));
|
|
@@ -14,7 +14,7 @@ export const styles = css `
|
|
|
14
14
|
--_sds_radio-group-legend-help-text-gap: var(--sds-radio-group-legend-help-text-gap, var(--sds-spacing-4xs));
|
|
15
15
|
|
|
16
16
|
--_sds-radio-group-help-text-color: var(--sds-radio-group-help-text-color, var(--sds-color-text-subtle, var(--sds-color-neutral-text-subtle)));
|
|
17
|
-
--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-md));
|
|
17
|
+
--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-content-md));
|
|
18
18
|
--_sds-radio-group-help-text-font-weight: var(--sds-radio-group-help-text-font-weight, var(--sds-typography-body-md-desktop-font-weight));
|
|
19
19
|
--_sds-radio-group-help-text-line-height: var(--sds-radio-group-help-text-line-height, var(--sds-components-line-height-squeezed-md));
|
|
20
20
|
|
|
@@ -85,16 +85,16 @@ export const styles = css `
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
:host([size='sm']) {
|
|
88
|
-
--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-sm));
|
|
88
|
+
--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-content-sm));
|
|
89
89
|
--_sds-radio-group-legend-line-height: var(--sds-radio-group-legend-line-height, var(--sds-components-line-height-squeezed-sm));
|
|
90
|
-
--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-sm));
|
|
90
|
+
--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-content-sm));
|
|
91
91
|
--_sds-radio-group-help-text-line-height: var(--sds-radio-group-help-text-line-height, var(--sds-components-line-height-squeezed-sm));
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
:host([size='lg']) {
|
|
95
|
-
--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-lg));
|
|
95
|
+
--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-content-lg));
|
|
96
96
|
--_sds-radio-group-legend-line-height: var(--sds-radio-group-legend-line-height, var(--sds-components-line-height-squeezed-lg));
|
|
97
|
-
--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-lg));
|
|
97
|
+
--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-content-lg));
|
|
98
98
|
--_sds-radio-group-help-text-line-height: var(--sds-radio-group-help-text-line-height, var(--sds-components-line-height-squeezed-lg));
|
|
99
99
|
}
|
|
100
100
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sds-radio-group.styles.js","sourceRoot":"","sources":["../../src/sds-radio-group/sds-radio-group.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t--_sds-radio-group-gap: var(--sds-radio-group-gap, var(--sds-spacing-xs));\n\t\t--_sds-radio-group-row-gap: var(--sds-radio-group-row-gap, var(--sds-spacing-md));\n\t\t--_sds-radio-group-font-family: var(--sds-radio-group-font-family, var(--sds-typography-font-family-roboto));\n\t\t--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-md));\n\t\t--_sds-radio-group-text-color: var(--sds-radio-group-text-color, var(--sds-color-text-default, var(--sds-color-neutral-text-default)));\n\t\t--_sds-radio-group-max-line-width: var(--sds-radio-group-max-line-width, var(--sds-typography-max-line-width));\n\t\t--_sds-radio-group-disabled-opacity: var(--sds-radio-group-disabled-opacity, var(--sds-color-states-disabled-opacity));\n\n\t\t--_sds-radio-group-legend-font-weight: var(--sds-radio-group-legend-font-weight, var(--sds-typography-body-lg-strong-tall-desktop-font-weight));\n\t\t--_sds-radio-group-legend-line-height: var(--sds-radio-group-legend-line-height, var(--sds-components-line-height-squeezed-md));\n\t\t--_sds_radio-group-legend-help-text-gap: var(--sds-radio-group-legend-help-text-gap, var(--sds-spacing-4xs));\n\n\t\t--_sds-radio-group-help-text-color: var(--sds-radio-group-help-text-color, var(--sds-color-text-subtle, var(--sds-color-neutral-text-subtle)));\n\t\t--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-md));\n\t\t--_sds-radio-group-help-text-font-weight: var(--sds-radio-group-help-text-font-weight, var(--sds-typography-body-md-desktop-font-weight));\n\t\t--_sds-radio-group-help-text-line-height: var(--sds-radio-group-help-text-line-height, var(--sds-components-line-height-squeezed-md));\n\n\t\tdisplay: block;\n\t\tcontain: layout style;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.sds-radio-group {\n\t\tborder: 0;\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tcolor: var(--_sds-radio-group-text-color);\n\t\tfont-family: var(--_sds-radio-group-font-family);\n\t\tfont-size: var(--_sds-radio-group-font-size);\n\t}\n\n\t.sds-radio-group--disabled {\n\t\t.sds-radio-group__legend,\n\t\t.sds-radio-group__help-text,\n\t\tsds-alert {\n\t\t\topacity: var(--_sds-radio-group-disabled-opacity);\n\t\t}\n\t}\n\n\tsds-alert {\n\t\t--sds-alert-padding: 0px;\n\t}\n\n\t.sds-radio-group__legend {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: var(--sds-spacing-5xs);\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tfont-weight: var(--_sds-radio-group-legend-font-weight);\n\t\tline-height: var(--_sds-radio-group-legend-line-height);\n\t\tmax-width: var(--_sds-radio-group-max-line-width);\n\n\t\t+ .sds-radio-group__help-text {\n\t\t\tmargin-block-start: var(--_sds_radio-group-legend-help-text-gap);\n\t\t}\n\t}\n\n\t.sds-radio-group__help-text {\n\t\tmargin: 0;\n\t\tcolor: var(--_sds-radio-group-help-text-color);\n\t\tfont-size: var(--_sds-radio-group-help-text-font-size);\n\t\tfont-weight: var(--_sds-radio-group-help-text-font-weight);\n\t\tline-height: var(--_sds-radio-group-help-text-line-height);\n\t\tmax-width: var(--_sds-radio-group-max-line-width);\n\t}\n\n\t.sds-radio-group__radios {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--_sds-radio-group-gap);\n\t\tmargin-top: var(--_sds-radio-group-gap);\n\n\t\t&.sds-radio-group--row {\n\t\t\tflex-direction: row;\n\t\t\tgap: var(--_sds-radio-group-row-gap);\n\t\t}\n\t}\n\n\tsds-alert {\n\t\tmargin-top: var(--_sds-radio-group-gap);\n\t}\n\n\t:host([size='sm']) {\n\t\t--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-sm));\n\t\t--_sds-radio-group-legend-line-height: var(--sds-radio-group-legend-line-height, var(--sds-components-line-height-squeezed-sm));\n\t\t--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-sm));\n\t\t--_sds-radio-group-help-text-line-height: var(--sds-radio-group-help-text-line-height, var(--sds-components-line-height-squeezed-sm));\n\t}\n\n\t:host([size='lg']) {\n\t\t--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-lg));\n\t\t--_sds-radio-group-legend-line-height: var(--sds-radio-group-legend-line-height, var(--sds-components-line-height-squeezed-lg));\n\t\t--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-lg));\n\t\t--_sds-radio-group-help-text-line-height: var(--sds-radio-group-help-text-line-height, var(--sds-components-line-height-squeezed-lg));\n\t}\n`;\n"]}
|
|
1
|
+
{"version":3,"file":"sds-radio-group.styles.js","sourceRoot":"","sources":["../../src/sds-radio-group/sds-radio-group.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\t--_sds-radio-group-gap: var(--sds-radio-group-gap, var(--sds-spacing-xs));\n\t\t--_sds-radio-group-row-gap: var(--sds-radio-group-row-gap, var(--sds-spacing-md));\n\t\t--_sds-radio-group-font-family: var(--sds-radio-group-font-family, var(--sds-typography-font-family-roboto));\n\t\t--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-content-md));\n\t\t--_sds-radio-group-text-color: var(--sds-radio-group-text-color, var(--sds-color-text-default, var(--sds-color-neutral-text-default)));\n\t\t--_sds-radio-group-max-line-width: var(--sds-radio-group-max-line-width, var(--sds-typography-max-line-width));\n\t\t--_sds-radio-group-disabled-opacity: var(--sds-radio-group-disabled-opacity, var(--sds-color-states-disabled-opacity));\n\n\t\t--_sds-radio-group-legend-font-weight: var(--sds-radio-group-legend-font-weight, var(--sds-typography-body-lg-strong-tall-desktop-font-weight));\n\t\t--_sds-radio-group-legend-line-height: var(--sds-radio-group-legend-line-height, var(--sds-components-line-height-squeezed-md));\n\t\t--_sds_radio-group-legend-help-text-gap: var(--sds-radio-group-legend-help-text-gap, var(--sds-spacing-4xs));\n\n\t\t--_sds-radio-group-help-text-color: var(--sds-radio-group-help-text-color, var(--sds-color-text-subtle, var(--sds-color-neutral-text-subtle)));\n\t\t--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-content-md));\n\t\t--_sds-radio-group-help-text-font-weight: var(--sds-radio-group-help-text-font-weight, var(--sds-typography-body-md-desktop-font-weight));\n\t\t--_sds-radio-group-help-text-line-height: var(--sds-radio-group-help-text-line-height, var(--sds-components-line-height-squeezed-md));\n\n\t\tdisplay: block;\n\t\tcontain: layout style;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.sds-radio-group {\n\t\tborder: 0;\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tcolor: var(--_sds-radio-group-text-color);\n\t\tfont-family: var(--_sds-radio-group-font-family);\n\t\tfont-size: var(--_sds-radio-group-font-size);\n\t}\n\n\t.sds-radio-group--disabled {\n\t\t.sds-radio-group__legend,\n\t\t.sds-radio-group__help-text,\n\t\tsds-alert {\n\t\t\topacity: var(--_sds-radio-group-disabled-opacity);\n\t\t}\n\t}\n\n\tsds-alert {\n\t\t--sds-alert-padding: 0px;\n\t}\n\n\t.sds-radio-group__legend {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tgap: var(--sds-spacing-5xs);\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tfont-weight: var(--_sds-radio-group-legend-font-weight);\n\t\tline-height: var(--_sds-radio-group-legend-line-height);\n\t\tmax-width: var(--_sds-radio-group-max-line-width);\n\n\t\t+ .sds-radio-group__help-text {\n\t\t\tmargin-block-start: var(--_sds_radio-group-legend-help-text-gap);\n\t\t}\n\t}\n\n\t.sds-radio-group__help-text {\n\t\tmargin: 0;\n\t\tcolor: var(--_sds-radio-group-help-text-color);\n\t\tfont-size: var(--_sds-radio-group-help-text-font-size);\n\t\tfont-weight: var(--_sds-radio-group-help-text-font-weight);\n\t\tline-height: var(--_sds-radio-group-help-text-line-height);\n\t\tmax-width: var(--_sds-radio-group-max-line-width);\n\t}\n\n\t.sds-radio-group__radios {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--_sds-radio-group-gap);\n\t\tmargin-top: var(--_sds-radio-group-gap);\n\n\t\t&.sds-radio-group--row {\n\t\t\tflex-direction: row;\n\t\t\tgap: var(--_sds-radio-group-row-gap);\n\t\t}\n\t}\n\n\tsds-alert {\n\t\tmargin-top: var(--_sds-radio-group-gap);\n\t}\n\n\t:host([size='sm']) {\n\t\t--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-content-sm));\n\t\t--_sds-radio-group-legend-line-height: var(--sds-radio-group-legend-line-height, var(--sds-components-line-height-squeezed-sm));\n\t\t--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-content-sm));\n\t\t--_sds-radio-group-help-text-line-height: var(--sds-radio-group-help-text-line-height, var(--sds-components-line-height-squeezed-sm));\n\t}\n\n\t:host([size='lg']) {\n\t\t--_sds-radio-group-font-size: var(--sds-radio-group-font-size, var(--sds-components-font-size-content-lg));\n\t\t--_sds-radio-group-legend-line-height: var(--sds-radio-group-legend-line-height, var(--sds-components-line-height-squeezed-lg));\n\t\t--_sds-radio-group-help-text-font-size: var(--sds-radio-group-help-text-font-size, var(--sds-components-font-size-content-lg));\n\t\t--_sds-radio-group-help-text-line-height: var(--sds-radio-group-help-text-line-height, var(--sds-components-line-height-squeezed-lg));\n\t}\n`;\n"]}
|