bareframe 0.1.0 → 0.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/README.md +179 -0
- package/dist/bareframe.min.js +119 -0
- package/dist/components/accordion.js +66 -0
- package/dist/components/autocomplete.css +78 -15
- package/dist/components/autocomplete.js +220 -10
- package/dist/components/avatar.css +129 -17
- package/dist/components/avatar.js +47 -10
- package/dist/components/breadcrumb.css +63 -17
- package/dist/components/breadcrumb.js +140 -5
- package/dist/components/button.css +4 -0
- package/dist/components/button.js +95 -15
- package/dist/components/chart.css +163 -14
- package/dist/components/chart.js +59 -4
- package/dist/components/checkbox.css +43 -1
- package/dist/components/checkbox.js +98 -5
- package/dist/components/dialog.css +95 -0
- package/dist/components/dialog.js +172 -4
- package/dist/components/divider.css +18 -22
- package/dist/components/divider.js +31 -3
- package/dist/components/drawer.css +68 -18
- package/dist/components/drawer.js +84 -4
- package/dist/components/edge.css +54 -0
- package/dist/components/edge.js +55 -0
- package/dist/components/file-upload.css +72 -3
- package/dist/components/file-upload.js +186 -4
- package/dist/components/input.css +59 -0
- package/dist/components/input.js +369 -4
- package/dist/components/list.css +11 -0
- package/dist/components/list.js +45 -0
- package/dist/components/menu.css +20 -0
- package/dist/components/menu.js +144 -0
- package/dist/components/modal.css +30 -17
- package/dist/components/modal.js +68 -4
- package/dist/components/nav.css +39 -0
- package/dist/components/progress.css +196 -0
- package/dist/components/progress.js +304 -0
- package/dist/components/radio.css +35 -1
- package/dist/components/radio.js +86 -5
- package/dist/components/range.css +91 -0
- package/dist/components/range.js +250 -0
- package/dist/components/select.css +35 -1
- package/dist/components/select.js +255 -4
- package/dist/components/skeleton.css +108 -21
- package/dist/components/skeleton.js +57 -4
- package/dist/components/tab.css +9 -1
- package/dist/components/tab.js +66 -1
- package/dist/components/tag.css +36 -3
- package/dist/components/tag.js +32 -0
- package/dist/components/toast.css +113 -0
- package/dist/components/toast.js +265 -4
- package/dist/components/toggle.css +53 -0
- package/dist/components/toggle.js +73 -5
- package/dist/components/wizard.css +79 -14
- package/dist/components/wizard.js +141 -4
- package/dist/index.js +5147 -110
- package/dist/manifest.json +5 -42
- package/dist/themes/aurora.css +47 -0
- package/dist/themes/dark.css +12 -2
- package/dist/themes/desert.css +37 -0
- package/dist/themes/future.css +47 -0
- package/dist/themes/layout.css +191 -0
- package/dist/themes/light.css +12 -0
- package/dist/themes/matrix.css +37 -0
- package/dist/themes/modern.css +64 -0
- package/dist/themes/nature.css +47 -0
- package/dist/themes/nebula.css +37 -0
- package/dist/themes/noir.css +37 -0
- package/dist/themes/oceanic.css +37 -0
- package/dist/themes/retro.css +47 -0
- package/dist/themes/simple.css +47 -0
- package/dist/themes/sprint.css +12 -0
- package/dist/themes/sunrise.css +37 -0
- package/dist/themes/system.css +13 -0
- package/package.json +9 -2
- package/dist/components/alert.css +0 -30
- package/dist/components/alert.js +0 -31
- package/dist/components/badge.css +0 -30
- package/dist/components/badge.js +0 -31
- package/dist/components/banner.css +0 -30
- package/dist/components/banner.js +0 -31
- package/dist/components/bar-chart.css +0 -30
- package/dist/components/bar-chart.js +0 -31
- package/dist/components/bottom-sheet.css +0 -30
- package/dist/components/bottom-sheet.js +0 -31
- package/dist/components/button-group.css +0 -30
- package/dist/components/button-group.js +0 -31
- package/dist/components/chip.css +0 -30
- package/dist/components/chip.js +0 -31
- package/dist/components/color-picker.css +0 -30
- package/dist/components/color-picker.js +0 -31
- package/dist/components/context-menu.css +0 -30
- package/dist/components/context-menu.js +0 -31
- package/dist/components/donut-chart.css +0 -30
- package/dist/components/donut-chart.js +0 -31
- package/dist/components/expanded-panel.css +0 -30
- package/dist/components/expanded-panel.js +0 -31
- package/dist/components/footer.css +0 -30
- package/dist/components/footer.js +0 -31
- package/dist/components/gantt-chart.css +0 -30
- package/dist/components/gantt-chart.js +0 -31
- package/dist/components/gauge.css +0 -30
- package/dist/components/gauge.js +0 -31
- package/dist/components/graph.css +0 -30
- package/dist/components/graph.js +0 -31
- package/dist/components/header.css +0 -30
- package/dist/components/header.js +0 -31
- package/dist/components/heatmap.css +0 -30
- package/dist/components/heatmap.js +0 -31
- package/dist/components/line-chart.css +0 -30
- package/dist/components/line-chart.js +0 -31
- package/dist/components/list-item.css +0 -30
- package/dist/components/list-item.js +0 -31
- package/dist/components/menu-item.css +0 -30
- package/dist/components/menu-item.js +0 -31
- package/dist/components/multi-select.css +0 -30
- package/dist/components/multi-select.js +0 -31
- package/dist/components/notification.css +0 -30
- package/dist/components/notification.js +0 -31
- package/dist/components/pie-chart.css +0 -30
- package/dist/components/pie-chart.js +0 -31
- package/dist/components/popover.css +0 -30
- package/dist/components/popover.js +0 -31
- package/dist/components/progress-bar.css +0 -30
- package/dist/components/progress-bar.js +0 -31
- package/dist/components/progress-circle.css +0 -30
- package/dist/components/progress-circle.js +0 -31
- package/dist/components/radio-group.css +0 -30
- package/dist/components/radio-group.js +0 -31
- package/dist/components/range-slider.css +0 -30
- package/dist/components/range-slider.js +0 -31
- package/dist/components/rating.css +0 -30
- package/dist/components/rating.js +0 -31
- package/dist/components/sheet.css +0 -30
- package/dist/components/sheet.js +0 -31
- package/dist/components/slider.css +0 -30
- package/dist/components/slider.js +0 -31
- package/dist/components/snackbar.css +0 -30
- package/dist/components/snackbar.js +0 -31
- package/dist/components/sparkline.css +0 -30
- package/dist/components/sparkline.js +0 -31
- package/dist/components/stepper.css +0 -30
- package/dist/components/stepper.js +0 -31
- package/dist/components/switch.css +0 -30
- package/dist/components/switch.js +0 -31
- package/dist/components/tab-group.css +0 -30
- package/dist/components/tab-group.js +0 -31
- package/dist/components/textfield.css +0 -30
- package/dist/components/textfield.js +0 -31
- package/dist/components/tooltip.css +0 -30
- package/dist/components/tooltip.js +0 -31
- package/dist/components/treemap.css +0 -30
- package/dist/components/treemap.js +0 -31
- package/dist/components/upload-dropzone.css +0 -30
- package/dist/components/upload-dropzone.js +0 -31
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
--bf-wizard-font: var(--bf-theme-font-family, inherit);
|
|
3
|
-
--bf-wizard-radius: var(--bf-theme-radius-md,
|
|
4
|
-
--bf-wizard-border-width: var(--bf-theme-border-width, 1px);
|
|
5
|
-
--bf-wizard-border-style: var(--bf-theme-border-style, solid);
|
|
3
|
+
--bf-wizard-radius: var(--bf-theme-radius-md, 10px);
|
|
6
4
|
--bf-wizard-border-color: var(--bf-theme-wizard-border-color, var(--bf-theme-border-1, #cbd5e1));
|
|
7
5
|
--bf-wizard-bg: var(--bf-theme-wizard-bg, var(--bf-theme-surface-1, #ffffff));
|
|
8
6
|
--bf-wizard-color: var(--bf-theme-wizard-color, var(--bf-theme-text-1, #0f172a));
|
|
9
|
-
--bf-wizard-
|
|
10
|
-
--bf-wizard-
|
|
11
|
-
--bf-wizard-transition:
|
|
12
|
-
var(--bf-theme-transition-bg, background-color 120ms ease),
|
|
13
|
-
var(--bf-theme-transition-color, color 120ms ease),
|
|
14
|
-
var(--bf-theme-transition-border, border-color 120ms ease);
|
|
7
|
+
--bf-wizard-accent: var(--bf-theme-button-primary-bg, #2563eb);
|
|
8
|
+
--bf-wizard-muted: var(--bf-theme-text-2, #64748b);
|
|
15
9
|
|
|
16
10
|
display: block;
|
|
17
11
|
font: var(--bf-wizard-font);
|
|
@@ -21,10 +15,81 @@
|
|
|
21
15
|
.root {
|
|
22
16
|
background: var(--bf-wizard-bg);
|
|
23
17
|
color: var(--bf-wizard-color);
|
|
24
|
-
border
|
|
25
|
-
border-style: var(--bf-wizard-border-style);
|
|
26
|
-
border-color: var(--bf-wizard-border-color);
|
|
18
|
+
border: 1px solid var(--bf-wizard-border-color);
|
|
27
19
|
border-radius: var(--bf-wizard-radius);
|
|
28
|
-
padding:
|
|
29
|
-
|
|
20
|
+
padding: 0.85rem;
|
|
21
|
+
display: grid;
|
|
22
|
+
gap: 0.8rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.steps {
|
|
26
|
+
list-style: none;
|
|
27
|
+
margin: 0;
|
|
28
|
+
padding: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
gap: 0.55rem;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.steps li {
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: 0.4rem;
|
|
38
|
+
color: var(--bf-wizard-muted);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.steps .dot {
|
|
42
|
+
width: 1.4rem;
|
|
43
|
+
height: 1.4rem;
|
|
44
|
+
border-radius: 999px;
|
|
45
|
+
border: 1px solid var(--bf-wizard-border-color);
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
font-size: 0.78rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.steps li.current {
|
|
53
|
+
color: var(--bf-wizard-color);
|
|
54
|
+
font-weight: 600;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.steps li.current .dot {
|
|
58
|
+
background: var(--bf-wizard-accent);
|
|
59
|
+
color: #fff;
|
|
60
|
+
border-color: var(--bf-wizard-accent);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.steps li.done .dot {
|
|
64
|
+
border-color: var(--bf-wizard-accent);
|
|
65
|
+
color: var(--bf-wizard-accent);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.content.is-empty {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.actions {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: space-between;
|
|
75
|
+
gap: 0.6rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.actions button {
|
|
79
|
+
border: 1px solid var(--bf-wizard-border-color);
|
|
80
|
+
background: var(--bf-theme-surface-1, #fff);
|
|
81
|
+
color: inherit;
|
|
82
|
+
border-radius: 7px;
|
|
83
|
+
padding: 0.35rem 0.7rem;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.actions button:disabled {
|
|
88
|
+
opacity: 0.55;
|
|
89
|
+
cursor: not-allowed;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.root[data-mode='stepper'] .content,
|
|
93
|
+
.root[data-mode='stepper'] .actions {
|
|
94
|
+
display: none;
|
|
30
95
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
class BfWizard extends HTMLElement {
|
|
2
|
+
static observedAttributes = ['mode', 'step', 'steps', 'linear', 'stepper'];
|
|
3
|
+
|
|
2
4
|
constructor() {
|
|
3
5
|
super();
|
|
4
6
|
this.attachShadow({ mode: 'open' });
|
|
7
|
+
this._onPrev = this._onPrev.bind(this);
|
|
8
|
+
this._onNext = this._onNext.bind(this);
|
|
5
9
|
}
|
|
6
10
|
|
|
7
11
|
connectedCallback() {
|
|
8
12
|
if (this._initialized) {
|
|
13
|
+
this._sync();
|
|
9
14
|
return;
|
|
10
15
|
}
|
|
11
16
|
this._initialized = true;
|
|
@@ -18,13 +23,145 @@ class BfWizard extends HTMLElement {
|
|
|
18
23
|
const root = document.createElement('div');
|
|
19
24
|
root.className = 'root';
|
|
20
25
|
root.setAttribute('part', 'root');
|
|
21
|
-
root.innerHTML =
|
|
26
|
+
root.innerHTML = `
|
|
27
|
+
<ol class="steps" part="steps"></ol>
|
|
28
|
+
<div class="content" part="content"><slot></slot></div>
|
|
29
|
+
<div class="actions" part="actions">
|
|
30
|
+
<button class="prev" type="button" part="prev">Back</button>
|
|
31
|
+
<button class="next" type="button" part="next">Next</button>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
this.shadowRoot.replaceChildren(link, root);
|
|
36
|
+
this._root = root;
|
|
37
|
+
this._stepsEl = root.querySelector('.steps');
|
|
38
|
+
this._content = root.querySelector('.content');
|
|
39
|
+
this._prevBtn = root.querySelector('.prev');
|
|
40
|
+
this._nextBtn = root.querySelector('.next');
|
|
41
|
+
this._slot = root.querySelector('slot');
|
|
42
|
+
this._prevBtn.addEventListener('click', this._onPrev);
|
|
43
|
+
this._nextBtn.addEventListener('click', this._onNext);
|
|
44
|
+
this._slot.addEventListener('slotchange', () => this._sync());
|
|
45
|
+
this._sync();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
attributeChangedCallback() {
|
|
49
|
+
this._sync();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get step() {
|
|
53
|
+
return this._step();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
set step(next) {
|
|
57
|
+
this.setAttribute('step', `${next}`);
|
|
58
|
+
}
|
|
22
59
|
|
|
23
|
-
|
|
24
|
-
|
|
60
|
+
next() {
|
|
61
|
+
this.step = Math.min(this._items().length, this._step() + 1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
prev() {
|
|
65
|
+
this.step = Math.max(1, this._step() - 1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_onPrev() {
|
|
69
|
+
this.prev();
|
|
70
|
+
this._emitChange();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_onNext() {
|
|
74
|
+
this.next();
|
|
75
|
+
this._emitChange();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
_emitChange() {
|
|
79
|
+
this.dispatchEvent(
|
|
80
|
+
new CustomEvent('bf-change', {
|
|
81
|
+
bubbles: true,
|
|
82
|
+
composed: true,
|
|
83
|
+
detail: {
|
|
84
|
+
step: this._step(),
|
|
85
|
+
mode: this._mode(),
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
_mode() {
|
|
92
|
+
const mode = (this.getAttribute('mode') || '').toLowerCase();
|
|
93
|
+
if (mode === 'stepper' || this.hasAttribute('stepper')) {
|
|
94
|
+
return 'stepper';
|
|
25
95
|
}
|
|
96
|
+
return 'wizard';
|
|
97
|
+
}
|
|
26
98
|
|
|
27
|
-
|
|
99
|
+
_items() {
|
|
100
|
+
const explicit = (this.getAttribute('steps') || '')
|
|
101
|
+
.split(',')
|
|
102
|
+
.map((item) => item.trim())
|
|
103
|
+
.filter(Boolean);
|
|
104
|
+
if (explicit.length) {
|
|
105
|
+
return explicit;
|
|
106
|
+
}
|
|
107
|
+
const panels = [...this.children]
|
|
108
|
+
.filter((child) => child.tagName.toLowerCase() === 'section')
|
|
109
|
+
.map((panel) => panel.getAttribute('title') || panel.id || 'Step');
|
|
110
|
+
if (panels.length) {
|
|
111
|
+
return panels;
|
|
112
|
+
}
|
|
113
|
+
return ['Step 1', 'Step 2', 'Step 3'];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
_step() {
|
|
117
|
+
const parsed = Number.parseInt(this.getAttribute('step') || '1', 10);
|
|
118
|
+
if (!Number.isFinite(parsed) || parsed < 1) {
|
|
119
|
+
return 1;
|
|
120
|
+
}
|
|
121
|
+
return Math.min(parsed, this._items().length);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
_renderSteps(items, current) {
|
|
125
|
+
this._stepsEl.replaceChildren();
|
|
126
|
+
items.forEach((label, index) => {
|
|
127
|
+
const li = document.createElement('li');
|
|
128
|
+
const stepNumber = index + 1;
|
|
129
|
+
if (stepNumber === current) {
|
|
130
|
+
li.classList.add('current');
|
|
131
|
+
} else if (stepNumber < current) {
|
|
132
|
+
li.classList.add('done');
|
|
133
|
+
}
|
|
134
|
+
li.innerHTML = `<span class="dot">${stepNumber}</span><span class="label">${label}</span>`;
|
|
135
|
+
this._stepsEl.append(li);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
_syncPanels(current) {
|
|
140
|
+
const panels = [...this.children].filter((child) => child.tagName.toLowerCase() === 'section');
|
|
141
|
+
if (!panels.length) {
|
|
142
|
+
this._content.classList.add('is-empty');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
this._content.classList.remove('is-empty');
|
|
146
|
+
panels.forEach((panel, index) => {
|
|
147
|
+
panel.hidden = index + 1 !== current;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
_sync() {
|
|
152
|
+
if (!this._root) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const mode = this._mode();
|
|
156
|
+
const items = this._items();
|
|
157
|
+
const current = this._step();
|
|
158
|
+
this._root.setAttribute('data-mode', mode);
|
|
159
|
+
this._renderSteps(items, current);
|
|
160
|
+
this._syncPanels(current);
|
|
161
|
+
this._prevBtn.hidden = mode === 'stepper';
|
|
162
|
+
this._nextBtn.hidden = mode === 'stepper';
|
|
163
|
+
this._prevBtn.disabled = current <= 1;
|
|
164
|
+
this._nextBtn.disabled = current >= items.length;
|
|
28
165
|
}
|
|
29
166
|
}
|
|
30
167
|
|