@sula-tech/webcomponents 0.9.2 → 0.10.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/loader.cjs.js +1 -1
- package/dist/cjs/{sula-avatar_19.cjs.entry.js → sula-avatar_20.cjs.entry.js} +98 -20
- package/dist/cjs/sula-avatar_20.cjs.entry.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-segmented-control/model/sula-segmented-control.model.js +16 -0
- package/dist/collection/components/sula-segmented-control/model/sula-segmented-control.model.js.map +1 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.css +1 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.js +241 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.js.map +1 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.stories.js +352 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.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/sula-timeline-list.js +1 -1
- package/dist/collection/testing/e2e-setup.js +47 -0
- package/dist/collection/testing/e2e-setup.js.map +1 -0
- package/dist/components/{p-Bgqd8BiV.js → p-BZgImhEG.js} +3 -3
- package/dist/components/{p-Bgqd8BiV.js.map → p-BZgImhEG.js.map} +1 -1
- package/dist/components/{p-Uq6L0wCA.js → p-BuA_ueQn.js} +3 -3
- package/dist/components/{p-Uq6L0wCA.js.map → p-BuA_ueQn.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 +1 -1
- package/dist/components/sula-checkbox.js +1 -1
- package/dist/components/sula-chip.js +1 -1
- package/dist/components/sula-dropdown.js +1 -1
- package/dist/components/sula-icon.js +1 -1
- package/dist/components/sula-modal.js +2 -2
- package/dist/components/sula-progress-bar.js +1 -1
- package/dist/components/sula-search-bar.js +1 -1
- package/dist/components/sula-segmented-control.d.ts +11 -0
- package/dist/components/sula-segmented-control.js +113 -0
- package/dist/components/sula-segmented-control.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.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{sula-avatar_19.entry.js → sula-avatar_20.entry.js} +98 -21
- package/dist/esm/sula-avatar_20.entry.js.map +1 -0
- package/dist/esm/webcomponents.js +1 -1
- package/dist/types/components/sula-segmented-control/model/sula-segmented-control.model.d.ts +19 -0
- package/dist/types/components/sula-segmented-control/sula-segmented-control.d.ts +37 -0
- package/dist/types/components/sula-segmented-control/sula-segmented-control.stories.d.ts +136 -0
- package/dist/types/components.d.ts +84 -0
- package/dist/types/testing/e2e-setup.d.ts +1 -0
- package/dist/webcomponents/{p-9f81911a.entry.js → p-fbc8b4d8.entry.js} +186 -83
- package/dist/webcomponents/p-fbc8b4d8.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +6 -1
- package/package.json +5 -2
- package/dist/cjs/sula-avatar_19.cjs.entry.js.map +0 -1
- package/dist/esm/sula-avatar_19.entry.js.map +0 -1
- package/dist/webcomponents/p-9f81911a.entry.js.map +0 -1
package/dist/collection/components/sula-segmented-control/model/sula-segmented-control.model.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export var SulaSegmentedControlType;
|
|
2
|
+
(function (SulaSegmentedControlType) {
|
|
3
|
+
SulaSegmentedControlType["Icon"] = "icon";
|
|
4
|
+
SulaSegmentedControlType["Text"] = "text";
|
|
5
|
+
})(SulaSegmentedControlType || (SulaSegmentedControlType = {}));
|
|
6
|
+
export var SulaSegmentedControlSize;
|
|
7
|
+
(function (SulaSegmentedControlSize) {
|
|
8
|
+
SulaSegmentedControlSize["Small"] = "small";
|
|
9
|
+
SulaSegmentedControlSize["Default"] = "default";
|
|
10
|
+
})(SulaSegmentedControlSize || (SulaSegmentedControlSize = {}));
|
|
11
|
+
export var SulaSegmentedControlColor;
|
|
12
|
+
(function (SulaSegmentedControlColor) {
|
|
13
|
+
SulaSegmentedControlColor["White"] = "white";
|
|
14
|
+
SulaSegmentedControlColor["Gray"] = "gray";
|
|
15
|
+
})(SulaSegmentedControlColor || (SulaSegmentedControlColor = {}));
|
|
16
|
+
//# sourceMappingURL=sula-segmented-control.model.js.map
|
package/dist/collection/components/sula-segmented-control/model/sula-segmented-control.model.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-segmented-control.model.js","sourceRoot":"","sources":["../../../../src/components/sula-segmented-control/model/sula-segmented-control.model.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,yCAAa,CAAA;IACb,yCAAa,CAAA;AACf,CAAC,EAHW,wBAAwB,KAAxB,wBAAwB,QAGnC;AAED,MAAM,CAAN,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,2CAAe,CAAA;IACf,+CAAmB,CAAA;AACrB,CAAC,EAHW,wBAAwB,KAAxB,wBAAwB,QAGnC;AAED,MAAM,CAAN,IAAY,yBAGX;AAHD,WAAY,yBAAyB;IACnC,4CAAe,CAAA;IACf,0CAAa,CAAA;AACf,CAAC,EAHW,yBAAyB,KAAzB,yBAAyB,QAGpC","sourcesContent":["export enum SulaSegmentedControlType {\n Icon = 'icon',\n Text = 'text',\n}\n\nexport enum SulaSegmentedControlSize {\n Small = 'small',\n Default = 'default',\n}\n\nexport enum SulaSegmentedControlColor {\n White = 'white',\n Gray = 'gray',\n}\n\nexport interface SulaSegmentedControlOption {\n label?: string;\n addChevron?: boolean;\n value: string | number;\n icon?: string;\n selected?: boolean;\n}\n"]}
|
|
@@ -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}: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:#012b15;--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:#330d00;--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:#402705;--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:#401204;--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:#402301;--color-gray-50:#fff;--color-gray-100:#f3f4f4;--color-gray-200:#e5e6e6;--color-gray-300:#bfc0c0;--color-gray-400:#acaeae;--color-gray-500:#949595;--color-gray-600:#737575;--color-gray-700:#6c6e6e;--color-gray-800:#313333;--color-gray-900:#272929;--color-gray-950:#191d1d;--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:#071e40;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:rgba(25,29,29,.02);--color-black-opacity-100:rgba(25,29,29,.05);--color-black-opacity-200:rgba(25,29,29,.11);--color-black-opacity-300:rgba(25,29,29,.28);--color-black-opacity-400:rgba(25,29,29,.36);--color-black-opacity-500:rgba(25,29,29,.44);--color-black-opacity-600:rgba(25,29,29,.62);--color-black-opacity-700:rgba(25,29,29,.64);--color-black-opacity-800:rgba(25,29,29,.72);--color-black-opacity-900:rgba(25,29,29,.8);--color-black-opacity-950:rgba(25,29,29,.96);--color-shadow-opacity-50:rgba(0,0,0,.04);--color-shadow-opacity-100:rgba(0,0,0,.06);--color-shadow-opacity-200:rgba(0,0,0,.12);--color-shadow-opacity-300:rgba(0,0,0,.2);--color-shadow-opacity-400:rgba(0,0,0,.32);--color-shadow-opacity-500:rgba(0,0,0,.5);--color-shadow-opacity-600:rgba(0,0,0,.55);--color-shadow-opacity-700:rgba(0,0,0,.64);--color-shadow-opacity-800:rgba(0,0,0,.73);--color-shadow-opacity-900:rgba(0,0,0,.8);--color-shadow-opacity-950:rgba(0,0,0,.91);--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:#f3f4f4;--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:#313333;--color-text-secondary:#6c6e6e;--color-text-disabled:#949595;--color-text-link:#1355b4;--color-states-empty-bg-hover:rgba(25,29,29,.05);--color-states-empty-bg-pressed:rgba(25,29,29,.11);--color-states-bg-disabled:rgba(25,29,29,.02);--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:#e5e6e6;--color-states-negative-pressed:#bfc0c0;--color-icon-primary:#6c6e6e;--color-icon-secondary:#fff;--color-icon-tertiary:#b30404;--color-icon-disabled:#acaeae;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f3f4f4;--color-neutral-neutral-3:#acaeae;--color-neutral-neutral-4:#949595;--color-neutral-neutral-5:#737575;--color-neutral-neutral-6:#6c6e6e;--color-neutral-neutral-7:#313333;--color-neutral-neutral-8:#272929;--color-negative-negative-1:#fff;--color-negative-negative-2:#313333;--color-opacity-body:#fffc;--color-opacity-on-body:rgba(25,29,29,.02);--color-opacity-overlay:rgba(25,29,29,.62);--color-opacity-on-overlay:#ffffff1a;--color-line-input:#949595;--color-line-general-strong:#bfc0c0;--color-line-general:#e5e6e6;--color-line-hair:rgba(25,29,29,.05);--color-box-shadow-body:#fff;--color-box-shadow-shadow-color-1:rgba(0,0,0,.04);--color-box-shadow-shadow-color-2:rgba(0,0,0,.06)}.static{position:static}.ml-4{margin-left:.25rem}.flex{display:flex}.w-fit{width:fit-content}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-3xl{border-radius:1.5rem}.rounded-xxl{border-radius:18.75rem}.bg-box-shadow-body{background-color:var(--color-box-shadow-body)}.bg-brand-primary{background-color:var(--color-brand-primary)}.bg-opacity-body{background-color:var(--color-opacity-body)}.bg-opacity-on-body{background-color:var(--color-opacity-on-body)}.p-2{padding:.125rem}.px-16{padding-left:1rem;padding-right:1rem}.px-20{padding-left:1.25rem;padding-right:1.25rem}.py-12{padding-bottom:.75rem;padding-top:.75rem}.py-8{padding-bottom:.5rem;padding-top:.5rem}.text-base{font-size:1rem;line-height:1.5rem}.text-label-medium-bold{font-size:1rem;font-weight:700;letter-spacing:0;line-height:20px}.text-paragraph-medium-regular{font-size:1rem;font-weight:400;letter-spacing:0;line-height:24px}.text-xl{font-size:1.25rem;line-height:1.75rem}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.text-brand-primary{color:var(--color-brand-primary)}.text-icon-primary{color:var(--color-icon-primary)}.text-negative-negative-1{color:var(--color-negative-negative-1)}.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.backdrop-blur-\[20px\]{--tw-backdrop-blur:blur(20px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\:bg-box-shadow-body:hover{background-color:var(--color-box-shadow-body)}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { SulaSegmentedControlColor, SulaSegmentedControlSize, SulaSegmentedControlType } from "./model/sula-segmented-control.model";
|
|
3
|
+
export class SulaSegmentedControl {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Items for the segmented control.
|
|
7
|
+
*/
|
|
8
|
+
this.items = [];
|
|
9
|
+
/**
|
|
10
|
+
* Segmented control type.
|
|
11
|
+
*/
|
|
12
|
+
this.type = SulaSegmentedControlType.Text;
|
|
13
|
+
/**
|
|
14
|
+
* Segmented control size.
|
|
15
|
+
*/
|
|
16
|
+
this.size = SulaSegmentedControlSize.Default;
|
|
17
|
+
/**
|
|
18
|
+
* Segmented control color.
|
|
19
|
+
*/
|
|
20
|
+
this.color = SulaSegmentedControlColor.White;
|
|
21
|
+
}
|
|
22
|
+
handleItemClick(selectedItem) {
|
|
23
|
+
this.items = this.items.map(item => (Object.assign(Object.assign({}, item), { selected: item.value === selectedItem.value })));
|
|
24
|
+
this.itemClicked.emit(Object.assign(Object.assign({}, selectedItem), { selected: true }));
|
|
25
|
+
}
|
|
26
|
+
handleItemHover(hoveredItem) {
|
|
27
|
+
this.itemHovered.emit(hoveredItem);
|
|
28
|
+
}
|
|
29
|
+
handleItemBlur(blurredItem) {
|
|
30
|
+
this.itemBlur.emit(blurredItem);
|
|
31
|
+
}
|
|
32
|
+
getCaretIconClass(item) {
|
|
33
|
+
if (this.type === SulaSegmentedControlType.Icon) {
|
|
34
|
+
return item.selected ? 'text-negative-negative-1' : 'text-icon-primary';
|
|
35
|
+
}
|
|
36
|
+
return item.selected ? 'text-brand-primary' : 'text-text-primary';
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
return (h(Host, { key: 'e1dfe69feaf9d299a87c3006849751fb053e1410' }, h("div", { key: '77ce9955a1ed4a99c3dc35c76b4367a90b2dad61', class: {
|
|
40
|
+
'flex flex-row items-center rounded-xxl p-2 w-fit backdrop-blur-[20px]': true,
|
|
41
|
+
'bg-opacity-on-body': this.color === SulaSegmentedControlColor.Gray,
|
|
42
|
+
'bg-opacity-body': this.color === SulaSegmentedControlColor.White,
|
|
43
|
+
} }, this.items.map(item => (h("div", { class: {
|
|
44
|
+
'rounded-3xl flex justify-center items-center cursor-pointer transition': true,
|
|
45
|
+
'py-12 px-20': this.size === SulaSegmentedControlSize.Default,
|
|
46
|
+
'py-8 px-16': this.size === SulaSegmentedControlSize.Small,
|
|
47
|
+
'bg-box-shadow-body': this.type === SulaSegmentedControlType.Text && item.selected,
|
|
48
|
+
'bg-brand-primary': this.type === SulaSegmentedControlType.Icon && item.selected,
|
|
49
|
+
'hover:bg-box-shadow-body': !item.selected,
|
|
50
|
+
}, onClick: () => this.handleItemClick(item), onMouseEnter: () => this.handleItemHover(item), onMouseLeave: () => this.handleItemBlur(item) }, this.type === SulaSegmentedControlType.Text ? (h("span", { class: {
|
|
51
|
+
'text-brand-primary text-label-medium-bold leading-5': item.selected,
|
|
52
|
+
'text-text-secondary text-paragraph-medium-regular leading-5': !item.selected,
|
|
53
|
+
} }, item.label)) : (h("sula-icon", { class: "flex items-center justify-center", icon: item.icon, customClass: `${item.selected ? 'text-negative-negative-1' : 'text-icon-primary'} text-xl leading-4` })), item.addChevron && h("sula-icon", { class: "ml-4 flex", icon: "ph-bold ph-caret-down", customClass: `${this.getCaretIconClass(item)} text-base leading-4` })))))));
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "sula-segmented-control"; }
|
|
56
|
+
static get encapsulation() { return "shadow"; }
|
|
57
|
+
static get originalStyleUrls() {
|
|
58
|
+
return {
|
|
59
|
+
"$": ["sula-segmented-control.scss"]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
static get styleUrls() {
|
|
63
|
+
return {
|
|
64
|
+
"$": ["sula-segmented-control.css"]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
static get properties() {
|
|
68
|
+
return {
|
|
69
|
+
"items": {
|
|
70
|
+
"type": "unknown",
|
|
71
|
+
"attribute": "items",
|
|
72
|
+
"mutable": true,
|
|
73
|
+
"complexType": {
|
|
74
|
+
"original": "SulaSegmentedControlOption[]",
|
|
75
|
+
"resolved": "SulaSegmentedControlOption[]",
|
|
76
|
+
"references": {
|
|
77
|
+
"SulaSegmentedControlOption": {
|
|
78
|
+
"location": "import",
|
|
79
|
+
"path": "./model/sula-segmented-control.model",
|
|
80
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlOption"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"required": false,
|
|
85
|
+
"optional": false,
|
|
86
|
+
"docs": {
|
|
87
|
+
"tags": [],
|
|
88
|
+
"text": "Items for the segmented control."
|
|
89
|
+
},
|
|
90
|
+
"getter": false,
|
|
91
|
+
"setter": false,
|
|
92
|
+
"defaultValue": "[]"
|
|
93
|
+
},
|
|
94
|
+
"type": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"attribute": "type",
|
|
97
|
+
"mutable": true,
|
|
98
|
+
"complexType": {
|
|
99
|
+
"original": "SulaSegmentedControlType",
|
|
100
|
+
"resolved": "SulaSegmentedControlType.Icon | SulaSegmentedControlType.Text",
|
|
101
|
+
"references": {
|
|
102
|
+
"SulaSegmentedControlType": {
|
|
103
|
+
"location": "import",
|
|
104
|
+
"path": "./model/sula-segmented-control.model",
|
|
105
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlType"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": "Segmented control type."
|
|
114
|
+
},
|
|
115
|
+
"getter": false,
|
|
116
|
+
"setter": false,
|
|
117
|
+
"reflect": false,
|
|
118
|
+
"defaultValue": "SulaSegmentedControlType.Text"
|
|
119
|
+
},
|
|
120
|
+
"size": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"attribute": "size",
|
|
123
|
+
"mutable": true,
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "SulaSegmentedControlSize",
|
|
126
|
+
"resolved": "SulaSegmentedControlSize.Default | SulaSegmentedControlSize.Small",
|
|
127
|
+
"references": {
|
|
128
|
+
"SulaSegmentedControlSize": {
|
|
129
|
+
"location": "import",
|
|
130
|
+
"path": "./model/sula-segmented-control.model",
|
|
131
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlSize"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": "Segmented control size."
|
|
140
|
+
},
|
|
141
|
+
"getter": false,
|
|
142
|
+
"setter": false,
|
|
143
|
+
"reflect": false,
|
|
144
|
+
"defaultValue": "SulaSegmentedControlSize.Default"
|
|
145
|
+
},
|
|
146
|
+
"color": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"attribute": "color",
|
|
149
|
+
"mutable": true,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "SulaSegmentedControlColor",
|
|
152
|
+
"resolved": "SulaSegmentedControlColor.Gray | SulaSegmentedControlColor.White",
|
|
153
|
+
"references": {
|
|
154
|
+
"SulaSegmentedControlColor": {
|
|
155
|
+
"location": "import",
|
|
156
|
+
"path": "./model/sula-segmented-control.model",
|
|
157
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlColor"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"required": false,
|
|
162
|
+
"optional": false,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": "Segmented control color."
|
|
166
|
+
},
|
|
167
|
+
"getter": false,
|
|
168
|
+
"setter": false,
|
|
169
|
+
"reflect": false,
|
|
170
|
+
"defaultValue": "SulaSegmentedControlColor.White"
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
static get events() {
|
|
175
|
+
return [{
|
|
176
|
+
"method": "itemClicked",
|
|
177
|
+
"name": "itemClicked",
|
|
178
|
+
"bubbles": true,
|
|
179
|
+
"cancelable": true,
|
|
180
|
+
"composed": true,
|
|
181
|
+
"docs": {
|
|
182
|
+
"tags": [],
|
|
183
|
+
"text": "Emitted when an item is clicked."
|
|
184
|
+
},
|
|
185
|
+
"complexType": {
|
|
186
|
+
"original": "SulaSegmentedControlOption",
|
|
187
|
+
"resolved": "SulaSegmentedControlOption",
|
|
188
|
+
"references": {
|
|
189
|
+
"SulaSegmentedControlOption": {
|
|
190
|
+
"location": "import",
|
|
191
|
+
"path": "./model/sula-segmented-control.model",
|
|
192
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlOption"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
"method": "itemHovered",
|
|
198
|
+
"name": "itemHovered",
|
|
199
|
+
"bubbles": true,
|
|
200
|
+
"cancelable": true,
|
|
201
|
+
"composed": true,
|
|
202
|
+
"docs": {
|
|
203
|
+
"tags": [],
|
|
204
|
+
"text": "Emitted when an item is hovered."
|
|
205
|
+
},
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "SulaSegmentedControlOption",
|
|
208
|
+
"resolved": "SulaSegmentedControlOption",
|
|
209
|
+
"references": {
|
|
210
|
+
"SulaSegmentedControlOption": {
|
|
211
|
+
"location": "import",
|
|
212
|
+
"path": "./model/sula-segmented-control.model",
|
|
213
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlOption"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
"method": "itemBlur",
|
|
219
|
+
"name": "itemBlur",
|
|
220
|
+
"bubbles": true,
|
|
221
|
+
"cancelable": true,
|
|
222
|
+
"composed": true,
|
|
223
|
+
"docs": {
|
|
224
|
+
"tags": [],
|
|
225
|
+
"text": "Emitted when an item is blurred."
|
|
226
|
+
},
|
|
227
|
+
"complexType": {
|
|
228
|
+
"original": "SulaSegmentedControlOption",
|
|
229
|
+
"resolved": "SulaSegmentedControlOption",
|
|
230
|
+
"references": {
|
|
231
|
+
"SulaSegmentedControlOption": {
|
|
232
|
+
"location": "import",
|
|
233
|
+
"path": "./model/sula-segmented-control.model",
|
|
234
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlOption"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=sula-segmented-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-segmented-control.js","sourceRoot":"","sources":["../../../src/components/sula-segmented-control/sula-segmented-control.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport { SulaSegmentedControlColor, SulaSegmentedControlOption, SulaSegmentedControlSize, SulaSegmentedControlType } from './model/sula-segmented-control.model';\n\n@Component({\n tag: 'sula-segmented-control',\n styleUrl: 'sula-segmented-control.scss',\n shadow: true,\n})\nexport class SulaSegmentedControl {\n /**\n * Items for the segmented control.\n */\n @Prop({ mutable: true })\n items: SulaSegmentedControlOption[] = [];\n\n /**\n * Segmented control type.\n */\n @Prop({ mutable: true })\n type: SulaSegmentedControlType = SulaSegmentedControlType.Text;\n\n /**\n * Segmented control size.\n */\n @Prop({ mutable: true })\n size: SulaSegmentedControlSize = SulaSegmentedControlSize.Default;\n\n /**\n * Segmented control color.\n */\n @Prop({ mutable: true })\n color: SulaSegmentedControlColor = SulaSegmentedControlColor.White;\n\n /**\n * Emitted when an item is clicked.\n */\n @Event()\n itemClicked: EventEmitter<SulaSegmentedControlOption>;\n\n /**\n * Emitted when an item is hovered.\n */\n @Event()\n itemHovered: EventEmitter<SulaSegmentedControlOption>;\n\n /**\n * Emitted when an item is blurred.\n */\n @Event()\n itemBlur: EventEmitter<SulaSegmentedControlOption>;\n\n handleItemClick(selectedItem: SulaSegmentedControlOption) {\n this.items = this.items.map(item => ({\n ...item,\n selected: item.value === selectedItem.value,\n }));\n\n this.itemClicked.emit({ ...selectedItem, selected: true });\n }\n\n handleItemHover(hoveredItem: SulaSegmentedControlOption) {\n this.itemHovered.emit(hoveredItem);\n }\n\n handleItemBlur(blurredItem: SulaSegmentedControlOption) {\n this.itemBlur.emit(blurredItem);\n }\n\n getCaretIconClass(item: SulaSegmentedControlOption) {\n if (this.type === SulaSegmentedControlType.Icon) {\n return item.selected ? 'text-negative-negative-1' : 'text-icon-primary';\n }\n return item.selected ? 'text-brand-primary' : 'text-text-primary';\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'flex flex-row items-center rounded-xxl p-2 w-fit backdrop-blur-[20px]': true,\n 'bg-opacity-on-body': this.color === SulaSegmentedControlColor.Gray,\n 'bg-opacity-body': this.color === SulaSegmentedControlColor.White,\n }}\n >\n {this.items.map(item => (\n <div\n class={{\n 'rounded-3xl flex justify-center items-center cursor-pointer transition': true,\n 'py-12 px-20': this.size === SulaSegmentedControlSize.Default,\n 'py-8 px-16': this.size === SulaSegmentedControlSize.Small,\n 'bg-box-shadow-body': this.type === SulaSegmentedControlType.Text && item.selected,\n 'bg-brand-primary': this.type === SulaSegmentedControlType.Icon && item.selected,\n 'hover:bg-box-shadow-body': !item.selected,\n }}\n onClick={() => this.handleItemClick(item)}\n onMouseEnter={() => this.handleItemHover(item)}\n onMouseLeave={() => this.handleItemBlur(item)}\n >\n {this.type === SulaSegmentedControlType.Text ? (\n <span\n class={{\n 'text-brand-primary text-label-medium-bold leading-5': item.selected,\n 'text-text-secondary text-paragraph-medium-regular leading-5': !item.selected,\n }}\n >\n {item.label}\n </span>\n ) : (\n <sula-icon\n class=\"flex items-center justify-center\"\n icon={item.icon}\n customClass={`${item.selected ? 'text-negative-negative-1' : 'text-icon-primary'} text-xl leading-4`}\n ></sula-icon>\n )}\n {item.addChevron && <sula-icon class=\"ml-4 flex\" icon=\"ph-bold ph-caret-down\" customClass={`${this.getCaretIconClass(item)} text-base leading-4`}></sula-icon>}\n </div>\n ))}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { SulaSegmentedControlColor, SulaSegmentedControlSize, SulaSegmentedControlType } from "./model/sula-segmented-control.model";
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/sula-segmented-control',
|
|
4
|
+
tags: ['autodocs'],
|
|
5
|
+
argTypes: {
|
|
6
|
+
items: {
|
|
7
|
+
control: 'object',
|
|
8
|
+
description: 'Array de opções para o controle segmentado',
|
|
9
|
+
table: {
|
|
10
|
+
type: { summary: 'SulaSegmentedControlOption[]' },
|
|
11
|
+
defaultValue: { summary: '[]' },
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
type: {
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
options: Object.values(SulaSegmentedControlType),
|
|
17
|
+
description: 'Tipo do controle segmentado (texto ou ícone)',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'SulaSegmentedControlType' },
|
|
20
|
+
defaultValue: { summary: 'SulaSegmentedControlType.Text' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
control: { type: 'select' },
|
|
25
|
+
options: Object.values(SulaSegmentedControlSize),
|
|
26
|
+
description: 'Tamanho do controle segmentado',
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: 'SulaSegmentedControlSize' },
|
|
29
|
+
defaultValue: { summary: 'SulaSegmentedControlSize.Default' },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
color: {
|
|
33
|
+
control: { type: 'select' },
|
|
34
|
+
options: Object.values(SulaSegmentedControlColor),
|
|
35
|
+
description: 'Cor de fundo do controle segmentado',
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: 'SulaSegmentedControlColor' },
|
|
38
|
+
defaultValue: { summary: 'SulaSegmentedControlColor.White' },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
itemClicked: {
|
|
42
|
+
action: 'itemClicked',
|
|
43
|
+
description: 'Evento emitido quando um item é clicado',
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: 'CustomEvent<SulaSegmentedControlOption>' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
itemHovered: {
|
|
49
|
+
action: 'itemHovered',
|
|
50
|
+
description: 'Evento emitido quando um item recebe hover',
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: 'CustomEvent<SulaSegmentedControlOption>' },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
itemBlur: {
|
|
56
|
+
action: 'itemBlur',
|
|
57
|
+
description: 'Evento emitido quando um item perde o foco',
|
|
58
|
+
table: {
|
|
59
|
+
type: { summary: 'CustomEvent<SulaSegmentedControlOption>' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
parameters: {
|
|
64
|
+
docs: {
|
|
65
|
+
description: {
|
|
66
|
+
component: `
|
|
67
|
+
O componente **Sula Segmented Control** é utilizado para permitir que os usuários escolham entre
|
|
68
|
+
múltiplas opções mutuamente exclusivas. É ideal para navegação entre visualizações ou filtros.
|
|
69
|
+
|
|
70
|
+
### Características principais:
|
|
71
|
+
- Suporte a diferentes tipos (Texto e Ícone)
|
|
72
|
+
- Diferentes tamanhos (Default e Small)
|
|
73
|
+
- Cores de fundo personalizáveis (White e Gray)
|
|
74
|
+
- Suporte a chevron adicional nas opções
|
|
75
|
+
- Eventos de clique, hover e blur
|
|
76
|
+
`,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
const Template = args => {
|
|
82
|
+
const container = document.createElement('div');
|
|
83
|
+
container.style.margin = '20px';
|
|
84
|
+
container.style.display = 'flex';
|
|
85
|
+
container.style.alignItems = 'center';
|
|
86
|
+
container.style.justifyContent = 'center';
|
|
87
|
+
container.style.minHeight = '80px';
|
|
88
|
+
if (args.color === SulaSegmentedControlColor.White) {
|
|
89
|
+
container.style.backgroundColor = '#f5f5f5';
|
|
90
|
+
container.style.padding = '20px';
|
|
91
|
+
container.style.borderRadius = '8px';
|
|
92
|
+
}
|
|
93
|
+
const el = document.createElement('sula-segmented-control');
|
|
94
|
+
el.items = args.items;
|
|
95
|
+
el.setAttribute('type', args.type);
|
|
96
|
+
el.setAttribute('size', args.size);
|
|
97
|
+
el.setAttribute('color', args.color);
|
|
98
|
+
el.addEventListener('itemClicked', args.itemClicked);
|
|
99
|
+
el.addEventListener('itemHovered', args.itemHovered);
|
|
100
|
+
el.addEventListener('itemBlur', args.itemBlur);
|
|
101
|
+
container.appendChild(el);
|
|
102
|
+
return container;
|
|
103
|
+
};
|
|
104
|
+
export const Playground = Template.bind({});
|
|
105
|
+
Playground.args = {
|
|
106
|
+
items: [
|
|
107
|
+
{ label: 'Opção 1', value: '1', selected: true },
|
|
108
|
+
{ label: 'Opção 2', value: '2' },
|
|
109
|
+
{ label: 'Opção 3', value: '3' },
|
|
110
|
+
],
|
|
111
|
+
type: SulaSegmentedControlType.Text,
|
|
112
|
+
size: SulaSegmentedControlSize.Default,
|
|
113
|
+
color: SulaSegmentedControlColor.White,
|
|
114
|
+
};
|
|
115
|
+
export const TextType = Template.bind({});
|
|
116
|
+
TextType.args = {
|
|
117
|
+
items: [
|
|
118
|
+
{ label: 'Todos', value: 'all', selected: true },
|
|
119
|
+
{ label: 'Ativos', value: 'active' },
|
|
120
|
+
{ label: 'Inativos', value: 'inactive' },
|
|
121
|
+
],
|
|
122
|
+
type: SulaSegmentedControlType.Text,
|
|
123
|
+
size: SulaSegmentedControlSize.Default,
|
|
124
|
+
color: SulaSegmentedControlColor.White,
|
|
125
|
+
};
|
|
126
|
+
TextType.parameters = {
|
|
127
|
+
docs: {
|
|
128
|
+
description: {
|
|
129
|
+
story: 'Controle segmentado com texto.',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
export const IconType = Template.bind({});
|
|
134
|
+
IconType.args = {
|
|
135
|
+
items: [
|
|
136
|
+
{ icon: 'ph ph-house', value: 'home', selected: true },
|
|
137
|
+
{ icon: 'ph ph-user', value: 'user' },
|
|
138
|
+
{ icon: 'ph ph-gear', value: 'settings' },
|
|
139
|
+
],
|
|
140
|
+
type: SulaSegmentedControlType.Icon,
|
|
141
|
+
size: SulaSegmentedControlSize.Default,
|
|
142
|
+
color: SulaSegmentedControlColor.White,
|
|
143
|
+
};
|
|
144
|
+
IconType.parameters = {
|
|
145
|
+
docs: {
|
|
146
|
+
description: {
|
|
147
|
+
story: 'Controle segmentado com ícones.',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
export const WithChevron = Template.bind({});
|
|
152
|
+
WithChevron.args = {
|
|
153
|
+
items: [
|
|
154
|
+
{ label: 'Filtro 1', value: '1', addChevron: true, selected: true },
|
|
155
|
+
{ label: 'Filtro 2', value: '2', addChevron: true },
|
|
156
|
+
{ label: 'Filtro 3', value: '3', addChevron: true },
|
|
157
|
+
],
|
|
158
|
+
type: SulaSegmentedControlType.Text,
|
|
159
|
+
size: SulaSegmentedControlSize.Default,
|
|
160
|
+
color: SulaSegmentedControlColor.White,
|
|
161
|
+
};
|
|
162
|
+
WithChevron.parameters = {
|
|
163
|
+
docs: {
|
|
164
|
+
description: {
|
|
165
|
+
story: 'Controle segmentado com chevron nas opções.',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
export const SmallSize = Template.bind({});
|
|
170
|
+
SmallSize.args = {
|
|
171
|
+
items: [
|
|
172
|
+
{ label: 'Pequeno 1', value: '1', selected: true },
|
|
173
|
+
{ label: 'Pequeno 2', value: '2' },
|
|
174
|
+
{ label: 'Pequeno 3', value: '3' },
|
|
175
|
+
],
|
|
176
|
+
type: SulaSegmentedControlType.Text,
|
|
177
|
+
size: SulaSegmentedControlSize.Small,
|
|
178
|
+
color: SulaSegmentedControlColor.White,
|
|
179
|
+
};
|
|
180
|
+
SmallSize.parameters = {
|
|
181
|
+
docs: {
|
|
182
|
+
description: {
|
|
183
|
+
story: 'Controle segmentado em tamanho pequeno.',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
export const Sizes = () => {
|
|
188
|
+
const container = document.createElement('div');
|
|
189
|
+
container.style.display = 'flex';
|
|
190
|
+
container.style.flexDirection = 'column';
|
|
191
|
+
container.style.gap = '16px';
|
|
192
|
+
container.style.alignItems = 'center';
|
|
193
|
+
container.style.padding = '20px';
|
|
194
|
+
container.style.backgroundColor = '#f5f5f5';
|
|
195
|
+
container.style.borderRadius = '8px';
|
|
196
|
+
const defaultControl = document.createElement('sula-segmented-control');
|
|
197
|
+
defaultControl.items = [
|
|
198
|
+
{ label: 'Default 1', value: '1', selected: true },
|
|
199
|
+
{ label: 'Default 2', value: '2' },
|
|
200
|
+
{ label: 'Default 3', value: '3' },
|
|
201
|
+
];
|
|
202
|
+
defaultControl.setAttribute('size', SulaSegmentedControlSize.Default);
|
|
203
|
+
const smallControl = document.createElement('sula-segmented-control');
|
|
204
|
+
smallControl.items = [
|
|
205
|
+
{ label: 'Small 1', value: '1', selected: true },
|
|
206
|
+
{ label: 'Small 2', value: '2' },
|
|
207
|
+
{ label: 'Small 3', value: '3' },
|
|
208
|
+
];
|
|
209
|
+
smallControl.setAttribute('size', SulaSegmentedControlSize.Small);
|
|
210
|
+
container.appendChild(defaultControl);
|
|
211
|
+
container.appendChild(smallControl);
|
|
212
|
+
return container;
|
|
213
|
+
};
|
|
214
|
+
Sizes.parameters = {
|
|
215
|
+
docs: {
|
|
216
|
+
description: {
|
|
217
|
+
story: 'Comparação entre os diferentes tamanhos disponíveis.',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
export const GrayBackground = Template.bind({});
|
|
222
|
+
GrayBackground.args = {
|
|
223
|
+
items: [
|
|
224
|
+
{ label: 'Opção 1', value: '1', selected: true },
|
|
225
|
+
{ label: 'Opção 2', value: '2' },
|
|
226
|
+
{ label: 'Opção 3', value: '3' },
|
|
227
|
+
],
|
|
228
|
+
type: SulaSegmentedControlType.Text,
|
|
229
|
+
size: SulaSegmentedControlSize.Default,
|
|
230
|
+
color: SulaSegmentedControlColor.Gray,
|
|
231
|
+
};
|
|
232
|
+
GrayBackground.parameters = {
|
|
233
|
+
docs: {
|
|
234
|
+
description: {
|
|
235
|
+
story: 'Controle segmentado com fundo cinza.',
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
export const ColorVariations = () => {
|
|
240
|
+
const container = document.createElement('div');
|
|
241
|
+
container.style.display = 'flex';
|
|
242
|
+
container.style.flexDirection = 'column';
|
|
243
|
+
container.style.gap = '16px';
|
|
244
|
+
container.style.alignItems = 'center';
|
|
245
|
+
container.style.padding = '20px';
|
|
246
|
+
container.style.backgroundColor = '#f5f5f5';
|
|
247
|
+
container.style.borderRadius = '8px';
|
|
248
|
+
const whiteControl = document.createElement('sula-segmented-control');
|
|
249
|
+
whiteControl.items = [
|
|
250
|
+
{ label: 'White 1', value: '1', selected: true },
|
|
251
|
+
{ label: 'White 2', value: '2' },
|
|
252
|
+
{ label: 'White 3', value: '3' },
|
|
253
|
+
];
|
|
254
|
+
whiteControl.setAttribute('color', SulaSegmentedControlColor.White);
|
|
255
|
+
const grayControl = document.createElement('sula-segmented-control');
|
|
256
|
+
grayControl.items = [
|
|
257
|
+
{ label: 'Gray 1', value: '1', selected: true },
|
|
258
|
+
{ label: 'Gray 2', value: '2' },
|
|
259
|
+
{ label: 'Gray 3', value: '3' },
|
|
260
|
+
];
|
|
261
|
+
grayControl.setAttribute('color', SulaSegmentedControlColor.Gray);
|
|
262
|
+
container.appendChild(whiteControl);
|
|
263
|
+
container.appendChild(grayControl);
|
|
264
|
+
return container;
|
|
265
|
+
};
|
|
266
|
+
ColorVariations.parameters = {
|
|
267
|
+
docs: {
|
|
268
|
+
description: {
|
|
269
|
+
story: 'Diferentes cores de fundo disponíveis.',
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
export const ManyOptions = Template.bind({});
|
|
274
|
+
ManyOptions.args = {
|
|
275
|
+
items: [
|
|
276
|
+
{ label: 'Janeiro', value: '1', selected: true },
|
|
277
|
+
{ label: 'Fevereiro', value: '2' },
|
|
278
|
+
{ label: 'Março', value: '3' },
|
|
279
|
+
{ label: 'Abril', value: '4' },
|
|
280
|
+
{ label: 'Maio', value: '5' },
|
|
281
|
+
],
|
|
282
|
+
type: SulaSegmentedControlType.Text,
|
|
283
|
+
size: SulaSegmentedControlSize.Default,
|
|
284
|
+
color: SulaSegmentedControlColor.White,
|
|
285
|
+
};
|
|
286
|
+
ManyOptions.parameters = {
|
|
287
|
+
docs: {
|
|
288
|
+
description: {
|
|
289
|
+
story: 'Controle segmentado com múltiplas opções.',
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
export const AllVariations = () => {
|
|
294
|
+
const container = document.createElement('div');
|
|
295
|
+
container.style.display = 'grid';
|
|
296
|
+
container.style.gridTemplateColumns = 'repeat(auto-fit, minmax(300px, 1fr))';
|
|
297
|
+
container.style.gap = '24px';
|
|
298
|
+
container.style.padding = '20px';
|
|
299
|
+
container.style.backgroundColor = '#f5f5f5';
|
|
300
|
+
container.style.borderRadius = '8px';
|
|
301
|
+
const variations = [
|
|
302
|
+
{
|
|
303
|
+
items: [
|
|
304
|
+
{ label: 'Text White', value: '1', selected: true },
|
|
305
|
+
{ label: 'Opção 2', value: '2' },
|
|
306
|
+
],
|
|
307
|
+
type: SulaSegmentedControlType.Text,
|
|
308
|
+
color: SulaSegmentedControlColor.White,
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
items: [
|
|
312
|
+
{ label: 'Text Gray', value: '1', selected: true },
|
|
313
|
+
{ label: 'Opção 2', value: '2' },
|
|
314
|
+
],
|
|
315
|
+
type: SulaSegmentedControlType.Text,
|
|
316
|
+
color: SulaSegmentedControlColor.Gray,
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
items: [
|
|
320
|
+
{ icon: 'ph ph-house', value: '1', selected: true },
|
|
321
|
+
{ icon: 'ph ph-user', value: '2' },
|
|
322
|
+
],
|
|
323
|
+
type: SulaSegmentedControlType.Icon,
|
|
324
|
+
color: SulaSegmentedControlColor.White,
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
items: [
|
|
328
|
+
{ icon: 'ph ph-house', value: '1', selected: true },
|
|
329
|
+
{ icon: 'ph ph-user', value: '2' },
|
|
330
|
+
],
|
|
331
|
+
type: SulaSegmentedControlType.Icon,
|
|
332
|
+
color: SulaSegmentedControlColor.Gray,
|
|
333
|
+
},
|
|
334
|
+
];
|
|
335
|
+
variations.forEach(variation => {
|
|
336
|
+
const control = document.createElement('sula-segmented-control');
|
|
337
|
+
control.items = variation.items;
|
|
338
|
+
control.setAttribute('type', variation.type);
|
|
339
|
+
control.setAttribute('color', variation.color);
|
|
340
|
+
control.setAttribute('size', SulaSegmentedControlSize.Default);
|
|
341
|
+
container.appendChild(control);
|
|
342
|
+
});
|
|
343
|
+
return container;
|
|
344
|
+
};
|
|
345
|
+
AllVariations.parameters = {
|
|
346
|
+
docs: {
|
|
347
|
+
description: {
|
|
348
|
+
story: 'Visão geral de todas as combinações de tipo e cor.',
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
//# sourceMappingURL=sula-segmented-control.stories.js.map
|