@nightshadeui/components 0.0.0-stage → 3.1.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.
Files changed (95) hide show
  1. package/dist/components/BaseMenu.vue.d.ts +314 -0
  2. package/dist/components/BaseMenu.vue.d.ts.map +1 -0
  3. package/dist/components/Btn.vue.d.ts +215 -0
  4. package/dist/components/Btn.vue.d.ts.map +1 -0
  5. package/dist/components/Bubble.vue.d.ts +42 -0
  6. package/dist/components/Bubble.vue.d.ts.map +1 -0
  7. package/dist/components/Checkbox.vue.d.ts +137 -0
  8. package/dist/components/Checkbox.vue.d.ts.map +1 -0
  9. package/dist/components/Chip.vue.d.ts +120 -0
  10. package/dist/components/Chip.vue.d.ts.map +1 -0
  11. package/dist/components/ContextMenu.vue.d.ts +479 -0
  12. package/dist/components/ContextMenu.vue.d.ts.map +1 -0
  13. package/dist/components/ContextPopup.vue.d.ts +142 -0
  14. package/dist/components/ContextPopup.vue.d.ts.map +1 -0
  15. package/dist/components/Filler.vue.d.ts +24 -0
  16. package/dist/components/Filler.vue.d.ts.map +1 -0
  17. package/dist/components/HGroup.vue.d.ts +57 -0
  18. package/dist/components/HGroup.vue.d.ts.map +1 -0
  19. package/dist/components/InputBase.vue.d.ts +196 -0
  20. package/dist/components/InputBase.vue.d.ts.map +1 -0
  21. package/dist/components/InputGroup.vue.d.ts +24 -0
  22. package/dist/components/InputGroup.vue.d.ts.map +1 -0
  23. package/dist/components/InputSelect.vue.d.ts +228 -0
  24. package/dist/components/InputSelect.vue.d.ts.map +1 -0
  25. package/dist/components/InputText.vue.d.ts +218 -0
  26. package/dist/components/InputText.vue.d.ts.map +1 -0
  27. package/dist/components/InputTextarea.vue.d.ts +218 -0
  28. package/dist/components/InputTextarea.vue.d.ts.map +1 -0
  29. package/dist/components/ModalOverlay.vue.d.ts +38 -0
  30. package/dist/components/ModalOverlay.vue.d.ts.map +1 -0
  31. package/dist/components/RouterBtn.vue.d.ts +229 -0
  32. package/dist/components/RouterBtn.vue.d.ts.map +1 -0
  33. package/dist/components/Slider.vue.d.ts +293 -0
  34. package/dist/components/Slider.vue.d.ts.map +1 -0
  35. package/dist/components/Tab.vue.d.ts +53 -0
  36. package/dist/components/Tab.vue.d.ts.map +1 -0
  37. package/dist/components/TabCap.vue.d.ts +33 -0
  38. package/dist/components/TabCap.vue.d.ts.map +1 -0
  39. package/dist/components/Toggle.vue.d.ts +138 -0
  40. package/dist/components/Toggle.vue.d.ts.map +1 -0
  41. package/dist/components/ToolPanel.vue.d.ts +48 -0
  42. package/dist/components/ToolPanel.vue.d.ts.map +1 -0
  43. package/dist/components/VGroup.vue.d.ts +48 -0
  44. package/dist/components/VGroup.vue.d.ts.map +1 -0
  45. package/dist/components/index.d.ts +24 -0
  46. package/dist/components/index.d.ts.map +1 -0
  47. package/dist/components.css +1 -0
  48. package/dist/components.mjs +1719 -0
  49. package/dist/glyphs/GlyphCheck.vue.d.ts +3 -0
  50. package/dist/glyphs/GlyphCheck.vue.d.ts.map +1 -0
  51. package/dist/glyphs/GlyphXmark.vue.d.ts +3 -0
  52. package/dist/glyphs/GlyphXmark.vue.d.ts.map +1 -0
  53. package/dist/glyphs/index.d.ts +4 -0
  54. package/dist/glyphs/index.d.ts.map +1 -0
  55. package/dist/helpers/props.d.ts +13 -0
  56. package/dist/helpers/props.d.ts.map +1 -0
  57. package/dist/index.d.ts +7 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/types/MenuItem.d.ts +13 -0
  60. package/dist/types/MenuItem.d.ts.map +1 -0
  61. package/dist/types/SelectOption.d.ts +6 -0
  62. package/dist/types/SelectOption.d.ts.map +1 -0
  63. package/package.json +36 -5
  64. package/src/components/BaseMenu.vue +173 -0
  65. package/src/components/Btn.vue +385 -0
  66. package/src/components/Bubble.vue +143 -0
  67. package/src/components/Checkbox.vue +256 -0
  68. package/src/components/Chip.vue +189 -0
  69. package/src/components/ContextMenu.vue +71 -0
  70. package/src/components/ContextPopup.vue +166 -0
  71. package/src/components/Filler.vue +43 -0
  72. package/src/components/HGroup.vue +74 -0
  73. package/src/components/InputBase.vue +278 -0
  74. package/src/components/InputGroup.vue +43 -0
  75. package/src/components/InputSelect.vue +180 -0
  76. package/src/components/InputText.vue +103 -0
  77. package/src/components/InputTextarea.vue +130 -0
  78. package/src/components/ModalOverlay.vue +74 -0
  79. package/src/components/RouterBtn.vue +52 -0
  80. package/src/components/Slider.vue +689 -0
  81. package/src/components/Tab.vue +129 -0
  82. package/src/components/TabCap.vue +46 -0
  83. package/src/components/Toggle.vue +238 -0
  84. package/src/components/ToolPanel.vue +83 -0
  85. package/src/components/VGroup.vue +68 -0
  86. package/src/components/index.ts +47 -0
  87. package/src/glyphs/GlyphCheck.vue +12 -0
  88. package/src/glyphs/GlyphXmark.vue +12 -0
  89. package/src/glyphs/index.ts +7 -0
  90. package/src/helpers/props.ts +60 -0
  91. package/src/index.ts +10 -0
  92. package/src/types/MenuItem.ts +12 -0
  93. package/src/types/SelectOption.ts +5 -0
  94. package/src/types.d.ts +6 -0
  95. package/README.md +0 -3
@@ -0,0 +1,180 @@
1
+ <template>
2
+ <InputBase
3
+ class="InputSelect"
4
+ v-bind="inputBaseProps"
5
+ @click="onBaseClick($event)">
6
+ <slot name="before" />
7
+ <select
8
+ ref="input"
9
+ :value="resolvedProps.modelValue"
10
+ :disabled="resolvedProps.disabled"
11
+ :aria-readonly="resolvedProps.readonly"
12
+ @input="onInput($event)"
13
+ @change="onChange($event)"
14
+ @focus="$emit('focus', $event)"
15
+ @blur="$emit('blur', $event)">
16
+ <template v-if="hasGroupedOptions">
17
+ <optgroup
18
+ v-for="group in groupedOptions"
19
+ :key="group.label"
20
+ :label="group.label">
21
+ <option
22
+ v-for="option in group.options"
23
+ :key="optionKey(option)"
24
+ :value="option.value">
25
+ {{ optionLabel(option) }}
26
+ </option>
27
+ </optgroup>
28
+ </template>
29
+ <template v-else>
30
+ <option
31
+ v-for="option in resolvedProps.options"
32
+ :key="optionKey(option)"
33
+ :value="option.value">
34
+ {{ optionLabel(option) }}
35
+ </option>
36
+ </template>
37
+ </select>
38
+ <slot name="after" />
39
+ </InputBase>
40
+ </template>
41
+
42
+ <script>
43
+ import {
44
+ collectProps,
45
+ nightshadeMixin,
46
+ } from '../helpers/props.js';
47
+ import InputBase from './InputBase.vue';
48
+
49
+ export default {
50
+
51
+ components: {
52
+ InputBase,
53
+ },
54
+
55
+ mixins: [nightshadeMixin],
56
+
57
+ props: {
58
+ ...InputBase.props,
59
+ tagName: { type: String, default: 'label' },
60
+ modelValue: { type: [String, Number] },
61
+ options: {
62
+ type: Array,
63
+ default: () => [],
64
+ },
65
+ autoFocus: { type: Boolean },
66
+ readonly: { type: Boolean },
67
+ },
68
+
69
+ emits: [
70
+ 'focus',
71
+ 'blur',
72
+ 'input',
73
+ 'change',
74
+ 'update:modelValue'
75
+ ],
76
+
77
+ computed: {
78
+
79
+ inputBaseProps() {
80
+ return collectProps(this, InputBase);
81
+ },
82
+
83
+ hasGroupedOptions() {
84
+ return this.resolvedProps.options.some(option => option?.group);
85
+ },
86
+
87
+ groupedOptions() {
88
+ const groups = [{
89
+ label: '',
90
+ options: [],
91
+ }];
92
+ for (const option of this.resolvedProps.options) {
93
+ const groupLabel = option?.group ?? '';
94
+ const group = groups.find(group => group.label === groupLabel);
95
+ if (group) {
96
+ group.options.push(option);
97
+ } else {
98
+ groups.push({
99
+ label: groupLabel,
100
+ options: [option],
101
+ });
102
+ }
103
+ }
104
+ return groups;
105
+ },
106
+ },
107
+
108
+ mounted() {
109
+ if (this.resolvedProps.autoFocus) {
110
+ this.$refs.input?.focus();
111
+ }
112
+ },
113
+
114
+ methods: {
115
+
116
+ onInput(ev) {
117
+ this.$emit('input', ev);
118
+ },
119
+
120
+ onChange(ev) {
121
+ if (this.resolvedProps.readonly) {
122
+ ev.target.value = this.resolvedProps.modelValue;
123
+ return;
124
+ }
125
+ this.$emit('change', ev);
126
+ this.$emit('update:modelValue', ev.target.value);
127
+ },
128
+
129
+ optionLabel(option) {
130
+ return String(option?.label ?? option?.value ?? '');
131
+ },
132
+
133
+ optionKey(option) {
134
+ return `${option?.group ?? ''}:${String(option?.value ?? '')}`;
135
+ },
136
+
137
+ onBaseClick(ev) {
138
+ const select = this.$refs.input;
139
+ if (ev.target === select) {
140
+ return;
141
+ }
142
+ ev.preventDefault();
143
+ if (typeof select.showPicker === 'function') {
144
+ select.showPicker();
145
+ } else {
146
+ select.click();
147
+ }
148
+ },
149
+
150
+ }
151
+
152
+ };
153
+ </script>
154
+
155
+ <style scoped>
156
+ .InputSelect:not(.InputSelect-disabled) {
157
+ cursor: pointer;
158
+ }
159
+
160
+ select {
161
+ -webkit-appearance: none;
162
+ appearance: none;
163
+ box-sizing: border-box;
164
+ flex: 1;
165
+ padding: 0;
166
+ border: 0;
167
+ width: 100%;
168
+ min-width: 0;
169
+ outline: 0;
170
+ user-select: text;
171
+ background: transparent;
172
+ color: inherit;
173
+ font: inherit;
174
+ cursor: inherit;
175
+ }
176
+
177
+ select[aria-readonly='true'] {
178
+ pointer-events: none;
179
+ }
180
+ </style>
@@ -0,0 +1,103 @@
1
+ <template>
2
+ <InputBase
3
+ class="InputText"
4
+ v-bind="inputBaseProps">
5
+ <slot name="before" />
6
+ <input
7
+ ref="input"
8
+ :value="resolvedProps.modelValue"
9
+ :type="resolvedProps.type"
10
+ :placeholder="resolvedProps.placeholder"
11
+ :readonly="resolvedProps.readonly"
12
+ :disabled="resolvedProps.disabled"
13
+ :min="resolvedProps.min"
14
+ :max="resolvedProps.max"
15
+ :step="resolvedProps.step"
16
+ autocomplete="off"
17
+ @input="onInput($event)"
18
+ @focus="$emit('focus', $event)"
19
+ @blur="$emit('blur', $event)" />
20
+ <slot name="after" />
21
+ </InputBase>
22
+ </template>
23
+
24
+ <script>
25
+ import {
26
+ collectProps,
27
+ nightshadeMixin,
28
+ } from '../helpers/props.js';
29
+ import InputBase from './InputBase.vue';
30
+
31
+ export default {
32
+
33
+ components: {
34
+ InputBase,
35
+ },
36
+
37
+ mixins: [nightshadeMixin],
38
+
39
+ props: {
40
+ ...InputBase.props,
41
+ tagName: { type: String, default: 'label' },
42
+ modelValue: { type: [String, Number] },
43
+ type: { type: String },
44
+ placeholder: { type: String },
45
+ min: { type: Number },
46
+ max: { type: Number },
47
+ step: { type: Number },
48
+ autoFocus: { type: Boolean },
49
+ readonly: { type: Boolean },
50
+ },
51
+
52
+ emits: [
53
+ 'focus',
54
+ 'blur',
55
+ 'input',
56
+ 'update:modelValue'
57
+ ],
58
+
59
+ computed: {
60
+ inputBaseProps() {
61
+ return collectProps(this, InputBase);
62
+ }
63
+ },
64
+
65
+ mounted() {
66
+ if (this.resolvedProps.autoFocus) {
67
+ this.$refs.input?.focus();
68
+ }
69
+ },
70
+
71
+ methods: {
72
+
73
+ onInput(ev) {
74
+ this.$emit('input', ev);
75
+ this.$emit('update:modelValue', ev.target.value);
76
+ }
77
+
78
+ }
79
+
80
+ };
81
+ </script>
82
+
83
+ <style scoped>
84
+ .InputText:not(.InputText-disabled) {
85
+ cursor: text;
86
+ }
87
+
88
+ input, textarea {
89
+ -webkit-appearance: none;
90
+ box-sizing: border-box;
91
+ flex: 1;
92
+ padding: 0;
93
+ border: 0;
94
+ width: 100%;
95
+ min-width: 0;
96
+ outline: 0;
97
+ user-select: text;
98
+ background: transparent;
99
+ color: inherit;
100
+ font: inherit;
101
+ cursor: inherit;
102
+ }
103
+ </style>
@@ -0,0 +1,130 @@
1
+ <template>
2
+ <InputBase
3
+ class="InputTextarea"
4
+ v-bind="inputBaseProps"
5
+ :fixedHeight="false">
6
+ <slot name="before" />
7
+ <textarea
8
+ ref="input"
9
+ :value="resolvedProps.modelValue"
10
+ :placeholder="resolvedProps.placeholder"
11
+ :readonly="resolvedProps.readonly"
12
+ :disabled="resolvedProps.disabled"
13
+ :rows="resolvedProps.rows"
14
+ resize="none"
15
+ autocomplete="off"
16
+ @input="onInput($event)"
17
+ @focus="$emit('focus', $event)"
18
+ @blur="$emit('blur', $event)" />
19
+ <slot name="after" />
20
+ </InputBase>
21
+ </template>
22
+
23
+ <script>
24
+ import {
25
+ collectProps,
26
+ nightshadeMixin,
27
+ } from '../helpers/props.js';
28
+ import InputBase from './InputBase.vue';
29
+
30
+ export default {
31
+
32
+ components: {
33
+ InputBase,
34
+ },
35
+
36
+ mixins: [nightshadeMixin],
37
+
38
+ props: {
39
+ ...InputBase.props,
40
+ tagName: { type: String, default: 'label' },
41
+ modelValue: { type: String },
42
+ placeholder: { type: String },
43
+ rows: { type: Number },
44
+ autoSize: { type: Boolean, default: true },
45
+ autoFocus: { type: Boolean },
46
+ readonly: { type: Boolean },
47
+ },
48
+
49
+ emits: [
50
+ 'focus',
51
+ 'blur',
52
+ 'input',
53
+ 'update:modelValue'
54
+ ],
55
+
56
+ computed: {
57
+ inputBaseProps() {
58
+ return collectProps(this, InputBase);
59
+ }
60
+ },
61
+
62
+ watch: {
63
+
64
+ modelValue: {
65
+ handler() {
66
+ const textarea = this.$refs.input;
67
+ if (this.resolvedProps.autoSize && textarea) {
68
+ textarea.style.height = 'auto';
69
+ textarea.style.height = textarea.scrollHeight + 'px';
70
+ }
71
+ },
72
+ },
73
+
74
+ },
75
+
76
+ mounted() {
77
+ this.$nextTick(() => {
78
+ const textarea = this.$refs.input;
79
+ if (this.resolvedProps.autoFocus) {
80
+ textarea.focus();
81
+ }
82
+ if (this.resolvedProps.autoSize) {
83
+ textarea.style.height = textarea.scrollHeight + 'px';
84
+ textarea.style.overflowY = 'hidden';
85
+ }
86
+ });
87
+ },
88
+
89
+ methods: {
90
+
91
+ onInput(ev) {
92
+ this.$emit('input', ev);
93
+ this.$emit('update:modelValue', ev.target.value);
94
+ },
95
+
96
+ }
97
+
98
+ };
99
+ </script>
100
+
101
+ <style scoped>
102
+ .InputTextarea:not(.InputTextarea-disabled) {
103
+ cursor: text;
104
+ }
105
+
106
+ input, textarea {
107
+ -webkit-appearance: none;
108
+ box-sizing: border-box;
109
+ flex: 1;
110
+ padding: 0;
111
+ border: 0;
112
+ width: 100%;
113
+ min-width: 0;
114
+ outline: 0;
115
+ user-select: text;
116
+ background: transparent;
117
+ color: inherit;
118
+ font: inherit;
119
+ cursor: inherit;
120
+ resize: none;
121
+ }
122
+
123
+ .InputBase:deep(.Container) {
124
+ overflow-y: auto;
125
+ }
126
+
127
+ textarea {
128
+ align-self: flex-start;
129
+ }
130
+ </style>
@@ -0,0 +1,74 @@
1
+ <template>
2
+ <teleport to="#overlays">
3
+ <div
4
+ class="ModalOverlay"
5
+ :class="{
6
+ 'ModalOverlay-enabled': resolvedProps.overlayEnabled,
7
+ 'ModalOverlay-shown': resolvedProps.overlayShown,
8
+ }"
9
+ @click.stop="hide">
10
+ <slot />
11
+ </div>
12
+ </teleport>
13
+ </template>
14
+
15
+ <script>
16
+ import { nightshadeMixin } from '../helpers/props.js';
17
+
18
+ export default {
19
+
20
+ mixins: [nightshadeMixin],
21
+
22
+ props: {
23
+ overlayEnabled: { type: Boolean, default: true },
24
+ overlayShown: { type: Boolean, default: true },
25
+ },
26
+
27
+ emits: ['hide'],
28
+
29
+ mounted() {
30
+ window.addEventListener('keydown', this.onKeyDown);
31
+ },
32
+
33
+ beforeUnmount() {
34
+ window.removeEventListener('keydown', this.onKeyDown);
35
+ },
36
+
37
+ methods: {
38
+
39
+ hide() {
40
+ this.$emit('hide');
41
+ },
42
+
43
+ onKeyDown(ev) {
44
+ if (ev.key === 'Escape') {
45
+ ev.preventDefault();
46
+ this.hide();
47
+ }
48
+ },
49
+
50
+ },
51
+
52
+ };
53
+ </script>
54
+
55
+ <style scoped>
56
+ .ModalOverlay {
57
+ --ModalOverlay-background: var(--surface-overlay);
58
+
59
+ position: fixed;
60
+ z-index: 2000;
61
+ inset: 0;
62
+ pointer-events: none;
63
+ }
64
+
65
+ .ModalOverlay-enabled {
66
+ pointer-events: auto;
67
+ overscroll-behavior: none;
68
+ overflow: auto;
69
+ }
70
+
71
+ .ModalOverlay-shown {
72
+ background: var(--ModalOverlay-background);
73
+ }
74
+ </style>
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <RouterLink
3
+ v-slot="{ href, navigate, isActive, isExactActive }"
4
+ :to="resolvedProps.to"
5
+ custom>
6
+ <Btn
7
+ tagName="a"
8
+ :href="href"
9
+ v-bind="actualProps(isActive, isExactActive)"
10
+ @click="navigate" />
11
+ </RouterLink>
12
+ </template>
13
+
14
+ <script>
15
+ import {
16
+ collectProps,
17
+ nightshadeMixin,
18
+ } from '../helpers/props.js';
19
+ import Btn from './Btn.vue';
20
+
21
+ export default {
22
+
23
+ components: {
24
+ Btn,
25
+ },
26
+
27
+ mixins: [nightshadeMixin],
28
+
29
+ props: {
30
+ ...Btn.props,
31
+ to: { required: true },
32
+ baseProps: { type: Object },
33
+ activeProps: { type: Object },
34
+ exactActiveProps: { type: Object },
35
+ },
36
+
37
+ methods: {
38
+
39
+ actualProps(isActive, isExactActive) {
40
+ const btnProps = collectProps(this, Btn);
41
+ return {
42
+ ...btnProps,
43
+ ...this.resolvedProps.baseProps,
44
+ ...(isActive ? this.resolvedProps.activeProps : {}),
45
+ ...(isExactActive ? this.resolvedProps.exactActiveProps : {}),
46
+ };
47
+ }
48
+
49
+ }
50
+
51
+ };
52
+ </script>