{"version":3,"names":["CSS","container","labelCss","CalciteLabelStyle0","Label","this","labelClickHandler","event","window","getSelection","type","calciteInternalLabelClick","emit","sourceEvent","handleForChange","associateExplicitLabelToUnlabeledComponent","el","connectedCallback","document","dispatchEvent","CustomEvent","labelConnectedEvent","disconnectedCallback","labelDisconnectedEvent","render","h","Host","key","onClick","class"],"sources":["src/components/label/resources.ts","src/components/label/label.scss?tag=calcite-label&encapsulation=shadow","src/components/label/label.tsx"],"sourcesContent":["export const CSS = {\n container: \"container\",\n};\n","/**\n * CSS Custom Properties\n *\n * These properties can be overridden using the component's tag as selector.\n *\n * @prop --calcite-label-margin-bottom: The spacing below the component.\n */\n\n:host {\n @apply flex;\n}\n\n:host([alignment=\"start\"]) {\n text-align: start;\n}\n\n:host([alignment=\"end\"]) {\n text-align: end;\n}\n\n:host([alignment=\"center\"]) {\n @apply text-center;\n}\n\n:host([scale=\"s\"]) {\n .container {\n @apply text-n2h gap-1;\n margin-block-end: var(--calcite-label-margin-bottom, theme(\"spacing.2\"));\n }\n}\n:host([scale=\"m\"]) {\n .container {\n @apply text-n1h gap-2;\n margin-block-end: var(--calcite-label-margin-bottom, theme(\"spacing.3\"));\n }\n}\n:host([scale=\"l\"]) {\n .container {\n @apply text-0h gap-2;\n margin-block-end: var(--calcite-label-margin-bottom, theme(\"spacing.4\"));\n }\n}\n\n:host .container {\n @apply text-color-1\n mt-0\n mx-0\n w-full\n leading-snug;\n}\n\n:host([layout=\"default\"]) {\n .container {\n @apply flex flex-col;\n }\n}\n\n:host([layout=\"inline\"]),\n:host([layout=\"inline-space-between\"]) {\n .container {\n @apply flex flex-row items-center gap-2;\n }\n}\n:host([layout=\"inline\"][scale=\"l\"]) {\n .container {\n @apply gap-3;\n }\n}\n\n:host([layout=\"inline-space-between\"]) {\n .container {\n @apply justify-between;\n }\n}\n\n@include disabled() {\n & > .container {\n @apply opacity-disabled;\n }\n\n // prevent opacity stacking with already disabled child elements\n ::slotted(*[disabled]),\n ::slotted(*[disabled] *) {\n @apply bg-opacity-100;\n }\n ::slotted(calcite-input-message:not([active])) {\n @apply bg-opacity-0;\n }\n}\n\n@include base-component();\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n VNode,\n Watch,\n} from \"@stencil/core\";\nimport {\n associateExplicitLabelToUnlabeledComponent,\n labelConnectedEvent,\n labelDisconnectedEvent,\n} from \"../../utils/label\";\nimport { Alignment, Scale } from \"../interfaces\";\nimport { CSS } from \"./resources\";\n\n/**\n * @slot - A slot for adding text and a component that can be labeled.\n */\n@Component({\n tag: \"calcite-label\",\n styleUrl: \"label.scss\",\n shadow: true,\n})\nexport class Label {\n //--------------------------------------------------------------------------\n //\n // Properties\n //\n //--------------------------------------------------------------------------\n\n /** Specifies the text alignment of the component. */\n @Prop({ reflect: true }) alignment: Alignment = \"start\";\n\n /** Specifies the `id` of the component the label is bound to. Use when the component the label is bound to does not reside within the component. */\n @Prop({ reflect: true }) for: string;\n\n @Watch(\"for\")\n handleForChange(): void {\n associateExplicitLabelToUnlabeledComponent(this.el);\n }\n\n /** Specifies the size of the component. */\n @Prop({ reflect: true }) scale: Scale = \"m\";\n\n /** Defines the layout of the label in relation to the component. Use `\"inline\"` positions to wrap the label and component on the same line. */\n @Prop({ reflect: true }) layout: \"inline\" | \"inline-space-between\" | \"default\" = \"default\";\n\n //--------------------------------------------------------------------------\n //\n // Events\n //\n //--------------------------------------------------------------------------\n\n /**\n * @internal\n */\n @Event({ bubbles: false, cancelable: false }) calciteInternalLabelClick: EventEmitter<{\n sourceEvent: MouseEvent;\n }>;\n\n //--------------------------------------------------------------------------\n //\n // Private Properties\n //\n //--------------------------------------------------------------------------\n\n @Element() el: HTMLCalciteLabelElement;\n\n //--------------------------------------------------------------------------\n //\n // Private Methods\n //\n //--------------------------------------------------------------------------\n\n labelClickHandler = (event: MouseEvent): void => {\n if (window.getSelection()?.type === \"Range\") {\n return;\n }\n\n this.calciteInternalLabelClick.emit({\n sourceEvent: event,\n });\n };\n\n //--------------------------------------------------------------------------\n //\n // Lifecycle\n //\n //--------------------------------------------------------------------------\n\n connectedCallback(): void {\n document.dispatchEvent(new CustomEvent(labelConnectedEvent));\n }\n\n disconnectedCallback(): void {\n document.dispatchEvent(new CustomEvent(labelDisconnectedEvent));\n }\n\n render(): VNode {\n return (\n \n
\n \n
\n
\n );\n }\n}\n"],"mappings":";;;;;kNAAO,MAAMA,EAAM,CACjBC,UAAW,aCDb,MAAMC,EAAW,ksDACjB,MAAAC,EAAeD,E,MC0BFE,EAAK,M,8FAmDhBC,KAAAC,kBAAqBC,IACnB,GAAIC,OAAOC,gBAAgBC,OAAS,QAAS,CAC3C,M,CAGFL,KAAKM,0BAA0BC,KAAK,CAClCC,YAAaN,GACb,E,eAlD4C,Q,8BAWR,I,YAGyC,S,CARjF,eAAAO,GACEC,EAA2CV,KAAKW,G,CAoDlD,iBAAAC,GACEC,SAASC,cAAc,IAAIC,YAAYC,G,CAGzC,oBAAAC,GACEJ,SAASC,cAAc,IAAIC,YAAYG,G,CAGzC,MAAAC,GACE,OACEC,EAACC,EAAI,CAAAC,IAAA,2CAACC,QAASvB,KAAKC,mBAClBmB,EAAA,OAAAE,IAAA,2CAAKE,MAAO7B,EAAIC,WACdwB,EAAA,QAAAE,IAAA,8C","ignoreList":[]}