@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,3 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
2
+ export default _default;
3
+ //# sourceMappingURL=GlyphCheck.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlyphCheck.vue.d.ts","sourceRoot":"","sources":["../../src/glyphs/GlyphCheck.vue"],"names":[],"mappings":";AA0DA,wBAMG"}
@@ -0,0 +1,3 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, SVGSVGElement>;
2
+ export default _default;
3
+ //# sourceMappingURL=GlyphXmark.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlyphXmark.vue.d.ts","sourceRoot":"","sources":["../../src/glyphs/GlyphXmark.vue"],"names":[],"mappings":";AA0DA,wBAMG"}
@@ -0,0 +1,4 @@
1
+ import { default as GlyphCheck } from './GlyphCheck.vue';
2
+ import { default as GlyphXmark } from './GlyphXmark.vue';
3
+ export { GlyphCheck, GlyphXmark, };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/glyphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EACH,UAAU,EACV,UAAU,GACb,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const nightshadeMixin: {
2
+ inject: {
3
+ $nightshade: {
4
+ default: null;
5
+ };
6
+ };
7
+ computed: {
8
+ resolvedProps(): Record<string, any>;
9
+ };
10
+ };
11
+ export declare function resolveProps(instance: any, targetComponent: any): Record<string, any>;
12
+ export declare function collectProps(instance: any, targetComponent: any): Record<string, any>;
13
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/helpers/props.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe;;;;;;;;;CAY3B,CAAC;AAEF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAiBrF;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQrF"}
@@ -0,0 +1,7 @@
1
+ import * as standardComponents from './components/index.js';
2
+ export * from './components/index.js';
3
+ export * from './glyphs/index.js';
4
+ export * from './types/MenuItem.js';
5
+ export * from './types/SelectOption.js';
6
+ export { standardComponents, };
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,uBAAuB,CAAC;AAE5D,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AAExC,OAAO,EACH,kBAAkB,GACrB,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface MenuItem {
2
+ type?: 'normal' | 'header' | 'separator';
3
+ title?: string;
4
+ value?: any;
5
+ icon?: string;
6
+ tone?: string;
7
+ outline?: boolean;
8
+ ghost?: boolean;
9
+ disabled?: boolean;
10
+ checked?: boolean;
11
+ activate?: () => void;
12
+ }
13
+ //# sourceMappingURL=MenuItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../src/types/MenuItem.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACrB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB"}
@@ -0,0 +1,6 @@
1
+ export interface SelectOption {
2
+ value: any;
3
+ label?: string;
4
+ group?: string;
5
+ }
6
+ //# sourceMappingURL=SelectOption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectOption.d.ts","sourceRoot":"","sources":["../../src/types/SelectOption.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
- "name": "@nightshadeui/components",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@nightshadeui/components",
3
+ "version": "3.1.0",
4
+ "description": "Standard Nightshade components: opt-in Vue primitives that read the styles",
5
+ "author": "Boris Okunskiy",
6
+ "license": "ISC",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/components.mjs"
12
+ },
13
+ "./css": "./dist/components.css",
14
+ "./src": "./src/index.ts"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "src"
19
+ ],
20
+ "scripts": {
21
+ "build:watch": "vite build --watch",
22
+ "build": "NODE_ENV=production vite build"
23
+ },
24
+ "peerDependencies": {
25
+ "vue": "^3.5.22",
26
+ "vue-router": "^4.6.3"
27
+ },
28
+ "peerDependenciesMeta": {
29
+ "vue-router": {
30
+ "optional": true
31
+ }
32
+ },
33
+ "dependencies": {
34
+ "@nightshadeui/util": "3.1.0",
35
+ "@nightshadeui/stylesheets": "3.1.0"
36
+ }
37
+ }
@@ -0,0 +1,173 @@
1
+ <template>
2
+ <VGroup
3
+ class="BaseMenu"
4
+ :class="[
5
+ resolvedProps.size && `input-size-${resolvedProps.size}`,
6
+ ]"
7
+ @keydown="onKeyDown">
8
+ <template
9
+ v-for="(item, i) of items"
10
+ :key="i">
11
+
12
+ <div
13
+ v-if="getItemType(item) === 'header'"
14
+ class="Header">
15
+ {{ item.title }}
16
+ </div>
17
+
18
+ <div
19
+ v-if="getItemType(item) === 'separator'"
20
+ class="Separator" />
21
+
22
+ <Btn
23
+ v-if="getItemType(item) === 'normal'"
24
+ class="Item"
25
+ :class="{
26
+ 'Item-checked': item.checked,
27
+ }"
28
+ :tone="item.tone"
29
+ :size="resolvedProps.size"
30
+ :round="resolvedProps.round"
31
+ :flat="true"
32
+ :ghost="item.ghost ?? true"
33
+ :outline="item.outline"
34
+ :disabled="item.disabled"
35
+ :icon="item.icon"
36
+ @click="onItemClick(item, $event)">
37
+
38
+ <template #label>
39
+ <div class="Title">
40
+ {{ item.title }}
41
+ </div>
42
+ </template>
43
+
44
+ <template #after>
45
+ <span
46
+ v-if="item.checked"
47
+ class="CheckIcon">
48
+ ✓
49
+ </span>
50
+ </template>
51
+ </Btn>
52
+
53
+ </template>
54
+ </VGroup>
55
+ </template>
56
+
57
+ <script>
58
+ import {
59
+ nightshadeMixin,
60
+ } from '../helpers/props.js';
61
+ import Btn from './Btn.vue';
62
+ import VGroup from './VGroup.vue';
63
+
64
+ export default {
65
+
66
+ components: {
67
+ Btn,
68
+ VGroup,
69
+ },
70
+
71
+ mixins: [nightshadeMixin],
72
+
73
+ props: {
74
+ items: { type: Array, default: () => [] },
75
+ size: { type: String },
76
+ round: { type: Boolean, default: false },
77
+ autoFocus: { type: Boolean, default: false },
78
+ },
79
+
80
+ emits: [
81
+ 'activate',
82
+ ],
83
+
84
+ mounted() {
85
+ if (this.resolvedProps.autoFocus) {
86
+ this.$nextTick(() => {
87
+ const first = this.getFocusableEls()[0];
88
+ if (first) {
89
+ first.focus();
90
+ }
91
+ });
92
+ }
93
+ },
94
+
95
+ methods: {
96
+
97
+ getItemType(item) {
98
+ return item.type || 'normal';
99
+ },
100
+
101
+ getFocusableEls() {
102
+ return Array.from(this.$el.querySelectorAll('.Item:not(:disabled)'));
103
+ },
104
+
105
+ onKeyDown(ev) {
106
+ if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {
107
+ ev.preventDefault();
108
+ const focusableEls = this.getFocusableEls();
109
+ if (!focusableEls.length) {
110
+ return;
111
+ }
112
+ const activeElement = document.activeElement;
113
+ let activeIndex = focusableEls.findIndex(el => el === activeElement || el.contains(activeElement));
114
+ if (ev.key === 'ArrowDown') {
115
+ activeIndex = (activeIndex + 1) % focusableEls.length;
116
+ } else {
117
+ activeIndex = (activeIndex + focusableEls.length - 1) % focusableEls.length;
118
+ }
119
+ focusableEls[activeIndex]?.focus();
120
+ }
121
+ },
122
+
123
+ onItemClick(item, ev) {
124
+ if (item.disabled) {
125
+ return;
126
+ }
127
+ if (typeof item.activate === 'function') {
128
+ item.activate();
129
+ }
130
+ this.$emit('activate', item, ev);
131
+ }
132
+
133
+ }
134
+
135
+ };
136
+ </script>
137
+
138
+ <style scoped>
139
+ .BaseMenu {
140
+ --BaseMenu-padding: var(--sp);
141
+ --BaseMenu-gap: var(--sp0-5);
142
+ --BaseMenu-min-width: var(--sp24);
143
+
144
+ padding: var(--BaseMenu-padding);
145
+ gap: var(--BaseMenu-gap);
146
+ min-width: var(--BaseMenu-min-width);
147
+ }
148
+
149
+ .Header {
150
+ padding: var(--sp) var(--input-major-padding) 0;
151
+ font-size: var(--font-size-s);
152
+ font-weight: var(--font-weight-bold);
153
+ text-transform: uppercase;
154
+ opacity: 0.5;
155
+ user-select: none;
156
+ }
157
+
158
+ .Separator {
159
+ height: var(--input-border-size);
160
+ background: var(--border-base);
161
+ }
162
+
163
+ .Title {
164
+ flex: 1;
165
+ text-align: left;
166
+ }
167
+
168
+ .Item {
169
+ white-space: nowrap;
170
+ overflow: hidden;
171
+ text-overflow: ellipsis;
172
+ }
173
+ </style>
@@ -0,0 +1,385 @@
1
+ <template>
2
+ <component
3
+ :is="resolvedProps.tagName"
4
+ ref="button"
5
+ class="Btn InputElement"
6
+ :class="[
7
+ effectiveStyle.tone && `tone-${effectiveStyle.tone}`,
8
+ effectiveStyle.size && `input-size-${effectiveStyle.size}`,
9
+ `Btn-iconPos-${resolvedProps.iconPos}`,
10
+ {
11
+ 'Btn-ghost': effectiveStyle.ghost,
12
+ 'Btn-round': effectiveStyle.round,
13
+ 'Btn-outline': effectiveStyle.outline,
14
+ 'Btn-flat': effectiveStyle.flat,
15
+ 'Btn-translucent': effectiveStyle.translucent && !effectiveStyle.ghost,
16
+ 'Btn-square': resolvedProps.square,
17
+ 'Btn-block': resolvedProps.block,
18
+ 'Btn-disabled': inactive,
19
+ 'Btn-forceFocus': resolvedProps.forceFocus,
20
+ 'Btn-forceHover': resolvedProps.forceHover,
21
+ 'Btn-forceActive': resolvedProps.forceActive,
22
+ },
23
+ ]"
24
+ :disabled="isButton ? inactive : undefined"
25
+ :aria-disabled="!isButton && inactive ? 'true' : undefined"
26
+ :tabindex="!isButton && inactive ? -1 : undefined"
27
+ :title="resolvedProps.title ?? resolvedProps.label"
28
+ :href="inactive ? undefined : resolvedProps.href"
29
+ @click.capture="onClickCapture"
30
+ @mouseenter="hover = true"
31
+ @mouseleave="hover = false"
32
+ @mousedown="active = true"
33
+ @mouseup="active = false"
34
+ @mouseout="active = false"
35
+ @focusin="focus = true"
36
+ @focusout="focus = false">
37
+
38
+ <slot
39
+ name="before"
40
+ :hover="hover"
41
+ :active="active"
42
+ :focus="focus"
43
+ :blocked="blocked" />
44
+
45
+ <slot
46
+ :hover="hover"
47
+ :active="active"
48
+ :focus="focus"
49
+ :blocked="blocked">
50
+ <i
51
+ v-if="resolvedProps.icon"
52
+ :class="resolvedProps.icon"
53
+ class="Icon" />
54
+ <slot
55
+ name="label"
56
+ :hover="hover"
57
+ :active="active"
58
+ :focus="focus"
59
+ :blocked="blocked">
60
+ <span
61
+ v-if="resolvedProps.label"
62
+ class="Label">
63
+ {{ resolvedProps.label }}
64
+ </span>
65
+ </slot>
66
+ </slot>
67
+
68
+ <slot
69
+ name="after"
70
+ :hover="hover"
71
+ :active="active"
72
+ :focus="focus"
73
+ :blocked="blocked" />
74
+
75
+ </component>
76
+ </template>
77
+
78
+ <script>
79
+ import {
80
+ nightshadeMixin,
81
+ } from '../helpers/props.js';
82
+
83
+ export default {
84
+
85
+ mixins: [nightshadeMixin],
86
+
87
+ props: {
88
+ tagName: { type: String, default: 'button' },
89
+ href: { type: String },
90
+ label: { type: String },
91
+ title: { type: String },
92
+
93
+ tone: { type: String },
94
+ size: { type: String },
95
+ flat: { type: Boolean, default: false },
96
+ outline: { type: Boolean, default: false },
97
+ round: { type: Boolean, default: false },
98
+ translucent: { type: Boolean, default: false },
99
+ ghost: { type: Boolean, default: false },
100
+
101
+ block: { type: Boolean, default: false },
102
+ square: { type: Boolean, default: false },
103
+
104
+ disabled: { type: Boolean, default: false },
105
+ forceFocus: { type: Boolean, default: false },
106
+ forceHover: { type: Boolean, default: false },
107
+ forceActive: { type: Boolean, default: false },
108
+
109
+ icon: { type: String },
110
+ iconPos: { type: String, default: 'left' },
111
+
112
+ hoverOverrides: { type: Object },
113
+ activeOverrides: { type: Object },
114
+ focusOverrides: { type: Object },
115
+ },
116
+
117
+ data() {
118
+ return {
119
+ hover: false,
120
+ active: false,
121
+ focus: false,
122
+ blocked: false,
123
+ };
124
+ },
125
+
126
+ computed: {
127
+
128
+ isButton() {
129
+ return this.resolvedProps.tagName === 'button';
130
+ },
131
+
132
+ inactive() {
133
+ return this.resolvedProps.disabled || this.blocked;
134
+ },
135
+
136
+ baseStyle() {
137
+ const { resolvedProps } = this;
138
+ return {
139
+ tone: resolvedProps.tone,
140
+ size: resolvedProps.size,
141
+ flat: resolvedProps.flat,
142
+ outline: resolvedProps.outline,
143
+ round: resolvedProps.round,
144
+ translucent: resolvedProps.translucent,
145
+ ghost: resolvedProps.ghost,
146
+ };
147
+ },
148
+
149
+ effectiveStyle() {
150
+ const {
151
+ baseStyle,
152
+ hoverOverrides = {},
153
+ activeOverrides = {},
154
+ focusOverrides = {},
155
+ active,
156
+ hover,
157
+ focus,
158
+ resolvedProps,
159
+ } = this;
160
+ const { forceActive, forceHover, forceFocus } = resolvedProps;
161
+ const style = Object.assign({}, baseStyle);
162
+ if (active || forceActive) {
163
+ Object.assign(style, activeOverrides);
164
+ }
165
+ if (hover || forceHover) {
166
+ Object.assign(style, hoverOverrides);
167
+ }
168
+ if (focus || forceFocus) {
169
+ Object.assign(style, focusOverrides);
170
+ }
171
+ return style;
172
+ },
173
+
174
+ },
175
+
176
+ methods: {
177
+
178
+ /** Only a `<button>` ignores clicks when disabled: stop them on any other tag (links, router links). */
179
+ onClickCapture(ev) {
180
+ if (this.inactive) {
181
+ ev.preventDefault();
182
+ ev.stopImmediatePropagation();
183
+ }
184
+ },
185
+
186
+ },
187
+
188
+ };
189
+ </script>
190
+
191
+ <style scoped>
192
+ .Btn {
193
+ --Btn-size: var(--input-major-height);
194
+ --Btn-padding: var(--input-major-padding);
195
+ --Btn-gap: var(--input-gap);
196
+ --Btn-font-size: var(--input-font-size);
197
+
198
+ --Btn-text: var(--tone-fill-text);
199
+
200
+ --Btn-outline: transparent;
201
+
202
+ --Btn-fill: var(--tone-fill);
203
+ --Btn-fill-top: var(--tone-fill-top);
204
+ --Btn-fill-bottom: var(--tone-fill-bottom);
205
+ --Btn-background: linear-gradient(
206
+ to bottom,
207
+ var(--Btn-fill-top),
208
+ var(--Btn-fill-bottom)
209
+ );
210
+
211
+ --Btn-border-size: 0px;
212
+ --Btn-border: transparent;
213
+ --Btn-radius: var(--radius-m);
214
+
215
+ --Btn-shadow: var(--tone-shadow);
216
+ --Btn-box-shadow:
217
+ 0 1px 1px var(--Btn-shadow),
218
+ 0 1px 5px var(--shadow-medium);
219
+ --Btn-text-shadow: 0 1px 1px var(--text-shadow-auto);
220
+
221
+ -webkit-appearance: none;
222
+ appearance: none;
223
+
224
+ position: relative;
225
+ margin: 0;
226
+ padding: 0 calc(var(--Btn-padding) - var(--Btn-border-size));
227
+ height: var(--Btn-size);
228
+ line-height: var(--Btn-size);
229
+ box-sizing: border-box;
230
+
231
+ display: inline-flex;
232
+ align-items: center;
233
+ justify-content: flex-start;
234
+ flex-shrink: 0;
235
+ gap: var(--Btn-gap);
236
+
237
+ border: var(--Btn-border-size) solid var(--Btn-border);
238
+ border-radius: var(--Btn-radius);
239
+
240
+ color: var(--Btn-text);
241
+ text-shadow: var(--Btn-text-shadow);
242
+ outline: var(--input-outline-size) solid var(--Btn-outline);
243
+ outline-offset: var(--input-outline-offset);
244
+ background: var(--Btn-background);
245
+ box-shadow: var(--Btn-box-shadow);
246
+
247
+ cursor: pointer;
248
+ user-select: none;
249
+
250
+ font-family: inherit;
251
+ font-size: var(--Btn-font-size);
252
+
253
+ transition: color .3s, outline .3s, filter .3s, border-radius .3s;
254
+ }
255
+
256
+ .Btn::after {
257
+ content: '';
258
+ position: absolute;
259
+ z-index: 1;
260
+ top: 0;
261
+ left: 0;
262
+ width: 100%;
263
+ height: 100%;
264
+ border-radius: var(--Btn-radius);
265
+
266
+ background: var(--input-hover-overlay);
267
+ mix-blend-mode: color-dodge;
268
+ pointer-events: none;
269
+ opacity: 0;
270
+ }
271
+
272
+ .Label {
273
+ line-height: var(--Btn-size);
274
+ white-space: nowrap;
275
+ overflow: hidden;
276
+ text-overflow: ellipsis;
277
+ }
278
+
279
+ .Icon {
280
+ width: var(--sp2);
281
+ display: flex;
282
+ align-items: center;
283
+ justify-content: center;
284
+ font-size: var(--Btn-font-size);
285
+ }
286
+
287
+ .Btn-iconPos-right .Icon {
288
+ order: 100;
289
+ }
290
+
291
+ /* States */
292
+
293
+ .Btn:focus, .Btn:active, .Btn:hover {
294
+ transition: none;
295
+ }
296
+
297
+ .Btn:not(:disabled):hover::after, .Btn.Btn-forceHover::after {
298
+ opacity: 1;
299
+ }
300
+
301
+ .Btn:not(:disabled):focus-visible, .Btn.Btn-forceFocus {
302
+ z-index: 10;
303
+ --Btn-outline: var(--tone-focus-outline);
304
+ --Btn-border: var(--tone-focus-border);
305
+ }
306
+
307
+ .Btn:not(:disabled):active, .Btn.Btn-forceActive {
308
+ padding-top: 1px;
309
+ box-shadow:
310
+ 0 6px 12px var(--shadow-light) inset,
311
+ 0 1px 2px var(--shadow-medium) inset;
312
+ }
313
+
314
+ .Btn-disabled {
315
+ opacity: var(--input-disabled-opacity);
316
+ filter: var(--input-disabled-filter);
317
+ cursor: not-allowed;
318
+ }
319
+
320
+ /* Styles */
321
+
322
+ .Btn-round {
323
+ --Btn-radius: calc(.5 * var(--Btn-size));
324
+ }
325
+
326
+ .Btn-outline {
327
+ --Btn-border: var(--tone-border);
328
+ --Btn-border-size: var(--input-border-size);
329
+ }
330
+
331
+ .Btn-ghost {
332
+ --Btn-fill: transparent;
333
+ --Btn-fill-top: transparent;
334
+ --Btn-fill-bottom: transparent;
335
+ --Btn-border: var(--tone-text);
336
+ --Btn-text: var(--tone-text);
337
+ --Btn-text-shadow: none;
338
+ --Btn-box-shadow: none;
339
+ }
340
+
341
+ .Btn-flat {
342
+ --Btn-fill-top: var(--Btn-fill);
343
+ --Btn-fill-bottom: var(--Btn-fill);
344
+ --Btn-text-shadow: none;
345
+ --Btn-box-shadow: none;
346
+ }
347
+
348
+ .Btn-translucent {
349
+ --Btn-background: linear-gradient(
350
+ to bottom,
351
+ color-mix(in srgb, var(--Btn-fill-top), transparent var(--translucency-mix-light)),
352
+ color-mix(in srgb, var(--Btn-fill-bottom), transparent var(--translucency-mix-light))
353
+ );
354
+ --Btn-box-shadow:
355
+ 0 1px 1px var(--Btn-shadow),
356
+ 0 1px 5px var(--shadow-medium),
357
+ 0 0 3px var(--translucency-highlight) inset;
358
+
359
+ backdrop-filter: blur(var(--translucency-blur));
360
+ }
361
+
362
+ .Btn-flat.Btn-translucent {
363
+ --Btn-box-shadow: 0 0 3px var(--translucency-highlight) inset;
364
+ }
365
+
366
+ .Btn-ghost.Btn-translucent {
367
+ --Btn-background: transparent;
368
+ --Btn-box-shadow: none;
369
+ backdrop-filter: none;
370
+ }
371
+
372
+ .Btn-square {
373
+ padding-left: 0;
374
+ padding-right: 0;
375
+ width: var(--Btn-size);
376
+ justify-content: center;
377
+ }
378
+
379
+ .Btn-block {
380
+ flex: 1 1 auto;
381
+ display: flex;
382
+ justify-content: center;
383
+ }
384
+
385
+ </style>