@sula-tech/webcomponents 0.4.1 → 0.6.0
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-BtkenDV1.js → index-Bbryl0vg.js} +30 -4
- package/dist/cjs/index-Bbryl0vg.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{sula-avatar_14.cjs.entry.js → sula-avatar_18.cjs.entry.js} +386 -48
- package/dist/cjs/sula-avatar_18.cjs.entry.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +5 -1
- package/dist/collection/components/sula-button/sula-button.css +1 -1
- package/dist/collection/components/sula-button/sula-button.js +66 -6
- package/dist/collection/components/sula-button/sula-button.js.map +1 -1
- package/dist/collection/components/sula-button/sula-button.stories.js +260 -97
- package/dist/collection/components/sula-button/sula-button.stories.js.map +1 -1
- package/dist/collection/components/sula-checkbox/sula-checkbox.js +3 -3
- package/dist/collection/components/sula-chip/sula-chip.css +1 -1
- package/dist/collection/components/sula-chip/sula-chip.js +3 -3
- package/dist/collection/components/sula-dropdown/sula-dropdown.css +1 -0
- package/dist/collection/components/sula-dropdown/sula-dropdown.js +275 -0
- package/dist/collection/components/sula-dropdown/sula-dropdown.js.map +1 -0
- package/dist/collection/components/sula-dropdown/sula-dropdown.stories.js +155 -0
- package/dist/collection/components/sula-dropdown/sula-dropdown.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-loader/sula-loader.css +1 -1
- package/dist/collection/components/sula-loader/sula-loader.js +1 -1
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.css +1 -1
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.js +29 -1
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.js.map +1 -1
- package/dist/collection/components/sula-progress-bar/model/sula-progress-bar.model.js +15 -0
- package/dist/collection/components/sula-progress-bar/model/sula-progress-bar.model.js.map +1 -0
- package/dist/collection/components/sula-progress-bar/sula-progress-bar.css +1 -0
- package/dist/collection/components/sula-progress-bar/sula-progress-bar.js +213 -0
- package/dist/collection/components/sula-progress-bar/sula-progress-bar.js.map +1 -0
- package/dist/collection/components/sula-progress-bar/sula-progress.stories.js +172 -0
- package/dist/collection/components/sula-progress-bar/sula-progress.stories.js.map +1 -0
- package/dist/collection/components/sula-radio-button/sula-radio-button.js +2 -2
- package/dist/collection/components/sula-search-bar/model/sula-search.bar-model.js +6 -0
- package/dist/collection/components/sula-search-bar/model/sula-search.bar-model.js.map +1 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.css +1 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.js +240 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.js.map +1 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.stories.js +119 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.stories.js.map +1 -0
- package/dist/collection/components/sula-switch/sula-switch.js +4 -4
- package/dist/collection/components/sula-tag/sula-tag.js +3 -3
- package/dist/collection/components/sula-textarea/sula-textarea.js +6 -6
- package/dist/collection/components/sula-textfield/sula-textfield.js +2 -2
- package/dist/collection/components/sula-tiles/sula-tiles.js +1 -1
- package/dist/collection/components/sula-timeline-list/model/sula-timeline-list.model.js +7 -0
- package/dist/collection/components/sula-timeline-list/model/sula-timeline-list.model.js.map +1 -0
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.css +1 -0
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.js +123 -0
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.js.map +1 -0
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.stories.js +217 -0
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.stories.js.map +1 -0
- package/dist/components/index.js +20 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-DJGFqp8r.js → p-BNtk_d_S.js} +14 -5
- package/dist/components/p-BNtk_d_S.js.map +1 -0
- package/dist/components/p-CYBZuKr6.js +27129 -0
- package/dist/components/p-CYBZuKr6.js.map +1 -0
- package/dist/components/{p-CEU3PNQs.js → p-DULnDBOY.js} +4 -4
- package/dist/components/{p-CEU3PNQs.js.map → p-DULnDBOY.js.map} +1 -1
- package/dist/components/sula-avatar.js +1 -1
- package/dist/components/sula-badge.js +1 -1
- package/dist/components/sula-button.js +38 -9
- package/dist/components/sula-button.js.map +1 -1
- package/dist/components/sula-checkbox.js +4 -4
- package/dist/components/sula-chip.js +6 -6
- package/dist/components/sula-chip.js.map +1 -1
- package/dist/components/sula-dropdown.d.ts +11 -0
- package/dist/components/sula-dropdown.js +137 -0
- package/dist/components/sula-dropdown.js.map +1 -0
- package/dist/components/sula-icon.js +1 -1
- package/dist/components/sula-loader.js +1 -27124
- package/dist/components/sula-loader.js.map +1 -1
- package/dist/components/sula-menu-select-list.js +1 -1
- package/dist/components/sula-progress-bar.d.ts +11 -0
- package/dist/components/sula-progress-bar.js +122 -0
- package/dist/components/sula-progress-bar.js.map +1 -0
- package/dist/components/sula-radio-button.js +2 -2
- package/dist/components/sula-search-bar.d.ts +11 -0
- package/dist/components/sula-search-bar.js +104 -0
- package/dist/components/sula-search-bar.js.map +1 -0
- package/dist/components/sula-switch.js +4 -4
- package/dist/components/sula-tag.js +4 -4
- package/dist/components/sula-textarea.js +6 -6
- package/dist/components/sula-textfield.js +3 -3
- package/dist/components/sula-tiles.js +2 -2
- package/dist/components/sula-timeline-list.d.ts +11 -0
- package/dist/components/sula-timeline-list.js +101 -0
- package/dist/components/sula-timeline-list.js.map +1 -0
- package/dist/esm/{index-Yyeke16a.js → index-or7qTZgT.js} +30 -4
- package/dist/esm/index-or7qTZgT.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{sula-avatar_14.entry.js → sula-avatar_18.entry.js} +383 -49
- package/dist/esm/sula-avatar_18.entry.js.map +1 -0
- package/dist/esm/webcomponents.js +3 -3
- package/dist/types/components/sula-button/sula-button.d.ts +11 -1
- package/dist/types/components/sula-button/sula-button.stories.d.ts +124 -33
- package/dist/types/components/sula-dropdown/sula-dropdown.d.ts +49 -0
- package/dist/types/components/sula-dropdown/sula-dropdown.stories.d.ts +68 -0
- package/dist/types/components/sula-menu-select-list/sula-menu-select-list.d.ts +4 -0
- package/dist/types/components/sula-progress-bar/model/sula-progress-bar.model.d.ts +12 -0
- package/dist/types/components/sula-progress-bar/sula-progress-bar.d.ts +33 -0
- package/dist/types/components/sula-progress-bar/sula-progress.stories.d.ts +84 -0
- package/dist/types/components/sula-search-bar/model/sula-search.bar-model.d.ts +4 -0
- package/dist/types/components/sula-search-bar/sula-search-bar.d.ts +50 -0
- package/dist/types/components/sula-search-bar/sula-search-bar.stories.d.ts +84 -0
- package/dist/types/components/sula-timeline-list/model/sula-timeline-list.model.d.ts +16 -0
- package/dist/types/components/sula-timeline-list/sula-timeline-list.d.ts +17 -0
- package/dist/types/components/sula-timeline-list/sula-timeline-list.stories.d.ts +47 -0
- package/dist/types/components.d.ts +315 -0
- package/dist/webcomponents/{p-5ba79323.entry.js → p-2a133394.entry.js} +3656 -3167
- package/dist/webcomponents/p-2a133394.entry.js.map +1 -0
- package/dist/webcomponents/{p-Yyeke16a.js → p-or7qTZgT.js} +229 -204
- package/dist/webcomponents/p-or7qTZgT.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +50 -18
- package/package.json +1 -1
- package/readme.md +79 -19
- package/dist/cjs/index-BtkenDV1.js.map +0 -1
- package/dist/cjs/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.entry.cjs.js.map +0 -1
- package/dist/cjs/sula-avatar_14.cjs.entry.js.map +0 -1
- package/dist/components/p-DJGFqp8r.js.map +0 -1
- package/dist/esm/index-Yyeke16a.js.map +0 -1
- package/dist/esm/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.entry.js.map +0 -1
- package/dist/esm/sula-avatar_14.entry.js.map +0 -1
- package/dist/webcomponents/p-5ba79323.entry.js.map +0 -1
- package/dist/webcomponents/p-Yyeke16a.js.map +0 -1
- package/dist/webcomponents/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.entry.esm.js.map +0 -1
|
@@ -63,7 +63,7 @@ export class SulaChip {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
render() {
|
|
66
|
-
return (h(Host, { key: '
|
|
66
|
+
return (h(Host, { key: '6d1b92a6fda24fde41243d60571f6ef34fefd79e', ref: node => (this.node = node) }, h("div", { key: 'ad1ed1703e015a284fd315364ed3fb70b65c6b25', class: "w-fit relative" }, h("div", { key: 'fc717fc929968ffe49438a88012d7c11f9ac4e20', class: {
|
|
67
67
|
'flex justify-center items-center px-16 py-2 rounded-xxl min-h-40 w-fit outline-none': true,
|
|
68
68
|
'bg-surface-on-body hover:bg-states-empty-bg-hover active:bg-states-empty-bg-pressed': this.appearance === SulaChipAppearance.Default && !this.disabled,
|
|
69
69
|
'bg-negative-negative-1 hover:bg-states-negative-hover active:bg-states-negative-pressed': this.appearance === SulaChipAppearance.Negative && !this.disabled,
|
|
@@ -71,12 +71,12 @@ export class SulaChip {
|
|
|
71
71
|
'cursor-pointer': !this.disabled,
|
|
72
72
|
'border border-line-input chip-opened': !this.disabled && this.showItems,
|
|
73
73
|
'chip-focus': this.isFocused,
|
|
74
|
-
}, tabIndex: 0, onClick: this.handleClick, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("span", { key: '
|
|
74
|
+
}, tabIndex: 0, onClick: this.handleClick, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("span", { key: 'e08903b3bcd3e101aeec7f2deb9213636818682a', class: {
|
|
75
75
|
'text-base font-bold leading-4': true,
|
|
76
76
|
'text-text-primary': this.appearance === SulaChipAppearance.Default && !this.disabled,
|
|
77
77
|
'text-negative-negative-2': this.appearance === SulaChipAppearance.Negative && !this.disabled,
|
|
78
78
|
'text-text-disabled': this.disabled,
|
|
79
|
-
} }, this.text), this.items.length > 0 && (h("div", { key: '
|
|
79
|
+
} }, this.text), this.items.length > 0 && (h("div", { key: 'bf169918f272474e80295c1685bdc081e52b0659', class: "flex items-center justify-center ml-8 leading-4" }, h("sula-icon", { key: '4725462c18f295d2bdfd2ac878af6f28329c43ae', icon: `ph-bold ph-caret-${this.showItems ? 'up' : 'down'}`, customClass: this.getIconClass() })))), this.showItems && (h("div", { key: 'f4ed2a67fcaebafb80e2a308f9e3949814ec791d', class: "absolute z-50 top-40 left-0" }, h("sula-menu-select-list", { key: '03b02174a28fd59aa5dbab6c773c15a4d6bdc91e', items: this.items, onItemSelected: this.handleItemSelected }))))));
|
|
80
80
|
}
|
|
81
81
|
static get is() { return "sula-chip"; }
|
|
82
82
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,: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-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--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;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;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-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--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;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! 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}.dropdown-focus{outline:2px solid var(--color-feedback-informational)!important;outline-offset:2px!important}: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-tertiary:#b30404;--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}.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.top-\[72px\]{top:72px}.z-50{z-index:50}.ml-8{margin-left:.5rem}.flex{display:flex}.h-\[72px\]{height:72px}.w-full{width:100%}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.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)}.px-16{padding-left:1rem;padding-right:1rem}.pt-4{padding-top:.25rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.leading-4{line-height:1rem}.leading-6{line-height:1.5rem}.text-icon-disabled{color:var(--color-icon-disabled)}.text-text-disabled{color:var(--color-text-disabled)}.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)}.max-h-\[260px\]{max-height:260px}.w-300{width:18.75rem}.overflow-auto{overflow:auto}.rounded-sm{border-radius:.75rem}.border-line-general{border-color:var(--color-line-general)}.px-24{padding-left:1.5rem;padding-right:1.5rem}.py-12{padding-bottom:.75rem;padding-top:.75rem}.py-16{padding-bottom:1rem;padding-top:1rem}.hover\:bg-states-empty-bg-hover:hover{background-color:var(--color-states-empty-bg-hover)}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
export class SulaDropdown {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* Dropdown is disabled
|
|
6
|
+
*/
|
|
7
|
+
this.disabled = false;
|
|
8
|
+
/**
|
|
9
|
+
* Items for list
|
|
10
|
+
*/
|
|
11
|
+
this.items = [];
|
|
12
|
+
this.showItems = false;
|
|
13
|
+
this.isFocused = false;
|
|
14
|
+
this.handleClick = () => {
|
|
15
|
+
if (this.disabled)
|
|
16
|
+
return;
|
|
17
|
+
this.dropdownClicked.emit();
|
|
18
|
+
if (this.items.length > 0) {
|
|
19
|
+
this.showItems = !this.showItems;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
this.handleItemSelected = (item) => {
|
|
23
|
+
this.menuItemSelected.emit(item.detail);
|
|
24
|
+
this.selectedItem = item.detail;
|
|
25
|
+
};
|
|
26
|
+
this.handleFocus = () => {
|
|
27
|
+
if (this.disabled)
|
|
28
|
+
return;
|
|
29
|
+
this.isFocused = true;
|
|
30
|
+
this.dropdownFocused.emit();
|
|
31
|
+
};
|
|
32
|
+
this.handleBlur = () => {
|
|
33
|
+
if (this.disabled)
|
|
34
|
+
return;
|
|
35
|
+
this.isFocused = false;
|
|
36
|
+
this.dropdownFocusedOut.emit();
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
handleValueChange() {
|
|
40
|
+
if (this.value) {
|
|
41
|
+
this.selectedItem = this.value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
handleDocumentClick(event) {
|
|
45
|
+
if (!this.node)
|
|
46
|
+
return;
|
|
47
|
+
const clickInside = this.node.contains(event.target);
|
|
48
|
+
if (!clickInside) {
|
|
49
|
+
this.showItems = false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
componentWillLoad() {
|
|
53
|
+
if (this.value) {
|
|
54
|
+
this.selectedItem = this.value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
getIconClass() {
|
|
58
|
+
if (this.disabled)
|
|
59
|
+
return 'text-icon-disabled';
|
|
60
|
+
return 'text-text-primary';
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
return (h(Host, { key: 'af171f9d30d47328809736bfd6ba701f0148a5ab', ref: node => (this.node = node) }, h("div", { key: 'ef5a81511095b6e6edf85db9b7edf46c3aff0b7b', class: {
|
|
64
|
+
'flex justify-between items-center border border-line-input h-[72px] px-16 rounded-xl relative': true,
|
|
65
|
+
'bg-surface-body cursor-pointer': !this.disabled,
|
|
66
|
+
'bg-states-bg-disabled': this.disabled,
|
|
67
|
+
'dropdown-focus': this.isFocused,
|
|
68
|
+
}, onClick: this.handleClick, tabIndex: 0, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("div", { key: 'fee96c02b5b8e52d2e2abfac4ee9d6a3db8521c6', class: "flex flex-col" }, h("label", { key: 'a1a0ac4132c1a4bb4cac86dcbcccd981ee034c39', class: {
|
|
69
|
+
'text-base leading-4': !this.selectedItem,
|
|
70
|
+
'text-sm leading-4 font-bold': !!this.selectedItem,
|
|
71
|
+
'text-text-primary': !this.disabled,
|
|
72
|
+
'text-text-disabled': this.disabled,
|
|
73
|
+
} }, this.label), !!this.selectedItem && (h("span", { key: 'e99a3a7e82876c2cacd3d2ed956eb6b5965ba9ac', class: {
|
|
74
|
+
'text-base leading-4 pt-4': true,
|
|
75
|
+
'text-text-primary': !this.disabled,
|
|
76
|
+
'text-text-disabled': this.disabled,
|
|
77
|
+
} }, this.selectedItem.title))), h("div", { key: 'adfab0de70c420ca4889606e9623b9d0f574646c', class: "flex items-center justify-center ml-8 leading-6 text-2xl" }, h("sula-icon", { key: '9e9b7c2e68037090e3d66cafd5052ddb7a4ae6b7', icon: `ph ph-caret-${this.showItems ? 'up' : 'down'}`, customClass: `${this.getIconClass()} text-2xl` })), this.showItems && (h("div", { key: '72c7054b3110563312e048f8e2c70cf1c18edfda', class: "absolute z-50 top-[72px] left-0 w-full" }, h("sula-menu-select-list", { key: 'fd63b80f52e1861f2bb1f0132a544ac8e4c6c4d6', items: this.items, fullWidth: true, onItemSelected: this.handleItemSelected }))))));
|
|
78
|
+
}
|
|
79
|
+
static get is() { return "sula-dropdown"; }
|
|
80
|
+
static get encapsulation() { return "shadow"; }
|
|
81
|
+
static get originalStyleUrls() {
|
|
82
|
+
return {
|
|
83
|
+
"$": ["sula-dropdown.scss"]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
static get styleUrls() {
|
|
87
|
+
return {
|
|
88
|
+
"$": ["sula-dropdown.css"]
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
static get properties() {
|
|
92
|
+
return {
|
|
93
|
+
"label": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"attribute": "label",
|
|
96
|
+
"mutable": true,
|
|
97
|
+
"complexType": {
|
|
98
|
+
"original": "string",
|
|
99
|
+
"resolved": "string",
|
|
100
|
+
"references": {}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": "Dropdown label"
|
|
107
|
+
},
|
|
108
|
+
"getter": false,
|
|
109
|
+
"setter": false,
|
|
110
|
+
"reflect": false
|
|
111
|
+
},
|
|
112
|
+
"disabled": {
|
|
113
|
+
"type": "boolean",
|
|
114
|
+
"attribute": "disabled",
|
|
115
|
+
"mutable": true,
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "boolean",
|
|
118
|
+
"resolved": "boolean",
|
|
119
|
+
"references": {}
|
|
120
|
+
},
|
|
121
|
+
"required": false,
|
|
122
|
+
"optional": false,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": "Dropdown is disabled"
|
|
126
|
+
},
|
|
127
|
+
"getter": false,
|
|
128
|
+
"setter": false,
|
|
129
|
+
"reflect": false,
|
|
130
|
+
"defaultValue": "false"
|
|
131
|
+
},
|
|
132
|
+
"items": {
|
|
133
|
+
"type": "unknown",
|
|
134
|
+
"attribute": "items",
|
|
135
|
+
"mutable": true,
|
|
136
|
+
"complexType": {
|
|
137
|
+
"original": "SulaMenuListItem[]",
|
|
138
|
+
"resolved": "SulaMenuListItem[]",
|
|
139
|
+
"references": {
|
|
140
|
+
"SulaMenuListItem": {
|
|
141
|
+
"location": "import",
|
|
142
|
+
"path": "../../components",
|
|
143
|
+
"id": "src/components.d.ts::SulaMenuListItem"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"required": false,
|
|
148
|
+
"optional": false,
|
|
149
|
+
"docs": {
|
|
150
|
+
"tags": [],
|
|
151
|
+
"text": "Items for list"
|
|
152
|
+
},
|
|
153
|
+
"getter": false,
|
|
154
|
+
"setter": false,
|
|
155
|
+
"defaultValue": "[]"
|
|
156
|
+
},
|
|
157
|
+
"value": {
|
|
158
|
+
"type": "unknown",
|
|
159
|
+
"attribute": "value",
|
|
160
|
+
"mutable": true,
|
|
161
|
+
"complexType": {
|
|
162
|
+
"original": "SulaMenuListItem",
|
|
163
|
+
"resolved": "SulaMenuListItem",
|
|
164
|
+
"references": {
|
|
165
|
+
"SulaMenuListItem": {
|
|
166
|
+
"location": "import",
|
|
167
|
+
"path": "../../components",
|
|
168
|
+
"id": "src/components.d.ts::SulaMenuListItem"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"required": false,
|
|
173
|
+
"optional": true,
|
|
174
|
+
"docs": {
|
|
175
|
+
"tags": [],
|
|
176
|
+
"text": "Value for dropdown"
|
|
177
|
+
},
|
|
178
|
+
"getter": false,
|
|
179
|
+
"setter": false
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
static get states() {
|
|
184
|
+
return {
|
|
185
|
+
"selectedItem": {},
|
|
186
|
+
"showItems": {},
|
|
187
|
+
"isFocused": {}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
static get events() {
|
|
191
|
+
return [{
|
|
192
|
+
"method": "dropdownClicked",
|
|
193
|
+
"name": "dropdownClicked",
|
|
194
|
+
"bubbles": true,
|
|
195
|
+
"cancelable": true,
|
|
196
|
+
"composed": true,
|
|
197
|
+
"docs": {
|
|
198
|
+
"tags": [],
|
|
199
|
+
"text": "Event emitted when dropdown is clicked"
|
|
200
|
+
},
|
|
201
|
+
"complexType": {
|
|
202
|
+
"original": "void",
|
|
203
|
+
"resolved": "void",
|
|
204
|
+
"references": {}
|
|
205
|
+
}
|
|
206
|
+
}, {
|
|
207
|
+
"method": "dropdownFocused",
|
|
208
|
+
"name": "dropdownFocused",
|
|
209
|
+
"bubbles": true,
|
|
210
|
+
"cancelable": true,
|
|
211
|
+
"composed": true,
|
|
212
|
+
"docs": {
|
|
213
|
+
"tags": [],
|
|
214
|
+
"text": "Event emitted when dropdown is focused"
|
|
215
|
+
},
|
|
216
|
+
"complexType": {
|
|
217
|
+
"original": "void",
|
|
218
|
+
"resolved": "void",
|
|
219
|
+
"references": {}
|
|
220
|
+
}
|
|
221
|
+
}, {
|
|
222
|
+
"method": "dropdownFocusedOut",
|
|
223
|
+
"name": "dropdownFocusedOut",
|
|
224
|
+
"bubbles": true,
|
|
225
|
+
"cancelable": true,
|
|
226
|
+
"composed": true,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [],
|
|
229
|
+
"text": "Event emitted when dropdown is focused out"
|
|
230
|
+
},
|
|
231
|
+
"complexType": {
|
|
232
|
+
"original": "void",
|
|
233
|
+
"resolved": "void",
|
|
234
|
+
"references": {}
|
|
235
|
+
}
|
|
236
|
+
}, {
|
|
237
|
+
"method": "menuItemSelected",
|
|
238
|
+
"name": "menuItemSelected",
|
|
239
|
+
"bubbles": true,
|
|
240
|
+
"cancelable": true,
|
|
241
|
+
"composed": true,
|
|
242
|
+
"docs": {
|
|
243
|
+
"tags": [],
|
|
244
|
+
"text": "Event emitted when item is selected"
|
|
245
|
+
},
|
|
246
|
+
"complexType": {
|
|
247
|
+
"original": "SulaMenuListItem",
|
|
248
|
+
"resolved": "SulaMenuListItem",
|
|
249
|
+
"references": {
|
|
250
|
+
"SulaMenuListItem": {
|
|
251
|
+
"location": "import",
|
|
252
|
+
"path": "../../components",
|
|
253
|
+
"id": "src/components.d.ts::SulaMenuListItem"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}];
|
|
258
|
+
}
|
|
259
|
+
static get watchers() {
|
|
260
|
+
return [{
|
|
261
|
+
"propName": "value",
|
|
262
|
+
"methodName": "handleValueChange"
|
|
263
|
+
}];
|
|
264
|
+
}
|
|
265
|
+
static get listeners() {
|
|
266
|
+
return [{
|
|
267
|
+
"name": "click",
|
|
268
|
+
"method": "handleDocumentClick",
|
|
269
|
+
"target": "document",
|
|
270
|
+
"capture": false,
|
|
271
|
+
"passive": false
|
|
272
|
+
}];
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=sula-dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-dropdown.js","sourceRoot":"","sources":["../../../src/components/sula-dropdown/sula-dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAQpG,MAAM,OAAO,YAAY;IALzB;QAYE;;WAEG;QAEH,aAAQ,GAAY,KAAK,CAAC;QAE1B;;WAEG;QAEH,UAAK,GAAuB,EAAE,CAAC;QAoC/B,cAAS,GAAG,KAAK,CAAC;QAGlB,cAAS,GAAG,KAAK,CAAC;QA4BlB,gBAAW,GAAG,GAAG,EAAE;YACjB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAE1B,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;YAE5B,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;YACnC,CAAC;QACH,CAAC,CAAC;QAEF,uBAAkB,GAAG,CAAC,IAAqD,EAAE,EAAE;YAC7E,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC;QAClC,CAAC,CAAC;QAQF,gBAAW,GAAG,GAAG,EAAE;YACjB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAE1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;QAC9B,CAAC,CAAC;QAEF,eAAU,GAAG,GAAG,EAAE;YAChB,IAAI,IAAI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/core';\nimport { SulaMenuListItem, SulaMenuSelectListCustomEvent } from '../../components';\n\n@Component({\n tag: 'sula-dropdown',\n styleUrl: 'sula-dropdown.scss',\n shadow: true,\n})\nexport class SulaDropdown {\n /**\n * Dropdown label\n */\n @Prop({ mutable: true })\n label: string;\n\n /**\n * Dropdown is disabled\n */\n @Prop({ mutable: true })\n disabled: boolean = false;\n\n /**\n * Items for list\n */\n @Prop({ mutable: true })\n items: SulaMenuListItem[] = [];\n\n /**\n * Value for dropdown\n */\n @Prop({ mutable: true })\n value?: SulaMenuListItem;\n\n /**\n * Event emitted when dropdown is clicked\n */\n @Event()\n dropdownClicked: EventEmitter<void>;\n\n /**\n * Event emitted when dropdown is focused\n */\n @Event()\n dropdownFocused: EventEmitter<void>;\n\n /**\n * Event emitted when dropdown is focused out\n */\n @Event()\n dropdownFocusedOut: EventEmitter<void>;\n\n /**\n * Event emitted when item is selected\n */\n @Event()\n menuItemSelected: EventEmitter<SulaMenuListItem>;\n\n @State()\n selectedItem?: SulaMenuListItem;\n\n @State()\n showItems = false;\n\n @State()\n isFocused = false;\n\n node?: HTMLElement;\n\n @Watch('value')\n handleValueChange() {\n if (this.value) {\n this.selectedItem = this.value;\n }\n }\n\n @Listen('click', { target: 'document' })\n handleDocumentClick(event: Event) {\n if (!this.node) return;\n\n const clickInside = this.node.contains(event.target as Node);\n\n if (!clickInside) {\n this.showItems = false;\n }\n }\n\n componentWillLoad() {\n if (this.value) {\n this.selectedItem = this.value;\n }\n }\n\n handleClick = () => {\n if (this.disabled) return;\n\n this.dropdownClicked.emit();\n\n if (this.items.length > 0) {\n this.showItems = !this.showItems;\n }\n };\n\n handleItemSelected = (item: SulaMenuSelectListCustomEvent<SulaMenuListItem>) => {\n this.menuItemSelected.emit(item.detail);\n this.selectedItem = item.detail;\n };\n\n getIconClass() {\n if (this.disabled) return 'text-icon-disabled';\n\n return 'text-text-primary';\n }\n\n handleFocus = () => {\n if (this.disabled) return;\n\n this.isFocused = true;\n this.dropdownFocused.emit();\n };\n\n handleBlur = () => {\n if (this.disabled) return;\n\n this.isFocused = false;\n this.dropdownFocusedOut.emit();\n };\n\n render() {\n return (\n <Host ref={node => (this.node = node)}>\n <div\n class={{\n 'flex justify-between items-center border border-line-input h-[72px] px-16 rounded-xl relative': true,\n 'bg-surface-body cursor-pointer': !this.disabled,\n 'bg-states-bg-disabled': this.disabled,\n 'dropdown-focus': this.isFocused,\n }}\n onClick={this.handleClick}\n tabIndex={0}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n >\n <div class=\"flex flex-col\">\n <label\n class={{\n 'text-base leading-4': !this.selectedItem,\n 'text-sm leading-4 font-bold': !!this.selectedItem,\n 'text-text-primary': !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.label}\n </label>\n\n {!!this.selectedItem && (\n <span\n class={{\n 'text-base leading-4 pt-4': true,\n 'text-text-primary': !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.selectedItem.title}\n </span>\n )}\n </div>\n <div class=\"flex items-center justify-center ml-8 leading-6 text-2xl\">\n <sula-icon icon={`ph ph-caret-${this.showItems ? 'up' : 'down'}`} customClass={`${this.getIconClass()} text-2xl`}></sula-icon>\n </div>\n\n {this.showItems && (\n <div class=\"absolute z-50 top-[72px] left-0 w-full\">\n <sula-menu-select-list items={this.items} fullWidth={true} onItemSelected={this.handleItemSelected}></sula-menu-select-list>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'Components/sula-dropdown',
|
|
3
|
+
tags: ['autodocs'],
|
|
4
|
+
argTypes: {
|
|
5
|
+
label: {
|
|
6
|
+
control: 'text',
|
|
7
|
+
defaultValue: 'Selecione uma opção',
|
|
8
|
+
description: 'Label do dropdown',
|
|
9
|
+
type: {
|
|
10
|
+
required: false,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
disabled: {
|
|
14
|
+
control: 'boolean',
|
|
15
|
+
defaultValue: false,
|
|
16
|
+
description: 'Define se o dropdown está desabilitado',
|
|
17
|
+
type: {
|
|
18
|
+
required: false,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
items: {
|
|
22
|
+
control: 'object',
|
|
23
|
+
defaultValue: [],
|
|
24
|
+
description: 'Lista de itens para o dropdown',
|
|
25
|
+
type: {
|
|
26
|
+
required: false,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
value: {
|
|
30
|
+
control: 'object',
|
|
31
|
+
defaultValue: null,
|
|
32
|
+
description: 'Valor selecionado do dropdown',
|
|
33
|
+
type: {
|
|
34
|
+
required: false,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
dropdownClicked: {
|
|
38
|
+
action: 'dropdownClicked',
|
|
39
|
+
description: 'Evento emitido quando o dropdown é clicado',
|
|
40
|
+
},
|
|
41
|
+
dropdownFocused: {
|
|
42
|
+
action: 'dropdownFocused',
|
|
43
|
+
description: 'Evento emitido quando o dropdown recebe foco',
|
|
44
|
+
},
|
|
45
|
+
dropdownFocusedOut: {
|
|
46
|
+
action: 'dropdownFocusedOut',
|
|
47
|
+
description: 'Evento emitido quando o dropdown perde o foco',
|
|
48
|
+
},
|
|
49
|
+
menuItemSelected: {
|
|
50
|
+
action: 'menuItemSelected',
|
|
51
|
+
description: 'Evento emitido quando um item é selecionado',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
parameters: {
|
|
55
|
+
docs: {
|
|
56
|
+
description: {
|
|
57
|
+
component: 'O componente Dropdown Sula Design System é utilizado para exibição de opções de escolha. Seu intuito é ser usado junto com o botton sheet para selecionar opções variadas de itens em uma lista.',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const Template = args => {
|
|
63
|
+
const container = document.createElement('div');
|
|
64
|
+
container.style.margin = '20px';
|
|
65
|
+
container.style.width = '300px'; // Define uma largura para melhor visualização
|
|
66
|
+
const el = document.createElement('sula-dropdown');
|
|
67
|
+
if (args.label)
|
|
68
|
+
el.setAttribute('label', args.label);
|
|
69
|
+
el.setAttribute('disabled', args.disabled.toString());
|
|
70
|
+
if (args.items && args.items.length > 0) {
|
|
71
|
+
el.items = args.items;
|
|
72
|
+
}
|
|
73
|
+
if (args.value) {
|
|
74
|
+
el.value = args.value;
|
|
75
|
+
}
|
|
76
|
+
// Adiciona os event listeners
|
|
77
|
+
el.addEventListener('dropdownClicked', args.dropdownClicked);
|
|
78
|
+
el.addEventListener('dropdownFocused', args.dropdownFocused);
|
|
79
|
+
el.addEventListener('dropdownFocusedOut', args.dropdownFocusedOut);
|
|
80
|
+
el.addEventListener('menuItemSelected', args.menuItemSelected);
|
|
81
|
+
container.appendChild(el);
|
|
82
|
+
return container;
|
|
83
|
+
};
|
|
84
|
+
export const Default = Template.bind({});
|
|
85
|
+
Default.args = {
|
|
86
|
+
label: 'Selecione uma opção',
|
|
87
|
+
disabled: false,
|
|
88
|
+
items: [
|
|
89
|
+
{ id: '1', title: 'Opção 1' },
|
|
90
|
+
{ id: '2', title: 'Opção 2' },
|
|
91
|
+
{ id: '3', title: 'Opção 3' },
|
|
92
|
+
{ id: '4', title: 'Opção 4' },
|
|
93
|
+
],
|
|
94
|
+
value: null,
|
|
95
|
+
};
|
|
96
|
+
export const WithSelectedValue = Template.bind({});
|
|
97
|
+
WithSelectedValue.args = {
|
|
98
|
+
label: 'País',
|
|
99
|
+
disabled: false,
|
|
100
|
+
items: [
|
|
101
|
+
{ id: '1', title: 'Brasil' },
|
|
102
|
+
{ id: '2', title: 'Argentina' },
|
|
103
|
+
{ id: '3', title: 'Chile' },
|
|
104
|
+
{ id: '4', title: 'Uruguai' },
|
|
105
|
+
],
|
|
106
|
+
value: { id: '1', title: 'Brasil' },
|
|
107
|
+
};
|
|
108
|
+
export const Disabled = Template.bind({});
|
|
109
|
+
Disabled.args = {
|
|
110
|
+
label: 'Dropdown desabilitado',
|
|
111
|
+
disabled: true,
|
|
112
|
+
items: [
|
|
113
|
+
{ id: '1', title: 'Opção 1' },
|
|
114
|
+
{ id: '2', title: 'Opção 2' },
|
|
115
|
+
{ id: '3', title: 'Opção 3' },
|
|
116
|
+
],
|
|
117
|
+
value: null,
|
|
118
|
+
};
|
|
119
|
+
export const DisabledWithValue = Template.bind({});
|
|
120
|
+
DisabledWithValue.args = {
|
|
121
|
+
label: 'Estado',
|
|
122
|
+
disabled: true,
|
|
123
|
+
items: [
|
|
124
|
+
{ id: '1', title: 'São Paulo' },
|
|
125
|
+
{ id: '2', title: 'Rio de Janeiro' },
|
|
126
|
+
{ id: '3', title: 'Minas Gerais' },
|
|
127
|
+
],
|
|
128
|
+
value: { id: '1', title: 'São Paulo' },
|
|
129
|
+
};
|
|
130
|
+
export const EmptyItems = Template.bind({});
|
|
131
|
+
EmptyItems.args = {
|
|
132
|
+
label: 'Sem itens disponíveis',
|
|
133
|
+
disabled: false,
|
|
134
|
+
items: [],
|
|
135
|
+
value: null,
|
|
136
|
+
};
|
|
137
|
+
export const LongItemsList = Template.bind({});
|
|
138
|
+
LongItemsList.args = {
|
|
139
|
+
label: 'Lista com muitos itens',
|
|
140
|
+
disabled: false,
|
|
141
|
+
items: [
|
|
142
|
+
{ id: '1', title: 'Item 1' },
|
|
143
|
+
{ id: '2', title: 'Item 2' },
|
|
144
|
+
{ id: '3', title: 'Item 3' },
|
|
145
|
+
{ id: '4', title: 'Item 4' },
|
|
146
|
+
{ id: '5', title: 'Item 5' },
|
|
147
|
+
{ id: '6', title: 'Item 6' },
|
|
148
|
+
{ id: '7', title: 'Item 7' },
|
|
149
|
+
{ id: '8', title: 'Item 8' },
|
|
150
|
+
{ id: '9', title: 'Item 9' },
|
|
151
|
+
{ id: '10', title: 'Item 10' },
|
|
152
|
+
],
|
|
153
|
+
value: null,
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=sula-dropdown.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-dropdown.stories.js","sourceRoot":"","sources":["../../../src/components/sula-dropdown/sula-dropdown.stories.tsx"],"names":[],"mappings":"AAAA,eAAe;IACb,KAAK,EAAE,0BAA0B;IACjC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,qBAAqB;YACnC,WAAW,EAAE,mBAAmB;YAChC,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,SAAS;YAClB,YAAY,EAAE,KAAK;YACnB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ;YACjB,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,gCAAgC;YAC7C,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ;YACjB,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,+BAA+B;YAC5C,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,eAAe,EAAE;YACf,MAAM,EAAE,iBAAiB;YACzB,WAAW,EAAE,4CAA4C;SAC1D;QACD,eAAe,EAAE;YACf,MAAM,EAAE,iBAAiB;YACzB,WAAW,EAAE,8CAA8C;SAC5D;QACD,kBAAkB,EAAE;YAClB,MAAM,EAAE,oBAAoB;YAC5B,WAAW,EAAE,+CAA+C;SAC7D;QACD,gBAAgB,EAAE;YAChB,MAAM,EAAE,kBAAkB;YAC1B,WAAW,EAAE,6CAA6C;SAC3D;KACF;IACD,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EACP,kMAAkM;aACrM;SACF;KACF;CACF,CAAC;AAEF,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE;IACtB,MAA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E,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC5B,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC5B,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC5B,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC5B,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE;KAC/B;IACD,KAAK,EAAE,IAAI;CACZ,CAAC","sourcesContent":["export default {\n title: 'Components/sula-dropdown',\n tags: ['autodocs'],\n argTypes: {\n label: {\n control: 'text',\n defaultValue: 'Selecione uma opção',\n description: 'Label do dropdown',\n type: {\n required: false,\n },\n },\n disabled: {\n control: 'boolean',\n defaultValue: false,\n description: 'Define se o dropdown está desabilitado',\n type: {\n required: false,\n },\n },\n items: {\n control: 'object',\n defaultValue: [],\n description: 'Lista de itens para o dropdown',\n type: {\n required: false,\n },\n },\n value: {\n control: 'object',\n defaultValue: null,\n description: 'Valor selecionado do dropdown',\n type: {\n required: false,\n },\n },\n dropdownClicked: {\n action: 'dropdownClicked',\n description: 'Evento emitido quando o dropdown é clicado',\n },\n dropdownFocused: {\n action: 'dropdownFocused',\n description: 'Evento emitido quando o dropdown recebe foco',\n },\n dropdownFocusedOut: {\n action: 'dropdownFocusedOut',\n description: 'Evento emitido quando o dropdown perde o foco',\n },\n menuItemSelected: {\n action: 'menuItemSelected',\n description: 'Evento emitido quando um item é selecionado',\n },\n },\n parameters: {\n docs: {\n description: {\n component:\n 'O componente Dropdown Sula Design System é utilizado para exibição de opções de escolha. Seu intuito é ser usado junto com o botton sheet para selecionar opções variadas de itens em uma lista.',\n },\n },\n },\n};\n\nconst Template = args => {\n const container = document.createElement('div');\n container.style.margin = '20px';\n container.style.width = '300px'; // Define uma largura para melhor visualização\n\n const el = document.createElement('sula-dropdown');\n\n if (args.label) el.setAttribute('label', args.label);\n el.setAttribute('disabled', args.disabled.toString());\n\n if (args.items && args.items.length > 0) {\n el.items = args.items;\n }\n\n if (args.value) {\n el.value = args.value;\n }\n\n // Adiciona os event listeners\n el.addEventListener('dropdownClicked', args.dropdownClicked);\n el.addEventListener('dropdownFocused', args.dropdownFocused);\n el.addEventListener('dropdownFocusedOut', args.dropdownFocusedOut);\n el.addEventListener('menuItemSelected', args.menuItemSelected);\n\n container.appendChild(el);\n\n return container;\n};\n\nexport const Default = Template.bind({});\nDefault.args = {\n label: 'Selecione uma opção',\n disabled: false,\n items: [\n { id: '1', title: 'Opção 1' },\n { id: '2', title: 'Opção 2' },\n { id: '3', title: 'Opção 3' },\n { id: '4', title: 'Opção 4' },\n ],\n value: null,\n};\n\nexport const WithSelectedValue = Template.bind({});\nWithSelectedValue.args = {\n label: 'País',\n disabled: false,\n items: [\n { id: '1', title: 'Brasil' },\n { id: '2', title: 'Argentina' },\n { id: '3', title: 'Chile' },\n { id: '4', title: 'Uruguai' },\n ],\n value: { id: '1', title: 'Brasil' },\n};\n\nexport const Disabled = Template.bind({});\nDisabled.args = {\n label: 'Dropdown desabilitado',\n disabled: true,\n items: [\n { id: '1', title: 'Opção 1' },\n { id: '2', title: 'Opção 2' },\n { id: '3', title: 'Opção 3' },\n ],\n value: null,\n};\n\nexport const DisabledWithValue = Template.bind({});\nDisabledWithValue.args = {\n label: 'Estado',\n disabled: true,\n items: [\n { id: '1', title: 'São Paulo' },\n { id: '2', title: 'Rio de Janeiro' },\n { id: '3', title: 'Minas Gerais' },\n ],\n value: { id: '1', title: 'São Paulo' },\n};\n\nexport const EmptyItems = Template.bind({});\nEmptyItems.args = {\n label: 'Sem itens disponíveis',\n disabled: false,\n items: [],\n value: null,\n};\n\nexport const LongItemsList = Template.bind({});\nLongItemsList.args = {\n label: 'Lista com muitos itens',\n disabled: false,\n items: [\n { id: '1', title: 'Item 1' },\n { id: '2', title: 'Item 2' },\n { id: '3', title: 'Item 3' },\n { id: '4', title: 'Item 4' },\n { id: '5', title: 'Item 5' },\n { id: '6', title: 'Item 6' },\n { id: '7', title: 'Item 7' },\n { id: '8', title: 'Item 8' },\n { id: '9', title: 'Item 9' },\n { id: '10', title: 'Item 10' },\n ],\n value: null,\n};\n"]}
|