mertani-web-toolkit 0.1.33 → 0.1.34

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.
@@ -2,8 +2,9 @@
2
2
  import './button.css';
3
3
  import { Icon } from '../../index.js';
4
4
  import type { TIconName } from '../../icons/index.js';
5
+ import type { HTMLButtonAttributes } from 'svelte/elements';
5
6
 
6
- interface Props {
7
+ interface Props extends Omit<HTMLButtonAttributes, 'type'> {
7
8
  // ===Styles===
8
9
  type?: 'solid' | 'outline';
9
10
  size?: 48 | 40 | 32;
@@ -28,7 +29,7 @@
28
29
  // Additional Actions
29
30
  isLoading?: boolean;
30
31
  isShow?: boolean;
31
- isDisabled?: boolean;
32
+ disabled?: boolean;
32
33
  tooltip?: string;
33
34
 
34
35
  // Any
@@ -57,7 +58,7 @@
57
58
  // Additional Actions
58
59
  isLoading = false,
59
60
  isShow = true,
60
- isDisabled = false,
61
+ disabled = false,
61
62
  tooltip = '',
62
63
 
63
64
  class: className = '',
@@ -140,7 +141,7 @@
140
141
  classes.push('btn-loading');
141
142
  }
142
143
 
143
- if (isDisabled) {
144
+ if (disabled) {
144
145
  classes.push('btn-disabled');
145
146
  }
146
147
 
@@ -152,13 +153,13 @@
152
153
  });
153
154
 
154
155
  function handleClick() {
155
- if (!isDisabled && !isLoading && onclick) {
156
+ if (!disabled && !isLoading && onclick) {
156
157
  onclick();
157
158
  }
158
159
  }
159
160
 
160
161
  function handleMouseEnter() {
161
- if (!isDisabled && !isLoading && onmouseenter) {
162
+ if (!disabled && !isLoading && onmouseenter) {
162
163
  onmouseenter();
163
164
  }
164
165
  }
@@ -169,7 +170,7 @@
169
170
  type="button"
170
171
  class={buttonClasses()}
171
172
  style={buttonStyles()}
172
- disabled={isDisabled || isLoading}
173
+ disabled={disabled || isLoading}
173
174
  onclick={handleClick}
174
175
  onmouseenter={handleMouseEnter}
175
176
  title={tooltip || ''}
@@ -1,6 +1,7 @@
1
1
  import './button.css';
2
2
  import type { TIconName } from '../../icons/index.js';
3
- interface Props {
3
+ import type { HTMLButtonAttributes } from 'svelte/elements';
4
+ interface Props extends Omit<HTMLButtonAttributes, 'type'> {
4
5
  type?: 'solid' | 'outline';
5
6
  size?: 48 | 40 | 32;
6
7
  backgroundColor?: string;
@@ -17,7 +18,7 @@ interface Props {
17
18
  onmouseenter?: () => void;
18
19
  isLoading?: boolean;
19
20
  isShow?: boolean;
20
- isDisabled?: boolean;
21
+ disabled?: boolean;
21
22
  tooltip?: string;
22
23
  class?: string;
23
24
  style?: string;
@@ -0,0 +1,171 @@
1
+ .select-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 100%;
5
+ }
6
+
7
+ .select-container.select-side {
8
+ flex-direction: row;
9
+ align-items: center;
10
+ gap: 12px;
11
+ }
12
+
13
+ .select-label {
14
+ font-size: 14px;
15
+ font-weight: 400;
16
+ color: var(--color-text-primary);
17
+ margin-bottom: 8px;
18
+ display: block;
19
+ }
20
+
21
+ .select-container.select-side .select-label {
22
+ margin-bottom: 0;
23
+ min-width: 120px;
24
+ }
25
+
26
+ .select-label.label-left {
27
+ text-align: left;
28
+ }
29
+
30
+ .select-label.label-right {
31
+ text-align: right;
32
+ }
33
+
34
+ .label-required {
35
+ color: var(--color-text-error-ti);
36
+ margin-left: 4px;
37
+ }
38
+
39
+ .label-subLabel {
40
+ font-weight: 400;
41
+ color: var(--color-text-tertiary);
42
+ margin-left: 4px;
43
+ }
44
+
45
+ .select-trigger {
46
+ flex: 1;
47
+ display: flex;
48
+ width: 100%;
49
+ align-items: center;
50
+ justify-content: space-between;
51
+ border-radius: 6px;
52
+ border: 1px solid var(--color-border-form);
53
+ padding: 0.625rem 1rem;
54
+ text-align: left;
55
+ font-size: 14px;
56
+ color: var(--color-text-primary);
57
+ transition:
58
+ border-color 0.2s,
59
+ box-shadow 0.2s;
60
+ }
61
+
62
+ .select-trigger:not(:disabled) {
63
+ background: var(--color-bg-surface);
64
+ cursor: pointer;
65
+ }
66
+
67
+ .select-trigger:not(:disabled):hover {
68
+ border-color: var(--color-border-form);
69
+ }
70
+
71
+ .select-trigger:not(:disabled):focus {
72
+ outline: none;
73
+ border-color: var(--color-bg-act-primary);
74
+ box-shadow: 0 0 0 2px var(--color-bg-act-primary) 40;
75
+ }
76
+
77
+ .select-trigger:disabled {
78
+ cursor: not-allowed;
79
+ background: var(--color-bg-disabled);
80
+ }
81
+
82
+ .select-trigger.error:not(:disabled) {
83
+ border-color: var(--color-text-error-ti);
84
+ }
85
+
86
+ .select-trigger.error:not(:disabled):focus {
87
+ border-color: var(--color-text-error-ti);
88
+ box-shadow: 0 0 0 2px var(--color-text-error-ti) 40;
89
+ }
90
+
91
+ .select-menu {
92
+ position: absolute;
93
+ right: 0;
94
+ left: 0;
95
+ z-index: 20;
96
+ overflow: hidden;
97
+ border-radius: 6px;
98
+ background: var(--color-bg-surface);
99
+ box-shadow:
100
+ 0 4px 6px -1px rgba(0, 0, 0, 0.1),
101
+ 0 2px 4px -1px rgba(0, 0, 0, 0.06);
102
+ }
103
+
104
+ .select-option {
105
+ display: flex;
106
+ width: 100%;
107
+ align-items: center;
108
+ justify-content: space-between;
109
+ gap: 0.5rem;
110
+ padding: 0.5rem 0.75rem;
111
+ text-align: left;
112
+ font-size: 14px;
113
+ transition: background-color 0.15s;
114
+ color: var(--color-text-primary);
115
+ background: transparent;
116
+ border: none;
117
+ cursor: pointer;
118
+ }
119
+
120
+ .select-option:hover:not(.selected) {
121
+ background: var(--color-bg-disabled);
122
+ }
123
+
124
+ .select-option.selected {
125
+ color: var(--color-bg-act-primary);
126
+ }
127
+
128
+ .select-empty {
129
+ padding: 0.5rem 0.75rem;
130
+ font-size: 12px;
131
+ color: var(--color-text-tertiary);
132
+ }
133
+
134
+ .search-input {
135
+ width: 100%;
136
+ border-radius: 6px;
137
+ border: 1px solid var(--color-border-form);
138
+ background: var(--color-bg-surface);
139
+ padding: 0.5rem 2.25rem 0.5rem 0.75rem;
140
+ font-size: 14px;
141
+ color: var(--color-text-primary);
142
+ }
143
+
144
+ .search-input::placeholder {
145
+ color: var(--color-text-tertiary);
146
+ }
147
+
148
+ .search-input:focus {
149
+ outline: none;
150
+ }
151
+
152
+ .search-icon {
153
+ pointer-events: none;
154
+ position: absolute;
155
+ top: 50%;
156
+ right: 0.75rem;
157
+ transform: translateY(-50%);
158
+ color: var(--color-text-tertiary);
159
+ }
160
+
161
+ .options-container {
162
+ max-height: 14rem;
163
+ overflow-y: auto;
164
+ padding: 0.25rem 0;
165
+ }
166
+
167
+ .error-message {
168
+ margin-top: 8px;
169
+ font-size: 12px;
170
+ color: var(--color-text-error-ti);
171
+ }