@gov-design-system-ce/components 4.0.8-rc17 → 4.0.8-rc19
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/core.cjs.js +1 -1
- package/dist/cjs/gov-form-checkbox.cjs.entry.js +5 -4
- package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-control.cjs.entry.js +1 -37
- package/dist/cjs/gov-form-control.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-file.cjs.entry.js +7 -6
- package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-input.cjs.entry.js +11 -9
- package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-multi-select.cjs.entry.js +7 -7
- package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-radio.cjs.entry.js +5 -4
- package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-select.cjs.entry.js +10 -7
- package/dist/cjs/gov-form-select.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-switch.cjs.entry.js +2 -1
- package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-icon.cjs.entry.js +1 -1
- package/dist/cjs/gov-tile.cjs.entry.js +1 -1
- package/dist/cjs/gov-tile.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js +5 -4
- package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js.map +1 -1
- package/dist/collection/components/gov-form/control/gov-form-control.js +5 -64
- package/dist/collection/components/gov-form/control/gov-form-control.js.map +1 -1
- package/dist/collection/components/gov-form/file/gov-form-file.js +7 -6
- package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
- package/dist/collection/components/gov-form/input/gov-form-input.js +16 -14
- package/dist/collection/components/gov-form/input/gov-form-input.js.map +1 -1
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +7 -7
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
- package/dist/collection/components/gov-form/radio/gov-form-radio.js +5 -4
- package/dist/collection/components/gov-form/radio/gov-form-radio.js.map +1 -1
- package/dist/collection/components/gov-form/select/gov-form-select.js +12 -7
- package/dist/collection/components/gov-form/select/gov-form-select.js.map +1 -1
- package/dist/collection/components/gov-form/switch/gov-form-switch.js +2 -1
- package/dist/collection/components/gov-form/switch/gov-form-switch.js.map +1 -1
- package/dist/collection/components/gov-tile/gov-tile.js +1 -1
- package/dist/collection/components/gov-tile/gov-tile.js.map +1 -1
- package/dist/collection/pages/Forms.js +12 -12
- package/dist/collection/pages/Forms.js.map +1 -1
- package/dist/components/gov-accordion-item.js +1 -1
- package/dist/components/gov-attachments-item.js +1 -1
- package/dist/components/gov-breadcrumbs.js +1 -1
- package/dist/components/gov-button.js +1 -1
- package/dist/components/gov-card.js +1 -1
- package/dist/components/gov-chip.js +1 -1
- package/dist/components/gov-form-autocomplete.js +1 -1
- package/dist/components/gov-form-checkbox.js +1 -1
- package/dist/components/gov-form-checkbox.js.map +1 -1
- package/dist/components/gov-form-control.js +1 -1
- package/dist/components/gov-form-control.js.map +1 -1
- package/dist/components/gov-form-file.js +1 -1
- package/dist/components/gov-form-file.js.map +1 -1
- package/dist/components/gov-form-input.js +1 -1
- package/dist/components/gov-form-multi-select.js +1 -1
- package/dist/components/gov-form-multi-select.js.map +1 -1
- package/dist/components/gov-form-radio.js +1 -1
- package/dist/components/gov-form-radio.js.map +1 -1
- package/dist/components/gov-form-select.js +1 -1
- package/dist/components/gov-form-switch.js +1 -1
- package/dist/components/gov-form-switch.js.map +1 -1
- package/dist/components/gov-icon.js +1 -1
- package/dist/components/gov-infobar.js +1 -1
- package/dist/components/gov-loading.js +1 -1
- package/dist/components/gov-modal.js +1 -1
- package/dist/components/gov-pagination.js +1 -1
- package/dist/components/gov-prompt.js +1 -1
- package/dist/components/gov-side-nav-item.js +1 -1
- package/dist/components/gov-tabs.js +1 -1
- package/dist/components/gov-tabs.js.map +1 -1
- package/dist/components/gov-tag.js +1 -1
- package/dist/components/gov-tile.js +1 -1
- package/dist/components/gov-tile.js.map +1 -1
- package/dist/components/gov-toast.js +1 -1
- package/dist/components/gov-tooltip-content.js +1 -1
- package/dist/components/gov-wizard-item.js +1 -1
- package/dist/components/{p-8ac22724.js → p-37b342d0.js} +2 -2
- package/dist/components/p-37b342d0.js.map +1 -0
- package/dist/components/{p-57bc98b3.js → p-410e296d.js} +2 -2
- package/dist/components/{p-fd554fb4.js → p-4f694d25.js} +2 -2
- package/dist/components/{p-3248435d.js → p-5ee68c72.js} +2 -2
- package/dist/components/p-5ee68c72.js.map +1 -0
- package/dist/components/{p-483d079f.js → p-701f03e1.js} +2 -2
- package/dist/components/{p-e35fdedd.js → p-ab0ea373.js} +2 -2
- package/dist/components/{p-44c731a0.js → p-eefec75b.js} +2 -2
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/{p-a87d8f17.entry.js → p-2cdb5670.entry.js} +3 -2
- package/dist/core/p-2cdb5670.entry.js.map +1 -0
- package/dist/core/{p-4c83f443.entry.js → p-2e07619e.entry.js} +2 -2
- package/dist/core/{p-4c83f443.entry.js.map → p-2e07619e.entry.js.map} +1 -1
- package/dist/core/{p-14e5fd00.entry.js → p-396ae350.entry.js} +2 -2
- package/dist/core/p-396ae350.entry.js.map +1 -0
- package/dist/core/{p-065b396a.entry.js → p-3c0058a4.entry.js} +2 -2
- package/dist/core/p-3c0058a4.entry.js.map +1 -0
- package/dist/core/{p-98e89c46.entry.js → p-4b88cdf6.entry.js} +2 -2
- package/dist/core/{p-bc2ec133.entry.js → p-5f3721be.entry.js} +2 -2
- package/dist/core/p-5f3721be.entry.js.map +1 -0
- package/dist/core/p-6110119c.entry.js +2 -0
- package/dist/core/p-6110119c.entry.js.map +1 -0
- package/dist/core/{p-afb86442.entry.js → p-6be9b50d.entry.js} +3 -2
- package/dist/core/p-6be9b50d.entry.js.map +1 -0
- package/dist/core/{p-d0446df9.entry.js → p-74627eb2.entry.js} +2 -2
- package/dist/core/p-74627eb2.entry.js.map +1 -0
- package/dist/core/{p-b18be1d6.entry.js → p-753e4861.entry.js} +3 -2
- package/dist/core/p-753e4861.entry.js.map +1 -0
- package/dist/core/{p-36312bef.entry.js → p-92f752e1.entry.js} +3 -2
- package/dist/core/p-92f752e1.entry.js.map +1 -0
- package/dist/core/{p-6092fd22.entry.js → p-aa91f33f.entry.js} +2 -2
- package/dist/core/p-aa91f33f.entry.js.map +1 -0
- package/dist/core/{p-c7e8faec.entry.js → p-ab2f6b4d.entry.js} +2 -2
- package/dist/core/{p-c7e8faec.entry.js.map → p-ab2f6b4d.entry.js.map} +1 -1
- package/dist/core/{p-0d99a3d8.entry.js → p-e102ae1d.entry.js} +2 -2
- package/dist/core/p-e102ae1d.entry.js.map +1 -0
- package/dist/core/{p-dbb67e76.entry.js → p-e21b402c.entry.js} +3 -2
- package/dist/core/p-e21b402c.entry.js.map +1 -0
- package/dist/core/{p-1d67220c.entry.js → p-f9e6f776.entry.js} +3 -2
- package/dist/core/p-f9e6f776.entry.js.map +1 -0
- package/dist/core/{p-dbad9256.entry.js → p-fc3d4a73.entry.js} +3 -2
- package/dist/core/p-fc3d4a73.entry.js.map +1 -0
- package/dist/esm/core.js +1 -1
- package/dist/esm/gov-form-checkbox.entry.js +5 -4
- package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
- package/dist/esm/gov-form-control.entry.js +2 -38
- package/dist/esm/gov-form-control.entry.js.map +1 -1
- package/dist/esm/gov-form-file.entry.js +7 -6
- package/dist/esm/gov-form-file.entry.js.map +1 -1
- package/dist/esm/gov-form-input.entry.js +11 -9
- package/dist/esm/gov-form-input.entry.js.map +1 -1
- package/dist/esm/gov-form-multi-select.entry.js +7 -7
- package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
- package/dist/esm/gov-form-radio.entry.js +5 -4
- package/dist/esm/gov-form-radio.entry.js.map +1 -1
- package/dist/esm/gov-form-select.entry.js +10 -7
- package/dist/esm/gov-form-select.entry.js.map +1 -1
- package/dist/esm/gov-form-switch.entry.js +2 -1
- package/dist/esm/gov-form-switch.entry.js.map +1 -1
- package/dist/esm/gov-icon.entry.js +1 -1
- package/dist/esm/gov-tile.entry.js +1 -1
- package/dist/esm/gov-tile.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/hydrate/index.js +54 -82
- package/dist/hydrate/index.mjs +54 -82
- package/dist/types/components/gov-form/checkbox/gov-form-checkbox.d.ts +1 -1
- package/dist/types/components/gov-form/control/gov-form-control.d.ts +3 -10
- package/dist/types/components/gov-form/file/gov-form-file.d.ts +1 -1
- package/dist/types/components/gov-form/input/gov-form-input.d.ts +1 -1
- package/dist/types/components/gov-form/multiselect/gov-form-multi-select.d.ts +1 -1
- package/dist/types/components/gov-form/radio/gov-form-radio.d.ts +1 -1
- package/dist/types/components/gov-form/select/gov-form-select.d.ts +1 -1
- package/dist/types/components.d.ts +6 -14
- package/package.json +1 -1
- package/dist/components/p-3248435d.js.map +0 -1
- package/dist/components/p-8ac22724.js.map +0 -1
- package/dist/core/p-065b396a.entry.js.map +0 -1
- package/dist/core/p-0d99a3d8.entry.js.map +0 -1
- package/dist/core/p-14e5fd00.entry.js.map +0 -1
- package/dist/core/p-1d67220c.entry.js.map +0 -1
- package/dist/core/p-36312bef.entry.js.map +0 -1
- package/dist/core/p-4b048e19.entry.js +0 -2
- package/dist/core/p-4b048e19.entry.js.map +0 -1
- package/dist/core/p-6092fd22.entry.js.map +0 -1
- package/dist/core/p-a87d8f17.entry.js.map +0 -1
- package/dist/core/p-afb86442.entry.js.map +0 -1
- package/dist/core/p-b18be1d6.entry.js.map +0 -1
- package/dist/core/p-bc2ec133.entry.js.map +0 -1
- package/dist/core/p-d0446df9.entry.js.map +0 -1
- package/dist/core/p-dbad9256.entry.js.map +0 -1
- package/dist/core/p-dbb67e76.entry.js.map +0 -1
- /package/dist/components/{p-57bc98b3.js.map → p-410e296d.js.map} +0 -0
- /package/dist/components/{p-fd554fb4.js.map → p-4f694d25.js.map} +0 -0
- /package/dist/components/{p-483d079f.js.map → p-701f03e1.js.map} +0 -0
- /package/dist/components/{p-e35fdedd.js.map → p-ab0ea373.js.map} +0 -0
- /package/dist/components/{p-44c731a0.js.map → p-eefec75b.js.map} +0 -0
- /package/dist/core/{p-98e89c46.entry.js.map → p-4b88cdf6.entry.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FormFileClass","root","area","label","input","list","item","attachments","formatBytes","bytes","units","l","n","parseInt","toFixed","fileAcceptValidation","file","accept","length","replace","split","filter","RegExp","test","type","fileSizeValidation","maxSize","fileSize","Math","round","size","govFormFileCss","GovFormFileStyle0","GovFormFile","constructor","hostRef","this","fileId","createID","h","govHost","host","f","govForm","watchControlAttrs","passControlAttrs","passAttrToControl","toBoolAttr","invalid","disabled","registerListeners","highlight","areaRef","classList","add","unhighlight","remove","inputRef","addEventListener","e","preventDefault","stopPropagation","files","target","resetAfterPick","validateFiles","expanded","events","inEvents","outEvents","map","eventName","preventDefaults","bind","forEach","handleDrop","dataTransfer","filesBuffer","Array","from","isFile","find","name","ignoreFileDuplicationCheck","isSizeValid","maxFileSize","isAcceptValid","newFile","id","acceptValid","sizeValid","displayAttachments","govAddFile","emit","component","govFiles","reset","finally","componentWillLoad","passAttrToLabel","String","required","componentDidRender","canValidateWcagOnRender","delay","validateWcag","render","Host","key","class","classes","toBoolAttrIfDefined","ref","el","identifier","multiple","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","wcagDescribedBy","wcagLabelledBy","hasSlot","wcagAttachmentsLabel","onRemoveFileHandler","wcagRemoveLabel","slot","variant","errorAccept","errorSize","index","findIndex","removeFile","splice","govRemoveFile","govFocus","originalEvent","govBlur","getRef","getAreaRef","value","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/components/gov-form/file/constants.ts","../../../packages/core/src/utils/file.utils.ts","../../../packages/core/src/components/gov-form/file/gov-form-file.scss?tag=gov-form-file","../../../packages/core/src/components/gov-form/file/gov-form-file.tsx"],"sourcesContent":["export const FormFileClass = {\n\troot: 'gov-form-file',\n\tarea: 'gov-form-file__area',\n\tlabel: 'gov-form-file__label',\n\tinput: 'gov-form-file__input',\n\tlist: 'gov-form-file__list',\n\titem: 'gov-form-file__item',\n\tattachments: 'gov-form-file__attachments',\n}\n","export function formatBytes(bytes: any): string {\n\tconst units = ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']\n\tlet l = 0,\n\t\tn = parseInt(bytes, 10) || 0\n\n\twhile (n >= 1024 && ++l) {\n\t\tn = n / 1024\n\t}\n\n\treturn n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]\n}\n\nexport function fileAcceptValidation(file: File, accept: string): boolean {\n\tif (typeof accept === 'string' && accept.length) {\n\t\treturn (\n\t\t\taccept\n\t\t\t\t.replace(/\\s/g, '')\n\t\t\t\t.split(',')\n\t\t\t\t.filter(accept => {\n\t\t\t\t\treturn new RegExp(accept.replace('*', '.*')).test(file.type)\n\t\t\t\t}).length > 0\n\t\t)\n\t} else {\n\t\treturn true\n\t}\n}\n\nexport function fileSizeValidation(file: File, maxSize: number): boolean {\n\tconst fileSize = Math.round(file.size)\n\treturn fileSize <= maxSize\n}\n","/*\n * File\n */\n\n$class: \".gov-form-file\";\n\n#{$class} {\n\t@include base();\n\t&__label .gov-form-label__label {\n\t\t@include reset-last-margin();\n\t}\n\t&__input {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\topacity: 0.0001;\n\t\tcursor: pointer;\n\t}\n\t&__attachments {\n\t\tmargin-top: rem-calc(16 0 0);\n\t}\n\t&__item {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\talign-items: center;\n\t}\n\n\t// STATES\n\t@include parameter(\"disabled\") {\n\t\t#{$class} {\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\tpointer-events: none;\n\t\t\t\t* {\n\t\t\t\t\tcolor: $form-file-disabled-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"expanded\") {\n\t\t#{$class} {\n\t\t\t&__area {\n\t\t\t\tposition: relative;\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(32) rem-calc(22) rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t\ttransition: background-color $t ease-in-out;\n\t\t\t\twill-change: background-color;\n\t\t\t\t&.highlight {\n\t\t\t\t\tbackground-color: color(\"primary.200\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t}\n\t\t\t&__attachments {\n\t\t\t\tmargin: rem-calc(24 0 0);\n\t\t\t}\n\t\t}\n\n\t\t// STATES\n\t\t@include parameter(\"invalid\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t\t}\n\t\t\t\t&__area {\n\t\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t@include parameter(\"disabled\") {\n\t\t\t#{$class} {\n\t\t\t\t&__area {\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t\tcolor: $form-file-disabled-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t@include parameter(\"expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tpadding: rem-calc(32);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {createID} from \"../../../utils/string.utils\"\nimport {FormFileClass} from \"./constants\"\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from \"../../../helpers/Dom/template\"\nimport {validateWcagLabelFor, validateWcagRef} from \"../../../helpers/Validate/wcag\"\nimport {canValidateWcagOnRender} from \"../../../helpers/Dom/win\"\nimport {fileAcceptValidation, fileSizeValidation, formatBytes} from \"../../../utils/file.utils\"\nimport {delay} from \"../../../utils/utils\"\nimport {GovForm} from \"../../../helpers/Dom/form.types\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {govForm} from \"../../../helpers/Dom/form\"\nimport {GovFormFileEvent, GovFormFileItem} from \"./gov-form-file.types\"\n\n@Component({\n\ttag: \"gov-form-file\",\n\tstyleUrl: \"gov-form-file.scss\",\n})\nexport class GovFormFile {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate areaRef?: HTMLDivElement\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly fileId: string\n\n\tconstructor() {\n\t\tthis.fileId = createID(\"GovInputFile\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormFileElement\n\t/**\n\t * Expands the file input to fill 100% of the container width.\n\t */\n\t@Prop() readonly expanded: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the File component disabled.\n\t * This prevents users from being able to interact with the File, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * After selecting the files, the main input element will be reset.\n\t * The propagation of the event with the selected files will not be affected.\n\t */\n\t@Prop({attribute: \"reset-after-pick\"}) readonly resetAfterPick: boolean = true\n\t/**\n\t * Selected files will not be checked for duplicates based on name and size.\n\t */\n\t@Prop({attribute: \"ignore-file-duplication-check\"}) readonly ignoreFileDuplicationCheck: boolean = false\n\t/**\n\t * Show list of attachments\n\t */\n\t@Prop({attribute: \"display-attachments\"}) readonly displayAttachments: boolean = true\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept\n\t */\n\t@Prop() readonly accept: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/multiple\n\t */\n\t@Prop() readonly multiple: boolean = false\n\t/**\n\t * Maximum embedded file size\n\t */\n\t@Prop({attribute: \"max-file-size\"}) readonly maxFileSize: number = -1\n\t/**\n\t * Custom File identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Error message when the maximum file size is exceeded\n\t */\n\t@Prop({attribute: \"error-size\"}) readonly errorSize: string = \"Soubor je větší než povolená velikost {FILE_SIZE}\"\n\t/**\n\t * Insert unsupported file error message\n\t */\n\t@Prop({attribute: \"error-accept\"}) readonly errorAccept: string = \"Soubor tohoto typu není povolen\"\n\t/**\n\t * Description of the list of attachments\n\t */\n\t@Prop({attribute: \"attachments-label\"}) readonly attachmentsLabel: string = \"Přílohy\"\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: \"wcag-described-by\"}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: \"wcag-labelled-by\"}) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the remove button that is only shown for screen readers.\n\t */\n\t@Prop({attribute: \"wcag-remove-label\"}) readonly wcagRemoveLabel: string = \"Odebrat soubor {FILE_NAME}\"\n\t/**\n\t * Adds accessible label for the list of attachments.\n\t */\n\t@Prop({attribute: \"wcag-attachments-label\"}) readonly wcagAttachmentsLabel: string = \"Přílohy\"\n\t/**\n\t * Emitted when the File has focus.\n\t */\n\t@Event({eventName: \"gov-focus\"}) govFocus: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Emitted when the File loses focus.\n\t */\n\t@Event({eventName: \"gov-blur\"}) govBlur: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when the list of inserted files is changed\n\t */\n\t@Event({eventName: \"gov-files\"}) govFiles: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a new file is added\n\t */\n\t@Event({eventName: \"gov-add-file\"}) govAddFile: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a file is removed from the list\n\t */\n\t@Event({eventName: \"gov-remove-file\"}) govRemoveFile: EventEmitter<GovFormFileEvent>\n\n\t@State() files: GovFormFileItem[] = []\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\twatchControlAttrs(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl(\"disabled\", toBoolAttr(this.disabled))\n\t}\n\n\n\tprivate registerListeners() {\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add(\"highlight\")\n\t\t}\n\n\t\tfunction unhighlight() {\n\t\t\tthis.areaRef.classList.remove(\"highlight\")\n\t\t}\n\n\t\tthis.inputRef.addEventListener(\n\t\t\t\"change\",\n\t\t\te => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tconst files = (e.target as HTMLInputElement).files\n\t\t\t\tif (this.resetAfterPick) {\n\t\t\t\t\tif (files.length) {\n\t\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t)\n\n\t\tif (this.expanded) {\n\t\t\tconst events = [\"dragover\", \"dragleave\"]\n\t\t\tconst inEvents = [\"dragenter\", \"dragover\", \"mouseenter\"]\n\t\t\tconst outEvents = [\"dragleave\", \"drop\", \"mouseleave\"]\n\n\t\t\tevents.map(eventName => this.inputRef.addEventListener(eventName, this.preventDefaults.bind(this), false))\n\t\t\tinEvents.map(eventName => this.inputRef.addEventListener(eventName, highlight.bind(this), false))\n\t\t\toutEvents.forEach(eventName => this.inputRef.addEventListener(eventName, unhighlight.bind(this), false))\n\n\t\t\tthis.areaRef.addEventListener(\"drop\", this.handleDrop.bind(this), false)\n\t\t}\n\t}\n\n\tpreventDefaults(e) {\n\t\te.preventDefault()\n\t\te.stopPropagation()\n\t}\n\n\thandleDrop(e: DragEvent) {\n\t\tconst dataTransfer = e.dataTransfer\n\t\tthis.validateFiles(dataTransfer.files)\n\t}\n\n\tprivate validateFiles(files: FileList) {\n\t\tlet filesBuffer: GovFormFileItem[] = []\n\t\tArray.from(files).map(file => {\n\t\t\tconst isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null\n\t\t\tif (isFile === null || this.ignoreFileDuplicationCheck) {\n\t\t\t\tconst isSizeValid = typeof this.maxFileSize === \"number\" && this.maxFileSize > 0 ? fileSizeValidation(file, this.maxFileSize) : true\n\t\t\t\tconst isAcceptValid = fileAcceptValidation(file, this.accept)\n\t\t\t\tconst newFile = {\n\t\t\t\t\tid: createID(\"GovFormFile\"),\n\t\t\t\t\tfile,\n\t\t\t\t\tacceptValid: isAcceptValid,\n\t\t\t\t\tsizeValid: isSizeValid,\n\t\t\t\t}\n\t\t\t\tif (this.displayAttachments) {\n\t\t\t\t\tthis.files = [...this.files, newFile]\n\t\t\t\t} else {\n\t\t\t\t\tfilesBuffer = [...filesBuffer, newFile]\n\t\t\t\t}\n\t\t\t\tthis.govAddFile.emit({\n\t\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\t\tfile: newFile,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\tthis.govFiles.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\tfiles: filesBuffer.length ? filesBuffer : this.files,\n\t\t})\n\n\t\tif (this.resetAfterPick) {\n\t\t\tthis.reset().finally()\n\t\t}\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tthis.f.passAttrToControl(\"type\", \"File\")\n\t\tthis.passControlAttrs()\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\n\t\tthis.registerListeners()\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])} invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\texpanded={toBoolAttrIfDefined(this.expanded)}>\n\t\t\t\t<div class={FormFileClass.area} ref={el => (this.areaRef = el as HTMLDivElement)}>\n\t\t\t\t\t<slot/>\n\t\t\t\t\t<input\n\t\t\t\t\t\tclass={FormFileClass.input}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tid={this.identifier || this.fileId}\n\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\taccept={this.accept}\n\t\t\t\t\t\tmultiple={this.multiple}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t{this.h.hasSlot(\"attachments\") ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<slot name={\"attachments\"}/>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t{this.files.length && this.displayAttachments ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<gov-attachments label={this.wcagAttachmentsLabel} wcag-label={this.wcagAttachmentsLabel}>\n\t\t\t\t\t\t\t{this.files.map(item => (\n\t\t\t\t\t\t\t\t<gov-attachments-item wcag-remove-labelled-by={item.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton-gov-remove={() => this.onRemoveFileHandler(item)}>\n\t\t\t\t\t\t\t\t\t<span class={\"sr-only\"} id={item.id}>\n\t\t\t\t\t\t\t\t\t\t{this.wcagRemoveLabel.replace(\"{FILE_NAME}\", item.file.name)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{item.file.name}\n\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? this.errorAccept : null}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{item.sizeValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{this.errorSize.replace(\"{FILE_SIZE}\", formatBytes(this.maxFileSize))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t<span slot=\"info\">({formatBytes(item.file.size)})</span>\n\t\t\t\t\t\t\t\t</gov-attachments-item>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</gov-attachments>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onRemoveFileHandler(file: GovFormFileItem) {\n\t\tconst index = this.files.findIndex(item => item.id === file.id)\n\t\tif (index !== -1) {\n\t\t\tconst files = this.files\n\t\t\tconst removeFile = this.files[index]\n\t\t\tfiles.splice(index, 1)\n\t\t\tthis.files = [...files]\n\t\t\tthis.govRemoveFile.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfile: removeFile,\n\t\t\t})\n\t\t\tthis.govFiles.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfiles,\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Returns the reference of the native area element\n\t */\n\t@Method()\n\tasync getAreaRef(): Promise<HTMLDivElement> {\n\t\treturn this.areaRef\n\t}\n\n\t/**\n\t * Remove all files from component state\n\t */\n\t@Method()\n\tasync reset(): Promise<void> {\n\t\tthis.files = []\n\t\tthis.inputRef.value = '';\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormFileClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormFileClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.fileId, this.wcagLabelledBy, FormFileClass.root)\n\t}\n}\n"],"mappings":"wbAAO,MAAMA,EAAgB,CAC5BC,KAAM,gBACNC,KAAM,sBACNC,MAAO,uBACPC,MAAO,uBACPC,KAAM,sBACNC,KAAM,sBACNC,YAAa,8B,SCPEC,EAAYC,GAC3B,MAAMC,EAAQ,CAAC,QAAS,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,OACzE,IAAIC,EAAI,EACPC,EAAIC,SAASJ,EAAO,KAAO,EAE5B,MAAOG,GAAK,QAAUD,EAAG,CACxBC,EAAIA,EAAI,I,CAGT,OAAOA,EAAEE,QAAQF,EAAI,IAAMD,EAAI,EAAI,EAAI,GAAK,IAAMD,EAAMC,EACzD,C,SAEgBI,EAAqBC,EAAYC,GAChD,UAAWA,IAAW,UAAYA,EAAOC,OAAQ,CAChD,OACCD,EACEE,QAAQ,MAAO,IACfC,MAAM,KACNC,QAAOJ,GACA,IAAIK,OAAOL,EAAOE,QAAQ,IAAK,OAAOI,KAAKP,EAAKQ,QACrDN,OAAS,C,KAER,CACN,OAAO,I,CAET,C,SAEgBO,EAAmBT,EAAYU,GAC9C,MAAMC,EAAWC,KAAKC,MAAMb,EAAKc,MACjC,OAAOH,GAAYD,CACpB,CC9BA,MAAMK,EAAiB,6xJACvB,MAAAC,EAAeD,E,MCgBFE,EAAW,MAQvB,WAAAC,CAAAC,G,0NAWqC,M,cAKA,M,cAKA,M,oBAKqC,K,gCAIyB,M,wBAIlB,K,wDAc5C,M,kBAI+B,E,gEAYN,oD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KsF,gBAAiB,oBAAqB1H,EAAcC,MACzE8I,EAAgB3G,KAAKuF,eAAgB,mBAAoB3H,EAAcC,MACvE+I,EAAqB5G,KAAK8E,YAAc9E,KAAKC,OAAQD,KAAKuF,eAAgB3H,EAAcC,K","ignoreList":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as o,h as r,a as t,g as e}from"./p-0a5b0f7d.js";import{g as i,b as m}from"./p-c98fe646.js";import{g as c}from"./p-4191acf2.js";import{s}from"./p-95d41a3b.js";import"./p-92f420cb.js";import"./p-e0e2e9c1.js";import"./p-03dbb8b1.js";import"./p-f0d542f2.js";import"./p-45b869ae.js";import"./p-7ba4daf4.js";const a='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-control__holder{display:flex;flex-direction:column;padding:0;border:none}.gov-form-control__bottom>*:last-child{margin-bottom:0}.gov-form-control__bottom>:first-child{margin-top:0.25rem}.gov-form-control .gov-form-label .gov-form-label__label{margin:0rem 0rem 0.25rem}.gov-form-control[type=file] .gov-form-label[slot=top] .gov-form-label__label{margin:0rem 0rem 0.5rem}.gov-form-control[type=file] .gov-form-control__bottom>:first-child{margin-top:0.5rem}.gov-form-control[size=xs][type=checkbox] .gov-form-control__holder>.gov-form-control__bottom>:first-child,.gov-form-control[size=xs][type=radio] .gov-form-control__holder>.gov-form-control__bottom>:first-child{margin-top:var(--gov-form-checkbox-core-xs-message-gap, 0.5rem);margin-left:calc(var(--gov-form-checkbox-core-xs-indicator-size, 1.25rem) + var(--gov-form-checkbox-core-xs-gap, 0.75rem))}.gov-form-control[size=s][type=checkbox] .gov-form-control__holder>.gov-form-control__bottom>:first-child,.gov-form-control[size=s][type=radio] .gov-form-control__holder>.gov-form-control__bottom>:first-child{margin-top:var(--gov-form-checkbox-core-s-message-gap, 0.5rem);margin-left:calc(var(--gov-form-checkbox-core-s-indicator-size, 1.375rem) + var(--gov-form-checkbox-core-s-gap, 0.75rem))}.gov-form-control[size=m][type=checkbox] .gov-form-control__holder>.gov-form-control__bottom>:first-child,.gov-form-control[size=m][type=radio] .gov-form-control__holder>.gov-form-control__bottom>:first-child{margin-top:var(--gov-form-checkbox-core-m-message-gap, 0.75rem);margin-left:calc(var(--gov-form-checkbox-core-m-indicator-size, 1.5rem) + var(--gov-form-checkbox-core-m-gap, 1rem))}.gov-form-control[size=l][type=checkbox] .gov-form-control__holder>.gov-form-control__bottom>:first-child,.gov-form-control[size=l][type=radio] .gov-form-control__holder>.gov-form-control__bottom>:first-child{margin-top:var(--gov-form-checkbox-core-l-message-gap, 0.75rem);margin-left:calc(var(--gov-form-checkbox-core-l-indicator-size, 2rem) + var(--gov-form-checkbox-core-l-gap, 1rem))}.gov-form-control[size=xs][type=switch] .gov-form-control__bottom>:first-child{margin-top:var(--gov-form-switch-xs-message-gap, 0.5rem);margin-left:calc(var(--gov-form-switch-xs-indicator-height, 1.25rem) * 1.6666666667 + var(--gov-form-switch-xs-gap, 0.75rem))}.gov-form-control[size=s][type=switch] .gov-form-control__bottom>:first-child{margin-top:var(--gov-form-switch-s-message-gap, 0.5rem);margin-left:calc(var(--gov-form-switch-s-indicator-height, 1.375rem) * 1.6666666667 + var(--gov-form-switch-s-gap, 0.75rem))}.gov-form-control[size=m][type=switch] .gov-form-control__bottom>:first-child{margin-top:var(--gov-form-switch-m-message-gap, 0.75rem);margin-left:calc(var(--gov-form-switch-m-indicator-height, 1.5rem) * 1.6666666667 + var(--gov-form-switch-m-gap, 1rem))}.gov-form-control[size=l][type=switch] .gov-form-control__bottom>:first-child{margin-top:var(--gov-form-switch-l-message-gap, 0.75rem);margin-left:calc(var(--gov-form-switch-l-indicator-height, 2rem) * 1.6666666667 + var(--gov-form-switch-l-gap, 1rem))}.gov-form-control[invalid=""] .gov-form-label[slot=top] .gov-form-label__label,.gov-form-control[invalid=true i] .gov-form-label[slot=top] .gov-form-label__label,.gov-form-control[invalid="1"] .gov-form-label[slot=top] .gov-form-label__label{color:var(--gov-form-state-color-error, var(--gov-color-error))}.gov-form-control[disabled=""] .gov-form-label__label,.gov-form-control[disabled=true i] .gov-form-label__label,.gov-form-control[disabled="1"] .gov-form-label__label{pointer-events:none}';const l=a;const f=class{constructor(r){o(this,r);this.identifier=undefined;this.invalid=false;this.disabled=false;this.success=false;this.fieldset=false;this.size="m";this.h=c(this.host);this.f=i(this.h)}componentDidRender(){this.syncControlMessages();this.formElementDescriptionControl()}disconnectedCallback(){var o;(o=this.observer)===null||o===void 0?void 0:o.disconnect()}formElementDescriptionControl(){const o=this.host.querySelector("."+m.bottom);if(!o)return;this.observer=new MutationObserver(function(){this.syncControlMessages()}.bind(this));this.observer.observe(o,{childList:true})}syncControlMessages(){Promise.all(this.f.messageElements.map((o=>o.identifier()))).then((o=>{this.f.mainElementsInControl.forEach((r=>{const t=s(r.getAttribute("wcag-described-by"));r.removeAttribute("wcag-described-by");if(Array.isArray(t)){t.forEach((r=>r.indexOf("GovFormMessage")===-1?o.push(r):null))}if(o.length){r.setAttribute("wcag-described-by",o.join(" "))}}))}))}render(){const o=this.fieldset?"fieldset":"div";return r(t,{key:"9178f9dbaff42cb649849621e34059afa6d387d7",size:this.size,class:this.h.classes(m.root)},r(o,{key:"296540b214c4106f676b3bf4981ad84409004472",class:m.holder},this.h.hasSlot("top")&&r("slot",{key:"b62e1d46f8fdc6b56ae481de1cb1fb020f9f8ec6",name:"top"}),r("slot",{key:"24ffcd827657b1b02cbe657c41be16af9f8da165"}),this.h.hasSlot("bottom")&&r("div",{key:"77d9ee6b541d4b1073fd621deec00c2336aff240",class:m.bottom},r("slot",{key:"4c7f2200a2fd55b3f801dc40383b7a91cbb18b7d",name:"bottom"}))))}get host(){return e(this)}};f.style=l;export{f as gov_form_control};
|
|
2
|
+
//# sourceMappingURL=p-6110119c.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["govFormControlCss","GovFormControlStyle0","GovFormControl","constructor","hostRef","this","h","govHost","host","f","govForm","componentDidRender","syncControlMessages","formElementDescriptionControl","disconnectedCallback","_a","observer","disconnect","bottomSlot","querySelector","FormControlClass","bottom","MutationObserver","bind","observe","childList","Promise","all","messageElements","map","message","identifier","then","ids","mainElementsInControl","forEach","element","currentValue","splitByWhitespace","getAttribute","removeAttribute","Array","isArray","id","indexOf","push","length","setAttribute","join","render","Tag","fieldset","Host","key","size","class","classes","root","holder","hasSlot","name"],"sources":["../../../packages/core/src/components/gov-form/control/gov-form-control.scss?tag=gov-form-control","../../../packages/core/src/components/gov-form/control/gov-form-control.tsx"],"sourcesContent":["/*\n * Form Control\n */\n\n$class: \".gov-form-control\";\n\n#{$class} {\n\t&__holder {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tpadding: 0;\n\t\tborder: none;\n\t}\n\t&__bottom {\n\t\t@include reset-last-margin();\n\t\t> :first-child {\n\t\t\tmargin-top: rem-calc(4);\n\t\t}\n\t}\n\n\t// VARIANTS\n\t.gov-form-label .gov-form-label__label {\n\t\tmargin: rem-calc(0 0 4);\n\t}\n\t&[type=\"file\"] {\n\t\t.gov-form-label[slot=\"top\"] .gov-form-label__label {\n\t\t\tmargin: rem-calc(0 0 8);\n\t\t}\n\t\t#{$class}__bottom > :first-child {\n\t\t\tmargin-top: rem-calc(8);\n\t\t}\n\t}\n\t// Checkbox, radio\n\t@each $size, $definitions in $form-checkbox-core-sizes {\n\t\t&[size=\"#{$size}\"][type=\"checkbox\"],\n\t\t&[size=\"#{$size}\"][type=\"radio\"] {\n\t\t\t#{$class} {\n\t\t\t\t$indicator-width: get(\"indicator-size\", $definitions);\n\t\t\t\t&__holder > #{$class}__bottom > :first-child {\n\t\t\t\t\tmargin-top: get(\"message-gap\", $definitions);\n\t\t\t\t\tmargin-left: calc($indicator-width + get(\"gap\", $definitions));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Switch\n\t@each $size, $definitions in $form-switch-sizes {\n\t\t&[size=\"#{$size}\"][type=\"switch\"] {\n\t\t\t#{$class} {\n\t\t\t\t$indicator-ratio: calc(5 / 3);\n\t\t\t\t$indicator-width: calc(get(\"indicator-height\", $definitions) * $indicator-ratio);\n\t\t\t\t&__bottom > :first-child {\n\t\t\t\t\tmargin-top: get(\"message-gap\", $definitions);\n\t\t\t\t\tmargin-left: calc($indicator-width + get(\"gap\", $definitions));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// STATES\n\t@include parameter(\"invalid\") {\n\t\t.gov-form-label[slot=\"top\"] .gov-form-label__label {\n\t\t\tcolor: $form-state-color-error;\n\t\t}\n\t}\n\t@include parameter(\"disabled\") {\n\t\t.gov-form-label__label {\n\t\t\tpointer-events: none;\n\t\t}\n\t}\n}\n","import {Component, Element, h, Host, Prop} from \"@stencil/core\"\nimport {govForm} from \"../../../helpers/Dom/form\"\nimport {GovForm} from \"../../../helpers/Dom/form.types\"\nimport {govHost} from \"../../../helpers/Dom/template\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {splitByWhitespace} from \"../../../utils/string.utils\"\nimport {FormControlClass, FormControlSizesType} from \"./constants\"\n\n@Component({\n\ttag: \"gov-form-control\",\n\tstyleUrl: \"gov-form-control.scss\",\n})\nexport class GovFormControl {\n\tprivate readonly h: GovHost\n\tprivate f: GovForm\n\tprivate observer: MutationObserver\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormControlElement\n\t/**\n\t * Custom form element identifier\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Indicates the entered value of child form element does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean = false\n\t/**\n\t/**\n\t* Indicates the form control is disabled\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t/**\n\t* Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean = false\n\t/**\n\t * Use control as a fieldset for better accessibility.\n\t * Note: Don't forget to set the legend attribute of the gov-form-label component\n\t */\n\t@Prop() readonly fieldset: boolean = false\n\t/**\n\t * Form element size.\n\t */\n\t@Prop() readonly size?: FormControlSizesType = \"m\"\n\n\tcomponentDidRender() {\n\t\tthis.syncControlMessages()\n\t\tthis.formElementDescriptionControl()\n\t}\n\n\tdisconnectedCallback(): void {\n\t\tthis.observer?.disconnect()\n\t}\n\n\tprivate formElementDescriptionControl() {\n\t\tconst bottomSlot = this.host.querySelector(\".\" + FormControlClass.bottom)\n\t\tif (!bottomSlot) return\n\t\tthis.observer = new MutationObserver(\n\t\t\tfunction () {\n\t\t\t\tthis.syncControlMessages()\n\t\t\t}.bind(this),\n\t\t)\n\n\t\tthis.observer.observe(bottomSlot, {childList: true})\n\t}\n\n\tprivate syncControlMessages() {\n\t\tPromise.all(this.f.messageElements.map((message: HTMLGovFormMessageElement) => message.identifier())).then((ids: string[]) => {\n\t\t\tthis.f.mainElementsInControl.forEach((element: Element) => {\n\t\t\t\tconst currentValue = splitByWhitespace(element.getAttribute(\"wcag-described-by\"))\n\t\t\t\telement.removeAttribute(\"wcag-described-by\")\n\t\t\t\tif (Array.isArray(currentValue)) {\n\t\t\t\t\tcurrentValue.forEach(id => (id.indexOf(\"GovFormMessage\") === -1 ? ids.push(id) : null))\n\t\t\t\t}\n\t\t\t\tif (ids.length) {\n\t\t\t\t\telement.setAttribute(\"wcag-described-by\", ids.join(\" \"))\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t}\n\n\trender() {\n\t\tconst Tag = this.fieldset ? \"fieldset\" : \"div\"\n\t\treturn (\n\t\t\t<Host size={this.size} class={this.h.classes(FormControlClass.root)}>\n\t\t\t\t<Tag class={FormControlClass.holder}>\n\t\t\t\t\t{this.h.hasSlot(\"top\") && <slot name=\"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AW,WAAa,MACzC,OACC7C,EAAC8C,EAAI,CAAAC,IAAA,2CAACC,KAAMjD,KAAKiD,KAAMC,MAAOlD,KAAKC,EAAEkD,QAAQpC,EAAiBqC,OAC7DnD,EAAC4C,EAAG,CAAAG,IAAA,2CAACE,MAAOnC,EAAiBsC,QAC3BrD,KAAKC,EAAEqD,QAAQ,QAAUrD,EAAA,QAAA+C,IAAA,2CAAMO,KAAK,QACrCtD,EAAA,QAAA+C,IAAA,6CACChD,KAAKC,EAAEqD,QAAQ,WACfrD,EAAA,OAAA+C,IAAA,2CAAKE,MAAOnC,EAAiBC,QAC5Bf,EAAA,QAAA+C,IAAA,2CAAMO,KAAK,a","ignoreList":[]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{r as o,c as r,h as t,a as e,g as n}from"./p-0a5b0f7d.js";import{F as a}from"./p-1c1d0bbe.js";import{v as i}from"./p-344c72d7.js";import{S as s}from"./p-92f420cb.js";import{V as g}from"./p-03dbb8b1.js";import{p as c,d as v}from"./p-e0e2e9c1.js";import{g as l,p as u,t as h}from"./p-4191acf2.js";import{c as p,v as d}from"./p-92b7481f.js";import{c as b}from"./p-e618f1cb.js";import{c as m}from"./p-95d41a3b.js";import{c as _}from"./p-ded281e6.js";import"./p-e296ca83.js";import"./p-2aedc81e.js";const y=c(s,["_S","_M"]);const f=c(g,["PRIMARY","SECONDARY"]);var w;(function(o){o["BUTTON"]="button";o["SELECT"]="select"})(w||(w={}));const k={root:"gov-pagination",list:"gov-pagination__list",item:"gov-pagination__item",itemArrow:"gov-pagination__item--arrow",itemMore:"gov-pagination__item--more",itemSelect:"gov-pagination__item--select",inner:"gov-pagination__inner",arrow:"gov-pagination__arrow"};function x(o,r=1,t=10,e=10){const n=Math.ceil(o/t);if(r<1){r=1}else if(r>n){r=n}let a,i;if(n<=e){a=1;i=n}else{const o=Math.floor(e/2);const t=Math.ceil(e/2)-1;if(r<=o){a=1;i=e}else if(r+t>=n){a=n-e+1;i=n}else{a=r-o;i=r+t}}const s=(r-1)*t;const g=Math.min(s+t-1,o-1);const c=Array.from(Array(i+1-a).keys()).map((o=>a+o));return{totalItems:o,currentPage:r,pageSize:t,totalPages:n,startPage:a,endPage:i,startIndex:s,endIndex:g,pages:c}}const z=".gov-pagination__list{margin:0;padding:0}.gov-pagination__list .gov-pagination__item{margin:0;padding:0;background:none}.gov-pagination__list .gov-pagination__item::before{display:none}.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-pagination{position:relative;display:block;width:100%}.gov-pagination__list{display:flex;align-items:center;flex-wrap:wrap;font-weight:bold;text-align:center}.gov-pagination__list .gov-pagination__item{display:flex;justify-content:center;align-items:center;margin:0;padding:0.125rem;border-radius:var(--gov-border-radius, 0.1875rem);overflow:hidden}.gov-pagination__list .gov-pagination__item--arrow{display:flex}.gov-pagination__list .gov-pagination__item--select{z-index:1;display:flex;overflow:visible;padding:0rem 1rem}.gov-pagination__arrow{margin:0}.gov-pagination__item--more .gov-form-select select{border:none !important;padding-right:0.75rem !important}.gov-pagination__item--more .gov-form-select .gov-icon{display:none}.gov-pagination__inner{display:flex;justify-content:center;align-items:center;align-self:stretch;width:100%;text-decoration:none}.gov-pagination__inner[wcag-current=true][type=solid][variant=primary] .element{background-color:var(--gov-button-primary-solid-hover-bg, var(--gov-color-primary-700));color:var(--gov-button-primary-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=primary] .element{background-color:var(--gov-button-primary-outlined-hover-bg, var(--gov-color-primary-100));color:var(--gov-button-primary-outlined-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=base][variant=primary] .element{background-color:var(--gov-button-primary-base-hover-bg, var(--gov-color-primary-100));color:var(--gov-button-primary-base-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=link][variant=primary] .element{background-color:var(--gov-button-primary-link-hover-bg, transparent);color:var(--gov-button-primary-link-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=solid][variant=secondary] .element{background-color:var(--gov-button-secondary-solid-hover-bg, var(--gov-color-secondary-900));color:var(--gov-button-secondary-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=secondary] .element{background-color:var(--gov-button-secondary-outlined-hover-bg, var(--gov-color-secondary-300));color:var(--gov-button-secondary-outlined-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=base][variant=secondary] .element{background-color:var(--gov-button-secondary-base-hover-bg, var(--gov-color-secondary-300));color:var(--gov-button-secondary-base-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=link][variant=secondary] .element{background-color:var(--gov-button-secondary-link-hover-bg, transparent);color:var(--gov-button-secondary-link-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=solid][variant=error] .element{background-color:var(--gov-button-error-solid-hover-bg, var(--gov-color-error-500));color:var(--gov-button-error-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=error] .element{background-color:var(--gov-button-error-outlined-hover-bg, var(--gov-color-error-100));color:var(--gov-button-error-outlined-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=base][variant=error] .element{background-color:var(--gov-button-error-base-hover-bg, var(--gov-color-error-100));color:var(--gov-button-error-base-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=link][variant=error] .element{background-color:var(--gov-button-error-link-hover-bg, transparent);color:var(--gov-button-error-link-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=solid][variant=success] .element{background-color:var(--gov-button-success-solid-hover-bg, var(--gov-color-success-600));color:var(--gov-button-success-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=success] .element{background-color:var(--gov-button-success-outlined-hover-bg, var(--gov-color-success-100));color:var(--gov-button-success-outlined-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=base][variant=success] .element{background-color:var(--gov-button-success-base-hover-bg, var(--gov-color-success-100));color:var(--gov-button-success-base-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=link][variant=success] .element{background-color:var(--gov-button-success-link-hover-bg, transparent);color:var(--gov-button-success-link-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=solid][variant=warning] .element{background-color:var(--gov-button-warning-solid-hover-bg, var(--gov-color-warning-600));color:var(--gov-button-warning-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=warning] .element{background-color:var(--gov-button-warning-outlined-hover-bg, var(--gov-color-warning-200));color:var(--gov-button-warning-outlined-hover-color, var(--gov-color-warning-500))}.gov-pagination__inner[wcag-current=true][type=base][variant=warning] .element{background-color:var(--gov-button-warning-base-hover-bg, var(--gov-color-warning-200));color:var(--gov-button-warning-base-hover-color, var(--gov-color-warning-500))}.gov-pagination__inner[wcag-current=true][type=link][variant=warning] .element{background-color:var(--gov-button-warning-link-hover-bg, transparent);color:var(--gov-button-warning-link-hover-color, var(--gov-color-warning-500))}.gov-pagination[size=s] .gov-pagination__inner{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);font-weight:inherit}.gov-pagination[size=s] .gov-pagination__inner .element{min-width:var(--gov-pagination-s-button-size, 2rem)}.gov-pagination[size=m] .gov-pagination__inner{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);font-weight:inherit}.gov-pagination[size=m] .gov-pagination__inner .element{min-width:var(--gov-pagination-m-button-size, 2.5rem)}";const j=z;const S=class{constructor(t){o(this,t);this.govPage=r(this,"gov-page",7);this.type="button";this.current=1;this.total=0;this.inverse=undefined;this.selectIdentifier=undefined;this.size="m";this.variant="primary";this.pageSize=10;this.maxPages=5;this.link=undefined;this.wcagLabel=undefined;this.wcagLabelledBy=undefined;this.wcagSelectLabel="Vybrat stranu";this.wcagPageLabel="Strana";this.labelPrev="Přejít o stranu zpět";this.labelStart="Přejít na začátek";this.labelNext="Přejít na další stranu";this.labelEnd="Přejít na konec";this.pagination=undefined;this.h=l(this.host);this.pageSelectId=m("GovPageSelect");this.selectId=m("GovSelect")}validateType(o){i(w,o,k.root)}validateSize(o){i(y,o,k.root)}validateVariant(o){i(f,o,k.root)}recalculate(){this.recalculatePagination(this.current)}componentWillLoad(){this.recalculatePagination(this.current);this.validateSize(this.size);this.validateVariant(this.variant)}async componentDidRender(){if(b()){await v(500);await this.validateWcag()}}recalculatePagination(o){this.pagination=x(this.total,o,this.pageSize,this.maxPages)}isActivePageClass(o,r){if(this.pagination.currentPage===r){return o+" is-active"}else{return o}}prepareLinkUrl(o){if(this.link){return String(this.link).replace("{PAGE}",String(o))}return undefined}resetSelectValue(){if(this.spreadSelectRef){this.spreadSelectRef.getRef().then((o=>{o.value="..."}))}}render(){const o=(o,r,e)=>{const n=o===-1;const a=h(this.pagination.currentPage===o?true:undefined);return t("gov-button",{href:this.prepareLinkUrl(o),variant:this.variant,size:this.size,type:"base",disabled:n,"on-gov-click":r=>this.onClickHandler(r,o),"wcag-label":e?e:o>-1?this.wcagPageLabel+" "+o:undefined,"wcag-current":a,class:k.inner},r)};return t(e,{class:this.h.classes(k.root),type:this.type,variant:this.variant,size:this.size},t("nav",{"aria-label":this.wcagLabel,"aria-labelledby":this.wcagLabelledBy},t("ul",{class:k.list},t("li",{class:u([k.item,k.itemArrow])},o(this.pagination.currentPage>1?1:-1,t("gov-icon",{class:k.arrow,name:"chevron-double-left"}),this.labelStart)),t("li",{class:u([k.item,k.itemArrow])},o(this.pagination.startPage<this.pagination.currentPage?this.pagination.currentPage-1:-1,t("gov-icon",{class:k.arrow,name:"chevron-left"}),this.labelPrev)),this.type=="select"?t("li",{class:u([k.item,k.itemSelect])},t("span",{class:k.inner},t("span",{id:this.pageSelectId,hidden:true},this.wcagSelectLabel),t("gov-form-select",{size:this.size,variant:this.variant,identifier:this.selectIdentifier||this.selectId,"wcag-labelled-by":this.pageSelectId,"on-gov-change":this.onSelectHandler.bind(this)},_(1,this.pagination.totalPages).map((o=>t("option",{value:o,selected:this.pagination.currentPage===o},o)))))):t(a,null,this.pagination.pages.map((r=>t("li",{class:this.isActivePageClass(k.item,r)},o(r,r,"")))),this.pagination.totalPages?t("li",{class:u([k.item,k.itemMore])},t("span",{class:k.inner},t("span",{id:this.pageSelectId,hidden:true},this.wcagSelectLabel),t("gov-form-select",{size:this.size,variant:this.variant,identifier:this.selectIdentifier||this.selectId,"wcag-labelled-by":this.pageSelectId,ref:o=>this.spreadSelectRef=o,"on-gov-change":this.onSelectHandler.bind(this)},t("option",{selected:true,hidden:true},"..."),_(1,this.pagination.totalPages).map((o=>t("option",{value:o,selected:false},o)))))):null),t("li",{class:u([k.item,k.itemArrow])},o(this.pagination.totalPages>this.pagination.currentPage?this.pagination.currentPage+1:-1,t("gov-icon",{class:k.arrow,name:"chevron-right"}),this.labelNext)),t("li",{class:u([k.item,k.itemArrow])},o(this.pagination.totalPages>this.pagination.currentPage?this.pagination.totalPages:-1,t("gov-icon",{class:k.arrow,name:"chevron-double-right"}),this.labelEnd)))))}onClickHandler(o,r){o.stopPropagation();this.recalculatePagination(r);this.govPage.emit({component:k.root,pagination:this.pagination})}onSelectHandler(o){o.stopPropagation();const r=o.detail.value;const t=parseInt(r);this.resetSelectValue();if(isNaN(t)===false){this.recalculatePagination(t);if(this.link){window.location.href=this.prepareLinkUrl(t)}else{this.govPage.emit({component:k.root,pagination:this.pagination})}}}async validateWcag(){p(this.wcagPageLabel,"wcag-page-label",k.root);d(this.wcagLabel,this.wcagLabelledBy,k.root)}get host(){return n(this)}static get watchers(){return{type:["validateType"],size:["validateSize"],variant:["validateVariant"],current:["recalculate"],total:["recalculate"],pageSize:["recalculate"],maxPages:["recalculate"]}}};S.style=j;export{S as gov_pagination};
|
|
2
|
-
|
|
1
|
+
import{r as o,c as r,h as t,a as e,g as n}from"./p-0a5b0f7d.js";import{F as a}from"./p-1c1d0bbe.js";import{v as i}from"./p-344c72d7.js";import{S as s}from"./p-92f420cb.js";import{V as g}from"./p-03dbb8b1.js";import{p as c,d as v}from"./p-e0e2e9c1.js";import{g as l,p as u,t as h}from"./p-4191acf2.js";import{c as p,v as d}from"./p-92b7481f.js";import{c as b}from"./p-e618f1cb.js";import{c as m}from"./p-95d41a3b.js";import{c as _}from"./p-ded281e6.js";import"./p-e296ca83.js";import"./p-2aedc81e.js";const y=c(s,["_S","_M"]);const f=c(g,["PRIMARY","SECONDARY"]);var w;(function(o){o["BUTTON"]="button";o["SELECT"]="select"})(w||(w={}));const k={root:"gov-pagination",list:"gov-pagination__list",item:"gov-pagination__item",itemArrow:"gov-pagination__item--arrow",itemMore:"gov-pagination__item--more",itemSelect:"gov-pagination__item--select",inner:"gov-pagination__inner",arrow:"gov-pagination__arrow"};function x(o,r=1,t=10,e=10){const n=Math.ceil(o/t);if(r<1){r=1}else if(r>n){r=n}let a,i;if(n<=e){a=1;i=n}else{const o=Math.floor(e/2);const t=Math.ceil(e/2)-1;if(r<=o){a=1;i=e}else if(r+t>=n){a=n-e+1;i=n}else{a=r-o;i=r+t}}const s=(r-1)*t;const g=Math.min(s+t-1,o-1);const c=Array.from(Array(i+1-a).keys()).map((o=>a+o));return{totalItems:o,currentPage:r,pageSize:t,totalPages:n,startPage:a,endPage:i,startIndex:s,endIndex:g,pages:c}}const z=".gov-pagination__list{margin:0;padding:0}.gov-pagination__list .gov-pagination__item{margin:0;padding:0;background:none}.gov-pagination__list .gov-pagination__item::before{display:none}.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-pagination{position:relative;display:block;width:100%}.gov-pagination__list{display:flex;align-items:center;flex-wrap:wrap;font-weight:bold;text-align:center}.gov-pagination__list .gov-pagination__item{display:flex;justify-content:center;align-items:center;margin:0;padding:0.125rem;border-radius:var(--gov-border-radius, 0.1875rem);overflow:hidden}.gov-pagination__list .gov-pagination__item--arrow{display:flex}.gov-pagination__list .gov-pagination__item--select{z-index:1;display:flex;overflow:visible;padding:0rem 1rem}.gov-pagination__arrow{margin:0}.gov-pagination__item--more .gov-form-select select{border:none !important;padding-right:0.75rem !important}.gov-pagination__item--more .gov-form-select .gov-icon{display:none}.gov-pagination__inner{display:flex;justify-content:center;align-items:center;align-self:stretch;width:100%;text-decoration:none}.gov-pagination__inner[wcag-current=true][type=solid][variant=primary] .element{background-color:var(--gov-button-primary-solid-hover-bg, var(--gov-color-primary-700));color:var(--gov-button-primary-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=primary] .element{background-color:var(--gov-button-primary-outlined-hover-bg, var(--gov-color-primary-100));color:var(--gov-button-primary-outlined-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=base][variant=primary] .element{background-color:var(--gov-button-primary-base-hover-bg, var(--gov-color-primary-100));color:var(--gov-button-primary-base-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=link][variant=primary] .element{background-color:var(--gov-button-primary-link-hover-bg, transparent);color:var(--gov-button-primary-link-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=solid][variant=secondary] .element{background-color:var(--gov-button-secondary-solid-hover-bg, var(--gov-color-secondary-900));color:var(--gov-button-secondary-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=secondary] .element{background-color:var(--gov-button-secondary-outlined-hover-bg, var(--gov-color-secondary-300));color:var(--gov-button-secondary-outlined-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=base][variant=secondary] .element{background-color:var(--gov-button-secondary-base-hover-bg, var(--gov-color-secondary-300));color:var(--gov-button-secondary-base-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=link][variant=secondary] .element{background-color:var(--gov-button-secondary-link-hover-bg, transparent);color:var(--gov-button-secondary-link-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=solid][variant=error] .element{background-color:var(--gov-button-error-solid-hover-bg, var(--gov-color-error-500));color:var(--gov-button-error-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=error] .element{background-color:var(--gov-button-error-outlined-hover-bg, var(--gov-color-error-100));color:var(--gov-button-error-outlined-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=base][variant=error] .element{background-color:var(--gov-button-error-base-hover-bg, var(--gov-color-error-100));color:var(--gov-button-error-base-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=link][variant=error] .element{background-color:var(--gov-button-error-link-hover-bg, transparent);color:var(--gov-button-error-link-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=solid][variant=success] .element{background-color:var(--gov-button-success-solid-hover-bg, var(--gov-color-success-600));color:var(--gov-button-success-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=success] .element{background-color:var(--gov-button-success-outlined-hover-bg, var(--gov-color-success-100));color:var(--gov-button-success-outlined-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=base][variant=success] .element{background-color:var(--gov-button-success-base-hover-bg, var(--gov-color-success-100));color:var(--gov-button-success-base-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=link][variant=success] .element{background-color:var(--gov-button-success-link-hover-bg, transparent);color:var(--gov-button-success-link-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=solid][variant=warning] .element{background-color:var(--gov-button-warning-solid-hover-bg, var(--gov-color-warning-600));color:var(--gov-button-warning-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=warning] .element{background-color:var(--gov-button-warning-outlined-hover-bg, var(--gov-color-warning-200));color:var(--gov-button-warning-outlined-hover-color, var(--gov-color-warning-500))}.gov-pagination__inner[wcag-current=true][type=base][variant=warning] .element{background-color:var(--gov-button-warning-base-hover-bg, var(--gov-color-warning-200));color:var(--gov-button-warning-base-hover-color, var(--gov-color-warning-500))}.gov-pagination__inner[wcag-current=true][type=link][variant=warning] .element{background-color:var(--gov-button-warning-link-hover-bg, transparent);color:var(--gov-button-warning-link-hover-color, var(--gov-color-warning-500))}.gov-pagination[size=s] .gov-pagination__inner{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);font-weight:inherit}.gov-pagination[size=s] .gov-pagination__inner .element{min-width:var(--gov-pagination-s-button-size, 2rem)}.gov-pagination[size=m] .gov-pagination__inner{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);font-weight:inherit}.gov-pagination[size=m] .gov-pagination__inner .element{min-width:var(--gov-pagination-m-button-size, 2.5rem)}";const j=z;const S=class{constructor(t){o(this,t);this.govPage=r(this,"gov-page",7);this.type="button";this.current=1;this.total=0;this.inverse=undefined;this.selectIdentifier=undefined;this.size="m";this.variant="primary";this.pageSize=10;this.maxPages=5;this.link=undefined;this.wcagLabel=undefined;this.wcagLabelledBy=undefined;this.accessibleSelectLabel="Vybrat stranu";this.accessiblePageLabel="Strana";this.labelPrev="Přejít o stranu zpět";this.labelStart="Přejít na začátek";this.labelNext="Přejít na další stranu";this.labelEnd="Přejít na konec";this.pagination=undefined;this.h=l(this.host);this.pageSelectId=m("GovPageSelect");this.selectId=m("GovSelect")}validateType(o){i(w,o,k.root)}validateSize(o){i(y,o,k.root)}validateVariant(o){i(f,o,k.root)}recalculate(){this.recalculatePagination(this.current)}componentWillLoad(){this.recalculatePagination(this.current);this.validateSize(this.size);this.validateVariant(this.variant)}async componentDidRender(){if(b()){await v(500);await this.validateWcag()}}recalculatePagination(o){this.pagination=x(this.total,o,this.pageSize,this.maxPages)}isActivePageClass(o,r){if(this.pagination.currentPage===r){return o+" is-active"}else{return o}}prepareLinkUrl(o){if(this.link){return String(this.link).replace("{PAGE}",String(o))}return undefined}resetSelectValue(){if(this.spreadSelectRef){this.spreadSelectRef.getRef().then((o=>{o.value="..."}))}}render(){const o=(o,r,e)=>{const n=o===-1;const a=h(this.pagination.currentPage===o?true:undefined);return t("gov-button",{href:this.prepareLinkUrl(o),variant:this.variant,size:this.size,type:"base",disabled:n,"on-gov-click":r=>this.onClickHandler(r,o),"wcag-label":e?e:o>-1?this.accessiblePageLabel+" "+o:undefined,"wcag-current":a,class:k.inner},r)};return t(e,{class:this.h.classes(k.root),type:this.type,variant:this.variant,size:this.size},t("nav",{"aria-label":this.wcagLabel,"aria-labelledby":this.wcagLabelledBy},t("ul",{class:k.list},t("li",{class:u([k.item,k.itemArrow])},o(this.pagination.currentPage>1?1:-1,t("gov-icon",{class:k.arrow,name:"chevron-double-left"}),this.labelStart)),t("li",{class:u([k.item,k.itemArrow])},o(this.pagination.startPage<this.pagination.currentPage?this.pagination.currentPage-1:-1,t("gov-icon",{class:k.arrow,name:"chevron-left"}),this.labelPrev)),this.type=="select"?t("li",{class:u([k.item,k.itemSelect])},t("span",{class:k.inner},t("span",{id:this.pageSelectId,hidden:true},this.accessibleSelectLabel),t("gov-form-select",{size:this.size,variant:this.variant,identifier:this.selectIdentifier||this.selectId,"wcag-labelled-by":this.pageSelectId,"on-gov-change":this.onSelectHandler.bind(this)},_(1,this.pagination.totalPages).map((o=>t("option",{value:o,selected:this.pagination.currentPage===o},o)))))):t(a,null,this.pagination.pages.map((r=>t("li",{class:this.isActivePageClass(k.item,r)},o(r,r,"")))),this.pagination.totalPages?t("li",{class:u([k.item,k.itemMore])},t("span",{class:k.inner},t("span",{id:this.pageSelectId,hidden:true},this.accessibleSelectLabel),t("gov-form-select",{size:this.size,variant:this.variant,identifier:this.selectIdentifier||this.selectId,"wcag-labelled-by":this.pageSelectId,ref:o=>this.spreadSelectRef=o,"on-gov-change":this.onSelectHandler.bind(this)},t("option",{selected:true,hidden:true},"..."),_(1,this.pagination.totalPages).map((o=>t("option",{value:o,selected:false},o)))))):null),t("li",{class:u([k.item,k.itemArrow])},o(this.pagination.totalPages>this.pagination.currentPage?this.pagination.currentPage+1:-1,t("gov-icon",{class:k.arrow,name:"chevron-right"}),this.labelNext)),t("li",{class:u([k.item,k.itemArrow])},o(this.pagination.totalPages>this.pagination.currentPage?this.pagination.totalPages:-1,t("gov-icon",{class:k.arrow,name:"chevron-double-right"}),this.labelEnd)))))}onClickHandler(o,r){o.stopPropagation();this.recalculatePagination(r);this.govPage.emit({component:k.root,pagination:this.pagination})}onSelectHandler(o){o.stopPropagation();const r=o.detail.value;const t=parseInt(r);this.resetSelectValue();if(isNaN(t)===false){this.recalculatePagination(t);if(this.link){window.location.href=this.prepareLinkUrl(t)}else{this.govPage.emit({component:k.root,pagination:this.pagination})}}}async validateWcag(){p(this.accessiblePageLabel,"wcag-page-label",k.root);d(this.wcagLabel,this.wcagLabelledBy,k.root)}get host(){return n(this)}static get watchers(){return{type:["validateType"],size:["validateSize"],variant:["validateVariant"],current:["recalculate"],total:["recalculate"],pageSize:["recalculate"],maxPages:["recalculate"]}}};S.style=j;export{S as gov_pagination};
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=p-6be9b50d.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PaginationSizes","pick","Sizes","PaginationVariants","Variants","PaginationTypes","PaginationClass","root","list","item","itemArrow","itemMore","itemSelect","inner","arrow","paginate","totalItems","currentPage","pageSize","maxPages","totalPages","Math","ceil","startPage","endPage","maxPagesBeforeCurrentPage","floor","maxPagesAfterCurrentPage","startIndex","endIndex","min","pages","Array","from","keys","map","i","govPaginationCss","GovPaginationStyle0","GovPagination","constructor","hostRef","this","h","govHost","host","pageSelectId","createID","selectId","validateType","newValue","validateProp","validateSize","validateVariant","recalculate","recalculatePagination","current","componentWillLoad","size","variant","componentDidRender","canValidateWcagOnRender","delay","validateWcag","pagination","total","isActivePageClass","originalClass","page","prepareLinkUrl","link","String","replace","undefined","resetSelectValue","spreadSelectRef","getRef","then","el","value","render","pageResolver","content","description","isDisabled","ariaCurrent","toBoolAttrIfDefined","href","type","disabled","e","onClickHandler","accessiblePageLabel","class","Host","classes","wcagLabel","wcagLabelledBy","prepareClasses","name","labelStart","labelPrev","id","hidden","accessibleSelectLabel","identifier","selectIdentifier","onSelectHandler","bind","createArrayRange","selected","Fragment","ref","labelNext","labelEnd","stopPropagation","govPage","emit","component","detail","parseInt","isNaN","window","location","validateWcagProp","validateWcagLabel"],"sources":["../../../packages/core/src/components/gov-pagination/constants.ts","../../../packages/core/src/components/gov-pagination/pagination.ts","../../../packages/core/src/components/gov-pagination/gov-pagination.scss?tag=gov-pagination","../../../packages/core/src/components/gov-pagination/gov-pagination.tsx"],"sourcesContent":["import { Sizes } from '../../core/constants/sizes'\nimport { Variants } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const PaginationSizes = pick(Sizes, ['_S', '_M'])\nexport type PaginationSizeType = `${ValueOf<typeof PaginationSizes>}`\n\nexport const PaginationVariants = pick(Variants, ['PRIMARY', 'SECONDARY'])\nexport type PaginationVariantType = `${ValueOf<typeof PaginationVariants>}`\n\nexport enum PaginationTypes {\n\tBUTTON = 'button',\n\tSELECT = 'select',\n}\nexport type PaginationType = `${ValueOf<typeof PaginationTypes>}`\n\nexport const PaginationClass = {\n\troot: 'gov-pagination',\n\tlist: 'gov-pagination__list',\n\titem: 'gov-pagination__item',\n\titemArrow: 'gov-pagination__item--arrow',\n\titemMore: 'gov-pagination__item--more',\n\titemSelect: 'gov-pagination__item--select',\n\tinner: 'gov-pagination__inner',\n\tarrow: 'gov-pagination__arrow',\n}\n","export interface Pagination {\n\ttotalItems: number\n\tcurrentPage: number\n\tpageSize: number\n\ttotalPages: number\n\tstartPage: number\n\tendPage: number\n\tstartIndex: number\n\tendIndex: number\n\tpages: number[]\n}\n\nexport function paginate(totalItems: number, currentPage = 1, pageSize = 10, maxPages = 10): Pagination {\n\t// calculate total pages\n\tconst totalPages = Math.ceil(totalItems / pageSize)\n\n\t// ensure current page isn't out of range\n\tif (currentPage < 1) {\n\t\tcurrentPage = 1\n\t} else if (currentPage > totalPages) {\n\t\tcurrentPage = totalPages\n\t}\n\n\tlet startPage: number, endPage: number\n\tif (totalPages <= maxPages) {\n\t\t// total pages less than max so show all pages\n\t\tstartPage = 1\n\t\tendPage = totalPages\n\t} else {\n\t\t// total pages more than max so calculate start and end pages\n\t\tconst maxPagesBeforeCurrentPage = Math.floor(maxPages / 2)\n\t\tconst maxPagesAfterCurrentPage = Math.ceil(maxPages / 2) - 1\n\t\tif (currentPage <= maxPagesBeforeCurrentPage) {\n\t\t\t// current page near the start\n\t\t\tstartPage = 1\n\t\t\tendPage = maxPages\n\t\t} else if (currentPage + maxPagesAfterCurrentPage >= totalPages) {\n\t\t\t// current page near the end\n\t\t\tstartPage = totalPages - maxPages + 1\n\t\t\tendPage = totalPages\n\t\t} else {\n\t\t\t// current page somewhere in the middle\n\t\t\tstartPage = currentPage - maxPagesBeforeCurrentPage\n\t\t\tendPage = currentPage + maxPagesAfterCurrentPage\n\t\t}\n\t}\n\n\t// calculate start and end item indexes\n\tconst startIndex = (currentPage - 1) * pageSize\n\tconst endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1)\n\n\t// create an array of pages to ng-repeat in the pager control\n\tconst pages = Array.from(Array(endPage + 1 - startPage).keys()).map(i => startPage + i)\n\n\t// return object with all pager properties required by the view\n\treturn {\n\t\ttotalItems: totalItems,\n\t\tcurrentPage: currentPage,\n\t\tpageSize: pageSize,\n\t\ttotalPages: totalPages,\n\t\tstartPage: startPage,\n\t\tendPage: endPage,\n\t\tstartIndex: startIndex,\n\t\tendIndex: endIndex,\n\t\tpages: pages,\n\t}\n}\n","/*\n * Pagination\n */\n\n$class: \".gov-pagination\";\n\n#{$class} {\n\t@include base();\n\t&__list {\n\t\t@extend %reset-ul;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tflex-wrap: wrap;\n\t\tfont-weight: bold;\n\t\ttext-align: center;\n\t}\n\t&__list &__item {\n\t\t@extend %reset-ul-li;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tmargin: 0;\n\t\tpadding: rem-calc(2);\n\t\tborder-radius: $border-radius;\n\t\toverflow: hidden;\n\t\t&--arrow {\n\t\t\tdisplay: flex;\n\t\t}\n\t\t&--select {\n\t\t\tz-index: 1;\n\t\t\tdisplay: flex;\n\t\t\toverflow: visible;\n\t\t\tpadding: rem-calc(0 16);\n\t\t}\n\t}\n\t&__arrow {\n\t\tmargin: 0;\n\t}\n\t&__item--more {\n\t\t.gov-form-select {\n\t\t\tselect {\n\t\t\t\tborder: none !important;\n\t\t\t\tpadding-right: rem-calc(12) !important;\n\t\t\t}\n\t\t\t.gov-icon {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t}\n\t&__inner {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\talign-self: stretch;\n\t\twidth: 100%;\n\t\ttext-decoration: none;\n\t\t// Use hover styles from gov-button to active page button\n\t\t&[wcag-current=\"true\"] {\n\t\t\t@each $variant, $types in $button-variants {\n\t\t\t\t@each $type, $definitions in $types {\n\t\t\t\t\t&[type=\"#{$type}\"][variant=\"#{$variant}\"] {\n\t\t\t\t\t\t.element {\n\t\t\t\t\t\t\tbackground-color: deep-map-get($button-variants, $variant, $type, \"hover-bg\");\n\t\t\t\t\t\t\tcolor: deep-map-get($button-variants, $variant, $type, \"hover-color\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $pagination-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__inner {\n\t\t\t\t\t@include typography(get(\"font\", $definitions));\n\t\t\t\t\tfont-weight: inherit;\n\t\t\t\t\t.element {\n\t\t\t\t\t\tmin-width: get(\"button-size\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import Fragment from \"../../helpers/Fragment\"\nimport {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n\tPaginationClass,\n\tPaginationSizes,\n\tPaginationSizeType,\n\tPaginationType,\n\tPaginationTypes,\n\tPaginationVariants,\n\tPaginationVariantType,\n} from \"./constants\"\nimport {govHost, prepareClasses, toBoolAttrIfDefined} from \"../../helpers/Dom/template\"\nimport {paginate, Pagination} from \"./pagination\"\nimport {validateWcagLabel, validateWcagProp} from \"../../helpers/Validate/wcag\"\nimport {canValidateWcagOnRender} from \"../../helpers/Dom/win\"\nimport {delay} from \"../../utils/utils\"\nimport {createID} from \"../../utils/string.utils\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\nimport {createArrayRange} from \"../../utils/array.utils\"\nimport {FormSelectEvent} from \"../gov-form/select/gov-form-select.types\"\nimport {PaginationEvent} from \"./gov-pagination.types\"\n\n@Component({\n\ttag: \"gov-pagination\",\n\tstyleUrl: \"gov-pagination.scss\",\n})\nexport class GovPagination {\n\tprivate h: GovHost\n\tprivate readonly pageSelectId: string\n\tprivate readonly selectId: string\n\n\tprivate spreadSelectRef?: HTMLGovFormSelectElement\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.pageSelectId = createID(\"GovPageSelect\")\n\t\tthis.selectId = createID(\"GovSelect\")\n\t}\n\n\t@Element() readonly host: HTMLGovPaginationElement\n\t/**\n\t * Pagination type\n\t */\n\t@Prop() readonly type: PaginationType = \"button\"\n\t/**\n\t * Currently displayed page\n\t */\n\t@Prop() readonly current: number = 1\n\t/**\n\t * Total count of entries\n\t */\n\t@Prop() readonly total: number = 0\n\t/**\n\t * Set on active page\n\t */\n\t@Prop() readonly inverse: boolean\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({attribute: 'select-identifier'}) readonly selectIdentifier: string\n\t/**\n\t * Pagination's size\n\t */\n\t@Prop() readonly size?: PaginationSizeType = \"m\"\n\t/**\n\t * Style variation of the pagination.\n\t */\n\t@Prop() readonly variant?: PaginationVariantType = \"primary\"\n\t/**\n\t * Maximum number of entries per page\n\t */\n\t@Prop({attribute: \"page-size\"}) readonly pageSize: number = 10\n\t/**\n\t * Maximum pages displayed for selection\n\t */\n\t@Prop({attribute: \"max-pages\"}) readonly maxPages: number = 5\n\t/**\n\t * Setting a link to redirect to a given page.\n\t * The {PAGE} wildcard can be used in the link to replace the page number.\n\t * Note that in the case of paging through a link, it is always necessary to send to the component the current page where the user is.\n\t */\n\t@Prop() readonly link: string\n\t/**\n\t * Adds accessible label for the pagination that is only shown for screen readers.\n\t */\n\t@Prop({attribute: \"wcag-label\"}) readonly wcagLabel: string\n\t/**\n\t * Indicates the id of a component that labels the pagination.\n\t */\n\t@Prop({attribute: \"wcag-labelled-by\"}) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the page select\n\t */\n\t@Prop({attribute: \"wcag-select-label\"}) readonly accessibleSelectLabel: string = \"Vybrat stranu\"\n\t/**\n\t * Adds accessible label for the page item\n\t */\n\t@Prop({attribute: \"wcag-page-label\"}) readonly accessiblePageLabel: string = \"Strana\"\n\t/**\n\t * Description of the possibility to go back one page\n\t */\n\t@Prop({attribute: \"label-prev\"}) readonly labelPrev = 'Přejít o stranu zpět'\n\t/**\n\t * Description of the option to go to the top of paging\n\t */\n\t@Prop({attribute: \"label-start\"}) readonly labelStart = 'Přejít na začátek'\n\t/**\n\t * Description of the option to go to the end of paging\n\t */\n\t@Prop({attribute: \"label-next\"}) readonly labelNext = 'Přejít na další stranu'\n\t/**\n\t * Description of the option to move one page forward\n\t */\n\t@Prop({attribute: \"label-end\"}) readonly labelEnd = 'Přejít na konec'\n\t/**\n\t * Event called when changing the page with the current setting of the whole paging\n\t */\n\t@Event({eventName: \"gov-page\"}) govPage: EventEmitter<PaginationEvent>\n\n\t@State() pagination: Pagination\n\n\t@Watch(\"type\")\n\tvalidateType(newValue: string): void {\n\t\tvalidateProp(PaginationTypes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(PaginationSizes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"variant\")\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(PaginationVariants, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"current\")\n\t@Watch(\"total\")\n\t@Watch(\"pageSize\")\n\t@Watch(\"maxPages\")\n\trecalculate(): void {\n\t\tthis.recalculatePagination(this.current)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.recalculatePagination(this.current)\n\t\tthis.validateSize(this.size)\n\t\tthis.validateVariant(this.variant)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tprivate recalculatePagination(currentPage: number) {\n\t\tthis.pagination = paginate(this.total, currentPage, this.pageSize, this.maxPages)\n\t}\n\n\tprivate isActivePageClass(originalClass: string, page: number) {\n\t\tif (this.pagination.currentPage === page) {\n\t\t\treturn originalClass + \" is-active\"\n\t\t} else {\n\t\t\treturn originalClass\n\t\t}\n\t}\n\n\tprivate prepareLinkUrl(page: number) {\n\t\tif (this.link) {\n\t\t\treturn String(this.link).replace(\"{PAGE}\", String(page))\n\t\t}\n\t\treturn undefined\n\t}\n\n\tprivate resetSelectValue() {\n\t\tif (this.spreadSelectRef) {\n\t\t\tthis.spreadSelectRef.getRef()\n\t\t\t\t.then((el: HTMLSelectElement) => {\n\t\t\t\t\tel.value = '...'\n\t\t\t\t})\n\t\t}\n\t}\n\n\trender() {\n\t\tconst pageResolver = (page: number, content: any, description: string) => {\n\t\t\tconst isDisabled = page === -1\n\t\t\tconst ariaCurrent = toBoolAttrIfDefined(this.pagination.currentPage === page ? true : undefined)\n\t\t\treturn (\n\t\t\t\t<gov-button\n\t\t\t\t\thref={this.prepareLinkUrl(page)}\n\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\tsize={this.size}\n\t\t\t\t\ttype=\"base\"\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\ton-gov-click={(e) => this.onClickHandler(e, page)}\n\t\t\t\t\twcag-label={description ? description : page > -1 ? this.accessiblePageLabel + \" \" + page : undefined}\n\t\t\t\t\twcag-current={ariaCurrent}\n\t\t\t\t\tclass={PaginationClass.inner}>\n\t\t\t\t\t{content}\n\t\t\t\t</gov-button>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<Host class={this.h.classes(PaginationClass.root)} type={this.type} variant={this.variant} size={this.size}>\n\t\t\t\t<nav aria-label={this.wcagLabel} aria-labelledby={this.wcagLabelledBy}>\n\t\t\t\t\t<ul class={PaginationClass.list}>\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.currentPage > 1 ? 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-left\"></gov-icon>,\n\t\t\t\t\t\t\t\tthis.labelStart\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.startPage < this.pagination.currentPage ? this.pagination.currentPage - 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-left\"></gov-icon>,\n\t\t\t\t\t\t\t\tthis.labelPrev\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t{this.type == \"select\" ? (\n\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemSelect])}>\n\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t{this.accessibleSelectLabel}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\t\t\t\tidentifier={this.selectIdentifier || this.selectId}\n\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={this.pagination.currentPage === page}>\n\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{this.pagination.pages.map(page => (\n\t\t\t\t\t\t\t\t\t<li class={this.isActivePageClass(PaginationClass.item, page)}>{pageResolver(page, page, '')}</li>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t{this.pagination.totalPages ? (\n\t\t\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemMore])}>\n\t\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t\t{this.accessibleSelectLabel}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\t\t\t\t\tidentifier={this.selectIdentifier || this.selectId}\n\t\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\t\tref={el => (this.spreadSelectRef = el as HTMLGovFormSelectElement)}\n\t\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t\t<option selected hidden>...</option>\n\t\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={false}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.currentPage + 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-right\"></gov-icon>,\n\t\t\t\t\t\t\t\tthis.labelNext\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.totalPages : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-right\"></gov-icon>,\n\t\t\t\t\t\t\t\tthis.labelEnd\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e: CustomEvent, page: number): void {\n\t\te.stopPropagation()\n\t\tthis.recalculatePagination(page)\n\t\tthis.govPage.emit({\n\t\t\tcomponent: PaginationClass.root,\n\t\t\tpagination: this.pagination\n\t\t})\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent<FormSelectEvent>): void {\n\t\te.stopPropagation()\n\t\tconst value = e.detail.value\n\t\tconst page = parseInt(value)\n\t\tthis.resetSelectValue()\n\t\tif (isNaN(page) === false) {\n\t\t\tthis.recalculatePagination(page)\n\t\t\tif (this.link) {\n\t\t\t\twindow.location.href = this.prepareLinkUrl(page)\n\t\t\t} else {\n\t\t\t\tthis.govPage.emit({\n\t\t\t\t\tcomponent: PaginationClass.root,\n\t\t\t\t\tpagination: this.pagination\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagProp(this.accessiblePageLabel, \"wcag-page-label\", PaginationClass.root)\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, PaginationClass.root)\n\t}\n}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AAc,GAAK,EAC9F0B,EAAA,YAAUkD,MAAOvF,EAAgBQ,MAAOqF,KAAK,kBAC7CzD,KAAKuE,YAIPtE,EAAA,MAAIkD,MAAOK,EAAe,CAAC5F,EAAgBG,KAAMH,EAAgBI,aAC/DuE,EACAvC,KAAKsB,WAAW5C,WAAasB,KAAKsB,WAAW/C,YAAcyB,KAAKsB,WAAW5C,YAAc,EACzFuB,EAAA,YAAUkD,MAAOvF,EAAgBQ,MAAOqF,KAAK,yBAC7CzD,KAAKwE,a,CASJ,cAAAvB,CAAeD,EAAgBtB,GACtCsB,EAAEyB,kBACFzE,KAAKa,sBAAsBa,GAC3B1B,KAAK0E,QAAQC,KAAK,CACjBC,UAAWhH,EAAgBC,KAC3ByD,WAAYtB,KAAKsB,Y,CAIX,eAAA2C,CAAgBjB,GACvBA,EAAEyB,kBACF,MAAMpC,EAAQW,EAAE6B,OAAOxC,MACvB,MAAMX,EAAOoD,SAASzC,GACtBrC,KAAKgC,mBACL,GAAI+C,MAAMrD,KAAU,MAAO,CAC1B1B,KAAKa,sBAAsBa,GAC3B,GAAI1B,KAAK4B,KAAM,CACdoD,OAAOC,SAASpC,KAAO7C,KAAK2B,eAAeD,E,KACrC,CACN1B,KAAK0E,QAAQC,KAAK,CACjBC,UAAWhH,EAAgBC,KAC3ByD,WAAYtB,KAAKsB,Y,GAUrB,kBAAMD,GACL6D,EAAiBlF,KAAKkD,cAAe,kBAAmBtF,EAAgBC,MACxEsH,EAAkBnF,KAAKsD,UAAWtD,KAAKuD,eAAgB3F,EAAgBC,K","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e,c as o,h as i,a as t,g as r}from"./p-0a5b0f7d.js";import{g as s,n as c,o as l,p as n}from"./p-c98fe646.js";import{g as a,a as g,t as v}from"./p-4191acf2.js";import{c as m}from"./p-e618f1cb.js";import{v as f}from"./p-344c72d7.js";import{a as d,b as h}from"./p-92b7481f.js";import{c as p}from"./p-95d41a3b.js";import{d as u}from"./p-e0e2e9c1.js";import{p as z}from"./p-ded281e6.js";import{t as x}from"./p-240c302e.js";import"./p-92f420cb.js";import"./p-03dbb8b1.js";import"./p-f0d542f2.js";import"./p-45b869ae.js";import"./p-7ba4daf4.js";import"./p-e296ca83.js";import"./p-2aedc81e.js";const w='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-select{position:relative;display:flex;width:100%;align-items:center}.gov-form-select .element{position:relative;display:flex;flex:1 1 auto}.gov-form-select input,.gov-form-select select,.gov-form-select textarea{width:100%;border-radius:var(--gov-border-radius, 0.1875rem);background-color:var(--gov-form-bg-color, var(--gov-color-neutral-white));font-family:var(--gov-font-family, "Roboto", sans-serif)}.gov-form-select input:focus,.gov-form-select select:focus,.gov-form-select textarea:focus{outline:none}.gov-form-select input:focus-visible,.gov-form-select select:focus-visible,.gov-form-select textarea:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:0}.gov-form-select input::-moz-placeholder,.gov-form-select select::-moz-placeholder,.gov-form-select textarea::-moz-placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select input::placeholder,.gov-form-select select::placeholder,.gov-form-select textarea::placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select textarea{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);padding:0.5rem 0.75rem;resize:none}.gov-form-select *[slot=left-icon],.gov-form-select *[slot=right-icon]{position:absolute;top:50%;display:flex;justify-content:center;transform:translateY(-50%);pointer-events:none}.gov-form-select *[slot=left-icon]{left:0}.gov-form-select *[slot=right-icon]{right:0}.gov-form-select *[slot=prefix],.gov-form-select *[slot=sufix]{margin:0}[size=s].gov-form-select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);gap:0.5rem var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select input,[size=s].gov-form-select select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);height:var(--gov-form-input-core-s-height, 2rem);padding:var(--gov-form-input-core-s-padding, 0.25rem 0.75rem)}[size=s].gov-form-select *[slot=left-icon],[size=s].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-s-icon-size, 1rem);height:var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=s].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=right-icon]~input,[size=s].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=m].gov-form-select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);gap:0.5rem var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select input,[size=m].gov-form-select select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);height:var(--gov-form-input-core-m-height, 2.5rem);padding:var(--gov-form-input-core-m-padding, 0.4375rem 0.75rem)}[size=m].gov-form-select *[slot=left-icon],[size=m].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-m-icon-size, 1rem);height:var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=m].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=right-icon]~input,[size=m].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=l].gov-form-select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);gap:0.5rem var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select input,[size=l].gov-form-select select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);height:var(--gov-form-input-core-l-height, 3rem);padding:var(--gov-form-input-core-l-padding, 0.6875rem 0.75rem)}[size=l].gov-form-select *[slot=left-icon],[size=l].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-l-icon-size, 1rem);height:var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=l].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=right-icon]~input,[size=l].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=xl].gov-form-select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);gap:0.5rem var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select input,[size=xl].gov-form-select select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);height:var(--gov-form-input-core-xl-height, 3.5rem);padding:var(--gov-form-input-core-xl-padding, 0.9375rem 1rem 0.875rem)}[size=xl].gov-form-select *[slot=left-icon],[size=xl].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-xl-icon-size, 1.25rem);height:var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-xl-icon-padding, 3rem)}[size=xl].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=right-icon]~input,[size=xl].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-xl-icon-padding, 3rem)}[variant=primary].gov-form-select input,[variant=primary].gov-form-select select,[variant=primary].gov-form-select textarea{color:var(--gov-form-input-color-primary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-primary, 0.0625rem solid var(--gov-color-primary-600))}[variant=primary].gov-form-select *[slot=left-icon],[variant=primary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-primary, var(--gov-color-primary))}[variant=secondary].gov-form-select input,[variant=secondary].gov-form-select select,[variant=secondary].gov-form-select textarea{color:var(--gov-form-input-color-secondary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-secondary, 0.0625rem solid var(--gov-color-secondary-700))}[variant=secondary].gov-form-select *[slot=left-icon],[variant=secondary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-secondary, var(--gov-color-primary))}[disabled=""].gov-form-select,[disabled=true i].gov-form-select,[disabled="1"].gov-form-select{pointer-events:none}[disabled=""].gov-form-select input,[disabled=""].gov-form-select select,[disabled=""].gov-form-select textarea,[disabled=true i].gov-form-select input,[disabled=true i].gov-form-select select,[disabled=true i].gov-form-select textarea,[disabled="1"].gov-form-select input,[disabled="1"].gov-form-select select,[disabled="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600));background:var(--gov-form-input-disabled-bg, var(--gov-color-secondary-300));color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600))}[disabled=""].gov-form-select *[slot=left-icon],[disabled=""].gov-form-select *[slot=right-icon],[disabled=true i].gov-form-select *[slot=left-icon],[disabled=true i].gov-form-select *[slot=right-icon],[disabled="1"].gov-form-select *[slot=left-icon],[disabled="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600)) !important}[invalid=""].gov-form-select input,[invalid=""].gov-form-select select,[invalid=""].gov-form-select textarea,[invalid=true i].gov-form-select input,[invalid=true i].gov-form-select select,[invalid=true i].gov-form-select textarea,[invalid="1"].gov-form-select input,[invalid="1"].gov-form-select select,[invalid="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-error, var(--gov-color-error));color:var(--gov-form-state-color-error, var(--gov-color-error))}[invalid=""].gov-form-select input::-moz-placeholder,[invalid=""].gov-form-select select::-moz-placeholder,[invalid=""].gov-form-select textarea::-moz-placeholder,[invalid=true i].gov-form-select input::-moz-placeholder,[invalid=true i].gov-form-select select::-moz-placeholder,[invalid=true i].gov-form-select textarea::-moz-placeholder,[invalid="1"].gov-form-select input::-moz-placeholder,[invalid="1"].gov-form-select select::-moz-placeholder,[invalid="1"].gov-form-select textarea::-moz-placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select input::placeholder,[invalid=""].gov-form-select select::placeholder,[invalid=""].gov-form-select textarea::placeholder,[invalid=true i].gov-form-select input::placeholder,[invalid=true i].gov-form-select select::placeholder,[invalid=true i].gov-form-select textarea::placeholder,[invalid="1"].gov-form-select input::placeholder,[invalid="1"].gov-form-select select::placeholder,[invalid="1"].gov-form-select textarea::placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select *[slot=left-icon],[invalid=""].gov-form-select *[slot=right-icon],[invalid=true i].gov-form-select *[slot=left-icon],[invalid=true i].gov-form-select *[slot=right-icon],[invalid="1"].gov-form-select *[slot=left-icon],[invalid="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-error, var(--gov-color-error)) !important}[invalid=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[success=""].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-state-color-success, var(--gov-color-success))}[success=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[multiline=""].gov-form-select *[slot=left-icon],[multiline=""].gov-form-select *[slot=right-icon],[multiline=true i].gov-form-select *[slot=left-icon],[multiline=true i].gov-form-select *[slot=right-icon],[multiline="1"].gov-form-select *[slot=left-icon],[multiline="1"].gov-form-select *[slot=right-icon]{display:none}.gov-form-select{background:none}.gov-form-select select{-webkit-appearance:none;-moz-appearance:none}.gov-form-select select::-ms-expand{display:none}[size=s].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-s-arrow-right-position, 0.75rem);width:var(--gov-form-select-s-arrow-size, 0.75rem);height:var(--gov-form-select-s-arrow-size, 0.75rem)}[size=s][invalid=""].gov-form-select .icon-arrow,[size=s][invalid=true i].gov-form-select .icon-arrow,[size=s][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=s][success=""].gov-form-select .icon-arrow,[size=s][success=true i].gov-form-select .icon-arrow,[size=s][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=m].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-m-arrow-right-position, 1rem);width:var(--gov-form-select-m-arrow-size, 0.75rem);height:var(--gov-form-select-m-arrow-size, 0.75rem)}[size=m][invalid=""].gov-form-select .icon-arrow,[size=m][invalid=true i].gov-form-select .icon-arrow,[size=m][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=m][success=""].gov-form-select .icon-arrow,[size=m][success=true i].gov-form-select .icon-arrow,[size=m][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=l].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-l-arrow-right-position, 1rem);width:var(--gov-form-select-l-arrow-size, 1rem);height:var(--gov-form-select-l-arrow-size, 1rem)}[size=l][invalid=""].gov-form-select .icon-arrow,[size=l][invalid=true i].gov-form-select .icon-arrow,[size=l][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=l][success=""].gov-form-select .icon-arrow,[size=l][success=true i].gov-form-select .icon-arrow,[size=l][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=xl].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-xl-arrow-right-position, 1.3125rem);width:var(--gov-form-select-xl-arrow-size, 1rem);height:var(--gov-form-select-xl-arrow-size, 1rem)}[size=xl][invalid=""].gov-form-select .icon-arrow,[size=xl][invalid=true i].gov-form-select .icon-arrow,[size=xl][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=xl][success=""].gov-form-select .icon-arrow,[size=xl][success=true i].gov-form-select .icon-arrow,[size=xl][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=s][invalid=""].gov-form-select *[slot=right-icon]~select,[size=s][invalid=""].gov-form-select *[slot=right-icon]~input,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=s][success=""].gov-form-select *[slot=right-icon]~select,[size=s][success=""].gov-form-select *[slot=right-icon]~input,[size=s][success=true i].gov-form-select *[slot=right-icon]~select,[size=s][success=true i].gov-form-select *[slot=right-icon]~input,[size=s][success="1"].gov-form-select *[slot=right-icon]~select,[size=s][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=m][invalid=""].gov-form-select *[slot=right-icon]~select,[size=m][invalid=""].gov-form-select *[slot=right-icon]~input,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=m][success=""].gov-form-select *[slot=right-icon]~select,[size=m][success=""].gov-form-select *[slot=right-icon]~input,[size=m][success=true i].gov-form-select *[slot=right-icon]~select,[size=m][success=true i].gov-form-select *[slot=right-icon]~input,[size=m][success="1"].gov-form-select *[slot=right-icon]~select,[size=m][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=l][invalid=""].gov-form-select *[slot=right-icon]~select,[size=l][invalid=""].gov-form-select *[slot=right-icon]~input,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=l][success=""].gov-form-select *[slot=right-icon]~select,[size=l][success=""].gov-form-select *[slot=right-icon]~input,[size=l][success=true i].gov-form-select *[slot=right-icon]~select,[size=l][success=true i].gov-form-select *[slot=right-icon]~input,[size=l][success="1"].gov-form-select *[slot=right-icon]~select,[size=l][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=xl][invalid=""].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=""].gov-form-select *[slot=right-icon]~input,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}[size=xl][success=""].gov-form-select *[slot=right-icon]~select,[size=xl][success=""].gov-form-select *[slot=right-icon]~input,[size=xl][success=true i].gov-form-select *[slot=right-icon]~select,[size=xl][success=true i].gov-form-select *[slot=right-icon]~input,[size=xl][success="1"].gov-form-select *[slot=right-icon]~select,[size=xl][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}';const b=w;const y=class{constructor(i){e(this,i);this.govFocus=o(this,"gov-focus",7);this.govBlur=o(this,"gov-blur",7);this.govChange=o(this,"gov-change",7);this.value=undefined;this.options=undefined;this.identifier=undefined;this.variant="secondary";this.size="m";this.name=undefined;this.required=false;this.success=undefined;this.disabled=false;this.invalid=undefined;this.wcagActiveDescendant=undefined;this.wcagControls=undefined;this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagOwns=undefined;this.focused=undefined;this.optionsState=[];this.h=a(this.host);this.f=s(this.h);this.selectId=p("GovSelect")}validateVariant(e){f(l,e,c.root)}validateSize(e){f(n,e,c.root)}watchOptions(e){this.optionsState=z(e)}watchDisabled(){this.passControlAttrs()}watchValue(){this.markSelectedValue()}passControlAttrs(){this.f.passAttrToControl("size",this.size);this.f.passAttrToControl("invalid",g(this.invalid));this.f.passAttrToControl("type","select")}componentWillLoad(){this.validateVariant(this.variant);this.validateSize(this.size);this.markSelectedValue();this.passControlAttrs();this.f.passAttrToLabel("required",String(this.required));this.optionsState=z(this.options)}async componentDidRender(){if(m()){await u(500);await this.validateWcag()}x((()=>this.markSelectedValue()))}markSelectedValue(){this.host.querySelectorAll("option").forEach((e=>{if(e.value===this.value){e.setAttribute("selected","selected")}else{e.removeAttribute("selected")}}))}render(){return i(t,{key:"5e9b2cdd4aae50ae5ee5ce8fe35db02888d682db",class:c.root,size:this.size,variant:this.variant},this.h.hasSlot("prefix")&&i("slot",{key:"1eb66206a8dd47a44496c1566cd386b5183766ee",name:"prefix"}),i("span",{key:"df3d012666a80ca6e2ad96981f04f2adda0d8654",class:"element"},i("gov-icon",{key:"e8ad512230dec7eb045e4dc91169b16709674f0b",slot:"right-icon",name:"chevron-down",class:"icon-arrow"}),this.h.hasSlot("right-icon")&&!(this.success||this.invalid)&&i("slot",{key:"f05864931816635b3dc3c4613680ba5c1dac0283",name:"right-icon"}),this.success&&i("gov-icon",{key:"e5d8ad5dc8a6c5c14a1db233426ab2f56e4da6d3",slot:"right-icon",class:"icon-validation",name:"check-lg"}),this.invalid&&i("gov-icon",{key:"c63c87a6cfc3eafdb979ebd40e019e3f65ecd35f",slot:"right-icon",class:"icon-validation",name:"exclamation-lg"}),i("select",{key:"b0d5876fb44872b8189870d7cf8ac374612153c7",id:this.identifier||this.selectId,onFocus:this.onFocusHandler.bind(this),onChange:this.onChangeHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,name:this.name,disabled:this.disabled,ref:e=>this.selectRef=e,"aria-disabled":v(this.disabled),"aria-activedescendant":this.wcagActiveDescendant,"aria-controls":this.wcagControls,"aria-required":v(this.required),"aria-invalid":v(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-owns":this.wcagOwns},i("slot",{key:"5edd39b36e1dc407a26c28e41eda625e9a780f3f"}),Array.isArray(this.optionsState)&&this.optionsState.map((e=>{var o;return i("option",{value:e.value,selected:e.value===this.value,disabled:e===null||e===void 0?void 0:e.disabled},(o=e.label)!==null&&o!==void 0?o:e.value)})))),this.h.hasSlot("sufix")&&i("slot",{key:"9d2e12ec4dda23883e70b65773a7936cc231d03c",name:"sufix"}))}onFocusHandler(e){this.focused=true;this.govFocus.emit({component:c.root,originalEvent:e,value:this.value})}onBlurHandler(e){this.focused=false;this.govBlur.emit({component:c.root,originalEvent:e,value:this.value})}onChangeHandler(e){this.value=e.target.value;e.stopPropagation();this.govChange.emit({component:c.root,originalEvent:e,value:this.value})}async setFocus(e){return this.selectRef.focus(e)}async getRef(){return this.selectRef}async validateWcag(){d(this.wcagActiveDescendant,"wcag-active-descendant",c.root);d(this.wcagControls,"wcag-controls",c.root);d(this.wcagDescribedBy,"wcag-described-by",c.root);d(this.wcagOwns,"wcag-owns",c.root);h(this.identifier||this.selectId,this.wcagLabelledBy,c.root)}get host(){return r(this)}static get watchers(){return{variant:["validateVariant"],size:["validateSize","watchDisabled"],options:["watchOptions"],disabled:["watchDisabled"],invalid:["watchDisabled"],value:["watchValue"]}}};y.style=b;export{y as gov_form_select};
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as e,c as o,h as t,a as i,g as r}from"./p-0a5b0f7d.js";import{g as s,n as l,o as c,p as n}from"./p-c98fe646.js";import{g as a,a as g,t as v}from"./p-4191acf2.js";import{c as m}from"./p-e618f1cb.js";import{v as f}from"./p-344c72d7.js";import{a as d,b as h}from"./p-92b7481f.js";import{c as p}from"./p-95d41a3b.js";import{d as u}from"./p-e0e2e9c1.js";import{p as z}from"./p-ded281e6.js";import{t as x}from"./p-240c302e.js";import"./p-92f420cb.js";import"./p-03dbb8b1.js";import"./p-f0d542f2.js";import"./p-45b869ae.js";import"./p-7ba4daf4.js";import"./p-e296ca83.js";import"./p-2aedc81e.js";const w='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-select{position:relative;display:flex;width:100%;align-items:center}.gov-form-select .element{position:relative;display:flex;flex:1 1 auto}.gov-form-select input,.gov-form-select select,.gov-form-select textarea{width:100%;border-radius:var(--gov-border-radius, 0.1875rem);background-color:var(--gov-form-bg-color, var(--gov-color-neutral-white));font-family:var(--gov-font-family, "Roboto", sans-serif)}.gov-form-select input:focus,.gov-form-select select:focus,.gov-form-select textarea:focus{outline:none}.gov-form-select input:focus-visible,.gov-form-select select:focus-visible,.gov-form-select textarea:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:0}.gov-form-select input::-moz-placeholder,.gov-form-select select::-moz-placeholder,.gov-form-select textarea::-moz-placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select input::placeholder,.gov-form-select select::placeholder,.gov-form-select textarea::placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select textarea{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);padding:0.5rem 0.75rem;resize:none}.gov-form-select *[slot=left-icon],.gov-form-select *[slot=right-icon]{position:absolute;top:50%;display:flex;justify-content:center;transform:translateY(-50%);pointer-events:none}.gov-form-select *[slot=left-icon]{left:0}.gov-form-select *[slot=right-icon]{right:0}.gov-form-select *[slot=prefix],.gov-form-select *[slot=sufix]{margin:0}[size=s].gov-form-select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);gap:0.5rem var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select input,[size=s].gov-form-select select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);height:var(--gov-form-input-core-s-height, 2rem);padding:var(--gov-form-input-core-s-padding, 0.25rem 0.75rem)}[size=s].gov-form-select *[slot=left-icon],[size=s].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-s-icon-size, 1rem);height:var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=s].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=right-icon]~input,[size=s].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=m].gov-form-select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);gap:0.5rem var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select input,[size=m].gov-form-select select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);height:var(--gov-form-input-core-m-height, 2.5rem);padding:var(--gov-form-input-core-m-padding, 0.4375rem 0.75rem)}[size=m].gov-form-select *[slot=left-icon],[size=m].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-m-icon-size, 1rem);height:var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=m].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=right-icon]~input,[size=m].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=l].gov-form-select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);gap:0.5rem var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select input,[size=l].gov-form-select select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);height:var(--gov-form-input-core-l-height, 3rem);padding:var(--gov-form-input-core-l-padding, 0.6875rem 0.75rem)}[size=l].gov-form-select *[slot=left-icon],[size=l].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-l-icon-size, 1rem);height:var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=l].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=right-icon]~input,[size=l].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=xl].gov-form-select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);gap:0.5rem var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select input,[size=xl].gov-form-select select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);height:var(--gov-form-input-core-xl-height, 3.5rem);padding:var(--gov-form-input-core-xl-padding, 0.9375rem 1rem 0.875rem)}[size=xl].gov-form-select *[slot=left-icon],[size=xl].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-xl-icon-size, 1.25rem);height:var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-xl-icon-padding, 3rem)}[size=xl].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=right-icon]~input,[size=xl].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-xl-icon-padding, 3rem)}[variant=primary].gov-form-select input,[variant=primary].gov-form-select select,[variant=primary].gov-form-select textarea{color:var(--gov-form-input-color-primary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-primary, 0.0625rem solid var(--gov-color-primary-600))}[variant=primary].gov-form-select *[slot=left-icon],[variant=primary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-primary, var(--gov-color-primary))}[variant=secondary].gov-form-select input,[variant=secondary].gov-form-select select,[variant=secondary].gov-form-select textarea{color:var(--gov-form-input-color-secondary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-secondary, 0.0625rem solid var(--gov-color-secondary-700))}[variant=secondary].gov-form-select *[slot=left-icon],[variant=secondary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-secondary, var(--gov-color-primary))}[disabled=""].gov-form-select,[disabled=true i].gov-form-select,[disabled="1"].gov-form-select{pointer-events:none}[disabled=""].gov-form-select input,[disabled=""].gov-form-select select,[disabled=""].gov-form-select textarea,[disabled=true i].gov-form-select input,[disabled=true i].gov-form-select select,[disabled=true i].gov-form-select textarea,[disabled="1"].gov-form-select input,[disabled="1"].gov-form-select select,[disabled="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600));background:var(--gov-form-input-disabled-bg, var(--gov-color-secondary-300));color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600))}[disabled=""].gov-form-select *[slot=left-icon],[disabled=""].gov-form-select *[slot=right-icon],[disabled=true i].gov-form-select *[slot=left-icon],[disabled=true i].gov-form-select *[slot=right-icon],[disabled="1"].gov-form-select *[slot=left-icon],[disabled="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600)) !important}[invalid=""].gov-form-select input,[invalid=""].gov-form-select select,[invalid=""].gov-form-select textarea,[invalid=true i].gov-form-select input,[invalid=true i].gov-form-select select,[invalid=true i].gov-form-select textarea,[invalid="1"].gov-form-select input,[invalid="1"].gov-form-select select,[invalid="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-error, var(--gov-color-error));color:var(--gov-form-state-color-error, var(--gov-color-error))}[invalid=""].gov-form-select input::-moz-placeholder,[invalid=""].gov-form-select select::-moz-placeholder,[invalid=""].gov-form-select textarea::-moz-placeholder,[invalid=true i].gov-form-select input::-moz-placeholder,[invalid=true i].gov-form-select select::-moz-placeholder,[invalid=true i].gov-form-select textarea::-moz-placeholder,[invalid="1"].gov-form-select input::-moz-placeholder,[invalid="1"].gov-form-select select::-moz-placeholder,[invalid="1"].gov-form-select textarea::-moz-placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select input::placeholder,[invalid=""].gov-form-select select::placeholder,[invalid=""].gov-form-select textarea::placeholder,[invalid=true i].gov-form-select input::placeholder,[invalid=true i].gov-form-select select::placeholder,[invalid=true i].gov-form-select textarea::placeholder,[invalid="1"].gov-form-select input::placeholder,[invalid="1"].gov-form-select select::placeholder,[invalid="1"].gov-form-select textarea::placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select *[slot=left-icon],[invalid=""].gov-form-select *[slot=right-icon],[invalid=true i].gov-form-select *[slot=left-icon],[invalid=true i].gov-form-select *[slot=right-icon],[invalid="1"].gov-form-select *[slot=left-icon],[invalid="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-error, var(--gov-color-error)) !important}[invalid=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[success=""].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-state-color-success, var(--gov-color-success))}[success=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[multiline=""].gov-form-select *[slot=left-icon],[multiline=""].gov-form-select *[slot=right-icon],[multiline=true i].gov-form-select *[slot=left-icon],[multiline=true i].gov-form-select *[slot=right-icon],[multiline="1"].gov-form-select *[slot=left-icon],[multiline="1"].gov-form-select *[slot=right-icon]{display:none}.gov-form-select{background:none}.gov-form-select select{-webkit-appearance:none;-moz-appearance:none}.gov-form-select select::-ms-expand{display:none}[size=s].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-s-arrow-right-position, 0.75rem);width:var(--gov-form-select-s-arrow-size, 0.75rem);height:var(--gov-form-select-s-arrow-size, 0.75rem)}[size=s][invalid=""].gov-form-select .icon-arrow,[size=s][invalid=true i].gov-form-select .icon-arrow,[size=s][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=s][success=""].gov-form-select .icon-arrow,[size=s][success=true i].gov-form-select .icon-arrow,[size=s][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=m].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-m-arrow-right-position, 1rem);width:var(--gov-form-select-m-arrow-size, 0.75rem);height:var(--gov-form-select-m-arrow-size, 0.75rem)}[size=m][invalid=""].gov-form-select .icon-arrow,[size=m][invalid=true i].gov-form-select .icon-arrow,[size=m][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=m][success=""].gov-form-select .icon-arrow,[size=m][success=true i].gov-form-select .icon-arrow,[size=m][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=l].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-l-arrow-right-position, 1rem);width:var(--gov-form-select-l-arrow-size, 1rem);height:var(--gov-form-select-l-arrow-size, 1rem)}[size=l][invalid=""].gov-form-select .icon-arrow,[size=l][invalid=true i].gov-form-select .icon-arrow,[size=l][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=l][success=""].gov-form-select .icon-arrow,[size=l][success=true i].gov-form-select .icon-arrow,[size=l][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=xl].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-xl-arrow-right-position, 1.3125rem);width:var(--gov-form-select-xl-arrow-size, 1rem);height:var(--gov-form-select-xl-arrow-size, 1rem)}[size=xl][invalid=""].gov-form-select .icon-arrow,[size=xl][invalid=true i].gov-form-select .icon-arrow,[size=xl][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=xl][success=""].gov-form-select .icon-arrow,[size=xl][success=true i].gov-form-select .icon-arrow,[size=xl][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=s][invalid=""].gov-form-select *[slot=right-icon]~select,[size=s][invalid=""].gov-form-select *[slot=right-icon]~input,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=s][success=""].gov-form-select *[slot=right-icon]~select,[size=s][success=""].gov-form-select *[slot=right-icon]~input,[size=s][success=true i].gov-form-select *[slot=right-icon]~select,[size=s][success=true i].gov-form-select *[slot=right-icon]~input,[size=s][success="1"].gov-form-select *[slot=right-icon]~select,[size=s][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=m][invalid=""].gov-form-select *[slot=right-icon]~select,[size=m][invalid=""].gov-form-select *[slot=right-icon]~input,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=m][success=""].gov-form-select *[slot=right-icon]~select,[size=m][success=""].gov-form-select *[slot=right-icon]~input,[size=m][success=true i].gov-form-select *[slot=right-icon]~select,[size=m][success=true i].gov-form-select *[slot=right-icon]~input,[size=m][success="1"].gov-form-select *[slot=right-icon]~select,[size=m][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=l][invalid=""].gov-form-select *[slot=right-icon]~select,[size=l][invalid=""].gov-form-select *[slot=right-icon]~input,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=l][success=""].gov-form-select *[slot=right-icon]~select,[size=l][success=""].gov-form-select *[slot=right-icon]~input,[size=l][success=true i].gov-form-select *[slot=right-icon]~select,[size=l][success=true i].gov-form-select *[slot=right-icon]~input,[size=l][success="1"].gov-form-select *[slot=right-icon]~select,[size=l][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=xl][invalid=""].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=""].gov-form-select *[slot=right-icon]~input,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}[size=xl][success=""].gov-form-select *[slot=right-icon]~select,[size=xl][success=""].gov-form-select *[slot=right-icon]~input,[size=xl][success=true i].gov-form-select *[slot=right-icon]~select,[size=xl][success=true i].gov-form-select *[slot=right-icon]~input,[size=xl][success="1"].gov-form-select *[slot=right-icon]~select,[size=xl][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}';const b=w;const y=class{constructor(t){e(this,t);this.govFocus=o(this,"gov-focus",7);this.govBlur=o(this,"gov-blur",7);this.govChange=o(this,"gov-change",7);this.value=undefined;this.options=undefined;this.identifier=undefined;this.variant="secondary";this.size="m";this.name=undefined;this.required=false;this.success=undefined;this.disabled=false;this.invalid=undefined;this.wcagActiveDescendant=undefined;this.wcagControls=undefined;this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagOwns=undefined;this.focused=undefined;this.optionsState=[];this.h=a(this.host);this.f=s(this.h);this.selectId=p("GovSelect")}validateVariant(e){f(c,e,l.root)}validateSize(e){f(n,e,l.root)}watchOptions(e){this.optionsState=z(e)}watchControlAttrs(){this.passControlAttrs()}watchValue(){this.markSelectedValue()}passControlAttrs(){this.f.passAttrToControl("size",this.size);this.f.passAttrToControl("invalid",g(this.invalid));this.f.passAttrToControl("success",g(this.success));this.f.passAttrToControl("disabled",g(this.disabled))}componentWillLoad(){this.validateVariant(this.variant);this.validateSize(this.size);this.markSelectedValue();this.passControlAttrs();this.f.passAttrToLabel("required",String(this.required));this.f.passAttrToControl("type","select");this.optionsState=z(this.options)}async componentDidRender(){if(m()){await u(500);await this.validateWcag()}x((()=>this.markSelectedValue()))}markSelectedValue(){this.host.querySelectorAll("option").forEach((e=>{if(e.value===this.value){e.setAttribute("selected","selected")}else{e.removeAttribute("selected")}}))}render(){return t(i,{key:"0ef3419f4afce93b161ad8b71401a228ae8b9c4a",class:l.root,size:this.size,variant:this.variant},this.h.hasSlot("prefix")&&t("slot",{key:"828f069b3672d5bb766a44ef37384b9117327eab",name:"prefix"}),t("span",{key:"169ac6c9d58c88bbdcc96f36b8208ea05faa8e51",class:"element"},t("gov-icon",{key:"a2501ad9ecc603d3e52fc0143fef2ee53ae63d4d",slot:"right-icon",name:"chevron-down",class:"icon-arrow"}),this.h.hasSlot("right-icon")&&!(this.success||this.invalid)&&t("slot",{key:"97b2417a96a781620b67a557244c4c0cfa8b3669",name:"right-icon"}),this.success&&t("gov-icon",{key:"cebe7eb826cb741bae4afdbd8d9b18948c410f8c",slot:"right-icon",class:"icon-validation",name:"check-lg"}),this.invalid&&t("gov-icon",{key:"cef9b5715b1c134242f52439f65b88c7d228054f",slot:"right-icon",class:"icon-validation",name:"exclamation-lg"}),t("select",{key:"b8374d51d9a66f313db7f851446916e22debeee3",id:this.identifier||this.selectId,onFocus:this.onFocusHandler.bind(this),onChange:this.onChangeHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,name:this.name,disabled:this.disabled,ref:e=>this.selectRef=e,"aria-disabled":v(this.disabled),"aria-activedescendant":this.wcagActiveDescendant,"aria-controls":this.wcagControls,"aria-required":v(this.required),"aria-invalid":v(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-owns":this.wcagOwns},t("slot",{key:"5ad33b529b013a1e4846aaf3d6a778a0e7652f83"}),Array.isArray(this.optionsState)&&this.optionsState.map((e=>{var o;return t("option",{value:e.value,selected:e.value===this.value,disabled:e===null||e===void 0?void 0:e.disabled},(o=e.label)!==null&&o!==void 0?o:e.value)})))),this.h.hasSlot("sufix")&&t("slot",{key:"257ebbc1fbe845806360efbf491640c2c364d540",name:"sufix"}))}onFocusHandler(e){this.focused=true;this.govFocus.emit({component:l.root,originalEvent:e,value:this.value})}onBlurHandler(e){this.focused=false;this.govBlur.emit({component:l.root,originalEvent:e,value:this.value})}onChangeHandler(e){this.value=e.target.value;e.stopPropagation();this.govChange.emit({component:l.root,originalEvent:e,value:this.value})}async setFocus(e){return this.selectRef.focus(e)}async getRef(){return this.selectRef}async validateWcag(){d(this.wcagActiveDescendant,"wcag-active-descendant",l.root);d(this.wcagControls,"wcag-controls",l.root);d(this.wcagDescribedBy,"wcag-described-by",l.root);d(this.wcagOwns,"wcag-owns",l.root);h(this.identifier||this.selectId,this.wcagLabelledBy,l.root)}get host(){return r(this)}static get watchers(){return{variant:["validateVariant"],size:["validateSize","watchControlAttrs"],options:["watchOptions"],disabled:["watchControlAttrs"],invalid:["watchControlAttrs"],success:["watchControlAttrs"],value:["watchValue"]}}};y.style=b;export{y as gov_form_select};
|
|
2
|
+
//# sourceMappingURL=p-74627eb2.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["govFormSelectCss","GovFormSelectStyle0","GovFormSelect","constructor","hostRef","this","h","govHost","host","f","govForm","selectId","createID","validateVariant","newValue","validateProp","FormSelectVariants","FormSelectClass","root","validateSize","FormSelectSizes","watchOptions","optionsState","propsValueToArray","watchControlAttrs","passControlAttrs","watchValue","markSelectedValue","passAttrToControl","size","toBoolAttr","invalid","success","disabled","componentWillLoad","variant","passAttrToLabel","String","required","options","componentDidRender","canValidateWcagOnRender","delay","validateWcag","tick","querySelectorAll","forEach","option","value","setAttribute","removeAttribute","render","Host","key","class","hasSlot","name","slot","id","identifier","onFocus","onFocusHandler","bind","onChange","onChangeHandler","onBlur","onBlurHandler","ref","el","selectRef","toBoolAttrIfDefined","wcagActiveDescendant","wcagControls","wcagDescribedBy","wcagLabelledBy","wcagOwns","Array","isArray","map","selected","_a","label","e","focused","govFocus","emit","component","originalEvent","govBlur","target","stopPropagation","govChange","setFocus","focus","getRef","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/components/gov-form/select/gov-form-select.scss?tag=gov-form-select","../../../packages/core/src/components/gov-form/select/gov-form-select.tsx"],"sourcesContent":["/*\n * Select\n */\n\n@import \"../select/gov-form-select-core.scss\";\n\n$class: \".gov-form-select\";\n\n#{$class} {\n\t@extend %form-select-core;\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from '@stencil/core'\nimport {govForm} from '../../../helpers/Dom/form'\nimport {GovForm} from '../../../helpers/Dom/form.types'\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from '../../../helpers/Dom/template'\nimport {GovHost} from '../../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../../helpers/Dom/win'\nimport {validateProp} from '../../../helpers/Validate/props'\nimport {validateWcagLabelFor, validateWcagRef} from '../../../helpers/Validate/wcag'\nimport {createID} from '../../../utils/string.utils'\nimport {delay} from '../../../utils/utils'\nimport {\n\tFormSelectClass,\n\tFormSelectSizes,\n\tFormSelectSizesType,\n\tFormSelectVariants,\n\tFormSelectVariantType\n} from './constants'\nimport {FormSelectEvent, FormSelectOption} from './gov-form-select.types'\nimport {propsValueToArray} from \"../../../utils/array.utils\";\nimport {tick} from \"../../../utils/stencil.utils\";\n\n@Component({\n\ttag: 'gov-form-select',\n\tstyleUrl: 'gov-form-select.scss',\n})\nexport class GovFormSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\tprivate selectRef?: HTMLSelectElement\n\n\tprivate readonly selectId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t\tthis.selectId = createID('GovSelect')\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Value of select\n\t */\n\t@Prop({reflect: true, mutable: true}) value: string\n\t/**\n\t * Options of select\n\t */\n\t@Prop({reflect: true, mutable: true}) options?: string | FormSelectOption[]\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({attribute: 'identifier'}) readonly identifier: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormSelectVariantType = 'secondary'\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormSelectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a related component’s visually focused element.\n\t */\n\t@Prop({attribute: 'wcag-active-descendant'}) readonly wcagActiveDescendant: string\n\t/**\n\t * Use this prop to add an aria-controls attribute. Use the attribute to indicate the id of a component controlled by this component.\n\t */\n\t@Prop({attribute: 'wcag-controls'}) readonly wcagControls: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-described-by'}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: 'wcag-labelled-by'}) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-owns'}) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({eventName: 'gov-focus'}) govFocus: EventEmitter<FormSelectEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({eventName: 'gov-blur'}) govBlur: EventEmitter<FormSelectEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({eventName: 'gov-change'}) govChange: EventEmitter<FormSelectEvent>\n\t@State() focused: boolean\n\t@State() optionsState: FormSelectOption[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormSelectVariants, newValue, FormSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormSelectSizes, newValue, FormSelectClass.root)\n\t}\n\n\t@Watch('options')\n\twatchOptions(newValue: string | FormSelectOption[]): void {\n\t\tthis.optionsState = propsValueToArray(newValue)\n\t}\n\n\t@Watch('disabled')\n\t@Watch('invalid')\n\t@Watch('success')\n\t@Watch('size')\n\twatchControlAttrs(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@Watch('value')\n\twatchValue(): void {\n\t\tthis.markSelectedValue()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl('size', this.size)\n\t\tthis.f.passAttrToControl('invalid', toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl('success', toBoolAttr(this.success))\n\t\tthis.f.passAttrToControl('disabled', toBoolAttr(this.disabled))\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\n\t\tthis.markSelectedValue()\n\t\tthis.passControlAttrs()\n\t\tthis.f.passAttrToLabel('required', String(this.required))\n\t\tthis.f.passAttrToControl('type', 'select')\n\t\tthis.optionsState = propsValueToArray(this.options)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t\ttick(() => this.markSelectedValue())\n\t}\n\n\tprivate markSelectedValue() {\n\t\tthis.host.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.value === this.value) {\n\t\t\t\toption.setAttribute('selected', 'selected')\n\t\t\t} else {\n\t\t\t\toption.removeAttribute('selected')\n\t\t\t}\n\t\t})\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t{this.h.hasSlot('prefix') && <slot name=\"prefix\"></slot>}\n\t\t\t\t<span class=\"element\">\n\t\t\t\t\t<gov-icon slot=\"right-icon\" name=\"chevron-down\" class=\"icon-arrow\"></gov-icon>\n\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\"/>}\n\t\t\t\t\t{this.success && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t{this.invalid && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t<select\n\t\t\t\t\t\tid={this.identifier || this.selectId}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\taria-activedescendant={this.wcagActiveDescendant}\n\t\t\t\t\t\taria-controls={this.wcagControls}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t>\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t{Array.isArray(this.optionsState) && this.optionsState.map((option) => {\n\t\t\t\t\t\t\treturn (<option value={option.value} selected={option.value === this.value}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={option?.disabled}>{option.label ?? option.value}</option>)\n\t\t\t\t\t\t})}\n\t\t\t\t\t</select>\n\t\t\t\t</span>\n\t\t\t\t{this.h.hasSlot('sufix') && <slot name=\"sufix\"></slot>}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.value = (e.target as HTMLSelectElement).value\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagActiveDescendant, 'wcag-active-descendant', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagControls, 'wcag-controls', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormSelectClass.root)\n\t}\n}\n"],"mappings":"slBAAA,MAAMA,EAAmB,kxlBACzB,MAAAC,EAAeD,E,MCwBFE,EAAa,MA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618f1cb.js";import{v as c}from"./p-344c72d7.js";import{c as l,v}from"./p-92b7481f.js";import{c as b}from"./p-95d41a3b.js";import{d as g}from"./p-e0e2e9c1.js";import{T as d,a as h,b as p,c as m}from"./p-4faa3ba6.js";import{h as f}from"./p-2aedc81e.js";import"./p-e296ca83.js";import"./p-03dbb8b1.js";const y=".gov-tabs__list{margin:0;padding:0}.gov-tabs__list>.gov-tabs__item{margin:0;padding:0;background:none}.gov-tabs__list>.gov-tabs__item::before{display:none}.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-tabs{position:relative;display:block;width:100%}.gov-tabs__list{display:flex;flex-wrap:wrap;margin:0rem 0rem 1.25rem}.gov-tabs__list>.gov-tabs__item{display:flex;margin:0}.gov-tabs__btn{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);display:inline-flex;vertical-align:middle;justify-content:center;align-items:center;border:0;background-color:transparent;text-align:center;text-decoration:none;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;margin:0;padding:0.75rem 0rem 0.625rem;border-bottom:0.125rem solid transparent;font-weight:700;text-align:center;transition:150ms linear color, 150ms linear border-color}.gov-tabs__btn:focus{outline:none}.gov-tabs__btn:focus{outline:none}.gov-tabs__btn:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:0}.gov-tabs__btn[disabled]{cursor:not-allowed}.gov-tabs[type=text] .gov-tabs__list{gap:0.5rem 2rem;border-bottom:var(--gov-tabs-list-border-width, 0.0625rem solid var(--gov-color-secondary-500))}.gov-tabs[type=chip] .gov-tabs__list{gap:0.5rem 1rem}.gov-tabs[variant=primary][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-primary-color, var(--gov-color-primary))}@media not all and (pointer: coarse){.gov-tabs[variant=primary][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-primary-color-hover, var(--gov-color-primary-800))}}.gov-tabs[variant=primary][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-primary-color-active, var(--gov-color-primary-800));color:var(--gov-tabs-primary-color-active, var(--gov-color-primary-800))}.gov-tabs[variant=secondary][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-secondary-color, var(--gov-color-secondary-700))}@media not all and (pointer: coarse){.gov-tabs[variant=secondary][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-secondary-color-hover, var(--gov-color-secondary-900))}}.gov-tabs[variant=secondary][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-secondary-color-active, var(--gov-color-secondary-900));color:var(--gov-tabs-secondary-color-active, var(--gov-color-secondary-900))}.gov-tabs[variant=success][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-success-color, var(--gov-color-success-500))}@media not all and (pointer: coarse){.gov-tabs[variant=success][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-success-color-hover, var(--gov-color-success-700))}}.gov-tabs[variant=success][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-success-color-active, var(--gov-color-success-700));color:var(--gov-tabs-success-color-active, var(--gov-color-success-700))}.gov-tabs[variant=warning][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-warning-color, var(--gov-color-warning-500))}@media not all and (pointer: coarse){.gov-tabs[variant=warning][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-warning-color-hover, var(--gov-color-warning-700))}}.gov-tabs[variant=warning][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-warning-color-active, var(--gov-color-warning-700));color:var(--gov-tabs-warning-color-active, var(--gov-color-warning-700))}.gov-tabs[variant=error][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-error-color, var(--gov-color-error-400))}@media not all and (pointer: coarse){.gov-tabs[variant=error][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-error-color-hover, var(--gov-color-error-600))}}.gov-tabs[variant=error][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-error-color-active, var(--gov-color-error-600));color:var(--gov-tabs-error-color-active, var(--gov-color-error-600))}.gov-tabs[orientation=vertical] .gov-tabs__btn{text-align:left}@media (min-width: 75em){.gov-tabs[orientation=vertical]{display:flex;flex-direction:row}.gov-tabs[orientation=vertical] .gov-tabs__list{flex-wrap:nowrap;flex-direction:column;width:-moz-max-content;width:max-content;max-width:30vw;margin-right:1.25rem;padding:0rem 0.5rem;border-bottom:none;border-right:var(--gov-tabs-list-border-width, 0.0625rem solid var(--gov-color-secondary-500))}.gov-tabs[orientation=vertical] .gov-tabs__item{justify-content:flex-end}.gov-tabs[orientation=vertical] .gov-tabs__btn{padding:0.5rem 0.75rem;text-align:right}}";const _=y;const u=class{constructor(a){t(this,a);this.govChange=o(this,"gov-change",7);this.triggerRefs={};this.controllers=[];this.focusIndex=0;this.compactControls=false;this.type="text";this.variant="primary";this.orientation="horizontal";this.wcagLabel=undefined;this.wcagSelectLabel=undefined;this.wcagLabelledBy=undefined;this.h=s(this.host);this.formSelectId=b("GovFormSelect")}validateType(t){c(p,t,h.root)}validateVariant(t){c(m,t,h.root)}componentWillLoad(){this.prepareControllers()}async componentDidRender(){if(n()){await g(500);await this.validateWcag()}}prepareControllers(t=false){this.controllers=[];const o=[];this.host.querySelectorAll(d.root).forEach((t=>{const a=Promise.all([t.getIdentifier(),t.getTriggerIdentifier(),t.getDisableState()]).then((([o,a,r])=>{const e=typeof t.getAttribute("default")==="string";return{label:t.getAttribute("label"),contentIdentifier:o,disabled:r,triggerIdentifier:a,element:t,active:false,default:e}}));o.push(a)}));Promise.all(o).then((o=>{if(t===false){let t=o.findIndex((t=>t.default));if(t===-1)t=0;this.focusIndex=t;o[t].active=true}else if(this.focusIndex>-1&&f(o,this.focusIndex)){o[this.focusIndex].active=true}const a=o.findIndex((t=>t.active&&t.disabled));if(a>-1){o[a].active=false;const t=o.findIndex((t=>!t.disabled));if(t>-1){o[t].active=true;this.focusIndex=t}}this.controllers=[...o];this.reRender()}))}setActiveByIdentifier(t){const o=[];this.controllers.map((a=>{a.active=t===a.triggerIdentifier||t===a.contentIdentifier;o.push(a)}));this.controllers=[...o]}reRender(){this.controllers.map((t=>{t.element.setActiveStatus(t.active).catch()}))}render(){return a(r,{key:"c9268edb140ab2f89a200e24fb82489ac643bb5b",class:this.h.classes(h.root),variant:this.variant,type:this.type,role:"tablist","aria-label":this.wcagLabel,"aria-labelledby":this.wcagLabelledBy,onKeyDown:this.onKeydownHandler.bind(this)},a("div",{key:"41848142996bf01dc71ec80d396feb28d1d361d3",class:h.tabs,"aria-hidden":i(this.compactControls)},a("ul",{key:"dcbc258c22c0200a96b74aba9b50088484cc9d36",class:h.list},this.controllers.map((t=>a("li",{class:h.item},this.type=="text"?a("button",{class:h.btn,id:t.triggerIdentifier,role:"tab",onClick:()=>this.onSelectHandler(t),disabled:t.disabled,"aria-disabled":i(t.disabled),"aria-selected":i(t.active),"aria-controls":t.contentIdentifier,tabindex:t.active&&!t.disabled?0:-1,ref:o=>this.triggerRefs[t.triggerIdentifier]=o},t.label):a("gov-chip",{role:"tab",tag:"button",identifier:t.triggerIdentifier,"wcag-selected":t.active,"wcag-controls":t.contentIdentifier,focusable:t.active,disabled:t.disabled,variant:this.variant,inverse:!t.active,ref:o=>this.triggerRefs[t.triggerIdentifier]=o,"on-gov-click":()=>this.onSelectHandler(t)},t.label)))))),a("span",{key:"a7d9ec6aa331b24ba759f25cbfaefab3ffb3aa22",id:this.formSelectId,hidden:true},this.wcagSelectLabel),this.compactControls?a("gov-form-select",{"wcag-labelled-by":this.formSelectId,"onGov-change":this.onChangeHandler.bind(this)},this.controllers.map((t=>a("option",{value:t.triggerIdentifier,selected:t.active},t.label)))):null,a("slot",{key:"0b67266e6e5ef507c45202e92575d82be6946278"}))}getCurrentTab(){return this.controllers.find((t=>t.active))||null}onSelectHandler(t){const o=this.controllers.findIndex((o=>o.triggerIdentifier===t.triggerIdentifier));this.focusIndex=o;this.setActiveByIdentifier(t.triggerIdentifier);this.reRender();this.govChange.emit(this.getCurrentTab().element)}onChangeHandler(t){const o=t.target.value;t.stopPropagation();this.setActiveByIdentifier(o);this.reRender();this.govChange.emit(this.getCurrentTab().element)}onKeydownHandler(t){const o=t.keyCode;t.stopPropagation();this.goToPrevNext(o)}goToPrevNext(t){if([37,38,39,40].includes(t)){if(false===(this.focusIndex>=0&&this.focusIndex<=this.controllers.length-1)){return}this.controllers[this.focusIndex].active=false;if(t===39||t===40){this.focusIndex++;if(this.focusIndex>=this.controllers.length){this.focusIndex=0}if(this.controllers[this.focusIndex].disabled){this.goToPrevNext(40)}}else if(t===37||t===38){this.focusIndex--;if(this.focusIndex<0){this.focusIndex=this.controllers.length-1}if(this.controllers[this.focusIndex].disabled){this.goToPrevNext(38)}}if(this.focusIndex>=0&&this.focusIndex<=this.controllers.length-1){const t=this.controllers[this.focusIndex];t.active=true;const o=this.triggerRefs[t.triggerIdentifier];if(o.nodeName.toLowerCase()==="gov-chip"){this.triggerRefs[t.triggerIdentifier].setFocus()}else{this.triggerRefs[t.triggerIdentifier].focus()}this.controllers=[...this.controllers];this.reRender();this.govChange.emit(this.getCurrentTab().element)}}}async refresh(){this.prepareControllers()}async currentTab(){return this.getCurrentTab().element||null}async setActiveTab(t){this.setActiveByIdentifier(t);this.reRender()}async rerender(){this.prepareControllers(true)}async validateWcag(){l(this.wcagSelectLabel,"wcag-select-label",h.root);v(this.wcagLabel,this.wcagLabelledBy,h.root)}get host(){return e(this)}static get watchers(){return{type:["validateType"],variant:["validateVariant"]}}};u.style=_;export{u as gov_tabs};
|
|
2
|
-
|
|
1
|
+
import{r as t,c as o,h as a,a as r,g as e}from"./p-0a5b0f7d.js";import{g as s,a as i}from"./p-4191acf2.js";import{c as n}from"./p-e618f1cb.js";import{v as c}from"./p-344c72d7.js";import{c as l,v}from"./p-92b7481f.js";import{c as b}from"./p-95d41a3b.js";import{d as g}from"./p-e0e2e9c1.js";import{T as d,a as h,b as p,c as m}from"./p-4faa3ba6.js";import{h as f}from"./p-2aedc81e.js";import"./p-e296ca83.js";import"./p-03dbb8b1.js";const y=".gov-tabs__list{margin:0;padding:0}.gov-tabs__list>.gov-tabs__item{margin:0;padding:0;background:none}.gov-tabs__list>.gov-tabs__item::before{display:none}.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-tabs{position:relative;display:block;width:100%}.gov-tabs__list{display:flex;flex-wrap:wrap;margin:0rem 0rem 1.25rem}.gov-tabs__list>.gov-tabs__item{display:flex;margin:0}.gov-tabs__btn{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);display:inline-flex;vertical-align:middle;justify-content:center;align-items:center;border:0;background-color:transparent;text-align:center;text-decoration:none;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;margin:0;padding:0.75rem 0rem 0.625rem;border-bottom:0.125rem solid transparent;font-weight:700;text-align:center;transition:150ms linear color, 150ms linear border-color}.gov-tabs__btn:focus{outline:none}.gov-tabs__btn:focus{outline:none}.gov-tabs__btn:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:0}.gov-tabs__btn[disabled]{cursor:not-allowed}.gov-tabs[type=text] .gov-tabs__list{gap:0.5rem 2rem;border-bottom:var(--gov-tabs-list-border-width, 0.0625rem solid var(--gov-color-secondary-500))}.gov-tabs[type=chip] .gov-tabs__list{gap:0.5rem 1rem}.gov-tabs[variant=primary][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-primary-color, var(--gov-color-primary))}@media not all and (pointer: coarse){.gov-tabs[variant=primary][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-primary-color-hover, var(--gov-color-primary-800))}}.gov-tabs[variant=primary][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-primary-color-active, var(--gov-color-primary-800));color:var(--gov-tabs-primary-color-active, var(--gov-color-primary-800))}.gov-tabs[variant=secondary][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-secondary-color, var(--gov-color-secondary-700))}@media not all and (pointer: coarse){.gov-tabs[variant=secondary][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-secondary-color-hover, var(--gov-color-secondary-900))}}.gov-tabs[variant=secondary][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-secondary-color-active, var(--gov-color-secondary-900));color:var(--gov-tabs-secondary-color-active, var(--gov-color-secondary-900))}.gov-tabs[variant=success][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-success-color, var(--gov-color-success-500))}@media not all and (pointer: coarse){.gov-tabs[variant=success][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-success-color-hover, var(--gov-color-success-700))}}.gov-tabs[variant=success][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-success-color-active, var(--gov-color-success-700));color:var(--gov-tabs-success-color-active, var(--gov-color-success-700))}.gov-tabs[variant=warning][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-warning-color, var(--gov-color-warning-500))}@media not all and (pointer: coarse){.gov-tabs[variant=warning][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-warning-color-hover, var(--gov-color-warning-700))}}.gov-tabs[variant=warning][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-warning-color-active, var(--gov-color-warning-700));color:var(--gov-tabs-warning-color-active, var(--gov-color-warning-700))}.gov-tabs[variant=error][type=text] .gov-tabs__btn:not([disabled]){color:var(--gov-tabs-error-color, var(--gov-color-error-400))}@media not all and (pointer: coarse){.gov-tabs[variant=error][type=text] .gov-tabs__btn:not([disabled]):hover{color:var(--gov-tabs-error-color-hover, var(--gov-color-error-600))}}.gov-tabs[variant=error][type=text] .gov-tabs__btn[aria-selected=true]{border-bottom-color:var(--gov-tabs-error-color-active, var(--gov-color-error-600));color:var(--gov-tabs-error-color-active, var(--gov-color-error-600))}.gov-tabs[orientation=vertical] .gov-tabs__btn{text-align:left}@media (min-width: 75em){.gov-tabs[orientation=vertical]{display:flex;flex-direction:row}.gov-tabs[orientation=vertical] .gov-tabs__list{flex-wrap:nowrap;flex-direction:column;width:-moz-max-content;width:max-content;max-width:30vw;margin-right:1.25rem;padding:0rem 0.5rem;border-bottom:none;border-right:var(--gov-tabs-list-border-width, 0.0625rem solid var(--gov-color-secondary-500))}.gov-tabs[orientation=vertical] .gov-tabs__item{justify-content:flex-end}.gov-tabs[orientation=vertical] .gov-tabs__btn{padding:0.5rem 0.75rem;text-align:right}}";const _=y;const u=class{constructor(a){t(this,a);this.govChange=o(this,"gov-change",7);this.triggerRefs={};this.controllers=[];this.focusIndex=0;this.compactControls=false;this.type="text";this.variant="primary";this.orientation="horizontal";this.wcagLabel=undefined;this.accessibleSelectLabel=undefined;this.wcagLabelledBy=undefined;this.h=s(this.host);this.formSelectId=b("GovFormSelect")}validateType(t){c(p,t,h.root)}validateVariant(t){c(m,t,h.root)}componentWillLoad(){this.prepareControllers()}async componentDidRender(){if(n()){await g(500);await this.validateWcag()}}prepareControllers(t=false){this.controllers=[];const o=[];this.host.querySelectorAll(d.root).forEach((t=>{const a=Promise.all([t.getIdentifier(),t.getTriggerIdentifier(),t.getDisableState()]).then((([o,a,r])=>{const e=typeof t.getAttribute("default")==="string";return{label:t.getAttribute("label"),contentIdentifier:o,disabled:r,triggerIdentifier:a,element:t,active:false,default:e}}));o.push(a)}));Promise.all(o).then((o=>{if(t===false){let t=o.findIndex((t=>t.default));if(t===-1)t=0;this.focusIndex=t;o[t].active=true}else if(this.focusIndex>-1&&f(o,this.focusIndex)){o[this.focusIndex].active=true}const a=o.findIndex((t=>t.active&&t.disabled));if(a>-1){o[a].active=false;const t=o.findIndex((t=>!t.disabled));if(t>-1){o[t].active=true;this.focusIndex=t}}this.controllers=[...o];this.reRender()}))}setActiveByIdentifier(t){const o=[];this.controllers.map((a=>{a.active=t===a.triggerIdentifier||t===a.contentIdentifier;o.push(a)}));this.controllers=[...o]}reRender(){this.controllers.map((t=>{t.element.setActiveStatus(t.active).catch()}))}render(){return a(r,{key:"c9268edb140ab2f89a200e24fb82489ac643bb5b",class:this.h.classes(h.root),variant:this.variant,type:this.type,role:"tablist","aria-label":this.wcagLabel,"aria-labelledby":this.wcagLabelledBy,onKeyDown:this.onKeydownHandler.bind(this)},a("div",{key:"41848142996bf01dc71ec80d396feb28d1d361d3",class:h.tabs,"aria-hidden":i(this.compactControls)},a("ul",{key:"dcbc258c22c0200a96b74aba9b50088484cc9d36",class:h.list},this.controllers.map((t=>a("li",{class:h.item},this.type=="text"?a("button",{class:h.btn,id:t.triggerIdentifier,role:"tab",onClick:()=>this.onSelectHandler(t),disabled:t.disabled,"aria-disabled":i(t.disabled),"aria-selected":i(t.active),"aria-controls":t.contentIdentifier,tabindex:t.active&&!t.disabled?0:-1,ref:o=>this.triggerRefs[t.triggerIdentifier]=o},t.label):a("gov-chip",{role:"tab",tag:"button",identifier:t.triggerIdentifier,"wcag-selected":t.active,"wcag-controls":t.contentIdentifier,focusable:t.active,disabled:t.disabled,variant:this.variant,inverse:!t.active,ref:o=>this.triggerRefs[t.triggerIdentifier]=o,"on-gov-click":()=>this.onSelectHandler(t)},t.label)))))),a("span",{key:"a7d9ec6aa331b24ba759f25cbfaefab3ffb3aa22",id:this.formSelectId,hidden:true},this.accessibleSelectLabel),this.compactControls?a("gov-form-select",{"wcag-labelled-by":this.formSelectId,"onGov-change":this.onChangeHandler.bind(this)},this.controllers.map((t=>a("option",{value:t.triggerIdentifier,selected:t.active},t.label)))):null,a("slot",{key:"0b67266e6e5ef507c45202e92575d82be6946278"}))}getCurrentTab(){return this.controllers.find((t=>t.active))||null}onSelectHandler(t){const o=this.controllers.findIndex((o=>o.triggerIdentifier===t.triggerIdentifier));this.focusIndex=o;this.setActiveByIdentifier(t.triggerIdentifier);this.reRender();this.govChange.emit(this.getCurrentTab().element)}onChangeHandler(t){const o=t.target.value;t.stopPropagation();this.setActiveByIdentifier(o);this.reRender();this.govChange.emit(this.getCurrentTab().element)}onKeydownHandler(t){const o=t.keyCode;t.stopPropagation();this.goToPrevNext(o)}goToPrevNext(t){if([37,38,39,40].includes(t)){if(false===(this.focusIndex>=0&&this.focusIndex<=this.controllers.length-1)){return}this.controllers[this.focusIndex].active=false;if(t===39||t===40){this.focusIndex++;if(this.focusIndex>=this.controllers.length){this.focusIndex=0}if(this.controllers[this.focusIndex].disabled){this.goToPrevNext(40)}}else if(t===37||t===38){this.focusIndex--;if(this.focusIndex<0){this.focusIndex=this.controllers.length-1}if(this.controllers[this.focusIndex].disabled){this.goToPrevNext(38)}}if(this.focusIndex>=0&&this.focusIndex<=this.controllers.length-1){const t=this.controllers[this.focusIndex];t.active=true;const o=this.triggerRefs[t.triggerIdentifier];if(o.nodeName.toLowerCase()==="gov-chip"){this.triggerRefs[t.triggerIdentifier].setFocus()}else{this.triggerRefs[t.triggerIdentifier].focus()}this.controllers=[...this.controllers];this.reRender();this.govChange.emit(this.getCurrentTab().element)}}}async refresh(){this.prepareControllers()}async currentTab(){return this.getCurrentTab().element||null}async setActiveTab(t){this.setActiveByIdentifier(t);this.reRender()}async rerender(){this.prepareControllers(true)}async validateWcag(){l(this.accessibleSelectLabel,"wcag-select-label",h.root);v(this.wcagLabel,this.wcagLabelledBy,h.root)}get host(){return e(this)}static get watchers(){return{type:["validateType"],variant:["validateVariant"]}}};u.style=_;export{u as gov_tabs};
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=p-753e4861.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["govTabsCss","GovTabsStyle0","GovTabs","constructor","hostRef","this","triggerRefs","h","govHost","host","formSelectId","createID","validateType","newValue","validateProp","TabTypes","TabsClass","root","validateVariant","TabVariants","componentWillLoad","prepareControllers","componentDidRender","canValidateWcagOnRender","delay","validateWcag","skipDefault","controllers","promises","querySelectorAll","TabsItemClass","forEach","tab","controlItem","Promise","all","getIdentifier","getTriggerIdentifier","getDisableState","then","identifier","triggerIdentifier","disabled","isDefault","getAttribute","label","contentIdentifier","element","active","default","push","defaultTabIndex","findIndex","controller","focusIndex","hasOwnProperty","isWrongCombination","firstGoodTab","reRender","setActiveByIdentifier","temp","map","item","control","setActiveStatus","catch","render","Host","key","class","classes","variant","type","role","wcagLabel","wcagLabelledBy","onKeyDown","onKeydownHandler","bind","tabs","toBoolAttr","compactControls","list","btn","id","onClick","onSelectHandler","tabindex","ref","el","tag","focusable","inverse","hidden","accessibleSelectLabel","onChangeHandler","value","selected","getCurrentTab","find","index","t","govChange","emit","e","triggerId","target","stopPropagation","keyCode","goToPrevNext","includes","length","current","trigger","nodeName","toLowerCase","setFocus","focus","refresh","currentTab","setActiveTab","rerender","validateWcagProp","validateWcagLabel"],"sources":["../../../packages/core/src/components/gov-tabs/gov-tabs.scss?tag=gov-tabs","../../../packages/core/src/components/gov-tabs/gov-tabs.tsx"],"sourcesContent":["/*\n * Tabs\n */\n\n$class: \".gov-tabs\";\n\n#{$class} {\n\t@include base();\n\t&__list {\n\t\t@extend %reset-ul;\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tmargin: rem-calc(0 0 20);\n\t}\n\t&__list > &__item {\n\t\t@extend %reset-ul-li;\n\t\tdisplay: flex;\n\t\tmargin: 0;\n\t}\n\t&__btn {\n\t\t@include typography($font-size-s);\n\t\t@include button-core();\n\t\t@include focus-outline();\n\t\tmargin: 0;\n\t\tpadding: rem-calc(12 0 10);\n\t\tborder-bottom: rem-calc(2) solid transparent;\n\t\tfont-weight: 700;\n\t\ttext-align: center;\n\t\ttransition: $t linear color, $t linear border-color;\n\t\t&[disabled] {\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $type, $definitions in $tabs-types {\n\t\t&[type=\"#{$type}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__list {\n\t\t\t\t\tgap: get(\"item-spacing\", $definitions);\n\t\t\t\t\t@if deep-map-check($definitions, \"border\") {\n\t\t\t\t\t\tborder-bottom: $tabs-list-border;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t@each $variant, $definitions in $tabs-variants {\n\t\t&[variant=\"#{$variant}\"][type=\"text\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__btn:not([disabled]) {\n\t\t\t\t\tcolor: get(\"color\", $definitions);\n\t\t\t\t\t@include hover() {\n\t\t\t\t\t\tcolor: get(\"color-hover\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// STATES\n\t\t\t\t&__btn[aria-selected=\"true\"] {\n\t\t\t\t\tborder-bottom-color: get(\"color-active\", $definitions);\n\t\t\t\t\tcolor: get(\"color-active\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t&[orientation=\"vertical\"] {\n\t\t#{$class}__btn {\n\t\t\ttext-align: left;\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: xl) {\n\t\t&[orientation=\"vertical\"] {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\n\t\t\t#{$class}__list {\n\t\t\t\tflex-wrap: nowrap;\n\t\t\t\tflex-direction: column;\n\t\t\t\twidth: max-content;\n\t\t\t\tmax-width: 30vw;\n\t\t\t\tmargin-right: rem-calc(20);\n\t\t\t\tpadding: rem-calc(0 8);\n\t\t\t\tborder-bottom: none;\n\t\t\t\tborder-right: $tabs-list-border;\n\t\t\t}\n\n\t\t\t#{$class}__item {\n\t\t\t\tjustify-content: flex-end;\n\t\t\t}\n\n\t\t\t#{$class}__btn {\n\t\t\t\tpadding: rem-calc(8 12);\n\t\t\t\ttext-align: right;\n\t\t\t}\n\t\t}\n\t}\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\n\nimport {govHost, toBoolAttr} from \"../../helpers/Dom/template\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\nimport {canValidateWcagOnRender} from \"../../helpers/Dom/win\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {validateWcagLabel, validateWcagProp} from \"../../helpers/Validate/wcag\"\nimport {Nullable} from \"../../types/interfaces\"\nimport {createID} from \"../../utils/string.utils\"\nimport {delay} from \"../../utils/utils\"\nimport {TabOrientationType, TabsClass, TabsItemClass, TabType, TabTypes, TabVariants, VariantType} from \"./constants\"\nimport {GovTabControllerItem} from \"./gov-tabs.types\"\nimport {hasOwnProperty} from \"../../utils/helpers.types\";\n\n@Component({\n\ttag: \"gov-tabs\",\n\tstyleUrl: \"gov-tabs.scss\",\n})\nexport class GovTabs {\n\tprivate h: GovHost\n\tprivate triggerRefs: Record<string, HTMLButtonElement | HTMLGovChipElement> = {}\n\n\tprivate readonly formSelectId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.formSelectId = createID(\"GovFormSelect\")\n\t}\n\n\t@Element() host: HTMLGovTabsElement\n\t@State() controllers: GovTabControllerItem[] = []\n\t@State() focusIndex = 0\n\t@State() compactControls = false\n\t/**\n\t * Tabs type\n\t */\n\t@Prop() readonly type: TabType = \"text\"\n\t/**\n\t * Style variation of the tab chips.\n\t */\n\t@Prop() readonly variant?: VariantType = \"primary\"\n\t/**\n\t * Tabs orientation\n\t */\n\t@Prop() readonly orientation: TabOrientationType = \"horizontal\"\n\t/**\n\t * Adds accessible label for the tabs that is only shown for screen readers.\n\t */\n\t@Prop({attribute: \"wcag-label\"}) readonly wcagLabel: string\n\t/**\n\t * Adds accessible label for the tabs select\n\t */\n\t@Prop({attribute: \"wcag-select-label\"}) readonly accessibleSelectLabel: string\n\t/**\n\t * Indicates the id of a component that labels the tabs.\n\t */\n\t@Prop({attribute: \"wcag-labelled-by\"}) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when the tab is changed.\n\t */\n\t@Event({eventName: \"gov-change\"}) govChange: EventEmitter<HTMLGovTabsItemElement>\n\n\t@Watch(\"type\")\n\tvalidateType(newValue: string): void {\n\t\tvalidateProp(TabTypes, newValue, TabsClass.root)\n\t}\n\n\t@Watch(\"variant\")\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(TabVariants, newValue, TabsClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.prepareControllers()\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tprivate prepareControllers(skipDefault = false): void {\n\t\tthis.controllers = []\n\t\tconst promises: Promise<GovTabControllerItem>[] = []\n\t\tthis.host.querySelectorAll(TabsItemClass.root).forEach((tab: HTMLGovTabsItemElement) => {\n\t\t\tconst controlItem = Promise.all([\n\t\t\t\ttab.getIdentifier(),\n\t\t\t\ttab.getTriggerIdentifier(),\n\t\t\t\ttab.getDisableState()\n\t\t\t]).then(([identifier, triggerIdentifier, disabled]) => {\n\t\t\t\tconst isDefault = typeof tab.getAttribute(\"default\") === \"string\"\n\t\t\t\treturn {\n\t\t\t\t\tlabel: tab.getAttribute(\"label\"),\n\t\t\t\t\tcontentIdentifier: identifier,\n\t\t\t\t\tdisabled: disabled,\n\t\t\t\t\ttriggerIdentifier: triggerIdentifier,\n\t\t\t\t\telement: tab,\n\t\t\t\t\tactive: false,\n\t\t\t\t\tdefault: isDefault,\n\t\t\t\t}\n\t\t\t})\n\t\t\tpromises.push(controlItem)\n\t\t});\n\t\tPromise.all(promises).then(controllers => {\n\t\t\tif (skipDefault === false) {\n\t\t\t\tlet defaultTabIndex = controllers.findIndex(controller => controller.default)\n\t\t\t\tif (defaultTabIndex === -1) defaultTabIndex = 0\n\t\t\t\tthis.focusIndex = defaultTabIndex\n\t\t\t\tcontrollers[defaultTabIndex].active = true\n\t\t\t} else if (this.focusIndex > -1 && hasOwnProperty(controllers, this.focusIndex)) {\n\t\t\t\tcontrollers[this.focusIndex].active = true\n\t\t\t}\n\t\t\tconst isWrongCombination = controllers.findIndex((controller) => controller.active && controller.disabled)\n\t\t\tif (isWrongCombination > -1) {\n\t\t\t\tcontrollers[isWrongCombination].active = false;\n\t\t\t\tconst firstGoodTab = controllers.findIndex((controller) => !controller.disabled)\n\t\t\t\tif (firstGoodTab > -1) {\n\t\t\t\t\tcontrollers[firstGoodTab].active = true\n\t\t\t\t\tthis.focusIndex = firstGoodTab;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.controllers = [...controllers]\n\t\t\tthis.reRender()\n\t\t})\n\t}\n\n\tprivate setActiveByIdentifier(identifier: string) {\n\t\tconst temp = []\n\t\tthis.controllers.map(item => {\n\t\t\titem.active = identifier === item.triggerIdentifier || identifier === item.contentIdentifier\n\t\t\ttemp.push(item)\n\t\t})\n\t\tthis.controllers = [...temp]\n\t}\n\n\tprivate reRender() {\n\t\tthis.controllers.map(control => {\n\t\t\tcontrol.element.setActiveStatus(control.active).catch()\n\t\t})\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={this.h.classes(TabsClass.root)}\n\t\t\t\tvariant={this.variant}\n\t\t\t\ttype={this.type}\n\t\t\t\trole=\"tablist\"\n\t\t\t\taria-label={this.wcagLabel}\n\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\tonKeyDown={this.onKeydownHandler.bind(this)}\n\t\t\t>\n\t\t\t\t<div class={TabsClass.tabs} aria-hidden={toBoolAttr(this.compactControls)}>\n\t\t\t\t\t<ul class={TabsClass.list}>\n\t\t\t\t\t\t{this.controllers.map(control => (\n\t\t\t\t\t\t\t<li class={TabsClass.item}>\n\t\t\t\t\t\t\t\t{this.type == \"text\" ? (\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\tclass={TabsClass.btn}\n\t\t\t\t\t\t\t\t\t\tid={control.triggerIdentifier}\n\t\t\t\t\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\t\t\t\t\tonClick={() => this.onSelectHandler(control)}\n\t\t\t\t\t\t\t\t\t\tdisabled={control.disabled}\n\t\t\t\t\t\t\t\t\t\taria-disabled={toBoolAttr(control.disabled)}\n\t\t\t\t\t\t\t\t\t\taria-selected={toBoolAttr(control.active)}\n\t\t\t\t\t\t\t\t\t\taria-controls={control.contentIdentifier}\n\t\t\t\t\t\t\t\t\t\ttabindex={control.active && !control.disabled ? 0 : -1}\n\t\t\t\t\t\t\t\t\t\tref={el => (this.triggerRefs[control.triggerIdentifier] = el as HTMLButtonElement)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{control.label}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<gov-chip\n\t\t\t\t\t\t\t\t\t\trole=\"tab\"\n\t\t\t\t\t\t\t\t\t\ttag={'button'}\n\t\t\t\t\t\t\t\t\t\tidentifier={control.triggerIdentifier}\n\t\t\t\t\t\t\t\t\t\twcag-selected={control.active}\n\t\t\t\t\t\t\t\t\t\twcag-controls={control.contentIdentifier}\n\t\t\t\t\t\t\t\t\t\tfocusable={control.active}\n\t\t\t\t\t\t\t\t\t\tdisabled={control.disabled}\n\t\t\t\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\t\t\t\tinverse={!control.active}\n\t\t\t\t\t\t\t\t\t\tref={el => (this.triggerRefs[control.triggerIdentifier] = el as HTMLGovChipElement)}\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onSelectHandler(control)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{control.label}\n\t\t\t\t\t\t\t\t\t</gov-chip>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\n\t\t\t\t<span id={this.formSelectId} hidden>\n\t\t\t\t\t{this.accessibleSelectLabel}\n\t\t\t\t</span>\n\t\t\t\t{this.compactControls ? (\n\t\t\t\t\t<gov-form-select wcag-labelled-by={this.formSelectId} onGov-change={this.onChangeHandler.bind(this)}>\n\t\t\t\t\t\t{this.controllers.map(control => (\n\t\t\t\t\t\t\t<option value={control.triggerIdentifier} selected={control.active}>\n\t\t\t\t\t\t\t\t{control.label}\n\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</gov-form-select>\n\t\t\t\t) : null}\n\n\t\t\t\t<slot></slot>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate getCurrentTab(): GovTabControllerItem | null {\n\t\treturn this.controllers.find(control => control.active) || null\n\t}\n\n\tprivate onSelectHandler(control: GovTabControllerItem) {\n\t\tconst index = this.controllers.findIndex(t => t.triggerIdentifier === control.triggerIdentifier);\n\t\tthis.focusIndex = index\n\t\tthis.setActiveByIdentifier(control.triggerIdentifier)\n\t\tthis.reRender()\n\t\tthis.govChange.emit(this.getCurrentTab().element)\n\t}\n\n\tprivate onChangeHandler(e: CustomEvent) {\n\t\tconst triggerId = (e.target as HTMLSelectElement).value\n\t\te.stopPropagation()\n\t\tthis.setActiveByIdentifier(triggerId)\n\t\tthis.reRender()\n\t\tthis.govChange.emit(this.getCurrentTab().element)\n\t}\n\n\tprivate onKeydownHandler(e: KeyboardEvent) {\n\t\tconst keyCode = e.keyCode\n\n\t\te.stopPropagation()\n\t\tthis.goToPrevNext(keyCode)\n\t}\n\n\tprivate goToPrevNext(keyCode: number) {\n\t\tif ([37, 38, 39, 40].includes(keyCode)) {\n\t\t\tif (false === (this.focusIndex >= 0 && this.focusIndex <= this.controllers.length - 1)) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.controllers[this.focusIndex].active = false\n\n\t\t\tif (keyCode === 39 || keyCode === 40) {\n\t\t\t\tthis.focusIndex++\n\t\t\t\tif (this.focusIndex >= this.controllers.length) {\n\t\t\t\t\tthis.focusIndex = 0\n\t\t\t\t}\n\t\t\t\tif (this.controllers[this.focusIndex].disabled) {\n\t\t\t\t\tthis.goToPrevNext(40)\n\t\t\t\t}\n\t\t\t} else if (keyCode === 37 || keyCode === 38) {\n\t\t\t\tthis.focusIndex--\n\t\t\t\tif (this.focusIndex < 0) {\n\t\t\t\t\tthis.focusIndex = this.controllers.length - 1\n\t\t\t\t}\n\t\t\t\tif (this.controllers[this.focusIndex].disabled) {\n\t\t\t\t\tthis.goToPrevNext(38)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.focusIndex >= 0 && this.focusIndex <= this.controllers.length - 1) {\n\t\t\t\tconst current = this.controllers[this.focusIndex]\n\t\t\t\tcurrent.active = true\n\t\t\t\tconst trigger = this.triggerRefs[current.triggerIdentifier]\n\t\t\t\tif (trigger.nodeName.toLowerCase() === 'gov-chip') {\n\t\t\t\t\t(this.triggerRefs[current.triggerIdentifier] as HTMLGovChipElement).setFocus()\n\t\t\t\t} else {\n\t\t\t\t\tthis.triggerRefs[current.triggerIdentifier].focus()\n\t\t\t\t}\n\n\t\t\t\tthis.controllers = [...this.controllers]\n\t\t\t\tthis.reRender()\n\t\t\t\tthis.govChange.emit(this.getCurrentTab().element)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Regenerate tabs controllers\n\t */\n\t@Method()\n\tasync refresh(): Promise<void> {\n\t\tthis.prepareControllers()\n\t}\n\n\t/**\n\t * Returns the currently selected tabs-item\n\t */\n\t@Method()\n\tasync currentTab(): Promise<Nullable<HTMLGovTabsItemElement>> {\n\t\treturn this.getCurrentTab().element || null\n\t}\n\n\t/**\n\t * Regenerate tabs controllers\n\t */\n\t@Method()\n\tasync setActiveTab(identifier: string): Promise<void> {\n\t\tthis.setActiveByIdentifier(identifier)\n\t\tthis.reRender()\n\t}\n\n\t/**\n\t * Regenerate tabs controllers\n\t */\n\t@Method()\n\tasync rerender(): Promise<void> {\n\t\tthis.prepareControllers(true);\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagProp(this.accessibleSelectLabel, \"wcag-select-label\", TabsClass.root)\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, TabsClass.root)\n\t}\n}\n"],"mappings":"8aAAA,MAAMA,EAAa,wgKACnB,MAAAC,EAAeD,E,MCiBFE,EAAO,MAMnB,WAAAC,CAAAC,G,gDAJQC,KAAAC,YAAsE,G,iBAU/B,G,gBACzB,E,qBACK,M,UAIM,O,aAIQ,U,iBAIU,a,sFAnBlDD,KAAKE,EAAIC,EAAQH,KAAKI,MACtBJ,KAAKK,aAAeC,EAAS,gB,CAqC9B,YAAAC,CAAaC,GACZC,EAAaC,EAAUF,EAAUG,EAAUC,K,CAI5C,eAAAC,CAAgBL,GACfC,EAAaK,EAAaN,EAAUG,EAAUC,K,CAG/C,iBAAAG,GACCf,KAAKgB,oB,CAGN,wBAAMC,GACL,GAAIC,IAA2B,OACxBC,EAAM,WACNnB,KAAKoB,c,EAIL,kBAAAJ,CAAmBK,EAAc,OACxCrB,KAAKsB,YAAc,GACnB,MAAMC,EAA4C,GAClDvB,KAAKI,KAAKoB,iBAAiBC,EAAcb,MAAMc,SAASC,IACvD,MAAMC,EAAcC,QAAQC,IAAI,CAC/BH,EAAII,gBACJJ,EAAIK,uBACJL,EAAIM,oBACFC,MAAK,EAAE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Eb,GAAID,IAAY,IAAMA,IAAY,GAAI,CAC5CvG,KAAKiD,aACL,GAAIjD,KAAKiD,WAAa,EAAG,CACxBjD,KAAKiD,WAAajD,KAAKsB,YAAYoF,OAAS,C,CAE7C,GAAI1G,KAAKsB,YAAYtB,KAAKiD,YAAYZ,SAAU,CAC/CrC,KAAKwG,aAAa,G,EAIpB,GAAIxG,KAAKiD,YAAc,GAAKjD,KAAKiD,YAAcjD,KAAKsB,YAAYoF,OAAS,EAAG,CAC3E,MAAMC,EAAU3G,KAAKsB,YAAYtB,KAAKiD,YACtC0D,EAAQhE,OAAS,KACjB,MAAMiE,EAAU5G,KAAKC,YAAY0G,EAAQvE,mBACzC,GAAIwE,EAAQC,SAASC,gBAAkB,WAAY,CACjD9G,KAAKC,YAAY0G,EAAQvE,mBAA0C2E,U,KAC9D,CACN/G,KAAKC,YAAY0G,EAAQvE,mBAAmB4E,O,CAG7ChH,KAAKsB,YAAc,IAAItB,KAAKsB,aAC5BtB,KAAKqD,WACLrD,KAAKiG,UAAUC,KAAKlG,KAAK6F,gBAAgBnD,Q,GAS5C,aAAMuE,GACLjH,KAAKgB,oB,CAON,gBAAMkG,GACL,OAAOlH,KAAK6F,gBAAgBnD,SAAW,I,CAOxC,kBAAMyE,CAAahF,GAClBnC,KAAKsD,sBAAsBnB,GAC3BnC,KAAKqD,U,CAON,cAAM+D,GACLpH,KAAKgB,mBAAmB,K,CAOzB,kBAAMI,GACLiG,EAAiBrH,KAAKyF,gBAAiB,oBAAqB9E,EAAUC,MACtE0G,EAAkBtH,KAAKqE,UAAWrE,KAAKsE,eAAgB3D,EAAUC,K","ignoreList":[]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{r as e,c as r,h as t,a,g as i}from"./p-0a5b0f7d.js";import{v as o}from"./p-92b7481f.js";import{c as s}from"./p-e618f1cb.js";import{d as c}from"./p-e0e2e9c1.js";import{g as l}from"./p-4191acf2.js";import"./p-e296ca83.js";import"./p-95d41a3b.js";const n={root:"gov-breadcrumbs"};const d='.gov-breadcrumbs ul{margin:0;padding:0}.gov-breadcrumbs li{margin:0;padding:0;background:none}.gov-breadcrumbs li::before{display:none}.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-breadcrumbs{position:relative;display:flex;width:100%;justify-content:space-between;align-items:flex-start;gap:var(--gov-breadcrumbs-gap, 1rem)}.gov-breadcrumbs nav{overflow:hidden;width:100%}.gov-breadcrumbs ul{position:relative;display:flex;width:100%;flex-direction:column;gap:8px;margin-bottom:0}.gov-breadcrumbs li{display:flex;justify-content:flex-start;align-items:flex-start;margin-bottom:0 !important}.gov-breadcrumbs li .gov-icon{flex:0 0 auto;width:var(--gov-breadcrumbs-icon-size, 0.625rem);height:var(--gov-breadcrumbs-icon-size, 0.625rem);margin:calc((24px - var(--gov-breadcrumbs-icon-size, 0.625rem)) / 2) var(--gov-breadcrumbs-gap, 1rem) 0;color:var(--gov-breadcrumbs-arrow-color, var(--gov-color-secondary-600))}.gov-breadcrumbs li>a:first-child,.gov-breadcrumbs li>button:first-child{margin-left:calc(var(--gov-breadcrumbs-icon-size, 0.625rem) + 2 * var(--gov-breadcrumbs-gap, 1rem))}.gov-breadcrumbs a{font-weight:var(--text-font-weight, var(--gov-text-m-font-weight));font-size:var(--text-font-size, var(--gov-text-m-font-size));line-height:var(--text-line-height, var(--gov-text-m-line-height));letter-spacing:var(--text-letter-spacing, var(--gov-text-m-letter-spacing));color:var(--gov-breadcrumbs-link-color, var(--gov-color-primary))}.gov-breadcrumbs button{font-weight:var(--text-font-weight, var(--gov-text-m-font-weight));font-size:var(--text-font-size, var(--gov-text-m-font-size));line-height:var(--text-line-height, var(--gov-text-m-line-height));letter-spacing:var(--text-letter-spacing, var(--gov-text-m-letter-spacing));color:var(--gov-breadcrumbs-link-color, var(--gov-color-primary));padding:0;border:none;background:none;text-decoration:underline}.gov-breadcrumbs[collapsed=""],.gov-breadcrumbs[collapsed=true i],.gov-breadcrumbs[collapsed="1"]{align-items:center}.gov-breadcrumbs[collapsed=""] ul,.gov-breadcrumbs[collapsed=true i] ul,.gov-breadcrumbs[collapsed="1"] ul{overflow-x:hidden;flex-direction:row}.gov-breadcrumbs[collapsed=""] li,.gov-breadcrumbs[collapsed=true i] li,.gov-breadcrumbs[collapsed="1"] li{align-items:center;white-space:nowrap}.gov-breadcrumbs[collapsed=""] li .gov-icon,.gov-breadcrumbs[collapsed=true i] li .gov-icon,.gov-breadcrumbs[collapsed="1"] li .gov-icon{margin-top:0}.gov-breadcrumbs[collapsed=""] li>a:first-child,.gov-breadcrumbs[collapsed=""] li>button:first-child,.gov-breadcrumbs[collapsed=true i] li>a:first-child,.gov-breadcrumbs[collapsed=true i] li>button:first-child,.gov-breadcrumbs[collapsed="1"] li>a:first-child,.gov-breadcrumbs[collapsed="1"] li>button:first-child{margin-left:0}';const b=d;const g=class{constructor(t){e(this,t);this.govChange=r(this,"gov-change",7);this.inited=false;this.collapsible=false;this.isExpanded=false;this.wcagLabel=undefined;this.wcagLabelledBy=undefined;this.
|
|
2
|
-
|
|
1
|
+
import{r as e,c as r,h as t,a,g as i}from"./p-0a5b0f7d.js";import{v as o}from"./p-92b7481f.js";import{c as s}from"./p-e618f1cb.js";import{d as c}from"./p-e0e2e9c1.js";import{g as l}from"./p-4191acf2.js";import"./p-e296ca83.js";import"./p-95d41a3b.js";const n={root:"gov-breadcrumbs"};const d='.gov-breadcrumbs ul{margin:0;padding:0}.gov-breadcrumbs li{margin:0;padding:0;background:none}.gov-breadcrumbs li::before{display:none}.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-breadcrumbs{position:relative;display:flex;width:100%;justify-content:space-between;align-items:flex-start;gap:var(--gov-breadcrumbs-gap, 1rem)}.gov-breadcrumbs nav{overflow:hidden;width:100%}.gov-breadcrumbs ul{position:relative;display:flex;width:100%;flex-direction:column;gap:8px;margin-bottom:0}.gov-breadcrumbs li{display:flex;justify-content:flex-start;align-items:flex-start;margin-bottom:0 !important}.gov-breadcrumbs li .gov-icon{flex:0 0 auto;width:var(--gov-breadcrumbs-icon-size, 0.625rem);height:var(--gov-breadcrumbs-icon-size, 0.625rem);margin:calc((24px - var(--gov-breadcrumbs-icon-size, 0.625rem)) / 2) var(--gov-breadcrumbs-gap, 1rem) 0;color:var(--gov-breadcrumbs-arrow-color, var(--gov-color-secondary-600))}.gov-breadcrumbs li>a:first-child,.gov-breadcrumbs li>button:first-child{margin-left:calc(var(--gov-breadcrumbs-icon-size, 0.625rem) + 2 * var(--gov-breadcrumbs-gap, 1rem))}.gov-breadcrumbs a{font-weight:var(--text-font-weight, var(--gov-text-m-font-weight));font-size:var(--text-font-size, var(--gov-text-m-font-size));line-height:var(--text-line-height, var(--gov-text-m-line-height));letter-spacing:var(--text-letter-spacing, var(--gov-text-m-letter-spacing));color:var(--gov-breadcrumbs-link-color, var(--gov-color-primary))}.gov-breadcrumbs button{font-weight:var(--text-font-weight, var(--gov-text-m-font-weight));font-size:var(--text-font-size, var(--gov-text-m-font-size));line-height:var(--text-line-height, var(--gov-text-m-line-height));letter-spacing:var(--text-letter-spacing, var(--gov-text-m-letter-spacing));color:var(--gov-breadcrumbs-link-color, var(--gov-color-primary));padding:0;border:none;background:none;text-decoration:underline}.gov-breadcrumbs[collapsed=""],.gov-breadcrumbs[collapsed=true i],.gov-breadcrumbs[collapsed="1"]{align-items:center}.gov-breadcrumbs[collapsed=""] ul,.gov-breadcrumbs[collapsed=true i] ul,.gov-breadcrumbs[collapsed="1"] ul{overflow-x:hidden;flex-direction:row}.gov-breadcrumbs[collapsed=""] li,.gov-breadcrumbs[collapsed=true i] li,.gov-breadcrumbs[collapsed="1"] li{align-items:center;white-space:nowrap}.gov-breadcrumbs[collapsed=""] li .gov-icon,.gov-breadcrumbs[collapsed=true i] li .gov-icon,.gov-breadcrumbs[collapsed="1"] li .gov-icon{margin-top:0}.gov-breadcrumbs[collapsed=""] li>a:first-child,.gov-breadcrumbs[collapsed=""] li>button:first-child,.gov-breadcrumbs[collapsed=true i] li>a:first-child,.gov-breadcrumbs[collapsed=true i] li>button:first-child,.gov-breadcrumbs[collapsed="1"] li>a:first-child,.gov-breadcrumbs[collapsed="1"] li>button:first-child{margin-left:0}';const b=d;const g=class{constructor(t){e(this,t);this.govChange=r(this,"gov-change",7);this.inited=false;this.collapsible=false;this.isExpanded=false;this.wcagLabel=undefined;this.wcagLabelledBy=undefined;this.accessibleToggleLabel="Zobrazit či skrýt navigaci";this.collapsed=true;this.toggleOption=false;this.h=l(this.host)}async componentDidRender(){this.scheduleContentVerification();if(s()){await c(500);await this.validateWcag()}}scheduleContentVerification(){if(this.inited)return;this.inited=true;requestAnimationFrame((()=>{this.calculateWidthOfItems();this.inited=false}))}calculateWidthOfItems(){const e=this.host.getBoundingClientRect().width;let r=0;this.host.querySelectorAll("li").forEach((e=>{r+=e.getBoundingClientRect().width}));this.toggleOption=r>e}render(){return t(a,{key:"7ae4eae66fadfb3aebb005e85dec94f6cef0c932",class:this.h.classes(n.root),collapsed:this.collapsed},t("nav",{key:"780b9b2ec63b40f2b9f8ae4e088eba378717fc12","aria-label":this.wcagLabel,"aria-labelledby":this.wcagLabelledBy},t("slot",{key:"778051c57d0b3e657d9fe28802098d1f88a328a4"})),this.toggleOption?t("gov-button",{size:"xs",variant:"primary",type:"base",wcagLabel:this.accessibleToggleLabel,wcagPressed:!this.collapsed,wcagExpanded:!this.collapsed,"on-gov-click":()=>this.collapsed=!this.collapsed},t("gov-icon",{name:this.collapsed?"chevron-down":"chevron-up"})):null)}async validateWcag(){o(this.wcagLabel,this.wcagLabelledBy,n.root);o(this.accessibleToggleLabel,undefined,n.root)}get host(){return i(this)}};g.style=b;export{g as gov_breadcrumbs};
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=p-92f752e1.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BreadcrumbsClass","root","govBreadcrumbsCss","GovBreadcrumbsStyle0","GovBreadcrumbs","constructor","hostRef","this","inited","h","govHost","host","componentDidRender","scheduleContentVerification","canValidateWcagOnRender","delay","validateWcag","requestAnimationFrame","calculateWidthOfItems","hostWidth","getBoundingClientRect","width","sumOfWidths","querySelectorAll","forEach","li","toggleOption","render","Host","key","class","classes","collapsed","wcagLabel","wcagLabelledBy","size","variant","type","accessibleToggleLabel","wcagPressed","wcagExpanded","name","validateWcagLabel","undefined"],"sources":["../../../packages/core/src/components/gov-breadcrumbs/constants.ts","../../../packages/core/src/components/gov-breadcrumbs/gov-breadcrumbs.scss?tag=gov-breadcrumbs","../../../packages/core/src/components/gov-breadcrumbs/gov-breadcrumbs.tsx"],"sourcesContent":["export const BreadcrumbsClass = {\n\troot: 'gov-breadcrumbs',\n}\n","/*\n * Pagination\n */\n\n$class: \".gov-breadcrumbs\";\n\n#{$class} {\n\t@include base(flex);\n\tjustify-content: space-between;\n\talign-items: flex-start;\n\tgap: $breadcrumbs-gap;\n\n\tnav {\n\t\toverflow: hidden;\n\t\twidth: 100%;\n\t}\n\tul {\n\t\t@extend %reset-ul;\n\t\t@include base(flex);\n\t\tflex-direction: column;\n\t\tgap: 8px;\n\t\tmargin-bottom: 0;\n\t}\n\tli {\n\t\t@extend %reset-ul-li;\n\t\tdisplay: flex;\n\t\tjustify-content: flex-start;\n\t\talign-items: flex-start;\n\t\tmargin-bottom: 0 !important;\n\t\t.gov-icon {\n\t\t\tflex: 0 0 auto;\n\t\t\twidth: $breadcrumbs-icon-size;\n\t\t\theight: $breadcrumbs-icon-size;\n\t\t\tmargin: calc((24px - $breadcrumbs-icon-size) / 2) $breadcrumbs-gap 0;\n\t\t\tcolor: $breadcrumbs-arrow-color;\n\t\t}\n\t\t> a:first-child,\n\t\t> button:first-child {\n\t\t\tmargin-left: calc($breadcrumbs-icon-size + (2 * $breadcrumbs-gap));\n\t\t}\n\t}\n\ta {\n\t\t@include typography-component($font-size-m);\n\t\tcolor: $breadcrumbs-link-color;\n\t}\n\tbutton {\n\t\t@include typography-component($font-size-m);\n\t\tcolor: $breadcrumbs-link-color;\n\t\tpadding: 0;\n\t\tborder: none;\n\t\tbackground: none;\n\t\ttext-decoration: underline;\n\t}\n\n\t@include parameter(\"collapsed\") {\n\t\talign-items: center;\n\t\tul {\n\t\t\toverflow-x: hidden;\n\t\t\tflex-direction: row;\n\t\t}\n\t\tli {\n\t\t\talign-items: center;\n\t\t\twhite-space: nowrap;\n\t\t\t.gov-icon {\n\t\t\t\tmargin-top: 0;\n\t\t\t}\n\t\t}\n\t\tli > a:first-child,\n\t\tli > button:first-child {\n\t\t\tmargin-left: 0;\n\t\t}\n\t}\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State} from '@stencil/core'\nimport {BreadcrumbsClass} from './constants'\nimport {validateWcagLabel} from '../../helpers/Validate/wcag'\nimport {canValidateWcagOnRender} from '../../helpers/Dom/win'\nimport {delay} from '../../utils/utils'\nimport {GovBreadcrumbsChangeEvent} from './gov-breadcrumbs.d'\nimport {govHost} from '../../helpers/Dom/template'\nimport {GovHost} from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-breadcrumbs',\n\tstyleUrl: 'gov-breadcrumbs.scss',\n})\nexport class GovBreadcrumbs {\n\tprivate inited = false;\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() readonly host: HTMLGovBreadcrumbsElement\n\t/**\n\t * Defines whether the components can be collapsible when element doesn't fit in one row.\n\t */\n\t@Prop() readonly collapsible: boolean = false\n\t/**\n\t * Defines whether the breadcrumbs are open or closed by button\n\t */\n\t@Prop({attribute: 'is-expanded'}) readonly isExpanded: boolean = false\n\t/**\n\t * Adds accessible label for the pagination that is only shown for screen readers.\n\t */\n\t@Prop({attribute: 'wcag-label'}) readonly wcagLabel: string\n\t/**\n\t * Indicates the id of a component that labels the pagination.\n\t */\n\t@Prop({attribute: 'wcag-labeled-by'}) readonly wcagLabelledBy: string\n\t/**\n\t * Adds an accessible label to display the full breadcrumb navigation that only screen readers can see.\n\t */\n\t@Prop({attribute: 'wcag-toggle-label'}) readonly accessibleToggleLabel: string = 'Zobrazit či skrýt navigaci'\n\n\t/**\n\t * Called when the Breadcrumbs state changes\n\t */\n\t@Event({eventName: 'gov-change'}) govChange: EventEmitter<GovBreadcrumbsChangeEvent>\n\n\t@State() collapsed = true;\n\t@State() toggleOption = false;\n\n\tasync componentDidRender() {\n\t\tthis.scheduleContentVerification()\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tprivate scheduleContentVerification() {\n\t\tif (this.inited) return;\n\t\tthis.inited = true;\n\t\trequestAnimationFrame(() => {\n\t\t\tthis.calculateWidthOfItems();\n\t\t\tthis.inited = false;\n\t\t});\n\t}\n\n\n\tprivate calculateWidthOfItems() {\n\t\tconst hostWidth = this.host.getBoundingClientRect().width;\n\t\tlet sumOfWidths = 0;\n\t\tthis.host.querySelectorAll('li').forEach((li) => {\n\t\t\tsumOfWidths += li.getBoundingClientRect().width\n\t\t})\n\t\tthis.toggleOption = sumOfWidths > hostWidth;\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(BreadcrumbsClass.root)} collapsed={this.collapsed}>\n\t\t\t\t<nav aria-label={this.wcagLabel} aria-labelledby={this.wcagLabelledBy}>\n\t\t\t\t\t<slot/>\n\t\t\t\t</nav>\n\t\t\t\t{this.toggleOption ? (\n\t\t\t\t\t<gov-button\n\t\t\t\t\t\tsize={'xs'}\n\t\t\t\t\t\tvariant={'primary'}\n\t\t\t\t\t\ttype={'base'}\n\t\t\t\t\t\twcagLabel={this.accessibleToggleLabel}\n\t\t\t\t\t\twcagPressed={!this.collapsed}\n\t\t\t\t\t\twcagExpanded={!this.collapsed}\n\t\t\t\t\t\ton-gov-click={() => this.collapsed = !this.collapsed}\n\t\t\t\t\t>\n\t\t\t\t\t\t<gov-icon name={this.collapsed ? 'chevron-down' : 'chevron-up'}></gov-icon>\n\t\t\t\t\t</gov-button>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, BreadcrumbsClass.root)\n\t\tvalidateWcagLabel(this.accessibleToggleLabel, undefined, BreadcrumbsClass.root)\n\t}\n}\n"],"mappings":"2PAAO,MAAMA,EAAmB,CAC/BC,KAAM,mBCDP,MAAMC,EAAoB,4+FAC1B,MAAAC,EAAeD,E,MCYFE,EAAc,MAI1B,WAAAC,CAAAC,G,gDAHQC,KAAAC,OAAS,M,iBAWuB,M,gBAIyB,M,4EAYU,6B,eAOtD,K,kBACG,MA/BvBD,KAAKE,EAAIC,EAAQH,KAAKI,K,CAiCvB,wBAAMC,GACLL,KAAKM,8BACL,GAAIC,IAA2B,OACxBC,EAAM,WACNR,KAAKS,c,EAIL,2BAAAH,GACP,GAAIN,KAAKC,OAAQ,OACjBD,KAAKC,OAAS,KACdS,uBAAsB,KACrBV,KAAKW,wBACLX,KAAKC,OAAS,KAAK,G,CAKb,qBAAAU,GACP,MAAMC,EAAYZ,KAAKI,KAAKS,wBAAwBC,MACpD,IAAIC,EAAc,EAClBf,KAAKI,KAAKY,iBAAiB,MAAMC,SAASC,IACzCH,GAAeG,EAAGL,wBAAwBC,KAAK,IAEhDd,KAAKmB,aAAeJ,EAAcH,C,CAGnC,MAAAQ,GACC,OACClB,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