@sula-tech/webcomponents 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-7973b779.js → index-87eec792.js} +126 -5
- package/dist/cjs/index-87eec792.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{sula-avatar_3.cjs.entry.js → sula-avatar_9.cjs.entry.js} +652 -7
- package/dist/cjs/sula-avatar_9.cjs.entry.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +7 -1
- package/dist/collection/components/sula-avatar/sula-avatar.css +1 -1
- package/dist/collection/components/sula-avatar/sula-avatar.stories.js +14 -17
- package/dist/collection/components/sula-avatar/sula-avatar.stories.js.map +1 -1
- package/dist/collection/components/sula-badge/model/sula-badge.model.js +23 -0
- package/dist/collection/components/sula-badge/model/sula-badge.model.js.map +1 -0
- package/dist/collection/components/sula-badge/sula-badge.css +1 -0
- package/dist/collection/components/sula-badge/sula-badge.js +230 -0
- package/dist/collection/components/sula-badge/sula-badge.js.map +1 -0
- package/dist/collection/components/sula-badge/sula-badge.stories.js +148 -0
- package/dist/collection/components/sula-badge/sula-badge.stories.js.map +1 -0
- package/dist/collection/components/sula-button/sula-button.css +1 -1
- package/dist/collection/components/sula-button/sula-button.js +1 -1
- package/dist/collection/components/sula-button/sula-button.stories.js +36 -9
- package/dist/collection/components/sula-button/sula-button.stories.js.map +1 -1
- package/dist/collection/components/sula-checkbox/model/sula-checkbox.model.js +6 -0
- package/dist/collection/components/sula-checkbox/model/sula-checkbox.model.js.map +1 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.css +1 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.js +233 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.js.map +1 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js +113 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js.map +1 -0
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-icon/sula-icon.js +1 -1
- package/dist/collection/components/sula-icon/sula-icon.stories.js +35 -14
- package/dist/collection/components/sula-icon/sula-icon.stories.js.map +1 -1
- package/dist/collection/components/sula-switch/model/sula-switch.model.js +6 -0
- package/dist/collection/components/sula-switch/model/sula-switch.model.js.map +1 -0
- package/dist/collection/components/sula-switch/sula-switch.css +1 -0
- package/dist/collection/components/sula-switch/sula-switch.js +235 -0
- package/dist/collection/components/sula-switch/sula-switch.js.map +1 -0
- package/dist/collection/components/sula-switch/sula-switch.stories.js +111 -0
- package/dist/collection/components/sula-switch/sula-switch.stories.js.map +1 -0
- package/dist/collection/components/sula-tag/model/sula-tag.model.js +28 -0
- package/dist/collection/components/sula-tag/model/sula-tag.model.js.map +1 -0
- package/dist/collection/components/sula-tag/sula-tag.css +1 -0
- package/dist/collection/components/sula-tag/sula-tag.js +249 -0
- package/dist/collection/components/sula-tag/sula-tag.js.map +1 -0
- package/dist/collection/components/sula-tag/sula-tag.stories.js +201 -0
- package/dist/collection/components/sula-tag/sula-tag.stories.js.map +1 -0
- package/dist/collection/components/sula-textarea/model/sula-textarea.model.js +6 -0
- package/dist/collection/components/sula-textarea/model/sula-textarea.model.js.map +1 -0
- package/dist/collection/components/sula-textarea/sula-textarea.css +1 -0
- package/dist/collection/components/sula-textarea/sula-textarea.js +358 -0
- package/dist/collection/components/sula-textarea/sula-textarea.js.map +1 -0
- package/dist/collection/components/sula-textarea/sula-textarea.stories.js +138 -0
- package/dist/collection/components/sula-textarea/sula-textarea.stories.js.map +1 -0
- package/dist/collection/components/sula-textfield/model/sula-textfield.model.js +11 -0
- package/dist/collection/components/sula-textfield/model/sula-textfield.model.js.map +1 -0
- package/dist/collection/components/sula-textfield/sula-textfield.css +1 -0
- package/dist/collection/components/sula-textfield/sula-textfield.js +376 -0
- package/dist/collection/components/sula-textfield/sula-textfield.js.map +1 -0
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js +148 -0
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/{p-81fcc74a.js → p-2d5f97d1.js} +4 -4
- package/dist/components/{p-81fcc74a.js.map → p-2d5f97d1.js.map} +1 -1
- package/dist/components/{p-d3ba6302.js → p-881c6b35.js} +114 -6
- package/dist/components/p-881c6b35.js.map +1 -0
- package/dist/components/sula-avatar.js +3 -3
- package/dist/components/sula-avatar.js.map +1 -1
- package/dist/components/sula-badge.d.ts +11 -0
- package/dist/components/sula-badge.js +154 -0
- package/dist/components/sula-badge.js.map +1 -0
- package/dist/components/sula-button.js +4 -4
- package/dist/components/sula-button.js.map +1 -1
- package/dist/components/sula-checkbox.d.ts +11 -0
- package/dist/components/sula-checkbox.js +109 -0
- package/dist/components/sula-checkbox.js.map +1 -0
- package/dist/components/sula-icon.js +1 -1
- package/dist/components/sula-switch.d.ts +11 -0
- package/dist/components/sula-switch.js +105 -0
- package/dist/components/sula-switch.js.map +1 -0
- package/dist/components/sula-tag.d.ts +11 -0
- package/dist/components/sula-tag.js +157 -0
- package/dist/components/sula-tag.js.map +1 -0
- package/dist/components/sula-textarea.d.ts +11 -0
- package/dist/components/sula-textarea.js +166 -0
- package/dist/components/sula-textarea.js.map +1 -0
- package/dist/components/sula-textfield.d.ts +11 -0
- package/dist/components/sula-textfield.js +171 -0
- package/dist/components/sula-textfield.js.map +1 -0
- package/dist/esm/{index-9bf8f892.js → index-aa1c5f36.js} +126 -6
- package/dist/esm/index-aa1c5f36.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{sula-avatar_3.entry.js → sula-avatar_9.entry.js} +647 -8
- package/dist/esm/sula-avatar_9.entry.js.map +1 -0
- package/dist/esm/webcomponents.js +3 -3
- package/dist/types/components/sula-avatar/sula-avatar.stories.d.ts +0 -1
- package/dist/types/components/sula-badge/model/sula-badge.model.d.ts +19 -0
- package/dist/types/components/sula-badge/sula-badge.d.ts +33 -0
- package/dist/types/components/sula-badge/sula-badge.stories.d.ts +65 -0
- package/dist/types/components/sula-button/sula-button.stories.d.ts +2 -0
- package/dist/types/components/sula-checkbox/model/sula-checkbox.model.d.ts +4 -0
- package/dist/types/components/sula-checkbox/sula-checkbox.d.ts +42 -0
- package/dist/types/components/sula-checkbox/sula-checkbox.stories.d.ts +73 -0
- package/dist/types/components/sula-icon/sula-icon.stories.d.ts +5 -2
- package/dist/types/components/sula-switch/model/sula-switch.model.d.ts +4 -0
- package/dist/types/components/sula-switch/sula-switch.d.ts +41 -0
- package/dist/types/components/sula-switch/sula-switch.stories.d.ts +72 -0
- package/dist/types/components/sula-tag/model/sula-tag.model.d.ts +23 -0
- package/dist/types/components/sula-tag/sula-tag.d.ts +33 -0
- package/dist/types/components/sula-tag/sula-tag.stories.d.ts +82 -0
- package/dist/types/components/sula-textarea/model/sula-textarea.model.d.ts +4 -0
- package/dist/types/components/sula-textarea/sula-textarea.d.ts +65 -0
- package/dist/types/components/sula-textarea/sula-textarea.stories.d.ts +98 -0
- package/dist/types/components/sula-textfield/model/sula-textfield.model.d.ts +8 -0
- package/dist/types/components/sula-textfield/sula-textfield.d.ts +74 -0
- package/dist/types/components/sula-textfield/sula-textfield.stories.d.ts +108 -0
- package/dist/types/components.d.ts +510 -0
- package/dist/webcomponents/{p-82d7a024.entry.js → p-1c8457aa.entry.js} +917 -64
- package/dist/webcomponents/p-1c8457aa.entry.js.map +1 -0
- package/dist/webcomponents/{p-cca32e44.js → p-5a36af0f.js} +343 -220
- package/dist/webcomponents/p-5a36af0f.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +68 -13
- package/dist/webcomponents/webcomponents.esm.js.map +1 -1
- package/package.json +21 -13
- package/readme.md +36 -18
- package/dist/cjs/index-7973b779.js.map +0 -1
- package/dist/cjs/sula-avatar_3.cjs.entry.js.map +0 -1
- package/dist/components/p-d3ba6302.js.map +0 -1
- package/dist/esm/index-9bf8f892.js.map +0 -1
- package/dist/esm/sula-avatar_3.entry.js.map +0 -1
- package/dist/webcomponents/p-82d7a024.entry.js.map +0 -1
- package/dist/webcomponents/p-cca32e44.js.map +0 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, d as createEvent, h, c as Host } from './p-881c6b35.js';
|
|
2
|
+
|
|
3
|
+
var SulaSwitchType;
|
|
4
|
+
(function (SulaSwitchType) {
|
|
5
|
+
SulaSwitchType["Default"] = "default";
|
|
6
|
+
SulaSwitchType["List"] = "list";
|
|
7
|
+
})(SulaSwitchType || (SulaSwitchType = {}));
|
|
8
|
+
|
|
9
|
+
const sulaSwitchCss = "*,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.relative{position:relative}.block{display:block}.hidden{display:none}.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))}.outline{outline-style:solid}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter}.ease-in-out,.transition{transition-timing-function:cubic-bezier(.4,0,.2,1)}:host{display:block}.container-focus,.switch-focus{outline:2px solid var(--color-feedback-informational)!important;outline-offset:2px!important}.switch-container{cursor:pointer;overflow:hidden;position:relative;transition:background-color .3s ease-in-out}.switch-thumb{position:relative;transition:transform .3s ease-in-out}.switch-on .switch-thumb{animation:slideFromLeft .3s ease-in-out forwards}.switch-off .switch-thumb{animation:slideFromRight .3s ease-in-out forwards}.switch-indicator{transition:width .3s ease-in-out,height .3s ease-in-out,background-color .3s ease-in-out}.switch-indicator-on{animation:growIndicator .3s ease-in-out forwards}.switch-indicator-off{animation:shrinkIndicator .3s ease-in-out forwards}@keyframes slideFromLeft{0%{opacity:0;transform:translateX(-100%)}50%{opacity:.7}to{opacity:1;transform:translateX(0)}}@keyframes slideFromRight{0%{opacity:0;transform:translateX(100%)}50%{opacity:.7}to{opacity:1;transform:translateX(0)}}@keyframes growIndicator{0%{height:4px;opacity:.5;width:10px}to{height:12px;opacity:1;width:12px}}@keyframes shrinkIndicator{0%{height:12px;opacity:.5;width:12px}to{height:4px;opacity:1;width:10px}}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#02361a;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#500202;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#683f08;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#691e07;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#6a3b01;--color-gray-50:#fff;--color-gray-100:#f4f4f4;--color-gray-200:#e6e6e6;--color-gray-300:#c3c3c3;--color-gray-400:#b9b9b9;--color-gray-500:#949494;--color-gray-600:#737373;--color-gray-700:#5c5c5c;--color-gray-800:#323232;--color-gray-900:#292929;--color-gray-950:#141414;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#0a2e61;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:#14141405;--color-black-opacity-100:#1414141a;--color-black-opacity-200:#14141426;--color-black-opacity-300:#14141445;--color-black-opacity-400:#1414145c;--color-black-opacity-500:#14141480;--color-black-opacity-600:#1414148c;--color-black-opacity-700:#141414a3;--color-black-opacity-800:#141414ba;--color-black-opacity-900:#141414cc;--color-black-opacity-950:#141414e8;--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f4f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#323232;--color-text-secondary:#5c5c5c;--color-text-disabled:#949494;--color-text-link:#1355b4;--color-states-empty-bg-hover:#1414141a;--color-states-empty-bg-pressed:#14141426;--color-states-bg-disabled:#14141405;--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e6e6e6;--color-states-negative-pressed:#c3c3c3;--color-icon-primary:#5c5c5c;--color-icon-secondary:#fff;--color-icon-disabled:#b9b9b9;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f4f4f4;--color-neutral-neutral-3:#b9b9b9;--color-neutral-neutral-4:#949494;--color-neutral-neutral-5:#737373;--color-neutral-neutral-6:#5c5c5c;--color-neutral-neutral-7:#323232;--color-neutral-neutral-8:#292929;--color-negative-negative-1:#fff;--color-negative-negative-2:#323232;--color-opacity-body:#fffc;--color-opacity-on-body:#14141405;--color-opacity-overlay:#1414148c;--color-opacity-on-overlay:#ffffff1a;--color-line-input:#949494;--color-line-general-strong:#c3c3c3;--color-line-general:#e6e6e6}.static{position:static}.mr-16{margin-right:1rem}.flex{display:flex}.h-12{height:.75rem}.h-32{height:2rem}.h-4{height:.25rem}.h-\\[28px\\]{height:28px}.min-h-\\[85px\\]{min-height:85px}.w-12{width:.75rem}.w-56{width:3.5rem}.w-\\[10px\\]{width:10px}.w-\\[280px\\]{width:280px}.w-\\[28px\\]{width:28px}.flex-1{flex:1 1 0%}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.space-x-12>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.75rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.75rem*var(--tw-space-x-reverse))}.overflow-hidden{overflow:hidden}.break-words{overflow-wrap:break-word}.rounded-full{border-radius:9999px}.rounded-md{border-radius:1.25rem}.rounded-xxl{border-radius:18.75rem}.bg-brand-primary{background-color:var(--color-brand-primary)}.bg-negative-negative-1{background-color:var(--color-negative-negative-1)}.bg-neutral-neutral-3{background-color:var(--color-neutral-neutral-3)}.bg-neutral-neutral-4{background-color:var(--color-neutral-neutral-4)}.bg-states-bg-disabled{background-color:var(--color-states-bg-disabled)}.bg-surface-on-body{background-color:var(--color-surface-on-body)}.p-2{padding:.125rem}.px-24{padding-left:1.5rem;padding-right:1.5rem}.py-16{padding-bottom:1rem;padding-top:1rem}.text-base{font-size:1rem;line-height:1.5rem}.font-bold{font-weight:700}.text-text-primary{color:var(--color-text-primary)}.text-text-secondary{color:var(--color-text-secondary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.hover\\:bg-states-empty-bg-hover:hover{background-color:var(--color-states-empty-bg-hover)}.active\\:bg-states-empty-bg-pressed:active{background-color:var(--color-states-empty-bg-pressed)}";
|
|
10
|
+
const SulaSwitchStyle0 = sulaSwitchCss;
|
|
11
|
+
|
|
12
|
+
const SulaSwitch$1 = /*@__PURE__*/ proxyCustomElement(class SulaSwitch extends H {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.__registerHost();
|
|
16
|
+
this.__attachShadow();
|
|
17
|
+
this.valueChanged = createEvent(this, "valueChanged", 7);
|
|
18
|
+
this.focusedOn = createEvent(this, "focusedOn", 7);
|
|
19
|
+
this.focusedOut = createEvent(this, "focusedOut", 7);
|
|
20
|
+
/**
|
|
21
|
+
* Switch type
|
|
22
|
+
*/
|
|
23
|
+
this.type = SulaSwitchType.Default;
|
|
24
|
+
/**
|
|
25
|
+
* Is switch active
|
|
26
|
+
*/
|
|
27
|
+
this.active = false;
|
|
28
|
+
/**
|
|
29
|
+
* Is switch disabled
|
|
30
|
+
*/
|
|
31
|
+
this.disabled = false;
|
|
32
|
+
this.isFocus = false;
|
|
33
|
+
this.handleClick = () => {
|
|
34
|
+
if (!this.disabled) {
|
|
35
|
+
this.active = !this.active;
|
|
36
|
+
this.valueChanged.emit(this.active);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
this.handleFocus = () => {
|
|
40
|
+
if (!this.disabled) {
|
|
41
|
+
this.isFocus = true;
|
|
42
|
+
this.focusedOn.emit();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
this.handleBlur = () => {
|
|
46
|
+
if (!this.disabled) {
|
|
47
|
+
this.focusedOut.emit();
|
|
48
|
+
this.isFocus = false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
return (h(Host, { key: '5fba5bf4066f179cd147357f6a80d7c1513723e9' }, h("div", { key: '359784f411172191cd1454095d287e5c6df4a725', class: {
|
|
54
|
+
'outline-none': true,
|
|
55
|
+
'flex items-center space-x-12': !!this.label && this.type === SulaSwitchType.Default,
|
|
56
|
+
'flex items-center justify-between bg-surface-on-body rounded-md w-[280px] min-h-[85px] px-24 py-16': this.type === SulaSwitchType.List,
|
|
57
|
+
'hover:bg-states-empty-bg-hover active:bg-states-empty-bg-pressed cursor-pointer': this.type === SulaSwitchType.List && !this.disabled,
|
|
58
|
+
'container-focus': this.isFocus && this.type === SulaSwitchType.List,
|
|
59
|
+
}, onFocus: this.handleFocus, onBlur: this.handleBlur, onClick: this.handleClick, tabIndex: 0 }, this.type === SulaSwitchType.List && (h("div", { key: '7d9a24510c3a53f36770d3e082b426a3b146bf2b', class: "flex flex-col flex-1 mr-16 overflow-hidden" }, !!this.label && h("label", { key: 'f07f3ac2185d7fd2620dd4b81cdb84308432a5f0', class: "text-text-primary font-bold text-base cursor-pointer break-words" }, this.label), !!this.subTitle && h("span", { key: '06e91e4e9d30ffd8d5f401d0a3cc38d5ade9e86a', class: "text-text-secondary text-base break-words" }, this.subTitle))), h("div", { key: '540ec3811c7a16d4ff7d6aa00b22b4cd81efb3ce', class: {
|
|
60
|
+
'switch-container w-56 h-32 flex items-center rounded-xxl p-2 outline-none': true,
|
|
61
|
+
'switch-on bg-brand-primary justify-end': this.active,
|
|
62
|
+
'switch-off bg-neutral-neutral-3 justify-start': !this.active,
|
|
63
|
+
'cursor-not-allowed bg-states-bg-disabled': this.disabled,
|
|
64
|
+
'switch-focus': this.isFocus && this.type === SulaSwitchType.Default,
|
|
65
|
+
}, tabIndex: 0, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("div", { key: '72643cf70fed83ce49b2528db7d4b516d1b1cb38', class: {
|
|
66
|
+
'switch-thumb w-[28px] h-[28px] rounded-full flex justify-center items-center': true,
|
|
67
|
+
'bg-negative-negative-1': !this.disabled,
|
|
68
|
+
'bg-states-bg-disabled shadow-md': this.disabled,
|
|
69
|
+
} }, h("div", { key: 'c891324c8cdb8532f7ed7224c7d9419f2e2f3dc1', class: {
|
|
70
|
+
'switch-indicator rounded-full': true,
|
|
71
|
+
'switch-indicator-on w-12 h-12 bg-brand-primary': this.active,
|
|
72
|
+
'switch-indicator-off w-[10px] h-4 bg-neutral-neutral-4': !this.active,
|
|
73
|
+
'shadow-sm bg-states-bg-disabled': this.disabled,
|
|
74
|
+
} }))))));
|
|
75
|
+
}
|
|
76
|
+
static get style() { return SulaSwitchStyle0; }
|
|
77
|
+
}, [1, "sula-switch", {
|
|
78
|
+
"type": [1025],
|
|
79
|
+
"active": [1028],
|
|
80
|
+
"disabled": [1028],
|
|
81
|
+
"label": [1025],
|
|
82
|
+
"subTitle": [1025, "sub-title"],
|
|
83
|
+
"isFocus": [32]
|
|
84
|
+
}]);
|
|
85
|
+
function defineCustomElement$1() {
|
|
86
|
+
if (typeof customElements === "undefined") {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const components = ["sula-switch"];
|
|
90
|
+
components.forEach(tagName => { switch (tagName) {
|
|
91
|
+
case "sula-switch":
|
|
92
|
+
if (!customElements.get(tagName)) {
|
|
93
|
+
customElements.define(tagName, SulaSwitch$1);
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
} });
|
|
97
|
+
}
|
|
98
|
+
defineCustomElement$1();
|
|
99
|
+
|
|
100
|
+
const SulaSwitch = SulaSwitch$1;
|
|
101
|
+
const defineCustomElement = defineCustomElement$1;
|
|
102
|
+
|
|
103
|
+
export { SulaSwitch, defineCustomElement };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=sula-switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"sula-switch.js","mappings":";;AAAA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,KAAd,cAAc;;ACA1B,MAAM,aAAa,GAAG,wrYAAwrY,CAAC;AAC/sY,yBAAe,aAAa;;MCOfA,YAAU;IALvB;;;;;;;;;;QAS2B,SAAI,GAAmB,cAAc,CAAC,OAAO,CAAC;;;;QAK9C,WAAM,GAAY,KAAK,CAAC;;;;QAKxB,aAAQ,GAAY,KAAK,CAAC;QA+BnD,YAAO,GAAY,KAAK,CAAC;QAEzB,gBAAW,GAAG;YACZ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACrC;SACF,CAAC;QAEF,gBAAW,GAAG;YACZ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;gBACpB,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;aACvB;SACF,CAAC;QAEF,eAAU,GAAG;YACX,IAAI,CAAC,IAAI,CAAC,QAAQ,EA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AAc,CAAC,OAAO;aACrE,EACD,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,MAAM,EAAE,IAAI,CAAC,UAAU,IAEvB,4DACE,KAAK,EAAE;gBACL,8EAA8E,EAAE,IAAI;gBACpF,wBAAwB,EAAE,CAAC,IAAI,CAAC,QAAQ;gBACxC,iCAAiC,EAAE,IAAI,CAAC,QAAQ;aACjD,IAED,4DACE,KAAK,EAAE;gBACL,+BAA+B,EAAE,IAAI;gBACrC,gDAAgD,EAAE,IAAI,CAAC,MAAM;gBAC7D,wDAAwD,EAAE,CAAC,IAAI,CAAC,MAAM;gBACtE,iCAAiC,EAAE,IAAI,CAAC,QAAQ;aACjD,GACI,CACH,CACF,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SulaSwitch"],"sources":["src/components/sula-switch/model/sula-switch.model.ts","src/components/sula-switch/sula-switch.scss?tag=sula-switch&encapsulation=shadow","src/components/sula-switch/sula-switch.tsx"],"sourcesContent":["export enum SulaSwitchType {\n Default = 'default',\n List = 'list',\n}\n",":host {\n display: block;\n}\n\n.switch-focus {\n outline: 2px solid var(--color-feedback-informational) !important;\n outline-offset: 2px !important;\n}\n\n.container-focus {\n outline: 2px solid var(--color-feedback-informational) !important;\n outline-offset: 2px !important;\n}\n\n.switch-container {\n position: relative;\n transition: background-color 0.3s ease-in-out;\n cursor: pointer;\n overflow: hidden;\n}\n\n.switch-thumb {\n position: relative;\n transition: transform 0.3s ease-in-out;\n}\n\n.switch-on .switch-thumb {\n animation: slideFromLeft 0.3s ease-in-out forwards;\n}\n\n.switch-off .switch-thumb {\n animation: slideFromRight 0.3s ease-in-out forwards;\n}\n\n.switch-indicator {\n transition: width 0.3s ease-in-out, height 0.3s ease-in-out, background-color 0.3s ease-in-out;\n}\n\n.switch-indicator-on {\n animation: growIndicator 0.3s ease-in-out forwards;\n}\n\n.switch-indicator-off {\n animation: shrinkIndicator 0.3s ease-in-out forwards;\n}\n\n@keyframes slideFromLeft {\n 0% {\n transform: translateX(-100%);\n opacity: 0;\n }\n 50% {\n opacity: 0.7;\n }\n 100% {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@keyframes slideFromRight {\n 0% {\n transform: translateX(100%);\n opacity: 0;\n }\n 50% {\n opacity: 0.7;\n }\n 100% {\n transform: translateX(0);\n opacity: 1;\n }\n}\n\n@keyframes growIndicator {\n 0% {\n width: 10px;\n height: 4px;\n opacity: 0.5;\n }\n 100% {\n width: 12px;\n height: 12px;\n opacity: 1;\n }\n}\n\n@keyframes shrinkIndicator {\n 0% {\n width: 12px;\n height: 12px;\n opacity: 0.5;\n }\n 100% {\n width: 10px;\n height: 4px;\n opacity: 1;\n }\n}\n","import { Component, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core';\nimport { SulaSwitchType } from './model/sula-switch.model';\n\n@Component({\n tag: 'sula-switch',\n styleUrl: 'sula-switch.scss',\n shadow: true,\n})\nexport class SulaSwitch {\n /**\n * Switch type\n */\n @Prop({ mutable: true }) type: SulaSwitchType = SulaSwitchType.Default;\n\n /**\n * Is switch active\n */\n @Prop({ mutable: true }) active: boolean = false;\n\n /**\n * Is switch disabled\n */\n @Prop({ mutable: true }) disabled: boolean = false;\n\n /**\n * Switch label\n */\n @Prop({ mutable: true }) label?: string;\n\n /**\n * Switch sub title (avaible when is `list` type)\n */\n @Prop({ mutable: true }) subTitle?: string;\n\n /**\n * Event emitted when switch value changes.\n */\n @Event()\n valueChanged: EventEmitter<boolean>;\n\n /**\n * Event emitted when switch is focused.\n */\n @Event()\n focusedOn: EventEmitter<void>;\n\n /**\n * Event emitted when switch is focused out.\n */\n @Event()\n focusedOut: EventEmitter<void>;\n\n @State()\n isFocus: boolean = false;\n\n handleClick = () => {\n if (!this.disabled) {\n this.active = !this.active;\n this.valueChanged.emit(this.active);\n }\n };\n\n handleFocus = () => {\n if (!this.disabled) {\n this.isFocus = true;\n this.focusedOn.emit();\n }\n };\n\n handleBlur = () => {\n if (!this.disabled) {\n this.focusedOut.emit();\n this.isFocus = false;\n }\n };\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'outline-none': true,\n 'flex items-center space-x-12': !!this.label && this.type === SulaSwitchType.Default,\n 'flex items-center justify-between bg-surface-on-body rounded-md w-[280px] min-h-[85px] px-24 py-16': this.type === SulaSwitchType.List,\n 'hover:bg-states-empty-bg-hover active:bg-states-empty-bg-pressed cursor-pointer': this.type === SulaSwitchType.List && !this.disabled,\n 'container-focus': this.isFocus && this.type === SulaSwitchType.List,\n }}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n onClick={this.handleClick}\n tabIndex={0}\n >\n {this.type === SulaSwitchType.List && (\n <div class=\"flex flex-col flex-1 mr-16 overflow-hidden\">\n {!!this.label && <label class=\"text-text-primary font-bold text-base cursor-pointer break-words\">{this.label}</label>}\n {!!this.subTitle && <span class=\"text-text-secondary text-base break-words\">{this.subTitle}</span>}\n </div>\n )}\n <div\n class={{\n 'switch-container w-56 h-32 flex items-center rounded-xxl p-2 outline-none': true,\n 'switch-on bg-brand-primary justify-end': this.active,\n 'switch-off bg-neutral-neutral-3 justify-start': !this.active,\n 'cursor-not-allowed bg-states-bg-disabled': this.disabled,\n 'switch-focus': this.isFocus && this.type === SulaSwitchType.Default,\n }}\n tabIndex={0}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n >\n <div\n class={{\n 'switch-thumb w-[28px] h-[28px] rounded-full flex justify-center items-center': true,\n 'bg-negative-negative-1': !this.disabled,\n 'bg-states-bg-disabled shadow-md': this.disabled,\n }}\n >\n <div\n class={{\n 'switch-indicator rounded-full': true,\n 'switch-indicator-on w-12 h-12 bg-brand-primary': this.active,\n 'switch-indicator-off w-[10px] h-4 bg-neutral-neutral-4': !this.active,\n 'shadow-sm bg-states-bg-disabled': this.disabled,\n }}\n ></div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SulaTag extends Components.SulaTag, HTMLElement {}
|
|
4
|
+
export const SulaTag: {
|
|
5
|
+
prototype: SulaTag;
|
|
6
|
+
new (): SulaTag;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, h, c as Host } from './p-881c6b35.js';
|
|
2
|
+
import { d as defineCustomElement$2 } from './p-2d5f97d1.js';
|
|
3
|
+
|
|
4
|
+
var SulaTagSize;
|
|
5
|
+
(function (SulaTagSize) {
|
|
6
|
+
SulaTagSize["Small"] = "small";
|
|
7
|
+
SulaTagSize["Default"] = "default";
|
|
8
|
+
})(SulaTagSize || (SulaTagSize = {}));
|
|
9
|
+
var SulaTagIconStatus;
|
|
10
|
+
(function (SulaTagIconStatus) {
|
|
11
|
+
SulaTagIconStatus["Success"] = "success";
|
|
12
|
+
SulaTagIconStatus["Warning"] = "warning";
|
|
13
|
+
SulaTagIconStatus["Error"] = "error";
|
|
14
|
+
SulaTagIconStatus["Info"] = "info";
|
|
15
|
+
})(SulaTagIconStatus || (SulaTagIconStatus = {}));
|
|
16
|
+
var SulaTagAppearance;
|
|
17
|
+
(function (SulaTagAppearance) {
|
|
18
|
+
SulaTagAppearance["Brand"] = "brand";
|
|
19
|
+
SulaTagAppearance["Bordered"] = "bordered";
|
|
20
|
+
SulaTagAppearance["LightBlue"] = "light-blue";
|
|
21
|
+
SulaTagAppearance["LightBrand"] = "light-brand";
|
|
22
|
+
SulaTagAppearance["Negative"] = "negative";
|
|
23
|
+
SulaTagAppearance["OpacityGrey"] = "opacity-grey";
|
|
24
|
+
SulaTagAppearance["OpacityWhite"] = "opacity-white";
|
|
25
|
+
})(SulaTagAppearance || (SulaTagAppearance = {}));
|
|
26
|
+
var SulaTagFontWeight;
|
|
27
|
+
(function (SulaTagFontWeight) {
|
|
28
|
+
SulaTagFontWeight["Normal"] = "normal";
|
|
29
|
+
SulaTagFontWeight["Bold"] = "bold";
|
|
30
|
+
})(SulaTagFontWeight || (SulaTagFontWeight = {}));
|
|
31
|
+
|
|
32
|
+
const sulaTagCss = "*,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}:host{display:block}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#02361a;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#500202;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#683f08;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#691e07;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#6a3b01;--color-gray-50:#fff;--color-gray-100:#f4f4f4;--color-gray-200:#e6e6e6;--color-gray-300:#c3c3c3;--color-gray-400:#b9b9b9;--color-gray-500:#949494;--color-gray-600:#737373;--color-gray-700:#5c5c5c;--color-gray-800:#323232;--color-gray-900:#292929;--color-gray-950:#141414;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#0a2e61;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:#14141405;--color-black-opacity-100:#1414141a;--color-black-opacity-200:#14141426;--color-black-opacity-300:#14141445;--color-black-opacity-400:#1414145c;--color-black-opacity-500:#14141480;--color-black-opacity-600:#1414148c;--color-black-opacity-700:#141414a3;--color-black-opacity-800:#141414ba;--color-black-opacity-900:#141414cc;--color-black-opacity-950:#141414e8;--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f4f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#323232;--color-text-secondary:#5c5c5c;--color-text-disabled:#949494;--color-text-link:#1355b4;--color-states-empty-bg-hover:#1414141a;--color-states-empty-bg-pressed:#14141426;--color-states-bg-disabled:#14141405;--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e6e6e6;--color-states-negative-pressed:#c3c3c3;--color-icon-primary:#5c5c5c;--color-icon-secondary:#fff;--color-icon-disabled:#b9b9b9;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f4f4f4;--color-neutral-neutral-3:#b9b9b9;--color-neutral-neutral-4:#949494;--color-neutral-neutral-5:#737373;--color-neutral-neutral-6:#5c5c5c;--color-neutral-neutral-7:#323232;--color-neutral-neutral-8:#292929;--color-negative-negative-1:#fff;--color-negative-negative-2:#323232;--color-opacity-body:#fffc;--color-opacity-on-body:#14141405;--color-opacity-overlay:#1414148c;--color-opacity-on-overlay:#ffffff1a;--color-line-input:#949494;--color-line-general-strong:#c3c3c3;--color-line-general:#e6e6e6}.static{position:static}.mr-8{margin-right:.5rem}.flex{display:flex}.w-fit{width:fit-content}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-full{border-radius:9999px}.rounded-xxl{border-radius:18.75rem}.border{border-width:1px}.border-line-general{border-color:var(--color-line-general)}.bg-brand-primary{background-color:var(--color-brand-primary)}.bg-feedback-alert{background-color:var(--color-feedback-alert)}.bg-feedback-error{background-color:var(--color-feedback-error)}.bg-feedback-informational{background-color:var(--color-feedback-informational)}.bg-feedback-success{background-color:var(--color-feedback-success)}.bg-negative-negative-1{background-color:var(--color-negative-negative-1)}.bg-opacity-body{background-color:var(--color-opacity-body)}.bg-opacity-on-body{background-color:var(--color-opacity-on-body)}.bg-surface-on-body-blue{background-color:var(--color-surface-on-body-blue)}.bg-surface-on-body-brand{background-color:var(--color-surface-on-body-brand)}.bg-transparent{background-color:transparent}.px-12{padding-left:.75rem;padding-right:.75rem}.px-2{padding-left:.125rem;padding-right:.125rem}.px-8{padding-left:.5rem;padding-right:.5rem}.py-1{padding-bottom:.0625rem;padding-top:.0625rem}.py-4{padding-bottom:.25rem;padding-top:.25rem}.py-8{padding-bottom:.5rem;padding-top:.5rem}.text-base{font-size:1rem;line-height:1.5rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.leading-4{line-height:1rem}.text-negative-negative-1{color:var(--color-negative-negative-1)}.text-negative-negative-2{color:var(--color-negative-negative-2)}.text-text-primary{color:var(--color-text-primary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}";
|
|
33
|
+
const SulaTagStyle0 = sulaTagCss;
|
|
34
|
+
|
|
35
|
+
const SulaTag$1 = /*@__PURE__*/ proxyCustomElement(class SulaTag extends H {
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
this.__registerHost();
|
|
39
|
+
this.__attachShadow();
|
|
40
|
+
/**
|
|
41
|
+
* Tag label
|
|
42
|
+
*/
|
|
43
|
+
this.label = '';
|
|
44
|
+
/**
|
|
45
|
+
* Tag icon
|
|
46
|
+
*/
|
|
47
|
+
this.icon = '';
|
|
48
|
+
/**
|
|
49
|
+
* Tag icon status
|
|
50
|
+
*/
|
|
51
|
+
this.iconStatus = SulaTagIconStatus.Success;
|
|
52
|
+
/**
|
|
53
|
+
* Tag size
|
|
54
|
+
*/
|
|
55
|
+
this.size = SulaTagSize.Default;
|
|
56
|
+
/**
|
|
57
|
+
* Tag appearance
|
|
58
|
+
*/
|
|
59
|
+
this.appearance = SulaTagAppearance.Bordered;
|
|
60
|
+
/**
|
|
61
|
+
* Tag font weight
|
|
62
|
+
*/
|
|
63
|
+
this.fontWeight = SulaTagFontWeight.Normal;
|
|
64
|
+
}
|
|
65
|
+
getSizeClass() {
|
|
66
|
+
const sizeStyles = {
|
|
67
|
+
[SulaTagSize.Small]: 'px-8 py-4',
|
|
68
|
+
[SulaTagSize.Default]: 'px-12 py-8',
|
|
69
|
+
};
|
|
70
|
+
return sizeStyles[this.size];
|
|
71
|
+
}
|
|
72
|
+
getAppearanceClass() {
|
|
73
|
+
const appearanceStyles = {
|
|
74
|
+
[SulaTagAppearance.Brand]: 'bg-brand-primary',
|
|
75
|
+
[SulaTagAppearance.Bordered]: 'border-line-general border bg-transparent',
|
|
76
|
+
[SulaTagAppearance.LightBlue]: 'bg-surface-on-body-blue',
|
|
77
|
+
[SulaTagAppearance.LightBrand]: 'bg-surface-on-body-brand',
|
|
78
|
+
[SulaTagAppearance.Negative]: 'bg-negative-negative-1',
|
|
79
|
+
[SulaTagAppearance.OpacityGrey]: 'bg-opacity-on-body',
|
|
80
|
+
[SulaTagAppearance.OpacityWhite]: 'bg-opacity-body',
|
|
81
|
+
};
|
|
82
|
+
return appearanceStyles[this.appearance];
|
|
83
|
+
}
|
|
84
|
+
getTextColorClass() {
|
|
85
|
+
if (this.appearance === SulaTagAppearance.Brand) {
|
|
86
|
+
return 'text-negative-negative-1';
|
|
87
|
+
}
|
|
88
|
+
else if (this.appearance === SulaTagAppearance.Negative) {
|
|
89
|
+
return 'text-negative-negative-2';
|
|
90
|
+
}
|
|
91
|
+
return 'text-text-primary';
|
|
92
|
+
}
|
|
93
|
+
getTextWeightClass() {
|
|
94
|
+
const fontWeightStyles = {
|
|
95
|
+
[SulaTagFontWeight.Bold]: 'font-bold',
|
|
96
|
+
[SulaTagFontWeight.Normal]: 'font-normal',
|
|
97
|
+
};
|
|
98
|
+
return fontWeightStyles[this.fontWeight];
|
|
99
|
+
}
|
|
100
|
+
getIconStatusClass() {
|
|
101
|
+
const iconStatusStyles = {
|
|
102
|
+
[SulaTagIconStatus.Success]: 'bg-feedback-success',
|
|
103
|
+
[SulaTagIconStatus.Warning]: 'bg-feedback-alert',
|
|
104
|
+
[SulaTagIconStatus.Error]: 'bg-feedback-error',
|
|
105
|
+
[SulaTagIconStatus.Info]: 'bg-feedback-informational',
|
|
106
|
+
};
|
|
107
|
+
return iconStatusStyles[this.iconStatus];
|
|
108
|
+
}
|
|
109
|
+
render() {
|
|
110
|
+
return (h(Host, { key: '7e0e4b7d7154a39e20c2b57945167efc690e4796' }, h("div", { key: 'f06f2ec0369383b87f4d03e3c1d07cdf7f244b2d', class: {
|
|
111
|
+
'flex items-center rounded-xxl w-fit': true,
|
|
112
|
+
[this.getSizeClass()]: true,
|
|
113
|
+
[this.getAppearanceClass()]: true,
|
|
114
|
+
} }, this.icon && (h("div", { key: '3735de1b6f93802d3a56e28b7c4d262d565c863f', class: {
|
|
115
|
+
'flex justify-center items-center mr-8 rounded-full leading-4 px-2 py-1': true,
|
|
116
|
+
[this.getIconStatusClass()]: true,
|
|
117
|
+
} }, h("sula-icon", { key: 'f059688dab53e5ccfbab562ab9546c7bb4551857', icon: this.icon, "custom-class": "text-base text-negative-negative-1 leading-4" }))), h("span", { key: 'f9bfbac5f1260d327504b9b4eab3c524320d03b0', class: {
|
|
118
|
+
'text-base leading-4': true,
|
|
119
|
+
[this.getTextColorClass()]: true,
|
|
120
|
+
[this.getTextWeightClass()]: true,
|
|
121
|
+
} }, this.label))));
|
|
122
|
+
}
|
|
123
|
+
static get style() { return SulaTagStyle0; }
|
|
124
|
+
}, [1, "sula-tag", {
|
|
125
|
+
"label": [1025],
|
|
126
|
+
"icon": [1025],
|
|
127
|
+
"iconStatus": [1025, "icon-status"],
|
|
128
|
+
"size": [1025],
|
|
129
|
+
"appearance": [1025],
|
|
130
|
+
"fontWeight": [1025, "font-weight"]
|
|
131
|
+
}]);
|
|
132
|
+
function defineCustomElement$1() {
|
|
133
|
+
if (typeof customElements === "undefined") {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const components = ["sula-tag", "sula-icon"];
|
|
137
|
+
components.forEach(tagName => { switch (tagName) {
|
|
138
|
+
case "sula-tag":
|
|
139
|
+
if (!customElements.get(tagName)) {
|
|
140
|
+
customElements.define(tagName, SulaTag$1);
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
case "sula-icon":
|
|
144
|
+
if (!customElements.get(tagName)) {
|
|
145
|
+
defineCustomElement$2();
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
} });
|
|
149
|
+
}
|
|
150
|
+
defineCustomElement$1();
|
|
151
|
+
|
|
152
|
+
const SulaTag = SulaTag$1;
|
|
153
|
+
const defineCustomElement = defineCustomElement$1;
|
|
154
|
+
|
|
155
|
+
export { SulaTag, defineCustomElement };
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=sula-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"sula-tag.js","mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAED,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,wCAAmB,CAAA;IACnB,oCAAe,CAAA;IACf,kCAAa,CAAA;AACf,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AAED,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,oCAAe,CAAA;IACf,0CAAqB,CAAA;IACrB,6CAAwB,CAAA;IACxB,+CAA0B,CAAA;IAC1B,0CAAqB,CAAA;IACrB,iDAA4B,CAAA;IAC5B,mDAA8B,CAAA;AAChC,CAAC,EARW,iBAAiB,KAAjB,iBAAiB,QAQ5B;AAED,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,sCAAiB,CAAA;IACjB,kCAAa,CAAA;AACf,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB;;ACtB7B,MAAM,UAAU,GAAG,u4TAAu4T,CAAC;AAC35T,sBAAe,UAAU;;MCOZA,SAAO;IALpB;;;;;;;QAUE,UAAK,GAAW,EAAE,CAAC;;;;QAMnB,SAAI,GAAW,EAAE,CAAC;;;;QAMlB,eAAU,GAAsB,iBAAiB,CAAC,OAAO,CAAC;;;;QAM1D,SAAI,GAAgB,WAAW,CAAC,OAAO,CAAC;;;;QAMxC,eAAU,GAAsB,iBAAiB,CAAC,QAAQ,CAAC;;;;QAM3D,eAAU,GAAsB,iBAAiB,CAAC,MAAM,C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ChD,CAAC,iBAAiB,CAAC,KAAK,GAAG,mBAAmB;YAC9C,CAAC,iBAAiB,CAAC,IAAI,GAAG,2BAA2B;SACtD,CAAC;QACF,OAAO,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KAC1C;IAED,MAAM;QACJ,QACE,EAAC,IAAI,uDACH,4DACE,KAAK,EAAE;gBACL,qCAAqC,EAAE,IAAI;gBAC3C,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI;gBAC3B,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,IAAI;aAClC,IAEA,IAAI,CAAC,IAAI,KACR,4DACE,KAAK,EAAE;gBACL,wEAAwE,EAAE,IAAI;gBAC9E,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,IAAI;aAClC,IAED,kEAAW,IAAI,EAAE,IAAI,CAAC,IAAI,kBAAe,8CAA8C,GAAa,CAChG,CACP,EACD,6DACE,KAAK,EAAE;gBACL,qBAAqB,EAAE,IAAI;gBAC3B,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,IAAI;gBAChC,CAAC,IAAI,CAAC,kBAAkB,EAAE,GAAG,IAAI;aAClC,IAEA,IAAI,CAAC,KAAK,CACN,CACH,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SulaTag"],"sources":["src/components/sula-tag/model/sula-tag.model.ts","src/components/sula-tag/sula-tag.scss?tag=sula-tag&encapsulation=shadow","src/components/sula-tag/sula-tag.tsx"],"sourcesContent":["export enum SulaTagSize {\n Small = 'small',\n Default = 'default',\n}\n\nexport enum SulaTagIconStatus {\n Success = 'success',\n Warning = 'warning',\n Error = 'error',\n Info = 'info',\n}\n\nexport enum SulaTagAppearance {\n Brand = 'brand',\n Bordered = 'bordered',\n LightBlue = 'light-blue', \n LightBrand = 'light-brand',\n Negative = 'negative',\n OpacityGrey = 'opacity-grey',\n OpacityWhite = 'opacity-white',\n}\n\nexport enum SulaTagFontWeight {\n Normal = 'normal',\n Bold = 'bold',\n}\n",":host {\n display: block;\n}\n","import { Component, Host, Prop, h } from '@stencil/core';\nimport { SulaTagAppearance, SulaTagFontWeight, SulaTagIconStatus, SulaTagSize } from './model/sula-tag.model';\n\n@Component({\n tag: 'sula-tag',\n styleUrl: 'sula-tag.scss',\n shadow: true,\n})\nexport class SulaTag {\n /**\n * Tag label\n */\n @Prop({ mutable: true })\n label: string = '';\n\n /**\n * Tag icon\n */\n @Prop({ mutable: true })\n icon: string = '';\n\n /**\n * Tag icon status\n */\n @Prop({ mutable: true })\n iconStatus: SulaTagIconStatus = SulaTagIconStatus.Success;\n\n /**\n * Tag size\n */\n @Prop({ mutable: true })\n size: SulaTagSize = SulaTagSize.Default;\n\n /**\n * Tag appearance\n */\n @Prop({ mutable: true })\n appearance: SulaTagAppearance = SulaTagAppearance.Bordered;\n\n /**\n * Tag font weight\n */\n @Prop({ mutable: true })\n fontWeight: SulaTagFontWeight = SulaTagFontWeight.Normal;\n\n getSizeClass() {\n const sizeStyles = {\n [SulaTagSize.Small]: 'px-8 py-4',\n [SulaTagSize.Default]: 'px-12 py-8',\n };\n\n return sizeStyles[this.size];\n }\n\n getAppearanceClass() {\n const appearanceStyles = {\n [SulaTagAppearance.Brand]: 'bg-brand-primary',\n [SulaTagAppearance.Bordered]: 'border-line-general border bg-transparent',\n [SulaTagAppearance.LightBlue]: 'bg-surface-on-body-blue',\n [SulaTagAppearance.LightBrand]: 'bg-surface-on-body-brand',\n [SulaTagAppearance.Negative]: 'bg-negative-negative-1',\n [SulaTagAppearance.OpacityGrey]: 'bg-opacity-on-body',\n [SulaTagAppearance.OpacityWhite]: 'bg-opacity-body',\n };\n return appearanceStyles[this.appearance];\n }\n\n getTextColorClass() {\n if (this.appearance === SulaTagAppearance.Brand) {\n return 'text-negative-negative-1';\n } else if (this.appearance === SulaTagAppearance.Negative) {\n return 'text-negative-negative-2';\n }\n\n return 'text-text-primary';\n }\n\n getTextWeightClass() {\n const fontWeightStyles = {\n [SulaTagFontWeight.Bold]: 'font-bold',\n [SulaTagFontWeight.Normal]: 'font-normal',\n };\n return fontWeightStyles[this.fontWeight];\n }\n\n getIconStatusClass() {\n const iconStatusStyles = {\n [SulaTagIconStatus.Success]: 'bg-feedback-success',\n [SulaTagIconStatus.Warning]: 'bg-feedback-alert',\n [SulaTagIconStatus.Error]: 'bg-feedback-error',\n [SulaTagIconStatus.Info]: 'bg-feedback-informational',\n };\n return iconStatusStyles[this.iconStatus];\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'flex items-center rounded-xxl w-fit': true,\n [this.getSizeClass()]: true,\n [this.getAppearanceClass()]: true,\n }}\n >\n {this.icon && (\n <div\n class={{\n 'flex justify-center items-center mr-8 rounded-full leading-4 px-2 py-1': true,\n [this.getIconStatusClass()]: true,\n }}\n >\n <sula-icon icon={this.icon} custom-class=\"text-base text-negative-negative-1 leading-4\"></sula-icon>\n </div>\n )}\n <span\n class={{\n 'text-base leading-4': true,\n [this.getTextColorClass()]: true,\n [this.getTextWeightClass()]: true,\n }}\n >\n {this.label}\n </span>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SulaTextarea extends Components.SulaTextarea, HTMLElement {}
|
|
4
|
+
export const SulaTextarea: {
|
|
5
|
+
prototype: SulaTextarea;
|
|
6
|
+
new (): SulaTextarea;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, d as createEvent, h, c as Host } from './p-881c6b35.js';
|
|
2
|
+
|
|
3
|
+
var SulaTextareaStatus;
|
|
4
|
+
(function (SulaTextareaStatus) {
|
|
5
|
+
SulaTextareaStatus["Default"] = "default";
|
|
6
|
+
SulaTextareaStatus["Error"] = "error";
|
|
7
|
+
})(SulaTextareaStatus || (SulaTextareaStatus = {}));
|
|
8
|
+
|
|
9
|
+
const sulaTextareaCss = "*,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}.outline{outline-style:solid}:host{display:block;width:100%}.textarea-focus{outline:2px solid var(--color-feedback-informational)!important;outline-offset:2px!important}.textarea-error{outline:2px solid var(--color-feedback-error)!important;outline-offset:2px!important}.label-up{animation:labelMoveUp .2s ease-in-out}.label-down{animation:labelMoveDown .2s ease-in-out}@keyframes labelMoveUp{0%{font-size:1rem;left:12px;top:16px}to{font-size:.875rem;left:16px;top:12px}}@keyframes labelMoveDown{0%{font-size:.875rem;left:16px;top:12px}to{font-size:1rem;left:12px;top:16px}}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#02361a;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#500202;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#683f08;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#691e07;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#6a3b01;--color-gray-50:#fff;--color-gray-100:#f4f4f4;--color-gray-200:#e6e6e6;--color-gray-300:#c3c3c3;--color-gray-400:#b9b9b9;--color-gray-500:#949494;--color-gray-600:#737373;--color-gray-700:#5c5c5c;--color-gray-800:#323232;--color-gray-900:#292929;--color-gray-950:#141414;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#0a2e61;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:#14141405;--color-black-opacity-100:#1414141a;--color-black-opacity-200:#14141426;--color-black-opacity-300:#14141445;--color-black-opacity-400:#1414145c;--color-black-opacity-500:#14141480;--color-black-opacity-600:#1414148c;--color-black-opacity-700:#141414a3;--color-black-opacity-800:#141414ba;--color-black-opacity-900:#141414cc;--color-black-opacity-950:#141414e8;--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f4f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#323232;--color-text-secondary:#5c5c5c;--color-text-disabled:#949494;--color-text-link:#1355b4;--color-states-empty-bg-hover:#1414141a;--color-states-empty-bg-pressed:#14141426;--color-states-bg-disabled:#14141405;--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e6e6e6;--color-states-negative-pressed:#c3c3c3;--color-icon-primary:#5c5c5c;--color-icon-secondary:#fff;--color-icon-disabled:#b9b9b9;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f4f4f4;--color-neutral-neutral-3:#b9b9b9;--color-neutral-neutral-4:#949494;--color-neutral-neutral-5:#737373;--color-neutral-neutral-6:#5c5c5c;--color-neutral-neutral-7:#323232;--color-neutral-neutral-8:#292929;--color-negative-negative-1:#fff;--color-negative-negative-2:#323232;--color-opacity-body:#fffc;--color-opacity-on-body:#14141405;--color-opacity-overlay:#1414148c;--color-opacity-on-overlay:#ffffff1a;--color-line-input:#949494;--color-line-general-strong:#c3c3c3;--color-line-general:#e6e6e6}.pointer-events-none{pointer-events:none}.static{position:static}.absolute{position:absolute}.relative{position:relative}.left-12{left:.75rem}.left-16{left:1rem}.top-12{top:.75rem}.top-16{top:1rem}.z-10{z-index:10}.mt-4{margin-top:.25rem}.flex{display:flex}.h-full{height:100%}.w-\\[85\\%\\]{width:85%}.w-full{width:100%}.cursor-not-allowed{cursor:not-allowed}.cursor-text{cursor:text}.resize-none{resize:none}.items-center{align-items:center}.justify-between{justify-content:space-between}.overflow-hidden{overflow:hidden}.rounded-sm{border-radius:.75rem}.border{border-width:1px}.border-none{border-style:none}.border-line-general{border-color:var(--color-line-general)}.border-line-input{border-color:var(--color-line-input)}.bg-states-bg-disabled{background-color:var(--color-states-bg-disabled)}.bg-surface-body{background-color:var(--color-surface-body)}.bg-transparent{background-color:transparent}.px-16{padding-left:1rem;padding-right:1rem}.py-12{padding-bottom:.75rem;padding-top:.75rem}.pt-0{padding-top:0}.pt-6{padding-top:1.5rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.text-feedback-error{color:var(--color-feedback-error)}.text-text-disabled{color:var(--color-text-disabled)}.text-text-primary{color:var(--color-text-primary)}.caret-brand-primary{caret-color:var(--color-brand-primary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}";
|
|
10
|
+
const SulaTextareaStyle0 = sulaTextareaCss;
|
|
11
|
+
|
|
12
|
+
const SulaTextarea$1 = /*@__PURE__*/ proxyCustomElement(class SulaTextarea extends H {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.__registerHost();
|
|
16
|
+
this.__attachShadow();
|
|
17
|
+
this.valueChanged = createEvent(this, "valueChanged", 7);
|
|
18
|
+
this.focusedOn = createEvent(this, "focusedOn", 7);
|
|
19
|
+
this.focusedOut = createEvent(this, "focusedOut", 7);
|
|
20
|
+
/**
|
|
21
|
+
* The textarea status
|
|
22
|
+
*/
|
|
23
|
+
this.status = SulaTextareaStatus.Default;
|
|
24
|
+
/**
|
|
25
|
+
* The textarea rows (height)
|
|
26
|
+
*/
|
|
27
|
+
this.rows = 4;
|
|
28
|
+
this.isActive = false;
|
|
29
|
+
this.textValue = '';
|
|
30
|
+
this.textareaIsFocused = false;
|
|
31
|
+
this.labelAnimationClass = '';
|
|
32
|
+
this.handleTextareaClick = () => {
|
|
33
|
+
if (this.disabled)
|
|
34
|
+
return;
|
|
35
|
+
this.setLabelUp();
|
|
36
|
+
this.focusOnTextarea();
|
|
37
|
+
};
|
|
38
|
+
this.handleTextareaChanges = (event) => {
|
|
39
|
+
const newValue = event.target.value;
|
|
40
|
+
this.textValue = newValue;
|
|
41
|
+
this.value = newValue;
|
|
42
|
+
if (newValue.length > 0 || this.textareaIsFocused) {
|
|
43
|
+
this.setLabelUp();
|
|
44
|
+
}
|
|
45
|
+
this.valueChanged.emit(newValue);
|
|
46
|
+
};
|
|
47
|
+
this.handleFocus = () => {
|
|
48
|
+
if (this.disabled)
|
|
49
|
+
return;
|
|
50
|
+
this.setLabelUp();
|
|
51
|
+
this.focusOnTextarea();
|
|
52
|
+
};
|
|
53
|
+
this.handleBlur = () => {
|
|
54
|
+
if (!this.textValue || this.textValue.trim().length === 0) {
|
|
55
|
+
this.setLabelDown();
|
|
56
|
+
}
|
|
57
|
+
this.focusedOut.emit();
|
|
58
|
+
this.textareaIsFocused = false;
|
|
59
|
+
};
|
|
60
|
+
this.handleTextareaFocus = () => {
|
|
61
|
+
this.focusedOn.emit();
|
|
62
|
+
this.textareaIsFocused = true;
|
|
63
|
+
this.setLabelUp();
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
handleClick(event) {
|
|
67
|
+
if (!this.node)
|
|
68
|
+
return;
|
|
69
|
+
const clickInside = this.node.contains(event.target);
|
|
70
|
+
if (!clickInside && (!this.textValue || this.textValue.trim().length === 0)) {
|
|
71
|
+
this.setLabelDown();
|
|
72
|
+
this.focusedOut.emit();
|
|
73
|
+
this.textareaIsFocused = false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
focusOnTextarea() {
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
this.textareaElement.focus();
|
|
79
|
+
}, 0);
|
|
80
|
+
}
|
|
81
|
+
componentWillLoad() {
|
|
82
|
+
if (this.value && this.value.trim().length > 0) {
|
|
83
|
+
this.textValue = this.value;
|
|
84
|
+
this.isActive = true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
setLabelUp() {
|
|
88
|
+
if (!this.isActive) {
|
|
89
|
+
this.labelAnimationClass = 'label-up';
|
|
90
|
+
this.isActive = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
setLabelDown() {
|
|
94
|
+
if (this.isActive && (!this.textValue || this.textValue.trim().length === 0)) {
|
|
95
|
+
this.labelAnimationClass = 'label-down';
|
|
96
|
+
this.isActive = false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
render() {
|
|
100
|
+
const containerHeight = this.rows * 24 + 48;
|
|
101
|
+
return (h(Host, { key: '69db08ba2dfa48ab4972febe5fb1ece24574c0d1', ref: node => (this.node = node) }, h("div", { key: '2aa2f346436687068696e73f9a8a4d89b24d69ec' }, h("div", { key: '35c9c074790112d6622b032f0dff0f54c99ab7f8', id: "textarea-container", class: {
|
|
102
|
+
'relative border rounded-sm px-16 py-12 outline-none caret-brand-primary': true,
|
|
103
|
+
'textarea-focus': this.textareaIsFocused && !this.disabled && this.status === SulaTextareaStatus.Default,
|
|
104
|
+
'textarea-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
105
|
+
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
106
|
+
'bg-surface-body border-line-input cursor-text': !this.disabled,
|
|
107
|
+
}, style: { height: `${containerHeight}px` }, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleTextareaClick }, h("label", { key: 'fe14082916a84da099bfc0798a10eee16169b9f7', class: {
|
|
108
|
+
'absolute font-bold transition-all duration-200 ease-in-out pointer-events-none z-10 w-[85%]': true,
|
|
109
|
+
'text-sm top-12 left-16': this.isActive,
|
|
110
|
+
'text-base top-16 left-12': !this.isActive,
|
|
111
|
+
'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),
|
|
112
|
+
'text-text-disabled': this.disabled,
|
|
113
|
+
'bg-surface-body': !this.disabled && this.isActive,
|
|
114
|
+
[this.labelAnimationClass]: true,
|
|
115
|
+
}, style: this.isActive ? { padding: '0 4px', marginLeft: '-4px' } : {} }, this.label), h("textarea", { key: 'a0a611ffc887e3b5a751e93bd994feb4f63a0ad6', ref: node => (this.textareaElement = node), placeholder: this.isActive ? this.placeholder : '', rows: this.rows, maxLength: this.maxLength, disabled: this.disabled, class: {
|
|
116
|
+
'w-full h-full outline-none text-base bg-transparent border-none resize-none': true,
|
|
117
|
+
'pt-6': this.isActive,
|
|
118
|
+
'pt-0': !this.isActive,
|
|
119
|
+
'text-text-primary': !this.disabled,
|
|
120
|
+
'text-text-disabled cursor-not-allowed overflow-hidden': this.disabled,
|
|
121
|
+
}, onInput: this.handleTextareaChanges, onFocus: this.handleTextareaFocus, onBlur: this.handleBlur, value: this.textValue })), (this.helpText || this.maxLength) && (h("div", { key: 'a80df9745209ff2116815600e8077ab0c81dc122', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: '0882feb0b690fd6b56ea8911f1ddea994ef27228', id: "textarea-help-text", class: {
|
|
122
|
+
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
123
|
+
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
124
|
+
'text-text-disabled': this.disabled,
|
|
125
|
+
} }, this.helpText)), this.maxLength && (h("div", { key: '2f4150bec1a2cff4e484b35f6c92d5ee90791a6c', id: "max-length-container", class: {
|
|
126
|
+
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
127
|
+
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
128
|
+
'text-text-disabled': this.disabled,
|
|
129
|
+
} }, this.textValue ? this.textValue.length : 0, "/", this.maxLength)))))));
|
|
130
|
+
}
|
|
131
|
+
static get style() { return SulaTextareaStyle0; }
|
|
132
|
+
}, [1, "sula-textarea", {
|
|
133
|
+
"value": [1025],
|
|
134
|
+
"status": [1025],
|
|
135
|
+
"label": [1],
|
|
136
|
+
"placeholder": [1],
|
|
137
|
+
"disabled": [1028],
|
|
138
|
+
"helpText": [1, "help-text"],
|
|
139
|
+
"maxLength": [2, "max-length"],
|
|
140
|
+
"rows": [2],
|
|
141
|
+
"isActive": [32],
|
|
142
|
+
"textValue": [32],
|
|
143
|
+
"textareaIsFocused": [32],
|
|
144
|
+
"labelAnimationClass": [32]
|
|
145
|
+
}, [[4, "click", "handleClick"]]]);
|
|
146
|
+
function defineCustomElement$1() {
|
|
147
|
+
if (typeof customElements === "undefined") {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const components = ["sula-textarea"];
|
|
151
|
+
components.forEach(tagName => { switch (tagName) {
|
|
152
|
+
case "sula-textarea":
|
|
153
|
+
if (!customElements.get(tagName)) {
|
|
154
|
+
customElements.define(tagName, SulaTextarea$1);
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
} });
|
|
158
|
+
}
|
|
159
|
+
defineCustomElement$1();
|
|
160
|
+
|
|
161
|
+
const SulaTextarea = SulaTextarea$1;
|
|
162
|
+
const defineCustomElement = defineCustomElement$1;
|
|
163
|
+
|
|
164
|
+
export { SulaTextarea, defineCustomElement };
|
|
165
|
+
|
|
166
|
+
//# sourceMappingURL=sula-textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"sula-textarea.js","mappings":";;AAAA,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,qCAAe,CAAA;AACjB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB;;ACA9B,MAAM,eAAe,GAAG,y7UAAy7U,CAAC;AACl9U,2BAAe,eAAe;;MCOjBA,cAAY;IALzB;;;;;;;;;;QAe2B,WAAM,GAAuB,kBAAkB,CAAC,OAAO,CAAC;;;;QA8BzE,SAAI,GAAW,CAAC,CAAC;QAqBzB,aAAQ,GAAG,KAAK,CAAC;QAGjB,cAAS,GAAW,EAAE,CAAC;QAGvB,sBAAiB,GAAG,KAAK,CAAC;QAG1B,wBAAmB,GAAG,EAAE,CAAC;QA8CzB,wBAAmB,GAAG;YACpB,IAA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AAoB,EAAE,IAAI,CAAC,QAAQ;aACpC,IAEA,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,OAAG,IAAI,CAAC,SAAS,CACxD,CACP,CACG,CACP,CACG,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["SulaTextarea"],"sources":["src/components/sula-textarea/model/sula-textarea.model.ts","src/components/sula-textarea/sula-textarea.scss?tag=sula-textarea&encapsulation=shadow","src/components/sula-textarea/sula-textarea.tsx"],"sourcesContent":["export enum SulaTextareaStatus {\n Default = 'default',\n Error = 'error',\n}\n",":host {\n display: block;\n width: 100%;\n}\n\n.textarea-focus {\n outline: 2px solid var(--color-feedback-informational) !important;\n outline-offset: 2px !important;\n}\n\n.textarea-error {\n outline: 2px solid var(--color-feedback-error) !important;\n outline-offset: 2px !important;\n}\n\n.label-up {\n animation: labelMoveUp 0.2s ease-in-out;\n}\n\n.label-down {\n animation: labelMoveDown 0.2s ease-in-out;\n}\n\n@keyframes labelMoveUp {\n from {\n font-size: 1rem;\n top: 16px;\n left: 12px;\n }\n to {\n font-size: 0.875rem;\n top: 12px;\n left: 16px;\n }\n}\n\n@keyframes labelMoveDown {\n from {\n font-size: 0.875rem;\n top: 12px;\n left: 16px;\n }\n to {\n font-size: 1rem;\n top: 16px;\n left: 12px;\n }\n}\n","import { Component, Event, EventEmitter, Host, Listen, Prop, State, h } from '@stencil/core';\nimport { SulaTextareaStatus } from './model/sula-textarea.model';\n\n@Component({\n tag: 'sula-textarea',\n styleUrl: 'sula-textarea.scss',\n shadow: true,\n})\nexport class SulaTextarea {\n /**\n * Value for the textarea.\n */\n @Prop({ mutable: true })\n value?: string;\n\n /**\n * The textarea status\n */\n @Prop({ mutable: true }) status: SulaTextareaStatus = SulaTextareaStatus.Default;\n\n /**\n * The textarea label\n */\n @Prop() label: string;\n\n /**\n * The textarea placeholder\n */\n @Prop() placeholder: string;\n\n /**\n * The textarea is disabled\n */\n @Prop({ mutable: true }) disabled: boolean;\n\n /**\n * The help text for textarea\n */\n @Prop() helpText?: string;\n\n /**\n * The textarea max length\n */\n @Prop() maxLength?: number;\n\n /**\n * The textarea rows (height)\n */\n @Prop() rows: number = 4;\n\n /**\n * Event emitted when textarea value changes.\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Event emitted when textarea is focused.\n */\n @Event()\n focusedOn: EventEmitter<void>;\n\n /**\n * Event emitted when textarea is focused out.\n */\n @Event()\n focusedOut: EventEmitter<void>;\n\n @State()\n isActive = false;\n\n @State()\n textValue: string = '';\n\n @State()\n textareaIsFocused = false;\n\n @State()\n labelAnimationClass = '';\n\n textareaElement: HTMLTextAreaElement;\n\n node?: HTMLElement;\n\n @Listen('click', { target: 'document' })\n handleClick(event: Event) {\n if (!this.node) return;\n\n const clickInside = this.node.contains(event.target as Node);\n\n if (!clickInside && (!this.textValue || this.textValue.trim().length === 0)) {\n this.setLabelDown();\n this.focusedOut.emit();\n this.textareaIsFocused = false;\n }\n }\n\n focusOnTextarea() {\n setTimeout(() => {\n this.textareaElement.focus();\n }, 0);\n }\n\n componentWillLoad() {\n if (this.value && this.value.trim().length > 0) {\n this.textValue = this.value;\n this.isActive = true;\n }\n }\n\n setLabelUp() {\n if (!this.isActive) {\n this.labelAnimationClass = 'label-up';\n this.isActive = true;\n }\n }\n\n setLabelDown() {\n if (this.isActive && (!this.textValue || this.textValue.trim().length === 0)) {\n this.labelAnimationClass = 'label-down';\n this.isActive = false;\n }\n }\n\n handleTextareaClick = () => {\n if (this.disabled) return;\n this.setLabelUp();\n this.focusOnTextarea();\n };\n\n handleTextareaChanges = (event: InputEvent) => {\n const newValue = (event.target as HTMLTextAreaElement).value;\n this.textValue = newValue;\n this.value = newValue;\n\n if (newValue.length > 0 || this.textareaIsFocused) {\n this.setLabelUp();\n }\n\n this.valueChanged.emit(newValue);\n };\n\n handleFocus = () => {\n if (this.disabled) return;\n\n this.setLabelUp();\n this.focusOnTextarea();\n };\n\n handleBlur = () => {\n if (!this.textValue || this.textValue.trim().length === 0) {\n this.setLabelDown();\n }\n\n this.focusedOut.emit();\n this.textareaIsFocused = false;\n };\n\n handleTextareaFocus = () => {\n this.focusedOn.emit();\n this.textareaIsFocused = true;\n this.setLabelUp();\n };\n\n render() {\n const containerHeight = this.rows * 24 + 48;\n\n return (\n <Host ref={node => (this.node = node)}>\n <div>\n <div\n id=\"textarea-container\"\n class={{\n 'relative border rounded-sm px-16 py-12 outline-none caret-brand-primary': true,\n 'textarea-focus': this.textareaIsFocused && !this.disabled && this.status === SulaTextareaStatus.Default,\n 'textarea-error': this.status === SulaTextareaStatus.Error && !this.disabled,\n 'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,\n 'bg-surface-body border-line-input cursor-text': !this.disabled,\n }}\n style={{ height: `${containerHeight}px` }}\n tabIndex={0}\n onFocus={this.handleFocus}\n onClick={this.handleTextareaClick}\n >\n <label\n class={{\n 'absolute font-bold transition-all duration-200 ease-in-out pointer-events-none z-10 w-[85%]': true,\n 'text-sm top-12 left-16': this.isActive,\n 'text-base top-16 left-12': !this.isActive,\n 'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),\n 'text-text-disabled': this.disabled,\n 'bg-surface-body': !this.disabled && this.isActive,\n [this.labelAnimationClass]: true,\n }}\n style={this.isActive ? { padding: '0 4px', marginLeft: '-4px' } : {}}\n >\n {this.label}\n </label>\n\n <textarea\n ref={node => (this.textareaElement = node)}\n placeholder={this.isActive ? this.placeholder : ''}\n rows={this.rows}\n maxLength={this.maxLength}\n disabled={this.disabled}\n class={{\n 'w-full h-full outline-none text-base bg-transparent border-none resize-none': true,\n 'pt-6': this.isActive,\n 'pt-0': !this.isActive,\n 'text-text-primary': !this.disabled,\n 'text-text-disabled cursor-not-allowed overflow-hidden': this.disabled,\n }}\n onInput={this.handleTextareaChanges}\n onFocus={this.handleTextareaFocus}\n onBlur={this.handleBlur}\n value={this.textValue}\n />\n </div>\n\n {(this.helpText || this.maxLength) && (\n <div class=\"flex justify-between items-center px-16 mt-4 text-sm\">\n {this.helpText && (\n <div\n id=\"textarea-help-text\"\n class={{\n 'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,\n 'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.helpText}\n </div>\n )}\n {this.maxLength && (\n <div\n id=\"max-length-container\"\n class={{\n 'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,\n 'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.textValue ? this.textValue.length : 0}/{this.maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SulaTextfield extends Components.SulaTextfield, HTMLElement {}
|
|
4
|
+
export const SulaTextfield: {
|
|
5
|
+
prototype: SulaTextfield;
|
|
6
|
+
new (): SulaTextfield;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|