@salesforce-ux/design-system
Version:
Salesforce Lightning Design System
1 lines • 11.4 kB
JavaScript
var SLDS="object"==typeof SLDS?SLDS:{};SLDS["__internal/chunked/docs/./ui/components/pills/docs.mdx.js"]=function(e){function t(t){for(var a,s,r=t[0],o=t[1],c=t[2],p=0,m=[];p<r.length;p++)s=r[p],Object.prototype.hasOwnProperty.call(n,s)&&n[s]&&m.push(n[s][0]),n[s]=0;for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&(e[a]=o[a]);for(d&&d(t);m.length;)m.shift()();return i.push.apply(i,c||[]),l()}function l(){for(var e,t=0;t<i.length;t++){for(var l=i[t],a=!0,r=1;r<l.length;r++){var o=l[r];0!==n[o]&&(a=!1)}a&&(i.splice(t--,1),e=s(s.s=l[0]))}return e}var a={},n={55:0},i=[];function s(t){if(a[t])return a[t].exports;var l=a[t]={i:t,l:!1,exports:{}};return e[t].call(l.exports,l,l.exports,s),l.l=!0,l.exports}s.m=e,s.c=a,s.d=function(e,t,l){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:l})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var l=Object.create(null);if(s.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)s.d(l,a,function(t){return e[t]}.bind(null,a));return l},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="/assets/scripts/bundle/";var r=this.webpackJsonpSLDS___internal_chunked_docs=this.webpackJsonpSLDS___internal_chunked_docs||[],o=r.push.bind(r);r.push=t,r=r.slice();for(var c=0;c<r.length;c++)t(r[c]);var d=o;return i.push([747,0]),l()}({0:function(e,t){e.exports=React},20:function(e,t){e.exports=ReactDOM},22:function(e,t){e.exports=JSBeautify},747:function(e,t,l){"use strict";l.r(t),l.d(t,"getElement",(function(){return P})),l.d(t,"getContents",(function(){return N}));var a=l(0),n=l.n(a),i=l(4),s=l(2),r=(l(27),l(14),l(40)),o=l(1),c=l(39),d=l(9),p=l(30),m=n.a.createElement(p.e,null),u=[{id:"error",label:"Error",element:n.a.createElement(p.e,{className:"slds-has-error"},n.a.createElement("span",{className:"slds-pill__icon_container"},n.a.createElement("span",{className:"slds-icon_container",title:"Error"},n.a.createElement(d.a,{className:"slds-icon slds-icon-text-error",sprite:"utility",symbol:"error"}),n.a.createElement("span",{className:"slds-assistive-text"},"Warning"))))},{id:"truncated",label:"Truncated",demoStyles:"width: 220px;",storybookStyles:!0,element:n.a.createElement(p.f,null,n.a.createElement(p.e,{label:"Pill label that is longer than the area that contains it"}))},{id:"pill-truncated-tooltip",label:"Truncated Pill as Tooltip",demoStyles:"width: 220px;",storybookStyles:!0,element:n.a.createElement(p.g,null)},{id:"linked-pill-truncated-tooltip",label:"Truncated Linked Pill as Tooltip",demoStyles:"width: 220px;",storybookStyles:!0,element:n.a.createElement(p.a,null)}],b=[{id:"icon",label:"With icon",element:n.a.createElement(p.e,null,n.a.createElement("span",{className:"slds-pill__icon_container"},n.a.createElement("span",{className:"slds-icon_container slds-icon-standard-account",title:"Account"},n.a.createElement(d.a,{className:"slds-icon",sprite:"standard",symbol:"account"}),n.a.createElement("span",{className:"slds-assistive-text"},"Account"))))},{id:"avatar",label:"With avatar",element:n.a.createElement(p.e,null,n.a.createElement("span",{className:"slds-pill__icon_container"},n.a.createElement("span",{className:"slds-avatar slds-avatar_circle",title:"User avatar"},n.a.createElement("img",{alt:"Person name",src:"/assets/images/avatar2.jpg",title:"User avatar"}))))},{id:"container",label:"Pill with Container",element:n.a.createElement(p.f,null,n.a.createElement(p.e,null),n.a.createElement(p.e,null),n.a.createElement(p.e,null))},{id:"container-bare",label:"Pill with Bare Container - Deprecated",element:n.a.createElement(p.f,{variant:"container-bare"},n.a.createElement(p.e,null),n.a.createElement(p.e,null),n.a.createElement(p.e,null))}],h=l(49),f=l(35),E=[{id:"default",label:"Default",element:n.a.createElement(p.f,{type:"listbox",id:"listbox-pill-default"},n.a.createElement(p.c,{id:"listbox-pill-default"},n.a.createElement(p.d,null,n.a.createElement(p.b,{tabIndex:"0"})),n.a.createElement(p.d,null,n.a.createElement(p.b,null))))}],x=[{id:"listbox-pill-with-icon",label:"With icon",element:n.a.createElement(p.f,{type:"listbox",id:"listbox-pill-with-icon"},n.a.createElement(p.c,{id:"listbox-pill-with-icon"},n.a.createElement(p.d,null,n.a.createElement(p.b,{tabIndex:"0"},n.a.createElement(f.a,{containerClassName:"slds-pill__icon_container",title:"Account",assistiveText:"Account"}))),n.a.createElement(p.d,null,n.a.createElement(p.b,null,n.a.createElement(f.a,{containerClassName:"slds-pill__icon_container",symbol:"case",title:"Case",assistiveText:"Case"})))))},{id:"listbox-pill-with-avatar",label:"With avatar",element:n.a.createElement(p.f,{type:"listbox",id:"listbox-pill-with-avatar"},n.a.createElement(p.c,{id:"listbox-pill-with-avatar"},n.a.createElement(p.d,null,n.a.createElement(p.b,{tabIndex:"0"},n.a.createElement(h.a,{className:"slds-avatar_x-small slds-pill__icon_container"},n.a.createElement("img",{alt:"Person name",src:"/assets/images/avatar2.jpg",title:"User avatar"})))),n.a.createElement(p.d,null,n.a.createElement(p.b,null,n.a.createElement(h.a,{className:"slds-avatar_x-small slds-pill__icon_container"},n.a.createElement("img",{alt:"Person name",src:"/assets/images/avatar2.jpg",title:"User avatar"}))))))},{id:"listbox-pill-bare",label:"Bare",element:n.a.createElement(p.f,{type:"listbox",id:"listbox-pills-bare"},n.a.createElement(p.c,{id:"listbox-pills-bare"},n.a.createElement(p.d,null,n.a.createElement(p.b,{className:"slds-pill_bare",tabIndex:"0"})),n.a.createElement(p.d,null,n.a.createElement(p.b,{className:"slds-pill_bare"}))))},{id:"listbox-pill-group",label:"Grouped",element:n.a.createElement("div",null,n.a.createElement("div",{className:"slds-combobox_container"}),n.a.createElement(p.f,{variant:"listbox-group"},n.a.createElement(p.c,null,n.a.createElement(p.d,null,n.a.createElement(p.b,{tabIndex:"0"})),n.a.createElement(p.d,null,n.a.createElement(p.b,null)))))}],y=i.c.a,v=i.c.code,_=i.c.h2,w=i.c.h3,O=i.c.h4,g=i.c.li,j=i.c.p,k=i.c.strong,S=i.c.ul,P=function(){return Object(a.createElement)(i.b,{},Object(a.createElement)("div",{className:"lead doc"},"A pill represents an object that can be viewed with or without an icon."),Object(a.createElement)(s.a,{exampleOnly:!0},Object(o.f)(b,"icon")),_({id:"About-Pills"},"About Pills"),j({},"To create a pill, apply the ",v({},".slds-pill")," class on a ",v({},"<span>"),"."),j({},"Depending on your context, you will either need a base pill (linked or unlinked), or a pill option inside of a listbox. Note that a linked pill should not be used as a pill option inside of a listbox."),j({},"For linked pills, a modifier class of ",v({},"slds-pill_link")," needs to be added to the existing ",v({},"<span>")," with the class name of ",v({},"slds-pill"),". You need an ",v({},"<a>")," inside of the span with the ",v({},"slds-pill_link")," class. The ",v({},"<a>")," will get the class name of ",v({},"slds-pill__action"),". This will treat the interactions differently from an unlinked pill option inside of a listbox."),j({},"For both linked and unlinked pills, a ",v({},"<span>")," with the class name of ",v({},"slds-pill__label")," should contain the string of text describing the pill object."),j({},"Additionally, a pill can have an icon or image that sits to the left-hand side of the ",v({},".slds-pill__label"),". That icon or image should receive the class ",v({},".slds-pill__icon_container"),"."),j({},'You may also want the functionality to remove the pill as a selection. An "X" icon is normally used and will sit to the right-hand side of the ',v({},".slds-pill__label"),". That icon should receive the class ",v({},".slds-pill__remove"),"."),j({},"A ",v({},".slds-pill_container")," can be used as a visual container for multiple pill(s)."),w({id:"Mobile"},"Mobile"),Object(a.createElement)(c.a,{patternSpecificText:"pills will have an increased size to accommodate tapping with a finger instead of the more precise mouse cursor"}),Object(a.createElement)(s.a,{frameOnly:!0,frameTitle:"Example mobile styles for pills"},Object(o.f)(b,"icon")),_({id:"Base"},"Base"),Object(a.createElement)(s.a,null,Object(o.f)(m)),w({id:"Examples"},"Examples"),O({id:"With-Icon"},"With Icon"),Object(a.createElement)(s.a,null,Object(o.f)(b,"icon")),O({id:"With-Avatar"},"With Avatar"),Object(a.createElement)(s.a,null,Object(o.f)(b,"avatar")),O({id:"Pill-with-Container"},"Pill with Container"),Object(a.createElement)(s.a,null,Object(o.f)(b,"container")),w({id:"States"},"States"),O({id:"Error"},"Error"),Object(a.createElement)(s.a,null,Object(o.f)(u,"error")),O({id:"Truncated"},"Truncated"),j({},"The pills component will respect the width of its parent and truncate if necessary."),Object(a.createElement)(s.a,{demoStyles:"width: 220px;"},Object(o.f)(u,"truncated")),j({},"Showing the full text of a truncated pill as a tooltip."),Object(a.createElement)(s.a,{demoStyles:"width: 220px; padding-top:48px;"},Object(o.f)(u,"pill-truncated-tooltip")),_({id:"Listbox-Of-Pill-Options"},"Listbox Of Pill Options"),Object(a.createElement)(s.a,null,Object(o.f)(E)),j({},"A Listbox of Pills is a way to display a list of selected options when performing user input, usually from a multi-select ",y({href:"/components/combobox"},"Combobox"),", ",y({href:"/components/lookups"},"Lookup")," or ",y({href:"/components/picklist"},"Picklist"),"."),j({},"Note that we can use a linked or unlinked pill as a pill item inside of a listbox"),w({id:"Accessibility"},"Accessibility"),j({},k({},"Interaction requirements")),S({},g({},"Only 1 focused Pill per set of Pills"),g({},"The remove button is a focusable element and can be clickable.")),j({},k({},"Keyboard navigation")),S({},g({},"The first ",v({},"pill")," in the list will be take user focus initially, when tabbed to"),g({},v({},"Right")," arrow key will move focus to the next pill in the list"),g({},v({},"Left")," arrow key will move focus to the previous pill in the list"),g({},v({},"Left")," arrow key when on the first ",v({},"pill")," should cycle user focus to the last ",v({},"pill")),g({},v({},"Right")," arrow key when on the last ",v({},"pill")," should cycle user focus to the first ",v({},"pill")),g({},"On removing of the pill, the focus should then be placed on the nearest ",v({},"pill"),S({},g({},"When on the last ",v({},"pill"),", place user focus on the previous ",v({},"pill")),g({},"When on the first ",v({},"pill"),", place user focus on the next ",v({},"pill")),g({},"When on the only ",v({},"pill"),", place user focus on the ",v({},"listbox")," or any ",v({},"input")," element the ",v({},"pill")," might be associated with")))),w({id:"Examples-2"},"Examples"),O({id:"With-Icon-2"},"With Icon"),Object(a.createElement)(s.a,null,Object(o.f)(x,"listbox-pill-with-icon")),O({id:"With-Avatar-2"},"With Avatar"),Object(a.createElement)(s.a,null,Object(o.f)(x,"listbox-pill-with-avatar")),w({id:"Layout"},"Layout"),O({id:"Bare"},"Bare"),Object(a.createElement)(s.a,null,Object(o.f)(x,"listbox-pill-bare")),_({id:"Styling-Hooks-Overview"},"Styling Hooks Overview"),Object(a.createElement)(r.a,{name:"pills",type:"component"}))},N=function(){return Object(i.a)(P())}}});