@sula-tech/webcomponents 0.15.0 → 0.17.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-C19aFtyq.js → index-CHZXBkfx.js} +357 -7
- package/dist/cjs/index-CHZXBkfx.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{sula-avatar_22.cjs.entry.js → sula-avatar_29.cjs.entry.js} +244 -25
- package/dist/cjs/sula-avatar_29.cjs.entry.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +7 -0
- package/dist/collection/components/sula-avatar/sula-avatar.css +1 -1
- package/dist/collection/components/sula-dropdown/sula-dropdown.js +6 -6
- package/dist/collection/components/sula-dropdown/sula-dropdown.js.map +1 -1
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-table/model/sula-table.model.js +8 -0
- package/dist/collection/components/sula-table/model/sula-table.model.js.map +1 -0
- package/dist/collection/components/sula-table/sula-table.css +1 -0
- package/dist/collection/components/sula-table/sula-table.js +111 -0
- package/dist/collection/components/sula-table/sula-table.js.map +1 -0
- package/dist/collection/components/sula-table/sula-table.stories.js +298 -0
- package/dist/collection/components/sula-table/sula-table.stories.js.map +1 -0
- package/dist/collection/components/sula-table-body/sula-table-body.css +1 -0
- package/dist/collection/components/sula-table-body/sula-table-body.js +23 -0
- package/dist/collection/components/sula-table-body/sula-table-body.js.map +1 -0
- package/dist/collection/components/sula-table-cell/sula-table-cell.css +1 -0
- package/dist/collection/components/sula-table-cell/sula-table-cell.js +34 -0
- package/dist/collection/components/sula-table-cell/sula-table-cell.js.map +1 -0
- package/dist/collection/components/sula-table-head-cell/sula-table-head-cell.css +1 -0
- package/dist/collection/components/sula-table-head-cell/sula-table-head-cell.js +34 -0
- package/dist/collection/components/sula-table-head-cell/sula-table-head-cell.js.map +1 -0
- package/dist/collection/components/sula-table-header/sula-table-header.css +1 -0
- package/dist/collection/components/sula-table-header/sula-table-header.js +23 -0
- package/dist/collection/components/sula-table-header/sula-table-header.js.map +1 -0
- package/dist/collection/components/sula-table-row/sula-table-row.css +1 -0
- package/dist/collection/components/sula-table-row/sula-table-row.js +23 -0
- package/dist/collection/components/sula-table-row/sula-table-row.js.map +1 -0
- 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/components/sula-toggle/model/sula-toggle.model.js +2 -0
- package/dist/collection/components/sula-toggle/model/sula-toggle.model.js.map +1 -0
- package/dist/collection/components/sula-toggle/sula-toggle.css +1 -0
- package/dist/collection/components/sula-toggle/sula-toggle.js +150 -0
- package/dist/collection/components/sula-toggle/sula-toggle.js.map +1 -0
- package/dist/collection/components/sula-toggle/sula-toggle.stories.js +189 -0
- package/dist/collection/components/sula-toggle/sula-toggle.stories.js.map +1 -0
- package/dist/collection/components/sula-tooltip/sula-tooltip.js +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/utils/replace-host-with-rendered-element.js +24 -0
- package/dist/collection/utils/replace-host-with-rendered-element.js.map +1 -0
- package/dist/components/index.js +355 -5
- package/dist/components/index.js.map +1 -1
- package/dist/components/p-CQ1I0UIz.js +12 -0
- package/dist/components/p-CQ1I0UIz.js.map +1 -0
- package/dist/components/{p-BESq0oqe.js → p-CXwxPt-3.js} +3 -3
- package/dist/components/{p-BESq0oqe.js.map → p-CXwxPt-3.js.map} +1 -1
- package/dist/components/{p-BznR9x_k.js → p-DR7vhr0W.js} +3 -3
- package/dist/components/{p-BznR9x_k.js.map → p-DR7vhr0W.js.map} +1 -1
- package/dist/components/p-DrIWCpI3.js +28 -0
- package/dist/components/p-DrIWCpI3.js.map +1 -0
- package/dist/components/sula-avatar.js +2 -2
- package/dist/components/sula-badge.js +1 -1
- package/dist/components/sula-breadcrumb.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 +7 -7
- package/dist/components/sula-dropdown.js.map +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.js +1 -1
- package/dist/components/sula-table-body.d.ts +11 -0
- package/dist/components/sula-table-body.js +41 -0
- package/dist/components/sula-table-body.js.map +1 -0
- package/dist/components/sula-table-cell.d.ts +11 -0
- package/dist/components/sula-table-cell.js +52 -0
- package/dist/components/sula-table-cell.js.map +1 -0
- package/dist/components/sula-table-head-cell.d.ts +11 -0
- package/dist/components/sula-table-head-cell.js +52 -0
- package/dist/components/sula-table-head-cell.js.map +1 -0
- package/dist/components/sula-table-header.d.ts +11 -0
- package/dist/components/sula-table-header.js +41 -0
- package/dist/components/sula-table-header.js.map +1 -0
- package/dist/components/sula-table-row.d.ts +11 -0
- package/dist/components/sula-table-row.js +41 -0
- package/dist/components/sula-table-row.js.map +1 -0
- package/dist/components/sula-table.d.ts +11 -0
- package/dist/components/sula-table.js +61 -0
- package/dist/components/sula-table.js.map +1 -0
- 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/components/sula-toggle.d.ts +11 -0
- package/dist/components/sula-toggle.js +83 -0
- package/dist/components/sula-toggle.js.map +1 -0
- package/dist/components/sula-tooltip.js +2 -2
- package/dist/esm/{index-CwIBTB8E.js → index-CwrCjm3e.js} +357 -7
- package/dist/esm/index-CwrCjm3e.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{sula-avatar_22.entry.js → sula-avatar_29.entry.js} +238 -26
- package/dist/esm/sula-avatar_29.entry.js.map +1 -0
- package/dist/esm/webcomponents.js +3 -3
- package/dist/types/components/sula-table/model/sula-table.model.d.ts +6 -0
- package/dist/types/components/sula-table/sula-table.d.ts +16 -0
- package/dist/types/components/sula-table/sula-table.stories.d.ts +69 -0
- package/dist/types/components/sula-table-body/sula-table-body.d.ts +5 -0
- package/dist/types/components/sula-table-cell/sula-table-cell.d.ts +6 -0
- package/dist/types/components/sula-table-head-cell/sula-table-head-cell.d.ts +6 -0
- package/dist/types/components/sula-table-header/sula-table-header.d.ts +5 -0
- package/dist/types/components/sula-table-row/sula-table-row.d.ts +5 -0
- package/dist/types/components/sula-toggle/model/sula-toggle.model.d.ts +3 -0
- package/dist/types/components/sula-toggle/sula-toggle.d.ts +27 -0
- package/dist/types/components/sula-toggle/sula-toggle.stories.d.ts +75 -0
- package/dist/types/components.d.ts +175 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/replace-host-with-rendered-element.d.ts +1 -0
- package/dist/webcomponents/{p-6dc2ae91.entry.js → p-2956027f.entry.js} +1751 -1465
- package/dist/webcomponents/p-2956027f.entry.js.map +1 -0
- package/dist/webcomponents/{p-CwIBTB8E.js → p-CwrCjm3e.js} +504 -150
- package/dist/webcomponents/p-CwrCjm3e.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +12 -4
- package/package.json +1 -1
- package/dist/cjs/index-C19aFtyq.js.map +0 -1
- package/dist/cjs/sula-avatar_22.cjs.entry.js.map +0 -1
- package/dist/esm/index-CwIBTB8E.js.map +0 -1
- package/dist/esm/sula-avatar_22.entry.js.map +0 -1
- package/dist/webcomponents/p-6dc2ae91.entry.js.map +0 -1
- package/dist/webcomponents/p-CwIBTB8E.js.map +0 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'Components/sula-toggle',
|
|
3
|
+
tags: ['autodocs'],
|
|
4
|
+
argTypes: {
|
|
5
|
+
selected: {
|
|
6
|
+
control: 'boolean',
|
|
7
|
+
description: 'Indica se o favorito está selecionado (coração preenchido)',
|
|
8
|
+
table: {
|
|
9
|
+
type: { summary: 'boolean' },
|
|
10
|
+
defaultValue: { summary: 'false' },
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
buttonDisabled: {
|
|
14
|
+
control: 'boolean',
|
|
15
|
+
description: 'Estado desabilitado do botão',
|
|
16
|
+
table: {
|
|
17
|
+
type: { summary: 'boolean' },
|
|
18
|
+
defaultValue: { summary: 'false' },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Nome do ícone (Phosphor Icons) sem o prefixo. Exemplo: "heart", "star", "bookmark"',
|
|
24
|
+
table: {
|
|
25
|
+
type: { summary: 'string' },
|
|
26
|
+
defaultValue: { summary: 'heart' },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
toggleClicked: {
|
|
30
|
+
action: 'toggleClicked',
|
|
31
|
+
description: 'Evento emitido quando o botão de toggle é clicado',
|
|
32
|
+
table: {
|
|
33
|
+
type: { summary: 'CustomEvent<SulaToggleEvent>' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
parameters: {
|
|
38
|
+
docs: {
|
|
39
|
+
description: {
|
|
40
|
+
component: `
|
|
41
|
+
O componente **Sula Toggle Favorite** é um botão de alternância para favoritar itens.
|
|
42
|
+
Utiliza ícones da biblioteca Phosphor Icons, com o coração (heart) como padrão, mas podendo ser customizado.
|
|
43
|
+
|
|
44
|
+
### Características principais:
|
|
45
|
+
- Ícone customizável (padrão: heart)
|
|
46
|
+
- Alterna entre outline (padrão) e preenchido (selecionado)
|
|
47
|
+
- Área clicável de 40x40 com ícone de 24x24
|
|
48
|
+
- Estados: default, hover, pressed, selected e disabled
|
|
49
|
+
- Suporte a light/dark mode
|
|
50
|
+
- Acessibilidade com \`aria-pressed\` e \`aria-label\`
|
|
51
|
+
|
|
52
|
+
### Como usar ícones customizados:
|
|
53
|
+
Informe o nome do ícone da biblioteca Phosphor Icons sem o prefixo \`ph\` ou \`ph-fill\`.
|
|
54
|
+
Exemplos: "heart", "star", "bookmark", "thumbs-up", etc.
|
|
55
|
+
`,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
const Template = args => {
|
|
61
|
+
const container = document.createElement('div');
|
|
62
|
+
container.style.margin = '20px';
|
|
63
|
+
container.style.display = 'flex';
|
|
64
|
+
container.style.alignItems = 'center';
|
|
65
|
+
container.style.justifyContent = 'center';
|
|
66
|
+
container.style.minHeight = '80px';
|
|
67
|
+
const el = document.createElement('sula-toggle');
|
|
68
|
+
el.setAttribute('selected', args.selected ? args.selected.toString() : 'false');
|
|
69
|
+
el.setAttribute('button-disabled', args.buttonDisabled ? args.buttonDisabled.toString() : 'false');
|
|
70
|
+
if (args.icon) {
|
|
71
|
+
el.setAttribute('icon', args.icon);
|
|
72
|
+
}
|
|
73
|
+
el.addEventListener('toggleClicked', args.toggleClicked);
|
|
74
|
+
container.appendChild(el);
|
|
75
|
+
return container;
|
|
76
|
+
};
|
|
77
|
+
export const Default = Template.bind({});
|
|
78
|
+
Default.args = {
|
|
79
|
+
selected: false,
|
|
80
|
+
buttonDisabled: false,
|
|
81
|
+
};
|
|
82
|
+
Default.parameters = {
|
|
83
|
+
docs: {
|
|
84
|
+
description: {
|
|
85
|
+
story: 'Estado padrão do botão de favorito (coração outline, cor primária).',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
export const Selected = Template.bind({});
|
|
90
|
+
Selected.args = {
|
|
91
|
+
selected: true,
|
|
92
|
+
buttonDisabled: false,
|
|
93
|
+
};
|
|
94
|
+
Selected.parameters = {
|
|
95
|
+
docs: {
|
|
96
|
+
description: {
|
|
97
|
+
story: 'Estado selecionado/favoritado (coração preenchido, cor de erro/vermelho).',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
export const Disabled = Template.bind({});
|
|
102
|
+
Disabled.args = {
|
|
103
|
+
selected: false,
|
|
104
|
+
buttonDisabled: true,
|
|
105
|
+
};
|
|
106
|
+
Disabled.parameters = {
|
|
107
|
+
docs: {
|
|
108
|
+
description: {
|
|
109
|
+
story: 'Estado desabilitado do botão de favorito.',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
export const DisabledSelected = Template.bind({});
|
|
114
|
+
DisabledSelected.args = {
|
|
115
|
+
selected: true,
|
|
116
|
+
buttonDisabled: true,
|
|
117
|
+
};
|
|
118
|
+
DisabledSelected.parameters = {
|
|
119
|
+
docs: {
|
|
120
|
+
description: {
|
|
121
|
+
story: 'Estado desabilitado com favorito previamente selecionado.',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
export const CustomIcon = Template.bind({});
|
|
126
|
+
CustomIcon.args = {
|
|
127
|
+
selected: false,
|
|
128
|
+
buttonDisabled: false,
|
|
129
|
+
icon: 'star',
|
|
130
|
+
};
|
|
131
|
+
CustomIcon.parameters = {
|
|
132
|
+
docs: {
|
|
133
|
+
description: {
|
|
134
|
+
story: 'Exemplo de botão de toggle com ícone customizado (estrela). Você pode usar qualquer ícone da biblioteca Phosphor Icons informando apenas o nome sem o prefixo.',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
export const CustomIconBookmark = Template.bind({});
|
|
139
|
+
CustomIconBookmark.args = {
|
|
140
|
+
selected: true,
|
|
141
|
+
buttonDisabled: false,
|
|
142
|
+
icon: 'bookmark',
|
|
143
|
+
};
|
|
144
|
+
CustomIconBookmark.parameters = {
|
|
145
|
+
docs: {
|
|
146
|
+
description: {
|
|
147
|
+
story: 'Exemplo de botão de toggle com ícone de marcador (bookmark) selecionado.',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
export const AllStates = () => {
|
|
152
|
+
const container = document.createElement('div');
|
|
153
|
+
container.style.display = 'flex';
|
|
154
|
+
container.style.gap = '24px';
|
|
155
|
+
container.style.alignItems = 'center';
|
|
156
|
+
container.style.padding = '20px';
|
|
157
|
+
const states = [
|
|
158
|
+
{ label: 'Default', selected: false, disabled: false },
|
|
159
|
+
{ label: 'Selected', selected: true, disabled: false },
|
|
160
|
+
{ label: 'Disabled', selected: false, disabled: true },
|
|
161
|
+
{ label: 'Disabled + Selected', selected: true, disabled: true },
|
|
162
|
+
];
|
|
163
|
+
states.forEach(state => {
|
|
164
|
+
const wrapper = document.createElement('div');
|
|
165
|
+
wrapper.style.display = 'flex';
|
|
166
|
+
wrapper.style.flexDirection = 'column';
|
|
167
|
+
wrapper.style.alignItems = 'center';
|
|
168
|
+
wrapper.style.gap = '8px';
|
|
169
|
+
const el = document.createElement('sula-toggle');
|
|
170
|
+
el.setAttribute('selected', state.selected.toString());
|
|
171
|
+
el.setAttribute('button-disabled', state.disabled.toString());
|
|
172
|
+
const label = document.createElement('span');
|
|
173
|
+
label.style.fontSize = '12px';
|
|
174
|
+
label.style.color = '#666';
|
|
175
|
+
label.textContent = state.label;
|
|
176
|
+
wrapper.appendChild(el);
|
|
177
|
+
wrapper.appendChild(label);
|
|
178
|
+
container.appendChild(wrapper);
|
|
179
|
+
});
|
|
180
|
+
return container;
|
|
181
|
+
};
|
|
182
|
+
AllStates.parameters = {
|
|
183
|
+
docs: {
|
|
184
|
+
description: {
|
|
185
|
+
story: 'Visualização de todos os estados do botão de favorito lado a lado.',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
//# sourceMappingURL=sula-toggle.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-toggle.stories.js","sourceRoot":"","sources":["../../../src/components/sula-toggle/sula-toggle.stories.tsx"],"names":[],"mappings":"AAAA,eAAe;IACb,KAAK,EAAE,wBAAwB;IAC/B,IAAI,EAAE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vD,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE9D,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC7C,KAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC9B,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;QAC3B,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACxB,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC3B,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AACF,SAAS,CAAC,UAAU,GAAG;IACrB,IAAI,EAAE;QACJ,WAAW,EAAE;YACX,KAAK,EAAE,oEAAoE;SAC5E;KACF;CACF,CAAC","sourcesContent":["export default {\n title: 'Components/sula-toggle',\n tags: ['autodocs'],\n argTypes: {\n selected: {\n control: 'boolean',\n description: 'Indica se o favorito está selecionado (coração preenchido)',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: 'false' },\n },\n },\n buttonDisabled: {\n control: 'boolean',\n description: 'Estado desabilitado do botão',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: 'false' },\n },\n },\n icon: {\n control: 'text',\n description: 'Nome do ícone (Phosphor Icons) sem o prefixo. Exemplo: \"heart\", \"star\", \"bookmark\"',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'heart' },\n },\n },\n toggleClicked: {\n action: 'toggleClicked',\n description: 'Evento emitido quando o botão de toggle é clicado',\n table: {\n type: { summary: 'CustomEvent<SulaToggleEvent>' },\n },\n },\n },\n parameters: {\n docs: {\n description: {\n component: `\nO componente **Sula Toggle Favorite** é um botão de alternância para favoritar itens.\nUtiliza ícones da biblioteca Phosphor Icons, com o coração (heart) como padrão, mas podendo ser customizado.\n\n### Características principais:\n- Ícone customizável (padrão: heart)\n- Alterna entre outline (padrão) e preenchido (selecionado)\n- Área clicável de 40x40 com ícone de 24x24\n- Estados: default, hover, pressed, selected e disabled\n- Suporte a light/dark mode\n- Acessibilidade com \\`aria-pressed\\` e \\`aria-label\\`\n\n### Como usar ícones customizados:\nInforme o nome do ícone da biblioteca Phosphor Icons sem o prefixo \\`ph\\` ou \\`ph-fill\\`.\nExemplos: \"heart\", \"star\", \"bookmark\", \"thumbs-up\", etc.\n `,\n },\n },\n },\n};\n\nconst Template = args => {\n const container = document.createElement('div');\n container.style.margin = '20px';\n container.style.display = 'flex';\n container.style.alignItems = 'center';\n container.style.justifyContent = 'center';\n container.style.minHeight = '80px';\n\n const el = document.createElement('sula-toggle');\n\n el.setAttribute('selected', args.selected ? args.selected.toString() : 'false');\n el.setAttribute('button-disabled', args.buttonDisabled ? args.buttonDisabled.toString() : 'false');\n if (args.icon) {\n el.setAttribute('icon', args.icon);\n }\n\n el.addEventListener('toggleClicked', args.toggleClicked);\n\n container.appendChild(el);\n return container;\n};\n\nexport const Default = Template.bind({});\nDefault.args = {\n selected: false,\n buttonDisabled: false,\n};\nDefault.parameters = {\n docs: {\n description: {\n story: 'Estado padrão do botão de favorito (coração outline, cor primária).',\n },\n },\n};\n\nexport const Selected = Template.bind({});\nSelected.args = {\n selected: true,\n buttonDisabled: false,\n};\nSelected.parameters = {\n docs: {\n description: {\n story: 'Estado selecionado/favoritado (coração preenchido, cor de erro/vermelho).',\n },\n },\n};\n\nexport const Disabled = Template.bind({});\nDisabled.args = {\n selected: false,\n buttonDisabled: true,\n};\nDisabled.parameters = {\n docs: {\n description: {\n story: 'Estado desabilitado do botão de favorito.',\n },\n },\n};\n\nexport const DisabledSelected = Template.bind({});\nDisabledSelected.args = {\n selected: true,\n buttonDisabled: true,\n};\nDisabledSelected.parameters = {\n docs: {\n description: {\n story: 'Estado desabilitado com favorito previamente selecionado.',\n },\n },\n};\n\nexport const CustomIcon = Template.bind({});\nCustomIcon.args = {\n selected: false,\n buttonDisabled: false,\n icon: 'star',\n};\nCustomIcon.parameters = {\n docs: {\n description: {\n story: 'Exemplo de botão de toggle com ícone customizado (estrela). Você pode usar qualquer ícone da biblioteca Phosphor Icons informando apenas o nome sem o prefixo.',\n },\n },\n};\n\nexport const CustomIconBookmark = Template.bind({});\nCustomIconBookmark.args = {\n selected: true,\n buttonDisabled: false,\n icon: 'bookmark',\n};\nCustomIconBookmark.parameters = {\n docs: {\n description: {\n story: 'Exemplo de botão de toggle com ícone de marcador (bookmark) selecionado.',\n },\n },\n};\n\nexport const AllStates = () => {\n const container = document.createElement('div');\n container.style.display = 'flex';\n container.style.gap = '24px';\n container.style.alignItems = 'center';\n container.style.padding = '20px';\n\n const states = [\n { label: 'Default', selected: false, disabled: false },\n { label: 'Selected', selected: true, disabled: false },\n { label: 'Disabled', selected: false, disabled: true },\n { label: 'Disabled + Selected', selected: true, disabled: true },\n ];\n\n states.forEach(state => {\n const wrapper = document.createElement('div');\n wrapper.style.display = 'flex';\n wrapper.style.flexDirection = 'column';\n wrapper.style.alignItems = 'center';\n wrapper.style.gap = '8px';\n\n const el = document.createElement('sula-toggle');\n el.setAttribute('selected', state.selected.toString());\n el.setAttribute('button-disabled', state.disabled.toString());\n\n const label = document.createElement('span');\n label.style.fontSize = '12px';\n label.style.color = '#666';\n label.textContent = state.label;\n\n wrapper.appendChild(el);\n wrapper.appendChild(label);\n container.appendChild(wrapper);\n });\n\n return container;\n};\nAllStates.parameters = {\n docs: {\n description: {\n story: 'Visualização de todos os estados do botão de favorito lado a lado.',\n },\n },\n};\n"]}
|
|
@@ -99,7 +99,7 @@ export class SulaTooltip {
|
|
|
99
99
|
const hostClass = isParentMode
|
|
100
100
|
? 'absolute inset-0 pointer-events-none overflow-visible'
|
|
101
101
|
: 'inline-block relative';
|
|
102
|
-
return (h(Host, { key: '
|
|
102
|
+
return (h(Host, { key: 'd956da097b13617092e90a00d2abb209bdcaf046', class: hostClass }, !isParentMode && (h("div", { key: '0e8265bbd03ce89dc5ab88552efc0fa2e325fb32', class: this.getIconClasses(), onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave, role: "button", "aria-label": "Tooltip trigger", ref: (el) => (this.triggerEl = el) }, h("sula-icon", { key: '1680ed4bdba2e29f12d4a2f2c453ce66f5278157', class: "flex items-center justify-center w-full h-full leading-[0]", icon: this.icon, customClass: "text-icon-primary text-[18px] leading-none" }))), this.displayText && (h("div", { key: '97fd111befdd2eb116d09544a03c603205f67b86', class: this.getHintClasses(), role: "tooltip", ref: (el) => (this.hintEl = el) }, this.displayText, h("div", { key: '0a12d3604b4d280d37c3c6b3b27469d93c3889d4', class: "tooltip-arrow", "data-popper-arrow": true, ref: (el) => (this.arrowEl = el) })))));
|
|
103
103
|
}
|
|
104
104
|
static get is() { return "sula-tooltip"; }
|
|
105
105
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\n\nexport type * from './components.d.ts';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG","sourcesContent":["/**\n * @fileoverview entry point for your component library\n *\n * This is the entry point for your component library. Use this file to export utilities,\n * constants or data structure that accompany your components.\n *\n * DO NOT use this file to export your components. Instead, use the recommended approaches\n * to consume components of this package as outlined in the `README.md`.\n */\n\nexport type * from './components.d.ts';\nexport type { SulaToggleEvent } from './components/sula-toggle/model/sula-toggle.model';\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const replaceHostWithRenderedElement = (host, selector) => {
|
|
2
|
+
const nativeElement = host.querySelector(selector);
|
|
3
|
+
const parentNode = host.parentNode;
|
|
4
|
+
if (!nativeElement || !parentNode) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
Array.from(host.classList)
|
|
8
|
+
.filter(className => className !== 'hydrated')
|
|
9
|
+
.forEach(className => nativeElement.classList.add(className));
|
|
10
|
+
const hostStyle = host.getAttribute('style');
|
|
11
|
+
const nativeStyle = nativeElement.getAttribute('style');
|
|
12
|
+
if (hostStyle) {
|
|
13
|
+
nativeElement.setAttribute('style', [nativeStyle, hostStyle].filter(Boolean).join('; '));
|
|
14
|
+
}
|
|
15
|
+
Array.from(host.attributes).forEach(({ name, value }) => {
|
|
16
|
+
if (name === 'class' || name === 'style') {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
nativeElement.setAttribute(name, value);
|
|
20
|
+
});
|
|
21
|
+
parentNode.insertBefore(nativeElement, host);
|
|
22
|
+
parentNode.removeChild(host);
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=replace-host-with-rendered-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace-host-with-rendered-element.js","sourceRoot":"","sources":["../../src/utils/replace-host-with-rendered-element.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,IAAiB,EAAE,QAAgB,EAAE,EAAE;IACpF,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAc,QAAQ,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IAEnC,IAAI,CAAC,aAAa,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,OAAO;IACT,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;SACvB,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,KAAK,UAAU,CAAC;SAC7C,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhE,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAExD,IAAI,SAAS,EAAE,CAAC;QACd,aAAa,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;QACtD,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACzC,OAAO;QACT,CAAC;QAED,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,UAAU,CAAC,YAAY,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAC7C,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC,CAAC","sourcesContent":["export const replaceHostWithRenderedElement = (host: HTMLElement, selector: string) => {\n const nativeElement = host.querySelector<HTMLElement>(selector);\n const parentNode = host.parentNode;\n\n if (!nativeElement || !parentNode) {\n return;\n }\n\n Array.from(host.classList)\n .filter(className => className !== 'hydrated')\n .forEach(className => nativeElement.classList.add(className));\n\n const hostStyle = host.getAttribute('style');\n const nativeStyle = nativeElement.getAttribute('style');\n\n if (hostStyle) {\n nativeElement.setAttribute('style', [nativeStyle, hostStyle].filter(Boolean).join('; '));\n }\n\n Array.from(host.attributes).forEach(({ name, value }) => {\n if (name === 'class' || name === 'style') {\n return;\n }\n\n nativeElement.setAttribute(name, value);\n });\n\n parentNode.insertBefore(nativeElement, host);\n parentNode.removeChild(host);\n};\n"]}
|