@salesforce-ux/design-system
Version:
Salesforce Lightning Design System
1 lines • 5.94 kB
JavaScript
var SLDS="object"==typeof SLDS?SLDS:{};SLDS["__internal/chunked/docs/./ui/components/radio-group/docs.mdx.js"]=function(e){function t(t){for(var r,a,s=t[0],l=t[1],c=t[2],u=0,h=[];u<s.length;u++)a=s[u],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&h.push(o[a][0]),o[a]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(d&&d(t);h.length;)h.shift()();return i.push.apply(i,c||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],r=!0,s=1;s<n.length;s++){var l=n[s];0!==o[l]&&(r=!1)}r&&(i.splice(t--,1),e=a(a.s=n[0]))}return e}var r={},o={63:0},i=[];function a(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="/assets/scripts/bundle/";var s=this.webpackJsonpSLDS___internal_chunked_docs=this.webpackJsonpSLDS___internal_chunked_docs||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var c=0;c<s.length;c++)t(s[c]);var d=l;return i.push([628,0]),n()}({0:function(e,t){e.exports=React},20:function(e,t){e.exports=ReactDOM},22:function(e,t){e.exports=JSBeautify},628:function(e,t,n){"use strict";n.r(t),n.d(t,"getElement",(function(){return p})),n.d(t,"getContents",(function(){return f}));var r=n(0),o=n(4),i=n(2),a=(n(28),n(45),n(14),n(1)),s=n(39),l=n(36),c=n(40),d=o.c.code,u=o.c.h2,h=o.c.h3,b=o.c.p,p=function(){return Object(r.createElement)(o.b,{},Object(r.createElement)("div",{className:"doc lead"},"A select list that can have a single entry checked at any one time."),Object(r.createElement)(i.a,{exampleOnly:!0},Object(a.f)(l.d)),u({id:"About-Radio-Group"},"About Radio Group"),b({},"Radio buttons are shown in a group of two or more. The user can only select one radio button at a time. You should use the same ",d({},"name")," attribute on all radio buttons in the group. This ensures that if there is more than one group in the form, each one stays associated with its own group."),b({},"The ability to style radio buttons with CSS varies across browsers. To ensure that radio buttons look the same everywhere, we use a custom DOM. Pay close attention to the markup, because all elements must exist for the styles to work."),h({id:"Accessibility"},"Accessibility"),b({},"Groups of radio buttons should be marked up using the fieldset and legend element. This helps someone using assistive technology to understand the question they're answering with the group of radio buttons. The fieldset is placed around the whole group and the legend contains the question."),b({},"Custom radio buttons are created by applying the ",d({},".slds-radio")," class to a ",d({},"<label>")," element. To remain accessible to all user agents, place an ",d({},"<input>")," with ",d({},'type="radio"')," inside the ",d({},"<label>")," element. The ",d({},"<input>")," is then visually hidden, and the styling is placed on a span with the ",d({},".slds-radio_faux")," class. The styling of the span changes based on whether the radio button is selected or focused by using a pseudo-element. A second span with ",d({},".slds-form-element__label")," contains the label text."),b({},"When a radio group is required, the ",d({},"<fieldset>")," should receive the class ",d({},".slds-is-required"),". The ",d({},"<legend>")," should then get ",d({},'<abbr class="required" title="required" aria-hidden="true">*</abbr>')," added to the DOM for visual indication that the radio group is required."),b({},"When disabling a radio button, either the entire group must be disabled or if only some radio buttons are disabled, then the checked radio button cannot be disabled."),h({id:"Mobile"},"Mobile"),Object(r.createElement)(s.a,{patternSpecificText:"radio groups will have an increased size to accommodate tapping with a finger instead of the more precise mouse cursor"}),Object(r.createElement)(i.a,{frameOnly:!0,frameTitle:"Example mobile styles for radio groups"},Object(a.f)(l.d)),u({id:"Base"},"Base"),Object(r.createElement)(i.a,null,Object(a.f)(l.d)),u({id:"States"},"States"),h({id:"Disabled"},"Disabled"),Object(r.createElement)(i.a,null,Object(a.f)(l.e,"disabled")),h({id:"Checked-and-Disabled"},"Checked and Disabled"),Object(r.createElement)(i.a,null,Object(a.f)(l.e,"checked-and-disabled")),h({id:"Required"},"Required"),Object(r.createElement)(i.a,null,Object(a.f)(l.e,"required")),h({id:"Error"},"Error"),Object(r.createElement)(i.a,null,Object(a.f)(l.e,"error")),h({id:"Required-with-Help-Text-Icon"},"Required with Help Text Icon"),Object(r.createElement)(i.a,null,Object(a.f)(l.e,"required-help-text-icon")),h({id:"Required-with-Help-Text-Icon-and-Tooltip"},"Required with Help Text Icon and Tooltip"),Object(r.createElement)(i.a,{demoStyles:Object(a.e)(l.e,"required-help-text-icon-tooltip")},Object(a.f)(l.e,"required-help-text-icon-tooltip")),h({id:"Right-to-Left"},"Right to Left"),Object(r.createElement)(i.a,null,Object(a.f)(l.e,"rtl")),h({id:"Right-to-Left-Required-with-Help-Text-Icon"},"Right to Left Required with Help Text Icon"),Object(r.createElement)(i.a,null,Object(a.f)(l.e,"rtl-required-help-text-icon")),u({id:"Styling-Hooks-Overview"},"Styling Hooks Overview"),Object(r.createElement)(c.a,{name:"radio-group",type:"component"}))},f=function(){return Object(o.a)(p())}}});