@paperless/core 0.1.0-alpha.341 → 0.1.0-alpha.343
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/CHANGELOG.md +28 -0
- package/dist/build/{p-086cd638.entry.js → p-1b6cfd6c.entry.js} +2 -2
- package/dist/build/p-1b6cfd6c.entry.js.map +1 -0
- package/dist/build/{p-f1284018.entry.js → p-33f16166.entry.js} +2 -2
- package/dist/build/p-33f16166.entry.js.map +1 -0
- package/dist/build/p-b61128d4.entry.js +2 -0
- package/dist/build/p-b61128d4.entry.js.map +1 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/p-select.cjs.entry.js +12 -1
- package/dist/cjs/p-select.cjs.entry.js.map +1 -1
- package/dist/cjs/p-stepper-item.cjs.entry.js +1 -1
- package/dist/cjs/p-stepper-item.cjs.entry.js.map +1 -1
- package/dist/cjs/p-stepper.cjs.entry.js +49 -30
- package/dist/cjs/p-stepper.cjs.entry.js.map +1 -1
- package/dist/collection/components/atoms/stepper-item/stepper-item.component.css +1 -1
- package/dist/collection/components/molecules/profile/profile.component.css +1 -1
- package/dist/collection/components/molecules/select/select.component.js +27 -0
- package/dist/collection/components/molecules/select/select.component.js.map +1 -1
- package/dist/collection/components/molecules/stepper/stepper.component.js +49 -30
- package/dist/collection/components/molecules/stepper/stepper.component.js.map +1 -1
- package/dist/components/p-select.js +12 -1
- package/dist/components/p-select.js.map +1 -1
- package/dist/components/p-stepper-item.js +1 -1
- package/dist/components/p-stepper-item.js.map +1 -1
- package/dist/components/p-stepper.js +49 -30
- package/dist/components/p-stepper.js.map +1 -1
- package/dist/esm/p-select.entry.js +12 -1
- package/dist/esm/p-select.entry.js.map +1 -1
- package/dist/esm/p-stepper-item.entry.js +1 -1
- package/dist/esm/p-stepper-item.entry.js.map +1 -1
- package/dist/esm/p-stepper.entry.js +49 -30
- package/dist/esm/p-stepper.entry.js.map +1 -1
- package/dist/index.html +1 -1
- package/dist/paperless/{p-086cd638.entry.js → p-1b6cfd6c.entry.js} +2 -2
- package/dist/paperless/p-1b6cfd6c.entry.js.map +1 -0
- package/dist/paperless/{p-f1284018.entry.js → p-33f16166.entry.js} +2 -2
- package/dist/paperless/p-33f16166.entry.js.map +1 -0
- package/dist/paperless/p-b61128d4.entry.js +2 -0
- package/dist/paperless/p-b61128d4.entry.js.map +1 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/types/components/molecules/select/select.component.d.ts +5 -0
- package/dist/types/components/molecules/stepper/stepper.component.d.ts +1 -1
- package/dist/types/components.d.ts +4 -0
- package/hydrate/index.js +63 -33
- package/package.json +1 -1
- package/dist/build/p-086cd638.entry.js.map +0 -1
- package/dist/build/p-3a6e2934.entry.js +0 -2
- package/dist/build/p-3a6e2934.entry.js.map +0 -1
- package/dist/build/p-f1284018.entry.js.map +0 -1
- package/dist/paperless/p-086cd638.entry.js.map +0 -1
- package/dist/paperless/p-3a6e2934.entry.js +0 -2
- package/dist/paperless/p-3a6e2934.entry.js.map +0 -1
- package/dist/paperless/p-f1284018.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-stepper.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,mBAAmB,GAAG,gfAAgf;;MCO/f,OAAO;;;sBAIa,CAAC;qBAM1B,YAAY;2BAK4C,KAAK;;;EASjE,
|
|
1
|
+
{"file":"p-stepper.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,mBAAmB,GAAG,gfAAgf;;MCO/f,OAAO;;;sBAIa,CAAC;qBAM1B,YAAY;2BAK4C,KAAK;;;EASjE,kBAAkB;IACd,IAAI,CAAC,cAAc,EAAE,CAAC;GACzB;EAED,MAAM;IACF,QACIA,QAACC,UAAI,IAAC,KAAK,EAAC,WAAW,IACnBD,qBAAQ,CACL,EACT;GACL;EAEO,cAAc;IAClB,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,GA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I,UAAU,CAAC;WACrC;SACJ;OACJ;KACJ;GACJ;;;;;;;","names":["h","Host"],"sources":["./src/components/molecules/stepper/stepper.component.scss?tag=p-stepper&encapsulation=shadow","./src/components/molecules/stepper/stepper.component.tsx"],"sourcesContent":[":host {\n @apply flex;\n}\n\n:host([direction='horizontal']) {\n @apply h-auto items-end;\n}\n\n:host([direction='vertical']) {\n @apply flex-col flex-wrap items-start;\n @apply w-full min-h-full;\n}\n\n:host([direction='vertical'][content-position='start']) {\n @apply items-end;\n}\n","import { Component, Element, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'p-stepper',\n styleUrl: 'stepper.component.scss',\n shadow: true,\n})\nexport class Stepper {\n /**\n * The currently active step\n */\n @Prop() activeStep: number = 1;\n\n /**\n * The direction of the stepper\n */\n @Prop({ reflect: true }) direction: 'horizontal' | 'vertical' =\n 'horizontal';\n\n /**\n * The position of the content in case of vertical direction\n */\n @Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n // private _steps: Array<HTMLPStepperItemElement>;\n\n componentDidRender() {\n this._generateSteps();\n }\n\n render() {\n return (\n <Host class=\"p-stepper\">\n <slot />\n </Host>\n );\n }\n\n private _generateSteps() {\n let activeStep = this.activeStep - 1;\n const items = this._el.querySelectorAll(\n 'p-stepper-item, p-stepper-line'\n );\n\n if (!!this.activeStep || activeStep <= 0) {\n const arrayItems = Array.from(items);\n const activeItemIndex = arrayItems.findIndex(\n (i: any) =>\n i.tagName.toLowerCase() === 'p-stepper-item' &&\n i.active &&\n !i.finished\n );\n\n if (activeItemIndex >= 0) {\n activeStep = activeItemIndex;\n }\n\n const finishedItemIndex = arrayItems.findIndex(\n (i: any) =>\n i.tagName.toLowerCase() === 'p-stepper-item' && i.finished\n );\n if (activeStep <= 0 && finishedItemIndex >= 0) {\n activeStep = finishedItemIndex + 1;\n }\n }\n\n for (let i = 0; i < items?.length; i++) {\n const item = items.item(i) as any;\n\n if (item.tagName.toLowerCase() === 'p-stepper-item') {\n item.active = i === activeStep;\n item.finished = i < activeStep;\n item.direction = this.direction;\n item.align =\n i === 0\n ? 'start'\n : i === items?.length - 1\n ? 'end'\n : 'center';\n item.contentPosition = this.contentPosition;\n\n if (i > 0) {\n const nextItem = items.item(i + 1) as any;\n\n if (\n !nextItem ||\n nextItem.tagName.toLowerCase() === 'p-stepper-item'\n ) {\n const heightDiff = (item.clientHeight - 16) / 2;\n\n const stepperLine =\n document.createElement('p-stepper-line');\n stepperLine.direction = this.direction;\n stepperLine.active = i <= activeStep;\n\n if (heightDiff > 0 && this.direction === 'vertical') {\n stepperLine.style.marginTop = `-${\n heightDiff / 16\n }rem`;\n stepperLine.style.marginBottom = `-${\n heightDiff / 16\n }rem`;\n stepperLine.style.minHeight = `calc(1rem + ${\n (heightDiff * 2) / 16\n }rem)`;\n }\n\n this._el.insertBefore(stepperLine, item);\n\n continue;\n }\n\n if (nextItem.tagName.toLowerCase() === 'p-stepper-line') {\n nextItem.direction = this.direction;\n nextItem.active = i <= activeStep;\n }\n }\n }\n }\n }\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.absolute{position:absolute!important}.relative{position:relative!important}.left-1\/2{left:50%!important}.order-2{order:2!important}.ml-0{margin-left:0!important}.mr-4{margin-right:1rem!important}.flex{display:flex!important}.h-4{height:1rem!important}.min-h-\[1rem\]{min-height:1rem!important}.w-4{width:1rem!important}.min-w-0{min-width:0!important}.-translate-x-1\/2{--tw-translate-x:-50%!important}.-translate-x-1\/2,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.items-end{align-items:flex-end!important}.items-center{align-items:center!important}.bg-mystic-dark{--tw-bg-opacity:1!important;background-color:rgb(218 230 240/var(--tw-bg-opacity))!important}.text-sm{font-size:.875rem!important;line-height:1.25rem!important}.
|
|
1
|
+
.absolute{position:absolute!important}.relative{position:relative!important}.left-1\/2{left:50%!important}.order-2{order:2!important}.ml-0{margin-left:0!important}.mr-4{margin-right:1rem!important}.flex{display:flex!important}.h-4{height:1rem!important}.min-h-\[1rem\]{min-height:1rem!important}.w-4{width:1rem!important}.min-w-0{min-width:0!important}.-translate-x-1\/2{--tw-translate-x:-50%!important}.-translate-x-1\/2,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.items-end{align-items:flex-end!important}.items-center{align-items:center!important}.bg-mystic-dark{--tw-bg-opacity:1!important;background-color:rgb(218 230 240/var(--tw-bg-opacity))!important}.text-sm{font-size:.875rem!important;line-height:1.25rem!important}.transition{transition-duration:.15s!important;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter!important;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter!important;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important}.duration-500{transition-duration:.5s!important}*{box-sizing:border-box}:host{align-items:flex-end;display:flex;justify-content:center;position:relative}:host .content{--tw-text-opacity:1;color:rgb(176 178 203/var(--tw-text-opacity));font-size:.875rem;line-height:1.25rem;min-width:0;white-space:nowrap}:host .circle{--tw-bg-opacity:1;--tw-text-opacity:1;align-items:center;background-color:rgb(218 230 240/var(--tw-bg-opacity));border-radius:100%;color:rgb(255 255 255/var(--tw-text-opacity));display:flex;height:1rem;justify-content:center;transition-duration:.5s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1rem}:host .circle p-icon{display:flex!important;font-size:.625rem}:host([direction=horizontal]){height:2.5rem}:host([direction=horizontal]) .content{order:1;position:absolute;top:0}:host([direction=horizontal]) .circle{order:2}:host([direction=vertical]){align-items:center;min-height:1rem}:host([direction=vertical]) .content{margin-left:1rem;order:2}:host([direction=vertical]) .circle{order:1}:host([active]) .content,:host([finished]) .content{--tw-text-opacity:1;color:rgb(82 138 250/var(--tw-text-opacity))}:host([active]) .circle,:host([finished]) .circle{--tw-bg-opacity:1;background-color:rgb(82 138 250/var(--tw-bg-opacity))}:host([direction=horizontal][align=start]) .content{left:0}:host([direction=horizontal][align=end]) .content{right:0}:host([direction=horizontal][align=center]) .content{--tw-translate-x:-50%;left:50%;text-align:center;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}:host([direction=vertical][content-position=start]){flex-direction:row-reverse}:host([direction=vertical][content-position=start]) .content{display:flex;justify-content:flex-end;margin-left:0;margin-right:1rem}.static{position:static!important}.-rotate-0{--tw-rotate:-0deg!important}.-rotate-0,.-rotate-135{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-135{--tw-rotate:-135deg!important}.-rotate-180{--tw-rotate:-180deg!important}.-rotate-180,.-rotate-225{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-225{--tw-rotate:-225deg!important}.-rotate-25{--tw-rotate:-25deg!important}.-rotate-25,.-rotate-270{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-270{--tw-rotate:-270deg!important}.-rotate-315{--tw-rotate:-315deg!important}.-rotate-315,.-rotate-45{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-45{--tw-rotate:-45deg!important}.-rotate-90{--tw-rotate:-90deg!important}.-rotate-90,.rotate-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-0{--tw-rotate:0deg!important}.rotate-135{--tw-rotate:135deg!important}.rotate-135,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-180{--tw-rotate:180deg!important}.rotate-225{--tw-rotate:225deg!important}.rotate-225,.rotate-25{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-25{--tw-rotate:25deg!important}.rotate-270{--tw-rotate:270deg!important}.rotate-270,.rotate-315{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-315{--tw-rotate:315deg!important}.rotate-45{--tw-rotate:45deg!important}.rotate-45,.rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-90{--tw-rotate:90deg!important}.scale-x-flip{--tw-scale-x:-1!important}.scale-x-flip,.scale-y-flip{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.scale-y-flip{--tw-scale-y:-1!important}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.text-2xl{font-size:1.5rem!important;line-height:2rem!important}.text-3xl{font-size:1.875rem!important;line-height:2.25rem!important}.text-4xl{font-size:2.25rem!important;line-height:2.5rem!important}.text-5xl{font-size:3rem!important}.text-5xl,.text-6xl{line-height:1!important}.text-6xl{font-size:3.75rem!important}.text-base{font-size:1rem!important;line-height:1.5rem!important}.text-lg{font-size:1.125rem!important}.text-lg,.text-xl{line-height:1.75rem!important}.text-xl{font-size:1.25rem!important}.text-xs{font-size:.75rem!important;line-height:1rem!important}.text-xxs{font-size:.6875rem!important}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.flex{display:flex!important}.h-\[3\.125rem\]{height:3.125rem!important}.h-\[4\.125rem\]{height:4.125rem!important}.flex-col{flex-direction:column!important}.items-center{align-items:center!important}.justify-center{justify-content:center!important}.gap-3{gap:.75rem!important}.overflow-hidden{overflow:hidden!important}.text-ellipsis{text-overflow:ellipsis!important}.rounded{border-radius:.25rem!important}.border{border-width:1px!important}.border-solid{border-style:solid!important}.border-mystic-dark{--tw-border-opacity:1!important;border-color:rgb(218 230 240/var(--tw-border-opacity))!important}.p-2{padding:.5rem!important}.text-sm{font-size:.875rem!important;line-height:1.25rem!important}*{box-sizing:border-box}:host{display:flex}:host .content{align-items:center;display:flex;gap:.75rem;width:100%}:host .content .name{display:flex;flex-direction:column;justify-content:center;overflow:hidden}:host .content .name>:first-child{--tw-text-opacity:1;color:rgb(39 40 56/var(--tw-text-opacity));font-size:.875rem;font-weight:600;line-height:1.25rem}:host .content .name>:nth-child(2){--tw-text-opacity:1;color:rgb(152 154 183/var(--tw-text-opacity));font-size:.875rem;line-height:1.25rem}:host .content .name ::slotted(*){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([size=small]){height:2rem}:host([size=medium]){height:3.125rem}:host([size=large]){height:4rem}:host(.has-dropdown){cursor:pointer}:host(.has-dropdown) .content{--tw-border-opacity:1!important;border-color:rgb(218 230 240/var(--tw-border-opacity))!important;border-radius:.25rem;border-style:solid!important;border-width:1px!important;padding:.5rem}:host(.has-dropdown[size=small]){height:3rem}:host(.has-dropdown[size=medium]){height:4.125rem}:host(.has-dropdown[size=large]){height:5rem}:host(.active) .content,:host(.has-dropdown:hover) .content{--tw-shadow:0px 0.3125rem 1rem rgba(0,24,98,.08),0px 0.0625rem 0.1875rem rgba(0,24,98,.13);--tw-shadow-colored:0px 0.3125rem 1rem var(--tw-shadow-color),0px 0.0625rem 0.1875rem var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}:host(.active) .content p-icon{--tw-text-opacity:1;color:rgb(82 138 250/var(--tw-text-opacity))}.static{position:static!important}.absolute{position:absolute!important}.ml-auto{margin-left:auto!important}.w-full{width:100%!important}.min-w-0{min-width:0!important}.-rotate-0{--tw-rotate:-0deg!important}.-rotate-0,.-rotate-135{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-135{--tw-rotate:-135deg!important}.-rotate-180{--tw-rotate:-180deg!important}.-rotate-180,.-rotate-225{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-225{--tw-rotate:-225deg!important}.-rotate-25{--tw-rotate:-25deg!important}.-rotate-25,.-rotate-270{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-270{--tw-rotate:-270deg!important}.-rotate-315{--tw-rotate:-315deg!important}.-rotate-315,.-rotate-45{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-45{--tw-rotate:-45deg!important}.-rotate-90{--tw-rotate:-90deg!important}.-rotate-90,.rotate-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-0{--tw-rotate:0deg!important}.rotate-135{--tw-rotate:135deg!important}.rotate-135,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-180{--tw-rotate:180deg!important}.rotate-225{--tw-rotate:225deg!important}.rotate-225,.rotate-25{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-25{--tw-rotate:25deg!important}.rotate-270{--tw-rotate:270deg!important}.rotate-270,.rotate-315{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-315{--tw-rotate:315deg!important}.rotate-45{--tw-rotate:45deg!important}.rotate-45,.rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-90{--tw-rotate:90deg!important}.scale-x-flip{--tw-scale-x:-1!important}.scale-x-flip,.scale-y-flip{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.scale-y-flip{--tw-scale-y:-1!important}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.text-2xl{font-size:1.5rem!important;line-height:2rem!important}.text-3xl{font-size:1.875rem!important;line-height:2.25rem!important}.text-4xl{font-size:2.25rem!important;line-height:2.5rem!important}.text-5xl{font-size:3rem!important}.text-5xl,.text-6xl{line-height:1!important}.text-6xl{font-size:3.75rem!important}.text-base{font-size:1rem!important;line-height:1.5rem!important}.text-lg{font-size:1.125rem!important}.text-lg,.text-xl{line-height:1.75rem!important}.text-xl{font-size:1.25rem!important}.text-xs{font-size:.75rem!important;line-height:1rem!important}.text-xxs{font-size:.6875rem!important}
|
|
1
|
+
.flex{display:flex!important}.h-\[3\.125rem\]{height:3.125rem!important}.h-\[4\.125rem\]{height:4.125rem!important}.flex-col{flex-direction:column!important}.items-center{align-items:center!important}.justify-center{justify-content:center!important}.gap-3{gap:.75rem!important}.overflow-hidden{overflow:hidden!important}.text-ellipsis{text-overflow:ellipsis!important}.rounded{border-radius:.25rem!important}.border{border-width:1px!important}.border-solid{border-style:solid!important}.border-mystic-dark{--tw-border-opacity:1!important;border-color:rgb(218 230 240/var(--tw-border-opacity))!important}.p-2{padding:.5rem!important}.text-sm{font-size:.875rem!important;line-height:1.25rem!important}*{box-sizing:border-box}:host{display:flex}:host .content{align-items:center;display:flex;gap:.75rem;width:100%}:host .content .name{display:flex;flex-direction:column;justify-content:center;overflow:hidden}:host .content .name>:first-child{--tw-text-opacity:1;color:rgb(39 40 56/var(--tw-text-opacity));font-size:.875rem;font-weight:600;line-height:1.25rem}:host .content .name>:nth-child(2){--tw-text-opacity:1;color:rgb(152 154 183/var(--tw-text-opacity));font-size:.875rem;line-height:1.25rem}:host .content .name ::slotted(*){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host([size=small]){height:2rem}:host([size=medium]){height:3.125rem}:host([size=large]){height:4rem}:host(.has-dropdown){cursor:pointer}:host(.has-dropdown) .content{--tw-border-opacity:1!important;border-color:rgb(218 230 240/var(--tw-border-opacity))!important;border-radius:.25rem;border-style:solid!important;border-width:1px!important;padding:.5rem}:host(.has-dropdown[size=small]){height:3rem}:host(.has-dropdown[size=medium]){height:4.125rem}:host(.has-dropdown[size=large]){height:5rem}:host(.active) .content,:host(.has-dropdown:hover) .content{--tw-shadow:0px 0.3125rem 1rem rgba(0,24,98,.08),0px 0.0625rem 0.1875rem rgba(0,24,98,.13);--tw-shadow-colored:0px 0.3125rem 1rem var(--tw-shadow-color),0px 0.0625rem 0.1875rem var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}:host(.active) .content p-icon{--tw-text-opacity:1;color:rgb(82 138 250/var(--tw-text-opacity))}.static{position:static!important}.absolute{position:absolute!important}.ml-auto{margin-left:auto!important}.w-full{width:100%!important}.min-w-0{min-width:0!important}.visible{visibility:visible!important}.-rotate-0{--tw-rotate:-0deg!important}.-rotate-0,.-rotate-135{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-135{--tw-rotate:-135deg!important}.-rotate-180{--tw-rotate:-180deg!important}.-rotate-180,.-rotate-225{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-225{--tw-rotate:-225deg!important}.-rotate-25{--tw-rotate:-25deg!important}.-rotate-25,.-rotate-270{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-270{--tw-rotate:-270deg!important}.-rotate-315{--tw-rotate:-315deg!important}.-rotate-315,.-rotate-45{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-45{--tw-rotate:-45deg!important}.-rotate-90{--tw-rotate:-90deg!important}.-rotate-90,.rotate-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-0{--tw-rotate:0deg!important}.rotate-135{--tw-rotate:135deg!important}.rotate-135,.rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-180{--tw-rotate:180deg!important}.rotate-225{--tw-rotate:225deg!important}.rotate-225,.rotate-25{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-25{--tw-rotate:25deg!important}.rotate-270{--tw-rotate:270deg!important}.rotate-270,.rotate-315{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-315{--tw-rotate:315deg!important}.rotate-45{--tw-rotate:45deg!important}.rotate-45,.rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-90{--tw-rotate:90deg!important}.scale-x-flip{--tw-scale-x:-1!important}.scale-x-flip,.scale-y-flip{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.scale-y-flip{--tw-scale-y:-1!important}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.text-2xl{font-size:1.5rem!important;line-height:2rem!important}.text-3xl{font-size:1.875rem!important;line-height:2.25rem!important}.text-4xl{font-size:2.25rem!important;line-height:2.5rem!important}.text-5xl{font-size:3rem!important}.text-5xl,.text-6xl{line-height:1!important}.text-6xl{font-size:3.75rem!important}.text-base{font-size:1rem!important;line-height:1.5rem!important}.text-lg{font-size:1.125rem!important}.text-lg,.text-xl{line-height:1.75rem!important}.text-xl{font-size:1.25rem!important}.text-xs{font-size:.75rem!important;line-height:1rem!important}.text-xxs{font-size:.6875rem!important}
|
|
@@ -95,6 +95,12 @@ export class Select {
|
|
|
95
95
|
itemChanges() {
|
|
96
96
|
this._preselectItem();
|
|
97
97
|
}
|
|
98
|
+
_showDropdownChanges() {
|
|
99
|
+
this.dropdownShown.emit({
|
|
100
|
+
value: this._showDropdown,
|
|
101
|
+
query: this.query,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
98
104
|
_preselectItem(value) {
|
|
99
105
|
value = value === undefined ? null : value;
|
|
100
106
|
const parsedValue = !!this.value
|
|
@@ -115,6 +121,9 @@ export class Select {
|
|
|
115
121
|
this._onBlur(true);
|
|
116
122
|
}
|
|
117
123
|
_onFocus() {
|
|
124
|
+
if (!this.items.length && !this.loading) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
118
127
|
if (!this.enableAutocomplete) {
|
|
119
128
|
this._inputRef.blur();
|
|
120
129
|
if (!this._showDropdown) {
|
|
@@ -588,6 +597,21 @@ export class Select {
|
|
|
588
597
|
"resolved": "any",
|
|
589
598
|
"references": {}
|
|
590
599
|
}
|
|
600
|
+
}, {
|
|
601
|
+
"method": "dropdownShown",
|
|
602
|
+
"name": "dropdownShown",
|
|
603
|
+
"bubbles": true,
|
|
604
|
+
"cancelable": true,
|
|
605
|
+
"composed": true,
|
|
606
|
+
"docs": {
|
|
607
|
+
"tags": [],
|
|
608
|
+
"text": "Event when the dropdown shows"
|
|
609
|
+
},
|
|
610
|
+
"complexType": {
|
|
611
|
+
"original": "any",
|
|
612
|
+
"resolved": "any",
|
|
613
|
+
"references": {}
|
|
614
|
+
}
|
|
591
615
|
}];
|
|
592
616
|
}
|
|
593
617
|
static get elementRef() { return "_el"; }
|
|
@@ -598,6 +622,9 @@ export class Select {
|
|
|
598
622
|
}, {
|
|
599
623
|
"propName": "items",
|
|
600
624
|
"methodName": "itemChanges"
|
|
625
|
+
}, {
|
|
626
|
+
"propName": "_showDropdown",
|
|
627
|
+
"methodName": "_showDropdownChanges"
|
|
601
628
|
}];
|
|
602
629
|
}
|
|
603
630
|
static get listeners() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.component.js","sourceRoot":"","sources":["../../../../src/components/molecules/select/select.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAQzC,MAAM,OAAO,MAAM;;IA4HP,sBAAiB,GAAY,KAAK,CAAC;;;;;;;sBA1Fd,MAAM;oBAKR,OAAO;;2BAUC,IAAI;uBAKR,IAAI;6BAKC,EAAE;8BAKA,IAAI;uBAKX,KAAK;mBAKT,KAAK;gBAeG,QAAQ;;;;;oBAyBE,KAAK;yBAOZ,KAAK;yBACL,IAAI;;EAM1C,IAAI,MAAM;;IACN,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE;MAC7B,OAAO,EAAE,CAAC;KACb;IAED,IAAI,KAAK,GACL,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;MAC1B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;MACxB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IAErB,IAAI,OAAO,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAA,KAAK,QAAQ,EAAE;MAChC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;MACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;MAExB,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { childOf } from '../../../utils';\nimport { IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-select',\n styleUrl: 'select.component.scss',\n shadow: false,\n})\nexport class Select {\n /**\n * The items to show in the dropdown\n */\n @Prop() items: string | any[];\n\n /**\n * Icon of the select box\n */\n @Prop() icon: IconVariant;\n\n /**\n * The current query\n */\n @Prop() query: string;\n\n /**\n * The placeholder of the input\n */\n @Prop() placeholder: string;\n\n /**\n * The placeholder of the input when auto completing\n */\n @Prop() autocompletePlaceholder: string;\n\n /**\n * The current value\n */\n @Prop() value: any;\n\n /**\n * The key of the object to display\n */\n @Prop() displayKey: string = 'text';\n\n /**\n * The key of the object to return\n */\n @Prop() valueKey: string = 'value';\n\n /**\n * The key of the object to display\n */\n @Prop() queryKey?: string;\n\n /**\n * Wether to automatically select the first item\n */\n @Prop() autoSelectFirst: boolean = true;\n\n /**\n * Wether to show the chevron or not\n */\n @Prop() showChevron: boolean = true;\n\n /**\n * The maximum amount of items to display\n */\n @Prop() maxDisplayedItems: number = 10;\n\n /**\n * Wether to enable autocomplete\n */\n @Prop() enableAutocomplete: boolean = true;\n\n /**\n * Wether the input uses async filtering\n */\n @Prop() asyncFilter: boolean = false;\n\n /**\n * Wether to show loading items\n */\n @Prop() loading: boolean = false;\n\n /**\n * Event when the query of the autocomplete changes\n */\n @Event() queryChange: EventEmitter<string>;\n\n /**\n * Event when the value changes\n */\n @Event() valueChange: EventEmitter<any>;\n\n /**\n * The size of the input group used by the select\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group used by the select\n */\n @Prop() prefix: string;\n\n /**\n * The label of the input group used by the select\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop() helper: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled used by the select\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _showDropdown: any = false;\n @State() private _selectedItem: any = null;\n\n private _isAutoCompleting: boolean = false;\n\n private _inputRef: HTMLInputElement;\n\n get _items() {\n if (!this.items || this.loading) {\n return [];\n }\n\n let items =\n typeof this.items === 'string'\n ? JSON.parse(this.items)\n : this.items;\n\n if (typeof items?.[0] === 'string') {\n this.displayKey = 'text';\n this.valueKey = 'value';\n\n items = items.map((str) => ({\n value: str,\n text: str,\n }));\n }\n\n if (this._isAutoCompleting && this.query?.length && !this.asyncFilter) {\n items = items.filter((item) => {\n if (this.queryKey) {\n return this._checkvalue(this.queryKey, item);\n }\n\n return (\n this._checkvalue(this.valueKey, item) ||\n this._checkvalue(this.displayKey, item)\n );\n });\n }\n\n return items?.slice(0, this.maxDisplayedItems);\n }\n\n get _displayValue() {\n if (this._isAutoCompleting) {\n return this.query;\n }\n\n return this._selectedItem?.[this.displayKey];\n }\n\n get _placeholder() {\n return this._isAutoCompleting && this.autocompletePlaceholder?.length\n ? this.autocompletePlaceholder\n : this.placeholder;\n }\n\n componentDidLoad() {\n if (this.value) {\n this._valueChange(this.value);\n return;\n }\n\n if (this.autoSelectFirst) {\n this._selectedItem = this._items?.[0];\n }\n }\n\n render() {\n return (\n <Host class=\"p-select\">\n <p-dropdown\n disableTriggerClick={true}\n calculateWidth={true}\n insideClick={true}\n show={this._showDropdown}\n >\n <p-input-group\n slot=\"trigger\"\n icon={this.icon}\n size={this.size}\n prefix={this.prefix}\n label={this.label}\n helper={this.helper}\n error={this.error}\n disabled={this.disabled}\n focused={this._showDropdown}\n >\n <input\n slot=\"input\"\n type=\"text\"\n placeholder={this._placeholder}\n value={this._displayValue}\n class={`p-input cursor-pointer ${\n !this._isAutoCompleting && 'read-only'\n }`}\n onFocus={() => this._onFocus()}\n onMouseDown={(ev) => this._onMouseDown(ev)}\n onClick={() => this._onClick()}\n onInput={(ev) => this._onChange(ev)}\n ref={(ref) => (this._inputRef = ref)}\n />\n\n {this.showChevron && (\n <p-icon variant=\"chevron\" slot=\"suffix\" />\n )}\n </p-input-group>\n <div slot=\"items\">\n {this.loading\n ? this._getLoadingItems()\n : this._getItems()}\n </div>\n </p-dropdown>\n </Host>\n );\n }\n\n @Listen('click', { target: 'document', capture: true })\n protected documentClickHandler({ target }) {\n if (!this._showDropdown || childOf(target, this._el)) {\n return;\n }\n\n this._showDropdown = false;\n this._isAutoCompleting = false;\n }\n\n @Watch('value')\n private _valueChange(value: any) {\n this._preselectItem(value);\n }\n\n @Watch('items')\n public itemChanges() {\n this._preselectItem();\n }\n\n private _preselectItem(value?: any) {\n value = value === undefined ? null : value;\n const parsedValue = !!this.value\n ? JSON.stringify(this.value)\n : JSON.stringify(value);\n\n if (\n this._selectedItem &&\n JSON.stringify(this._selectedItem[this.valueKey]) === parsedValue\n ) {\n return;\n }\n\n const item = this._items.find(\n (i) => JSON.stringify(i?.[this.valueKey]) === parsedValue\n );\n\n this._selectedItem = item;\n }\n\n private _selectValue(item) {\n this._selectedItem = item;\n const value = item[this.valueKey];\n\n this.value = value;\n this.valueChange.emit(this.value);\n\n this._onBlur(true);\n }\n\n private _onFocus() {\n if (!this.enableAutocomplete) {\n this._inputRef.blur();\n if (!this._showDropdown) {\n this._showDropdown = true;\n }\n return;\n }\n\n this._isAutoCompleting = true;\n this._showDropdown = true;\n }\n\n private _onMouseDown(ev) {\n if (this.enableAutocomplete) {\n return;\n }\n\n ev.preventDefault();\n }\n\n private _onClick() {\n if (this.enableAutocomplete) {\n return;\n }\n\n this._showDropdown = !this._showDropdown;\n }\n\n private _onBlur(force = false) {\n if (!this.enableAutocomplete && !force) {\n return;\n }\n\n this._isAutoCompleting = false;\n this._showDropdown = false;\n }\n\n private _onChange(ev) {\n if (!this._isAutoCompleting) {\n return;\n }\n\n this.query = ev.target.value;\n this.queryChange.emit(this.query);\n }\n\n private _checkvalue(key, item) {\n return (\n item?.[key]\n ?.toString()\n ?.toLowerCase()\n .indexOf(this.query?.toLowerCase()) >= 0\n );\n }\n\n private _getItems() {\n return this._items.map((item) => (\n <p-dropdown-menu-item\n onClick={() => this._selectValue(item)}\n active={\n item[this.valueKey] === this._selectedItem?.[this.valueKey]\n }\n >\n {item[this.displayKey]}\n </p-dropdown-menu-item>\n ));\n }\n\n private _getLoadingItems() {\n return [0, 0, 0].map(() => (\n <p-dropdown-menu-item enableHover={false}>\n <p-loader variant=\"ghost\" class=\"h-6 w-full rounded\" />\n </p-dropdown-menu-item>\n ));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"select.component.js","sourceRoot":"","sources":["../../../../src/components/molecules/select/select.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAQzC,MAAM,OAAO,MAAM;;IAiIP,sBAAiB,GAAY,KAAK,CAAC;;;;;;;sBA/Fd,MAAM;oBAKR,OAAO;;2BAUC,IAAI;uBAKR,IAAI;6BAKC,EAAE;8BAKA,IAAI;uBAKX,KAAK;mBAKT,KAAK;gBAoBG,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;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { childOf } from '../../../utils';\nimport { IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-select',\n styleUrl: 'select.component.scss',\n shadow: false,\n})\nexport class Select {\n /**\n * The items to show in the dropdown\n */\n @Prop() items: string | any[];\n\n /**\n * Icon of the select box\n */\n @Prop() icon: IconVariant;\n\n /**\n * The current query\n */\n @Prop() query: string;\n\n /**\n * The placeholder of the input\n */\n @Prop() placeholder: string;\n\n /**\n * The placeholder of the input when auto completing\n */\n @Prop() autocompletePlaceholder: string;\n\n /**\n * The current value\n */\n @Prop() value: any;\n\n /**\n * The key of the object to display\n */\n @Prop() displayKey: string = 'text';\n\n /**\n * The key of the object to return\n */\n @Prop() valueKey: string = 'value';\n\n /**\n * The key of the object to display\n */\n @Prop() queryKey?: string;\n\n /**\n * Wether to automatically select the first item\n */\n @Prop() autoSelectFirst: boolean = true;\n\n /**\n * Wether to show the chevron or not\n */\n @Prop() showChevron: boolean = true;\n\n /**\n * The maximum amount of items to display\n */\n @Prop() maxDisplayedItems: number = 10;\n\n /**\n * Wether to enable autocomplete\n */\n @Prop() enableAutocomplete: boolean = true;\n\n /**\n * Wether the input uses async filtering\n */\n @Prop() asyncFilter: boolean = false;\n\n /**\n * Wether to show loading items\n */\n @Prop() loading: boolean = false;\n\n /**\n * Event when the query of the autocomplete changes\n */\n @Event() queryChange: EventEmitter<string>;\n\n /**\n * Event when the value changes\n */\n @Event() valueChange: EventEmitter<any>;\n\n /**\n * Event when the dropdown shows\n */\n @Event() dropdownShown: EventEmitter<any>;\n\n /**\n * The size of the input group used by the select\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group used by the select\n */\n @Prop() prefix: string;\n\n /**\n * The label of the input group used by the select\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop() helper: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled used by the select\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _showDropdown: any = false;\n @State() private _selectedItem: any = null;\n\n private _isAutoCompleting: boolean = false;\n\n private _inputRef: HTMLInputElement;\n\n get _items() {\n if (!this.items || this.loading) {\n return [];\n }\n\n let items =\n typeof this.items === 'string'\n ? JSON.parse(this.items)\n : this.items;\n\n if (typeof items?.[0] === 'string') {\n this.displayKey = 'text';\n this.valueKey = 'value';\n\n items = items.map((str) => ({\n value: str,\n text: str,\n }));\n }\n\n if (this._isAutoCompleting && this.query?.length && !this.asyncFilter) {\n items = items.filter((item) => {\n if (this.queryKey) {\n return this._checkvalue(this.queryKey, item);\n }\n\n return (\n this._checkvalue(this.valueKey, item) ||\n this._checkvalue(this.displayKey, item)\n );\n });\n }\n\n return items?.slice(0, this.maxDisplayedItems);\n }\n\n get _displayValue() {\n if (this._isAutoCompleting) {\n return this.query;\n }\n\n return this._selectedItem?.[this.displayKey];\n }\n\n get _placeholder() {\n return this._isAutoCompleting && this.autocompletePlaceholder?.length\n ? this.autocompletePlaceholder\n : this.placeholder;\n }\n\n componentDidLoad() {\n if (this.value) {\n this._valueChange(this.value);\n return;\n }\n\n if (this.autoSelectFirst) {\n this._selectedItem = this._items?.[0];\n }\n }\n\n render() {\n return (\n <Host class=\"p-select\">\n <p-dropdown\n disableTriggerClick={true}\n calculateWidth={true}\n insideClick={true}\n show={this._showDropdown}\n >\n <p-input-group\n slot=\"trigger\"\n icon={this.icon}\n size={this.size}\n prefix={this.prefix}\n label={this.label}\n helper={this.helper}\n error={this.error}\n disabled={this.disabled}\n focused={this._showDropdown}\n >\n <input\n slot=\"input\"\n type=\"text\"\n placeholder={this._placeholder}\n value={this._displayValue}\n class={`p-input cursor-pointer ${\n !this._isAutoCompleting && 'read-only'\n }`}\n onFocus={() => this._onFocus()}\n onMouseDown={(ev) => this._onMouseDown(ev)}\n onClick={() => this._onClick()}\n onInput={(ev) => this._onChange(ev)}\n ref={(ref) => (this._inputRef = ref)}\n />\n\n {this.showChevron && (\n <p-icon variant=\"chevron\" slot=\"suffix\" />\n )}\n </p-input-group>\n <div slot=\"items\">\n {this.loading\n ? this._getLoadingItems()\n : this._getItems()}\n </div>\n </p-dropdown>\n </Host>\n );\n }\n\n @Listen('click', { target: 'document', capture: true })\n protected documentClickHandler({ target }) {\n if (!this._showDropdown || childOf(target, this._el)) {\n return;\n }\n\n this._showDropdown = false;\n this._isAutoCompleting = false;\n }\n\n @Watch('value')\n private _valueChange(value: any) {\n this._preselectItem(value);\n }\n\n @Watch('items')\n public itemChanges() {\n this._preselectItem();\n }\n\n @Watch('_showDropdown')\n public _showDropdownChanges() {\n this.dropdownShown.emit({\n value: this._showDropdown,\n query: this.query,\n });\n }\n\n private _preselectItem(value?: any) {\n value = value === undefined ? null : value;\n const parsedValue = !!this.value\n ? JSON.stringify(this.value)\n : JSON.stringify(value);\n\n if (\n this._selectedItem &&\n JSON.stringify(this._selectedItem[this.valueKey]) === parsedValue\n ) {\n return;\n }\n\n const item = this._items.find(\n (i) => JSON.stringify(i?.[this.valueKey]) === parsedValue\n );\n\n this._selectedItem = item;\n }\n\n private _selectValue(item) {\n this._selectedItem = item;\n const value = item[this.valueKey];\n\n this.value = value;\n this.valueChange.emit(this.value);\n\n this._onBlur(true);\n }\n\n private _onFocus() {\n if (!this.items.length && !this.loading) {\n return;\n }\n\n if (!this.enableAutocomplete) {\n this._inputRef.blur();\n if (!this._showDropdown) {\n this._showDropdown = true;\n }\n return;\n }\n\n this._isAutoCompleting = true;\n this._showDropdown = true;\n }\n\n private _onMouseDown(ev) {\n if (this.enableAutocomplete) {\n return;\n }\n\n ev.preventDefault();\n }\n\n private _onClick() {\n if (this.enableAutocomplete) {\n return;\n }\n\n this._showDropdown = !this._showDropdown;\n }\n\n private _onBlur(force = false) {\n if (!this.enableAutocomplete && !force) {\n return;\n }\n\n this._isAutoCompleting = false;\n this._showDropdown = false;\n }\n\n private _onChange(ev) {\n if (!this._isAutoCompleting) {\n return;\n }\n\n this.query = ev.target.value;\n this.queryChange.emit(this.query);\n }\n\n private _checkvalue(key, item) {\n return (\n item?.[key]\n ?.toString()\n ?.toLowerCase()\n .indexOf(this.query?.toLowerCase()) >= 0\n );\n }\n\n private _getItems() {\n return this._items.map((item) => (\n <p-dropdown-menu-item\n onClick={() => this._selectValue(item)}\n active={\n item[this.valueKey] === this._selectedItem?.[this.valueKey]\n }\n >\n {item[this.displayKey]}\n </p-dropdown-menu-item>\n ));\n }\n\n private _getLoadingItems() {\n return [0, 0, 0].map(() => (\n <p-dropdown-menu-item enableHover={false}>\n <p-loader variant=\"ghost\" class=\"h-6 w-full rounded\" />\n </p-dropdown-menu-item>\n ));\n }\n}\n"]}
|
|
@@ -6,45 +6,64 @@ export class Stepper {
|
|
|
6
6
|
this.contentPosition = 'end';
|
|
7
7
|
}
|
|
8
8
|
// private _steps: Array<HTMLPStepperItemElement>;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this._generateSteps(activeStep);
|
|
9
|
+
componentDidRender() {
|
|
10
|
+
this._generateSteps();
|
|
12
11
|
}
|
|
13
12
|
render() {
|
|
14
13
|
return (h(Host, { class: "p-stepper" }, h("slot", null)));
|
|
15
14
|
}
|
|
16
|
-
_generateSteps(
|
|
17
|
-
|
|
15
|
+
_generateSteps() {
|
|
16
|
+
let activeStep = this.activeStep - 1;
|
|
17
|
+
const items = this._el.querySelectorAll('p-stepper-item, p-stepper-line');
|
|
18
|
+
if (!!this.activeStep || activeStep <= 0) {
|
|
19
|
+
const arrayItems = Array.from(items);
|
|
20
|
+
const activeItemIndex = arrayItems.findIndex((i) => i.tagName.toLowerCase() === 'p-stepper-item' &&
|
|
21
|
+
i.active &&
|
|
22
|
+
!i.finished);
|
|
23
|
+
if (activeItemIndex >= 0) {
|
|
24
|
+
activeStep = activeItemIndex;
|
|
25
|
+
}
|
|
26
|
+
const finishedItemIndex = arrayItems.findIndex((i) => i.tagName.toLowerCase() === 'p-stepper-item' && i.finished);
|
|
27
|
+
if (activeStep <= 0 && finishedItemIndex >= 0) {
|
|
28
|
+
activeStep = finishedItemIndex + 1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
18
31
|
for (let i = 0; i < (items === null || items === void 0 ? void 0 : items.length); i++) {
|
|
19
32
|
const item = items.item(i);
|
|
20
|
-
item.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if (item.tagName.toLowerCase() === 'p-stepper-item') {
|
|
34
|
+
item.active = i === activeStep;
|
|
35
|
+
item.finished = i < activeStep;
|
|
36
|
+
item.direction = this.direction;
|
|
37
|
+
item.align =
|
|
38
|
+
i === 0
|
|
39
|
+
? 'start'
|
|
40
|
+
: i === (items === null || items === void 0 ? void 0 : items.length) - 1
|
|
41
|
+
? 'end'
|
|
42
|
+
: 'center';
|
|
43
|
+
item.contentPosition = this.contentPosition;
|
|
44
|
+
if (i > 0) {
|
|
45
|
+
const nextItem = items.item(i + 1);
|
|
46
|
+
if (!nextItem ||
|
|
47
|
+
nextItem.tagName.toLowerCase() === 'p-stepper-item') {
|
|
48
|
+
const heightDiff = (item.clientHeight - 16) / 2;
|
|
49
|
+
const stepperLine = document.createElement('p-stepper-line');
|
|
50
|
+
stepperLine.direction = this.direction;
|
|
51
|
+
stepperLine.active = i <= activeStep;
|
|
52
|
+
if (heightDiff > 0 && this.direction === 'vertical') {
|
|
53
|
+
stepperLine.style.marginTop = `-${heightDiff / 16}rem`;
|
|
54
|
+
stepperLine.style.marginBottom = `-${heightDiff / 16}rem`;
|
|
55
|
+
stepperLine.style.minHeight = `calc(1rem + ${(heightDiff * 2) / 16}rem)`;
|
|
56
|
+
}
|
|
57
|
+
this._el.insertBefore(stepperLine, item);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (nextItem.tagName.toLowerCase() === 'p-stepper-line') {
|
|
61
|
+
nextItem.direction = this.direction;
|
|
62
|
+
nextItem.active = i <= activeStep;
|
|
63
|
+
}
|
|
35
64
|
}
|
|
36
|
-
this._el.insertBefore(stepperLine, item);
|
|
37
65
|
}
|
|
38
|
-
// const child = item.querySelector('[slot="content"]');
|
|
39
|
-
// const newItem = (
|
|
40
|
-
// <p-stepper-item
|
|
41
|
-
// >
|
|
42
|
-
// <div slot="content" innerHTML={child.outerHTML} />
|
|
43
|
-
// </p-stepper-item>
|
|
44
|
-
// );
|
|
45
|
-
// elements.push(newItem);
|
|
46
66
|
}
|
|
47
|
-
// return elements;
|
|
48
67
|
}
|
|
49
68
|
static get is() { return "p-stepper"; }
|
|
50
69
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepper.component.js","sourceRoot":"","sources":["../../../../src/components/molecules/stepper/stepper.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAOlE,MAAM,OAAO,OAAO;;sBAIa,CAAC;qBAM1B,YAAY;2BAK4C,KAAK;;EAOjE,kDAAkD;EAElD,
|
|
1
|
+
{"version":3,"file":"stepper.component.js","sourceRoot":"","sources":["../../../../src/components/molecules/stepper/stepper.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAOlE,MAAM,OAAO,OAAO;;sBAIa,CAAC;qBAM1B,YAAY;2BAK4C,KAAK;;EAOjE,kDAAkD;EAElD,kBAAkB;IACd,IAAI,C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ACvB,MAAM,CAAC;aACV;YAED,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;YAEzC,SAAS;WACZ;UAED,IAAI,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,gBAAgB,EAAE;YACrD,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;YACpC,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC;WACrC;SACJ;OACJ;KACJ;EACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, Element, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'p-stepper',\n styleUrl: 'stepper.component.scss',\n shadow: true,\n})\nexport class Stepper {\n /**\n * The currently active step\n */\n @Prop() activeStep: number = 1;\n\n /**\n * The direction of the stepper\n */\n @Prop({ reflect: true }) direction: 'horizontal' | 'vertical' =\n 'horizontal';\n\n /**\n * The position of the content in case of vertical direction\n */\n @Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n // private _steps: Array<HTMLPStepperItemElement>;\n\n componentDidRender() {\n this._generateSteps();\n }\n\n render() {\n return (\n <Host class=\"p-stepper\">\n <slot />\n </Host>\n );\n }\n\n private _generateSteps() {\n let activeStep = this.activeStep - 1;\n const items = this._el.querySelectorAll(\n 'p-stepper-item, p-stepper-line'\n );\n\n if (!!this.activeStep || activeStep <= 0) {\n const arrayItems = Array.from(items);\n const activeItemIndex = arrayItems.findIndex(\n (i: any) =>\n i.tagName.toLowerCase() === 'p-stepper-item' &&\n i.active &&\n !i.finished\n );\n\n if (activeItemIndex >= 0) {\n activeStep = activeItemIndex;\n }\n\n const finishedItemIndex = arrayItems.findIndex(\n (i: any) =>\n i.tagName.toLowerCase() === 'p-stepper-item' && i.finished\n );\n if (activeStep <= 0 && finishedItemIndex >= 0) {\n activeStep = finishedItemIndex + 1;\n }\n }\n\n for (let i = 0; i < items?.length; i++) {\n const item = items.item(i) as any;\n\n if (item.tagName.toLowerCase() === 'p-stepper-item') {\n item.active = i === activeStep;\n item.finished = i < activeStep;\n item.direction = this.direction;\n item.align =\n i === 0\n ? 'start'\n : i === items?.length - 1\n ? 'end'\n : 'center';\n item.contentPosition = this.contentPosition;\n\n if (i > 0) {\n const nextItem = items.item(i + 1) as any;\n\n if (\n !nextItem ||\n nextItem.tagName.toLowerCase() === 'p-stepper-item'\n ) {\n const heightDiff = (item.clientHeight - 16) / 2;\n\n const stepperLine =\n document.createElement('p-stepper-line');\n stepperLine.direction = this.direction;\n stepperLine.active = i <= activeStep;\n\n if (heightDiff > 0 && this.direction === 'vertical') {\n stepperLine.style.marginTop = `-${\n heightDiff / 16\n }rem`;\n stepperLine.style.marginBottom = `-${\n heightDiff / 16\n }rem`;\n stepperLine.style.minHeight = `calc(1rem + ${\n (heightDiff * 2) / 16\n }rem)`;\n }\n\n this._el.insertBefore(stepperLine, item);\n\n continue;\n }\n\n if (nextItem.tagName.toLowerCase() === 'p-stepper-line') {\n nextItem.direction = this.direction;\n nextItem.active = i <= activeStep;\n }\n }\n }\n }\n }\n}\n"]}
|
|
@@ -18,6 +18,7 @@ const Select = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
18
18
|
this.__registerHost();
|
|
19
19
|
this.queryChange = createEvent(this, "queryChange", 7);
|
|
20
20
|
this.valueChange = createEvent(this, "valueChange", 7);
|
|
21
|
+
this.dropdownShown = createEvent(this, "dropdownShown", 7);
|
|
21
22
|
this._isAutoCompleting = false;
|
|
22
23
|
this.items = undefined;
|
|
23
24
|
this.icon = undefined;
|
|
@@ -111,6 +112,12 @@ const Select = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
111
112
|
itemChanges() {
|
|
112
113
|
this._preselectItem();
|
|
113
114
|
}
|
|
115
|
+
_showDropdownChanges() {
|
|
116
|
+
this.dropdownShown.emit({
|
|
117
|
+
value: this._showDropdown,
|
|
118
|
+
query: this.query,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
114
121
|
_preselectItem(value) {
|
|
115
122
|
value = value === undefined ? null : value;
|
|
116
123
|
const parsedValue = !!this.value
|
|
@@ -131,6 +138,9 @@ const Select = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
131
138
|
this._onBlur(true);
|
|
132
139
|
}
|
|
133
140
|
_onFocus() {
|
|
141
|
+
if (!this.items.length && !this.loading) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
134
144
|
if (!this.enableAutocomplete) {
|
|
135
145
|
this._inputRef.blur();
|
|
136
146
|
if (!this._showDropdown) {
|
|
@@ -183,7 +193,8 @@ const Select = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
183
193
|
get _el() { return this; }
|
|
184
194
|
static get watchers() { return {
|
|
185
195
|
"value": ["_valueChange"],
|
|
186
|
-
"items": ["itemChanges"]
|
|
196
|
+
"items": ["itemChanges"],
|
|
197
|
+
"_showDropdown": ["_showDropdownChanges"]
|
|
187
198
|
}; }
|
|
188
199
|
static get style() { return selectComponentCss; }
|
|
189
200
|
}, [0, "p-select", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-select.js","mappings":";;;;;;;;;;;;AAAA,MAAM,kBAAkB,GAAG,0yLAA0yL;;MCoBxzL,MAAM;;;;;;IA4HP,sBAAiB,GAAY,KAAK,CAAC;;;;;;;sBA1Fd,MAAM;oBAKR,OAAO;;2BAUC,IAAI;uBAKR,IAAI;6BAKC,EAAE;8BAKA,IAAI;uBAKX,KAAK;mBAKT,KAAK;gBAeG,QAAQ;;;;;oBAyBE,KAAK;yBAOZ,KAAK;yBACL,IAAI;;EAM1C,IAAI,MAAM;;IACN,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE;MAC7B,OAAO,EAAE,CAAC;KACb;IAED,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ules/select/select.component.tsx"],"sourcesContent":[":host {\n @apply flex flex-col;\n\n input.read-only {\n @apply text-ellipsis;\n }\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { childOf } from '../../../utils';\nimport { IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-select',\n styleUrl: 'select.component.scss',\n shadow: false,\n})\nexport class Select {\n /**\n * The items to show in the dropdown\n */\n @Prop() items: string | any[];\n\n /**\n * Icon of the select box\n */\n @Prop() icon: IconVariant;\n\n /**\n * The current query\n */\n @Prop() query: string;\n\n /**\n * The placeholder of the input\n */\n @Prop() placeholder: string;\n\n /**\n * The placeholder of the input when auto completing\n */\n @Prop() autocompletePlaceholder: string;\n\n /**\n * The current value\n */\n @Prop() value: any;\n\n /**\n * The key of the object to display\n */\n @Prop() displayKey: string = 'text';\n\n /**\n * The key of the object to return\n */\n @Prop() valueKey: string = 'value';\n\n /**\n * The key of the object to display\n */\n @Prop() queryKey?: string;\n\n /**\n * Wether to automatically select the first item\n */\n @Prop() autoSelectFirst: boolean = true;\n\n /**\n * Wether to show the chevron or not\n */\n @Prop() showChevron: boolean = true;\n\n /**\n * The maximum amount of items to display\n */\n @Prop() maxDisplayedItems: number = 10;\n\n /**\n * Wether to enable autocomplete\n */\n @Prop() enableAutocomplete: boolean = true;\n\n /**\n * Wether the input uses async filtering\n */\n @Prop() asyncFilter: boolean = false;\n\n /**\n * Wether to show loading items\n */\n @Prop() loading: boolean = false;\n\n /**\n * Event when the query of the autocomplete changes\n */\n @Event() queryChange: EventEmitter<string>;\n\n /**\n * Event when the value changes\n */\n @Event() valueChange: EventEmitter<any>;\n\n /**\n * The size of the input group used by the select\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group used by the select\n */\n @Prop() prefix: string;\n\n /**\n * The label of the input group used by the select\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop() helper: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled used by the select\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _showDropdown: any = false;\n @State() private _selectedItem: any = null;\n\n private _isAutoCompleting: boolean = false;\n\n private _inputRef: HTMLInputElement;\n\n get _items() {\n if (!this.items || this.loading) {\n return [];\n }\n\n let items =\n typeof this.items === 'string'\n ? JSON.parse(this.items)\n : this.items;\n\n if (typeof items?.[0] === 'string') {\n this.displayKey = 'text';\n this.valueKey = 'value';\n\n items = items.map((str) => ({\n value: str,\n text: str,\n }));\n }\n\n if (this._isAutoCompleting && this.query?.length && !this.asyncFilter) {\n items = items.filter((item) => {\n if (this.queryKey) {\n return this._checkvalue(this.queryKey, item);\n }\n\n return (\n this._checkvalue(this.valueKey, item) ||\n this._checkvalue(this.displayKey, item)\n );\n });\n }\n\n return items?.slice(0, this.maxDisplayedItems);\n }\n\n get _displayValue() {\n if (this._isAutoCompleting) {\n return this.query;\n }\n\n return this._selectedItem?.[this.displayKey];\n }\n\n get _placeholder() {\n return this._isAutoCompleting && this.autocompletePlaceholder?.length\n ? this.autocompletePlaceholder\n : this.placeholder;\n }\n\n componentDidLoad() {\n if (this.value) {\n this._valueChange(this.value);\n return;\n }\n\n if (this.autoSelectFirst) {\n this._selectedItem = this._items?.[0];\n }\n }\n\n render() {\n return (\n <Host class=\"p-select\">\n <p-dropdown\n disableTriggerClick={true}\n calculateWidth={true}\n insideClick={true}\n show={this._showDropdown}\n >\n <p-input-group\n slot=\"trigger\"\n icon={this.icon}\n size={this.size}\n prefix={this.prefix}\n label={this.label}\n helper={this.helper}\n error={this.error}\n disabled={this.disabled}\n focused={this._showDropdown}\n >\n <input\n slot=\"input\"\n type=\"text\"\n placeholder={this._placeholder}\n value={this._displayValue}\n class={`p-input cursor-pointer ${\n !this._isAutoCompleting && 'read-only'\n }`}\n onFocus={() => this._onFocus()}\n onMouseDown={(ev) => this._onMouseDown(ev)}\n onClick={() => this._onClick()}\n onInput={(ev) => this._onChange(ev)}\n ref={(ref) => (this._inputRef = ref)}\n />\n\n {this.showChevron && (\n <p-icon variant=\"chevron\" slot=\"suffix\" />\n )}\n </p-input-group>\n <div slot=\"items\">\n {this.loading\n ? this._getLoadingItems()\n : this._getItems()}\n </div>\n </p-dropdown>\n </Host>\n );\n }\n\n @Listen('click', { target: 'document', capture: true })\n protected documentClickHandler({ target }) {\n if (!this._showDropdown || childOf(target, this._el)) {\n return;\n }\n\n this._showDropdown = false;\n this._isAutoCompleting = false;\n }\n\n @Watch('value')\n private _valueChange(value: any) {\n this._preselectItem(value);\n }\n\n @Watch('items')\n public itemChanges() {\n this._preselectItem();\n }\n\n private _preselectItem(value?: any) {\n value = value === undefined ? null : value;\n const parsedValue = !!this.value\n ? JSON.stringify(this.value)\n : JSON.stringify(value);\n\n if (\n this._selectedItem &&\n JSON.stringify(this._selectedItem[this.valueKey]) === parsedValue\n ) {\n return;\n }\n\n const item = this._items.find(\n (i) => JSON.stringify(i?.[this.valueKey]) === parsedValue\n );\n\n this._selectedItem = item;\n }\n\n private _selectValue(item) {\n this._selectedItem = item;\n const value = item[this.valueKey];\n\n this.value = value;\n this.valueChange.emit(this.value);\n\n this._onBlur(true);\n }\n\n private _onFocus() {\n if (!this.enableAutocomplete) {\n this._inputRef.blur();\n if (!this._showDropdown) {\n this._showDropdown = true;\n }\n return;\n }\n\n this._isAutoCompleting = true;\n this._showDropdown = true;\n }\n\n private _onMouseDown(ev) {\n if (this.enableAutocomplete) {\n return;\n }\n\n ev.preventDefault();\n }\n\n private _onClick() {\n if (this.enableAutocomplete) {\n return;\n }\n\n this._showDropdown = !this._showDropdown;\n }\n\n private _onBlur(force = false) {\n if (!this.enableAutocomplete && !force) {\n return;\n }\n\n this._isAutoCompleting = false;\n this._showDropdown = false;\n }\n\n private _onChange(ev) {\n if (!this._isAutoCompleting) {\n return;\n }\n\n this.query = ev.target.value;\n this.queryChange.emit(this.query);\n }\n\n private _checkvalue(key, item) {\n return (\n item?.[key]\n ?.toString()\n ?.toLowerCase()\n .indexOf(this.query?.toLowerCase()) >= 0\n );\n }\n\n private _getItems() {\n return this._items.map((item) => (\n <p-dropdown-menu-item\n onClick={() => this._selectValue(item)}\n active={\n item[this.valueKey] === this._selectedItem?.[this.valueKey]\n }\n >\n {item[this.displayKey]}\n </p-dropdown-menu-item>\n ));\n }\n\n private _getLoadingItems() {\n return [0, 0, 0].map(() => (\n <p-dropdown-menu-item enableHover={false}>\n <p-loader variant=\"ghost\" class=\"h-6 w-full rounded\" />\n </p-dropdown-menu-item>\n ));\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"p-select.js","mappings":";;;;;;;;;;;;AAAA,MAAM,kBAAkB,GAAG,0yLAA0yL;;MCoBxzL,MAAM;;;;;;;IAiIP,sBAAiB,GAAY,KAAK,CAAC;;;;;;;sBA/Fd,MAAM;oBAKR,OAAO;;2BAUC,IAAI;uBAKR,IAAI;6BAKC,EAAE;8BAKA,IAAI;uBAKX,KAAK;mBAKT,KAAK;gBAoBG,QAAQ;;;;;oBAyBE,KAAK;yBAOZ,KAAK;yBACL,IAAI;;EAM1C,IAAI,MAAM;;IACN,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE;MAC7B,OAAO,EAAE,CAAC;KACb;IAED,IAAI,KAAK,GACL,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC;IAErB,IAAI,QAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAA,KAAK,QAAQ,EAAE;MAChC,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;MACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;MAExB,KAAK,GAAG,KAAK,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C,iBAAiB,EAAE;MACzB,OAAO;KACV;IAED,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;IAC7B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;GACrC;EAEO,WAAW,CAAC,GAAG,EAAE,IAAI;;IACzB,QACI,CAAA,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,GAAG,CAAC,0CACL,QAAQ,EAAE,0CACV,WAAW,GACZ,OAAO,CAAC,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAW,EAAE,CAAC,KAAI,CAAC,EAC9C;GACL;EAEO,SAAS;IACb,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI;;MAAK,QAC7B,4BACI,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EACtC,MAAM,EACF,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAK,MAAA,IAAI,CAAC,aAAa,0CAAG,IAAI,CAAC,QAAQ,CAAC,CAAA,IAG9D,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CACH,EAC1B;KAAA,CAAC,CAAC;GACN;EAEO,gBAAgB;IACpB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OACjB,4BAAsB,WAAW,EAAE,KAAK,IACpC,gBAAU,OAAO,EAAC,OAAO,EAAC,KAAK,EAAC,oBAAoB,GAAG,CACpC,CAC1B,CAAC,CAAC;GACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/molecules/select/select.component.scss?tag=p-select","./src/components/molecules/select/select.component.tsx"],"sourcesContent":[":host {\n @apply flex flex-col;\n\n input.read-only {\n @apply text-ellipsis;\n }\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { childOf } from '../../../utils';\nimport { IconVariant } from '../../atoms/icon/icon.component';\n\n@Component({\n tag: 'p-select',\n styleUrl: 'select.component.scss',\n shadow: false,\n})\nexport class Select {\n /**\n * The items to show in the dropdown\n */\n @Prop() items: string | any[];\n\n /**\n * Icon of the select box\n */\n @Prop() icon: IconVariant;\n\n /**\n * The current query\n */\n @Prop() query: string;\n\n /**\n * The placeholder of the input\n */\n @Prop() placeholder: string;\n\n /**\n * The placeholder of the input when auto completing\n */\n @Prop() autocompletePlaceholder: string;\n\n /**\n * The current value\n */\n @Prop() value: any;\n\n /**\n * The key of the object to display\n */\n @Prop() displayKey: string = 'text';\n\n /**\n * The key of the object to return\n */\n @Prop() valueKey: string = 'value';\n\n /**\n * The key of the object to display\n */\n @Prop() queryKey?: string;\n\n /**\n * Wether to automatically select the first item\n */\n @Prop() autoSelectFirst: boolean = true;\n\n /**\n * Wether to show the chevron or not\n */\n @Prop() showChevron: boolean = true;\n\n /**\n * The maximum amount of items to display\n */\n @Prop() maxDisplayedItems: number = 10;\n\n /**\n * Wether to enable autocomplete\n */\n @Prop() enableAutocomplete: boolean = true;\n\n /**\n * Wether the input uses async filtering\n */\n @Prop() asyncFilter: boolean = false;\n\n /**\n * Wether to show loading items\n */\n @Prop() loading: boolean = false;\n\n /**\n * Event when the query of the autocomplete changes\n */\n @Event() queryChange: EventEmitter<string>;\n\n /**\n * Event when the value changes\n */\n @Event() valueChange: EventEmitter<any>;\n\n /**\n * Event when the dropdown shows\n */\n @Event() dropdownShown: EventEmitter<any>;\n\n /**\n * The size of the input group used by the select\n */\n @Prop() size: 'small' | 'medium' = 'medium';\n\n /**\n * The prefix of the input group used by the select\n */\n @Prop() prefix: string;\n\n /**\n * The label of the input group used by the select\n */\n @Prop() label: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop() helper: string;\n\n /**\n * The helper of the input group used by the select\n */\n @Prop({ reflect: true }) error: string;\n\n /**\n * Wether the input group is disabled used by the select\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The host element\n */\n @Element() private _el: HTMLElement;\n\n @State() private _showDropdown: any = false;\n @State() private _selectedItem: any = null;\n\n private _isAutoCompleting: boolean = false;\n\n private _inputRef: HTMLInputElement;\n\n get _items() {\n if (!this.items || this.loading) {\n return [];\n }\n\n let items =\n typeof this.items === 'string'\n ? JSON.parse(this.items)\n : this.items;\n\n if (typeof items?.[0] === 'string') {\n this.displayKey = 'text';\n this.valueKey = 'value';\n\n items = items.map((str) => ({\n value: str,\n text: str,\n }));\n }\n\n if (this._isAutoCompleting && this.query?.length && !this.asyncFilter) {\n items = items.filter((item) => {\n if (this.queryKey) {\n return this._checkvalue(this.queryKey, item);\n }\n\n return (\n this._checkvalue(this.valueKey, item) ||\n this._checkvalue(this.displayKey, item)\n );\n });\n }\n\n return items?.slice(0, this.maxDisplayedItems);\n }\n\n get _displayValue() {\n if (this._isAutoCompleting) {\n return this.query;\n }\n\n return this._selectedItem?.[this.displayKey];\n }\n\n get _placeholder() {\n return this._isAutoCompleting && this.autocompletePlaceholder?.length\n ? this.autocompletePlaceholder\n : this.placeholder;\n }\n\n componentDidLoad() {\n if (this.value) {\n this._valueChange(this.value);\n return;\n }\n\n if (this.autoSelectFirst) {\n this._selectedItem = this._items?.[0];\n }\n }\n\n render() {\n return (\n <Host class=\"p-select\">\n <p-dropdown\n disableTriggerClick={true}\n calculateWidth={true}\n insideClick={true}\n show={this._showDropdown}\n >\n <p-input-group\n slot=\"trigger\"\n icon={this.icon}\n size={this.size}\n prefix={this.prefix}\n label={this.label}\n helper={this.helper}\n error={this.error}\n disabled={this.disabled}\n focused={this._showDropdown}\n >\n <input\n slot=\"input\"\n type=\"text\"\n placeholder={this._placeholder}\n value={this._displayValue}\n class={`p-input cursor-pointer ${\n !this._isAutoCompleting && 'read-only'\n }`}\n onFocus={() => this._onFocus()}\n onMouseDown={(ev) => this._onMouseDown(ev)}\n onClick={() => this._onClick()}\n onInput={(ev) => this._onChange(ev)}\n ref={(ref) => (this._inputRef = ref)}\n />\n\n {this.showChevron && (\n <p-icon variant=\"chevron\" slot=\"suffix\" />\n )}\n </p-input-group>\n <div slot=\"items\">\n {this.loading\n ? this._getLoadingItems()\n : this._getItems()}\n </div>\n </p-dropdown>\n </Host>\n );\n }\n\n @Listen('click', { target: 'document', capture: true })\n protected documentClickHandler({ target }) {\n if (!this._showDropdown || childOf(target, this._el)) {\n return;\n }\n\n this._showDropdown = false;\n this._isAutoCompleting = false;\n }\n\n @Watch('value')\n private _valueChange(value: any) {\n this._preselectItem(value);\n }\n\n @Watch('items')\n public itemChanges() {\n this._preselectItem();\n }\n\n @Watch('_showDropdown')\n public _showDropdownChanges() {\n this.dropdownShown.emit({\n value: this._showDropdown,\n query: this.query,\n });\n }\n\n private _preselectItem(value?: any) {\n value = value === undefined ? null : value;\n const parsedValue = !!this.value\n ? JSON.stringify(this.value)\n : JSON.stringify(value);\n\n if (\n this._selectedItem &&\n JSON.stringify(this._selectedItem[this.valueKey]) === parsedValue\n ) {\n return;\n }\n\n const item = this._items.find(\n (i) => JSON.stringify(i?.[this.valueKey]) === parsedValue\n );\n\n this._selectedItem = item;\n }\n\n private _selectValue(item) {\n this._selectedItem = item;\n const value = item[this.valueKey];\n\n this.value = value;\n this.valueChange.emit(this.value);\n\n this._onBlur(true);\n }\n\n private _onFocus() {\n if (!this.items.length && !this.loading) {\n return;\n }\n\n if (!this.enableAutocomplete) {\n this._inputRef.blur();\n if (!this._showDropdown) {\n this._showDropdown = true;\n }\n return;\n }\n\n this._isAutoCompleting = true;\n this._showDropdown = true;\n }\n\n private _onMouseDown(ev) {\n if (this.enableAutocomplete) {\n return;\n }\n\n ev.preventDefault();\n }\n\n private _onClick() {\n if (this.enableAutocomplete) {\n return;\n }\n\n this._showDropdown = !this._showDropdown;\n }\n\n private _onBlur(force = false) {\n if (!this.enableAutocomplete && !force) {\n return;\n }\n\n this._isAutoCompleting = false;\n this._showDropdown = false;\n }\n\n private _onChange(ev) {\n if (!this._isAutoCompleting) {\n return;\n }\n\n this.query = ev.target.value;\n this.queryChange.emit(this.query);\n }\n\n private _checkvalue(key, item) {\n return (\n item?.[key]\n ?.toString()\n ?.toLowerCase()\n .indexOf(this.query?.toLowerCase()) >= 0\n );\n }\n\n private _getItems() {\n return this._items.map((item) => (\n <p-dropdown-menu-item\n onClick={() => this._selectValue(item)}\n active={\n item[this.valueKey] === this._selectedItem?.[this.valueKey]\n }\n >\n {item[this.displayKey]}\n </p-dropdown-menu-item>\n ));\n }\n\n private _getLoadingItems() {\n return [0, 0, 0].map(() => (\n <p-dropdown-menu-item enableHover={false}>\n <p-loader variant=\"ghost\" class=\"h-6 w-full rounded\" />\n </p-dropdown-menu-item>\n ));\n }\n}\n"],"version":3}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$2 } from './icon.component.js';
|
|
3
3
|
|
|
4
|
-
const stepperItemComponentCss = ".static{position:static!important}.absolute{position:absolute!important}.relative{position:relative!important}.left-1{left:.25rem!important}.order-2{order:2!important}.ml-0{margin-left:0!important}.mr-4{margin-right:1rem!important}.flex{display:flex!important}.h-4{height:1rem!important}.w-4{width:1rem!important}.min-w-0{min-width:0!important}.-translate-x-1{--tw-translate-x:-0.25rem!important}.-rotate-0,.-translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-0{--tw-rotate:-0deg!important}.-rotate-135{--tw-rotate:-135deg!important}.-rotate-135,.-rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-180{--tw-rotate:-180deg!important}.-rotate-225{--tw-rotate:-225deg!important}.-rotate-225,.-rotate-25{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-25{--tw-rotate:-25deg!important}.-rotate-270{--tw-rotate:-270deg!important}.-rotate-270,.-rotate-315{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-315{--tw-rotate:-315deg!important}.-rotate-45{--tw-rotate:-45deg!important}.-rotate-45,.-rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-90{--tw-rotate:-90deg!important}.rotate-0{--tw-rotate:0deg!important}.rotate-0,.rotate-135{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-135{--tw-rotate:135deg!important}.rotate-180{--tw-rotate:180deg!important}.rotate-180,.rotate-225{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-225{--tw-rotate:225deg!important}.rotate-25{--tw-rotate:25deg!important}.rotate-25,.rotate-270{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-270{--tw-rotate:270deg!important}.rotate-315{--tw-rotate:315deg!important}.rotate-315,.rotate-45{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-45{--tw-rotate:45deg!important}.rotate-90{--tw-rotate:90deg!important}.rotate-90,.scale-x-flip{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.scale-x-flip{--tw-scale-x:-1!important}.scale-y-flip{--tw-scale-y:-1!important}.scale-y-flip,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.items-end{align-items:flex-end!important}.items-center{align-items:center!important}.bg-mystic-dark{--tw-bg-opacity:1!important;background-color:rgb(218 230 240/var(--tw-bg-opacity))!important}.text-2xl{font-size:1.5rem!important;line-height:2rem!important}.text-3xl{font-size:1.875rem!important;line-height:2.25rem!important}.text-4xl{font-size:2.25rem!important;line-height:2.5rem!important}.text-5xl{font-size:3rem!important}.text-5xl,.text-6xl{line-height:1!important}.text-6xl{font-size:3.75rem!important}.text-base{font-size:1rem!important;line-height:1.5rem!important}.text-lg{font-size:1.125rem!important;line-height:1.75rem!important}.text-sm{font-size:.875rem!important;line-height:1.25rem!important}.text-xl{font-size:1.25rem!important;line-height:1.75rem!important}.text-xs{font-size:.75rem!important;line-height:1rem!important}.text-xxs{font-size:.6875rem!important}.
|
|
4
|
+
const stepperItemComponentCss = ".static{position:static!important}.absolute{position:absolute!important}.relative{position:relative!important}.left-1{left:.25rem!important}.order-2{order:2!important}.ml-0{margin-left:0!important}.mr-4{margin-right:1rem!important}.flex{display:flex!important}.h-4{height:1rem!important}.w-4{width:1rem!important}.min-w-0{min-width:0!important}.-translate-x-1{--tw-translate-x:-0.25rem!important}.-rotate-0,.-translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-0{--tw-rotate:-0deg!important}.-rotate-135{--tw-rotate:-135deg!important}.-rotate-135,.-rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-180{--tw-rotate:-180deg!important}.-rotate-225{--tw-rotate:-225deg!important}.-rotate-225,.-rotate-25{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-25{--tw-rotate:-25deg!important}.-rotate-270{--tw-rotate:-270deg!important}.-rotate-270,.-rotate-315{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-315{--tw-rotate:-315deg!important}.-rotate-45{--tw-rotate:-45deg!important}.-rotate-45,.-rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.-rotate-90{--tw-rotate:-90deg!important}.rotate-0{--tw-rotate:0deg!important}.rotate-0,.rotate-135{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-135{--tw-rotate:135deg!important}.rotate-180{--tw-rotate:180deg!important}.rotate-180,.rotate-225{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-225{--tw-rotate:225deg!important}.rotate-25{--tw-rotate:25deg!important}.rotate-25,.rotate-270{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-270{--tw-rotate:270deg!important}.rotate-315{--tw-rotate:315deg!important}.rotate-315,.rotate-45{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.rotate-45{--tw-rotate:45deg!important}.rotate-90{--tw-rotate:90deg!important}.rotate-90,.scale-x-flip{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.scale-x-flip{--tw-scale-x:-1!important}.scale-y-flip{--tw-scale-y:-1!important}.scale-y-flip,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.items-end{align-items:flex-end!important}.items-center{align-items:center!important}.bg-mystic-dark{--tw-bg-opacity:1!important;background-color:rgb(218 230 240/var(--tw-bg-opacity))!important}.text-2xl{font-size:1.5rem!important;line-height:2rem!important}.text-3xl{font-size:1.875rem!important;line-height:2.25rem!important}.text-4xl{font-size:2.25rem!important;line-height:2.5rem!important}.text-5xl{font-size:3rem!important}.text-5xl,.text-6xl{line-height:1!important}.text-6xl{font-size:3.75rem!important}.text-base{font-size:1rem!important;line-height:1.5rem!important}.text-lg{font-size:1.125rem!important;line-height:1.75rem!important}.text-sm{font-size:.875rem!important;line-height:1.25rem!important}.text-xl{font-size:1.25rem!important;line-height:1.75rem!important}.text-xs{font-size:.75rem!important;line-height:1rem!important}.text-xxs{font-size:.6875rem!important}.transition{transition-duration:.15s!important;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter!important;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter!important;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter!important;transition-timing-function:cubic-bezier(.4,0,.2,1)!important}.duration-500{transition-duration:.5s!important}*{box-sizing:border-box}.left-1\\/2{left:50%!important}.min-h-\\[1rem\\]{min-height:1rem!important}.-translate-x-1\\/2{--tw-translate-x:-50%!important}.-translate-x-1\\/2,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}:host{align-items:flex-end;display:flex;justify-content:center;position:relative}:host .content{--tw-text-opacity:1;color:rgb(176 178 203/var(--tw-text-opacity));font-size:.875rem;line-height:1.25rem;min-width:0;white-space:nowrap}:host .circle{--tw-bg-opacity:1;--tw-text-opacity:1;align-items:center;background-color:rgb(218 230 240/var(--tw-bg-opacity));border-radius:100%;color:rgb(255 255 255/var(--tw-text-opacity));display:flex;height:1rem;justify-content:center;transition-duration:.5s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1rem}:host .circle p-icon{display:flex!important;font-size:.625rem}:host([direction=horizontal]){height:2.5rem}:host([direction=horizontal]) .content{order:1;position:absolute;top:0}:host([direction=horizontal]) .circle{order:2}:host([direction=vertical]){align-items:center;min-height:1rem}:host([direction=vertical]) .content{margin-left:1rem;order:2}:host([direction=vertical]) .circle{order:1}:host([active]) .content,:host([finished]) .content{--tw-text-opacity:1;color:rgb(82 138 250/var(--tw-text-opacity))}:host([active]) .circle,:host([finished]) .circle{--tw-bg-opacity:1;background-color:rgb(82 138 250/var(--tw-bg-opacity))}:host([direction=horizontal][align=start]) .content{left:0}:host([direction=horizontal][align=end]) .content{right:0}:host([direction=horizontal][align=center]) .content{--tw-translate-x:-50%;left:50%;text-align:center;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}:host([direction=vertical][content-position=start]){flex-direction:row-reverse}:host([direction=vertical][content-position=start]) .content{display:flex;justify-content:flex-end;margin-left:0;margin-right:1rem}.-rotate-0,.-rotate-135,.-rotate-180,.-rotate-225,.-rotate-25,.-rotate-270,.-rotate-315,.-rotate-45,.-rotate-90,.rotate-0,.rotate-135,.rotate-180,.rotate-225,.rotate-25,.rotate-270,.rotate-315,.rotate-45,.rotate-90,.scale-x-flip,.scale-y-flip{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}.text-lg,.text-xl{line-height:1.75rem!important}.-rotate-0,.-rotate-135,.-rotate-180,.-rotate-225,.-rotate-25,.-rotate-270,.-rotate-315,.-rotate-45,.-rotate-90,.rotate-0,.rotate-135,.rotate-180,.rotate-225,.rotate-25,.rotate-270,.rotate-315,.rotate-45,.rotate-90,.scale-x-flip,.scale-y-flip,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}";
|
|
5
5
|
|
|
6
6
|
const StepperItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"p-stepper-item.js","mappings":";;;AAAA,MAAM,uBAAuB,GAAG
|
|
1
|
+
{"file":"p-stepper-item.js","mappings":";;;AAAA,MAAM,uBAAuB,GAAG,+lRAA+lR;;MCOlnR,WAAW;;;;;iBAIyC,QAAQ;qBAMjE,YAAY;2BAK4C,KAAK;oBAKpB,KAAK;kBAKP,KAAK;;EAEhD,MAAM;IACF,QACI,EAAC,IAAI,IAAC,KAAK,EAAC,gBAAgB,IACxB,WAAK,KAAK,EAAC,SAAS,IAChB,YAAM,IAAI,EAAC,SAAS,GAAG,CACrB,EACN,WAAK,KAAK,EAAC,QAAQ,IACd,IAAI,CAAC,QAAQ,IAAI,cAAQ,OAAO,EAAC,WAAW,GAAG,CAC9C,CACH,EACT;GACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/atoms/stepper-item/stepper-item.component.scss?tag=p-stepper-item&encapsulation=shadow","./src/components/atoms/stepper-item/stepper-item.component.tsx"],"sourcesContent":[":host {\n @apply relative flex items-end justify-center;\n\n .content {\n @apply min-w-0 whitespace-nowrap;\n @apply text-sm text-storm-light;\n }\n\n .circle {\n @apply transition duration-500 ease-in-out;\n @apply flex items-center justify-center;\n @apply h-4 w-4 rounded-round;\n @apply bg-mystic-dark text-white;\n\n p-icon {\n @apply flex #{!important};\n font-size: 0.625rem;\n }\n }\n}\n\n:host([direction='horizontal']) {\n @apply h-10;\n\n .content {\n @apply absolute top-0;\n @apply order-1;\n }\n\n .circle {\n @apply order-2;\n }\n}\n\n:host([direction='vertical']) {\n @apply min-h-[1rem] items-center;\n\n .content {\n @apply order-2 ml-4;\n }\n\n .circle {\n @apply order-1;\n }\n}\n\n:host([active]),\n:host([finished]) {\n .content {\n @apply text-indigo;\n }\n\n .circle {\n @apply bg-indigo;\n }\n}\n\n:host([direction='horizontal'][align='start']) {\n .content {\n @apply left-0;\n }\n}\n\n:host([direction='horizontal'][align='end']) {\n .content {\n @apply right-0;\n }\n}\n\n:host([direction='horizontal'][align='center']) {\n .content {\n @apply left-1/2 -translate-x-1/2 transform text-center;\n }\n}\n\n:host([direction='vertical'][content-position='start']) {\n @apply flex-row-reverse;\n\n .content {\n @apply ml-0 mr-4 flex justify-end;\n }\n}\n","import { Component, h, Host, Prop } from '@stencil/core';\n\n@Component({\n tag: 'p-stepper-item',\n styleUrl: 'stepper-item.component.scss',\n shadow: true,\n})\nexport class StepperItem {\n /**\n * The alignment of the step content\n */\n @Prop({ reflect: true }) align: 'start' | 'center' | 'end' = 'center';\n\n /**\n * The direction of the stepper step\n */\n @Prop({ reflect: true }) direction: 'horizontal' | 'vertical' =\n 'horizontal';\n\n /**\n * The position of the content in case of vertical direction\n */\n @Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n /**\n * Wether the step is finished\n */\n @Prop({ reflect: true }) finished: boolean = false;\n\n /**\n * Wether the step is active\n */\n @Prop({ reflect: true }) active: boolean = false;\n\n render() {\n return (\n <Host class=\"p-stepper-item\">\n <div class=\"content\">\n <slot name=\"content\" />\n </div>\n <div class=\"circle\">\n {this.finished && <p-icon variant=\"checkmark\" />}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|