@daracl/dialog 0.0.6 → 0.0.8

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.
@@ -1,337 +1,360 @@
1
- @import "_icon.scss";
2
-
3
- .daracl-dialog-hidden {
4
- visibility: visible;
5
- width: 0px;
6
- height: 0px;
7
- z-index: 1000;
8
- }
9
-
10
- .daracl-dialog-overlay {
11
- background: #aaaaaa;
12
- opacity: 0.3;
13
- position: fixed;
14
- top: 0;
15
- left: 0;
16
- width: 100%;
17
- height: 100%;
18
- }
19
-
20
- .daracl-dialog-wrapper {
21
- z-index: 10000;
22
- position: fixed;
23
- width: 400px; // 최대 너비
24
- color: #000000; // var(--font-color)
25
- top: 45%;
26
- left: 50%;
27
- transform: translate(-50%, -50%);
28
-
29
- * {
30
- box-sizing: border-box;
31
- }
32
-
33
- &.hide {
34
- display: none;
35
- }
36
-
37
- &.transform-disable {
38
- transform: none !important;
39
- }
40
-
41
- &.move-on {
42
- .dialog-move-overay {
43
- display: block !important;
44
- }
45
-
46
- .resizer {
47
- display: none;
48
- position: relative;
49
- z-index: 0;
50
- }
51
- }
52
-
53
- &.maximise {
54
- width: calc(100% - 6px) !important;
55
- height: calc(100% - 6px) !important;
56
- top: 3px !important;
57
- left: 3px !important;
58
- transform: initial;
59
-
60
- .resizer {
61
- display: none;
62
- }
63
-
64
- .dialog-header {
65
- cursor: default !important;
66
- }
67
- }
68
-
69
- > .daracl-dialog {
70
- border: 1px solid #e6e6e6; // var(--border)
71
- border-radius: 4px;
72
- height: 100%;
73
- position: relative;
74
- background: #ffffff; // var(--bg-color)
75
-
76
- > .dialog-header {
77
- width: 100%;
78
- height: 40px;
79
- padding: 10px 30px 10px 20px;
80
- background: #f5f5f5; // var(--bg-header-color)
81
- border: #e6e6e6; // var(--border)
82
- border-radius: 4px 4px 0px 0px;
83
- cursor: move;
84
-
85
- > .btn-area {
86
- position: absolute;
87
- top: 10px;
88
- right: 10px;
89
-
90
- > .dialog-maximise {
91
- width: 16px;
92
- height: 16px;
93
- display: inline-block;
94
- cursor: pointer;
95
- background-repeat: no-repeat;
96
- background-image: icon(maximise, "6c6c6c");
97
- }
98
- > .dialog-close {
99
- width: 16px;
100
- height: 16px;
101
- display: inline-block;
102
- cursor: pointer;
103
- background-repeat: no-repeat;
104
- background-image: icon(close, "6c6c6c");
105
- }
106
- }
107
- }
108
-
109
- .dialog-move-overay {
110
- width: 100%;
111
- height: 100%;
112
- position: absolute;
113
- z-index: 1;
114
- display: none;
115
- top: 0px;
116
- left: 0px;
117
- opacity: 0;
118
- }
119
-
120
- > .dialog-body {
121
- padding: 10px;
122
- height: calc(100% - 40px - 35px);
123
- border-top: 1px solid #e6e6e6; // var(--border)
124
- border-bottom: 1px solid #e6e6e6; // var(--border)
125
- min-height: 50px;
126
- position: relative;
127
- background-repeat: no-repeat;
128
- background-position: 10px 10px;
129
-
130
- &.primary {
131
- padding-left: 45px;
132
- background-image: icon(primary, "2496ed");
133
- }
134
-
135
- &.secondary {
136
- padding-left: 45px;
137
- background-image: icon(secondary, "2496ed");
138
- }
139
-
140
- &.info {
141
- padding-left: 45px;
142
- background-image: icon(info, "2496ed");
143
- }
144
-
145
- &.success {
146
- padding-left: 45px;
147
- background-image: icon(success, "493fff");
148
- }
149
-
150
- &.warning {
151
- padding-left: 45px;
152
- background-image: icon(warning, "e18787");
153
- }
154
-
155
- &.danger {
156
- padding-left: 45px;
157
- background-image: icon(danger, "ef2e40");
158
- }
159
-
160
- > .dialog-content {
161
- height: 100%;
162
- word-break: keep-all;
163
- word-wrap: break-word;
164
- overflow: auto;
165
-
166
- > .dialog-frame {
167
- width: 100%;
168
- height: 100%;
169
- border: 0;
170
- }
171
- }
172
- }
173
-
174
- > .dialog-footer {
175
- height: 45px;
176
-
177
- > .btn-area {
178
- text-align: right;
179
- padding: 12px 5px 0px;
180
- }
181
- }
182
-
183
- > .resizer {
184
- position: absolute;
185
- z-index: 2;
186
-
187
- &.top {
188
- top: -2px;
189
- left: 0px;
190
- width: 100%;
191
- height: 5px;
192
- cursor: n-resize;
193
- }
194
-
195
- &.left {
196
- top: 0px;
197
- left: -2px;
198
- width: 5px;
199
- height: 100%;
200
- cursor: e-resize;
201
- }
202
-
203
- &.right {
204
- top: 0px;
205
- right: -2px;
206
- width: 5px;
207
- height: 100%;
208
- cursor: w-resize;
209
- }
210
-
211
- &.bottom {
212
- bottom: -2px;
213
- left: 0px;
214
- width: 100%;
215
- height: 5px;
216
- cursor: s-resize;
217
- }
218
-
219
- &.top-left {
220
- top: 0px;
221
- left: 0px;
222
- width: 7px;
223
- height: 7px;
224
- cursor: nwse-resize;
225
- }
226
-
227
- &.top-right {
228
- top: 0px;
229
- right: 0px;
230
- width: 7px;
231
- height: 7px;
232
- cursor: nesw-resize;
233
- }
234
-
235
- &.bottom-left {
236
- bottom: 0px;
237
- left: 0px;
238
- width: 7px;
239
- height: 7px;
240
- cursor: nesw-resize;
241
- }
242
-
243
- &.bottom-right {
244
- bottom: 0px;
245
- right: 0px;
246
- width: 7px;
247
- height: 7px;
248
- cursor: nwse-resize;
249
- }
250
- }
251
-
252
- .dialog-btn {
253
- border-radius: 4px;
254
- background-color: #f2f7f5; /* Green */
255
- border: none;
256
- text-align: center;
257
- font-size: 16px;
258
- padding: 3px 5px;
259
- margin-right: 10px;
260
- cursor: pointer;
261
-
262
- &.primary {
263
- background-color: #cce5ff;
264
- border-color: #b8daff;
265
- color: #ffffff; // var(--light)
266
- }
267
-
268
- &.secondary {
269
- background-color: #e2e3e5;
270
- border-color: #d6d8db;
271
- color: #ffffff; // var(--light)
272
- }
273
-
274
- &.info {
275
- background-color: #d1ecf1;
276
- border-color: #bee5eb;
277
- color: #155724; // var(--dark)
278
- }
279
-
280
- &.success {
281
- background-color: #d4edda;
282
- border-color: #c3e6cb;
283
- color: #155724; // var(--dark)
284
- }
285
-
286
- &.warning {
287
- background-color: #fff3cd;
288
- border-color: #ffeeba;
289
- color: #155724; // var(--dark)
290
- }
291
-
292
- &.danger {
293
- background-color: #f8d7da;
294
- border-color: #f5c6cb;
295
- color: #ffffff; // var(--light)
296
- }
297
- }
298
-
299
- &.hide {
300
- animation: fadeOut 0.3s;
301
- animation-fill-mode: forwards;
302
- }
303
- }
304
- }
305
-
306
- @keyframes fadeIn {
307
- from {
308
- opacity: 0;
309
- }
310
- to {
311
- opacity: 1;
312
- }
313
- }
314
-
315
- @keyframes fadeOut {
316
- from {
317
- opacity: 1;
318
- }
319
- to {
320
- opacity: 0;
321
- }
322
- }
323
-
324
- @keyframes daradialogHide {
325
- 0% {
326
- transform: translateX(-10px);
327
- }
328
- 40% {
329
- transform: translateX(0%);
330
- }
331
- 80% {
332
- transform: translateX(-5%);
333
- }
334
- 100% {
335
- transform: translateX(calc(100% + 20px));
336
- }
337
- }
1
+ // 색상 / 테두리 같은 공통 값은 @daracl/ui-style 의 테마 변수(--dui-*)를 사용한다. (light 값이 fallback 으로 들어 있음)
2
+ // dark 는 앱이 '@daracl/ui-style/theme-vars.css' 를 로드하고 <html data-daracl-theme="dark"> 로 전환한다.
3
+ @use "@daracl/ui-style/abstracts" as style;
4
+ @use "@daracl/ui-style/themes" as themes;
5
+ @use "@daracl/ui-style/base" as base;
6
+ @use "_icon" as icon;
7
+ @use "./themes" as theme;
8
+
9
+ // ==========================================================================
10
+ // Theme (ui-grid 와 같은 구조)
11
+ // ==========================================================================
12
+ // 공통 색상(--dui-*) 기본값. 특이도 0(:where)으로 출력하므로 앱이 theme-vars.css 를 로드하지 않아도
13
+ // light / OS 다크 / data-daracl-theme 전환이 동작하고, 앱이 theme-vars.css 를 로드하거나 :root 에 값을 지정하면 그 값이 이긴다.
14
+ // dialog 하나만 다른 테마로 표시하려면 theme 옵션 또는 setTheme() 을 쓴다. (.daracl-dialog-wrapper 에 data-daracl-theme 지정)
15
+ $default-theme: theme.$default-theme;
16
+
17
+ @include themes.define-theme-defaults($default: $default-theme);
18
+
19
+ // dialog 전용 값(--ddlg-*) : 전역 테마(data-daracl-theme)와 dialog 별 테마([data-daracl-theme] 가 붙은 wrapper / overlay) 모두 처리한다.
20
+ // $auto-dark : 공통 색상(--dui-*)이 OS 다크 설정을 따르므로 dialog 전용 값도 같이 따르게 한다. (ui-grid 는 지정하지 않음)
21
+ @include themes.define-themes(".daracl-dialog-wrapper, .daracl-dialog-overlay", $default: $default-theme, $auto-dark: true, $prefix: "ddlg", $themes: theme.$themes);
22
+
23
+ // dialog 전용 변수 참조 : var(--ddlg-키, light값)
24
+ @function ddlg($name) {
25
+ @return themes.themed($name, $prefix: "ddlg", $themes: theme.$themes);
26
+ }
27
+
28
+ .daracl-dialog-hidden {
29
+ visibility: visible;
30
+ width: 0px;
31
+ height: 0px;
32
+ z-index: #{style.$z-dropdown};
33
+ }
34
+
35
+ .daracl-dialog-overlay {
36
+ background: ddlg(overlay-bg);
37
+ opacity: ddlg(overlay-opacity);
38
+ position: fixed;
39
+ top: 0;
40
+ left: 0;
41
+ width: 100%;
42
+ height: 100%;
43
+ }
44
+
45
+ .daracl-dialog-wrapper {
46
+ z-index: #{style.$z-modal};
47
+ position: fixed;
48
+ width: 400px; // 최대 너비
49
+ color: themes.themed(font-color);
50
+ top: 45%;
51
+ left: 50%;
52
+ transform: translate(-50%, -50%);
53
+
54
+ * {
55
+ box-sizing: border-box;
56
+ }
57
+
58
+ &.hide {
59
+ display: none;
60
+ }
61
+
62
+ &:focus {
63
+ outline: none;
64
+ }
65
+
66
+ &.transform-disable {
67
+ transform: none !important;
68
+ }
69
+
70
+ &.move-on {
71
+ .dialog-move-overay {
72
+ display: block !important;
73
+ }
74
+
75
+ .resizer {
76
+ display: none;
77
+ position: relative;
78
+ z-index: 0;
79
+ }
80
+ }
81
+
82
+ &.maximise {
83
+ width: calc(100% - 6px) !important;
84
+ height: calc(100% - 6px) !important;
85
+ top: 3px !important;
86
+ left: 3px !important;
87
+ transform: initial;
88
+
89
+ .resizer {
90
+ display: none;
91
+ }
92
+
93
+ .dialog-header {
94
+ cursor: default !important;
95
+ }
96
+ }
97
+
98
+ > .daracl-dialog {
99
+ border: 1px solid themes.themed(border-light-color);
100
+ border-radius: 4px;
101
+ height: 100%;
102
+ position: relative;
103
+ background: themes.themed(body-bg);
104
+
105
+ > .dialog-header {
106
+ width: 100%;
107
+ height: 40px;
108
+ padding: 10px 30px 10px 20px;
109
+ background: themes.themed(panel-header-bg);
110
+ border: themes.themed(border-light-color);
111
+ border-radius: 4px 4px 0px 0px;
112
+ cursor: move;
113
+
114
+ > .btn-area {
115
+ position: absolute;
116
+ top: 10px;
117
+ right: 10px;
118
+
119
+ > .dialog-maximise {
120
+ width: 16px;
121
+ height: 16px;
122
+ display: inline-block;
123
+ cursor: pointer;
124
+ background-repeat: no-repeat;
125
+ background-image: icon.get(maximise, "6c6c6c");
126
+ }
127
+ > .dialog-close {
128
+ width: 16px;
129
+ height: 16px;
130
+ display: inline-block;
131
+ cursor: pointer;
132
+ background-repeat: no-repeat;
133
+ background-image: icon.get(close, "6c6c6c");
134
+ }
135
+ }
136
+ }
137
+
138
+ .dialog-move-overay {
139
+ width: 100%;
140
+ height: 100%;
141
+ position: absolute;
142
+ z-index: 1;
143
+ display: none;
144
+ top: 0px;
145
+ left: 0px;
146
+ opacity: 0;
147
+ }
148
+
149
+ > .dialog-body {
150
+ padding: 10px;
151
+ height: calc(100% - 40px - 35px);
152
+ border-top: 1px solid themes.themed(border-light-color);
153
+ border-bottom: 1px solid themes.themed(border-light-color);
154
+ min-height: 50px;
155
+ position: relative;
156
+ background-repeat: no-repeat;
157
+ background-position: 10px 10px;
158
+
159
+ &.primary {
160
+ padding-left: 45px;
161
+ background-image: icon.get(primary, "2496ed");
162
+ }
163
+
164
+ &.secondary {
165
+ padding-left: 45px;
166
+ background-image: icon.get(secondary, "2496ed");
167
+ }
168
+
169
+ &.info {
170
+ padding-left: 45px;
171
+ background-image: icon.get(info, "2496ed");
172
+ }
173
+
174
+ &.success {
175
+ padding-left: 45px;
176
+ background-image: icon.get(success, "493fff");
177
+ }
178
+
179
+ &.warning {
180
+ padding-left: 45px;
181
+ background-image: icon.get(warning, "e18787");
182
+ }
183
+
184
+ &.danger {
185
+ padding-left: 45px;
186
+ background-image: icon.get(danger, "ef2e40");
187
+ }
188
+
189
+ > .dialog-content {
190
+ height: 100%;
191
+ word-break: keep-all;
192
+ word-wrap: break-word;
193
+ overflow: auto;
194
+
195
+ > .dialog-frame {
196
+ width: 100%;
197
+ height: 100%;
198
+ border: 0;
199
+ }
200
+ }
201
+ }
202
+
203
+ > .dialog-footer {
204
+ height: 45px;
205
+
206
+ > .btn-area {
207
+ text-align: right;
208
+ padding: 12px 5px 0px;
209
+ }
210
+ }
211
+
212
+ > .resizer {
213
+ position: absolute;
214
+ z-index: 2;
215
+
216
+ &.top {
217
+ top: -2px;
218
+ left: 0px;
219
+ width: 100%;
220
+ height: 5px;
221
+ cursor: n-resize;
222
+ }
223
+
224
+ &.left {
225
+ top: 0px;
226
+ left: -2px;
227
+ width: 5px;
228
+ height: 100%;
229
+ cursor: e-resize;
230
+ }
231
+
232
+ &.right {
233
+ top: 0px;
234
+ right: -2px;
235
+ width: 5px;
236
+ height: 100%;
237
+ cursor: w-resize;
238
+ }
239
+
240
+ &.bottom {
241
+ bottom: -2px;
242
+ left: 0px;
243
+ width: 100%;
244
+ height: 5px;
245
+ cursor: s-resize;
246
+ }
247
+
248
+ &.top-left {
249
+ top: 0px;
250
+ left: 0px;
251
+ width: 7px;
252
+ height: 7px;
253
+ cursor: nwse-resize;
254
+ }
255
+
256
+ &.top-right {
257
+ top: 0px;
258
+ right: 0px;
259
+ width: 7px;
260
+ height: 7px;
261
+ cursor: nesw-resize;
262
+ }
263
+
264
+ &.bottom-left {
265
+ bottom: 0px;
266
+ left: 0px;
267
+ width: 7px;
268
+ height: 7px;
269
+ cursor: nesw-resize;
270
+ }
271
+
272
+ &.bottom-right {
273
+ bottom: 0px;
274
+ right: 0px;
275
+ width: 7px;
276
+ height: 7px;
277
+ cursor: nwse-resize;
278
+ }
279
+ }
280
+
281
+ .dialog-btn {
282
+ border-radius: 4px;
283
+ background-color: themes.themed(hover-bg);
284
+ border: none;
285
+ text-align: center;
286
+ font-size: 16px;
287
+ padding: 3px 5px;
288
+ margin-right: 10px;
289
+ cursor: pointer;
290
+ color: themes.themed(font-color);
291
+ display: inline-block;
292
+
293
+ &.primary {
294
+ background-color: ddlg(btn-primary-bg);
295
+ border-color: ddlg(btn-primary-border-color);
296
+ color: ddlg(btn-primary-color);
297
+ }
298
+
299
+ &.secondary {
300
+ background-color: ddlg(btn-secondary-bg);
301
+ border-color: ddlg(btn-secondary-border-color);
302
+ color: ddlg(btn-secondary-color);
303
+ }
304
+
305
+ &.info {
306
+ background-color: ddlg(btn-info-bg);
307
+ border-color: ddlg(btn-info-border-color);
308
+ color: ddlg(btn-info-color);
309
+ }
310
+
311
+ &.success {
312
+ background-color: ddlg(btn-success-bg);
313
+ border-color: ddlg(btn-success-border-color);
314
+ color: ddlg(btn-success-color);
315
+ }
316
+
317
+ &.warning {
318
+ background-color: ddlg(btn-warning-bg);
319
+ border-color: ddlg(btn-warning-border-color);
320
+ color: ddlg(btn-warning-color);
321
+ }
322
+
323
+ &.danger {
324
+ background-color: ddlg(btn-danger-bg);
325
+ border-color: ddlg(btn-danger-border-color);
326
+ color: ddlg(btn-danger-color);
327
+ }
328
+ }
329
+
330
+ // 키보드 포커스 표시 (span 버튼은 tabindex 로 포커스를 받는다)
331
+ .dialog-btn:focus-visible,
332
+ .dialog-maximise:focus-visible,
333
+ .dialog-close:focus-visible {
334
+ outline: 2px solid themes.themed(selected-border-color);
335
+ outline-offset: 1px;
336
+ }
337
+
338
+ &.hide {
339
+ animation: ddlg-fade-out 0.3s;
340
+ animation-fill-mode: forwards;
341
+ }
342
+ }
343
+ }
344
+
345
+ @include base.keyframes-fade('ddlg');
346
+
347
+ @keyframes daradialogHide {
348
+ 0% {
349
+ transform: translateX(-10px);
350
+ }
351
+ 40% {
352
+ transform: translateX(0%);
353
+ }
354
+ 80% {
355
+ transform: translateX(-5%);
356
+ }
357
+ 100% {
358
+ transform: translateX(calc(100% + 20px));
359
+ }
360
+ }