ui-optago 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/optago-credit-dark.html +12 -24
- package/optago-credit-light.html +12 -23
- package/package.json +1 -1
- package/ui-optago.css +116 -4
- package/ui-optago.js +100 -6
package/optago-credit-dark.html
CHANGED
|
@@ -1,33 +1,21 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
Selo "Desenvolvido por Óptago"
|
|
2
|
+
Selo "Desenvolvido por Óptago" — versão escura
|
|
3
3
|
===============================================
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Bloco padrão para colar em QUALQUER site desenvolvido pela Óptago
|
|
5
|
+
com fundo escuro (ou sem tema definido). Autocontido: o <style> e
|
|
6
|
+
o HTML abaixo não dependem de nenhuma variável, classe ou fonte já
|
|
7
|
+
carregada pelo site hospedeiro — só copiar e colar este arquivo
|
|
8
|
+
inteiro (ex. no rodapé) e funciona, independente da paleta do site.
|
|
9
9
|
|
|
10
10
|
Existe também a versão clara: optago-credit-light.html. Escolha
|
|
11
11
|
a que combina com o fundo onde o selo vai ficar.
|
|
12
12
|
|
|
13
|
-
Uso
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</script>
|
|
20
|
-
Em produção, fixe a versão para não sofrer quebras em atualizações:
|
|
21
|
-
https://unpkg.com/ui-optago@1.1.0/optago-credit-dark.html
|
|
22
|
-
Também funciona via jsDelivr:
|
|
23
|
-
https://cdn.jsdelivr.net/npm/ui-optago/optago-credit-dark.html
|
|
24
|
-
|
|
25
|
-
Uso local (CodeIgniter/PHP): copie o arquivo pro projeto e dê
|
|
26
|
-
include no caminho local (sem tags PHP aqui dentro; este arquivo
|
|
27
|
-
é incluído por outros, então nunca deve conter
|
|
28
|
-
"menor-que interrogação php", ou ele se auto-inclui em loop). Em
|
|
29
|
-
qualquer outro stack (HTML puro, WordPress, etc.), cole o conteúdo
|
|
30
|
-
deste arquivo direto no template.
|
|
13
|
+
Uso em CodeIgniter/PHP: include APPPATH seguido de
|
|
14
|
+
"Views/partials/optago-credit-dark.html" (sem tags PHP aqui dentro
|
|
15
|
+
— este arquivo é incluído por outros, então nunca deve conter
|
|
16
|
+
"menor-que interrogação php", ou ele se auto-inclui em loop).
|
|
17
|
+
Em qualquer outro stack (HTML puro, WordPress, etc.), cole o
|
|
18
|
+
conteúdo deste arquivo direto no template.
|
|
31
19
|
-->
|
|
32
20
|
<style>
|
|
33
21
|
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;700&display=swap');
|
package/optago-credit-light.html
CHANGED
|
@@ -1,32 +1,21 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
Selo "Desenvolvido por Óptago"
|
|
2
|
+
Selo "Desenvolvido por Óptago" — versão clara
|
|
3
3
|
==============================================
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
Bloco padrão para colar em QUALQUER site desenvolvido pela Óptago
|
|
5
|
+
com fundo claro. Autocontido: o <style> e o HTML abaixo não
|
|
6
|
+
dependem de nenhuma variável, classe ou fonte já carregada pelo
|
|
7
|
+
site hospedeiro — só copiar e colar este arquivo inteiro (ex. no
|
|
8
|
+
rodapé) e funciona, independente da paleta do site.
|
|
8
9
|
|
|
9
10
|
Existe também a versão escura: optago-credit-dark.html. Escolha
|
|
10
11
|
a que combina com o fundo onde o selo vai ficar.
|
|
11
12
|
|
|
12
|
-
Uso
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
</script>
|
|
19
|
-
Em produção, fixe a versão para não sofrer quebras em atualizações:
|
|
20
|
-
https://unpkg.com/ui-optago@1.1.0/optago-credit-light.html
|
|
21
|
-
Também funciona via jsDelivr:
|
|
22
|
-
https://cdn.jsdelivr.net/npm/ui-optago/optago-credit-light.html
|
|
23
|
-
|
|
24
|
-
Uso local (CodeIgniter/PHP): copie o arquivo pro projeto e dê
|
|
25
|
-
include no caminho local (sem tags PHP aqui dentro; este arquivo
|
|
26
|
-
é incluído por outros, então nunca deve conter
|
|
27
|
-
"menor-que interrogação php", ou ele se auto-inclui em loop). Em
|
|
28
|
-
qualquer outro stack (HTML puro, WordPress, etc.), cole o conteúdo
|
|
29
|
-
deste arquivo direto no template.
|
|
13
|
+
Uso em CodeIgniter/PHP: include APPPATH seguido de
|
|
14
|
+
"Views/partials/optago-credit-light.html" (sem tags PHP aqui
|
|
15
|
+
dentro — este arquivo é incluído por outros, então nunca deve
|
|
16
|
+
conter "menor-que interrogação php", ou ele se auto-inclui em
|
|
17
|
+
loop). Em qualquer outro stack (HTML puro, WordPress, etc.), cole
|
|
18
|
+
o conteúdo deste arquivo direto no template.
|
|
30
19
|
-->
|
|
31
20
|
<style>
|
|
32
21
|
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;700&display=swap');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui-optago",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Design System Óptago: componentes UI em CSS puro + JS vanilla, com tema claro/escuro, verde-lima (#C0FF6B) e app shell com sidebar colapsável.",
|
|
5
5
|
"author": "Óptago <cowork@optago.com.br> (https://optago.com.br)",
|
|
6
6
|
"license": "MIT",
|
package/ui-optago.css
CHANGED
|
@@ -78,10 +78,10 @@
|
|
|
78
78
|
|
|
79
79
|
/* Superfícies: TEMA CLARO */
|
|
80
80
|
html.light {
|
|
81
|
-
--op-bg: #
|
|
82
|
-
--op-panel: #
|
|
83
|
-
--op-panel-2: #
|
|
84
|
-
--op-panel-3: #
|
|
81
|
+
--op-bg: #DBE1E8;
|
|
82
|
+
--op-panel: #E2E7ED;
|
|
83
|
+
--op-panel-2: #D9E0E7;
|
|
84
|
+
--op-panel-3: #D1D9E1;
|
|
85
85
|
--op-border: #D6DEE7;
|
|
86
86
|
--op-border-2: #BDC9D8;
|
|
87
87
|
--op-text: #334155;
|
|
@@ -717,6 +717,25 @@ html.light .op-input:focus, html.light .op-select:focus, html.light .op-textarea
|
|
|
717
717
|
cursor: pointer;
|
|
718
718
|
}
|
|
719
719
|
|
|
720
|
+
/* Tamanhos: o padrão acima (sem modificador) é o tamanho normal.
|
|
721
|
+
op-input-xs < op-input-sm < (normal) < op-input-lg */
|
|
722
|
+
.op-input-xs, .op-select-xs, .op-textarea-xs {
|
|
723
|
+
padding: .3125rem .625rem;
|
|
724
|
+
font-size: .75rem;
|
|
725
|
+
border-radius: 6px;
|
|
726
|
+
}
|
|
727
|
+
.op-select-xs { padding-right: 1.875rem; background-position: right .625rem center; background-size: 10px; }
|
|
728
|
+
.op-input-sm, .op-select-sm, .op-textarea-sm {
|
|
729
|
+
padding: .5rem .75rem;
|
|
730
|
+
font-size: .8125rem;
|
|
731
|
+
}
|
|
732
|
+
.op-select-sm { padding-right: 2.125rem; background-position: right .75rem center; }
|
|
733
|
+
.op-input-lg, .op-select-lg, .op-textarea-lg {
|
|
734
|
+
padding: .875rem 1.125rem;
|
|
735
|
+
font-size: 1rem;
|
|
736
|
+
}
|
|
737
|
+
.op-select-lg { padding-right: 2.75rem; background-position: right 1rem center; background-size: 14px; }
|
|
738
|
+
|
|
720
739
|
/* Estados de validação */
|
|
721
740
|
.op-input.is-error, .op-select.is-error, .op-textarea.is-error {
|
|
722
741
|
border-color: var(--op-danger);
|
|
@@ -882,6 +901,71 @@ html.light .op-switch input:checked::before { background: #fff; }
|
|
|
882
901
|
html.light .op-range::-webkit-slider-thumb { background: var(--op-primary); }
|
|
883
902
|
.op-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
|
|
884
903
|
|
|
904
|
+
/* Combobox: input de texto que filtra uma lista de opções (autocomplete).
|
|
905
|
+
Uso: <div class="op-combobox" data-op-combobox>
|
|
906
|
+
<input class="op-input" data-op-combobox-input ...>
|
|
907
|
+
<div class="op-combobox-menu" data-op-combobox-menu>
|
|
908
|
+
<button class="op-combobox-option" data-op-combobox-option data-value="br">Brasil</button>
|
|
909
|
+
...
|
|
910
|
+
<div class="op-combobox-empty" hidden>Nenhum resultado</div>
|
|
911
|
+
</div>
|
|
912
|
+
</div>
|
|
913
|
+
O JS filtra as opções ao digitar, abre no foco, navega com as setas e
|
|
914
|
+
fecha com ESC/clique fora (mesmo padrão do .op-dropdown). */
|
|
915
|
+
.op-combobox { position: relative; }
|
|
916
|
+
.op-combobox-menu {
|
|
917
|
+
position: absolute;
|
|
918
|
+
top: calc(100% + 8px);
|
|
919
|
+
left: 0;
|
|
920
|
+
right: 0;
|
|
921
|
+
max-height: 260px;
|
|
922
|
+
overflow-y: auto;
|
|
923
|
+
background: var(--op-panel);
|
|
924
|
+
border: 1px solid var(--op-border-2);
|
|
925
|
+
border-radius: var(--op-radius);
|
|
926
|
+
box-shadow: var(--op-shadow-lg);
|
|
927
|
+
padding: .375rem;
|
|
928
|
+
z-index: 80;
|
|
929
|
+
opacity: 0;
|
|
930
|
+
visibility: hidden;
|
|
931
|
+
transform: translateY(-6px) scale(.98);
|
|
932
|
+
transform-origin: top;
|
|
933
|
+
transition: all .2s var(--op-spring);
|
|
934
|
+
}
|
|
935
|
+
.op-combobox.is-open .op-combobox-menu {
|
|
936
|
+
opacity: 1;
|
|
937
|
+
visibility: visible;
|
|
938
|
+
transform: translateY(0) scale(1);
|
|
939
|
+
}
|
|
940
|
+
.op-combobox-option {
|
|
941
|
+
display: flex;
|
|
942
|
+
align-items: center;
|
|
943
|
+
width: 100%;
|
|
944
|
+
padding: .5625rem .75rem;
|
|
945
|
+
background: none;
|
|
946
|
+
border: 0;
|
|
947
|
+
border-radius: var(--op-radius-sm);
|
|
948
|
+
color: var(--op-text);
|
|
949
|
+
font-family: var(--op-font-sans);
|
|
950
|
+
font-size: .8125rem;
|
|
951
|
+
text-align: left;
|
|
952
|
+
cursor: pointer;
|
|
953
|
+
transition: background .15s, color .15s;
|
|
954
|
+
}
|
|
955
|
+
.op-combobox-option:hover,
|
|
956
|
+
.op-combobox-option.is-active {
|
|
957
|
+
background: color-mix(in srgb, var(--op-strong) 6%, transparent);
|
|
958
|
+
color: var(--op-strong);
|
|
959
|
+
}
|
|
960
|
+
.op-combobox-option.is-selected { color: var(--op-accent); font-weight: 700; }
|
|
961
|
+
html.light .op-combobox-option.is-selected { color: #3F6212; }
|
|
962
|
+
.op-combobox-option[hidden] { display: none; }
|
|
963
|
+
.op-combobox-empty {
|
|
964
|
+
padding: .625rem .75rem;
|
|
965
|
+
color: var(--op-muted);
|
|
966
|
+
font-size: .8125rem;
|
|
967
|
+
}
|
|
968
|
+
|
|
885
969
|
/* ----------------------------------------------------------------------------
|
|
886
970
|
9. TABELAS
|
|
887
971
|
---------------------------------------------------------------------------- */
|
|
@@ -1866,6 +1950,34 @@ html.light .op-modal-icon.is-brand { color: #3F6212; }
|
|
|
1866
1950
|
}
|
|
1867
1951
|
.op-timeline-text { font-size: .8125rem; color: var(--op-muted); margin: 0; line-height: 1.6; }
|
|
1868
1952
|
|
|
1953
|
+
/* Timeline horizontal: adicione .op-timeline-horizontal junto com .op-timeline
|
|
1954
|
+
no mesmo <ul>. Os itens viram colunas, com o marcador acima do texto. */
|
|
1955
|
+
.op-timeline.op-timeline-horizontal {
|
|
1956
|
+
display: flex;
|
|
1957
|
+
list-style: none;
|
|
1958
|
+
margin: 0;
|
|
1959
|
+
padding: 0;
|
|
1960
|
+
gap: 1.5rem;
|
|
1961
|
+
overflow-x: auto;
|
|
1962
|
+
}
|
|
1963
|
+
.op-timeline.op-timeline-horizontal::before {
|
|
1964
|
+
left: 0;
|
|
1965
|
+
right: 0;
|
|
1966
|
+
top: 7px;
|
|
1967
|
+
bottom: auto;
|
|
1968
|
+
height: 2px;
|
|
1969
|
+
width: auto;
|
|
1970
|
+
}
|
|
1971
|
+
.op-timeline-horizontal .op-timeline-item {
|
|
1972
|
+
flex: 1;
|
|
1973
|
+
min-width: 170px;
|
|
1974
|
+
padding-bottom: 0;
|
|
1975
|
+
padding-top: 2rem;
|
|
1976
|
+
text-align: center;
|
|
1977
|
+
}
|
|
1978
|
+
.op-timeline-horizontal .op-timeline-marker { left: 50%; top: 0; translate: -50% 0; }
|
|
1979
|
+
.op-timeline-horizontal .op-timeline-title { justify-content: center; }
|
|
1980
|
+
|
|
1869
1981
|
/* ----------------------------------------------------------------------------
|
|
1870
1982
|
20g. TABULATOR: tema Óptago
|
|
1871
1983
|
Aplicado quando a tabela é criada via OptagoUI.tabulator() (o JS injeta o
|
package/ui-optago.js
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
// Fonte única da versão exibida no badge do header e no rodapé
|
|
44
44
|
// (elementos com o atributo data-op-version). Atualize só aqui.
|
|
45
|
-
var VERSION = '1.1.
|
|
45
|
+
var VERSION = '1.1.1';
|
|
46
46
|
OptagoUI.version = VERSION;
|
|
47
47
|
|
|
48
48
|
/* --------------------------------------------------------------------------
|
|
@@ -493,6 +493,75 @@
|
|
|
493
493
|
}
|
|
494
494
|
return;
|
|
495
495
|
}
|
|
496
|
+
|
|
497
|
+
// Combobox: clique numa opção seleciona; clique fora fecha.
|
|
498
|
+
t = e.target.closest('[data-op-combobox-option]');
|
|
499
|
+
if (t && !t.hasAttribute('hidden')) { selectComboboxOption(t); return; }
|
|
500
|
+
if (!e.target.closest('[data-op-combobox]')) {
|
|
501
|
+
document.querySelectorAll('.op-combobox.is-open').forEach(closeCombobox);
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
/* --------------------------------------------------------------------------
|
|
506
|
+
7b. COMBOBOX: input com filtro de opções (autocomplete)
|
|
507
|
+
-------------------------------------------------------------------------- */
|
|
508
|
+
function comboboxOptions(box) {
|
|
509
|
+
var menu = box.querySelector('[data-op-combobox-menu]');
|
|
510
|
+
return menu ? Array.prototype.slice.call(menu.querySelectorAll('[data-op-combobox-option]')) : [];
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function visibleComboboxOptions(box) {
|
|
514
|
+
return comboboxOptions(box).filter(function (o) { return !o.hasAttribute('hidden'); });
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
function openCombobox(box) {
|
|
518
|
+
box.classList.add('is-open');
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function closeCombobox(box) {
|
|
522
|
+
box.classList.remove('is-open');
|
|
523
|
+
comboboxOptions(box).forEach(function (o) { o.classList.remove('is-active'); });
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function selectComboboxOption(option) {
|
|
527
|
+
var box = option.closest('[data-op-combobox]');
|
|
528
|
+
var input = box.querySelector('[data-op-combobox-input]');
|
|
529
|
+
comboboxOptions(box).forEach(function (o) { o.classList.remove('is-selected'); });
|
|
530
|
+
option.classList.add('is-selected');
|
|
531
|
+
if (input) {
|
|
532
|
+
input.value = option.textContent.trim();
|
|
533
|
+
box.dataset.value = option.getAttribute('data-value') || '';
|
|
534
|
+
input.dispatchEvent(new Event('change', { bubbles: true }));
|
|
535
|
+
}
|
|
536
|
+
closeCombobox(box);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function filterCombobox(box) {
|
|
540
|
+
var input = box.querySelector('[data-op-combobox-input]');
|
|
541
|
+
var empty = box.querySelector('.op-combobox-empty');
|
|
542
|
+
var query = (input.value || '').trim().toLowerCase();
|
|
543
|
+
var anyVisible = false;
|
|
544
|
+
comboboxOptions(box).forEach(function (o) {
|
|
545
|
+
var match = o.textContent.toLowerCase().indexOf(query) !== -1;
|
|
546
|
+
o.toggleAttribute('hidden', !match);
|
|
547
|
+
o.classList.remove('is-active');
|
|
548
|
+
if (match) anyVisible = true;
|
|
549
|
+
});
|
|
550
|
+
if (empty) empty.hidden = anyVisible;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
document.addEventListener('input', function (e) {
|
|
554
|
+
var input = e.target.closest('[data-op-combobox-input]');
|
|
555
|
+
if (!input) return;
|
|
556
|
+
var box = input.closest('[data-op-combobox]');
|
|
557
|
+
filterCombobox(box);
|
|
558
|
+
openCombobox(box);
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
document.addEventListener('focusin', function (e) {
|
|
562
|
+
var input = e.target.closest('[data-op-combobox-input]');
|
|
563
|
+
if (!input) return;
|
|
564
|
+
openCombobox(input.closest('[data-op-combobox]'));
|
|
496
565
|
});
|
|
497
566
|
|
|
498
567
|
// Tooltip da sidebar colapsada: o overflow-y da nav cortaria um tooltip
|
|
@@ -517,12 +586,37 @@
|
|
|
517
586
|
OptagoUI.showLoading(form.getAttribute('data-op-loading-message'));
|
|
518
587
|
});
|
|
519
588
|
|
|
520
|
-
// ESC fecha modais e
|
|
589
|
+
// ESC fecha modais, dropdowns e comboboxes
|
|
521
590
|
document.addEventListener('keydown', function (e) {
|
|
522
|
-
if (e.key
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
591
|
+
if (e.key === 'Escape') {
|
|
592
|
+
document.querySelectorAll('.op-modal.is-open').forEach(function (m) { OptagoUI.closeModal(m); });
|
|
593
|
+
document.querySelectorAll('.op-dropdown.is-open').forEach(function (d) { d.classList.remove('is-open'); });
|
|
594
|
+
document.querySelectorAll('.op-combobox.is-open').forEach(closeCombobox);
|
|
595
|
+
OptagoUI.closeSidebarMobile();
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// Navegação por teclado dentro de um combobox aberto
|
|
600
|
+
var comboInput = e.target.closest('[data-op-combobox-input]');
|
|
601
|
+
if (!comboInput) return;
|
|
602
|
+
var box = comboInput.closest('[data-op-combobox]');
|
|
603
|
+
if (!box.classList.contains('is-open')) return;
|
|
604
|
+
|
|
605
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
606
|
+
e.preventDefault();
|
|
607
|
+
var opts = visibleComboboxOptions(box);
|
|
608
|
+
if (!opts.length) return;
|
|
609
|
+
var current = opts.findIndex(function (o) { return o.classList.contains('is-active'); });
|
|
610
|
+
var next = e.key === 'ArrowDown' ? current + 1 : current - 1;
|
|
611
|
+
if (next < 0) next = opts.length - 1;
|
|
612
|
+
if (next >= opts.length) next = 0;
|
|
613
|
+
opts.forEach(function (o) { o.classList.remove('is-active'); });
|
|
614
|
+
opts[next].classList.add('is-active');
|
|
615
|
+
opts[next].scrollIntoView({ block: 'nearest' });
|
|
616
|
+
} else if (e.key === 'Enter') {
|
|
617
|
+
var active = visibleComboboxOptions(box).filter(function (o) { return o.classList.contains('is-active'); })[0];
|
|
618
|
+
if (active) { e.preventDefault(); selectComboboxOption(active); }
|
|
619
|
+
}
|
|
526
620
|
});
|
|
527
621
|
|
|
528
622
|
/* --------------------------------------------------------------------------
|