@salesforce/design-system-react 11.0.0-alpha.7 → 11.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/color-picker/color-picker.cjs +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/combobox/combobox.cjs +1 -1
- package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
- package/dist/cjs/components/filter/filter.cjs +1 -1
- package/dist/cjs/components/filter/filter.cjs.map +1 -1
- package/dist/cjs/components/modal/check-props.cjs +2 -0
- package/dist/cjs/components/modal/check-props.cjs.map +1 -0
- package/dist/cjs/components/modal/component.cjs +2 -0
- package/dist/cjs/components/modal/component.cjs.map +1 -0
- package/dist/cjs/components/modal/index.cjs +1 -1
- package/dist/cjs/components/modal/index.cjs.map +1 -1
- package/dist/cjs/components/popover/component.cjs +2 -0
- package/dist/cjs/components/popover/component.cjs.map +1 -0
- package/dist/cjs/components/popover/edit-dialog.cjs +1 -1
- package/dist/cjs/components/popover/edit-dialog.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs +1 -1
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/slider/check-props.cjs +1 -1
- package/dist/cjs/components/slider/check-props.cjs.map +1 -1
- package/dist/cjs/components/slider/index.cjs +1 -1
- package/dist/cjs/components/slider/index.cjs.map +1 -1
- package/dist/cjs/components/spinner/check-props.cjs +2 -0
- package/dist/cjs/components/spinner/check-props.cjs.map +1 -0
- package/dist/cjs/components/spinner/component.cjs +2 -0
- package/dist/cjs/components/spinner/component.cjs.map +1 -0
- package/dist/cjs/components/spinner/index.cjs +1 -1
- package/dist/cjs/components/spinner/index.cjs.map +1 -1
- package/dist/cjs/components/tree/check-props.cjs +1 -1
- package/dist/cjs/components/tree/check-props.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/vertical-navigation/index.cjs +1 -1
- package/dist/cjs/components/vertical-navigation/index.cjs.map +1 -1
- package/dist/cjs/components/welcome-mat/index.cjs +1 -1
- package/dist/cjs/components/welcome-mat/index.cjs.map +1 -1
- package/dist/es/components/color-picker/color-picker.js +1 -1
- package/dist/es/components/color-picker/color-picker.js.map +1 -1
- package/dist/es/components/combobox/combobox.js +2 -2
- package/dist/es/components/combobox/combobox.js.map +1 -1
- package/dist/es/components/filter/filter.js +1 -1
- package/dist/es/components/filter/filter.js.map +1 -1
- package/dist/es/components/modal/check-props.js +22 -0
- package/dist/es/components/modal/check-props.js.map +1 -0
- package/dist/es/components/modal/component.js +35 -0
- package/dist/es/components/modal/component.js.map +1 -0
- package/dist/es/components/modal/index.js +118 -104
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/popover/component.js +59 -0
- package/dist/es/components/popover/component.js.map +1 -0
- package/dist/es/components/popover/edit-dialog.js +1 -1
- package/dist/es/components/popover/edit-dialog.js.map +1 -1
- package/dist/es/components/popover/popover.js +235 -191
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/slider/check-props.js +1 -1
- package/dist/es/components/slider/check-props.js.map +1 -1
- package/dist/es/components/slider/index.js +63 -60
- package/dist/es/components/slider/index.js.map +1 -1
- package/dist/es/components/spinner/check-props.js +13 -0
- package/dist/es/components/spinner/check-props.js.map +1 -0
- package/dist/es/components/spinner/component.js +17 -0
- package/dist/es/components/spinner/component.js.map +1 -0
- package/dist/es/components/spinner/index.js +43 -29
- package/dist/es/components/spinner/index.js.map +1 -1
- package/dist/es/components/tree/check-props.js +1 -1
- package/dist/es/components/tree/check-props.js.map +1 -1
- package/dist/es/components/tree/tree.js +79 -73
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/vertical-navigation/index.js +17 -16
- package/dist/es/components/vertical-navigation/index.js.map +1 -1
- package/dist/es/components/welcome-mat/index.js +51 -50
- package/dist/es/components/welcome-mat/index.js.map +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/components/modal/check-props.d.ts +3 -0
- package/dist/types/components/modal/check-props.d.ts.map +1 -0
- package/dist/types/components/modal/index.d.ts +21 -13
- package/dist/types/components/modal/index.d.ts.map +1 -1
- package/dist/types/components/popover/popover.d.ts +24 -14
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/slider/check-props.d.ts.map +1 -1
- package/dist/types/components/slider/index.d.ts +9 -7
- package/dist/types/components/slider/index.d.ts.map +1 -1
- package/dist/types/components/spinner/check-props.d.ts +3 -0
- package/dist/types/components/spinner/check-props.d.ts.map +1 -0
- package/dist/types/components/spinner/index.d.ts +18 -9
- package/dist/types/components/spinner/index.d.ts.map +1 -1
- package/dist/types/components/tree/check-props.d.ts.map +1 -1
- package/dist/types/components/tree/tree.d.ts +8 -4
- package/dist/types/components/tree/tree.d.ts.map +1 -1
- package/dist/types/components/vertical-navigation/index.d.ts +7 -7
- package/dist/types/components/vertical-navigation/index.d.ts.map +1 -1
- package/dist/types/components/welcome-mat/index.d.ts +5 -6
- package/dist/types/components/welcome-mat/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/one-of-required-property.cjs"),n=require("../../utilities/warning/deprecated-property.cjs"),r=require("../../utilities/warning/only-one-of-properties.cjs");var i=function(){};process.env.NODE_ENV!==`production`&&(i=function(i,a,o){let s=e.default(o),c=a.assistiveText||{},l={"labels.heading":a.labels?.heading??a.heading,"assistiveText.heading":c.heading??c.label};t.default(i,l,s()),r.default(i,l,s()),n.default(i,a.heading,`heading`,`labels.heading`,s(`labels`)),n.default(i,c.label,`assistiveText.label`,`assistiveText.heading`,s(`assistiveText`)),n.default(i,a.onClick,`onClick`,`onSelect`,"`onSelect` receives `(event, { node, isSelected })`, where `isSelected` is the requested selection state."),n.default(i,a.onExpandClick,`onExpandClick`,`onRequestToggle`,"`onRequestToggle` receives `(event, { node, isExpanded })`, where `isExpanded` is the requested expansion state. Left arrow on a collapsed branch or item selects the parent through `onSelect` instead.")});var a=i;exports.default=a;
|
|
1
|
+
const e=require("../../utilities/get-component-doc.cjs"),t=require("../../utilities/warning/one-of-required-property.cjs"),n=require("../../utilities/warning/deprecated-property.cjs"),r=require("../../utilities/warning/only-one-of-properties.cjs");var i=function(){};process.env.NODE_ENV!==`production`&&(i=function(i,a,o){let s=e.default(o),c=a.assistiveText||{},l={"labels.heading":a.labels?.heading??a.heading,"assistiveText.heading":c.heading??c.label};t.default(i,l,s()),r.default(i,l,s()),n.default(i,a.heading,`heading`,`labels.heading`,s(`labels`)),n.default(i,c.label,`assistiveText.label`,`assistiveText.heading`,s(`assistiveText`)),n.default(i,a.onClick,`onClick`,`onSelect`,"`onSelect` receives `(event, { node, isSelected })`, where `isSelected` is the requested selection state."),n.default(i,a.onExpandClick,`onExpandClick`,`onRequestToggle`,"`onRequestToggle` receives `(event, { node, isExpanded })`, where `isExpanded` is the requested expansion state. Left arrow on a collapsed branch or item selects the parent through `onSelect` instead."),n.default(i,a.listClassName,`listClassName`,`classNameList`),n.default(i,a.listStyle,`listStyle`,`styleList`)});var a=i;exports.default=a;
|
|
2
2
|
//# sourceMappingURL=check-props.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/tree/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport oneOfRequiredProperty from '../../utilities/warning/one-of-required-property';\nimport onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\t\tconst assistiveText = props.assistiveText || {};\n\n\t\tconst headingProps = {\n\t\t\t'labels.heading': props.labels?.heading ?? props.heading,\n\t\t\t'assistiveText.heading': assistiveText.heading ?? assistiveText.label,\n\t\t};\n\t\toneOfRequiredProperty(COMPONENT, headingProps, createDocUrl());\n\t\tonlyOneOfProperties(COMPONENT, headingProps, createDocUrl());\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.heading,\n\t\t\t'heading',\n\t\t\t'labels.heading',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tassistiveText.label,\n\t\t\t'assistiveText.label',\n\t\t\t'assistiveText.heading',\n\t\t\tcreateDocUrl('assistiveText')\n\t\t);\n\n\t\t/* eslint-disable max-len */\n\t\t// Deprecated and changed to another property\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onClick,\n\t\t\t'onClick',\n\t\t\t'onSelect',\n\t\t\t'`onSelect` receives `(event, { node, isSelected })`, where `isSelected` is the requested selection state.'\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onExpandClick,\n\t\t\t'onExpandClick',\n\t\t\t'onRequestToggle',\n\t\t\t'`onRequestToggle` receives `(event, { node, isExpanded })`, where `isExpanded` is the requested expansion state. Left arrow on a collapsed branch or item selects the parent through `onSelect` instead.'\n\t\t);\n\t\t/* eslint-enable max-len */\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"wPASA,IAAI,EAAa,UAA8B,CAAC,EAEhD,QAAA,IAAA,WAA6B,eAC5B,EAAa,SAA4B,EAAW,EAAO,EAAS,CACnE,IAAM,EAAe,EAAA,QAAkB,CAAO,EACxC,EAAgB,EAAM,eAAiB,CAAC,EAExC,EAAe,CACpB,iBAAkB,EAAM,QAAQ,SAAW,EAAM,QACjD,wBAAyB,EAAc,SAAW,EAAc,KACjE,EACA,EAAA,QAAsB,EAAW,EAAc,EAAa,CAAC,EAC7D,EAAA,QAAoB,EAAW,EAAc,EAAa,CAAC,EAE3D,EAAA,QACC,EACA,EAAM,QACN,UACA,iBACA,EAAa,QAAQ,CACtB,EACA,EAAA,QACC,EACA,EAAc,MACd,sBACA,wBACA,EAAa,eAAe,CAC7B,EAIA,EAAA,QACC,EACA,EAAM,QACN,UACA,WACA,2GACD,EACA,EAAA,QACC,EACA,EAAM,cACN,gBACA,kBACA,0MACD,
|
|
1
|
+
{"version":3,"file":"check-props.cjs","names":[],"sources":["../../../../components/tree/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport oneOfRequiredProperty from '../../utilities/warning/one-of-required-property';\nimport onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\t\tconst assistiveText = props.assistiveText || {};\n\n\t\tconst headingProps = {\n\t\t\t'labels.heading': props.labels?.heading ?? props.heading,\n\t\t\t'assistiveText.heading': assistiveText.heading ?? assistiveText.label,\n\t\t};\n\t\toneOfRequiredProperty(COMPONENT, headingProps, createDocUrl());\n\t\tonlyOneOfProperties(COMPONENT, headingProps, createDocUrl());\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.heading,\n\t\t\t'heading',\n\t\t\t'labels.heading',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tassistiveText.label,\n\t\t\t'assistiveText.label',\n\t\t\t'assistiveText.heading',\n\t\t\tcreateDocUrl('assistiveText')\n\t\t);\n\n\t\t/* eslint-disable max-len */\n\t\t// Deprecated and changed to another property\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onClick,\n\t\t\t'onClick',\n\t\t\t'onSelect',\n\t\t\t'`onSelect` receives `(event, { node, isSelected })`, where `isSelected` is the requested selection state.'\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onExpandClick,\n\t\t\t'onExpandClick',\n\t\t\t'onRequestToggle',\n\t\t\t'`onRequestToggle` receives `(event, { node, isExpanded })`, where `isExpanded` is the requested expansion state. Left arrow on a collapsed branch or item selects the parent through `onSelect` instead.'\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.listClassName,\n\t\t\t'listClassName',\n\t\t\t'classNameList'\n\t\t);\n\t\tdeprecatedProperty(COMPONENT, props.listStyle, 'listStyle', 'styleList');\n\t\t/* eslint-enable max-len */\n\t};\n}\n\nexport default checkProps;\n"],"mappings":"wPASA,IAAI,EAAa,UAA8B,CAAC,EAEhD,QAAA,IAAA,WAA6B,eAC5B,EAAa,SAA4B,EAAW,EAAO,EAAS,CACnE,IAAM,EAAe,EAAA,QAAkB,CAAO,EACxC,EAAgB,EAAM,eAAiB,CAAC,EAExC,EAAe,CACpB,iBAAkB,EAAM,QAAQ,SAAW,EAAM,QACjD,wBAAyB,EAAc,SAAW,EAAc,KACjE,EACA,EAAA,QAAsB,EAAW,EAAc,EAAa,CAAC,EAC7D,EAAA,QAAoB,EAAW,EAAc,EAAa,CAAC,EAE3D,EAAA,QACC,EACA,EAAM,QACN,UACA,iBACA,EAAa,QAAQ,CACtB,EACA,EAAA,QACC,EACA,EAAc,MACd,sBACA,wBACA,EAAa,eAAe,CAC7B,EAIA,EAAA,QACC,EACA,EAAM,QACN,UACA,WACA,2GACD,EACA,EAAA,QACC,EACA,EAAM,cACN,gBACA,kBACA,0MACD,EACA,EAAA,QACC,EACA,EAAM,cACN,gBACA,eACD,EACA,EAAA,QAAmB,EAAW,EAAM,UAAW,YAAa,WAAW,CAExE,GAGD,IAAA,EAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("./private/branch.cjs"),r=require("./check-props.cjs"),i=require("./component.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=(e,t,n=``,r=!0)=>{if(!e.nodes)return[{node:e,treeIndex:n}];let i=[{node:e,treeIndex:n}];if(e.expanded)for(let a=0;a<e.nodes.length;a+=1){let o=r?e.nodes[a]:t(e)?.[a];o&&(i=i.concat(c(o,t,n?`${n}-${a}`:`${a}`,!1)))}return i},l=e=>e.nodes,u=({assistiveText:e,className:u,
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("./private/branch.cjs"),r=require("./check-props.cjs"),i=require("./component.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=(e,t,n=``,r=!0)=>{if(!e.nodes)return[{node:e,treeIndex:n}];let i=[{node:e,treeIndex:n}];if(e.expanded)for(let a=0;a<e.nodes.length;a+=1){let o=r?e.nodes[a]:t(e)?.[a];o&&(i=i.concat(c(o,t,n?`${n}-${a}`:`${a}`,!1)))}return i},l=e=>e.nodes,u=(0,a.forwardRef)(({assistiveText:e,className:u,classNameList:d,listClassName:f,getNodes:p=l,heading:m,id:h,labels:g,nodes:_,onSelect:v,onClick:y,onRequestToggle:b,onExpandClick:x,onScroll:S,searchTerm:C,styleList:w,listStyle:T},E)=>{let D=e?.heading??e?.label,O=g?.heading??m,k=(0,a.useRef)(!1),A=(0,a.useCallback)(()=>c({nodes:p({nodes:_}),expanded:!0},p).slice(1),[p,_]),[j,M]=(0,a.useState)(A),[N,P]=(0,a.useState)(()=>{let e=A().find(e=>e.node.selected);return e?[e.treeIndex]:[]}),[F,I]=(0,a.useState)(()=>A().find(e=>e.node.selected)?.treeIndex);(0,a.useEffect)(()=>{r.default(t.TREE,{assistiveText:e,className:u,classNameList:d,listClassName:f,getNodes:p,heading:m,id:h,labels:g,nodes:_,onSelect:v,onClick:y,onRequestToggle:b,onExpandClick:x,onScroll:S,searchTerm:C,styleList:w,listStyle:T},i.default)},[]),(0,a.useEffect)(()=>{M(A())},[A,_]);let L=(0,a.useCallback)(({event:e,data:t,clearSelectedNodes:n,fromFocus:r})=>{n&&j.forEach(e=>{e.node.selected&&(e.node.selected=!1)}),r||(v?v(e,{node:t.node,isSelected:t.select}):y&&y(e,t));let i;i=t.select?[...N,t.treeIndex]:N.filter(e=>e!==t.treeIndex),k.current=!0,I(t.treeIndex),P(i)},[j,v,y,N]),R=(0,a.useCallback)(()=>{k.current=!1},[]),z=(0,a.useCallback)(({event:e,data:t})=>{if(t.select){!b&&x?(k.current=!0,x(e,t),I(t.treeIndex)):L({event:e,data:{node:t.node,select:!0,treeIndex:t.treeIndex},clearSelectedNodes:!0});return}k.current=!0,b?b(e,{node:t.node,isExpanded:t.expand}):x&&x(e,t)},[L,b,x]),B=D||O;return(0,s.jsxs)(`div`,{id:h,className:(0,o.default)(`slds-tree_container`,u),ref:E,children:[(0,s.jsx)(`h4`,{className:(0,o.default)(`slds-tree__group-header`,{"slds-assistive-text":!!D}),id:`${h}__heading`,children:B}),(0,s.jsx)(n.default,{getNodes:p,initalClassName:(0,o.default)(f,d),htmlId:h,initialStyle:T||w?{...T,...w}:void 0,level:0,node:{nodes:_},flattenedNodes:j,selectedNodeIndexes:N,focusedNodeIndex:F,treeHasFocus:k.current,onNodeBlur:R,onSelect:L,onExpand:z,onScroll:S,searchTerm:C,treeId:h})]})});u.displayName=t.TREE,exports.default=u;
|
|
2
2
|
//# sourceMappingURL=tree.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.cjs","names":[],"sources":["../../../../components/tree/tree.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, { useState, useCallback, useEffect, useRef } from 'react';\nimport classNames from 'classnames';\n// Using native Array.find instead of lodash for better TypeScript support\n\n// Child components\nimport Branch from './private/branch';\n\n// Similar to React's PropTypes check\nimport checkProps from './check-props';\n\n// Constants\nimport { TREE } from '../../utilities/constants';\nimport componentDoc from './component.json';\n\nimport {\n\tTreeNode,\n\tFlattenedNode,\n\tTreeAssistiveText,\n\tTreeLabels,\n\tTreeNodeSelectData,\n\tTreeRequestToggleData,\n\tTreeSelectData,\n\tTreeExpandData,\n\tTreeScrollData,\n} from './types';\n\nexport interface TreeProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `heading`: Visually hidden tree heading. Set this or `labels.heading`.\n\t */\n\tassistiveText?: TreeAssistiveText;\n\t/** Class names for the container element */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Class names for the top-level ul element */\n\tlistClassName?: string | string[] | Record<string, boolean>;\n\t/** Function to get child nodes from a parent node */\n\tgetNodes?: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined;\n\t/** @deprecated Use `labels.heading` instead. */\n\theading?: ReactNode;\n\t/** HTML id of the tree container (required) */\n\tid: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `heading`: Visible tree heading that describes its contents. Set this or `assistiveText.heading`.\n\t */\n\tlabels?: TreeLabels;\n\t/** Array of tree nodes */\n\tnodes: TreeNode[];\n\t/**\n\t * Called when an item or branch is selected or deselected: by click, by focus, or by keyboard\n\t * (Enter, Up/Down arrows, Right arrow into an expanded branch, Left arrow to the parent node).\n\t * `data.isSelected` is the requested selection state. Update `node.selected` in `nodes` to apply it.\n\t */\n\tonSelect?: (event: React.SyntheticEvent, data: TreeNodeSelectData) => void;\n\t/**\n\t * Called when an item or branch is selected.\n\t * @deprecated Use `onSelect`, which receives `{ node, isSelected }`. Ignored when `onSelect` is passed.\n\t */\n\tonClick?: (event: React.SyntheticEvent, data: TreeSelectData) => void;\n\t/**\n\t * Called when a branch is asked to expand or collapse: by clicking its toggle button, by Right\n\t * arrow on a collapsed branch, or by Left arrow on an expanded branch. `data.isExpanded` is the\n\t * requested expansion state. Update `node.expanded` in `nodes` to apply it.\n\t */\n\tonRequestToggle?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: TreeRequestToggleData\n\t) => void;\n\t/**\n\t * Called when a branch's expand/collapse button is clicked, or when the Left arrow is pressed\n\t * on a collapsed branch or item (with `data.select: true` and `data.node` set to the parent).\n\t * @deprecated Use `onRequestToggle`, which receives `{ node, isExpanded }`. With\n\t * `onRequestToggle`, Left arrow on a collapsed branch or item selects the parent via\n\t * `onSelect` instead. Ignored when `onRequestToggle` is passed.\n\t */\n\tonExpandClick?: (event: React.SyntheticEvent, data: TreeExpandData) => void;\n\t/** Callback when the tree list scrolls. `data.ratio` is the scroll position from `0` to `1`. */\n\tonScroll?: (\n\t\tevent: React.UIEvent<HTMLUListElement>,\n\t\tdata: TreeScrollData\n\t) => void;\n\t/** Search term to highlight in node labels */\n\tsearchTerm?: string;\n\t/** Styles for the top-level ul element */\n\tlistStyle?: React.CSSProperties;\n}\n\ntype ReactNode = React.ReactNode;\n\n/**\n * Flattens hierarchical tree structure into a flat array.\n * The first item is the whole tree and should be removed with slice(1).\n */\nconst flattenTree = (\n\troot: { nodes?: TreeNode[]; expanded?: boolean },\n\tgetNodes: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined,\n\ttreeIndex = '',\n\tfirstLevel = true\n): FlattenedNode[] => {\n\tif (!root.nodes) {\n\t\treturn [{ node: root as TreeNode, treeIndex }];\n\t}\n\tlet nodes: FlattenedNode[] = [{ node: root as TreeNode, treeIndex }];\n\tif (root.expanded) {\n\t\tfor (let index = 0; index < root.nodes.length; index += 1) {\n\t\t\tconst curNode = firstLevel ? root.nodes[index] : getNodes(root)?.[index];\n\t\t\tif (curNode) {\n\t\t\t\tnodes = nodes.concat(\n\t\t\t\t\tflattenTree(\n\t\t\t\t\t\tcurNode,\n\t\t\t\t\t\tgetNodes,\n\t\t\t\t\t\ttreeIndex ? `${treeIndex}-${index}` : `${index}`,\n\t\t\t\t\t\tfalse\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn nodes;\n};\n\nconst defaultGetNodes = (node: { nodes?: TreeNode[] }) => node.nodes;\n\n/**\n * A tree is visualization of a structure hierarchy.\n * A branch can be expanded or collapsed.\n * This is a controlled component, since visual state is present in the nodes data.\n */\nconst Tree: React.FC<TreeProps> = ({\n\tassistiveText: assistiveTextProp,\n\tclassName,\n\tlistClassName,\n\tgetNodes = defaultGetNodes,\n\theading: headingProp,\n\tid,\n\tlabels,\n\tnodes,\n\tonSelect,\n\tonClick,\n\tonRequestToggle,\n\tonExpandClick,\n\tonScroll,\n\tsearchTerm,\n\tlistStyle,\n}) => {\n\t// `assistiveText.label` is deprecated\n\tconst assistiveHeading =\n\t\tassistiveTextProp?.heading ?? assistiveTextProp?.label;\n\t// `heading` is deprecated\n\tconst visibleHeading = labels?.heading ?? headingProp;\n\n\t// Track if tree has focus\n\tconst treeHasFocusRef = useRef(false);\n\n\t// Compute flattened nodes\n\tconst computeFlattenedNodes = useCallback(() => {\n\t\treturn flattenTree(\n\t\t\t{\n\t\t\t\tnodes: getNodes({ nodes }),\n\t\t\t\texpanded: true,\n\t\t\t},\n\t\t\tgetNodes\n\t\t).slice(1);\n\t}, [getNodes, nodes]);\n\n\t// Initialize state\n\tconst [flattenedNodes, setFlattenedNodes] = useState<FlattenedNode[]>(\n\t\tcomputeFlattenedNodes\n\t);\n\tconst [selectedNodeIndexes, setSelectedNodeIndexes] = useState<string[]>(\n\t\t() => {\n\t\t\tconst flattened = computeFlattenedNodes();\n\t\t\tconst selectedNode = flattened.find((curNode) => curNode.node.selected);\n\t\t\treturn selectedNode ? [selectedNode.treeIndex] : [];\n\t\t}\n\t);\n\tconst [focusedNodeIndex, setFocusedNodeIndex] = useState<string | undefined>(\n\t\t() => {\n\t\t\tconst flattened = computeFlattenedNodes();\n\t\t\tconst selectedNode = flattened.find((curNode) => curNode.node.selected);\n\t\t\treturn selectedNode?.treeIndex;\n\t\t}\n\t);\n\n\t// Check props on mount\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tTREE,\n\t\t\t{\n\t\t\t\tassistiveText: assistiveTextProp,\n\t\t\t\tclassName,\n\t\t\t\tlistClassName,\n\t\t\t\tgetNodes,\n\t\t\t\theading: headingProp,\n\t\t\t\tid,\n\t\t\t\tlabels,\n\t\t\t\tnodes,\n\t\t\t\tonSelect,\n\t\t\t\tonClick,\n\t\t\t\tonRequestToggle,\n\t\t\t\tonExpandClick,\n\t\t\t\tonScroll,\n\t\t\t\tsearchTerm,\n\t\t\t\tlistStyle,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\t// Update flattened nodes when nodes prop changes\n\tuseEffect(() => {\n\t\tsetFlattenedNodes(computeFlattenedNodes());\n\t}, [computeFlattenedNodes, nodes]);\n\n\t// Handle node selection\n\tconst handleSelect = useCallback(\n\t\t({\n\t\t\tevent,\n\t\t\tdata,\n\t\t\tclearSelectedNodes,\n\t\t\tfromFocus,\n\t\t}: {\n\t\t\tevent: React.SyntheticEvent;\n\t\t\tdata: TreeSelectData;\n\t\t\tclearSelectedNodes?: boolean;\n\t\t\tfromFocus?: boolean;\n\t\t}) => {\n\t\t\t// When triggered by a key event, other nodes should be deselected\n\t\t\tif (clearSelectedNodes) {\n\t\t\t\tflattenedNodes.forEach((flattenedNode) => {\n\t\t\t\t\tif (flattenedNode.node.selected) {\n\t\t\t\t\t\tflattenedNode.node.selected = false;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Prevent firing twice on first click due to focus event\n\t\t\tif (!fromFocus) {\n\t\t\t\tif (onSelect) {\n\t\t\t\t\tonSelect(event, { node: data.node, isSelected: data.select });\n\t\t\t\t} else if (onClick) {\n\t\t\t\t\tonClick(event, data);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update selected and focused nodes\n\t\t\tlet newSelectedNodeIndexes: string[];\n\t\t\tif (data.select) {\n\t\t\t\tnewSelectedNodeIndexes = [...selectedNodeIndexes, data.treeIndex];\n\t\t\t} else {\n\t\t\t\tnewSelectedNodeIndexes = selectedNodeIndexes.filter(\n\t\t\t\t\t(treeIndex) => treeIndex !== data.treeIndex\n\t\t\t\t);\n\t\t\t}\n\n\t\t\ttreeHasFocusRef.current = true;\n\t\t\tsetFocusedNodeIndex(data.treeIndex);\n\t\t\tsetSelectedNodeIndexes(newSelectedNodeIndexes);\n\t\t},\n\t\t[flattenedNodes, onSelect, onClick, selectedNodeIndexes]\n\t);\n\n\t// Handle node blur\n\tconst handleNodeBlur = useCallback(() => {\n\t\ttreeHasFocusRef.current = false;\n\t}, []);\n\n\t// Handle expand/collapse\n\tconst handleExpand = useCallback(\n\t\t({\n\t\t\tevent,\n\t\t\tdata,\n\t\t}: {\n\t\t\tevent: React.SyntheticEvent;\n\t\t\tdata: TreeExpandData;\n\t\t}) => {\n\t\t\t// `data.select` marks Left arrow on a collapsed branch or item: move to the parent node.\n\t\t\tif (data.select) {\n\t\t\t\tif (!onRequestToggle && onExpandClick) {\n\t\t\t\t\t// Deprecated behavior: report it to `onExpandClick` with the parent node\n\t\t\t\t\ttreeHasFocusRef.current = true;\n\t\t\t\t\tonExpandClick(event, data);\n\t\t\t\t\tsetFocusedNodeIndex(data.treeIndex);\n\t\t\t\t} else {\n\t\t\t\t\t// Not an expand/collapse request: select the parent, like Up/Down arrows do\n\t\t\t\t\thandleSelect({\n\t\t\t\t\t\tevent,\n\t\t\t\t\t\tdata: { node: data.node, select: true, treeIndex: data.treeIndex },\n\t\t\t\t\t\tclearSelectedNodes: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttreeHasFocusRef.current = true;\n\t\t\tif (onRequestToggle) {\n\t\t\t\tonRequestToggle(event, { node: data.node, isExpanded: data.expand });\n\t\t\t} else if (onExpandClick) {\n\t\t\t\tonExpandClick(event, data);\n\t\t\t}\n\t\t},\n\t\t[handleSelect, onRequestToggle, onExpandClick]\n\t);\n\n\t// Determine heading text\n\tconst headingText = assistiveHeading || visibleHeading;\n\n\treturn (\n\t\t<div id={id} className={classNames('slds-tree_container', className)}>\n\t\t\t<h4\n\t\t\t\tclassName={classNames('slds-tree__group-header', {\n\t\t\t\t\t'slds-assistive-text': !!assistiveHeading,\n\t\t\t\t})}\n\t\t\t\tid={`${id}__heading`}\n\t\t\t>\n\t\t\t\t{headingText}\n\t\t\t</h4>\n\t\t\t<Branch\n\t\t\t\tgetNodes={getNodes}\n\t\t\t\tinitalClassName={listClassName}\n\t\t\t\thtmlId={id}\n\t\t\t\tinitialStyle={listStyle}\n\t\t\t\tlevel={0}\n\t\t\t\tnode={{ nodes }}\n\t\t\t\tflattenedNodes={flattenedNodes}\n\t\t\t\tselectedNodeIndexes={selectedNodeIndexes}\n\t\t\t\tfocusedNodeIndex={focusedNodeIndex}\n\t\t\t\ttreeHasFocus={treeHasFocusRef.current}\n\t\t\t\tonNodeBlur={handleNodeBlur}\n\t\t\t\tonSelect={handleSelect}\n\t\t\t\tonExpand={handleExpand}\n\t\t\t\tonScroll={onScroll}\n\t\t\t\tsearchTerm={searchTerm}\n\t\t\t\ttreeId={id}\n\t\t\t/>\n\t\t</div>\n\t);\n};\n\nTree.displayName = TREE;\n\nexport default Tree;\n"],"mappings":"yTAiGA,IAAM,GACL,EACA,EACA,EAAY,GACZ,EAAa,KACQ,CACrB,GAAI,CAAC,EAAK,MACT,MAAO,CAAC,CAAE,KAAM,EAAkB,WAAU,CAAC,EAE9C,IAAI,E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WAAA,EAAW,EAAA,QAAA,CAAW,sBAAuB,CAAS,EAAnE,SAAA,EACC,EAAA,EAAA,IAAA,CAAC,KAAD,CACC,WAAA,EAAW,EAAA,QAAA,CAAW,0BAA2B,CAChD,sBAAuB,CAAC,CAAC,CAC1B,CAAC,EACD,GAAI,GAAG,EAAG,WAET,SAAA,CACE,CAAA,GACJ,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACW,WACV,gBAAiB,EACjB,OAAQ,EACR,aAAc,EACd,MAAO,EACP,KAAM,CAAE,OAAM,EACE,iBACK,sBACH,mBAClB,aAAc,EAAgB,QAC9B,WAAY,EACZ,SAAU,EACV,SAAU,EACA,WACE,aACZ,OAAQ,CACR,CAAA,CACG,GAEP,EAEA,EAAK,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"tree.cjs","names":[],"sources":["../../../../components/tree/tree.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tforwardRef,\n\tuseState,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n} from 'react';\nimport classNames from 'classnames';\n// Using native Array.find instead of lodash for better TypeScript support\n\n// Child components\nimport Branch from './private/branch';\n\n// Similar to React's PropTypes check\nimport checkProps from './check-props';\n\n// Constants\nimport { TREE } from '../../utilities/constants';\nimport componentDoc from './component.json';\n\nimport {\n\tTreeNode,\n\tFlattenedNode,\n\tTreeAssistiveText,\n\tTreeLabels,\n\tTreeNodeSelectData,\n\tTreeRequestToggleData,\n\tTreeSelectData,\n\tTreeExpandData,\n\tTreeScrollData,\n} from './types';\n\nexport interface TreeProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `heading`: Visually hidden tree heading. Set this or `labels.heading`.\n\t */\n\tassistiveText?: TreeAssistiveText;\n\t/** Class names for the root `.slds-tree_container` div */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Class names for the top-level `ul.slds-tree` element */\n\tclassNameList?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `classNameList`. */\n\tlistClassName?: string | string[] | Record<string, boolean>;\n\t/** Function to get child nodes from a parent node */\n\tgetNodes?: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined;\n\t/** @deprecated Use `labels.heading` instead. */\n\theading?: ReactNode;\n\t/** HTML id of the tree container (required) */\n\tid: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `heading`: Visible tree heading that describes its contents. Set this or `assistiveText.heading`.\n\t */\n\tlabels?: TreeLabels;\n\t/** Array of tree nodes */\n\tnodes: TreeNode[];\n\t/**\n\t * Called when an item or branch is selected or deselected: by click, by focus, or by keyboard\n\t * (Enter, Up/Down arrows, Right arrow into an expanded branch, Left arrow to the parent node).\n\t * `data.isSelected` is the requested selection state. Update `node.selected` in `nodes` to apply it.\n\t */\n\tonSelect?: (event: React.SyntheticEvent, data: TreeNodeSelectData) => void;\n\t/**\n\t * Called when an item or branch is selected.\n\t * @deprecated Use `onSelect`, which receives `{ node, isSelected }`. Ignored when `onSelect` is passed.\n\t */\n\tonClick?: (event: React.SyntheticEvent, data: TreeSelectData) => void;\n\t/**\n\t * Called when a branch is asked to expand or collapse: by clicking its toggle button, by Right\n\t * arrow on a collapsed branch, or by Left arrow on an expanded branch. `data.isExpanded` is the\n\t * requested expansion state. Update `node.expanded` in `nodes` to apply it.\n\t */\n\tonRequestToggle?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: TreeRequestToggleData\n\t) => void;\n\t/**\n\t * Called when a branch's expand/collapse button is clicked, or when the Left arrow is pressed\n\t * on a collapsed branch or item (with `data.select: true` and `data.node` set to the parent).\n\t * @deprecated Use `onRequestToggle`, which receives `{ node, isExpanded }`. With\n\t * `onRequestToggle`, Left arrow on a collapsed branch or item selects the parent via\n\t * `onSelect` instead. Ignored when `onRequestToggle` is passed.\n\t */\n\tonExpandClick?: (event: React.SyntheticEvent, data: TreeExpandData) => void;\n\t/** Callback when the tree list scrolls. `data.ratio` is the scroll position from `0` to `1`. */\n\tonScroll?: (\n\t\tevent: React.UIEvent<HTMLUListElement>,\n\t\tdata: TreeScrollData\n\t) => void;\n\t/** Search term to highlight in node labels */\n\tsearchTerm?: string;\n\t/** Styles for the top-level `ul.slds-tree` element */\n\tstyleList?: React.CSSProperties;\n\t/** @deprecated Use `styleList`. */\n\tlistStyle?: React.CSSProperties;\n}\n\ntype ReactNode = React.ReactNode;\n\n/**\n * Flattens hierarchical tree structure into a flat array.\n * The first item is the whole tree and should be removed with slice(1).\n */\nconst flattenTree = (\n\troot: { nodes?: TreeNode[]; expanded?: boolean },\n\tgetNodes: (node: { nodes?: TreeNode[] }) => TreeNode[] | undefined,\n\ttreeIndex = '',\n\tfirstLevel = true\n): FlattenedNode[] => {\n\tif (!root.nodes) {\n\t\treturn [{ node: root as TreeNode, treeIndex }];\n\t}\n\tlet nodes: FlattenedNode[] = [{ node: root as TreeNode, treeIndex }];\n\tif (root.expanded) {\n\t\tfor (let index = 0; index < root.nodes.length; index += 1) {\n\t\t\tconst curNode = firstLevel ? root.nodes[index] : getNodes(root)?.[index];\n\t\t\tif (curNode) {\n\t\t\t\tnodes = nodes.concat(\n\t\t\t\t\tflattenTree(\n\t\t\t\t\t\tcurNode,\n\t\t\t\t\t\tgetNodes,\n\t\t\t\t\t\ttreeIndex ? `${treeIndex}-${index}` : `${index}`,\n\t\t\t\t\t\tfalse\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn nodes;\n};\n\nconst defaultGetNodes = (node: { nodes?: TreeNode[] }) => node.nodes;\n\n/**\n * A tree is visualization of a structure hierarchy.\n * A branch can be expanded or collapsed.\n * This is a controlled component, since visual state is present in the nodes data.\n */\nconst Tree = forwardRef<HTMLDivElement, TreeProps>(\n\t(\n\t\t{\n\t\t\tassistiveText: assistiveTextProp,\n\t\t\tclassName,\n\t\t\tclassNameList,\n\t\t\tlistClassName,\n\t\t\tgetNodes = defaultGetNodes,\n\t\t\theading: headingProp,\n\t\t\tid,\n\t\t\tlabels,\n\t\t\tnodes,\n\t\t\tonSelect,\n\t\t\tonClick,\n\t\t\tonRequestToggle,\n\t\t\tonExpandClick,\n\t\t\tonScroll,\n\t\t\tsearchTerm,\n\t\t\tstyleList,\n\t\t\tlistStyle,\n\t\t},\n\t\tref\n\t) => {\n\t\t// `assistiveText.label` is deprecated\n\t\tconst assistiveHeading =\n\t\t\tassistiveTextProp?.heading ?? assistiveTextProp?.label;\n\t\t// `heading` is deprecated\n\t\tconst visibleHeading = labels?.heading ?? headingProp;\n\n\t\t// Track if tree has focus\n\t\tconst treeHasFocusRef = useRef(false);\n\n\t\t// Compute flattened nodes\n\t\tconst computeFlattenedNodes = useCallback(() => {\n\t\t\treturn flattenTree(\n\t\t\t\t{\n\t\t\t\t\tnodes: getNodes({ nodes }),\n\t\t\t\t\texpanded: true,\n\t\t\t\t},\n\t\t\t\tgetNodes\n\t\t\t).slice(1);\n\t\t}, [getNodes, nodes]);\n\n\t\t// Initialize state\n\t\tconst [flattenedNodes, setFlattenedNodes] = useState<FlattenedNode[]>(\n\t\t\tcomputeFlattenedNodes\n\t\t);\n\t\tconst [selectedNodeIndexes, setSelectedNodeIndexes] = useState<string[]>(\n\t\t\t() => {\n\t\t\t\tconst flattened = computeFlattenedNodes();\n\t\t\t\tconst selectedNode = flattened.find((curNode) => curNode.node.selected);\n\t\t\t\treturn selectedNode ? [selectedNode.treeIndex] : [];\n\t\t\t}\n\t\t);\n\t\tconst [focusedNodeIndex, setFocusedNodeIndex] = useState<\n\t\t\tstring | undefined\n\t\t>(() => {\n\t\t\tconst flattened = computeFlattenedNodes();\n\t\t\tconst selectedNode = flattened.find((curNode) => curNode.node.selected);\n\t\t\treturn selectedNode?.treeIndex;\n\t\t});\n\n\t\t// Check props on mount\n\t\tuseEffect(() => {\n\t\t\tcheckProps(\n\t\t\t\tTREE,\n\t\t\t\t{\n\t\t\t\t\tassistiveText: assistiveTextProp,\n\t\t\t\t\tclassName,\n\t\t\t\t\tclassNameList,\n\t\t\t\t\tlistClassName,\n\t\t\t\t\tgetNodes,\n\t\t\t\t\theading: headingProp,\n\t\t\t\t\tid,\n\t\t\t\t\tlabels,\n\t\t\t\t\tnodes,\n\t\t\t\t\tonSelect,\n\t\t\t\t\tonClick,\n\t\t\t\t\tonRequestToggle,\n\t\t\t\t\tonExpandClick,\n\t\t\t\t\tonScroll,\n\t\t\t\t\tsearchTerm,\n\t\t\t\t\tstyleList,\n\t\t\t\t\tlistStyle,\n\t\t\t\t},\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, []);\n\n\t\t// Update flattened nodes when nodes prop changes\n\t\tuseEffect(() => {\n\t\t\tsetFlattenedNodes(computeFlattenedNodes());\n\t\t}, [computeFlattenedNodes, nodes]);\n\n\t\t// Handle node selection\n\t\tconst handleSelect = useCallback(\n\t\t\t({\n\t\t\t\tevent,\n\t\t\t\tdata,\n\t\t\t\tclearSelectedNodes,\n\t\t\t\tfromFocus,\n\t\t\t}: {\n\t\t\t\tevent: React.SyntheticEvent;\n\t\t\t\tdata: TreeSelectData;\n\t\t\t\tclearSelectedNodes?: boolean;\n\t\t\t\tfromFocus?: boolean;\n\t\t\t}) => {\n\t\t\t\t// When triggered by a key event, other nodes should be deselected\n\t\t\t\tif (clearSelectedNodes) {\n\t\t\t\t\tflattenedNodes.forEach((flattenedNode) => {\n\t\t\t\t\t\tif (flattenedNode.node.selected) {\n\t\t\t\t\t\t\tflattenedNode.node.selected = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Prevent firing twice on first click due to focus event\n\t\t\t\tif (!fromFocus) {\n\t\t\t\t\tif (onSelect) {\n\t\t\t\t\t\tonSelect(event, { node: data.node, isSelected: data.select });\n\t\t\t\t\t} else if (onClick) {\n\t\t\t\t\t\tonClick(event, data);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Update selected and focused nodes\n\t\t\t\tlet newSelectedNodeIndexes: string[];\n\t\t\t\tif (data.select) {\n\t\t\t\t\tnewSelectedNodeIndexes = [...selectedNodeIndexes, data.treeIndex];\n\t\t\t\t} else {\n\t\t\t\t\tnewSelectedNodeIndexes = selectedNodeIndexes.filter(\n\t\t\t\t\t\t(treeIndex) => treeIndex !== data.treeIndex\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\ttreeHasFocusRef.current = true;\n\t\t\t\tsetFocusedNodeIndex(data.treeIndex);\n\t\t\t\tsetSelectedNodeIndexes(newSelectedNodeIndexes);\n\t\t\t},\n\t\t\t[flattenedNodes, onSelect, onClick, selectedNodeIndexes]\n\t\t);\n\n\t\t// Handle node blur\n\t\tconst handleNodeBlur = useCallback(() => {\n\t\t\ttreeHasFocusRef.current = false;\n\t\t}, []);\n\n\t\t// Handle expand/collapse\n\t\tconst handleExpand = useCallback(\n\t\t\t({\n\t\t\t\tevent,\n\t\t\t\tdata,\n\t\t\t}: {\n\t\t\t\tevent: React.SyntheticEvent;\n\t\t\t\tdata: TreeExpandData;\n\t\t\t}) => {\n\t\t\t\t// `data.select` marks Left arrow on a collapsed branch or item: move to the parent node.\n\t\t\t\tif (data.select) {\n\t\t\t\t\tif (!onRequestToggle && onExpandClick) {\n\t\t\t\t\t\t// Deprecated behavior: report it to `onExpandClick` with the parent node\n\t\t\t\t\t\ttreeHasFocusRef.current = true;\n\t\t\t\t\t\tonExpandClick(event, data);\n\t\t\t\t\t\tsetFocusedNodeIndex(data.treeIndex);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Not an expand/collapse request: select the parent, like Up/Down arrows do\n\t\t\t\t\t\thandleSelect({\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tnode: data.node,\n\t\t\t\t\t\t\t\tselect: true,\n\t\t\t\t\t\t\t\ttreeIndex: data.treeIndex,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tclearSelectedNodes: true,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\ttreeHasFocusRef.current = true;\n\t\t\t\tif (onRequestToggle) {\n\t\t\t\t\tonRequestToggle(event, { node: data.node, isExpanded: data.expand });\n\t\t\t\t} else if (onExpandClick) {\n\t\t\t\t\tonExpandClick(event, data);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[handleSelect, onRequestToggle, onExpandClick]\n\t\t);\n\n\t\t// Determine heading text\n\t\tconst headingText = assistiveHeading || visibleHeading;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tid={id}\n\t\t\t\tclassName={classNames('slds-tree_container', className)}\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t<h4\n\t\t\t\t\tclassName={classNames('slds-tree__group-header', {\n\t\t\t\t\t\t'slds-assistive-text': !!assistiveHeading,\n\t\t\t\t\t})}\n\t\t\t\t\tid={`${id}__heading`}\n\t\t\t\t>\n\t\t\t\t\t{headingText}\n\t\t\t\t</h4>\n\t\t\t\t<Branch\n\t\t\t\t\tgetNodes={getNodes}\n\t\t\t\t\tinitalClassName={classNames(listClassName, classNameList)}\n\t\t\t\t\thtmlId={id}\n\t\t\t\t\tinitialStyle={\n\t\t\t\t\t\tlistStyle || styleList ? { ...listStyle, ...styleList } : undefined\n\t\t\t\t\t}\n\t\t\t\t\tlevel={0}\n\t\t\t\t\tnode={{ nodes }}\n\t\t\t\t\tflattenedNodes={flattenedNodes}\n\t\t\t\t\tselectedNodeIndexes={selectedNodeIndexes}\n\t\t\t\t\tfocusedNodeIndex={focusedNodeIndex}\n\t\t\t\t\ttreeHasFocus={treeHasFocusRef.current}\n\t\t\t\t\tonNodeBlur={handleNodeBlur}\n\t\t\t\t\tonSelect={handleSelect}\n\t\t\t\t\tonExpand={handleExpand}\n\t\t\t\t\tonScroll={onScroll}\n\t\t\t\t\tsearchTerm={searchTerm}\n\t\t\t\t\ttree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jB,EACA,mBAAoB,EACrB,CAAC,EAEF,MACD,CAEA,EAAgB,QAAU,GACtB,EACH,EAAgB,EAAO,CAAE,KAAM,EAAK,KAAM,WAAY,EAAK,MAAO,CAAC,EACzD,GACV,EAAc,EAAO,CAAI,CAE3B,EACA,CAAC,EAAc,EAAiB,CAAa,CAC9C,EAGM,EAAc,GAAoB,EAExC,OACC,EAAA,EAAA,KAAA,CAAC,MAAD,CACK,KACJ,WAAA,EAAW,EAAA,QAAA,CAAW,sBAAuB,CAAS,EACjD,MAHN,SAAA,EAKC,EAAA,EAAA,IAAA,CAAC,KAAD,CACC,WAAA,EAAW,EAAA,QAAA,CAAW,0BAA2B,CAChD,sBAAuB,CAAC,CAAC,CAC1B,CAAC,EACD,GAAI,GAAG,EAAG,WAET,SAAA,CACE,CAAA,GACJ,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CACW,WACV,iBAAA,EAAiB,EAAA,QAAA,CAAW,EAAe,CAAa,EACxD,OAAQ,EACR,aACC,GAAa,EAAY,CAAE,GAAG,EAAW,GAAG,CAAU,EAAI,IAAA,GAE3D,MAAO,EACP,KAAM,CAAE,OAAM,EACE,iBACK,sBACH,mBAClB,aAAc,EAAgB,QAC9B,WAAY,EACZ,SAAU,EACV,SAAU,EACA,WACE,aACZ,OAAQ,CACR,CAAA,CACG,GAEP,CACD,EAEA,EAAK,YAAc,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("./private/item.cjs");let r=require("react")
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("./private/item.cjs");let r=require("react"),i=require("classnames");i=e.__toESM(i,1);let a=require("react/jsx-runtime");var o=(0,r.forwardRef)(({categories:e,className:t,id:o,onSelect:s,selectedId:c},l)=>{let u=(0,r.useId)(),d=o||u,f=(0,r.useMemo)(()=>{if(c)return c;if(e.length>0&&e[0].items?.length>0)return e[0].items[0].id},[c,e]);return(0,a.jsx)(`nav`,{id:d,className:(0,i.default)(`slds-nav-vertical`,t),ref:l,children:e.map(e=>{let t=`${d}-${e.id}`;return(0,a.jsxs)(`div`,{className:`slds-nav-vertical__section`,children:[(0,a.jsx)(`h2`,{id:t,className:`slds-nav-vertical__title`,children:e.label}),(0,a.jsx)(`ul`,{children:e.items.map(e=>(0,a.jsx)(n.default,{item:e,isSelected:e.id===f,categoryId:t,onSelect:s},e.id))},t)]},`${t}-header`)})})});o.displayName=t.VERTICAL_NAVIGATION,exports.default=o;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/vertical-navigation/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/vertical-navigation/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport {\n\tforwardRef,\n\tuseId,\n\tuseMemo,\n\ttype MouseEvent,\n\ttype ReactElement,\n} from 'react';\nimport classNames from 'classnames';\nimport { VERTICAL_NAVIGATION } from '../../utilities/constants';\nimport type { BadgeProps } from '../badge';\nimport type { IconProps } from '../icon';\nimport Item from './private/item';\n\n/**\n * Navigation item structure\n */\nexport interface NavigationItem {\n\t/** Unique identifier */\n\tid: string;\n\t/** Display label */\n\tlabel: string;\n\t/** URL for the link */\n\turl: string;\n\t/** `Icon` rendered before the label. Its `size` sets the right margin. */\n\ticon?: ReactElement<IconProps>;\n\t/** `Badge` rendered after the label, aligned right */\n\tnotificationBadge?: ReactElement<BadgeProps>;\n}\n\n/**\n * Navigation category structure\n */\nexport interface NavigationCategory {\n\t/** Unique identifier */\n\tid: string;\n\t/** Category label */\n\tlabel: string;\n\t/** Items in this category */\n\titems: NavigationItem[];\n}\n\n/**\n * Selection event data\n */\nexport interface NavigationSelectData {\n\titem: NavigationItem;\n}\n\n/**\n * Props for the VerticalNavigation component\n */\nexport interface VerticalNavigationProps {\n\t/** Array of navigation categories */\n\tcategories: NavigationCategory[];\n\t/** CSS classes for the root `nav.slds-nav-vertical` element */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string;\n\t/** Selection callback */\n\tonSelect?: (\n\t\tevent: MouseEvent<HTMLAnchorElement>,\n\t\tdata: NavigationSelectData\n\t) => void;\n\t/** Currently selected item ID */\n\tselectedId?: string;\n}\n\n/**\n * Vertical Navigation represents a list of links that either take the user\n * to another page or parts of the page the user is in.\n */\nconst VerticalNavigation = forwardRef<HTMLElement, VerticalNavigationProps>(\n\t(\n\t\t{ categories, className, id: propId, onSelect, selectedId: propSelectedId },\n\t\tref\n\t) => {\n\t\tconst generatedId = useId();\n\t\tconst rootId = propId || generatedId;\n\n\t\t// Determine selected ID (default to first item if not specified)\n\t\tconst selectedId = useMemo(() => {\n\t\t\tif (propSelectedId) {\n\t\t\t\treturn propSelectedId;\n\t\t\t}\n\t\t\tif (categories.length > 0 && categories[0].items?.length > 0) {\n\t\t\t\treturn categories[0].items[0].id;\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}, [propSelectedId, categories]);\n\n\t\treturn (\n\t\t\t<nav\n\t\t\t\tid={rootId}\n\t\t\t\tclassName={classNames('slds-nav-vertical', className)}\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t{categories.map((category) => {\n\t\t\t\t\tconst categoryId = `${rootId}-${category.id}`;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={`${categoryId}-header`}\n\t\t\t\t\t\t\tclassName=\"slds-nav-vertical__section\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<h2 id={categoryId} className=\"slds-nav-vertical__title\">\n\t\t\t\t\t\t\t\t{category.label}\n\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\t<ul key={categoryId}>\n\t\t\t\t\t\t\t\t{category.items.map((item) => (\n\t\t\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\t\t\tkey={item.id}\n\t\t\t\t\t\t\t\t\t\titem={item}\n\t\t\t\t\t\t\t\t\t\tisSelected={item.id === selectedId}\n\t\t\t\t\t\t\t\t\t\tcategoryId={categoryId}\n\t\t\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</nav>\n\t\t);\n\t}\n);\n\nVerticalNavigation.displayName = VERTICAL_NAVIGATION;\n\nexport default VerticalNavigation;\n"],"mappings":"qUA0EA,IAAM,GAAA,EAAqB,EAAA,WAAA,EAEzB,CAAE,aAAY,YAAW,GAAI,EAAQ,WAAU,WAAY,GAC3D,IACI,CACJ,IAAM,GAAA,EAAc,EAAA,MAAA,CAAM,EACpB,EAAS,GAAU,EAGnB,GAAA,EAAa,EAAA,QAAA,KAAc,CAChC,GAAI,EACH,OAAO,EAER,GAAI,EAAW,OAAS,GAAK,EAAW,EAAE,CAAC,OAAO,OAAS,EAC1D,OAAO,EAAW,EAAE,CAAC,MAAM,EAAE,CAAC,EAGhC,EAAG,CAAC,EAAgB,CAAU,CAAC,EAE/B,OACC,EAAA,EAAA,IAAA,CAAC,MAAD,CACC,GAAI,EACJ,WAAA,EAAW,EAAA,QAAA,CAAW,oBAAqB,CAAS,EAC/C,MAEJ,SAAA,EAAW,IAAK,GAAa,CAC7B,IAAM,EAAa,GAAG,EAAO,GAAG,EAAS,KACzC,OACC,EAAA,EAAA,KAAA,CAAC,MAAD,CAEC,UAAU,6BAFX,SAAA,EAIC,EAAA,EAAA,IAAA,CAAC,KAAD,CAAI,GAAI,EAAY,UAAU,2BAC5B,SAAA,EAAS,KACP,CAAA,GACJ,EAAA,EAAA,IAAA,CAAC,KAAD,CAAA,SACE,EAAS,MAAM,IAAK,IACpB,EAAA,EAAA,IAAA,CAAC,EAAA,QAAD,CAEO,OACN,WAAY,EAAK,KAAO,EACZ,aACF,UACV,EALK,EAAK,EAKV,CACD,CACE,EAVK,CAUL,CACA,CAjBC,EAAA,GAAG,EAAW,QAiBf,CAEP,CAAC,CACG,CAAA,CAEP,CACD,EAEA,EAAmB,YAAc,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../modal/index.cjs"),r=require("../progress-bar/index.cjs"),i=require("./check-props.cjs"),a=require("./component.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l={unitsCompletedAfter:`units completed`},u=({children:e,className:u,doNotShowAgainCheckbox:d,id:f,infoActions:p,infoBadge:m,isOpen:h=!0,labels:g,onRequestClose:_,onRenderInfoActions:v,variant:y=`steps`})=>{let
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utilities/constants.cjs"),n=require("../modal/index.cjs"),r=require("../progress-bar/index.cjs"),i=require("./check-props.cjs"),a=require("./component.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l={unitsCompletedAfter:`units completed`},u=(0,o.forwardRef)(({children:e,className:u,doNotShowAgainCheckbox:d,id:f,infoActions:p,infoBadge:m,isOpen:h=!0,labels:g,onRequestClose:_,onRenderInfoActions:v,variant:y=`steps`},b)=>{let x=(0,o.useId)(),S=f||x,C={...l,...g};(0,o.useEffect)(()=>{i.default(t.WELCOME_MAT,{onRenderInfoActions:v},a.default)},[v]);let{totalSteps:w,completedSteps:T,progress:E}=(0,o.useMemo)(()=>{let t=o.default.Children.count(e),n=o.default.Children.toArray(e).filter(e=>o.default.isValidElement(e)&&e.props.isComplete).length;return{totalSteps:t,completedSteps:n,progress:t>0?n/t*100:0}},[e]),D=(0,c.jsxs)(`div`,{className:`slds-welcome-mat__info-content`,id:`${S}-content`,children:[(0,c.jsx)(`h2`,{className:`slds-welcome-mat__info-title`,id:`${S}-label`,children:C.title}),(0,c.jsx)(`div`,{className:`slds-welcome-mat__info-description slds-text-longform`,children:(0,c.jsx)(`p`,{children:C.description})}),(y===`info-only`||y===`splash`)&&(0,c.jsxs)(`div`,{className:`slds-welcome-mat__info-actions`,children:[p??v?.(),d&&(0,c.jsx)(`div`,{className:`slds-m-top_large`,children:d})]}),(y===`steps`||y===`trailhead-connected`)&&e&&(0,c.jsxs)(`div`,{className:(0,s.default)(`slds-welcome-mat__info-progress`,{"slds-welcome-mat__info-progress_complete":T===w}),children:[y===`trailhead-connected`&&o.default.Children.map(m,e=>o.default.isValidElement(e)?o.default.cloneElement(e,{isComplete:T===w||void 0}):e),(T!==w||y!==`trailhead-connected`)&&(0,c.jsxs)(c.Fragment,{children:[y===`trailhead-connected`?(0,c.jsxs)(`p`,{children:[T,`/`,w,` `,C.unitsCompletedAfter]}):(0,c.jsx)(`p`,{children:(0,c.jsxs)(`strong`,{children:[T,`/`,w,` `,C.unitsCompletedAfter]})}),(0,c.jsx)(r.default,{value:E,radius:`circular`})]})]})]});return(0,c.jsx)(n.default,{assistiveText:{dialogLabelledBy:`${S}-label`},isOpen:h,onRequestClose:_,size:`small`,id:`${S}-modal`,children:(0,c.jsx)(`div`,{className:(0,s.default)(`slds-welcome-mat`,{"slds-welcome-mat_info-only":y===`info-only`,"slds-welcome-mat_splash":!e},u),id:S,ref:b,children:(0,c.jsx)(`div`,{className:`slds-welcome-mat__content slds-grid`,children:e?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(`div`,{className:`slds-welcome-mat__info slds-size_1-of-2`,children:D}),(0,c.jsx)(`div`,{className:(0,s.default)(`slds-welcome-mat__tiles`,`slds-size_1-of-2`,{"slds-welcome-mat__tiles_info-only":y===`info-only`}),children:o.default.Children.map(e,e=>o.default.isValidElement(e)?o.default.cloneElement(e,{variant:y}):e)})]}):(0,c.jsx)(`div`,{className:`slds-welcome-mat__info slds-size_1-of-1`,children:D})})})})});u.displayName=t.WELCOME_MAT,exports.default=u;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/welcome-mat/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tuseEffect,\n\tuseId,\n\tuseMemo,\n\ttype ReactNode,\n\ttype ReactElement,\n} from 'react';\nimport classNames from 'classnames';\nimport Modal, {\n\ttype ModalRequestCloseData,\n\ttype ModalRequestCloseEvent,\n\ttype ModalRequestCloseTrigger,\n} from '../modal';\nimport ProgressBar from '../progress-bar';\nimport { WELCOME_MAT } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Welcome mat variant types\n */\nexport type WelcomeMatVariant =\n\t'steps' | 'info-only' | 'splash' | 'trailhead-connected';\n\n/**\n * Labels for WelcomeMat\n */\nexport interface WelcomeMatLabels {\n\t/** Title text */\n\ttitle?: string;\n\t/** Description text */\n\tdescription?: string;\n\t/** Text after units completed number */\n\tunitsCompletedAfter?: string;\n}\n\n/**\n * What caused a WelcomeMat close request (same as the underlying Modal's)\n */\nexport type WelcomeMatRequestCloseTrigger = ModalRequestCloseTrigger;\n\n/**\n * Data passed to `onRequestClose` (forwarded from the underlying Modal)\n */\nexport type WelcomeMatRequestCloseData = ModalRequestCloseData;\n\n/**\n * Event passed to `onRequestClose` (forwarded from the underlying Modal)\n */\nexport type WelcomeMatRequestCloseEvent = ModalRequestCloseEvent;\n\ninterface WelcomeMatBaseProps {\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string;\n\t/** Whether modal is open */\n\tisOpen?: boolean;\n\t/** Text labels */\n\tlabels?: WelcomeMatLabels;\n\t/**\n\t * Close request handler, forwarded from the underlying Modal. Receives the triggering\n\t * click or keydown event and `data.trigger`: `'close-button'`, `'escape'`, or `'click-outside'`.\n\t */\n\tonRequestClose?: (\n\t\tevent: WelcomeMatRequestCloseEvent,\n\t\tdata: WelcomeMatRequestCloseData\n\t) => void;\n}\n\n/**\n * `variant` decides what the info panel shows. `steps` and\n * `trailhead-connected` show progress through `WelcomeMatTile` children;\n * `info-only` and `splash` show actions instead.\n */\nexport type WelcomeMatVariantProps =\n\t| {\n\t\t\t/** Tiles with a progress bar */\n\t\t\tvariant?: 'steps';\n\t\t\t/** WelcomeMatTile children */\n\t\t\tchildren: ReactNode;\n\t\t\tdoNotShowAgainCheckbox?: never;\n\t\t\tinfoBadge?: never;\n\t\t\tinfoActions?: never;\n\t\t\tonRenderInfoActions?: never;\n\t }\n\t| {\n\t\t\t/** Tiles with Trailhead progress and an info badge */\n\t\t\tvariant: 'trailhead-connected';\n\t\t\t/** WelcomeMatTile children */\n\t\t\tchildren: ReactNode;\n\t\t\tdoNotShowAgainCheckbox?: never;\n\t\t\t/** WelcomeMatInfoBadge shown above the progress */\n\t\t\tinfoBadge?: ReactNode;\n\t\t\tinfoActions?: never;\n\t\t\tonRenderInfoActions?: never;\n\t }\n\t| {\n\t\t\t/** Tiles with actions instead of progress */\n\t\t\tvariant: 'info-only';\n\t\t\t/** WelcomeMatTile children */\n\t\t\tchildren: ReactNode;\n\t\t\t/** Do not show again checkbox element */\n\t\t\tdoNotShowAgainCheckbox?: ReactNode;\n\t\t\tinfoBadge?: never;\n\t\t\t/** Actions shown below the description */\n\t\t\tinfoActions?: ReactNode;\n\t\t\t/** @deprecated Use `infoActions` instead. */\n\t\t\tonRenderInfoActions?: () => ReactNode;\n\t }\n\t| {\n\t\t\t/** Info panel only, with actions and no tiles */\n\t\t\tvariant: 'splash';\n\t\t\tchildren?: never;\n\t\t\t/** Do not show again checkbox element */\n\t\t\tdoNotShowAgainCheckbox?: ReactNode;\n\t\t\tinfoBadge?: never;\n\t\t\t/** Actions shown below the description */\n\t\t\tinfoActions?: ReactNode;\n\t\t\t/** @deprecated Use `infoActions` instead. */\n\t\t\tonRenderInfoActions?: () => ReactNode;\n\t };\n\n/**\n * Props for the WelcomeMat component\n */\nexport type WelcomeMatProps = WelcomeMatBaseProps & WelcomeMatVariantProps;\n\nconst defaultLabels: WelcomeMatLabels = {\n\tunitsCompletedAfter: 'units completed',\n};\n\n/**\n * A Welcome Mat provides a series of unordered items a user can click to learn about a thematic topic.\n */\nconst WelcomeMat = ({\n\tchildren,\n\tclassName,\n\tdoNotShowAgainCheckbox,\n\tid: propId,\n\tinfoActions,\n\tinfoBadge,\n\tisOpen = true,\n\tlabels: propLabels,\n\tonRequestClose,\n\tonRenderInfoActions,\n\tvariant = 'steps',\n}: WelcomeMatProps): React.ReactElement => {\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\tconst labels = { ...defaultLabels, ...propLabels };\n\n\tuseEffect(() => {\n\t\tcheckProps(WELCOME_MAT, { onRenderInfoActions }, componentDoc);\n\t}, [onRenderInfoActions]);\n\n\t// Calculate progress from children\n\tconst { totalSteps, completedSteps, progress } = useMemo(() => {\n\t\tconst total = React.Children.count(children);\n\t\tconst completed = React.Children.toArray(children).filter(\n\t\t\t(c) =>\n\t\t\t\tReact.isValidElement(c) &&\n\t\t\t\t(c.props as { isComplete?: boolean }).isComplete\n\t\t).length;\n\t\treturn {\n\t\t\ttotalSteps: total,\n\t\t\tcompletedSteps: completed,\n\t\t\tprogress: total > 0 ? (completed / total) * 100 : 0,\n\t\t};\n\t}, [children]);\n\n\tconst splash = (\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-welcome-mat__info-content',\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t\tid={`${id}-content`}\n\t\t>\n\t\t\t<h2 className=\"slds-welcome-mat__info-title\" id={`${id}-label`}>\n\t\t\t\t{labels.title}\n\t\t\t</h2>\n\t\t\t<div className=\"slds-welcome-mat__info-description slds-text-longform\">\n\t\t\t\t<p>{labels.description}</p>\n\t\t\t</div>\n\t\t\t{(variant === 'info-only' || variant === 'splash') && (\n\t\t\t\t<div className=\"slds-welcome-mat__info-actions\">\n\t\t\t\t\t{infoActions ?? onRenderInfoActions?.()}\n\t\t\t\t\t{doNotShowAgainCheckbox && (\n\t\t\t\t\t\t<div className=\"slds-m-top_large\">{doNotShowAgainCheckbox}</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{(variant === 'steps' || variant === 'trailhead-connected') &&\n\t\t\t\tchildren && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={classNames('slds-welcome-mat__info-progress', {\n\t\t\t\t\t\t\t'slds-welcome-mat__info-progress_complete':\n\t\t\t\t\t\t\t\tcompletedSteps === totalSteps,\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{variant === 'trailhead-connected' &&\n\t\t\t\t\t\t\tReact.Children.map(infoBadge, (child) =>\n\t\t\t\t\t\t\t\tReact.isValidElement(child)\n\t\t\t\t\t\t\t\t\t? React.cloneElement(\n\t\t\t\t\t\t\t\t\t\t\tchild as ReactElement<{ isComplete?: boolean }>,\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tisComplete: completedSteps === totalSteps || undefined,\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t: child\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t{(completedSteps !== totalSteps ||\n\t\t\t\t\t\t\tvariant !== 'trailhead-connected') && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t{variant === 'trailhead-connected' ? (\n\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t{completedSteps}/{totalSteps} {labels.unitsCompletedAfter}\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t\t\t\t{completedSteps}/{totalSteps} {labels.unitsCompletedAfter}\n\t\t\t\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t<ProgressBar value={progress} radius=\"circular\" />\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<Modal\n\t\t\tassistiveText={{\n\t\t\t\tdialogLabelledBy: `${id}-label`,\n\t\t\t}}\n\t\t\tisOpen={isOpen}\n\t\t\tonRequestClose={onRequestClose}\n\t\t\tsize=\"small\"\n\t\t\tid={`${id}-modal`}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={classNames('slds-welcome-mat', {\n\t\t\t\t\t'slds-welcome-mat_info-only': variant === 'info-only',\n\t\t\t\t\t'slds-welcome-mat_splash': !children,\n\t\t\t\t})}\n\t\t\t\tid={id}\n\t\t\t>\n\t\t\t\t<div className=\"slds-welcome-mat__content slds-grid\">\n\t\t\t\t\t{children ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"slds-welcome-mat__info slds-size_1-of-2\">\n\t\t\t\t\t\t\t\t{splash}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\t\t'slds-welcome-mat__tiles',\n\t\t\t\t\t\t\t\t\t'slds-size_1-of-2',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'slds-welcome-mat__tiles_info-only':\n\t\t\t\t\t\t\t\t\t\t\tvariant === 'info-only',\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{React.Children.map(children, (child) =>\n\t\t\t\t\t\t\t\t\tReact.isValidElement(child)\n\t\t\t\t\t\t\t\t\t\t? React.cloneElement(\n\t\t\t\t\t\t\t\t\t\t\t\tchild as ReactElement<{ variant?: WelcomeMatVariant }>,\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tvariant,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t: child\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<div className=\"slds-welcome-mat__info slds-size_1-of-1\">\n\t\t\t\t\t\t\t{splash}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n};\n\nWelcomeMat.displayName = WELCOME_MAT;\n\nexport default WelcomeMat;\n"],"mappings":"6bAmIA,IAAM,EAAkC,CACvC,oBAAqB,iBACtB,EAKM,GAAc,CACnB,WACA,YACA,yBACA,GAAI,EACJ,cACA,YACA,SAAS,GACT,OAAQ,EACR,iBACA,sBACA,UAAU,WACgC,CAC1C,IAAM,GAAA,EAAc,EAAA,MAAA,CAAM,EACpB,EAAK,GAAU,EACf,EAAS,CAAE,GAAG,EAAe,GAAG,CAAW,GAEjD,EAAA,EAA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A,CACC,SACD,CACD,EACC,CACJ,CACI,CAAA,CACJ,CAAA,CAAA,GAEF,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0CACb,SAAA,CACG,CAAA,CAEF,CAAA,CACD,CAAA,CACC,CAAA,CAET,EAEA,EAAW,YAAc,EAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../components/welcome-mat/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tforwardRef,\n\tuseEffect,\n\tuseId,\n\tuseMemo,\n\ttype ReactNode,\n\ttype ReactElement,\n} from 'react';\nimport classNames from 'classnames';\nimport Modal, {\n\ttype ModalRequestCloseData,\n\ttype ModalRequestCloseEvent,\n\ttype ModalRequestCloseTrigger,\n} from '../modal';\nimport ProgressBar from '../progress-bar';\nimport { WELCOME_MAT } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Welcome mat variant types\n */\nexport type WelcomeMatVariant =\n\t'steps' | 'info-only' | 'splash' | 'trailhead-connected';\n\n/**\n * Labels for WelcomeMat\n */\nexport interface WelcomeMatLabels {\n\t/** Title text */\n\ttitle?: string;\n\t/** Description text */\n\tdescription?: string;\n\t/** Text after units completed number */\n\tunitsCompletedAfter?: string;\n}\n\n/**\n * What caused a WelcomeMat close request (same as the underlying Modal's)\n */\nexport type WelcomeMatRequestCloseTrigger = ModalRequestCloseTrigger;\n\n/**\n * Data passed to `onRequestClose` (forwarded from the underlying Modal)\n */\nexport type WelcomeMatRequestCloseData = ModalRequestCloseData;\n\n/**\n * Event passed to `onRequestClose` (forwarded from the underlying Modal)\n */\nexport type WelcomeMatRequestCloseEvent = ModalRequestCloseEvent;\n\ninterface WelcomeMatBaseProps {\n\t/** CSS classes for the root `.slds-welcome-mat` div */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string;\n\t/** Whether modal is open */\n\tisOpen?: boolean;\n\t/** Text labels */\n\tlabels?: WelcomeMatLabels;\n\t/**\n\t * Close request handler, forwarded from the underlying Modal. Receives the triggering\n\t * click or keydown event and `data.trigger`: `'close-button'`, `'escape'`, or `'click-outside'`.\n\t */\n\tonRequestClose?: (\n\t\tevent: WelcomeMatRequestCloseEvent,\n\t\tdata: WelcomeMatRequestCloseData\n\t) => void;\n}\n\n/**\n * `variant` decides what the info panel shows. `steps` and\n * `trailhead-connected` show progress through `WelcomeMatTile` children;\n * `info-only` and `splash` show actions instead.\n */\nexport type WelcomeMatVariantProps =\n\t| {\n\t\t\t/** Tiles with a progress bar */\n\t\t\tvariant?: 'steps';\n\t\t\t/** WelcomeMatTile children */\n\t\t\tchildren: ReactNode;\n\t\t\tdoNotShowAgainCheckbox?: never;\n\t\t\tinfoBadge?: never;\n\t\t\tinfoActions?: never;\n\t\t\tonRenderInfoActions?: never;\n\t }\n\t| {\n\t\t\t/** Tiles with Trailhead progress and an info badge */\n\t\t\tvariant: 'trailhead-connected';\n\t\t\t/** WelcomeMatTile children */\n\t\t\tchildren: ReactNode;\n\t\t\tdoNotShowAgainCheckbox?: never;\n\t\t\t/** WelcomeMatInfoBadge shown above the progress */\n\t\t\tinfoBadge?: ReactNode;\n\t\t\tinfoActions?: never;\n\t\t\tonRenderInfoActions?: never;\n\t }\n\t| {\n\t\t\t/** Tiles with actions instead of progress */\n\t\t\tvariant: 'info-only';\n\t\t\t/** WelcomeMatTile children */\n\t\t\tchildren: ReactNode;\n\t\t\t/** Do not show again checkbox element */\n\t\t\tdoNotShowAgainCheckbox?: ReactNode;\n\t\t\tinfoBadge?: never;\n\t\t\t/** Actions shown below the description */\n\t\t\tinfoActions?: ReactNode;\n\t\t\t/** @deprecated Use `infoActions` instead. */\n\t\t\tonRenderInfoActions?: () => ReactNode;\n\t }\n\t| {\n\t\t\t/** Info panel only, with actions and no tiles */\n\t\t\tvariant: 'splash';\n\t\t\tchildren?: never;\n\t\t\t/** Do not show again checkbox element */\n\t\t\tdoNotShowAgainCheckbox?: ReactNode;\n\t\t\tinfoBadge?: never;\n\t\t\t/** Actions shown below the description */\n\t\t\tinfoActions?: ReactNode;\n\t\t\t/** @deprecated Use `infoActions` instead. */\n\t\t\tonRenderInfoActions?: () => ReactNode;\n\t };\n\n/**\n * Props for the WelcomeMat component\n */\nexport type WelcomeMatProps = WelcomeMatBaseProps & WelcomeMatVariantProps;\n\nconst defaultLabels: WelcomeMatLabels = {\n\tunitsCompletedAfter: 'units completed',\n};\n\n/**\n * A Welcome Mat provides a series of unordered items a user can click to learn about a thematic topic.\n */\nconst WelcomeMat = forwardRef<HTMLDivElement, WelcomeMatProps>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tdoNotShowAgainCheckbox,\n\t\t\tid: propId,\n\t\t\tinfoActions,\n\t\t\tinfoBadge,\n\t\t\tisOpen = true,\n\t\t\tlabels: propLabels,\n\t\t\tonRequestClose,\n\t\t\tonRenderInfoActions,\n\t\t\tvariant = 'steps',\n\t\t},\n\t\tref\n\t) => {\n\t\tconst generatedId = useId();\n\t\tconst id = propId || generatedId;\n\t\tconst labels = { ...defaultLabels, ...propLabels };\n\n\t\tuseEffect(() => {\n\t\t\tcheckProps(WELCOME_MAT, { onRenderInfoActions }, componentDoc);\n\t\t}, [onRenderInfoActions]);\n\n\t\t// Calculate progress from children\n\t\tconst { totalSteps, completedSteps, progress } = useMemo(() => {\n\t\t\tconst total = React.Children.count(children);\n\t\t\tconst completed = React.Children.toArray(children).filter(\n\t\t\t\t(c) =>\n\t\t\t\t\tReact.isValidElement(c) &&\n\t\t\t\t\t(c.props as { isComplete?: boolean }).isComplete\n\t\t\t).length;\n\t\t\treturn {\n\t\t\t\ttotalSteps: total,\n\t\t\t\tcompletedSteps: completed,\n\t\t\t\tprogress: total > 0 ? (completed / total) * 100 : 0,\n\t\t\t};\n\t\t}, [children]);\n\n\t\tconst splash = (\n\t\t\t<div className=\"slds-welcome-mat__info-content\" id={`${id}-content`}>\n\t\t\t\t<h2 className=\"slds-welcome-mat__info-title\" id={`${id}-label`}>\n\t\t\t\t\t{labels.title}\n\t\t\t\t</h2>\n\t\t\t\t<div className=\"slds-welcome-mat__info-description slds-text-longform\">\n\t\t\t\t\t<p>{labels.description}</p>\n\t\t\t\t</div>\n\t\t\t\t{(variant === 'info-only' || variant === 'splash') && (\n\t\t\t\t\t<div className=\"slds-welcome-mat__info-actions\">\n\t\t\t\t\t\t{infoActions ?? onRenderInfoActions?.()}\n\t\t\t\t\t\t{doNotShowAgainCheckbox && (\n\t\t\t\t\t\t\t<div className=\"slds-m-top_large\">{doNotShowAgainCheckbox}</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{(variant === 'steps' || variant === 'trailhead-connected') &&\n\t\t\t\t\tchildren && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={classNames('slds-welcome-mat__info-progress', {\n\t\t\t\t\t\t\t\t'slds-welcome-mat__info-progress_complete':\n\t\t\t\t\t\t\t\t\tcompletedSteps === totalSteps,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{variant === 'trailhead-connected' &&\n\t\t\t\t\t\t\t\tReact.Children.map(infoBadge, (child) =>\n\t\t\t\t\t\t\t\t\tReact.isValidElement(child)\n\t\t\t\t\t\t\t\t\t\t? React.cloneElement(\n\t\t\t\t\t\t\t\t\t\t\t\tchild as ReactElement<{ isComplete?: boolean }>,\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tisComplete:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcompletedSteps === totalSteps || undefined,\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t: child\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{(completedSteps !== totalSteps ||\n\t\t\t\t\t\t\t\tvariant !== 'trailhead-connected') && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t{variant === 'trailhead-connected' ? (\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t{completedSteps}/{totalSteps} {labels.unitsCompletedAfter}\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t\t\t\t\t{completedSteps}/{totalSteps}{' '}\n\t\t\t\t\t\t\t\t\t\t\t\t{labels.unitsCompletedAfter}\n\t\t\t\t\t\t\t\t\t\t\t</strong>\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t<ProgressBar value={progress} radius=\"circular\" />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t</div>\n\t\t);\n\n\t\treturn (\n\t\t\t<Modal\n\t\t\t\tassistiveText={{\n\t\t\t\t\tdialogLabelledBy: `${id}-label`,\n\t\t\t\t}}\n\t\t\t\tisOpen={isOpen}\n\t\t\t\tonRequestClose={onRequestClose}\n\t\t\t\tsize=\"small\"\n\t\t\t\tid={`${id}-modal`}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-welcome-mat',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'slds-welcome-mat_info-only': variant === 'info-only',\n\t\t\t\t\t\t\t'slds-welcome-mat_splash': !children,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tclassName\n\t\t\t\t\t)}\n\t\t\t\t\tid={id}\n\t\t\t\t\tref={ref}\n\t\t\t\t>\n\t\t\t\t\t<div className=\"slds-welcome-mat__content slds-grid\">\n\t\t\t\t\t\t{children ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<div className=\"slds-welcome-mat__info slds-size_1-of-2\">\n\t\t\t\t\t\t\t\t\t{splash}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t\t\t\t\t'slds-welcome-mat__tiles',\n\t\t\t\t\t\t\t\t\t\t'slds-size_1-of-2',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'slds-welcome-mat__tiles_info-only':\n\t\t\t\t\t\t\t\t\t\t\t\tvariant === 'info-only',\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{React.Children.map(children, (child) =>\n\t\t\t\t\t\t\t\t\t\tReact.isValidElement(child)\n\t\t\t\t\t\t\t\t\t\t\t? React.cloneElement(\n\t\t\t\t\t\t\t\t\t\t\t\t\tchild as ReactElement<{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariant?: WelcomeMatVariant;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}>,\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvariant,\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t: child\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<div className=\"slds-welcome-mat__info slds-size_1-of-1\">\n\t\t\t\t\t\t\t\t{splash}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</Modal>\n\t\t);\n\t}\n);\n\nWelcomeMat.displayName =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CAAA,EAAA,SAAA,CAAA,SAAA,EACC,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0CACb,SAAA,CACG,CAAA,GACL,EAAA,EAAA,IAAA,CAAC,MAAD,CACC,WAAA,EAAW,EAAA,QAAA,CACV,0BACA,mBACA,CACC,oCACC,IAAY,WACd,CACD,EAEC,SAAA,EAAA,QAAM,SAAS,IAAI,EAAW,GAC9B,EAAA,QAAM,eAAe,CAAK,EACvB,EAAA,QAAM,aACN,EAGA,CACC,SACD,CACD,EACC,CACJ,CACI,CAAA,CACJ,CAAA,CAAA,GAEF,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,0CACb,SAAA,CACG,CAAA,CAEF,CAAA,CACD,CAAA,CACC,CAAA,CAET,CACD,EAEA,EAAW,YAAc,EAAA"}
|
|
@@ -192,7 +192,7 @@ var h = {
|
|
|
192
192
|
ariaLabelledby: `color-picker-label-${R}`,
|
|
193
193
|
align: "bottom left",
|
|
194
194
|
body: xe,
|
|
195
|
-
|
|
195
|
+
classNameDialog: f("slds-color-picker__selector", v),
|
|
196
196
|
footer: Se,
|
|
197
197
|
hasNoCloseButton: !0,
|
|
198
198
|
hasNoNubbin: !0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.js","names":[],"sources":["../../../../components/color-picker/color-picker.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React, {\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n} from 'react';\nimport classNames from 'classnames';\n\nimport checkProps from './check-props';\n\nimport CustomColor from './private/custom-color';\nimport Swatch from './private/swatch';\nimport SwatchPicker from './private/swatch-picker';\n\nimport Button from '../button';\nimport Input, { type InputChangeData } from '../input';\nimport Tabs from '../tabs';\nimport TabsPanel from '../tabs/panel';\nimport Popover from '../popover';\n\nimport ColorUtils from '../../utilities/color';\nimport { COLOR_PICKER } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\n\nimport {\n\tWorkingColor,\n\tColorPickerAssistiveText,\n\tColorPickerLabels,\n\tColorPickerEvents,\n} from './types';\n\ninterface ColorPickerBaseProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ColorPickerAssistiveText;\n\t/** CSS classes for the color-picker container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the popover menu */\n\tclassNameMenu?: string | string[] | Record<string, boolean>;\n\t/** Unique ID for the component */\n\tid?: string;\n\t/** Disables the input and button */\n\tdisabled?: boolean;\n\t/** Error message for the outer input */\n\terrorText?: string;\n\t/** Error message for the custom tab working color input */\n\terrorTextWorkingColor?: string;\n\t/** Event callbacks */\n\tevents?: ColorPickerEvents;\n\t/** Disable flip behavior for popover alignment */\n\thasStaticAlignment?: boolean;\n\t/** Hides the text input */\n\thideInput?: boolean;\n\t/** Controlled popover open state */\n\tisOpen?: boolean;\n\t/** Text labels for internationalization */\n\tlabels?: ColorPickerLabels;\n\t/** Popover position strategy */\n\tmenuPosition?: 'absolute' | 'overflowBoundaryElement' | 'relative';\n\t/** Current color in hexadecimal string */\n\tvalue?: string;\n\t/** Current working color in hexadecimal string */\n\tvalueWorking?: string;\n\t/** Callback when popover closes */\n\tonClose?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { trigger?: string; componentWillUnmount?: boolean }\n\t) => void;\n\t/** Callback when popover opens */\n\tonOpen?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { portal?: HTMLElement }\n\t) => void;\n\t/** Callback when user requests close */\n\tonRequestClose?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { trigger: string }\n\t) => void;\n\t/** Callback when popover requests to open */\n\tonRequestOpen?: () => void;\n}\n\n/**\n * `variant` sets which tabs are present. `swatchColors` needs the swatch tab\n * and `defaultSelectedTab` only applies when both tabs are present.\n */\nexport type ColorPickerVariantProps =\n\t| {\n\t\t\t/** Both the swatch and custom tabs */\n\t\t\tvariant?: 'base';\n\t\t\t/** Array of hex color values for swatch options */\n\t\t\tswatchColors?: string[];\n\t\t\t/** Which tab is visible when dialog opens */\n\t\t\tdefaultSelectedTab?: 'swatches' | 'custom';\n\t }\n\t| {\n\t\t\t/** Only the swatch tab */\n\t\t\tvariant: 'swatches';\n\t\t\t/** Array of hex color values for swatch options */\n\t\t\tswatchColors?: string[];\n\t\t\tdefaultSelectedTab?: never;\n\t }\n\t| {\n\t\t\t/** Only the custom tab */\n\t\t\tvariant: 'custom';\n\t\t\tswatchColors?: never;\n\t\t\tdefaultSelectedTab?: never;\n\t };\n\nexport type ColorPickerProps = ColorPickerBaseProps & ColorPickerVariantProps;\n\nconst defaultLabels: ColorPickerLabels = {\n\tblueAbbreviated: 'B',\n\tcancelButton: 'Cancel',\n\tcustomTab: 'Custom',\n\tcustomTabActiveWorkingColorSwatch: 'Working Color',\n\tcustomTabTransparentSwatch: 'Transparent Swatch',\n\tgreenAbbreviated: 'G',\n\thexLabel: 'Hex',\n\tinvalidColor: 'The color entered is invalid',\n\tinvalidComponent: 'The value needs to be an integer from 0-255',\n\tredAbbreviated: 'R',\n\tsubmitButton: 'Done',\n\tswatchTab: 'Default',\n\tswatchTabTransparentSwatch: 'Transparent Swatch',\n};\n\nconst defaultAssistiveText: ColorPickerAssistiveText = {\n\tsaturationValueGrid:\n\t\t'Use arrow keys to select a saturation and brightness, on an x and y axis.',\n\thueSlider: 'Select Hue',\n};\n\nconst defaultSwatchColors = [\n\t'#e3abec',\n\t'#c2dbf7',\n\t'#9fd6ff',\n\t'#9de7da',\n\t'#9df0c0',\n\t'#fff099',\n\t'#fed49a',\n\t'#d073e0',\n\t'#86baf3',\n\t'#5ebbff',\n\t'#44d8be',\n\t'#3be282',\n\t'#ffe654',\n\t'#ffb758',\n\t'#bd35bd',\n\t'#5779c1',\n\t'#5679c0',\n\t'#00aea9',\n\t'#3cba4c',\n\t'#f5bc25',\n\t'#f99221',\n\t'#580d8c',\n\t'#001970',\n\t'#0a2399',\n\t'#0b7477',\n\t'#0b6b50',\n\t'#b67e11',\n\t'#b85d0d',\n\t'',\n];\n\n/**\n * The Unified Color Picker component allows for a fully accessible and\n * configurable color picker, allowing the user to pick from a set of\n * predefined colors (swatches), or to pick a custom color using a HSB\n * selection interface.\n */\nconst ColorPicker: React.FC<ColorPickerProps> = ({\n\tassistiveText: assistiveTextProp,\n\tclassName,\n\tclassNameMenu,\n\tid: idProp,\n\tdisabled = false,\n\terrorText: errorTextProp,\n\terrorTextWorkingColor,\n\tevents = {},\n\thasStaticAlignment,\n\thideInput = false,\n\tisOpen: isOpenProp,\n\tlabels: labelsProp,\n\tmenuPosition = 'absolute',\n\tswatchColors = defaultSwatchColors,\n\tdefaultSelectedTab = 'swatches',\n\tvariant = 'base',\n\tvalue: valueProp,\n\tvalueWorking: valueWorkingProp,\n\tonClose,\n\tonOpen,\n\tonRequestClose,\n\tonRequestOpen,\n}) => {\n\t// Merge labels and assistive text with defaults\n\tconst labels = useMemo(\n\t\t() => ({ ...defaultLabels, ...labelsProp }),\n\t\t[labelsProp]\n\t);\n\tconst assistiveText = useMemo(\n\t\t() => ({ ...defaultAssistiveText, ...assistiveTextProp }),\n\t\t[assistiveTextProp]\n\t);\n\n\t// Generate stable ID\n\tconst generatedId = useRef(idProp || generateId());\n\tconst componentId = idProp || generatedId.current;\n\n\t// Refs\n\tconst wrapperRef = useRef<HTMLDivElement>(null);\n\n\t// Initialize working color from props\n\tconst getInitialWorkingColor = useCallback((): WorkingColor => {\n\t\treturn ColorUtils.getNewColor(\n\t\t\t{ hex: valueWorkingProp || valueProp },\n\t\t\tevents.onValidateWorkingColor\n\t\t) as WorkingColor;\n\t}, [valueWorkingProp, valueProp, events.onValidateWorkingColor]);\n\n\t// State\n\tconst [currentColor, setCurrentColor] = useState<string>(\n\t\tvalueProp != null ? valueProp : ''\n\t);\n\tconst [isOpen, setIsOpen] = useState<boolean>(isOpenProp || false);\n\tconst [workingColor, setWorkingColor] = useState<WorkingColor>(\n\t\tgetInitialWorkingColor\n\t);\n\tconst [previousWorkingColor, setPreviousWorkingColor] =\n\t\tuseState<WorkingColor>(getInitialWorkingColor);\n\tconst [colorErrorMessage, setColorErrorMessage] = useState<string>(\n\t\terrorTextProp || ''\n\t);\n\n\t// Check props on mount (development only)\n\tuseEffect(() => {\n\t\t// checkProps is a no-op in production\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(checkProps as any)(\n\t\t\tCOLOR_PICKER,\n\t\t\t{\n\t\t\t\tassistiveText: assistiveTextProp,\n\t\t\t\tclassName,\n\t\t\t\tclassNameMenu,\n\t\t\t\tid: idProp,\n\t\t\t\tdisabled,\n\t\t\t\terrorText: errorTextProp,\n\t\t\t\terrorTextWorkingColor,\n\t\t\t\tevents,\n\t\t\t\thasStaticAlignment,\n\t\t\t\thideInput,\n\t\t\t\tisOpen: isOpenProp,\n\t\t\t\tlabels: labelsProp,\n\t\t\t\tmenuPosition,\n\t\t\t\tswatchColors,\n\t\t\t\tdefaultSelectedTab,\n\t\t\t\tvariant,\n\t\t\t\tvalue: valueProp,\n\t\t\t\tvalueWorking: valueWorkingProp,\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\t// Sync props to state when they change externally\n\tuseEffect(() => {\n\t\tif (valueProp !== undefined) {\n\t\t\tsetCurrentColor(valueProp);\n\t\t}\n\t}, [valueProp]);\n\n\tuseEffect(() => {\n\t\tif (valueWorkingProp !== undefined) {\n\t\t\tsetWorkingColor(\n\t\t\t\tColorUtils.getNewColor(\n\t\t\t\t\t{ hex: valueWorkingProp },\n\t\t\t\t\tevents.onValidateWorkingColor\n\t\t\t\t) as WorkingColor\n\t\t\t);\n\t\t}\n\t}, [valueWorkingProp, events.onValidateWorkingColor]);\n\n\tuseEffect(() => {\n\t\tif (isOpenProp !== undefined) {\n\t\t\tsetIsOpen(isOpenProp);\n\t\t}\n\t}, [isOpenProp]);\n\n\t// Helper to update working color\n\tconst updateWorkingColor = useCallback(\n\t\t(\n\t\t\tevent: React.SyntheticEvent,\n\t\t\tcolorOptions: {\n\t\t\t\thex?: string;\n\t\t\t\tred?: string | number;\n\t\t\t\tgreen?: string | number;\n\t\t\t\tblue?: string | number;\n\t\t\t\thue?: number | string;\n\t\t\t\tsaturation?: number;\n\t\t\t\tvalue?: number;\n\t\t\t}\n\t\t) => {\n\t\t\tconst newColor = ColorUtils.getNewColor(\n\t\t\t\tcolorOptions,\n\t\t\t\tevents.onValidateWorkingColor,\n\t\t\t\tworkingColor\n\t\t\t) as WorkingColor;\n\t\t\tsetPreviousWorkingColor(workingColor);\n\t\t\tsetWorkingColor(newColor);\n\n\t\t\tif (events.onWorkingColorChange) {\n\t\t\t\tevents.onWorkingColorChange(event, { color: newColor });\n\t\t\t}\n\t\t},\n\t\t[events, workingColor]\n\t);\n\n\t// Event handlers\n\tconst handleSwatchChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tupdateWorkingColor(event, { hex: event.target.value });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleCancelState = useCallback(() => {\n\t\tconst resetColor = ColorUtils.getNewColor(\n\t\t\t{ hex: currentColor },\n\t\t\tevents.onValidateWorkingColor\n\t\t) as WorkingColor;\n\t\tsetIsOpen(false);\n\t\tsetWorkingColor(resetColor);\n\t\tsetPreviousWorkingColor(resetColor);\n\t}, [currentColor, events.onValidateWorkingColor]);\n\n\tconst handleOnRequestClose = useCallback(\n\t\t(event: React.SyntheticEvent, data: { trigger: string }) => {\n\t\t\tif (data.trigger === 'clickOutside' || data.trigger === 'cancel') {\n\t\t\t\thandleCancelState();\n\t\t\t}\n\n\t\t\tif (onRequestClose) {\n\t\t\t\tonRequestClose(event, data);\n\t\t\t}\n\t\t},\n\t\t[handleCancelState, onRequestClose]\n\t);\n\n\tconst handleCancel = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\thandleCancelState();\n\n\t\t\tif (onRequestClose) {\n\t\t\t\tonRequestClose(event, { trigger: 'cancel' });\n\t\t\t}\n\t\t},\n\t\t[handleCancelState, onRequestClose]\n\t);\n\n\tconst handleColorChange = useCallback(\n\t\t(property: 'hex' | 'red' | 'green' | 'blue') =>\n\t\t\t(event: React.SyntheticEvent, data: InputChangeData) => {\n\t\t\t\tconst colorProperties: Record<string, string | number> = {};\n\t\t\t\tcolorProperties[property] = data.value;\n\t\t\t\tupdateWorkingColor(event, colorProperties);\n\t\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleHueChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tupdateWorkingColor(event, { hue: event.target.value });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleHexInputChange = useCallback(\n\t\t(event: React.SyntheticEvent, data: InputChangeData) => {\n\t\t\tconst newCurrentColor = data.value;\n\t\t\tconst namedColorHex = ColorUtils.getHexFromNamedColor(newCurrentColor);\n\t\t\tlet isValid = false;\n\n\t\t\tif (events.onValidateColor) {\n\t\t\t\tisValid = events.onValidateColor(newCurrentColor);\n\t\t\t} else {\n\t\t\t\tisValid = namedColorHex ? true : ColorUtils.isValidHex(newCurrentColor);\n\t\t\t}\n\n\t\t\tsetCurrentColor(newCurrentColor);\n\t\t\tsetWorkingColor(\n\t\t\t\tColorUtils.getNewColor(\n\t\t\t\t\t{\n\t\t\t\t\t\thex: namedColorHex || newCurrentColor,\n\t\t\t\t\t\tname: namedColorHex ? newCurrentColor.toLowerCase() : null,\n\t\t\t\t\t} as { hex: string; name?: string | null },\n\t\t\t\t\tevents.onValidateWorkingColor\n\t\t\t\t) as WorkingColor\n\t\t\t);\n\t\t\tsetColorErrorMessage(isValid ? '' : labels.invalidColor || '');\n\n\t\t\tif (events.onChange) {\n\t\t\t\tevents.onChange(event, {\n\t\t\t\t\tcolor: newCurrentColor,\n\t\t\t\t\tisValid,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[events, labels.invalidColor]\n\t);\n\n\tconst handleNavigate = useCallback(\n\t\t(property: 'saturation' | 'value') =>\n\t\t\t(event: React.KeyboardEvent, data: { delta: number }) => {\n\t\t\t\tconst colorProperties: Record<string, number> = {};\n\t\t\t\tcolorProperties[property] = data.delta;\n\t\t\t\tconst newColor = ColorUtils.getDeltaColor(\n\t\t\t\t\tcolorProperties,\n\t\t\t\t\tevents.onValidateWorkingColor,\n\t\t\t\t\tworkingColor\n\t\t\t\t) as WorkingColor;\n\t\t\t\tsetPreviousWorkingColor(workingColor);\n\t\t\t\tsetWorkingColor(newColor);\n\n\t\t\t\tif (events.onWorkingColorChange) {\n\t\t\t\t\tevents.onWorkingColorChange(event, { color: newColor });\n\t\t\t\t}\n\t\t\t},\n\t\t[events, workingColor]\n\t);\n\n\tconst handleSaturationValueChange = useCallback(\n\t\t(\n\t\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\t\tdata: { saturation: number; value: number }\n\t\t) => {\n\t\t\tupdateWorkingColor(event, {\n\t\t\t\tsaturation: data.saturation,\n\t\t\t\tvalue: data.value,\n\t\t\t});\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleSubmitButtonClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tsetIsOpen(false);\n\t\t\tsetCurrentColor(workingColor.hex);\n\t\t\tsetColorErrorMessage('');\n\n\t\t\tif (events.onChange) {\n\t\t\t\tevents.onChange(event, {\n\t\t\t\t\tcolor: workingColor.hex,\n\t\t\t\t\tisValid: true,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[events, workingColor.hex]\n\t);\n\n\tconst handleSwatchButtonClick = useCallback(() => {\n\t\tconst newWorkingColor = ColorUtils.getNewColor(\n\t\t\t{ hex: workingColor.hex },\n\t\t\tevents.onValidateWorkingColor\n\t\t) as WorkingColor;\n\t\tsetIsOpen((prev) => !prev);\n\t\tsetWorkingColor(newWorkingColor);\n\n\t\tif (onRequestOpen) {\n\t\t\tonRequestOpen();\n\t\t}\n\t}, [events.onValidateWorkingColor, onRequestOpen, workingColor.hex]);\n\n\tconst handleSwatchSelect = useCallback(\n\t\t(event: React.MouseEvent | React.KeyboardEvent, data: { hex: string }) => {\n\t\t\tupdateWorkingColor(event, { hex: data.hex });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\t// Render helpers\n\tconst renderInput = () => {\n\t\tif (hideInput) return null;\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\taria-describedby={\n\t\t\t\t\t!isOpen && colorErrorMessage\n\t\t\t\t\t\t? `color-picker-summary-error-${componentId}`\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-color-picker__summary-input',\n\t\t\t\t\t'slds-align-top',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-has-error': !!colorErrorMessage,\n\t\t\t\t\t}\n\t\t\t\t)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tid={`color-picker-summary-input-${componentId}`}\n\t\t\t\tonChange={handleHexInputChange}\n\t\t\t\tvalue={currentColor}\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderDefaultTab = () => {\n\t\tif (variant !== 'base' && variant !== 'swatches') return null;\n\n\t\treturn (\n\t\t\t<TabsPanel label={labels.swatchTab ?? ''}>\n\t\t\t\t<SwatchPicker\n\t\t\t\t\tcolor={workingColor}\n\t\t\t\t\tlabels={labels}\n\t\t\t\t\tonSelect={handleSwatchSelect}\n\t\t\t\t\tswatchColors={swatchColors}\n\t\t\t\t/>\n\t\t\t</TabsPanel>\n\t\t);\n\t};\n\n\tconst renderCustomTab = () => {\n\t\tif (variant !== 'base' && variant !== 'custom') return null;\n\n\t\treturn (\n\t\t\t<TabsPanel label={labels.customTab ?? ''}>\n\t\t\t\t<CustomColor\n\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\tid={componentId}\n\t\t\t\t\tcolor={workingColor}\n\t\t\t\t\terrorTextWorkingColor={errorTextWorkingColor}\n\t\t\t\t\tpreviousColor={previousWorkingColor}\n\t\t\t\t\tlabels={labels}\n\t\t\t\t\tonBlueChange={handleColorChange('blue')}\n\t\t\t\t\tonGreenChange={handleColorChange('green')}\n\t\t\t\t\tonHexChange={handleColorChange('hex')}\n\t\t\t\t\tonHueChange={handleHueChange}\n\t\t\t\t\tonRedChange={handleColorChange('red')}\n\t\t\t\t\tonSwatchChange={handleSwatchChange}\n\t\t\t\t\tonSaturationValueChange={handleSaturationValueChange}\n\t\t\t\t\tonSaturationNavigate={handleNavigate('saturation')}\n\t\t\t\t\tonValueNavigate={handleNavigate('value')}\n\t\t\t\t/>\n\t\t\t</TabsPanel>\n\t\t);\n\t};\n\n\tconst popoverBody = (\n\t\t<Tabs\n\t\t\tid={`color-picker-tabs-${componentId}`}\n\t\t\tdefaultSelectedIndex={defaultSelectedTab === 'custom' ? 1 : 0}\n\t\t>\n\t\t\t{renderDefaultTab()}\n\t\t\t{renderCustomTab()}\n\t\t</Tabs>\n\t);\n\n\tconst popoverFooter = (\n\t\t<div className=\"slds-color-picker__selector-footer\">\n\t\t\t<Button\n\t\t\t\tclassName=\"slds-color-picker__selector-cancel\"\n\t\t\t\tid={`color-picker-footer-cancel-${componentId}`}\n\t\t\t\tlabel={labels.cancelButton}\n\t\t\t\tonClick={handleCancel}\n\t\t\t\tvariant=\"neutral\"\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tclassName=\"slds-color-picker__selector-submit\"\n\t\t\t\tdisabled={Object.keys(workingColor.errors || {}).length > 0}\n\t\t\t\tid={`color-picker-footer-submit-${componentId}`}\n\t\t\t\tlabel={labels.submitButton}\n\t\t\t\tonClick={handleSubmitButtonClick}\n\t\t\t\tvariant=\"brand\"\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('slds-color-picker', className)}\n\t\t\tref={wrapperRef}\n\t\t>\n\t\t\t<div className=\"slds-color-picker__summary\">\n\t\t\t\t<label\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-color-picker__summary-label',\n\t\t\t\t\t\tassistiveText.label ? 'slds-assistive-text' : ''\n\t\t\t\t\t)}\n\t\t\t\t\thtmlFor={\n\t\t\t\t\t\t!hideInput ? `color-picker-summary-input-${componentId}` : undefined\n\t\t\t\t\t}\n\t\t\t\t\tid={`color-picker-label-${componentId}`}\n\t\t\t\t>\n\t\t\t\t\t{assistiveText.label ? assistiveText.label : labels.label}\n\t\t\t\t</label>\n\t\t\t\t<Popover\n\t\t\t\t\tariaLabelledby={`color-picker-label-${componentId}`}\n\t\t\t\t\talign=\"bottom left\"\n\t\t\t\t\tbody={popoverBody}\n\t\t\t\t\tclassName={classNames('slds-color-picker__selector', classNameMenu)}\n\t\t\t\t\tfooter={popoverFooter}\n\t\t\t\t\thasNoCloseButton\n\t\t\t\t\thasNoNubbin\n\t\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\t\tid={`slds-color-picker__selector-${componentId}`}\n\t\t\t\t\tisOpen={isOpen}\n\t\t\t\t\tonClose={\n\t\t\t\t\t\tonClose as unknown as\n\t\t\t\t\t\t\t| ((\n\t\t\t\t\t\t\t\t\tevent?: unknown,\n\t\t\t\t\t\t\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t\t\t\t\t\t ) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tonOpen={\n\t\t\t\t\t\tonOpen as unknown as\n\t\t\t\t\t\t\t| ((event?: unknown, data?: { portal?: HTMLElement }) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tonRequestClose={\n\t\t\t\t\t\thandleOnRequestClose as unknown as\n\t\t\t\t\t\t\t| ((event?: unknown, data?: { trigger?: string }) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tposition={menuPosition}\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"slds-color-picker__summary-button\"\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\ticonClassName=\"slds-m-left_xx-small\"\n\t\t\t\t\t\ticonPosition=\"right\"\n\t\t\t\t\t\ticonVariant=\"more\"\n\t\t\t\t\t\tid={`slds-color-picker__summary-button-${componentId}`}\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t\t\t{assistiveText.label ? assistiveText.label : labels.label}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<Swatch color={currentColor} labels={labels} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={handleSwatchButtonClick}\n\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t/>\n\t\t\t\t</Popover>\n\t\t\t\t{renderInput()}\n\t\t\t\t{!isOpen && colorErrorMessage && (\n\t\t\t\t\t<p\n\t\t\t\t\t\tclassName=\"slds-form-error\"\n\t\t\t\t\t\tid={`color-picker-summary-error-${componentId}`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{colorErrorMessage}\n\t\t\t\t\t</p>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nColorPicker.displayName = COLOR_PICKER;\n\nexport default ColorPicker;\n"],"mappings":";;;;;;;;;;;;;;;;AAgHA,IAAM,IAAmC;CACxC,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,mCAAmC;CACnC,4BAA4B;CAC5B,kBAAkB;CAClB,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,gBAAgB;CAChB,cAAc;CACd,WAAW;CACX,4BAA4B;AAC7B,GAEM,KAAiD;CACtD,qBACC;CACD,WAAW;AACZ,GAEM,KAAsB,4PA8B5B,GAQM,KAA2C,EAChD,eAAe,GACf,cACA,kBACA,IAAI,GACJ,cAAW,IACX,WAAW,GACX,0BACA,YAAS,CAAC,GACV,uBACA,eAAY,IACZ,QAAQ,GACR,QAAQ,GACR,kBAAe,YACf,kBAAe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D,KAAK;EAEL,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACC,kBAAC,SAAD;KACC,WAAW,EACV,oCACA,EAAc,QAAQ,wBAAwB,EAC/C;KACA,SACE,IAA0D,KAAA,IAA9C,8BAA8B;KAE5C,IAAI,sBAAsB;KAEzB,UAAA,EAAc,QAAQ,EAAc,QAAQ,EAAO;IAC9C,CAAA;IACP,kBAAC,IAAD;KACC,gBAAgB,sBAAsB;KACtC,OAAM;KACN,MAAM;KACN,WAAW,EAAW,+BAA+B,CAAa;KAClE,QAAQ;KACR,kBAAA;KACA,aAAA;KACoB;KACpB,IAAI,+BAA+B;KAC3B;KAEP;KAQA;KAID,gBACC;KAID,UAAU;KAEV,UAAA,kBAAC,GAAD;MACC,WAAU;MACA;MACV,eAAc;MACd,cAAa;MACb,aAAY;MACZ,IAAI,qCAAqC;MACzC,OACC,kBAAC,OAAD,EAAA,UAAA,CACC,kBAAC,QAAD;OAAM,WAAU;OACd,UAAA,EAAc,QAAQ,EAAc,QAAQ,EAAO;MAC/C,CAAA,GACN,kBAAC,IAAD;OAAQ,OAAO;OAAsB;MAAS,CAAA,CAC1C,EAAA,CAAA;MAEN,SAAS;MACT,SAAQ;KACR,CAAA;IACO,CAAA;IACR,GAAY;IACZ,CAAC,KAAU,KACX,kBAAC,KAAD;KACC,WAAU;KACV,IAAI,8BAA8B;KAEjC,UAAA;IACC,CAAA;GAEA;;CACD,CAAA;AAEP;AAEA,EAAY,cAAc"}
|
|
1
|
+
{"version":3,"file":"color-picker.js","names":[],"sources":["../../../../components/color-picker/color-picker.tsx"],"sourcesContent":["/* eslint-disable max-lines */\nimport React, {\n\tuseState,\n\tuseCallback,\n\tuseRef,\n\tuseEffect,\n\tuseMemo,\n} from 'react';\nimport classNames from 'classnames';\n\nimport checkProps from './check-props';\n\nimport CustomColor from './private/custom-color';\nimport Swatch from './private/swatch';\nimport SwatchPicker from './private/swatch-picker';\n\nimport Button from '../button';\nimport Input, { type InputChangeData } from '../input';\nimport Tabs from '../tabs';\nimport TabsPanel from '../tabs/panel';\nimport Popover from '../popover';\n\nimport ColorUtils from '../../utilities/color';\nimport { COLOR_PICKER } from '../../utilities/constants';\nimport generateId from '../../utilities/generate-id';\n\nimport {\n\tWorkingColor,\n\tColorPickerAssistiveText,\n\tColorPickerLabels,\n\tColorPickerEvents,\n} from './types';\n\ninterface ColorPickerBaseProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ColorPickerAssistiveText;\n\t/** CSS classes for the color-picker container */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS classes for the popover menu */\n\tclassNameMenu?: string | string[] | Record<string, boolean>;\n\t/** Unique ID for the component */\n\tid?: string;\n\t/** Disables the input and button */\n\tdisabled?: boolean;\n\t/** Error message for the outer input */\n\terrorText?: string;\n\t/** Error message for the custom tab working color input */\n\terrorTextWorkingColor?: string;\n\t/** Event callbacks */\n\tevents?: ColorPickerEvents;\n\t/** Disable flip behavior for popover alignment */\n\thasStaticAlignment?: boolean;\n\t/** Hides the text input */\n\thideInput?: boolean;\n\t/** Controlled popover open state */\n\tisOpen?: boolean;\n\t/** Text labels for internationalization */\n\tlabels?: ColorPickerLabels;\n\t/** Popover position strategy */\n\tmenuPosition?: 'absolute' | 'overflowBoundaryElement' | 'relative';\n\t/** Current color in hexadecimal string */\n\tvalue?: string;\n\t/** Current working color in hexadecimal string */\n\tvalueWorking?: string;\n\t/** Callback when popover closes */\n\tonClose?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { trigger?: string; componentWillUnmount?: boolean }\n\t) => void;\n\t/** Callback when popover opens */\n\tonOpen?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { portal?: HTMLElement }\n\t) => void;\n\t/** Callback when user requests close */\n\tonRequestClose?: (\n\t\tevent: React.SyntheticEvent,\n\t\tdata: { trigger: string }\n\t) => void;\n\t/** Callback when popover requests to open */\n\tonRequestOpen?: () => void;\n}\n\n/**\n * `variant` sets which tabs are present. `swatchColors` needs the swatch tab\n * and `defaultSelectedTab` only applies when both tabs are present.\n */\nexport type ColorPickerVariantProps =\n\t| {\n\t\t\t/** Both the swatch and custom tabs */\n\t\t\tvariant?: 'base';\n\t\t\t/** Array of hex color values for swatch options */\n\t\t\tswatchColors?: string[];\n\t\t\t/** Which tab is visible when dialog opens */\n\t\t\tdefaultSelectedTab?: 'swatches' | 'custom';\n\t }\n\t| {\n\t\t\t/** Only the swatch tab */\n\t\t\tvariant: 'swatches';\n\t\t\t/** Array of hex color values for swatch options */\n\t\t\tswatchColors?: string[];\n\t\t\tdefaultSelectedTab?: never;\n\t }\n\t| {\n\t\t\t/** Only the custom tab */\n\t\t\tvariant: 'custom';\n\t\t\tswatchColors?: never;\n\t\t\tdefaultSelectedTab?: never;\n\t };\n\nexport type ColorPickerProps = ColorPickerBaseProps & ColorPickerVariantProps;\n\nconst defaultLabels: ColorPickerLabels = {\n\tblueAbbreviated: 'B',\n\tcancelButton: 'Cancel',\n\tcustomTab: 'Custom',\n\tcustomTabActiveWorkingColorSwatch: 'Working Color',\n\tcustomTabTransparentSwatch: 'Transparent Swatch',\n\tgreenAbbreviated: 'G',\n\thexLabel: 'Hex',\n\tinvalidColor: 'The color entered is invalid',\n\tinvalidComponent: 'The value needs to be an integer from 0-255',\n\tredAbbreviated: 'R',\n\tsubmitButton: 'Done',\n\tswatchTab: 'Default',\n\tswatchTabTransparentSwatch: 'Transparent Swatch',\n};\n\nconst defaultAssistiveText: ColorPickerAssistiveText = {\n\tsaturationValueGrid:\n\t\t'Use arrow keys to select a saturation and brightness, on an x and y axis.',\n\thueSlider: 'Select Hue',\n};\n\nconst defaultSwatchColors = [\n\t'#e3abec',\n\t'#c2dbf7',\n\t'#9fd6ff',\n\t'#9de7da',\n\t'#9df0c0',\n\t'#fff099',\n\t'#fed49a',\n\t'#d073e0',\n\t'#86baf3',\n\t'#5ebbff',\n\t'#44d8be',\n\t'#3be282',\n\t'#ffe654',\n\t'#ffb758',\n\t'#bd35bd',\n\t'#5779c1',\n\t'#5679c0',\n\t'#00aea9',\n\t'#3cba4c',\n\t'#f5bc25',\n\t'#f99221',\n\t'#580d8c',\n\t'#001970',\n\t'#0a2399',\n\t'#0b7477',\n\t'#0b6b50',\n\t'#b67e11',\n\t'#b85d0d',\n\t'',\n];\n\n/**\n * The Unified Color Picker component allows for a fully accessible and\n * configurable color picker, allowing the user to pick from a set of\n * predefined colors (swatches), or to pick a custom color using a HSB\n * selection interface.\n */\nconst ColorPicker: React.FC<ColorPickerProps> = ({\n\tassistiveText: assistiveTextProp,\n\tclassName,\n\tclassNameMenu,\n\tid: idProp,\n\tdisabled = false,\n\terrorText: errorTextProp,\n\terrorTextWorkingColor,\n\tevents = {},\n\thasStaticAlignment,\n\thideInput = false,\n\tisOpen: isOpenProp,\n\tlabels: labelsProp,\n\tmenuPosition = 'absolute',\n\tswatchColors = defaultSwatchColors,\n\tdefaultSelectedTab = 'swatches',\n\tvariant = 'base',\n\tvalue: valueProp,\n\tvalueWorking: valueWorkingProp,\n\tonClose,\n\tonOpen,\n\tonRequestClose,\n\tonRequestOpen,\n}) => {\n\t// Merge labels and assistive text with defaults\n\tconst labels = useMemo(\n\t\t() => ({ ...defaultLabels, ...labelsProp }),\n\t\t[labelsProp]\n\t);\n\tconst assistiveText = useMemo(\n\t\t() => ({ ...defaultAssistiveText, ...assistiveTextProp }),\n\t\t[assistiveTextProp]\n\t);\n\n\t// Generate stable ID\n\tconst generatedId = useRef(idProp || generateId());\n\tconst componentId = idProp || generatedId.current;\n\n\t// Refs\n\tconst wrapperRef = useRef<HTMLDivElement>(null);\n\n\t// Initialize working color from props\n\tconst getInitialWorkingColor = useCallback((): WorkingColor => {\n\t\treturn ColorUtils.getNewColor(\n\t\t\t{ hex: valueWorkingProp || valueProp },\n\t\t\tevents.onValidateWorkingColor\n\t\t) as WorkingColor;\n\t}, [valueWorkingProp, valueProp, events.onValidateWorkingColor]);\n\n\t// State\n\tconst [currentColor, setCurrentColor] = useState<string>(\n\t\tvalueProp != null ? valueProp : ''\n\t);\n\tconst [isOpen, setIsOpen] = useState<boolean>(isOpenProp || false);\n\tconst [workingColor, setWorkingColor] = useState<WorkingColor>(\n\t\tgetInitialWorkingColor\n\t);\n\tconst [previousWorkingColor, setPreviousWorkingColor] =\n\t\tuseState<WorkingColor>(getInitialWorkingColor);\n\tconst [colorErrorMessage, setColorErrorMessage] = useState<string>(\n\t\terrorTextProp || ''\n\t);\n\n\t// Check props on mount (development only)\n\tuseEffect(() => {\n\t\t// checkProps is a no-op in production\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(checkProps as any)(\n\t\t\tCOLOR_PICKER,\n\t\t\t{\n\t\t\t\tassistiveText: assistiveTextProp,\n\t\t\t\tclassName,\n\t\t\t\tclassNameMenu,\n\t\t\t\tid: idProp,\n\t\t\t\tdisabled,\n\t\t\t\terrorText: errorTextProp,\n\t\t\t\terrorTextWorkingColor,\n\t\t\t\tevents,\n\t\t\t\thasStaticAlignment,\n\t\t\t\thideInput,\n\t\t\t\tisOpen: isOpenProp,\n\t\t\t\tlabels: labelsProp,\n\t\t\t\tmenuPosition,\n\t\t\t\tswatchColors,\n\t\t\t\tdefaultSelectedTab,\n\t\t\t\tvariant,\n\t\t\t\tvalue: valueProp,\n\t\t\t\tvalueWorking: valueWorkingProp,\n\t\t\t},\n\t\t\t{}\n\t\t);\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\t// Sync props to state when they change externally\n\tuseEffect(() => {\n\t\tif (valueProp !== undefined) {\n\t\t\tsetCurrentColor(valueProp);\n\t\t}\n\t}, [valueProp]);\n\n\tuseEffect(() => {\n\t\tif (valueWorkingProp !== undefined) {\n\t\t\tsetWorkingColor(\n\t\t\t\tColorUtils.getNewColor(\n\t\t\t\t\t{ hex: valueWorkingProp },\n\t\t\t\t\tevents.onValidateWorkingColor\n\t\t\t\t) as WorkingColor\n\t\t\t);\n\t\t}\n\t}, [valueWorkingProp, events.onValidateWorkingColor]);\n\n\tuseEffect(() => {\n\t\tif (isOpenProp !== undefined) {\n\t\t\tsetIsOpen(isOpenProp);\n\t\t}\n\t}, [isOpenProp]);\n\n\t// Helper to update working color\n\tconst updateWorkingColor = useCallback(\n\t\t(\n\t\t\tevent: React.SyntheticEvent,\n\t\t\tcolorOptions: {\n\t\t\t\thex?: string;\n\t\t\t\tred?: string | number;\n\t\t\t\tgreen?: string | number;\n\t\t\t\tblue?: string | number;\n\t\t\t\thue?: number | string;\n\t\t\t\tsaturation?: number;\n\t\t\t\tvalue?: number;\n\t\t\t}\n\t\t) => {\n\t\t\tconst newColor = ColorUtils.getNewColor(\n\t\t\t\tcolorOptions,\n\t\t\t\tevents.onValidateWorkingColor,\n\t\t\t\tworkingColor\n\t\t\t) as WorkingColor;\n\t\t\tsetPreviousWorkingColor(workingColor);\n\t\t\tsetWorkingColor(newColor);\n\n\t\t\tif (events.onWorkingColorChange) {\n\t\t\t\tevents.onWorkingColorChange(event, { color: newColor });\n\t\t\t}\n\t\t},\n\t\t[events, workingColor]\n\t);\n\n\t// Event handlers\n\tconst handleSwatchChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tupdateWorkingColor(event, { hex: event.target.value });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleCancelState = useCallback(() => {\n\t\tconst resetColor = ColorUtils.getNewColor(\n\t\t\t{ hex: currentColor },\n\t\t\tevents.onValidateWorkingColor\n\t\t) as WorkingColor;\n\t\tsetIsOpen(false);\n\t\tsetWorkingColor(resetColor);\n\t\tsetPreviousWorkingColor(resetColor);\n\t}, [currentColor, events.onValidateWorkingColor]);\n\n\tconst handleOnRequestClose = useCallback(\n\t\t(event: React.SyntheticEvent, data: { trigger: string }) => {\n\t\t\tif (data.trigger === 'clickOutside' || data.trigger === 'cancel') {\n\t\t\t\thandleCancelState();\n\t\t\t}\n\n\t\t\tif (onRequestClose) {\n\t\t\t\tonRequestClose(event, data);\n\t\t\t}\n\t\t},\n\t\t[handleCancelState, onRequestClose]\n\t);\n\n\tconst handleCancel = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\thandleCancelState();\n\n\t\t\tif (onRequestClose) {\n\t\t\t\tonRequestClose(event, { trigger: 'cancel' });\n\t\t\t}\n\t\t},\n\t\t[handleCancelState, onRequestClose]\n\t);\n\n\tconst handleColorChange = useCallback(\n\t\t(property: 'hex' | 'red' | 'green' | 'blue') =>\n\t\t\t(event: React.SyntheticEvent, data: InputChangeData) => {\n\t\t\t\tconst colorProperties: Record<string, string | number> = {};\n\t\t\t\tcolorProperties[property] = data.value;\n\t\t\t\tupdateWorkingColor(event, colorProperties);\n\t\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleHueChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement>) => {\n\t\t\tupdateWorkingColor(event, { hue: event.target.value });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleHexInputChange = useCallback(\n\t\t(event: React.SyntheticEvent, data: InputChangeData) => {\n\t\t\tconst newCurrentColor = data.value;\n\t\t\tconst namedColorHex = ColorUtils.getHexFromNamedColor(newCurrentColor);\n\t\t\tlet isValid = false;\n\n\t\t\tif (events.onValidateColor) {\n\t\t\t\tisValid = events.onValidateColor(newCurrentColor);\n\t\t\t} else {\n\t\t\t\tisValid = namedColorHex ? true : ColorUtils.isValidHex(newCurrentColor);\n\t\t\t}\n\n\t\t\tsetCurrentColor(newCurrentColor);\n\t\t\tsetWorkingColor(\n\t\t\t\tColorUtils.getNewColor(\n\t\t\t\t\t{\n\t\t\t\t\t\thex: namedColorHex || newCurrentColor,\n\t\t\t\t\t\tname: namedColorHex ? newCurrentColor.toLowerCase() : null,\n\t\t\t\t\t} as { hex: string; name?: string | null },\n\t\t\t\t\tevents.onValidateWorkingColor\n\t\t\t\t) as WorkingColor\n\t\t\t);\n\t\t\tsetColorErrorMessage(isValid ? '' : labels.invalidColor || '');\n\n\t\t\tif (events.onChange) {\n\t\t\t\tevents.onChange(event, {\n\t\t\t\t\tcolor: newCurrentColor,\n\t\t\t\t\tisValid,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[events, labels.invalidColor]\n\t);\n\n\tconst handleNavigate = useCallback(\n\t\t(property: 'saturation' | 'value') =>\n\t\t\t(event: React.KeyboardEvent, data: { delta: number }) => {\n\t\t\t\tconst colorProperties: Record<string, number> = {};\n\t\t\t\tcolorProperties[property] = data.delta;\n\t\t\t\tconst newColor = ColorUtils.getDeltaColor(\n\t\t\t\t\tcolorProperties,\n\t\t\t\t\tevents.onValidateWorkingColor,\n\t\t\t\t\tworkingColor\n\t\t\t\t) as WorkingColor;\n\t\t\t\tsetPreviousWorkingColor(workingColor);\n\t\t\t\tsetWorkingColor(newColor);\n\n\t\t\t\tif (events.onWorkingColorChange) {\n\t\t\t\t\tevents.onWorkingColorChange(event, { color: newColor });\n\t\t\t\t}\n\t\t\t},\n\t\t[events, workingColor]\n\t);\n\n\tconst handleSaturationValueChange = useCallback(\n\t\t(\n\t\t\tevent: React.MouseEvent | React.KeyboardEvent,\n\t\t\tdata: { saturation: number; value: number }\n\t\t) => {\n\t\t\tupdateWorkingColor(event, {\n\t\t\t\tsaturation: data.saturation,\n\t\t\t\tvalue: data.value,\n\t\t\t});\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\tconst handleSubmitButtonClick = useCallback(\n\t\t(event: React.MouseEvent) => {\n\t\t\tsetIsOpen(false);\n\t\t\tsetCurrentColor(workingColor.hex);\n\t\t\tsetColorErrorMessage('');\n\n\t\t\tif (events.onChange) {\n\t\t\t\tevents.onChange(event, {\n\t\t\t\t\tcolor: workingColor.hex,\n\t\t\t\t\tisValid: true,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[events, workingColor.hex]\n\t);\n\n\tconst handleSwatchButtonClick = useCallback(() => {\n\t\tconst newWorkingColor = ColorUtils.getNewColor(\n\t\t\t{ hex: workingColor.hex },\n\t\t\tevents.onValidateWorkingColor\n\t\t) as WorkingColor;\n\t\tsetIsOpen((prev) => !prev);\n\t\tsetWorkingColor(newWorkingColor);\n\n\t\tif (onRequestOpen) {\n\t\t\tonRequestOpen();\n\t\t}\n\t}, [events.onValidateWorkingColor, onRequestOpen, workingColor.hex]);\n\n\tconst handleSwatchSelect = useCallback(\n\t\t(event: React.MouseEvent | React.KeyboardEvent, data: { hex: string }) => {\n\t\t\tupdateWorkingColor(event, { hex: data.hex });\n\t\t},\n\t\t[updateWorkingColor]\n\t);\n\n\t// Render helpers\n\tconst renderInput = () => {\n\t\tif (hideInput) return null;\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\taria-describedby={\n\t\t\t\t\t!isOpen && colorErrorMessage\n\t\t\t\t\t\t? `color-picker-summary-error-${componentId}`\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-color-picker__summary-input',\n\t\t\t\t\t'slds-align-top',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-has-error': !!colorErrorMessage,\n\t\t\t\t\t}\n\t\t\t\t)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tid={`color-picker-summary-input-${componentId}`}\n\t\t\t\tonChange={handleHexInputChange}\n\t\t\t\tvalue={currentColor}\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderDefaultTab = () => {\n\t\tif (variant !== 'base' && variant !== 'swatches') return null;\n\n\t\treturn (\n\t\t\t<TabsPanel label={labels.swatchTab ?? ''}>\n\t\t\t\t<SwatchPicker\n\t\t\t\t\tcolor={workingColor}\n\t\t\t\t\tlabels={labels}\n\t\t\t\t\tonSelect={handleSwatchSelect}\n\t\t\t\t\tswatchColors={swatchColors}\n\t\t\t\t/>\n\t\t\t</TabsPanel>\n\t\t);\n\t};\n\n\tconst renderCustomTab = () => {\n\t\tif (variant !== 'base' && variant !== 'custom') return null;\n\n\t\treturn (\n\t\t\t<TabsPanel label={labels.customTab ?? ''}>\n\t\t\t\t<CustomColor\n\t\t\t\t\tassistiveText={assistiveText}\n\t\t\t\t\tid={componentId}\n\t\t\t\t\tcolor={workingColor}\n\t\t\t\t\terrorTextWorkingColor={errorTextWorkingColor}\n\t\t\t\t\tpreviousColor={previousWorkingColor}\n\t\t\t\t\tlabels={labels}\n\t\t\t\t\tonBlueChange={handleColorChange('blue')}\n\t\t\t\t\tonGreenChange={handleColorChange('green')}\n\t\t\t\t\tonHexChange={handleColorChange('hex')}\n\t\t\t\t\tonHueChange={handleHueChange}\n\t\t\t\t\tonRedChange={handleColorChange('red')}\n\t\t\t\t\tonSwatchChange={handleSwatchChange}\n\t\t\t\t\tonSaturationValueChange={handleSaturationValueChange}\n\t\t\t\t\tonSaturationNavigate={handleNavigate('saturation')}\n\t\t\t\t\tonValueNavigate={handleNavigate('value')}\n\t\t\t\t/>\n\t\t\t</TabsPanel>\n\t\t);\n\t};\n\n\tconst popoverBody = (\n\t\t<Tabs\n\t\t\tid={`color-picker-tabs-${componentId}`}\n\t\t\tdefaultSelectedIndex={defaultSelectedTab === 'custom' ? 1 : 0}\n\t\t>\n\t\t\t{renderDefaultTab()}\n\t\t\t{renderCustomTab()}\n\t\t</Tabs>\n\t);\n\n\tconst popoverFooter = (\n\t\t<div className=\"slds-color-picker__selector-footer\">\n\t\t\t<Button\n\t\t\t\tclassName=\"slds-color-picker__selector-cancel\"\n\t\t\t\tid={`color-picker-footer-cancel-${componentId}`}\n\t\t\t\tlabel={labels.cancelButton}\n\t\t\t\tonClick={handleCancel}\n\t\t\t\tvariant=\"neutral\"\n\t\t\t/>\n\t\t\t<Button\n\t\t\t\tclassName=\"slds-color-picker__selector-submit\"\n\t\t\t\tdisabled={Object.keys(workingColor.errors || {}).length > 0}\n\t\t\t\tid={`color-picker-footer-submit-${componentId}`}\n\t\t\t\tlabel={labels.submitButton}\n\t\t\t\tonClick={handleSubmitButtonClick}\n\t\t\t\tvariant=\"brand\"\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames('slds-color-picker', className)}\n\t\t\tref={wrapperRef}\n\t\t>\n\t\t\t<div className=\"slds-color-picker__summary\">\n\t\t\t\t<label\n\t\t\t\t\tclassName={classNames(\n\t\t\t\t\t\t'slds-color-picker__summary-label',\n\t\t\t\t\t\tassistiveText.label ? 'slds-assistive-text' : ''\n\t\t\t\t\t)}\n\t\t\t\t\thtmlFor={\n\t\t\t\t\t\t!hideInput ? `color-picker-summary-input-${componentId}` : undefined\n\t\t\t\t\t}\n\t\t\t\t\tid={`color-picker-label-${componentId}`}\n\t\t\t\t>\n\t\t\t\t\t{assistiveText.label ? assistiveText.label : labels.label}\n\t\t\t\t</label>\n\t\t\t\t<Popover\n\t\t\t\t\tariaLabelledby={`color-picker-label-${componentId}`}\n\t\t\t\t\talign=\"bottom left\"\n\t\t\t\t\tbody={popoverBody}\n\t\t\t\t\tclassNameDialog={classNames(\n\t\t\t\t\t\t'slds-color-picker__selector',\n\t\t\t\t\t\tclassNameMenu\n\t\t\t\t\t)}\n\t\t\t\t\tfooter={popoverFooter}\n\t\t\t\t\thasNoCloseButton\n\t\t\t\t\thasNoNubbin\n\t\t\t\t\thasStaticAlignment={hasStaticAlignment}\n\t\t\t\t\tid={`slds-color-picker__selector-${componentId}`}\n\t\t\t\t\tisOpen={isOpen}\n\t\t\t\t\tonClose={\n\t\t\t\t\t\tonClose as unknown as\n\t\t\t\t\t\t\t| ((\n\t\t\t\t\t\t\t\t\tevent?: unknown,\n\t\t\t\t\t\t\t\t\tdata?: { componentWillUnmount?: boolean }\n\t\t\t\t\t\t\t ) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tonOpen={\n\t\t\t\t\t\tonOpen as unknown as\n\t\t\t\t\t\t\t| ((event?: unknown, data?: { portal?: HTMLElement }) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tonRequestClose={\n\t\t\t\t\t\thandleOnRequestClose as unknown as\n\t\t\t\t\t\t\t| ((event?: unknown, data?: { trigger?: string }) => void)\n\t\t\t\t\t\t\t| undefined\n\t\t\t\t\t}\n\t\t\t\t\tposition={menuPosition}\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"slds-color-picker__summary-button\"\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\ticonClassName=\"slds-m-left_xx-small\"\n\t\t\t\t\t\ticonPosition=\"right\"\n\t\t\t\t\t\ticonVariant=\"more\"\n\t\t\t\t\t\tid={`slds-color-picker__summary-button-${componentId}`}\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t\t\t{assistiveText.label ? assistiveText.label : labels.label}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<Swatch color={currentColor} labels={labels} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={handleSwatchButtonClick}\n\t\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t\t/>\n\t\t\t\t</Popover>\n\t\t\t\t{renderInput()}\n\t\t\t\t{!isOpen && colorErrorMessage && (\n\t\t\t\t\t<p\n\t\t\t\t\t\tclassName=\"slds-form-error\"\n\t\t\t\t\t\tid={`color-picker-summary-error-${componentId}`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{colorErrorMessage}\n\t\t\t\t\t</p>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nColorPicker.displayName = COLOR_PICKER;\n\nexport default ColorPicker;\n"],"mappings":";;;;;;;;;;;;;;;;AAgHA,IAAM,IAAmC;CACxC,iBAAiB;CACjB,cAAc;CACd,WAAW;CACX,mCAAmC;CACnC,4BAA4B;CAC5B,kBAAkB;CAClB,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,gBAAgB;CAChB,cAAc;CACd,WAAW;CACX,4BAA4B;AAC7B,GAEM,KAAiD;CAC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AU;GACV,UAAU,OAAO,KAAK,EAAa,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;GAC1D,IAAI,8BAA8B;GAClC,OAAO,EAAO;GACd,SAAS;GACT,SAAQ;EACR,CAAA,CACG;;CAGN,OACC,kBAAC,OAAD;EACC,WAAW,EAAW,qBAAqB,CAAS;EACpD,KAAK;EAEL,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA;IACC,kBAAC,SAAD;KACC,WAAW,EACV,oCACA,EAAc,QAAQ,wBAAwB,EAC/C;KACA,SACE,IAA0D,KAAA,IAA9C,8BAA8B;KAE5C,IAAI,sBAAsB;KAEzB,UAAA,EAAc,QAAQ,EAAc,QAAQ,EAAO;IAC9C,CAAA;IACP,kBAAC,IAAD;KACC,gBAAgB,sBAAsB;KACtC,OAAM;KACN,MAAM;KACN,iBAAiB,EAChB,+BACA,CACD;KACA,QAAQ;KACR,kBAAA;KACA,aAAA;KACoB;KACpB,IAAI,+BAA+B;KAC3B;KAEP;KAQA;KAID,gBACC;KAID,UAAU;KAEV,UAAA,kBAAC,GAAD;MACC,WAAU;MACA;MACV,eAAc;MACd,cAAa;MACb,aAAY;MACZ,IAAI,qCAAqC;MACzC,OACC,kBAAC,OAAD,EAAA,UAAA,CACC,kBAAC,QAAD;OAAM,WAAU;OACd,UAAA,EAAc,QAAQ,EAAc,QAAQ,EAAO;MAC/C,CAAA,GACN,kBAAC,IAAD;OAAQ,OAAO;OAAsB;MAAS,CAAA,CAC1C,EAAA,CAAA;MAEN,SAAS;MACT,SAAQ;KACR,CAAA;IACO,CAAA;IACR,GAAY;IACZ,CAAC,KAAU,KACX,kBAAC,KAAD;KACC,WAAU;KACV,IAAI,8BAA8B;KAEjC,UAAA;IACC,CAAA;GAEA;;CACD,CAAA;AAEP;AAEA,EAAY,cAAc"}
|
|
@@ -339,9 +339,9 @@ var m, be = typeof document < "u", xe = Symbol("actionItem"), Se = (e) => xe in
|
|
|
339
339
|
ariaLabelledby: `${j()}-label`,
|
|
340
340
|
align: "bottom",
|
|
341
341
|
body: t,
|
|
342
|
-
|
|
342
|
+
classNameDialog: "slds-popover_full-width",
|
|
343
343
|
footer: n,
|
|
344
|
-
|
|
344
|
+
classNameFooter: "slds-popover__footer_form",
|
|
345
345
|
hasNoNubbin: !0,
|
|
346
346
|
id: j(),
|
|
347
347
|
isOpen: H,
|