@gov-design-system-ce/components 0.0.31 → 0.0.32
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/gov-form-autocomplete.cjs.entry.js +4 -2
- package/dist/cjs/gov-form-autocomplete.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-icon.cjs.entry.js +1 -1
- package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js +5 -3
- package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js.map +1 -1
- package/dist/components/gov-accordion-item.js +1 -0
- package/dist/components/gov-accordion-item.js.map +1 -1
- package/dist/components/gov-accordion.js +1 -0
- package/dist/components/gov-accordion.js.map +1 -1
- package/dist/components/gov-alert.js +1 -0
- package/dist/components/gov-alert.js.map +1 -1
- package/dist/components/gov-app.js +1 -0
- package/dist/components/gov-app.js.map +1 -1
- package/dist/components/gov-attachments-item2.js +1 -0
- package/dist/components/gov-attachments-item2.js.map +1 -1
- package/dist/components/gov-attachments2.js +1 -0
- package/dist/components/gov-attachments2.js.map +1 -1
- package/dist/components/gov-backdrop2.js +1 -0
- package/dist/components/gov-backdrop2.js.map +1 -1
- package/dist/components/gov-badge2.js +1 -0
- package/dist/components/gov-badge2.js.map +1 -1
- package/dist/components/gov-breadcrumbs.js +1 -0
- package/dist/components/gov-breadcrumbs.js.map +1 -1
- package/dist/components/gov-button2.js +1 -0
- package/dist/components/gov-button2.js.map +1 -1
- package/dist/components/gov-card.js +1 -0
- package/dist/components/gov-card.js.map +1 -1
- package/dist/components/gov-container.js +1 -0
- package/dist/components/gov-container.js.map +1 -1
- package/dist/components/gov-cookiebar.js +1 -0
- package/dist/components/gov-cookiebar.js.map +1 -1
- package/dist/components/gov-empty.js +1 -0
- package/dist/components/gov-empty.js.map +1 -1
- package/dist/components/gov-error-code.js +1 -0
- package/dist/components/gov-error-code.js.map +1 -1
- package/dist/components/gov-form-autocomplete2.js +5 -2
- package/dist/components/gov-form-autocomplete2.js.map +1 -1
- package/dist/components/gov-form-checkbox.js +1 -0
- package/dist/components/gov-form-checkbox.js.map +1 -1
- package/dist/components/gov-form-control.js +1 -0
- package/dist/components/gov-form-control.js.map +1 -1
- package/dist/components/gov-form-file.js +1 -0
- package/dist/components/gov-form-file.js.map +1 -1
- package/dist/components/gov-form-group.js +1 -0
- package/dist/components/gov-form-group.js.map +1 -1
- package/dist/components/gov-form-input2.js +1 -0
- package/dist/components/gov-form-input2.js.map +1 -1
- package/dist/components/gov-form-label.js +1 -0
- package/dist/components/gov-form-label.js.map +1 -1
- package/dist/components/gov-form-message2.js +1 -0
- package/dist/components/gov-form-message2.js.map +1 -1
- package/dist/components/gov-form-multi-select.js +1 -0
- package/dist/components/gov-form-multi-select.js.map +1 -1
- package/dist/components/gov-form-password-power.js +1 -0
- package/dist/components/gov-form-password-power.js.map +1 -1
- package/dist/components/gov-form-radio.js +1 -0
- package/dist/components/gov-form-radio.js.map +1 -1
- package/dist/components/gov-form-search.js +1 -0
- package/dist/components/gov-form-search.js.map +1 -1
- package/dist/components/gov-form-select2.js +1 -0
- package/dist/components/gov-form-select2.js.map +1 -1
- package/dist/components/gov-form-switch.js +1 -0
- package/dist/components/gov-form-switch.js.map +1 -1
- package/dist/components/gov-grid-item.js +1 -0
- package/dist/components/gov-grid-item.js.map +1 -1
- package/dist/components/gov-grid.js +1 -0
- package/dist/components/gov-grid.js.map +1 -1
- package/dist/components/gov-icon2.js +2 -1
- package/dist/components/gov-icon2.js.map +1 -1
- package/dist/components/gov-layout-column.js +1 -0
- package/dist/components/gov-layout-column.js.map +1 -1
- package/dist/components/gov-layout.js +1 -0
- package/dist/components/gov-layout.js.map +1 -1
- package/dist/components/gov-loading.js +1 -0
- package/dist/components/gov-loading.js.map +1 -1
- package/dist/components/gov-message.js +1 -0
- package/dist/components/gov-message.js.map +1 -1
- package/dist/components/gov-modal.js +1 -0
- package/dist/components/gov-modal.js.map +1 -1
- package/dist/components/gov-nav-item.js +1 -0
- package/dist/components/gov-nav-item.js.map +1 -1
- package/dist/components/gov-nav.js +1 -0
- package/dist/components/gov-nav.js.map +1 -1
- package/dist/components/gov-pagination.js +1 -0
- package/dist/components/gov-pagination.js.map +1 -1
- package/dist/components/gov-prompt.js +1 -0
- package/dist/components/gov-prompt.js.map +1 -1
- package/dist/components/gov-side-nav-item.js +1 -0
- package/dist/components/gov-side-nav-item.js.map +1 -1
- package/dist/components/gov-side-nav.js +1 -0
- package/dist/components/gov-side-nav.js.map +1 -1
- package/dist/components/gov-skeleton.js +1 -0
- package/dist/components/gov-skeleton.js.map +1 -1
- package/dist/components/gov-spacer.js +1 -0
- package/dist/components/gov-spacer.js.map +1 -1
- package/dist/components/gov-statsbar-item.js +1 -0
- package/dist/components/gov-statsbar-item.js.map +1 -1
- package/dist/components/gov-statsbar.js +1 -0
- package/dist/components/gov-statsbar.js.map +1 -1
- package/dist/components/gov-stepper-item.js +1 -0
- package/dist/components/gov-stepper-item.js.map +1 -1
- package/dist/components/gov-stepper.js +1 -0
- package/dist/components/gov-stepper.js.map +1 -1
- package/dist/components/gov-tabs-item.js +1 -0
- package/dist/components/gov-tabs-item.js.map +1 -1
- package/dist/components/gov-tabs.js +1 -0
- package/dist/components/gov-tabs.js.map +1 -1
- package/dist/components/gov-tile.js +1 -0
- package/dist/components/gov-tile.js.map +1 -1
- package/dist/components/gov-tiles.js +1 -0
- package/dist/components/gov-tiles.js.map +1 -1
- package/dist/components/gov-toast.js +1 -0
- package/dist/components/gov-toast.js.map +1 -1
- package/dist/components/gov-tooltip-content.js +1 -0
- package/dist/components/gov-tooltip-content.js.map +1 -1
- package/dist/components/gov-tooltip.js +1 -0
- package/dist/components/gov-tooltip.js.map +1 -1
- package/dist/components/gov-wizzard-item.js +1 -0
- package/dist/components/gov-wizzard-item.js.map +1 -1
- package/dist/components/gov-wizzard.js +1 -0
- package/dist/components/gov-wizzard.js.map +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/{p-6e8bdc3b.entry.js → p-70786676.entry.js} +2 -2
- package/dist/core/p-70786676.entry.js.map +1 -0
- package/dist/core/{p-a853709d.entry.js → p-d5b2d142.entry.js} +2 -2
- package/dist/custom-elements/index.js +1 -1
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/gov-form-autocomplete.entry.js +4 -2
- package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
- package/dist/esm/gov-icon.entry.js +1 -1
- package/dist/hydrate/index.js +4 -2
- package/package.json +1 -1
- package/dist/core/p-6e8bdc3b.entry.js.map +0 -1
- /package/dist/core/{p-a853709d.entry.js.map → p-d5b2d142.entry.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-stepper-item.js","mappings":";;;;;;;AAAA,MAAM,iBAAiB,GAAG,unQAAunQ;;MCapoQA,gBAAc;EAK1B;;;;;mBAYgD,SAAS;gBAId,GAAG;;;;sBAgBoB,IAAI;IA/BrE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAA;IAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAA;GAC9C;EAmCD,aAAa,CAAC,QAAgB;IAC7B,IAAI,CAAC,QAAQ,EAAE;MACd,WAAW,CAAC,IAAI,gBAAgB,CAAC,IAAI,iCAAiC,CAAC,CAAA;KACvE;GACD;EAGD,kBAAkB,CAAC,QAAgB;IAClC,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IAC9D,IAAI,QAAQ,EAAE;MACb,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClC,WAAW,CAAC,IAAI,gBAAgB,CAAC,IAAI,UAAU,QAAQ,kBAAkB,CAAC,CAAA;OAC1E;KACD;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OAAO,EAAE,EAAE,EAAE,SAAS,qBAAmB,SAAS,EAAE,IAAI,EAAC,UAAU,IAC/F,YAAM,IAAI,EAAC,SAAS,GAAG,CAClB,CACN,CACK,EACP;GACD;;;;EAMD,MAAM,YAAY;IACjB,OAAO,IAAI,CAAC,eAAe,CAAA;GAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovStepperItem"],"sources":["../../../packages/core/src/components/gov-stepper/gov-stepper-item.scss?tag=gov-stepper-item","../../../packages/core/src/components/gov-stepper/gov-stepper-item.tsx"],"sourcesContent":["/*\n * Stepper - Item\n */\n\n@import \"../gov-wizzard/gov-wizzard-item-core.scss\";\n$class: \".gov-stepper-item\";\n\n#{$class} {\n\t@include wizzard-item-core;\n\t&::before {\n\t\t@include pseudo();\n\t\twidth: rem-calc(2);\n\t}\n\t&:last-child::before {\n\t\tcontent: none;\n\t}\n\n\t// VARIANTS\n\t@each $variant, $definitions in $wizzard-core-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\t&::before {\n\t\t\t\tbackground: get(\"indicator-bg\", $definitions);\n\t\t\t}\n\t\t}\n\t}\n\t@each $size, $definitions in $stepper-sizes {\n\t\t$connect-gap: get(\"connect-gap\", $definitions);\n\t\t&[size=\"#{$size}\"] {\n\t\t\tmin-height: calc(get(\"indicator-size\", $definitions) + 3 * $connect-gap);\n\t\t\t&::before {\n\t\t\t\ttop: calc(get(\"indicator-size\", $definitions) + $connect-gap);\n\t\t\t\tbottom: $connect-gap;\n\t\t\t\tleft: calc((get(\"indicator-size\", $definitions) - rem-calc(2)) / 2);\n\t\t\t}\n\t\t\t&:last-child {\n\t\t\t\tmin-height: 0;\n\t\t\t}\n\t\t\t#{$class} {\n\t\t\t\t&__title {\n\t\t\t\t\t@include typography(get(\"font-size\", $definitions));\n\t\t\t\t}\n\t\t\t\t&__annot {\n\t\t\t\t\t@include typography(get(\"font-size-annot\", $definitions));\n\t\t\t\t}\n\t\t\t\t&__prefix {\n\t\t\t\t\t@include typography(get(\"font-size-indicator\", $definitions));\n\t\t\t\t\twidth: get(\"indicator-size\", $definitions);\n\t\t\t\t\theight: get(\"indicator-size\", $definitions);\n\t\t\t\t\tbox-shadow: 0 0 0 $connect-gap color(\"neutral.white\");\n\t\t\t\t}\n\t\t\t\t&__content {\n\t\t\t\t\tpadding: get(\"content-padding\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t&--w-annot[size=\"#{$size}\"] {\n\t\t\tmin-height: calc(get(\"indicator-size\", $definitions) * 1.5 + 3 * $connect-gap);\n\t\t}\n\t}\n}\n","import { Component, Element, h, Prop, State, Watch, Host, Method, Event, EventEmitter } from '@stencil/core'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { StepperSizesType, StepperItemClass, StepperVariantType, StepperVariants } from './constants'\nimport { createID } from '../../utils/string.utils'\nimport { govHost, prepareClasses } from '../../helpers/Dom/template'\nimport { GovStepperItemChangeEvent } from './gov-stepper-item.d'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-stepper-item',\n\tstyleUrl: 'gov-stepper-item.scss',\n})\nexport class GovStepperItem {\n\tprivate h: GovHost\n\tprivate readonly triggerId: string\n\tprivate readonly contentId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.triggerId = createID('GovStepperItem')\n\t\tthis.contentId = createID('GovStepperContent')\n\t}\n\n\t@Element() readonly host: HTMLGovStepperItemElement\n\t@State() isExpandedState: boolean\n\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly variant?: StepperVariantType = 'primary'\n\t/**\n\t * Size of stepper\n\t */\n\t@Prop() readonly size?: StepperSizesType = 'm'\n\t/**\n\t * Custom stepper item identifier. Otherwise, it will be generated\n\t */\n\t@Prop() readonly identifier: string\n\t/**\n\t * Item name of the stepper\n\t */\n\t@Prop() readonly label: string\n\t/**\n\t * Item annotation of the stepper\n\t */\n\t@Prop() readonly annotation: string\n\t/**\n\t * Used to change the HMTL tag in the stepper trigger for correct semantic structure\n\t */\n\t@Prop({ attribute: 'trigger-tag' }) readonly triggerTag: string = 'h3'\n\t/**\n\t * Called when the accordion state changes\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<GovStepperItemChangeEvent>\n\n\t@Watch('label')\n\tvalidateLabel(newValue: string): void {\n\t\tif (!newValue) {\n\t\t\tgovErrorLog(`[${StepperItemClass.root}]: Parameter label is required.`)\n\t\t}\n\t}\n\n\t@Watch('triggerTag')\n\tvalidateTriggerTag(newValue: string): void {\n\t\tconst validTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span']\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${StepperItemClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(StepperVariants, newValue, StepperItemClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateLabel(this.label)\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateTriggerTag(this.triggerTag)\n\t}\n\n\trender() {\n\t\tconst triggerId = this.identifier || this.triggerId\n\t\tconst contentId = this.contentId\n\t\tconst { label } = this\n\t\tconst TriggerTag = this.triggerTag\n\n\t\treturn (\n\t\t\t<Host class={prepareClasses([StepperItemClass.root, this.annotation && StepperItemClass.rootWithAnnot])} variant={this.variant}>\n\t\t\t\t<div id={triggerId} class={StepperItemClass.header} role=\"listitem\">\n\t\t\t\t\t<TriggerTag class={StepperItemClass.title}>\n\t\t\t\t\t\t{this.h.hasSlot('prefix') && (\n\t\t\t\t\t\t\t<span class={StepperItemClass.prefix}>\n\t\t\t\t\t\t\t\t<slot name=\"prefix\" />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<span class={StepperItemClass.name}>\n\t\t\t\t\t\t\t<span class={StepperItemClass.label}>{label}</span>\n\t\t\t\t\t\t\t{this.annotation && <span class={StepperItemClass.annot}>{this.annotation}</span>}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</TriggerTag>\n\t\t\t\t</div>\n\n\t\t\t\t{this.h.hasSlot('content') && (\n\t\t\t\t\t<div class={StepperItemClass.content} id={contentId} aria-labelledby={triggerId} role=\"tabpanel\">\n\t\t\t\t\t\t<slot name=\"content\" />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync currentState(): Promise<boolean> {\n\t\treturn this.isExpandedState\n\t}\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-stepper.js","mappings":";;;;;AAAA,MAAM,aAAa,GAAG,gZAAgZ;;MCYzZA,YAAU;EAGtB;;;;gBAQ2C,GAAG;IAP7C,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;GAC3B;EAaD,YAAY,CAAC,QAAgB;IAC5B,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;GACvD;EAED,iBAAiB;IAChB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;GAC5B;EAED,gBAAgB;IACf,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,KAAgC;MAC1F,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;MACrC,KAAK,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAuD;QAC5F,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;OAC7B,CAA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;;;;;;;;","names":["GovStepper"],"sources":["../../../packages/core/src/components/gov-stepper/gov-stepper.scss?tag=gov-stepper","../../../packages/core/src/components/gov-stepper/gov-stepper.tsx"],"sourcesContent":["/*\n * Stepper\n */\n\n$class: \".gov-stepper\";\n\n#{$class} {\n\t@include base();\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { StepperClass, StepperItemClass, StepperSizes, StepperSizesType } from './constants'\nimport { GovStepperItemCustomEvent } from '../../components'\nimport { GovStepperItemChangeEvent } from './gov-stepper-item.d'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { govHost } from '../../helpers/Dom/template'\n\n@Component({\n\ttag: 'gov-stepper',\n\tstyleUrl: 'gov-stepper.scss',\n})\nexport class GovStepper {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() readonly host: HTMLGovStepperElement\n\t/**\n\t * Size of stepper\n\t */\n\t@Prop() readonly size?: StepperSizesType = 'm'\n\t/**\n\t * Called when the Stepper state changes\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<GovStepperItemChangeEvent>\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(StepperSizes, newValue, StepperClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateSize(this.size)\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.host.querySelectorAll(StepperItemClass.root).forEach((child: HTMLGovStepperItemElement) => {\n\t\t\tchild.setAttribute('size', this.size)\n\t\t\tchild.addEventListener('gov-change', (e: GovStepperItemCustomEvent<GovStepperItemChangeEvent>) => {\n\t\t\t\te.stopPropagation()\n\t\t\t\tthis.govChange.emit(e.detail)\n\t\t\t})\n\t\t})\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(StepperClass.root)} role=\"list\" size={this.size}>\n\t\t\t\t<slot />\n\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C,KAAK;oBACrB,KAAK;IAtBxB,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAA;IAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAA;GACzC;EAqBD,MAAM;IACL,QACC,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,IACrE,WACC,KAAK,EAAE,aAAa,CAAC,KAAK,EAC1B,IAAI,EAAC,UAAU,EACf,EAAE,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,EACrC,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,qBACL,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,QAAQ,iBAC3C,mBAAmB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAEhD,eAAa,CACR,CACA,EACP;GACD;;;;EAMD,MAAM,aAAa;IAClB,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,CAAA;GACxC;;;;EAMD,MAAM,oBAAoB;IACzB,OAAO,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,QAAQ,CAAA;GAC9C;;;;EAMD,MAAM,eAAe,CAAC,MAAe;IACpC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAA;GACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovTabsItem"],"sources":["../../../packages/core/src/components/gov-tabs/gov-tabs-item.scss?tag=gov-tabs-item","../../../packages/core/src/components/gov-tabs/gov-tabs-item.tsx"],"sourcesContent":["/*\n * Tabs - Item\n */\n\n$class: \".gov-tabs-item\";\n\n#{$class} {\n\tcolor: $tabs-text-color;\n\t&__inner {\n\t\t@include reset-last-margin();\n\t}\n}\n","import { Component, Element, h, Prop, Method, State, Host } from '@stencil/core'\nimport { createID } from '../../utils/string.utils'\nimport { govHost, toBoolAttrIfDefined } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { TabsItemClass } from './constants'\n\n@Component({\n\ttag: 'gov-tabs-item',\n\tstyleUrl: 'gov-tabs-item.scss',\n})\nexport class GovTabsItem {\n\tprivate h: GovHost\n\tprivate readonly contentId: string\n\tprivate readonly triggeId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.contentId = createID('GovTabContent')\n\t\tthis.triggeId = createID('GovTabTrigger')\n\t}\n\n\t@Element() host: HTMLGovTabsItemElement\n\t/**\n\t * Custom tab item identifier. Otherwise, it will be generated\n\t */\n\t@Prop() readonly identifier: string\n\t/**\n\t * Custom tab trigger item identifier. Otherwise, it will be generated\n\t */\n\t@Prop() readonly triggerIdentifier: string\n\t/**\n\t * Item name of the tab\n\t */\n\t@Prop() readonly label: string\n\t/**\n\t * Default selected tab\n\t */\n\t@Prop() readonly default: boolean = false\n\t@State() isActive = false\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(TabsItemClass.root)} default={this.default}>\n\t\t\t\t<div\n\t\t\t\t\tclass={TabsItemClass.inner}\n\t\t\t\t\trole=\"tabpanel\"\n\t\t\t\t\tid={this.identifier || this.contentId}\n\t\t\t\t\thidden={!this.isActive}\n\t\t\t\t\taria-labelledby={this.triggerIdentifier || this.triggeId}\n\t\t\t\t\taria-hidden={toBoolAttrIfDefined(!this.isActive)}\n\t\t\t\t>\n\t\t\t\t\t<slot></slot>\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Returns a unique tab content identifier\n\t */\n\t@Method()\n\tasync getIdentifier(): Promise<string> {\n\t\treturn this.identifier || this.contentId\n\t}\n\n\t/**\n\t * Returns a unique tab trigger identifier\n\t */\n\t@Method()\n\tasync getTriggerIdentifier(): Promise<string> {\n\t\treturn this.triggerIdentifier || this.triggeId\n\t}\n\n\t/**\n\t * Set status of tab-item\n\t */\n\t@Method()\n\tasync setActiveStatus(status: boolean): Promise<void> {\n\t\tthis.isActive = status\n\t}\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-tabs.js","mappings":";;;;;;;;;;;;AAAA,MAAM,UAAU,GAAG,q1JAAq1J;;MCiB31JA,SAAO;EAOnB;;;;IALQ,gBAAW,GAAyC,EAAE,CAAA;sBAWhB,EAAE;sBAC1B,CAAC;2BACI,KAAK;gBAIC,MAAM;mBAIE,SAAS;uBAIC,YAAY;;;;IAnB9D,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAA;GAC5C;EAoCD,YAAY,CAAC,QAAgB;IAC5B,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;GAChD;EAED,eAAe,CAAC,QAAgB;IAC/B,YAAY,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;GACnD;EAED,iBAAiB;IAChB,IAAI,CAAC,iBAAiB,EAAE,CAAA;GACxB;EAED,MAAM,kBAAkB;IACvB,IAAI,uBAAuB,EAAE,EAAE;MAC9B,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;MAChB,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;KACzB;IAED,IAAI,CAAC,cAAc,EAAE,CAAA;GACrB;EAEO,iBAAiB;IACxB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;IACpB,MAAM,QAAQ,GAAoC,EAAE,CAAA;IACpD,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAA2B;MAClF,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,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IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1E,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAChD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAA;QACrB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,CAAA;QACnD,IAAI,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAA;QACtC,IAAI,CAAC,QAAQ,EAAE,CAAA;QACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,CAAA;OACjD;KACD;GACD;;;;EAMD,MAAM,OAAO;IACZ,IAAI,CAAC,iBAAiB,EAAE,CAAA;GACxB;;;;EAMD,MAAM,UAAU;IACf,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC,OAAO,IAAI,IAAI,CAAA;GAC3C;;;;EAMD,MAAM,YAAY,CAAC,UAAkB;IACpC,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAA;IACtC,IAAI,CAAC,QAAQ,EAAE,CAAA;GACf;;;;EAMD,MAAM,YAAY;IACjB,gBAAgB,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;IAC3E,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;GACtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovTabs"],"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\ttext-transform: uppercase;\n\t\ttransition: $t linear color, $t linear border-color;\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 {\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, Host, h, State, Method, Event, EventEmitter, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { TabsItemClass, TabVariants, VariantType } from './constants'\nimport { GovTabControllerItem } from './gov-tabs.types'\nimport { govHost, toBoolAttr } from '../../helpers/Dom/template'\nimport { validateWcagLabel, validateWcagProp } from '../../helpers/Validate/wcag'\nimport { TabsClass, TabType, TabTypes, TabOrientationType } from './constants'\nimport { canValidateWcagOnRender } from '../../helpers/Dom/win'\nimport { delay, throttle } from '../../utils/utils'\nimport { createID } from '../../utils/string.utils'\nimport { Nullable } from '../../types/interfaces'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tabs',\n\tstyleUrl: 'gov-tabs.scss',\n})\nexport class GovTabs {\n\tprivate h: GovHost\n\tprivate triggerRefs: { [key: string]: HTMLButtonElement } = {}\n\tprivate tabsRef?: HTMLDivElement\n\n\tprivate readonly formSelectId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.formSelectId = createID('GovForSelect')\n\t}\n\n\t@Element() host: HTMLGovTabsElement\n\t@State() controller: 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 badges.\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 wcagSelectLabel: 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\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(TabVariants, newValue, TabsClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.prepareDataSource()\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.resizeObserver()\n\t}\n\n\tprivate prepareDataSource(): void {\n\t\tthis.controller = []\n\t\tconst promises: Promise<GovTabControllerItem>[] = []\n\t\tthis.host.querySelectorAll(TabsItemClass.root).forEach((tab: HTMLGovTabsItemElement) => {\n\t\t\tconst controlItem = Promise.all([tab.getIdentifier(), tab.getTriggerIdentifier()]).then(([identifier, triggerIdentifier]) => {\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\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\tlet defaultTab = controllers.findIndex(controller => controller.default)\n\t\t\tif (defaultTab === -1) defaultTab = 0\n\t\t\tthis.focusIndex = defaultTab\n\t\t\tcontrollers[defaultTab].active = true\n\t\t\tthis.controller = [...controllers]\n\t\t\tthis.reRender()\n\t\t})\n\t}\n\n\tprivate setActiveByIdentifier(identifier: string) {\n\t\tconst temp = []\n\t\tthis.controller.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.controller = [...temp]\n\t}\n\n\tprivate reRender() {\n\t\tthis.controller.map(control => {\n\t\t\tcontrol.element.setActiveStatus(control.active)\n\t\t})\n\t}\n\n\t/*\n\tprivate evaluateControls() {\n\t\tthis.compactControls = false\n\t\tlet sumOfWidth = this.tabsRef.querySelector(\"ul\").offsetWidth\n\t\tthis.compactControls = this.tabsRef.offsetWidth < sumOfWidth\n\t}\n\t*/\n\n\tprivate resizeObserver() {\n\t\tconst resizeObserver = new ResizeObserver(\n\t\t\tthrottle(() => {\n\t\t\t\t// this.evaluateControls()\n\t\t\t}, 200)\n\t\t)\n\n\t\tresizeObserver.observe(this.tabsRef)\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\tref={el => (this.tabsRef = el as HTMLDivElement)}\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.controller.map((control, index) => (\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, index)}\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 ? -1 : 0}\n\t\t\t\t\t\t\t\t\t\tref={el => (this.triggerRefs[control.triggerIdentifier] = el as HTMLInputElement)}\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-badge\n\t\t\t\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\t\t\t\ttype={toBoolAttr(control.active) == 'true' ? 'solid' : 'outlined'}\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onSelectHandler(control, index)}\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-badge>\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.wcagSelectLabel}\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.controller.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.controller.find(control => control.active) || null\n\t}\n\n\tprivate onSelectHandler(control: GovTabControllerItem, index: number) {\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\t\te.stopPropagation()\n\t\tif (keyCode === 39 || keyCode === 37) {\n\t\t\tif (false === (this.focusIndex >= 0 && this.focusIndex <= this.controller.length - 1)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.controller[this.focusIndex].active = false\n\t\t\tif (keyCode === 39) {\n\t\t\t\tthis.focusIndex++\n\t\t\t\tif (this.focusIndex >= this.controller.length) {\n\t\t\t\t\tthis.focusIndex = 0\n\t\t\t\t}\n\t\t\t} else if (keyCode === 37) {\n\t\t\t\tthis.focusIndex--\n\t\t\t\tif (this.focusIndex < 0) {\n\t\t\t\t\tthis.focusIndex = this.controller.length - 1\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.focusIndex >= 0 && this.focusIndex <= this.controller.length - 1) {\n\t\t\t\tconst current = this.controller[this.focusIndex]\n\t\t\t\tcurrent.active = true\n\t\t\t\tthis.triggerRefs[current.triggerIdentifier].focus()\n\t\t\t\tthis.controller = [...this.controller]\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.prepareDataSource()\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 * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagProp(this.wcagSelectLabel, 'wcag-select-label', TabsClass.root)\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, TabsClass.root)\n\t}\n}\n"],"version":3}
|
|
1
|
+
{"file":"gov-tabs.js","mappings":";;;;;;;;;;;;AAAA,MAAM,UAAU,GAAG,q1JAAq1J;;MCiB31JA,SAAO;EAOnB;;;;IALQ,gBAAW,GAAyC,EAAE,CAAA;sBAWhB,EAAE;sBAC1B,CAAC;2BACI,KAAK;gBAIC,MAAM;mBAIE,SAAS;uBAIC,YAAY;;;;IAnB9D,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAA;GAC5C;EAoCD,YAAY,CAAC,QAAgB;IAC5B,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;GAChD;EAED,eAAe,CAAC,QAAgB;IAC/B,YAAY,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;GACnD;EAED,iBAA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,CAAC,UAAU,CAAC,CAAA;IACtC,IAAI,CAAC,QAAQ,EAAE,CAAA;GACf;;;;EAMD,MAAM,YAAY;IACjB,gBAAgB,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;IAC3E,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;GACtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovTabs"],"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\ttext-transform: uppercase;\n\t\ttransition: $t linear color, $t linear border-color;\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 {\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, Host, h, State, Method, Event, EventEmitter, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { TabsItemClass, TabVariants, VariantType } from './constants'\nimport { GovTabControllerItem } from './gov-tabs.types'\nimport { govHost, toBoolAttr } from '../../helpers/Dom/template'\nimport { validateWcagLabel, validateWcagProp } from '../../helpers/Validate/wcag'\nimport { TabsClass, TabType, TabTypes, TabOrientationType } from './constants'\nimport { canValidateWcagOnRender } from '../../helpers/Dom/win'\nimport { delay, throttle } from '../../utils/utils'\nimport { createID } from '../../utils/string.utils'\nimport { Nullable } from '../../types/interfaces'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tabs',\n\tstyleUrl: 'gov-tabs.scss',\n})\nexport class GovTabs {\n\tprivate h: GovHost\n\tprivate triggerRefs: { [key: string]: HTMLButtonElement } = {}\n\tprivate tabsRef?: HTMLDivElement\n\n\tprivate readonly formSelectId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.formSelectId = createID('GovForSelect')\n\t}\n\n\t@Element() host: HTMLGovTabsElement\n\t@State() controller: 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 badges.\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 wcagSelectLabel: 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\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(TabVariants, newValue, TabsClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.prepareDataSource()\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.resizeObserver()\n\t}\n\n\tprivate prepareDataSource(): void {\n\t\tthis.controller = []\n\t\tconst promises: Promise<GovTabControllerItem>[] = []\n\t\tthis.host.querySelectorAll(TabsItemClass.root).forEach((tab: HTMLGovTabsItemElement) => {\n\t\t\tconst controlItem = Promise.all([tab.getIdentifier(), tab.getTriggerIdentifier()]).then(([identifier, triggerIdentifier]) => {\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\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\tlet defaultTab = controllers.findIndex(controller => controller.default)\n\t\t\tif (defaultTab === -1) defaultTab = 0\n\t\t\tthis.focusIndex = defaultTab\n\t\t\tcontrollers[defaultTab].active = true\n\t\t\tthis.controller = [...controllers]\n\t\t\tthis.reRender()\n\t\t})\n\t}\n\n\tprivate setActiveByIdentifier(identifier: string) {\n\t\tconst temp = []\n\t\tthis.controller.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.controller = [...temp]\n\t}\n\n\tprivate reRender() {\n\t\tthis.controller.map(control => {\n\t\t\tcontrol.element.setActiveStatus(control.active)\n\t\t})\n\t}\n\n\t/*\n\tprivate evaluateControls() {\n\t\tthis.compactControls = false\n\t\tlet sumOfWidth = this.tabsRef.querySelector(\"ul\").offsetWidth\n\t\tthis.compactControls = this.tabsRef.offsetWidth < sumOfWidth\n\t}\n\t*/\n\n\tprivate resizeObserver() {\n\t\tconst resizeObserver = new ResizeObserver(\n\t\t\tthrottle(() => {\n\t\t\t\t// this.evaluateControls()\n\t\t\t}, 200)\n\t\t)\n\n\t\tresizeObserver.observe(this.tabsRef)\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\tref={el => (this.tabsRef = el as HTMLDivElement)}\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.controller.map((control, index) => (\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, index)}\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 ? -1 : 0}\n\t\t\t\t\t\t\t\t\t\tref={el => (this.triggerRefs[control.triggerIdentifier] = el as HTMLInputElement)}\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-badge\n\t\t\t\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\t\t\t\ttype={toBoolAttr(control.active) == 'true' ? 'solid' : 'outlined'}\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onSelectHandler(control, index)}\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-badge>\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.wcagSelectLabel}\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.controller.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.controller.find(control => control.active) || null\n\t}\n\n\tprivate onSelectHandler(control: GovTabControllerItem, index: number) {\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\t\te.stopPropagation()\n\t\tif (keyCode === 39 || keyCode === 37) {\n\t\t\tif (false === (this.focusIndex >= 0 && this.focusIndex <= this.controller.length - 1)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.controller[this.focusIndex].active = false\n\t\t\tif (keyCode === 39) {\n\t\t\t\tthis.focusIndex++\n\t\t\t\tif (this.focusIndex >= this.controller.length) {\n\t\t\t\t\tthis.focusIndex = 0\n\t\t\t\t}\n\t\t\t} else if (keyCode === 37) {\n\t\t\t\tthis.focusIndex--\n\t\t\t\tif (this.focusIndex < 0) {\n\t\t\t\t\tthis.focusIndex = this.controller.length - 1\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.focusIndex >= 0 && this.focusIndex <= this.controller.length - 1) {\n\t\t\t\tconst current = this.controller[this.focusIndex]\n\t\t\t\tcurrent.active = true\n\t\t\t\tthis.triggerRefs[current.triggerIdentifier].focus()\n\t\t\t\tthis.controller = [...this.controller]\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.prepareDataSource()\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 * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagProp(this.wcagSelectLabel, 'wcag-select-label', TabsClass.root)\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, TabsClass.root)\n\t}\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-tile.js","mappings":";;;;;AAAO,MAAM,SAAS,GAAG;EACxB,IAAI,EAAE,UAAU;EACh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C,IAAI,IACzB,YAAM,IAAI,EAAC,MAAM,GAAG,CACf,CACN,EACD,UAAI,KAAK,EAAE,SAAS,CAAC,KAAK,IACzB,YAAM,KAAK,EAAE,SAAS,CAAC,OAAO,IAC5B,IAAI,CAAC,IAAI,EACV,gBAAU,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,EAAC,eAAe,GAAY,CAC5D,CACH,EACL,WAAK,KAAK,EAAE,SAAS,CAAC,OAAO,IAC5B,eAAQ,CACH,CACH,KAEJ,gBACE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KACtB,WAAK,KAAK,EAAE,SAAS,CAAC,IAAI,IACzB,YAAM,IAAI,EAAC,MAAM,GAAG,CACf,CACN,EACD,UAAI,KAAK,EAAE,SAAS,CAAC,KAAK,IACxB,gBAAO,IAAI,CAAC,IAAI,CAAQ,CACrB,EACL,WAAK,KAAK,EAAE,SAAS,CAAC,OAAO,IAC5B,eAAQ,CACH,CACA,CACP,CAEK,EACP;GACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovTile"],"sources":["../../../packages/core/src/components/gov-tile/constants.ts","../../../packages/core/src/components/gov-tile/gov-tile.scss?tag=gov-tile","../../../packages/core/src/components/gov-tile/gov-tile.tsx"],"sourcesContent":["export const TileClass = {\n\troot: 'gov-tile',\n\ticon: 'gov-tile__icon',\n\tarrow: 'gov-tile__arrow',\n\ttitle: 'gov-tile__title',\n\tlink: 'gov-tile__link',\n\tcontent: 'gov-tile__content',\n\theading: 'gov-tile__heading',\n}\n","/*\n * Tile\n */\n\n$class: \".gov-tile\";\n\n#{$class} {\n\t@include base();\n\tpadding: rem-calc(12);\n\ttransition: background-color $t;\n\t&__icon {\n\t\tdisplay: flex;\n\t\tmargin: rem-calc(0 0 12);\n\t\tcolor: $tile-main-color;\n\t\t.gov-icon {\n\t\t\twidth: rem-calc(40);\n\t\t\theight: rem-calc(40);\n\t\t}\n\t}\n\t&__title {\n\t\t@include typography($font-size-xl);\n\t\tmargin: 0 0 rem-calc(8);\n\t}\n\t&__heading {\n\t\t@extend %link-mask;\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\tjustify-content: space-between;\n\t\tcolor: $tile-main-color;\n\t\ttext-decoration: none;\n\t}\n\t&__arrow {\n\t\tflex: 0 0 auto;\n\t\twidth: rem-calc(12);\n\t\theight: rem-calc(32);\n\t\tmargin: rem-calc(8);\n\t\tcolor: inherit;\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t\tcolor: $tile-text-color;\n\t\ta {\n\t\t\tposition: relative;\n\t\t\tz-index: 1;\n\t\t}\n\t}\n\t&__link {\n\t\tdisplay: block;\n\t\ttext-decoration: none;\n\t}\n\n\t// HOVERS\n\t&[href] {\n\t\t@include hover() {\n\t\t\tbackground: $tile-hover-bg;\n\t\t\t#{$class} {\n\t\t\t\t&__heading {\n\t\t\t\t\tcolor: $tile-main-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// VARIANTS\n\t\t@include parameter(\"promotion\") {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: auto 1fr;\n\t\t\tgap: 0 rem-calc(14);\n\t\t\t#{$class} {\n\t\t\t\t&__icon {\n\t\t\t\t\tgrid-area: 1/1/3/1;\n\t\t\t\t\tmargin: 0;\n\t\t\t\t}\n\t\t\t\t&__title {\n\t\t\t\t\tgrid-area: 1/2/1/2;\n\t\t\t\t}\n\t\t\t\t&__content {\n\t\t\t\t\tgrid-area: 2/2/2/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: md) {\n\t\tpadding: rem-calc(24);\n\t\t&__icon {\n\t\t\tmargin: rem-calc(0 0 24);\n\t\t\t.gov-icon {\n\t\t\t\twidth: rem-calc(48);\n\t\t\t\theight: rem-calc(48);\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: lg) {\n\t\t// VARIANTS\n\t\t@include parameter(\"promotion\") {\n\t\t\tgap: 0 rem-calc(26);\n\t\t}\n\t}\n}\n","\timport { Component, Element, h, Host, Prop, Watch } from '@stencil/core'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { TileClass } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tile',\n\tstyleUrl: 'gov-tile.scss',\n})\nexport class GovTile {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovTileElement\n\t/**\n\t * Style variation of the card.\n\t */\n\t@Prop() readonly promotion: boolean = false\n\t/**\n\t * Link on whole tile\n\t */\n\t@Prop() readonly href: string\n\t/**\n\t * Item name\n\t */\n\t@Prop() readonly name: string\n\n\t@Watch('name')\n\tvalidateName(newValue: string): void {\n\t\tif (!newValue) {\n\t\t\tgovErrorLog(`[${TileClass.root}]: Parameter title is required.`)\n\t\t}\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateName(this.name)\n\t}\n\n\trender() {\n\t\t// tag type\n\t\treturn (\n\t\t\t<Host class={this.h.classes(TileClass.root)} promotion={this.promotion}>\n\t\t\t\t{this.href ? (\n\t\t\t\t\t<a href={this.href} class={TileClass.link}>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t\t<div class={TileClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<h3 class={TileClass.title}>\n\t\t\t\t\t\t\t<span class={TileClass.heading}>\n\t\t\t\t\t\t\t\t{this.name}\n\t\t\t\t\t\t\t\t<gov-icon class={TileClass.arrow} name=\"chevron-right\"></gov-icon>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<div class={TileClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<span>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t\t<div class={TileClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<h3 class={TileClass.title}>\n\t\t\t\t\t\t\t\t<span>{this.name}</span>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<div class={TileClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-tiles.js","mappings":";;;AAAO,MAAM,UAAU,GAAG;EACzB,IAAI,EAAE,WAAW;CACjB;;ACFD,MAAM,WAAW,GAAG,69DAA69D;;MCUp+DA,UAAQ;EAGpB;;;mBAMmC,CAAC;oBAI2B,KAAK;IATnE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;GAC3B;EAYD,IAAI,UAAU;IACb,OAAO,cAAc,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,UAAU,CAAC,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;GAChG;EAED,MAAM;IACL,QACC,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAC3C,eAAQ,CACF,EACP;GACD
|
|
1
|
+
{"file":"gov-tiles.js","mappings":";;;AAAO,MAAM,UAAU,GAAG;EACzB,IAAI,EAAE,WAAW;CACjB;;ACFD,MAAM,WAAW,GAAG,69DAA69D;;MCUp+DA,UAAQ;EAGpB;;;mBAMmC,CAAC;oBAI2B,KAAK;IATnE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;GAC3B;EAYD,IAAI,UAAU;IACb,OAAO,cAAc,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,UAAU,CAAC,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;GAChG;EAED,MAAM;IACL,QACC,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAC3C,eAAQ,CACF,EACP;GACD;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovTiles"],"sources":["../../../packages/core/src/components/gov-tile/container/constants.ts","../../../packages/core/src/components/gov-tile/container/gov-tiles.scss?tag=gov-tiles","../../../packages/core/src/components/gov-tile/container/gov-tiles.tsx"],"sourcesContent":["export const TilesClass = {\n\troot: 'gov-tiles',\n}\n","/*\n * Tiles\n */\n\n$class: \".gov-tiles\";\n$line-width: rem-calc(1);\n\n@mixin grid-lines($i) {\n\tgrid-template-columns: repeat(#{$i}, 1fr);\n\t& > * {\n\t\tborder-width: $line-width $line-width $line-width 0;\n\t\t&:nth-child(-n + #{$i + 1}) {\n\t\t\tborder-top-width: 0;\n\t\t}\n\t\t&:nth-child(#{$i}n + #{$i}) {\n\t\t\tborder-right-width: 0;\n\t\t}\n\t}\n}\n\n#{$class} {\n\toverflow: hidden;\n\t& > * {\n\t\tmargin: 0 calc($line-width * -1) calc($line-width * -1) 0;\n\t\tborder: $line-width solid $tiles-border-color;\n\t\tborder-width: 0 0 $line-width;\n\t\t&:last-child {\n\t\t\tborder-bottom-width: 0;\n\t\t}\n\t}\n\t&[no-border] {\n\t\t& > * {\n\t\t\tborder: none;\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@include mq($from: md) {\n\t\tdisplay: grid;\n\t\t&--x2 {\n\t\t\t@include grid-lines(2);\n\t\t}\n\t\t@include mq($until: lg) {\n\t\t\t&--x3,\n\t\t\t&--x4 {\n\t\t\t\t@include grid-lines(2);\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: lg) {\n\t\t&--x3 {\n\t\t\t@include grid-lines(3);\n\t\t}\n\t\t@include mq($until: xl) {\n\t\t\t&--x4 {\n\t\t\t\t@include grid-lines(3);\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: xl) {\n\t\t&--x4 {\n\t\t\t@include grid-lines(4);\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Prop } from '@stencil/core'\nimport { TilesClass } from './constants'\nimport { prepareClasses } from '../../../helpers/Dom/template'\nimport { govHost } from '../../../helpers/Dom/template'\nimport { GovHost } from '../../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tiles',\n\tstyleUrl: 'gov-tiles.scss',\n})\nexport class GovTiles {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\t/**\n\t * Number of columns between 1-4\n\t */\n\t@Prop() readonly columns: number = 3\n\t/**\n\t * Tiles border\n\t */\n\t@Prop({ attribute: 'no-border' }) readonly noBorder: boolean = false\n\n\t@Element() host: HTMLGovTilesElement\n\n\tget classNames(): string {\n\t\treturn prepareClasses([TilesClass.root, this.columns && TilesClass.root + '--x' + this.columns])\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(this.classNames)}>\n\t\t\t\t<slot />\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-toast.js","mappings":";;;;;;;;;AAIO,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAA;AAG1E,IAAI,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAC;AAGpD,MAAM,UAAU,GAAG;EACz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AG,IAAI,CAAC,UAAU,GAAG,gBAAU,IAAI,EAAC,MAAM,GAAY,CAC1D,CACR,EAEN,WAAK,KAAK,EAAE,UAAU,CAAC,KAAK,GAAQ,CAC9B,EACP;GACD;EAEO,cAAc;IACrB,IAAI,CAAC,OAAO,EAAE;OACZ,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;OAC5C,KAAK,EAAE,CAAA;GACT;EAED,IAAI,OAAO;IACV,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,CAAA;GAC5B;EAED,IAAI,OAAO;IACV,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;GACnD;;;;EAMD,MAAM,OAAO;IACZ,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC1B,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,mBAAmB,IAAI,CAAC,OAAO,IAAI,CAAC,CAAA;IACzE,IAAI,KAAK,EAAE;MACV,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;MACtC,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU,EAAE;QACvC,KAAK,CAAC,MAAM,EAAE,CAAA;OACd;KACD;GACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovToast"],"sources":["../../../packages/core/src/components/gov-toast/constants.ts","../../../packages/core/src/components/gov-toast/gov-toast.scss?tag=gov-toast","../../../packages/core/src/components/gov-toast/gov-toast.tsx"],"sourcesContent":["import { Variants, Types } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const ToastVariants = pick(Variants, ['SUCCESS', 'WARNING', 'ERROR', 'SECONDARY', 'PRIMARY'])\nexport type ToastVariantType = `${ValueOf<typeof ToastVariants>}`\n\nexport const ToastTypes = pick(Types, ['CLASSIC', 'SOLID'])\nexport type ToastTypesType = `${ValueOf<typeof ToastTypes>}`\n\nexport const ToastClass = {\n\troot: 'gov-toast',\n\thidden: 'gov-toast--hidden',\n\ticon: 'gov-toast__icon',\n\tcontent: 'gov-toast__content',\n\tclose: 'gov-toast__close',\n\ttimer: 'gov-toast__timer',\n}\n","/*\n * Alert\n */\n\n@import \"./gov-toast-message-core.scss\";\n$class: \".gov-toast\";\n\n#{$class} {\n\t@include toast-message-core;\n\t@include z-index(\"toast\", 1);\n\tposition: relative;\n\tposition: fixed;\n\tmax-width: rem-calc(375);\n\tpadding-right: rem-calc(50);\n\topacity: 1;\n\ttransition: opacity 300ms ease-in-out;\n\t&__content {\n\t\tpadding-right: 0;\n\t}\n\t&__close {\n\t\tposition: absolute;\n\t\ttop: rem-calc(8);\n\t\tright: rem-calc(12);\n\t}\n\t&__timer {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\tz-index: -1;\n\t}\n\n\t// VARIANTS\n\t&--hidden {\n\t\topacity: 0;\n\t}\n\t&[gravity=\"top\" i] {\n\t\ttop: rem-calc(16);\n\t}\n\t&[gravity=\"bottom\" i] {\n\t\tbottom: rem-calc(16);\n\t}\n\t&[position=\"left\" i] {\n\t\tleft: rem-calc(16);\n\t}\n\t&[position=\"center\" i] {\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t}\n\t&[position=\"right\" i] {\n\t\tright: rem-calc(16);\n\t}\n\t&[type=\"solid\" i] {\n\t\tborder: none;\n\t\tborder-radius: rem-calc(4);\n\t\toverflow: hidden;\n\t\tbox-shadow: none;\n\t\t&.is-initialized #{$class}__timer {\n\t\t\ttransform-origin: left;\n\t\t\tanimation: countdown linear forwards var(--toast-duration, 0);\n\t\t}\n\t}\n\n\t@each $variant, $definitions in $toast-message-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\tborder-left-color: get(\"decor-color\", $definitions);\n\t\t\t#{$class} {\n\t\t\t\t&__icon {\n\t\t\t\t\tcolor: get(\"decor-color\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&[type=\"solid\" i] {\n\t\t\t\tbackground-color: get(\"background\", $definitions);\n\t\t\t\tcolor: get(\"color\", $definitions);\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__icon {\n\t\t\t\t\t\tcolor: get(\"color\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t\t&__timer {\n\t\t\t\t\t\tbackground-color: get(\"timer-background\", $definitions);\n\t\t\t\t\t}\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&__content {\n\t\t\tpadding-right: rem-calc(32);\n\t\t}\n\t}\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Prop, Watch, Method } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { ToastClass, ToastTypesType, ToastVariants } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { ToastVariantType } from './constants'\nimport { createID } from '../../utils/string.utils'\n\n@Component({\n\ttag: 'gov-toast',\n\tstyleUrl: 'gov-toast.scss',\n})\nexport class GovToast {\n\tprivate h: GovHost\n\tprivate timeout\n\tprivate readonly toastId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.toastId = createID('GovToast')\n\t}\n\n\t@Element() host: HTMLGovToastElement\n\t/**\n\t * Style variation of the toast message.\n\t */\n\t@Prop() readonly variant?: ToastVariantType = 'primary'\n\n\t/**\n\t * Toast’s gravity\n\t */\n\t@Prop() readonly gravity: 'top' | 'bottom' = 'top'\n\t/**\n\t * Toast’s position\n\t */\n\t@Prop() readonly position: 'left' | 'center' | 'right' = 'right'\n\t/**\n\t * Toast type\n\t */\n\t@Prop() readonly type?: ToastTypesType = 'classic'\n\t/**\n\t * Number of milliseconds to wait before Toast disappear\n\t */\n\t@Prop() readonly time: number = 0\n\t/**\n\t * Closing button texting instead of icons\n\t */\n\t@Prop({ attribute: 'close-label' }) readonly closeLabel: string\n\t/**\n\t * Aria label for the closing button. It is mandatory if the alert is closable\n\t */\n\t@Prop({ attribute: 'wcag-close-label' }) readonly wcagCloseLabel: string\n\t/**\n\t * Called when the close button is clicked\n\t */\n\t@Event({ eventName: 'gov-close' }) govClose: EventEmitter<string>\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(ToastVariants, newValue, ToastClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.runTimer()\n\t}\n\n\tcomponentDidLoad() {\n\t\tconst existedToasts = document.querySelectorAll(`gov-toast[gravity=\"${this.gravity}\"][position=\"${this.position}\"]:not([data-toast-id=\"${this.toastId}\"])`)\n\t\tif (existedToasts.length > 0) {\n\t\t\tArray.from(existedToasts).map((toast: HTMLGovToastElement) => toast.destroy().then())\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\tclearTimeout(this.timeout)\n\t}\n\n\tprivate runTimer() {\n\t\tif (this.isSolid) {\n\t\t\tthis.host.classList.add('is-initialized')\n\t\t}\n\t\tif (this.isTimer) {\n\t\t\tthis.timeout = setTimeout(() => {\n\t\t\t\tthis.host.classList.add(ToastClass.hidden)\n\t\t\t\tsetTimeout(this.destroy.bind(this), 600)\n\t\t\t}, this.time)\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={this.h.classes([ToastClass.root, 'gov-box-shadow--m'])}\n\t\t\t\tdata-toast-id={this.toastId}\n\t\t\t\tgravity={this.gravity}\n\t\t\t\tposition={this.position}\n\t\t\t\tvariant={this.variant}\n\t\t\t\ttype={this.type}\n\t\t\t\tstyle={{ '--toast-duration': this.time + 'ms' }}\n\t\t\t>\n\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t<span class={ToastClass.icon}>\n\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\n\t\t\t\t<div class={ToastClass.content} aria-live=\"polite\" role=\"status\">\n\t\t\t\t\t<slot />\n\t\t\t\t</div>\n\n\t\t\t\t<div class={ToastClass.close}>\n\t\t\t\t\t<gov-button\n\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\twcag-label={this.wcagCloseLabel}\n\t\t\t\t\t\tvariant={this.isSolid ? this.variant : 'secondary'}\n\t\t\t\t\t\tinverse={this.isSolid}\n\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.closeLabel ? this.closeLabel : <gov-icon name=\"x-lg\"></gov-icon>}\n\t\t\t\t\t</gov-button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class={ToastClass.timer}></div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onCloseHandler(): void {\n\t\tthis.destroy()\n\t\t\t.then(() => this.govClose.emit(this.toastId))\n\t\t\t.catch()\n\t}\n\n\tget isSolid(): boolean {\n\t\treturn this.type === 'solid'\n\t}\n\n\tget isTimer(): boolean {\n\t\treturn Number.isInteger(this.time) && this.time > 0\n\t}\n\n\t/**\n\t * Remove toast from dom\n\t */\n\t@Method()\n\tasync destroy(): Promise<void> {\n\t\tclearTimeout(this.timeout)\n\t\tconst toast = document.querySelector(`[data-toast-id=\"${this.toastId}\"]`)\n\t\tif (toast) {\n\t\t\ttoast.classList.add(ToastClass.hidden)\n\t\t\tif (typeof toast.remove === 'function') {\n\t\t\t\ttoast.remove()\n\t\t\t}\n\t\t}\n\t}\n}\n"],"version":3}
|
|
1
|
+
{"file":"gov-toast.js","mappings":";;;;;;;;;AAIO,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC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rB,IAAI,EAAC,MAAM,kBACG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAE3C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,gBAAU,IAAI,EAAC,MAAM,GAAY,CAC1D,CACR,EAEN,WAAK,KAAK,EAAE,UAAU,CAAC,KAAK,GAAQ,CAC9B,EACP;GACD;EAEO,cAAc;IACrB,IAAI,CAAC,OAAO,EAAE;OACZ,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;OAC5C,KAAK,EAAE,CAAA;GACT;EAED,IAAI,OAAO;IACV,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,CAAA;GAC5B;EAED,IAAI,OAAO;IACV,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAA;GACnD;;;;EAMD,MAAM,OAAO;IACZ,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC1B,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,mBAAmB,IAAI,CAAC,OAAO,IAAI,CAAC,CAAA;IACzE,IAAI,KAAK,EAAE;MACV,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;MACtC,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU,EAAE;QACvC,KAAK,CAAC,MAAM,EAAE,CAAA;OACd;KACD;GACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovToast"],"sources":["../../../packages/core/src/components/gov-toast/constants.ts","../../../packages/core/src/components/gov-toast/gov-toast.scss?tag=gov-toast","../../../packages/core/src/components/gov-toast/gov-toast.tsx"],"sourcesContent":["import { Variants, Types } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const ToastVariants = pick(Variants, ['SUCCESS', 'WARNING', 'ERROR', 'SECONDARY', 'PRIMARY'])\nexport type ToastVariantType = `${ValueOf<typeof ToastVariants>}`\n\nexport const ToastTypes = pick(Types, ['CLASSIC', 'SOLID'])\nexport type ToastTypesType = `${ValueOf<typeof ToastTypes>}`\n\nexport const ToastClass = {\n\troot: 'gov-toast',\n\thidden: 'gov-toast--hidden',\n\ticon: 'gov-toast__icon',\n\tcontent: 'gov-toast__content',\n\tclose: 'gov-toast__close',\n\ttimer: 'gov-toast__timer',\n}\n","/*\n * Alert\n */\n\n@import \"./gov-toast-message-core.scss\";\n$class: \".gov-toast\";\n\n#{$class} {\n\t@include toast-message-core;\n\t@include z-index(\"toast\", 1);\n\tposition: relative;\n\tposition: fixed;\n\tmax-width: rem-calc(375);\n\tpadding-right: rem-calc(50);\n\topacity: 1;\n\ttransition: opacity 300ms ease-in-out;\n\t&__content {\n\t\tpadding-right: 0;\n\t}\n\t&__close {\n\t\tposition: absolute;\n\t\ttop: rem-calc(8);\n\t\tright: rem-calc(12);\n\t}\n\t&__timer {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\tz-index: -1;\n\t}\n\n\t// VARIANTS\n\t&--hidden {\n\t\topacity: 0;\n\t}\n\t&[gravity=\"top\" i] {\n\t\ttop: rem-calc(16);\n\t}\n\t&[gravity=\"bottom\" i] {\n\t\tbottom: rem-calc(16);\n\t}\n\t&[position=\"left\" i] {\n\t\tleft: rem-calc(16);\n\t}\n\t&[position=\"center\" i] {\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t}\n\t&[position=\"right\" i] {\n\t\tright: rem-calc(16);\n\t}\n\t&[type=\"solid\" i] {\n\t\tborder: none;\n\t\tborder-radius: rem-calc(4);\n\t\toverflow: hidden;\n\t\tbox-shadow: none;\n\t\t&.is-initialized #{$class}__timer {\n\t\t\ttransform-origin: left;\n\t\t\tanimation: countdown linear forwards var(--toast-duration, 0);\n\t\t}\n\t}\n\n\t@each $variant, $definitions in $toast-message-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\tborder-left-color: get(\"decor-color\", $definitions);\n\t\t\t#{$class} {\n\t\t\t\t&__icon {\n\t\t\t\t\tcolor: get(\"decor-color\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&[type=\"solid\" i] {\n\t\t\t\tbackground-color: get(\"background\", $definitions);\n\t\t\t\tcolor: get(\"color\", $definitions);\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__icon {\n\t\t\t\t\t\tcolor: get(\"color\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t\t&__timer {\n\t\t\t\t\t\tbackground-color: get(\"timer-background\", $definitions);\n\t\t\t\t\t}\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&__content {\n\t\t\tpadding-right: rem-calc(32);\n\t\t}\n\t}\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Prop, Watch, Method } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { ToastClass, ToastTypesType, ToastVariants } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { ToastVariantType } from './constants'\nimport { createID } from '../../utils/string.utils'\n\n@Component({\n\ttag: 'gov-toast',\n\tstyleUrl: 'gov-toast.scss',\n})\nexport class GovToast {\n\tprivate h: GovHost\n\tprivate timeout\n\tprivate readonly toastId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.toastId = createID('GovToast')\n\t}\n\n\t@Element() host: HTMLGovToastElement\n\t/**\n\t * Style variation of the toast message.\n\t */\n\t@Prop() readonly variant?: ToastVariantType = 'primary'\n\n\t/**\n\t * Toast’s gravity\n\t */\n\t@Prop() readonly gravity: 'top' | 'bottom' = 'top'\n\t/**\n\t * Toast’s position\n\t */\n\t@Prop() readonly position: 'left' | 'center' | 'right' = 'right'\n\t/**\n\t * Toast type\n\t */\n\t@Prop() readonly type?: ToastTypesType = 'classic'\n\t/**\n\t * Number of milliseconds to wait before Toast disappear\n\t */\n\t@Prop() readonly time: number = 0\n\t/**\n\t * Closing button texting instead of icons\n\t */\n\t@Prop({ attribute: 'close-label' }) readonly closeLabel: string\n\t/**\n\t * Aria label for the closing button. It is mandatory if the alert is closable\n\t */\n\t@Prop({ attribute: 'wcag-close-label' }) readonly wcagCloseLabel: string\n\t/**\n\t * Called when the close button is clicked\n\t */\n\t@Event({ eventName: 'gov-close' }) govClose: EventEmitter<string>\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(ToastVariants, newValue, ToastClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.runTimer()\n\t}\n\n\tcomponentDidLoad() {\n\t\tconst existedToasts = document.querySelectorAll(`gov-toast[gravity=\"${this.gravity}\"][position=\"${this.position}\"]:not([data-toast-id=\"${this.toastId}\"])`)\n\t\tif (existedToasts.length > 0) {\n\t\t\tArray.from(existedToasts).map((toast: HTMLGovToastElement) => toast.destroy().then())\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\tclearTimeout(this.timeout)\n\t}\n\n\tprivate runTimer() {\n\t\tif (this.isSolid) {\n\t\t\tthis.host.classList.add('is-initialized')\n\t\t}\n\t\tif (this.isTimer) {\n\t\t\tthis.timeout = setTimeout(() => {\n\t\t\t\tthis.host.classList.add(ToastClass.hidden)\n\t\t\t\tsetTimeout(this.destroy.bind(this), 600)\n\t\t\t}, this.time)\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={this.h.classes([ToastClass.root, 'gov-box-shadow--m'])}\n\t\t\t\tdata-toast-id={this.toastId}\n\t\t\t\tgravity={this.gravity}\n\t\t\t\tposition={this.position}\n\t\t\t\tvariant={this.variant}\n\t\t\t\ttype={this.type}\n\t\t\t\tstyle={{ '--toast-duration': this.time + 'ms' }}\n\t\t\t>\n\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t<span class={ToastClass.icon}>\n\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\n\t\t\t\t<div class={ToastClass.content} aria-live=\"polite\" role=\"status\">\n\t\t\t\t\t<slot />\n\t\t\t\t</div>\n\n\t\t\t\t<div class={ToastClass.close}>\n\t\t\t\t\t<gov-button\n\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\twcag-label={this.wcagCloseLabel}\n\t\t\t\t\t\tvariant={this.isSolid ? this.variant : 'secondary'}\n\t\t\t\t\t\tinverse={this.isSolid}\n\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.closeLabel ? this.closeLabel : <gov-icon name=\"x-lg\"></gov-icon>}\n\t\t\t\t\t</gov-button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class={ToastClass.timer}></div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onCloseHandler(): void {\n\t\tthis.destroy()\n\t\t\t.then(() => this.govClose.emit(this.toastId))\n\t\t\t.catch()\n\t}\n\n\tget isSolid(): boolean {\n\t\treturn this.type === 'solid'\n\t}\n\n\tget isTimer(): boolean {\n\t\treturn Number.isInteger(this.time) && this.time > 0\n\t}\n\n\t/**\n\t * Remove toast from dom\n\t */\n\t@Method()\n\tasync destroy(): Promise<void> {\n\t\tclearTimeout(this.timeout)\n\t\tconst toast = document.querySelector(`[data-toast-id=\"${this.toastId}\"]`)\n\t\tif (toast) {\n\t\t\ttoast.classList.add(ToastClass.hidden)\n\t\t\tif (typeof toast.remove === 'function') {\n\t\t\t\ttoast.remove()\n\t\t\t}\n\t\t}\n\t}\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-tooltip-content.js","mappings":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,IAAI,CAAC,SAAS,iBAAe,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAc,IAAI,CAAC,SAAS,IACpJ,eAAa,CACP,EACP;GACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovTooltipContent"],"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip-content.scss?tag=gov-tooltip-content","../../../packages/core/src/components/gov-tooltip/gov-tooltip-content.tsx"],"sourcesContent":["/*\n * Tooltip - Content\n */\n\n$class: \".gov-tooltip-content\";\n\n#{$class} {\n\t@include z-index(\"bar\", 1);\n\t@include typography($font-size-m);\n\tposition: absolute;\n\tdisplay: block;\n\twidth: max-content;\n\tmax-width: $tooltip-content-max-width;\n\tpadding: rem-calc(16);\n\tborder-radius: rem-calc(3);\n\tbackground-color: $tooltip-content-bg-color;\n\tcolor: $tooltip-content-text-color;\n\tletter-spacing: rem-calc(0.2);\n\tvisibility: hidden;\n\topacity: 0;\n\ttransition: opacity 0.2s ease-in;\n\t&::before {\n\t\t@include pseudo();\n\t\twidth: 0;\n\t\theight: 0;\n\t\tborder: rem-calc(10) solid transparent;\n\t}\n\n\t// STATES\n\t@include parameter(\"is-visible\") {\n\t\topacity: 1;\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $tooltip-content-sizes {\n\t\t.gov-tooltip[size=\"#{$size}\"] & {\n\t\t\t--#{$prefix}tooltip-content-padding: #{get(\"padding\", $definitions)};\n\t\t\t--#{$prefix}tooltip-content-arrow-size: #{get(\"arrow-size\", $definitions)};\n\t\t\t--#{$prefix}tooltip-content-letter-spacing: #{get(\"letter-spacing\", $definitions)};\n\t\t\t@include typography(get(\"typography\", $definitions));\n\t\t}\n\t}\n\t@each $position, $definitions in $tooltip-content-positions {\n\t\t$oppositeProperty: get(\"oppositeProperty\", $definitions);\n\n\t\t.gov-tooltip[position=\"#{$position}\"] & {\n\t\t\t#{$oppositeProperty}: 100%;\n\t\t\tmargin-#{$oppositeProperty}: rem-calc(10);\n\t\t\t&,\n\t\t\t&::before {\n\t\t\t\t#{get(\"directionProperty\", $definitions)}: 50%;\n\t\t\t\ttransform: #{get(\"transformFn\", $definitions) }(-50%);\n\t\t\t}\n\t\t\t&::before {\n\t\t\t\t#{$position}: 100%;\n\t\t\t\tborder-#{$oppositeProperty}-width: 0;\n\t\t\t\tborder-#{$position}-color: $tooltip-content-bg-color;\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core'\nimport { TooltipContentClass } from './constants'\nimport { toBoolAttr } from '../../helpers/Dom/template'\n\n@Component({\n\ttag: 'gov-tooltip-content',\n\tstyleUrl: 'gov-tooltip-content.scss',\n})\nexport class GovTooltipContent {\n\tprivate timeout\n\n\t@Element() host: HTMLGovTooltipContentElement\n\t/**\n\t * Indicates display of tooltip content\n\t */\n\t@Prop({ attribute: 'is-visible' }) readonly isVisible: boolean = false\n\n\t@Watch('isVisible')\n\tvisibleContent(newValue: boolean): void {\n\t\tclearTimeout(this.timeout)\n\t\tif (newValue === false) {\n\t\t\tthis.timeout = setTimeout(() => {\n\t\t\t\tthis.host.style.visibility = 'hidden'\n\t\t\t}, 250)\n\t\t} else {\n\t\t\tthis.host.style.visibility = 'visible'\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={TooltipContentClass.root} role={'tooltip'} hidden={!this.isVisible} aria-hidden={!toBoolAttr(this.isVisible)} is-visible={this.isVisible}>\n\t\t\t\t<slot></slot>\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-tooltip.js","mappings":";;;;;;AAAA,MAAM,aAAa,GAAG,wnDAAwnD;;MCoBjoDA,YAAU;EAKtB;;;mBASgD,SAAS;gBAIf,GAAG;oBAIL,OAAO;mBAIZ,SAAS;;gBAQU,SAAS;IA5B9D,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CA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ov-tooltip","../../../packages/core/src/components/gov-tooltip/gov-tooltip.tsx"],"sourcesContent":["/*\n * Tooltip\n */\n\n$class: \".gov-tooltip\";\n\n#{$class} {\n\tposition: relative;\n\tdisplay: inline;\n\tborder-bottom: 1px dashed currentcolor;\n\tcolor: color(\"primary\");\n\tcursor: help;\n\n\t// VARIANTS\n\t@include parameter(\"icon\") {\n\t\tdisplay: inline-flex;\n\t\tborder-bottom: 0;\n\t}\n\t@each $variant, $definitions in $tooltip-content-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\t--#{$prefix}tooltip-content-bg-color: #{get(\"bg-color\", $definitions)};\n\t\t\t--#{$prefix}tooltip-content-text-color: #{get(\"text-color\", $definitions)};\n\n\t\t\t// STATES\n\t\t\t@include parameter(\"inverse\") {\n\t\t\t\t--#{$prefix}tooltip-content-bg-color: #{color(\"neutral.white\")};\n\t\t\t\t--#{$prefix}tooltip-content-text-color: #{get(\"text-color-inverse\", $definitions)};\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Method, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport {\n\tTooltipPosition,\n\tTooltipPositionType,\n\tTooltipSize,\n\tTooltipSizeType,\n\tTooltipClass,\n\tTooltipContentClass,\n\tTooltipVariant,\n\tTooltipVariantType,\n} from './constants'\nimport { createID } from '../../utils/string.utils'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tooltip',\n\tstyleUrl: 'gov-tooltip.scss',\n})\nexport class GovTooltip {\n\tprivate h: GovHost\n\tprivate content: HTMLGovTooltipContentElement\n\tprivate readonly tooltipId\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.tooltipId = createID('GovTooltip')\n\t}\n\n\t@Element() host: HTMLGovTooltipElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly variant?: TooltipVariantType = 'primary'\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = 'm'\n\t/**\n\t * Tooltip display position\n\t */\n\t@Prop() position: TooltipPositionType = 'right'\n\t/**\n\t * Information contained in the tolltip\n\t */\n\t@Prop() readonly message: string = undefined\n\t/**\n\t * Custom tooltip identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Trigger is just an icon\n\t */\n\t@Prop({ attribute: 'icon' }) readonly icon: boolean = undefined\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(TooltipVariant, newValue, TooltipClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TooltipSize, newValue, TooltipClass.root)\n\t}\n\n\t@Watch('position')\n\tvalidatePosition(newValue: string): void {\n\t\tvalidateProp(TooltipPosition, newValue, TooltipClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t\tthis.validatePosition(this.position)\n\n\t\tthis.createContentWrapper()\n\t\tthis.registerListeners()\n\t}\n\n\tprivate createContentWrapper() {\n\t\tconst hasContentInside = this.host.querySelector(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\tif (hasContentInside) {\n\t\t\tthis.content = hasContentInside\n\t\t} else {\n\t\t\tthis.content = document.createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\t\tthis.content.innerHTML = this.message\n\t\t\tthis.host.appendChild(this.content)\n\t\t}\n\n\t\tthis.content.setAttribute('id', this.identifier ?? this.tooltipId)\n\t}\n\n\tprivate registerListeners() {\n\t\tthis.host.addEventListener('focus', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener('blur', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.hideTooltip()\n\t\t})\n\t\tthis.host.addEventListener('mouseenter', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener('mouseleave', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.hideTooltip()\n\t\t})\n\t}\n\n\tprivate verifyPositionSpace() {\n\t\t// @TODO Improve positioning of broken lines\n\t\tconst offset = 12\n\t\tconst windowWidth = window.innerWidth\n\t\tconst trigger = this.host.getBoundingClientRect()\n\t\tconst trgWidth = this.host.offsetWidth\n\t\tconst triggerPos = {\n\t\t\tleft: trigger.left + document.documentElement.scrollLeft,\n\t\t\ttop: trigger.top + document.documentElement.scrollTop,\n\t\t}\n\t\tconst tltWidth = this.content.offsetWidth\n\t\tif (this.position === TooltipPosition.LEFT) {\n\t\t\tif (offset + triggerPos.left < tltWidth) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.content.style.left = '0px'\n\t\t\t\tthis.content.style.width = window.innerWidth - triggerPos.left - offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t} else if (this.position === TooltipPosition.RIGHT) {\n\t\t\tif (windowWidth - (triggerPos.left + trgWidth) < tltWidth) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.content.style.right = '0px'\n\t\t\t\tthis.content.style.left = 'auto'\n\t\t\t\tthis.content.style.width = trgWidth + triggerPos.left + offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t} else {\n\t\t\t// doesn't fit from the left\n\t\t\tif (tltWidth / 2 > triggerPos.left) {\n\t\t\t\tthis.content.style.left = '0px'\n\t\t\t\tthis.content.style.width = window.innerWidth - triggerPos.left - offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t\t// doesn't fit from the right\n\t\t\telse if (tltWidth / 2 > windowWidth - (triggerPos.left + tltWidth)) {\n\t\t\t\tthis.content.style.right = '0px'\n\t\t\t\tthis.content.style.left = 'auto'\n\t\t\t\tthis.content.style.width = trgWidth + triggerPos.left + offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate showTooltip() {\n\t\tif (this.content) {\n\t\t\tthis.verifyPositionSpace()\n\t\t\tthis.content.setAttribute('is-visible', 'true')\n\t\t}\n\t}\n\n\tprivate hideTooltip() {\n\t\tif (this.content) {\n\t\t\tthis.content.setAttribute('is-visible', 'false')\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={this.h.classes(TooltipClass.root)}\n\t\t\t\tposition={this.position}\n\t\t\t\tsize={this.size}\n\t\t\t\ttabindex={0}\n\t\t\t\taria-describedby={this.identifier ?? this.tooltipId}\n\t\t\t\tvariant={this.variant}\n\t\t\t>\n\t\t\t\t<slot />\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showTooltip()\n\t}\n\n\t/**\n\t * Hidding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.hideTooltip()\n\t}\n}\n"],"version":3}
|
|
1
|
+
{"file":"gov-tooltip.js","mappings":";;;;;;AAAA,MAAM,aAAa,GAAG,wnDAAwnD;;MCoBjoDA,YAAU;EAKtB;;;mBASgD,SAAS;gBAIf,GAAG;oBAIL,OAAO;mBAIZ,SAAS;;gBAQU,SAAS;IA5B9D,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;GACvC;EA6BD,eAAe,CAAC,QAAgB;IAC/B,YAAY,CAAC,cAAc,EAAE,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;GACzD;EAGD,YAAY,CAAC,QAAgB;IAC5B,YAAY,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;GACtD;EAGD,gBAAgB,CAAC,QAAgB;IAChC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AAK,CAAC,SAAS,GAAG,MAAM,CAAA;OACrC;KACD;GACD;EAEO,WAAW;IAClB,IAAI,IAAI,CAAC,OAAO,EAAE;MACjB,IAAI,CAAC,mBAAmB,EAAE,CAAA;MAC1B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;KAC/C;GACD;EAEO,WAAW;IAClB,IAAI,IAAI,CAAC,OAAO,EAAE;MACjB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;KAChD;GACD;EAED,MAAM;;IACL,QACC,EAAC,IAAI,IACJ,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,CAAC,sBACO,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI,CAAC,SAAS,EACnD,OAAO,EAAE,IAAI,CAAC,OAAO,IAErB,eAAQ,CACF,EACP;GACD;;;;EAMD,MAAM,IAAI;IACT,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;EAMD,MAAM,IAAI;IACT,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovTooltip"],"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip.scss?tag=gov-tooltip","../../../packages/core/src/components/gov-tooltip/gov-tooltip.tsx"],"sourcesContent":["/*\n * Tooltip\n */\n\n$class: \".gov-tooltip\";\n\n#{$class} {\n\tposition: relative;\n\tdisplay: inline;\n\tborder-bottom: 1px dashed currentcolor;\n\tcolor: color(\"primary\");\n\tcursor: help;\n\n\t// VARIANTS\n\t@include parameter(\"icon\") {\n\t\tdisplay: inline-flex;\n\t\tborder-bottom: 0;\n\t}\n\t@each $variant, $definitions in $tooltip-content-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\t--#{$prefix}tooltip-content-bg-color: #{get(\"bg-color\", $definitions)};\n\t\t\t--#{$prefix}tooltip-content-text-color: #{get(\"text-color\", $definitions)};\n\n\t\t\t// STATES\n\t\t\t@include parameter(\"inverse\") {\n\t\t\t\t--#{$prefix}tooltip-content-bg-color: #{color(\"neutral.white\")};\n\t\t\t\t--#{$prefix}tooltip-content-text-color: #{get(\"text-color-inverse\", $definitions)};\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Method, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport {\n\tTooltipPosition,\n\tTooltipPositionType,\n\tTooltipSize,\n\tTooltipSizeType,\n\tTooltipClass,\n\tTooltipContentClass,\n\tTooltipVariant,\n\tTooltipVariantType,\n} from './constants'\nimport { createID } from '../../utils/string.utils'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tooltip',\n\tstyleUrl: 'gov-tooltip.scss',\n})\nexport class GovTooltip {\n\tprivate h: GovHost\n\tprivate content: HTMLGovTooltipContentElement\n\tprivate readonly tooltipId\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.tooltipId = createID('GovTooltip')\n\t}\n\n\t@Element() host: HTMLGovTooltipElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly variant?: TooltipVariantType = 'primary'\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = 'm'\n\t/**\n\t * Tooltip display position\n\t */\n\t@Prop() position: TooltipPositionType = 'right'\n\t/**\n\t * Information contained in the tolltip\n\t */\n\t@Prop() readonly message: string = undefined\n\t/**\n\t * Custom tooltip identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Trigger is just an icon\n\t */\n\t@Prop({ attribute: 'icon' }) readonly icon: boolean = undefined\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(TooltipVariant, newValue, TooltipClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TooltipSize, newValue, TooltipClass.root)\n\t}\n\n\t@Watch('position')\n\tvalidatePosition(newValue: string): void {\n\t\tvalidateProp(TooltipPosition, newValue, TooltipClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t\tthis.validatePosition(this.position)\n\n\t\tthis.createContentWrapper()\n\t\tthis.registerListeners()\n\t}\n\n\tprivate createContentWrapper() {\n\t\tconst hasContentInside = this.host.querySelector(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\tif (hasContentInside) {\n\t\t\tthis.content = hasContentInside\n\t\t} else {\n\t\t\tthis.content = document.createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\t\tthis.content.innerHTML = this.message\n\t\t\tthis.host.appendChild(this.content)\n\t\t}\n\n\t\tthis.content.setAttribute('id', this.identifier ?? this.tooltipId)\n\t}\n\n\tprivate registerListeners() {\n\t\tthis.host.addEventListener('focus', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener('blur', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.hideTooltip()\n\t\t})\n\t\tthis.host.addEventListener('mouseenter', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener('mouseleave', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.hideTooltip()\n\t\t})\n\t}\n\n\tprivate verifyPositionSpace() {\n\t\t// @TODO Improve positioning of broken lines\n\t\tconst offset = 12\n\t\tconst windowWidth = window.innerWidth\n\t\tconst trigger = this.host.getBoundingClientRect()\n\t\tconst trgWidth = this.host.offsetWidth\n\t\tconst triggerPos = {\n\t\t\tleft: trigger.left + document.documentElement.scrollLeft,\n\t\t\ttop: trigger.top + document.documentElement.scrollTop,\n\t\t}\n\t\tconst tltWidth = this.content.offsetWidth\n\t\tif (this.position === TooltipPosition.LEFT) {\n\t\t\tif (offset + triggerPos.left < tltWidth) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.content.style.left = '0px'\n\t\t\t\tthis.content.style.width = window.innerWidth - triggerPos.left - offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t} else if (this.position === TooltipPosition.RIGHT) {\n\t\t\tif (windowWidth - (triggerPos.left + trgWidth) < tltWidth) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.content.style.right = '0px'\n\t\t\t\tthis.content.style.left = 'auto'\n\t\t\t\tthis.content.style.width = trgWidth + triggerPos.left + offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t} else {\n\t\t\t// doesn't fit from the left\n\t\t\tif (tltWidth / 2 > triggerPos.left) {\n\t\t\t\tthis.content.style.left = '0px'\n\t\t\t\tthis.content.style.width = window.innerWidth - triggerPos.left - offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t\t// doesn't fit from the right\n\t\t\telse if (tltWidth / 2 > windowWidth - (triggerPos.left + tltWidth)) {\n\t\t\t\tthis.content.style.right = '0px'\n\t\t\t\tthis.content.style.left = 'auto'\n\t\t\t\tthis.content.style.width = trgWidth + triggerPos.left + offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate showTooltip() {\n\t\tif (this.content) {\n\t\t\tthis.verifyPositionSpace()\n\t\t\tthis.content.setAttribute('is-visible', 'true')\n\t\t}\n\t}\n\n\tprivate hideTooltip() {\n\t\tif (this.content) {\n\t\t\tthis.content.setAttribute('is-visible', 'false')\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={this.h.classes(TooltipClass.root)}\n\t\t\t\tposition={this.position}\n\t\t\t\tsize={this.size}\n\t\t\t\ttabindex={0}\n\t\t\t\taria-describedby={this.identifier ?? this.tooltipId}\n\t\t\t\tvariant={this.variant}\n\t\t\t>\n\t\t\t\t<slot />\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showTooltip()\n\t}\n\n\t/**\n\t * Hidding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.hideTooltip()\n\t}\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-wizzard-item.js","mappings":";;;;;;;;AAAA,MAAM,iBAAiB,GAAG,w2QAAw2Q;;ACSl4Q,IAAK,IAGJ;AAHD,WAAK,IAAI;EACR,mBAAW,CAAA;EACX,yBAAiB,CAAA;AAClB,CAAC,EAHI,IAAI,KAAJ,IAAI,QAGR;MAMYA,gBAAc;EAK1B;;;;mBAUgD,SAAS;gBAIf,GAAG;;uBAQL,KAAK;;;oBAYR,KAAK;sBAIyB,KAAK;oBAIV,IAAI;;IAzCjE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAA;IAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAA;GAC9C;EA+CO,aAAa,CAAC,QAAgB;IACrC,IAAI,CAAC,QAAQ,EAAE;MACd,WAAW,CAAC,IAAI,gBAAgB,CAAC,IAAI,iCAAiC,CAAC,CAAA;KACvE;GACD;EAGO,kBAAkB,CAAC,QAAgB;IAC1C,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IAC9D,IAAI,QAAQ,EAAE;MACb,IAAI,CAAC,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AE,CAAC,IAAI,CAAC,eAAe,IACrH,eAAQ,CACH,CACN,CACK,EACP;GACD;;;;EAMD,MAAM,IAAI;IACT,IAAI,CAAC,eAAe,GAAG,IAAI,CAAA;IAC3B,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;EAMM,MAAM,KAAK;IACjB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAA;IAC5B,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;EAMM,MAAM,MAAM;IAClB,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,eAAe,CAAA;IAC5C,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;EAMM,MAAM,YAAY;IACxB,OAAO,IAAI,CAAC,eAAe,CAAA;GAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovWizzardItem"],"sources":["../../../packages/core/src/components/gov-wizzard/gov-wizzard-item.scss?tag=gov-wizzard-item","../../../packages/core/src/components/gov-wizzard/gov-wizzard-item.tsx"],"sourcesContent":["/*\n * Wizzard - Item\n */\n\n@import \"../gov-wizzard/gov-wizzard-item-core.scss\";\n$class: \".gov-wizzard-item\";\n\n#{$class} {\n\t@include wizzard-item-core;\n\tmargin-bottom: rem-calc(16);\n\tbackground: $wizzard-bg-color;\n\t&__header {\n\t\t@include focus-outline();\n\t\tgap: rem-calc(16);\n\t\tpadding: rem-calc(16);\n\t\tborder-radius: 0;\n\t\ttext-align: left;\n\t\ttransition: $t linear color;\n\t}\n\n\t// STATES\n\t&__header[aria-expanded=\"true\"] {\n\t\t#{$class}__label {\n\t\t\t.gov-icon {\n\t\t\t\ttransform: scale(-1);\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t&[size=\"#{$size-xs}\"],\n\t&[size=\"#{$size-s}\"],\n\t&[size=\"#{$size-m}\"] {\n\t\t#{$class} {\n\t\t\t&__title {\n\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-xs, \"font-size\"));\n\t\t\t}\n\t\t\t&__annot {\n\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-xs, \"font-size-annot\"));\n\t\t\t}\n\t\t\t&__prefix {\n\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-xs, \"font-size-indicator\"));\n\t\t\t\twidth: deep-map-get($wizzard-sizes, $size-xs, \"indicator-size\");\n\t\t\t\theight: deep-map-get($wizzard-sizes, $size-xs, \"indicator-size\");\n\t\t\t}\n\t\t\t&__content {\n\t\t\t\tpadding: $wizzard-content-padding;\n\t\t\t}\n\t\t}\n\t}\n\t@each $variant, $definitions in $wizzard-core-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\t@include parameter(\"collapsible\") {\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__header {\n\t\t\t\t\t\t@include hover() {\n\t\t\t\t\t\t\tcolor: get(\"hover-color\", $definitions);\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// HOVERS\n\t@at-root button#{&}__header {\n\t\t@include button-core();\n\t\tjustify-content: flex-start;\n\t\ttext-align: left;\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t&[size=\"#{$size-s}\"],\n\t\t&[size=\"#{$size-m}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__title {\n\t\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-s, \"font-size\"));\n\t\t\t\t}\n\t\t\t\t&__prefix {\n\t\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-s, \"font-size-indicator\"));\n\t\t\t\t\twidth: deep-map-get($wizzard-sizes, $size-s, \"indicator-size\");\n\t\t\t\t\theight: deep-map-get($wizzard-sizes, $size-s, \"indicator-size\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: md) {\n\t\t&[size=\"#{$size-m}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__title {\n\t\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-m, \"font-size\"));\n\t\t\t\t}\n\t\t\t\t&__prefix {\n\t\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-m, \"font-size-indicator\"));\n\t\t\t\t\twidth: deep-map-get($wizzard-sizes, $size-m, \"indicator-size\");\n\t\t\t\t\theight: deep-map-get($wizzard-sizes, $size-m, \"indicator-size\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t@each $size, $definitions in $wizzard-sizes {\n\t\t\t&[size=\"#{$size}\"] {\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__content {\n\t\t\t\t\t\tpadding: get(\"content-padding\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Prop, State, Watch, Host, Method, Event, EventEmitter } from '@stencil/core'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { WizzardItemClass, WizardVariantsType, WizardSizesType, WizardVariants } from './constants'\nimport { createID } from '../../utils/string.utils'\nimport { booleanString, toBoolAttrIfDefined, govHost } from '../../helpers/Dom/template'\nimport { GovWizzardItemChangeEvent } from './gov-wizzard-item.d'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\nenum Tags {\n\tDIV = 'div',\n\tBUTTON = 'button',\n}\n\n@Component({\n\ttag: 'gov-wizzard-item',\n\tstyleUrl: 'gov-wizzard-item.scss',\n})\nexport class GovWizzardItem {\n\tprivate h: GovHost\n\tprivate readonly triggerId: string\n\tprivate readonly contentId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.triggerId = createID('GovWizzardItem')\n\t\tthis.contentId = createID('GovWizzardContent')\n\t}\n\n\t@Element() readonly host: HTMLGovWizzardItemElement\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly variant?: WizardVariantsType = 'primary'\n\t/**\n\t * Size of wizzard\n\t */\n\t@Prop() readonly size?: WizardSizesType = 'm'\n\t/**\n\t * Custom wizzard item identifier. Otherwise, it will be generated\n\t */\n\t@Prop() readonly identifier: string\n\t/**\n\t * Defines wether the wizzard item can be collapsible\n\t */\n\t@Prop() readonly collapsible: boolean = false\n\t/**\n\t * Item annotation of the wizzard\n\t */\n\t@Prop() readonly annotation: string\n\t/**\n\t * Item label of the wizzard\n\t */\n\t@Prop() readonly label: string\n\t/**\n\t * Makes the wizzard component disabled.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Defines whether the accordion is open or closed by default\n\t */\n\t@Prop({ attribute: 'is-expanded' }) readonly isExpanded: boolean = false\n\t/**\n\t * Used to change the HMTL tag in the accordion trigger for correct semantic structure\n\t */\n\t@Prop({ attribute: 'label-tag' }) readonly labelTag: string = 'h3'\n\t/**\n\t * Called when the accordion state changes\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<GovWizzardItemChangeEvent>\n\n\t@State() isExpandedState: boolean\n\n\t@Watch('label')\n\tprivate validateLabel(newValue: string): void {\n\t\tif (!newValue) {\n\t\t\tgovErrorLog(`[${WizzardItemClass.root}]: Parameter label is required.`)\n\t\t}\n\t}\n\n\t@Watch('labelTag')\n\tprivate validateTriggerTag(newValue: string): void {\n\t\tconst validTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span']\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${WizzardItemClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t@Watch('variant')\n\tprivate validateVariant(newValue: string): void {\n\t\tvalidateProp(WizardVariants, newValue, WizzardItemClass.root)\n\t}\n\n\tprivate emmitChange(): void {\n\t\tthis.govChange.emit({ open: this.isExpandedState, element: this.host })\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.isExpandedState = this.isExpanded\n\t\tthis.validateLabel(this.label)\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateTriggerTag(this.labelTag)\n\t}\n\n\trender() {\n\t\tconst triggerId = this.identifier || this.triggerId\n\t\tconst LabelTag = this.labelTag\n\t\tconst Tag = this.collapsible ? Tags.BUTTON : Tags.DIV\n\n\t\tconst label = (\n\t\t\t<LabelTag class={WizzardItemClass.title}>\n\t\t\t\t{this.h.hasSlot('prefix') && (\n\t\t\t\t\t<span class={WizzardItemClass.prefix}>\n\t\t\t\t\t\t<slot name=\"prefix\" />\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t\t<span class={WizzardItemClass.name}>\n\t\t\t\t\t<span class={WizzardItemClass.label}>\n\t\t\t\t\t\t<span>{this.label}</span>\n\t\t\t\t\t\t{this.collapsible && <gov-icon class={WizzardItemClass.arrow} name=\"chevron-down\"></gov-icon>}\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{this.annotation && <span class={WizzardItemClass.annot}>{this.annotation}</span>}\n\t\t\t\t</span>\n\t\t\t</LabelTag>\n\t\t)\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(WizzardItemClass.root)} variant={this.variant} size={this.size} role=\"listitem\" collapsible={this.collapsible}>\n\t\t\t\t{this.collapsible ? (\n\t\t\t\t\t<Tag\n\t\t\t\t\t\tid={triggerId}\n\t\t\t\t\t\tclass={WizzardItemClass.header}\n\t\t\t\t\t\taria-expanded={booleanString(this.isExpandedState)}\n\t\t\t\t\t\taria-controls={this.contentId}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\tonClick={() => (this.collapsible ? this.toggle() : false)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{label}\n\t\t\t\t\t</Tag>\n\t\t\t\t) : (\n\t\t\t\t\t<div class={WizzardItemClass.header}>{label}</div>\n\t\t\t\t)}\n\t\t\t\t{this.collapsible ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass={WizzardItemClass.content}\n\t\t\t\t\t\tid={this.contentId}\n\t\t\t\t\t\taria-hidden={booleanString(!this.isExpandedState)}\n\t\t\t\t\t\thidden={!this.isExpandedState}\n\t\t\t\t\t\taria-labelledby={triggerId}\n\t\t\t\t\t>\n\t\t\t\t\t\t<slot />\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<div class={WizzardItemClass.content} aria-hidden={booleanString(!this.isExpandedState)} hidden={!this.isExpandedState}>\n\t\t\t\t\t\t<slot />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Opening the Wizzard\n\t */\n\t@Method()\n\tasync open(): Promise<void> {\n\t\tthis.isExpandedState = true\n\t\tthis.emmitChange()\n\t}\n\n\t/**\n\t * Closing the Wizzard\n\t */\n\t@Method()\n\tpublic async close(): Promise<void> {\n\t\tthis.isExpandedState = false\n\t\tthis.emmitChange()\n\t}\n\n\t/**\n\t * Wizzard switch\n\t */\n\t@Method()\n\tpublic async toggle(): Promise<void> {\n\t\tthis.isExpandedState = !this.isExpandedState\n\t\tthis.emmitChange()\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tpublic async currentState(): Promise<boolean> {\n\t\treturn this.isExpandedState\n\t}\n}\n"],"version":3}
|
|
1
|
+
{"file":"gov-wizzard-item.js","mappings":";;;;;;;;AAAA,MAAM,iBAAiB,GAAG,w2QAAw2Q;;ACSl4Q,IAAK,IAGJ;AAHD,WAAK,IAAI;EACR,mBAAW,CAAA;EACX,yBAAiB,CAAA;AAClB,CAAC,EAHI,IAAI,KAAJ,IAAI,QAGR;MAMYA,gBAAc;EAK1B;;;;mBAUgD,SAAS;gBAIf,GAAG;;uBAQL,KAAK;;;oBAYR,KAAK;sBAIyB,KAAK;oBAIV,IAAI;;IAzCjE,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAA;IAC3C,IAAI,CAAC,SAAS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B,CAAC,MAAM,IAAG,KAAK,CAAO,CAClD,EACA,IAAI,CAAC,WAAW,IAChB,WACC,KAAK,EAAE,gBAAgB,CAAC,OAAO,EAC/B,EAAE,EAAE,IAAI,CAAC,SAAS,iBACL,aAAa,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,EACjD,MAAM,EAAE,CAAC,IAAI,CAAC,eAAe,qBACZ,SAAS,IAE1B,eAAQ,CACH,KAEN,WAAK,KAAK,EAAE,gBAAgB,CAAC,OAAO,iBAAe,aAAa,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,eAAe,IACrH,eAAQ,CACH,CACN,CACK,EACP;GACD;;;;EAMD,MAAM,IAAI;IACT,IAAI,CAAC,eAAe,GAAG,IAAI,CAAA;IAC3B,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;EAMM,MAAM,KAAK;IACjB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAA;IAC5B,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;EAMM,MAAM,MAAM;IAClB,IAAI,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,eAAe,CAAA;IAC5C,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;EAMM,MAAM,YAAY;IACxB,OAAO,IAAI,CAAC,eAAe,CAAA;GAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovWizzardItem"],"sources":["../../../packages/core/src/components/gov-wizzard/gov-wizzard-item.scss?tag=gov-wizzard-item","../../../packages/core/src/components/gov-wizzard/gov-wizzard-item.tsx"],"sourcesContent":["/*\n * Wizzard - Item\n */\n\n@import \"../gov-wizzard/gov-wizzard-item-core.scss\";\n$class: \".gov-wizzard-item\";\n\n#{$class} {\n\t@include wizzard-item-core;\n\tmargin-bottom: rem-calc(16);\n\tbackground: $wizzard-bg-color;\n\t&__header {\n\t\t@include focus-outline();\n\t\tgap: rem-calc(16);\n\t\tpadding: rem-calc(16);\n\t\tborder-radius: 0;\n\t\ttext-align: left;\n\t\ttransition: $t linear color;\n\t}\n\n\t// STATES\n\t&__header[aria-expanded=\"true\"] {\n\t\t#{$class}__label {\n\t\t\t.gov-icon {\n\t\t\t\ttransform: scale(-1);\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t&[size=\"#{$size-xs}\"],\n\t&[size=\"#{$size-s}\"],\n\t&[size=\"#{$size-m}\"] {\n\t\t#{$class} {\n\t\t\t&__title {\n\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-xs, \"font-size\"));\n\t\t\t}\n\t\t\t&__annot {\n\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-xs, \"font-size-annot\"));\n\t\t\t}\n\t\t\t&__prefix {\n\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-xs, \"font-size-indicator\"));\n\t\t\t\twidth: deep-map-get($wizzard-sizes, $size-xs, \"indicator-size\");\n\t\t\t\theight: deep-map-get($wizzard-sizes, $size-xs, \"indicator-size\");\n\t\t\t}\n\t\t\t&__content {\n\t\t\t\tpadding: $wizzard-content-padding;\n\t\t\t}\n\t\t}\n\t}\n\t@each $variant, $definitions in $wizzard-core-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\t@include parameter(\"collapsible\") {\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__header {\n\t\t\t\t\t\t@include hover() {\n\t\t\t\t\t\t\tcolor: get(\"hover-color\", $definitions);\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// HOVERS\n\t@at-root button#{&}__header {\n\t\t@include button-core();\n\t\tjustify-content: flex-start;\n\t\ttext-align: left;\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t&[size=\"#{$size-s}\"],\n\t\t&[size=\"#{$size-m}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__title {\n\t\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-s, \"font-size\"));\n\t\t\t\t}\n\t\t\t\t&__prefix {\n\t\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-s, \"font-size-indicator\"));\n\t\t\t\t\twidth: deep-map-get($wizzard-sizes, $size-s, \"indicator-size\");\n\t\t\t\t\theight: deep-map-get($wizzard-sizes, $size-s, \"indicator-size\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: md) {\n\t\t&[size=\"#{$size-m}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__title {\n\t\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-m, \"font-size\"));\n\t\t\t\t}\n\t\t\t\t&__prefix {\n\t\t\t\t\t@include typography(deep-map-get($wizzard-sizes, $size-m, \"font-size-indicator\"));\n\t\t\t\t\twidth: deep-map-get($wizzard-sizes, $size-m, \"indicator-size\");\n\t\t\t\t\theight: deep-map-get($wizzard-sizes, $size-m, \"indicator-size\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t@each $size, $definitions in $wizzard-sizes {\n\t\t\t&[size=\"#{$size}\"] {\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__content {\n\t\t\t\t\t\tpadding: get(\"content-padding\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Prop, State, Watch, Host, Method, Event, EventEmitter } from '@stencil/core'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { WizzardItemClass, WizardVariantsType, WizardSizesType, WizardVariants } from './constants'\nimport { createID } from '../../utils/string.utils'\nimport { booleanString, toBoolAttrIfDefined, govHost } from '../../helpers/Dom/template'\nimport { GovWizzardItemChangeEvent } from './gov-wizzard-item.d'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\nenum Tags {\n\tDIV = 'div',\n\tBUTTON = 'button',\n}\n\n@Component({\n\ttag: 'gov-wizzard-item',\n\tstyleUrl: 'gov-wizzard-item.scss',\n})\nexport class GovWizzardItem {\n\tprivate h: GovHost\n\tprivate readonly triggerId: string\n\tprivate readonly contentId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.triggerId = createID('GovWizzardItem')\n\t\tthis.contentId = createID('GovWizzardContent')\n\t}\n\n\t@Element() readonly host: HTMLGovWizzardItemElement\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly variant?: WizardVariantsType = 'primary'\n\t/**\n\t * Size of wizzard\n\t */\n\t@Prop() readonly size?: WizardSizesType = 'm'\n\t/**\n\t * Custom wizzard item identifier. Otherwise, it will be generated\n\t */\n\t@Prop() readonly identifier: string\n\t/**\n\t * Defines wether the wizzard item can be collapsible\n\t */\n\t@Prop() readonly collapsible: boolean = false\n\t/**\n\t * Item annotation of the wizzard\n\t */\n\t@Prop() readonly annotation: string\n\t/**\n\t * Item label of the wizzard\n\t */\n\t@Prop() readonly label: string\n\t/**\n\t * Makes the wizzard component disabled.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Defines whether the accordion is open or closed by default\n\t */\n\t@Prop({ attribute: 'is-expanded' }) readonly isExpanded: boolean = false\n\t/**\n\t * Used to change the HMTL tag in the accordion trigger for correct semantic structure\n\t */\n\t@Prop({ attribute: 'label-tag' }) readonly labelTag: string = 'h3'\n\t/**\n\t * Called when the accordion state changes\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<GovWizzardItemChangeEvent>\n\n\t@State() isExpandedState: boolean\n\n\t@Watch('label')\n\tprivate validateLabel(newValue: string): void {\n\t\tif (!newValue) {\n\t\t\tgovErrorLog(`[${WizzardItemClass.root}]: Parameter label is required.`)\n\t\t}\n\t}\n\n\t@Watch('labelTag')\n\tprivate validateTriggerTag(newValue: string): void {\n\t\tconst validTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'span']\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${WizzardItemClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t@Watch('variant')\n\tprivate validateVariant(newValue: string): void {\n\t\tvalidateProp(WizardVariants, newValue, WizzardItemClass.root)\n\t}\n\n\tprivate emmitChange(): void {\n\t\tthis.govChange.emit({ open: this.isExpandedState, element: this.host })\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.isExpandedState = this.isExpanded\n\t\tthis.validateLabel(this.label)\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateTriggerTag(this.labelTag)\n\t}\n\n\trender() {\n\t\tconst triggerId = this.identifier || this.triggerId\n\t\tconst LabelTag = this.labelTag\n\t\tconst Tag = this.collapsible ? Tags.BUTTON : Tags.DIV\n\n\t\tconst label = (\n\t\t\t<LabelTag class={WizzardItemClass.title}>\n\t\t\t\t{this.h.hasSlot('prefix') && (\n\t\t\t\t\t<span class={WizzardItemClass.prefix}>\n\t\t\t\t\t\t<slot name=\"prefix\" />\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t\t<span class={WizzardItemClass.name}>\n\t\t\t\t\t<span class={WizzardItemClass.label}>\n\t\t\t\t\t\t<span>{this.label}</span>\n\t\t\t\t\t\t{this.collapsible && <gov-icon class={WizzardItemClass.arrow} name=\"chevron-down\"></gov-icon>}\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{this.annotation && <span class={WizzardItemClass.annot}>{this.annotation}</span>}\n\t\t\t\t</span>\n\t\t\t</LabelTag>\n\t\t)\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(WizzardItemClass.root)} variant={this.variant} size={this.size} role=\"listitem\" collapsible={this.collapsible}>\n\t\t\t\t{this.collapsible ? (\n\t\t\t\t\t<Tag\n\t\t\t\t\t\tid={triggerId}\n\t\t\t\t\t\tclass={WizzardItemClass.header}\n\t\t\t\t\t\taria-expanded={booleanString(this.isExpandedState)}\n\t\t\t\t\t\taria-controls={this.contentId}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\tonClick={() => (this.collapsible ? this.toggle() : false)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{label}\n\t\t\t\t\t</Tag>\n\t\t\t\t) : (\n\t\t\t\t\t<div class={WizzardItemClass.header}>{label}</div>\n\t\t\t\t)}\n\t\t\t\t{this.collapsible ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass={WizzardItemClass.content}\n\t\t\t\t\t\tid={this.contentId}\n\t\t\t\t\t\taria-hidden={booleanString(!this.isExpandedState)}\n\t\t\t\t\t\thidden={!this.isExpandedState}\n\t\t\t\t\t\taria-labelledby={triggerId}\n\t\t\t\t\t>\n\t\t\t\t\t\t<slot />\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<div class={WizzardItemClass.content} aria-hidden={booleanString(!this.isExpandedState)} hidden={!this.isExpandedState}>\n\t\t\t\t\t\t<slot />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Opening the Wizzard\n\t */\n\t@Method()\n\tasync open(): Promise<void> {\n\t\tthis.isExpandedState = true\n\t\tthis.emmitChange()\n\t}\n\n\t/**\n\t * Closing the Wizzard\n\t */\n\t@Method()\n\tpublic async close(): Promise<void> {\n\t\tthis.isExpandedState = false\n\t\tthis.emmitChange()\n\t}\n\n\t/**\n\t * Wizzard switch\n\t */\n\t@Method()\n\tpublic async toggle(): Promise<void> {\n\t\tthis.isExpandedState = !this.isExpandedState\n\t\tthis.emmitChange()\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tpublic async currentState(): Promise<boolean> {\n\t\treturn this.isExpandedState\n\t}\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"gov-wizzard.js","mappings":";;;;;;;;AAAA,MAAM,aAAa,GAAG,0bAA0b;;MCencA,YAA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Wizzard"],"sources":["../../../packages/core/src/components/gov-wizzard/gov-wizzard.scss?tag=gov-wizzard","../../../packages/core/src/components/gov-wizzard/gov-wizzard.tsx"],"sourcesContent":["/*\n * Wizzard\n */\n\n$class: \".gov-wizzard\";\n\n#{$class} {\n\t@include base();\n\t@include reset-last-margin();\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { WizzardClass, WizzardItemClass, WizardSizesType, WizardSizes } from './constants'\nimport { GovWizzardItemCustomEvent } from '../../components'\nimport { GovWizzardItemChangeEvent } from './gov-wizzard-item.d'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { validateWcagLabel } from '../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../helpers/Dom/win'\nimport { delay } from '../../utils/utils'\n\n@Component({\n\ttag: 'gov-wizzard',\n\tstyleUrl: 'gov-wizzard.scss',\n})\nexport class GovWizzard {\n\tprivate h: GovHost\n\n\t@Element() readonly host: HTMLGovWizzardElement\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\t/**\n\t * Size of wizzard\n\t */\n\t@Prop() readonly size?: WizardSizesType = 'm'\n\t/**\n\t * Adds accessible label for the wizzard that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-label' }) readonly wcagLabel: string\n\t/**\n\t * String of id's that indicate alternative labels elements\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Called when the wizzard children state changes\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<GovWizzardItemChangeEvent>\n\n\t@Watch('size')\n\tprivate validateSize(newValue: string): void {\n\t\tvalidateProp(WizardSizes, newValue, WizzardClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateSize(this.size)\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.host.querySelectorAll(WizzardItemClass.root).forEach((child: HTMLGovWizzardItemElement) => {\n\t\t\tchild.setAttribute('size', this.size)\n\t\t\tchild.addEventListener('gov-change', (e: GovWizzardItemCustomEvent<GovWizzardItemChangeEvent>) => {\n\t\t\t\te.stopPropagation()\n\t\t\t\tthis.govChange.emit(e.detail)\n\t\t\t})\n\t\t})\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\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(WizzardClass.root)} role=\"list\" size={this.size}>\n\t\t\t\t<slot />\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tpublic async validateWcag(): Promise<void> {\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, WizzardClass.root)\n\t}\n}\n"],"version":3}
|