UNPKG

@adobe/coral-spectrum

Version:

Coral Spectrum is a JavaScript library of Web Components following Spectrum design patterns.

1,021 lines 3.52 MB
[ { "__docId__": 1, "kind": "external", "name": "Infinity", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Infinity", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 2, "kind": "external", "name": "NaN", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~NaN", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 3, "kind": "external", "name": "undefined", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~undefined", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 4, "kind": "external", "name": "null", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~null", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 5, "kind": "external", "name": "Object", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Object", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 6, "kind": "external", "name": "object", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~object", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 7, "kind": "external", "name": "Function", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Function", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 8, "kind": "external", "name": "function", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~function", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 9, "kind": "external", "name": "Boolean", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Boolean", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 10, "kind": "external", "name": "boolean", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~boolean", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 11, "kind": "external", "name": "Symbol", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Symbol", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 12, "kind": "external", "name": "Error", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Error", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 13, "kind": "external", "name": "EvalError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~EvalError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 14, "kind": "external", "name": "InternalError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~InternalError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 15, "kind": "external", "name": "RangeError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~RangeError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 16, "kind": "external", "name": "ReferenceError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~ReferenceError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 17, "kind": "external", "name": "SyntaxError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~SyntaxError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 18, "kind": "external", "name": "TypeError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~TypeError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 19, "kind": "external", "name": "URIError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~URIError", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 20, "kind": "external", "name": "Number", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Number", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 21, "kind": "external", "name": "number", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~number", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 22, "kind": "external", "name": "Date", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Date", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 23, "kind": "external", "name": "String", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~String", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 24, "kind": "external", "name": "string", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~string", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 25, "kind": "external", "name": "RegExp", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~RegExp", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 26, "kind": "external", "name": "Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 27, "kind": "external", "name": "Int8Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Int8Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 28, "kind": "external", "name": "Uint8Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Uint8Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 29, "kind": "external", "name": "Uint8ClampedArray", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Uint8ClampedArray", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 30, "kind": "external", "name": "Int16Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Int16Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 31, "kind": "external", "name": "Uint16Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Uint16Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 32, "kind": "external", "name": "Int32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Int32Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 33, "kind": "external", "name": "Uint32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Uint32Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 34, "kind": "external", "name": "Float32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Float32Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 35, "kind": "external", "name": "Float64Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Float64Array", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 36, "kind": "external", "name": "Map", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Map", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 37, "kind": "external", "name": "Set", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Set", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 38, "kind": "external", "name": "WeakMap", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~WeakMap", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 39, "kind": "external", "name": "WeakSet", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~WeakSet", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 40, "kind": "external", "name": "ArrayBuffer", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~ArrayBuffer", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 41, "kind": "external", "name": "DataView", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~DataView", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 42, "kind": "external", "name": "JSON", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~JSON", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 43, "kind": "external", "name": "Promise", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Promise", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 44, "kind": "external", "name": "Generator", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Generator", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 45, "kind": "external", "name": "GeneratorFunction", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~GeneratorFunction", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 46, "kind": "external", "name": "Reflect", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Reflect", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 47, "kind": "external", "name": "Proxy", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~Proxy", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 48, "kind": "external", "name": "CustomEvent", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/CustomEvent", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~CustomEvent", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 49, "kind": "external", "name": "HTMLElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 50, "kind": "external", "name": "HTMLAnchorElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLAnchorElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLAnchorElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 51, "kind": "external", "name": "HTMLButtonElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLButtonElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLButtonElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 52, "kind": "external", "name": "HTMLTableElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLTableElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLTableElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 53, "kind": "external", "name": "HTMLTableSectionElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLTableSectionElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLTableSectionElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 54, "kind": "external", "name": "HTMLTableCellElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLTableCellElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLTableCellElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 55, "kind": "external", "name": "HTMLTableRowElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLTableRowElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLTableRowElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 56, "kind": "external", "name": "HTMLTableColElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLTableColElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLTableColElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 57, "kind": "external", "name": "HTMLTextAreaElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLTextAreaElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLTextAreaElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 58, "kind": "external", "name": "HTMLInputElement", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/HTMLInputElement", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~HTMLInputElement", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 59, "kind": "external", "name": "momentJS", "externalLink": "https://momentjs.com/", "memberof": "coral-spectrum/.external-ecmascript.js", "static": true, "longname": "coral-spectrum/.external-ecmascript.js~momentJS", "access": "public", "description": "", "builtinExternal": true }, { "__docId__": 60, "kind": "file", "name": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js", "content": "/**\n * Copyright 2019 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {BaseLabellable} from '../../../coral-base-labellable';\nimport {Icon} from '../../../coral-component-icon';\nimport {transform, validate, commons} from '../../../coral-utils';\n\n/**\n Enumeration for {@link Button}, {@link AnchorButton} icon sizes.\n\n @typedef {Object} ButtonIconSizeEnum\n\n @property {String} EXTRA_EXTRA_SMALL\n Extra extra small size icon, typically 9px size.\n @property {String} EXTRA_SMALL\n Extra small size icon, typically 12px size.\n @property {String} SMALL\n Small size icon, typically 18px size. This is the default size.\n @property {String} MEDIUM\n Medium size icon, typically 24px size.\n */\nconst iconSize = {};\nconst excludedIconSizes = [Icon.size.LARGE, Icon.size.EXTRA_LARGE, Icon.size.EXTRA_EXTRA_LARGE];\nfor (const key in Icon.size) {\n // Populate button icon sizes by excluding the largest icon sizes\n if (excludedIconSizes.indexOf(Icon.size[key]) === -1) {\n iconSize[key] = Icon.size[key];\n }\n}\n\n/**\n Enumeration for {@link Button}, {@link AnchorButton} variants.\n\n @typedef {Object} ButtonVariantEnum\n\n @property {String} CTA\n A button that is meant to grab the user's attention.\n @property {String} PRIMARY\n A button that is meant to grab the user's attention.\n @property {String} QUIET\n A quiet button that indicates that the button's action is the primary action.\n @property {String} SECONDARY\n A button that indicates that the button's action is the secondary action.\n @property {String} QUIET_SECONDARY\n A quiet secondary button.\n @property {String} ACTION\n An action button.\n @property {String} QUIET_ACTION\n A quiet action button.\n @property {String} MINIMAL\n A quiet minimalistic button.\n @property {String} WARNING\n A button that indicates that the button's action is dangerous.\n @property {String} QUIET_WARNING\n A quiet warning button,\n @property {String} OVER_BACKGROUND\n A button to be placed on top of colored background.\n @property {String} DEFAULT\n The default button look and feel.\n */\nconst variant = {\n CTA: 'cta',\n PRIMARY: 'primary',\n SECONDARY: 'secondary',\n QUIET: 'quiet',\n MINIMAL: 'minimal',\n WARNING: 'warning',\n ACTION: 'action',\n QUIET_ACTION: 'quietaction',\n QUIET_SECONDARY: 'quietsecondary',\n QUIET_WARNING: 'quietwarning',\n OVER_BACKGROUND: 'overbackground',\n DEFAULT: 'default',\n // Private to be used for custom Button classes like field buttons\n _CUSTOM: '_custom'\n};\n\n// the button's base classname\nconst CLASSNAME = '_coral-Button';\nconst ACTION_CLASSNAME = '_coral-ActionButton';\n\nconst ALL_VARIANT_CLASSES = [\n `${CLASSNAME}--cta`,\n `${CLASSNAME}--primary`,\n `${CLASSNAME}--secondary`,\n `${CLASSNAME}--warning`,\n `${CLASSNAME}--quiet`,\n `${ACTION_CLASSNAME}--quiet`,\n `${CLASSNAME}--overBackground`,\n];\n\nconst VARIANT_MAP = {\n cta: [CLASSNAME, ALL_VARIANT_CLASSES[0]],\n primary: [CLASSNAME, ALL_VARIANT_CLASSES[0]],\n secondary: [CLASSNAME, ALL_VARIANT_CLASSES[2]],\n warning: [CLASSNAME, ALL_VARIANT_CLASSES[3]],\n quiet: [CLASSNAME, ALL_VARIANT_CLASSES[1], ALL_VARIANT_CLASSES[4]],\n minimal: [CLASSNAME, ALL_VARIANT_CLASSES[2], ALL_VARIANT_CLASSES[4]],\n default: [CLASSNAME, ALL_VARIANT_CLASSES[1]],\n action: [ACTION_CLASSNAME],\n quietaction: [ACTION_CLASSNAME, ALL_VARIANT_CLASSES[5]],\n quietsecondary: [CLASSNAME, ALL_VARIANT_CLASSES[2], ALL_VARIANT_CLASSES[4]],\n quietwarning: [CLASSNAME, ALL_VARIANT_CLASSES[3], ALL_VARIANT_CLASSES[4]],\n overbackground: [CLASSNAME, ALL_VARIANT_CLASSES[6]]\n};\n\n/**\n Enumeration for {@link BaseButton} sizes.\n\n @typedef {Object} ButtonSizeEnum\n\n @property {String} MEDIUM\n A medium button is the default, normal sized button.\n @property {String} LARGE\n Not supported. Falls back to MEDIUM.\n */\nconst size = {\n MEDIUM: 'M',\n LARGE: 'L'\n};\n\n/**\n Enumeration for {@link BaseButton} icon position options.\n\n @typedef {Object} ButtonIconPositionEnum\n\n @property {String} RIGHT\n Position should be right of the button label.\n @property {String} LEFT\n Position should be left of the button label.\n */\nconst iconPosition = {\n RIGHT: 'right',\n LEFT: 'left'\n};\n\n/**\n @base BaseButton\n @classdesc The base element for Button components\n */\nconst BaseButton = (superClass) => class extends BaseLabellable(superClass) {\n /** @ignore */\n constructor() {\n super();\n\n // Templates\n this._elements = {\n // Create or fetch the label element\n label: this.querySelector(this._contentZoneTagName) || document.createElement(this._contentZoneTagName),\n icon: this.querySelector('coral-icon')\n };\n\n // Events\n this._events = {\n mousedown: '_onMouseDown',\n click: '_onClick'\n };\n\n super._observeLabel();\n }\n\n /**\n The label of the button.\n @type {HTMLElement}\n @contentzone\n */\n get label() {\n return this._getContentZone(this._elements.label);\n }\n\n set label(value) {\n this._setContentZone('label', value, {\n handle: 'label',\n tagName: this._contentZoneTagName,\n insert: function (label) {\n // Update label styles\n this._updateLabel(label);\n\n // Ensure there's no extra space left for icon only buttons\n if (label.innerHTML.trim() === '') {\n label.textContent = '';\n }\n\n if (this.iconPosition === iconPosition.LEFT) {\n this.appendChild(label);\n } else {\n this.insertBefore(label, this.firstChild);\n }\n }\n });\n }\n\n /**\n Position of the icon relative to the label. If no <code>iconPosition</code> is provided, it will be set on the\n left side by default.\n See {@link ButtonIconPositionEnum}.\n\n @type {String}\n @default ButtonIconPositionEnum.LEFT\n @htmlattribute iconposition\n @htmlattributereflected\n */\n get iconPosition() {\n return this._iconPosition || iconPosition.LEFT;\n }\n\n set iconPosition(value) {\n value = transform.string(value).toLowerCase();\n value = validate.enumeration(iconPosition)(value) && value || iconPosition.LEFT;\n \n this._reflectAttribute('iconposition', value);\n\n if(validate.valueMustChange(this._iconPosition, value)) {\n this._iconPosition = value;\n this._updateIcon(this.icon);\n }\n }\n\n /**\n Specifies the icon name used inside the button. See {@link Icon} for valid icon names.\n\n @type {String}\n @default \"\"\n @htmlattribute icon\n */\n get icon() {\n if (this._elements.icon) {\n return this._elements.icon.getAttribute('icon') || '';\n }\n\n return this._icon || '';\n }\n\n set icon(value) {\n value = transform.string(value);\n if(validate.valueMustChange(this._icon, value)) {\n this._icon = value;\n this._updateIcon(value);\n }\n }\n\n /**\n Size of the icon. It accepts both lower and upper case sizes. See {@link ButtonIconSizeEnum}.\n\n @type {String}\n @default ButtonIconSizeEnum.SMALL\n @htmlattribute iconsize\n */\n get iconSize() {\n if (this._elements.icon) {\n return this._elements.icon.getAttribute('size') || Icon.size.SMALL;\n }\n\n return this._iconSize || Icon.size.SMALL;\n }\n\n set iconSize(value) {\n value = transform.string(value).toUpperCase();\n value = validate.enumeration(Icon.size)(value) && value || Icon.size.SMALL;\n\n if(validate.valueMustChange(this._iconSize, value)) {\n this._iconSize = value;\n this._updatedIcon && this._getIconElement().setAttribute('size', value);\n }\n }\n\n /**\n Whether aria-label is set automatically. See {@link IconAutoAriaLabelEnum}.\n\n @type {String}\n @default IconAutoAriaLabelEnum.OFF\n @htmlattribute autoarialabel\n */\n get iconAutoAriaLabel() {\n if (this._elements.icon) {\n return this._elements.icon.getAttribute('autoarialabel') || Icon.autoAriaLabel.OFF;\n }\n\n return this._iconAutoAriaLabel || Icon.autoAriaLabel.OFF;\n }\n\n set iconAutoAriaLabel(value) {\n value = transform.string(value).toLowerCase();\n value = validate.enumeration(Icon.autoAriaLabel)(value) && value || Icon.autoAriaLabel.OFF;\n\n if(validate.valueMustChange(this._iconAutoAriaLabel, value)) {\n this._iconAutoAriaLabel = value;\n this._updatedIcon && this._getIconElement().setAttribute('autoarialabel', value);\n }\n }\n\n /**\n The size of the button. It accepts both lower and upper case sizes. See {@link ButtonSizeEnum}.\n Currently only \"MEDIUM\" is supported.\n\n @type {String}\n @default ButtonSizeEnum.MEDIUM\n @htmlattribute size\n @htmlattributereflected\n */\n get size() {\n return this._size || size.MEDIUM;\n }\n\n set size(value) {\n value = transform.string(value).toUpperCase();\n this._size = validate.enumeration(size)(value) && value || size.MEDIUM;\n \n this._reflectAttribute('size', this._size);\n }\n\n /**\n Whether the button is selected.\n\n @type {Boolean}\n @default false\n @htmlattribute selected\n @htmlattributereflected\n */\n get selected() {\n return this._selected || false;\n }\n\n set selected(value) {\n value = transform.booleanAttr(value);\n \n this._reflectAttribute('selected', value);\n\n if(validate.valueMustChange(this._selected, value)) {\n this._selected = value;\n\n this.classList.toggle('is-selected', value);\n \n this.trigger('coral-button:_selectedchanged');\n }\n }\n\n // We just reflect it but we also trigger an event to be used by button group\n /** @ignore */\n get value() {\n return this.getAttribute('value');\n }\n\n set value(value) {\n this._reflectAttribute('value', value);\n\n this.trigger('coral-button:_valuechanged');\n }\n\n /**\n Expands the button to the full width of the parent.\n\n @type {Boolean}\n @default false\n @htmlattribute block\n @htmlattributereflected\n */\n get block() {\n return this._block || false;\n }\n\n set block(value) {\n value = transform.booleanAttr(value);\n \n this._reflectAttribute('block', value);\n\n if(validate.valueMustChange(this._block, value)) {\n this._block = value;\n\n this.classList.toggle(`${CLASSNAME}--block`, value);\n }\n }\n\n /**\n The button's variant. See {@link ButtonVariantEnum}.\n\n @type {String}\n @default ButtonVariantEnum.DEFAULT\n @htmlattribute variant\n @htmlattributereflected\n */\n get variant() {\n return this._variant || variant.DEFAULT;\n }\n\n set variant(value) {\n value = transform.string(value).toLowerCase();\n value = validate.enumeration(variant)(value) && value || variant.DEFAULT;\n\n this._reflectAttribute('variant', value);\n\n if(validate.valueMustChange(this._variant , value)) {\n this._variant = value;\n\n // removes every existing variant\n this.classList.remove(CLASSNAME, ACTION_CLASSNAME);\n this.classList.remove(...ALL_VARIANT_CLASSES);\n \n if (value === variant._CUSTOM) {\n this.classList.remove(CLASSNAME);\n } else {\n this.classList.add(...VARIANT_MAP[value]);\n \n if (value === variant.ACTION || value === variant.QUIET_ACTION) {\n this.classList.remove(CLASSNAME);\n }\n }\n \n // Update label styles\n this._updateLabel();\n }\n }\n\n /**\n Inherited from {@link BaseComponent#trackingElement}.\n */\n get trackingElement() {\n return typeof this._trackingElement === 'undefined' ?\n // keep spaces to only 1 max and trim. this mimics native html behaviors\n (this.label || this).textContent.replace(/\\s{2,}/g, ' ').trim() || this.icon :\n this._trackingElement;\n }\n\n set trackingElement(value) {\n super.trackingElement = value;\n }\n\n _onClick(event) {\n if (!this.disabled) {\n this._trackEvent('click', this.getAttribute('is'), event);\n }\n }\n\n /** @ignore */\n _updateIcon(value) {\n if (!this._updatedIcon && this._elements.icon) {\n return;\n }\n\n this._updatedIcon = true;\n\n const iconSizeValue = this.iconSize;\n const iconAutoAriaLabelValue = this.iconAutoAriaLabel;\n const iconElement = this._getIconElement();\n iconElement.icon = value;\n // Update size as well\n iconElement.size = iconSizeValue;\n // Update autoAriaLabel as well\n iconElement.autoAriaLabel = iconAutoAriaLabelValue;\n\n // removes the icon element from the DOM.\n if (this.icon === '') {\n iconElement.remove();\n }\n // add or adjust the icon. Add it back since it was blown away by textContent\n else if (!iconElement.parentNode || this._iconPosition) {\n if (this.contains(this.label)) {\n // insertBefore with <code>null</code> appends\n this.insertBefore(iconElement, this.iconPosition === iconPosition.LEFT ? this.label : this.label.nextElementSibling);\n }\n }\n\n super._toggleIconAriaHidden();\n }\n\n /** @ignore */\n _getIconElement() {\n if (!this._elements.icon) {\n this._elements.icon = new Icon();\n this._elements.icon.size = this.iconSize;\n }\n return this._elements.icon;\n }\n\n /**\n Forces button to receive focus on mousedown\n @param {MouseEvent} event mousedown event\n @ignore\n */\n _onMouseDown(event) {\n const target = event.matchedTarget;\n\n // Wait a frame or button won't receive focus in Safari.\n window.requestAnimationFrame(() => {\n if (target !== document.activeElement) {\n target.focus();\n }\n });\n }\n\n _updateLabel(label) {\n label = label || this._elements.label;\n\n label.classList.remove(`${CLASSNAME}-label`, `${ACTION_CLASSNAME}-label`);\n\n if (this._variant !== variant._CUSTOM) {\n if (this._variant === variant.ACTION || this._variant === variant.QUIET_ACTION) {\n label.classList.add(`${ACTION_CLASSNAME}-label`);\n } else {\n label.classList.add(`${CLASSNAME}-label`);\n }\n }\n }\n\n /** @private */\n get _contentZoneTagName() {\n return Object.keys(this._contentZones)[0];\n }\n\n get _contentZones() {\n return {'coral-button-label': 'label'};\n }\n\n /**\n Returns {@link BaseButton} sizes.\n\n @return {ButtonSizeEnum}\n */\n static get size() {\n return size;\n }\n\n /**\n Returns {@link BaseButton} variants.\n\n @return {ButtonVariantEnum}\n */\n static get variant() {\n return variant;\n }\n\n /**\n Returns {@link BaseButton} icon positions.\n\n @return {ButtonIconPositionEnum}\n */\n static get iconPosition() {\n return iconPosition;\n }\n\n /**\n Returns {@link BaseButton} icon sizes.\n\n @return {ButtonIconSizeEnum}\n */\n static get iconSize() {\n return iconSize;\n }\n\n static get _attributePropertyMap() {\n return commons.extend(super._attributePropertyMap, {\n iconposition: 'iconPosition',\n iconsize: 'iconSize',\n iconautoarialabel: 'iconAutoAriaLabel'\n });\n }\n\n /** @ignore */\n static get observedAttributes() {\n return super.observedAttributes.concat([\n 'iconposition',\n 'iconsize',\n 'icon',\n 'iconautoarialabel',\n 'size',\n 'selected',\n 'block',\n 'variant',\n 'value'\n ]);\n }\n\n /** @ignore */\n render() {\n super.render();\n\n // Default reflected attributes\n if (!this._variant) {\n this.variant = variant.DEFAULT;\n }\n if (!this._size) {\n this.size = size.MEDIUM;\n }\n\n // Create a fragment\n const fragment = document.createDocumentFragment();\n\n const label = this._elements.label;\n\n const contentZoneProvided = label.parentNode;\n\n // Remove it so we can process children\n if (contentZoneProvided) {\n this.removeChild(label);\n }\n\n let iconAdded = false;\n // Process remaining elements as necessary\n while (this.firstChild) {\n const child = this.firstChild;\n\n if (child.nodeName === 'CORAL-ICON') {\n // Don't add duplicated icons\n if (iconAdded) {\n this.removeChild(child);\n } else {\n // Conserve existing icon element to content\n this._elements.icon = child;\n fragment.appendChild(child);\n iconAdded = true;\n }\n }\n // Avoid content zone to be voracious\n else if (contentZoneProvided) {\n fragment.appendChild(child);\n } else {\n // Move anything else into the label\n label.appendChild(child);\n }\n }\n\n // Add the frag to the component\n this.appendChild(fragment);\n\n // Assign the content zones, moving them into place in the process\n this.label = label;\n\n // Make sure the icon is well positioned\n this._updatedIcon = true;\n this._updateIcon(this.icon);\n }\n\n /**\n Triggered when {@link BaseButton#selected} changed.\n\n @typedef {CustomEvent} coral-button:_selectedchanged\n\n @private\n */\n\n /**\n Triggered when {@link BaseButton#value} changed.\n\n @typedef {CustomEvent} coral-button:_valuechanged\n\n @private\n */\n};\n\nexport default BaseButton;\n", "static": true, "longname": "/home/runner/work/coral-spectrum/coral-spectrum/coral-base-button/src/scripts/BaseButton.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 61, "kind": "typedef", "name": "ButtonIconSizeEnum", "memberof": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js", "static": true, "longname": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js~ButtonIconSizeEnum", "access": "public", "description": "Enumeration for {@link Button}, {@link AnchorButton} icon sizes.", "lineNumber": 31, "properties": [ { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "EXTRA_EXTRA_SMALL", "description": "Extra extra small size icon, typically 9px size." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "EXTRA_SMALL", "description": "Extra small size icon, typically 12px size." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "SMALL", "description": "Small size icon, typically 18px size. This is the default size." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "MEDIUM", "description": "Medium size icon, typically 24px size." } ], "type": { "types": [ "Object" ], "optional": false, "name": "ButtonIconSizeEnum" } }, { "__docId__": 62, "kind": "variable", "name": "excludedIconSizes", "memberof": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js", "static": true, "longname": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js~excludedIconSizes", "access": "public", "export": false, "importPath": "@adobe/coral-spectrum", "importStyle": null, "description": null, "lineNumber": 32, "undocument": true, "type": { "types": [ "undefined[]" ] }, "ignore": true }, { "__docId__": 63, "kind": "typedef", "name": "ButtonVariantEnum", "memberof": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js", "static": true, "longname": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js~ButtonVariantEnum", "access": "public", "description": "Enumeration for {@link Button}, {@link AnchorButton} variants.", "lineNumber": 70, "properties": [ { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "CTA", "description": "A button that is meant to grab the user's attention." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "PRIMARY", "description": "A button that is meant to grab the user's attention." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "QUIET", "description": "A quiet button that indicates that the button's action is the primary action." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "SECONDARY", "description": "A button that indicates that the button's action is the secondary action." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "QUIET_SECONDARY", "description": "A quiet secondary button." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "ACTION", "description": "An action button." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "QUIET_ACTION", "description": "A quiet action button." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "MINIMAL", "description": "A quiet minimalistic button." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "WARNING", "description": "A button that indicates that the button's action is dangerous." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "QUIET_WARNING", "description": "A quiet warning button," }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "OVER_BACKGROUND", "description": "A button to be placed on top of colored background." }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": false, "name": "DEFAULT", "description": "The default button look and feel." } ], "type": { "types": [ "Object" ], "optional": false, "name": "ButtonVariantEnum" } }, { "__docId__": 64, "kind": "variable", "name": "CLASSNAME", "memberof": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js", "static": true, "longname": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js~CLASSNAME", "access": "public", "export": false, "importPath": "@adobe/coral-spectrum", "importStyle": null, "description": null, "lineNumber": 88, "undocument": true, "type": { "types": [ "string" ] }, "ignore": true }, { "__docId__": 65, "kind": "variable", "name": "ACTION_CLASSNAME", "memberof": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js", "static": true, "longname": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js~ACTION_CLASSNAME", "access": "public", "export": false, "importPath": "@adobe/coral-spectrum", "importStyle": null, "description": null, "lineNumber": 89, "undocument": true, "type": { "types": [ "string" ] }, "ignore": true }, { "__docId__": 66, "kind": "variable", "name": "ALL_VARIANT_CLASSES", "memberof": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js", "static": true, "longname": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js~ALL_VARIANT_CLASSES", "access": "public", "export": false, "importPath": "@adobe/coral-spectrum", "importStyle": null, "description": null, "lineNumber": 91, "undocument": true, "type": { "types": [ "undefined[]" ] }, "ignore": true }, { "__docId__": 67, "kind": "variable", "name": "VARIANT_MAP", "memberof": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js", "static": true, "longname": "coral-spectrum/coral-base-button/src/scripts/BaseButton.js~VARIANT_MAP", "access": "public", "export": false, "importPath": "@adobe/coral-spectrum", "importStyle": null, "description": null, "lineNumber": 101, "undocument": true, "type": { "types": [ "{\"cta\": *, \"primary\": *, \"secondary\": *, \"warning\": *, \"quiet\": *, \"minimal\": *, \"default\": *, \"action\": *, \"qui