@nightshadeui/core 2.0.0-dev.3 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nightshadeui/core",
3
- "version": "2.0.0-dev.3",
3
+ "version": "2.0.0",
4
4
  "description": "Core Nightshade UI components",
5
5
  "author": "Boris Okunskiy",
6
6
  "license": "ISC",
@@ -12,7 +12,6 @@
12
12
  },
13
13
  "types": "./dist/index.d.ts",
14
14
  "files": [
15
- "src",
16
15
  "dist"
17
16
  ],
18
17
  "scripts": {
package/src/Btn.vue DELETED
@@ -1,342 +0,0 @@
1
- <template>
2
- <component
3
- :is="tagName"
4
- ref="button"
5
- class="Btn InputElement"
6
- :class="[
7
- `Btn-${effectiveStyle.size}`,
8
- `Btn-${effectiveStyle.kind}`,
9
- `input-kind-${effectiveStyle.kind}`,
10
- `Btn-iconPos-${iconPos}`,
11
- {
12
- 'Btn-ghost': effectiveStyle.ghost,
13
- 'Btn-round': effectiveStyle.round,
14
- 'Btn-outline': effectiveStyle.outline,
15
- 'Btn-flat': effectiveStyle.flat,
16
- 'Btn-shadow': effectiveStyle.shadow,
17
- 'Btn-square': square,
18
- 'Btn-block': block,
19
- 'Btn-disabled': disabled || blocked,
20
- 'Btn-force-focus': forceFocus,
21
- 'Btn-force-hover': forceHover,
22
- 'Btn-force-active': forceActive,
23
- },
24
- ]"
25
- :disabled="disabled || blocked"
26
- :title="title ?? label"
27
- :href="href"
28
- @mouseenter="hover = true"
29
- @mouseleave="hover = false"
30
- @mousedown="active = true"
31
- @mouseup="active = false"
32
- @mouseout="active = false"
33
- @focusin="focus = true"
34
- @focusout="focus = false">
35
-
36
- <slot
37
- name="icon"
38
- :hover="hover"
39
- :blocked="blocked">
40
- <i
41
- v-if="icon"
42
- :class="icon"
43
- class="Icon" />
44
- </slot>
45
-
46
- <span
47
- v-if="label"
48
- class="Label">
49
- {{ label }}
50
- </span>
51
-
52
- <slot
53
- :hover="hover"
54
- :active="active"
55
- :blocked="blocked" />
56
-
57
- </component>
58
- </template>
59
-
60
- <script>
61
- export default {
62
-
63
- props: {
64
- tagName: { type: String, default: 'button' },
65
- href: { type: String },
66
- label: { type: String },
67
- title: { type: String },
68
-
69
- kind: { type: String, default: 'base' },
70
- size: { type: String, default: 'm' },
71
- flat: { type: Boolean, default: false },
72
- shadow: { type: Boolean, default: false },
73
- outline: { type: Boolean, default: false },
74
- round: { type: Boolean, default: false },
75
- ghost: { type: Boolean, default: false },
76
-
77
- block: { type: Boolean, default: false },
78
- square: { type: Boolean, default: false },
79
-
80
- disabled: { type: Boolean, default: false },
81
- forceFocus: { type: Boolean, default: false },
82
- forceHover: { type: Boolean, default: false },
83
- forceActive: { type: Boolean, default: false },
84
-
85
- icon: { type: String },
86
- iconPos: { type: String, default: 'left' },
87
-
88
- hoverOverrides: { type: Object },
89
- activeOverrides: { type: Object },
90
- focusOverrides: { type: Object },
91
- },
92
-
93
- data() {
94
- return {
95
- hover: false,
96
- active: false,
97
- focus: false,
98
- blocked: false,
99
- };
100
- },
101
-
102
- computed: {
103
-
104
- baseStyle() {
105
- return {
106
- kind: this.kind,
107
- size: this.size,
108
- flat: this.flat,
109
- shadow: this.shadow,
110
- outline: this.outline,
111
- round: this.round,
112
- ghost: this.ghost,
113
- };
114
- },
115
-
116
- effectiveStyle() {
117
- const {
118
- baseStyle,
119
- hoverOverrides = {},
120
- activeOverrides = {},
121
- focusOverrides = {},
122
- active,
123
- hover,
124
- focus,
125
- forceActive,
126
- forceHover,
127
- forceFocus
128
- } = this;
129
- const style = Object.assign({}, baseStyle);
130
- if (active || forceActive) {
131
- Object.assign(style, activeOverrides);
132
- }
133
- if (hover || forceHover) {
134
- Object.assign(style, hoverOverrides);
135
- }
136
- if (focus || forceFocus) {
137
- Object.assign(style, focusOverrides);
138
- }
139
- return style;
140
- },
141
-
142
- },
143
-
144
- methods: {
145
-
146
- // TODO add debounce
147
-
148
- }
149
-
150
- };
151
- </script>
152
-
153
- <style scoped>
154
- .Btn {
155
- --Btn-size: var(--input-size);
156
- --Btn-padding: var(--sp1-5);
157
- --Btn-gap: var(--sp);
158
- --Btn-font-size: var(--font-size);
159
-
160
- --Btn-text-color: var(--input-surface-color-text);
161
- --Btn-text-shadow: var(--Btn-surface-bottom);
162
-
163
- --Btn-outline-color: transparent;
164
-
165
- --Btn-surface: var(--input-surface-color);
166
- --Btn-surface-top: var(--input-surface-color-top);
167
- --Btn-surface-bottom: var(--input-surface-color-bottom);
168
-
169
- --Btn-border-size: 0;
170
- --Btn-border-color: transparent;
171
- --Btn-border-radius: var(--border-radius);
172
-
173
- --Btn-shadow-color: var(--input-shadow-color);
174
-
175
- --Btn-gradient-x: 50%;
176
- --Btn-gradient-y: 0%;
177
- --Btn-gradient-width: 150%;
178
- --Btn-gradient-height: 150%;
179
-
180
- -webkit-appearance: none;
181
- appearance: none;
182
-
183
- position: relative;
184
- z-index: var(--input-z);
185
- margin: 0;
186
- padding: 0 var(--Btn-padding);
187
- height: var(--Btn-size);
188
- line-height: var(--Btn-size);
189
- box-sizing: border-box;
190
-
191
- display: inline-flex;
192
- align-items: center;
193
- justify-content: flex-start;
194
- flex-shrink: 0;
195
- gap: var(--Btn-gap);
196
-
197
- border: var(--Btn-border-size) solid var(--Btn-border-color);
198
- border-radius: var(--Btn-border-radius);
199
-
200
- color: var(--Btn-text-color);
201
- text-shadow: 0 1px 1px var(--Btn-text-shadow);
202
- outline: var(--input-outline-size) solid var(--Btn-outline-color);
203
- outline-offset: var(--input-outline-offset);
204
- background: radial-gradient(
205
- var(--Btn-gradient-width) var(--Btn-gradient-height) at var(--Btn-gradient-x) var(--Btn-gradient-y),
206
- var(--Btn-surface-top),
207
- var(--Btn-surface-bottom)
208
- );
209
-
210
- cursor: pointer;
211
- user-select: none;
212
-
213
- font-family: inherit;
214
- font-size: var(--Btn-font-size);
215
-
216
- transition: color .3s, outline .3s, filter .3s, border-radius .3s;
217
- }
218
-
219
- .Btn::after {
220
- content: '';
221
- position: absolute;
222
- z-index: 1;
223
- top: 0;
224
- left: 0;
225
- width: 100%;
226
- height: 100%;
227
- border-radius: var(--Btn-border-radius);
228
-
229
- background: rgba(127,127,127,.05);
230
- mix-blend-mode: color-dodge;
231
- pointer-events: none;
232
- opacity: 0;
233
- }
234
-
235
- .Label {
236
- line-height: var(--Btn-size);
237
- white-space: nowrap;
238
- overflow: hidden;
239
- text-overflow: ellipsis;
240
- }
241
-
242
- .Icon {
243
- width: var(--sp2);
244
- display: flex;
245
- align-items: center;
246
- justify-content: center;
247
- font-size: var(--Btn-font-size);
248
- }
249
-
250
- .Btn-iconPos-right .Icon {
251
- order: 100;
252
- }
253
-
254
- /* States */
255
-
256
- .Btn:focus, .Btn:active, .Btn:hover {
257
- transition: none;
258
- }
259
-
260
- .Btn:not(:disabled):hover::after, .Btn.Btn-force-hover::after {
261
- opacity: 1;
262
- }
263
-
264
- .Btn:not(:disabled):focus, .Btn.Btn-force-focus {
265
- z-index: 10;
266
- --Btn-outline-color: var(--input-focus-light-color);
267
- --Btn-border-color: var(--input-focus-medium-color);
268
- }
269
-
270
- .Btn:not(:disabled):active, .Btn.Btn-force-active {
271
- padding-top: 1px;
272
- box-shadow:
273
- 0 6px 12px var(--shadow-color-light) inset,
274
- 0 1px 2px var(--shadow-color-medium) inset;
275
- }
276
-
277
- .Btn-disabled {
278
- opacity: .64;
279
- filter: saturate(40%);
280
- cursor: not-allowed;
281
- }
282
-
283
- /* Styles */
284
-
285
- .Btn-round {
286
- --Btn-border-radius: var(--border-radius-m);
287
- }
288
-
289
- .Btn-ghost {
290
- --Btn-surface: transparent;
291
- --Btn-surface-top: transparent;
292
- --Btn-surface-bottom: transparent;
293
- --Btn-text-color: var(--input-text-color);
294
- --Btn-text-shadow: none;
295
- --Btn-shadow-color: var(--shadow-color-light);
296
- }
297
-
298
- .Btn-outline {
299
- --Btn-border-color: var(--input-border-color);
300
- --Btn-border-size: var(--input-border-size);
301
- }
302
-
303
- .Btn-flat {
304
- --Btn-surface-top: var(--Btn-surface);
305
- --Btn-surface-bottom: var(--Btn-surface);
306
- --Btn-text-shadow: none;
307
- }
308
-
309
- .Btn-shadow {
310
- box-shadow:
311
- 0 1px 1px var(--Btn-shadow-color),
312
- 0 0 5px -1px var(--shadow-color-light);
313
- }
314
-
315
- .Btn-square {
316
- padding-left: 0;
317
- padding-right: 0;
318
- width: var(--Btn-size);
319
- justify-content: center;
320
- }
321
-
322
- .Btn-block {
323
- flex: 1 1 auto;
324
- display: flex;
325
- justify-content: center;
326
- }
327
-
328
- /* Sizes */
329
-
330
- .Btn-large {
331
- --Btn-size: var(--input-size-l);
332
- --Btn-font-size: var(--font-size-l);
333
- --Btn-padding: var(--sp2);
334
- }
335
-
336
- .Btn-small {
337
- --Btn-size: var(--input-size-s);
338
- --Btn-font-size: var(--font-size-s);
339
- --Btn-padding: var(--sp);
340
- --Btn-gap: var(--sp0-5);
341
- }
342
- </style>
package/src/HGroup.vue DELETED
@@ -1,78 +0,0 @@
1
- <template>
2
- <component
3
- :is="tagName"
4
- class="HGroup"
5
- :class="[
6
- `HGroup-align-${align}`,
7
- `HGroup-justify-${justify}`,
8
- `HGroup-gap-${gap}`,
9
- {
10
- 'HGroup-wrap': wrap,
11
- }
12
- ]">
13
- <slot />
14
- </component>
15
- </template>
16
-
17
- <script>
18
- export default {
19
-
20
- props: {
21
- tagName: { type: String, default: 'div' },
22
- align: { type: String, default: 'center' },
23
- justify: { type: String },
24
- gap: { type: String, default: 's' },
25
- wrap: { type: Boolean, default: false },
26
- }
27
-
28
- };
29
- </script>
30
-
31
- <style scoped>
32
- .HGroup {
33
- display: flex;
34
- flex-flow: row nowrap;
35
- }
36
-
37
- .HGroup-align-stretch { align-items: stretch; }
38
- .HGroup-align-baseline { align-items: baseline; }
39
- .HGroup-align-center { align-items: center; }
40
- .HGroup-align-start { align-items: flex-start; }
41
- .HGroup-align-end { align-items: flex-end; }
42
-
43
- .HGroup-justify-center { justify-content: center; }
44
- .HGroup-justify-start { justify-content: flex-start; }
45
- .HGroup-justify-end { justify-content: flex-end; }
46
- .HGroup-justify-space-around { justify-content: space-around; }
47
- .HGroup-justify-space-between { justify-content: space-between; }
48
-
49
- .HGroup-gap-xxs { gap: var(--sp-xxs) }
50
- .HGroup-gap-xs { gap: var(--sp-xs) }
51
- .HGroup-gap-s { gap: var(--sp-s) }
52
- .HGroup-gap-m { gap: var(--sp-m) }
53
- .HGroup-gap-l { gap: var(--sp-l) }
54
- .HGroup-gap-xl { gap: var(--sp-xl) }
55
- .HGroup-gap-xxl { gap: var(--sp-xxl) }
56
-
57
- .HGroup-gap-0 { gap: 0 }
58
- .HGroup-gap-0-25 { gap: var(--sp0-25) }
59
- .HGroup-gap-0-5 { gap: var(--sp0-5) }
60
- .HGroup-gap-1 { gap: var(--sp1) }
61
- .HGroup-gap-1-5 { gap: var(--sp1-5) }
62
- .HGroup-gap-2 { gap: var(--sp2) }
63
- .HGroup-gap-2-5 { gap: var(--sp2-5) }
64
- .HGroup-gap-3 { gap: var(--sp3) }
65
- .HGroup-gap-4 { gap: var(--sp4) }
66
- .HGroup-gap-5 { gap: var(--sp5) }
67
- .HGroup-gap-6 { gap: var(--sp6) }
68
- .HGroup-gap-7 { gap: var(--sp7) }
69
- .HGroup-gap-8 { gap: var(--sp8) }
70
- .HGroup-gap-9 { gap: var(--sp9) }
71
- .HGroup-gap-10 { gap: var(--sp10) }
72
- .HGroup-gap-12 { gap: var(--sp12) }
73
- .HGroup-gap-16 { gap: var(--sp16) }
74
- .HGroup-gap-24 { gap: var(--sp24) }
75
- .HGroup-gap-32 { gap: var(--sp32) }
76
-
77
- .HGroup-wrap { flex-wrap: wrap; }
78
- </style>
package/src/InputBase.vue DELETED
@@ -1,278 +0,0 @@
1
- <template>
2
- <component
3
- :is="tagName"
4
- class="InputBase"
5
- :class="[
6
- `InputBase-${effectiveStyle.kind}`,
7
- `input-kind-${effectiveStyle.kind}`,
8
- `InputBase-${effectiveStyle.size}`,
9
- {
10
- 'InputBase-fixed-height': fixedHeight,
11
- 'InputBase-shadow': effectiveStyle.shadow,
12
- 'InputBase-round': effectiveStyle.round,
13
- 'InputBase-disabled': disabled,
14
- 'InputBase-force-focus': forceFocus,
15
- 'InputBase-force-hover': forceHover,
16
- }
17
- ]"
18
- @mouseenter="hover = true"
19
- @mouseleave="hover = false"
20
- @focusin="focus = true"
21
- @focusout="focus = false">
22
- <template v-if="label">
23
- <Tab
24
- v-if="labelStyle === 'tab'"
25
- class="Label TabLabel"
26
- :label="label" />
27
- <div
28
- v-if="labelStyle === 'text'"
29
- class="Label TextLabel">
30
- {{ label }}
31
- </div>
32
- <div
33
- v-if="labelStyle === 'inline'"
34
- class="Label InlineLabel">
35
- {{ label }}
36
- </div>
37
- </template>
38
- <div class="InputElement Container">
39
- <slot />
40
- </div>
41
- </component>
42
- </template>
43
-
44
- <script>
45
- import Tab from './Tab.vue';
46
-
47
- export default {
48
-
49
- components: {
50
- Tab,
51
- },
52
-
53
- props: {
54
- tagName: { default: 'label' },
55
- kind: { type: String, default: 'base' },
56
- label: { type: String },
57
- labelStyle: { type: String, default: 'inline' },
58
-
59
- size: { type: String, default: 'normal' },
60
- fixedHeight: { type: Boolean, default: true },
61
- shadow: { type: Boolean, default: false },
62
- round: { type: Boolean, default: false },
63
-
64
- disabled: { type: Boolean, default: false },
65
- forceFocus: { type: Boolean, default: false },
66
- forceHover: { type: Boolean, default: false },
67
-
68
- hoverOverrides: { type: Object },
69
- focusOverrides: { type: Object },
70
- },
71
-
72
- data() {
73
- return {
74
- hover: false,
75
- focus: false,
76
- };
77
- },
78
-
79
- computed: {
80
-
81
- baseStyle() {
82
- return {
83
- kind: this.kind,
84
- size: this.size,
85
- shadow: this.shadow,
86
- round: this.round,
87
- labelStyle: this.labelStyle,
88
- };
89
- },
90
-
91
- effectiveStyle() {
92
- const {
93
- baseStyle,
94
- hoverOverrides = {},
95
- focusOverrides = {},
96
- hover,
97
- focus,
98
- forceHover,
99
- forceFocus
100
- } = this;
101
- const style = Object.assign({}, baseStyle);
102
- if (hover || forceHover) {
103
- Object.assign(style, hoverOverrides);
104
- }
105
- if (focus || forceFocus) {
106
- Object.assign(style, focusOverrides);
107
- }
108
- return style;
109
- },
110
- }
111
-
112
- };
113
- </script>
114
-
115
- <style scoped>
116
- .InputBase {
117
- --InputBase-size: var(--input-size);
118
- --InputBase-padding: var(--sp1-5);
119
- --InputBase-gap: var(--sp);
120
- --InputBase-font-size: var(--font-size);
121
-
122
- --InputBase-text-color: var(--text-color);
123
- --InputBase-surface: var(--base-color);
124
-
125
- --InputBase-outline-color: transparent;
126
- --InputBase-outline-size: var(--input-outline-size);
127
- --InputBase-outline-offset: var(--input-outline-offset);
128
-
129
- --InputBase-border-size: var(--input-border-size);
130
- --InputBase-border-color: var(--input-border-color);
131
- --InputBase-border-radius: var(--border-radius);
132
-
133
- --InputBase-label-color: var(--input-label-color);
134
- --InputBase-label-font-size: var(--font-size-s);
135
- --InputBase-tab-surface-color: var(--input-surface-color-top);
136
- --InputBase-tab-text-color: var(--input-surface-color-text);
137
-
138
- position: relative;
139
- display: flex;
140
- flex-flow: column nowrap;
141
- outline: 0;
142
- z-index: var(--input-z);
143
- }
144
-
145
- .Container {
146
- position: relative;
147
- z-index: 1;
148
-
149
- display: flex;
150
- align-items: center;
151
- box-sizing: border-box;
152
- padding: var(--InputBase-padding);
153
- gap: var(--InputBase-gap);
154
- width: 100%;
155
- min-height: var(--InputBase-size);
156
-
157
- color: var(--InputBase-text-color);
158
- background: var(--InputBase-surface);
159
-
160
- outline: var(--InputBase-outline-size) solid var(--InputBase-outline-color);
161
- outline-offset: var(--InputBase-outline-offset);
162
-
163
- border: var(--InputBase-border-size) solid var(--InputBase-border-color);
164
- border-radius: var(--InputBase-border-radius);
165
-
166
- font-size: var(--InputBase-font-size);
167
-
168
- transition: color .3s, outline .3s, border-radius .3s, filter .3s;
169
- }
170
-
171
- /* States */
172
-
173
- .InputBase:not(.InputBase-disabled):focus-within, .InputBase.InputBase-force-focus {
174
- z-index: 10;
175
- --InputBase-outline-color: var(--input-focus-light-color);
176
- --InputBase-border-color: var(--input-focus-medium-color);
177
- --InputBase-label-color: var(--input-focus-medium-color);
178
- /* --InputBase-tab-surface-color: var(--input-focus-light-color); */
179
- /* --InputBase-tab-text-color: var(--input-surface-text-color); */
180
- }
181
-
182
- .InputBase-disabled .Container {
183
- --InputBase-surface: var(--color-base-100);
184
- opacity: .6;
185
- filter: saturate(40%);
186
- cursor: not-allowed;
187
- }
188
-
189
- /* Styles */
190
-
191
- .InputBase-fixed-height .Container {
192
- height: var(--InputBase-size);
193
- }
194
-
195
- .InputBase-round {
196
- --InputBase-border-radius: var(--border-radius-m);
197
- }
198
-
199
- .InputBase-shadow .Container {
200
- box-shadow:
201
- 0 0 5px -1px var(--shadow-color-light) inset;
202
- }
203
-
204
- /* Sizes */
205
-
206
- .InputBase-small {
207
- --InputBase-size: var(--input-size-s);
208
- --InputBase-font-size: var(--font-size-s);
209
- --InputBase-label-font-size: var(--font-size-xs);
210
- --InputBase-padding: var(--sp);
211
- }
212
-
213
- .InputBase-large {
214
- --InputBase-size: var(--input-size-l);
215
- --InputBase-font-size: var(--font-size-l);
216
- --InputBase-padding: var(--sp2);
217
- }
218
-
219
- /* Labels */
220
-
221
- .Label {
222
- font-size: var(--InputBase-label-font-size);
223
- max-width: calc(100% - 2 * var(--sp2));
224
- }
225
-
226
- .Label.TabLabel {
227
- align-self: flex-start;
228
- position: relative;
229
- z-index: 0;
230
- margin: 0 var(--sp2);
231
-
232
- --Tab-surface: var(--InputBase-tab-surface-color);
233
- --Tab-color: var(--InputBase-tab-text-color);
234
- --Tab-size: calc(.75 * var(--InputBase-size));
235
- --Tab-cap-size: calc(.75 * var(--InputBase-size));
236
- }
237
-
238
- .Label.TextLabel {
239
- margin: 0 var(--InputBase-padding);
240
- line-height: 1.5;
241
- height: var(--sp3);
242
-
243
- color: var(--InputBase-text-color);
244
-
245
- white-space: nowrap;
246
- overflow: hidden;
247
- text-overflow: ellipsis;
248
- }
249
-
250
- .Label.InlineLabel {
251
- position: absolute;
252
- top: 0;
253
- left: 0;
254
- transform: translateY(-50%);
255
- z-index: 2;
256
- margin: 0 var(--InputBase-padding);
257
- padding: 0 2px;
258
-
259
- color: var(--InputBase-label-color);
260
-
261
- white-space: nowrap;
262
- overflow: hidden;
263
- text-overflow: ellipsis;
264
- }
265
-
266
- .Label.InlineLabel::after {
267
- content: '';
268
- position: absolute;
269
- left: 0;
270
- right: 0;
271
- top: 50%;
272
- height: var(--sp);
273
- transform: translateY(-50%);
274
- z-index: -1;
275
-
276
- background: var(--InputBase-surface);
277
- }
278
- </style>