@daracl/dialog 0.0.7 → 0.0.9

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,365 @@
1
- @use "_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.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.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.icon(primary, "2496ed");
133
- }
134
-
135
- &.secondary {
136
- padding-left: 45px;
137
- background-image: icon.icon(secondary, "2496ed");
138
- }
139
-
140
- &.info {
141
- padding-left: 45px;
142
- background-image: icon.icon(info, "2496ed");
143
- }
144
-
145
- &.success {
146
- padding-left: 45px;
147
- background-image: icon.icon(success, "493fff");
148
- }
149
-
150
- &.warning {
151
- padding-left: 45px;
152
- background-image: icon.icon(warning, "e18787");
153
- }
154
-
155
- &.danger {
156
- padding-left: 45px;
157
- background-image: icon.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
+ // draggable: false 이면 header 에 move 커서를 표시하지 않는다.
71
+ &.draggable > .daracl-dialog > .dialog-header {
72
+ cursor: move;
73
+ }
74
+
75
+ &.move-on {
76
+ .dialog-move-overay {
77
+ display: block !important;
78
+ }
79
+
80
+ .resizer {
81
+ display: none;
82
+ position: relative;
83
+ z-index: 0;
84
+ }
85
+ }
86
+
87
+ &.maximise {
88
+ width: calc(100% - 6px) !important;
89
+ height: calc(100% - 6px) !important;
90
+ top: 3px !important;
91
+ left: 3px !important;
92
+ transform: initial;
93
+
94
+ .resizer {
95
+ display: none;
96
+ }
97
+
98
+ .dialog-header {
99
+ cursor: default !important;
100
+ }
101
+ }
102
+
103
+ > .daracl-dialog {
104
+ border: 1px solid themes.themed(border-light-color);
105
+ border-radius: 4px;
106
+ height: 100%;
107
+ position: relative;
108
+ background: themes.themed(body-bg);
109
+
110
+ > .dialog-header {
111
+ width: 100%;
112
+ height: 40px;
113
+ padding: 10px 30px 10px 20px;
114
+ background: themes.themed(panel-header-bg);
115
+ border: themes.themed(border-light-color);
116
+ border-radius: 4px 4px 0px 0px;
117
+ cursor: default;
118
+
119
+ > .btn-area {
120
+ position: absolute;
121
+ top: 10px;
122
+ right: 10px;
123
+
124
+ > .dialog-maximise {
125
+ width: 16px;
126
+ height: 16px;
127
+ display: inline-block;
128
+ cursor: pointer;
129
+ background-repeat: no-repeat;
130
+ background-image: icon.get(maximise, "6c6c6c");
131
+ }
132
+ > .dialog-close {
133
+ width: 16px;
134
+ height: 16px;
135
+ display: inline-block;
136
+ cursor: pointer;
137
+ background-repeat: no-repeat;
138
+ background-image: icon.get(close, "6c6c6c");
139
+ }
140
+ }
141
+ }
142
+
143
+ .dialog-move-overay {
144
+ width: 100%;
145
+ height: 100%;
146
+ position: absolute;
147
+ z-index: 1;
148
+ display: none;
149
+ top: 0px;
150
+ left: 0px;
151
+ opacity: 0;
152
+ }
153
+
154
+ > .dialog-body {
155
+ padding: 10px;
156
+ height: calc(100% - 40px - 35px);
157
+ border-top: 1px solid themes.themed(border-light-color);
158
+ border-bottom: 1px solid themes.themed(border-light-color);
159
+ min-height: 50px;
160
+ position: relative;
161
+ background-repeat: no-repeat;
162
+ background-position: 10px 10px;
163
+
164
+ &.primary {
165
+ padding-left: 45px;
166
+ background-image: icon.get(primary, "2496ed");
167
+ }
168
+
169
+ &.secondary {
170
+ padding-left: 45px;
171
+ background-image: icon.get(secondary, "2496ed");
172
+ }
173
+
174
+ &.info {
175
+ padding-left: 45px;
176
+ background-image: icon.get(info, "2496ed");
177
+ }
178
+
179
+ &.success {
180
+ padding-left: 45px;
181
+ background-image: icon.get(success, "493fff");
182
+ }
183
+
184
+ &.warning {
185
+ padding-left: 45px;
186
+ background-image: icon.get(warning, "e18787");
187
+ }
188
+
189
+ &.danger {
190
+ padding-left: 45px;
191
+ background-image: icon.get(danger, "ef2e40");
192
+ }
193
+
194
+ > .dialog-content {
195
+ height: 100%;
196
+ word-break: keep-all;
197
+ word-wrap: break-word;
198
+ overflow: auto;
199
+
200
+ > .dialog-frame {
201
+ width: 100%;
202
+ height: 100%;
203
+ border: 0;
204
+ }
205
+ }
206
+ }
207
+
208
+ > .dialog-footer {
209
+ height: 45px;
210
+
211
+ > .btn-area {
212
+ text-align: right;
213
+ padding: 12px 5px 0px;
214
+ }
215
+ }
216
+
217
+ > .resizer {
218
+ position: absolute;
219
+ z-index: 2;
220
+
221
+ &.top {
222
+ top: -2px;
223
+ left: 0px;
224
+ width: 100%;
225
+ height: 5px;
226
+ cursor: n-resize;
227
+ }
228
+
229
+ &.left {
230
+ top: 0px;
231
+ left: -2px;
232
+ width: 5px;
233
+ height: 100%;
234
+ cursor: e-resize;
235
+ }
236
+
237
+ &.right {
238
+ top: 0px;
239
+ right: -2px;
240
+ width: 5px;
241
+ height: 100%;
242
+ cursor: w-resize;
243
+ }
244
+
245
+ &.bottom {
246
+ bottom: -2px;
247
+ left: 0px;
248
+ width: 100%;
249
+ height: 5px;
250
+ cursor: s-resize;
251
+ }
252
+
253
+ &.top-left {
254
+ top: 0px;
255
+ left: 0px;
256
+ width: 7px;
257
+ height: 7px;
258
+ cursor: nwse-resize;
259
+ }
260
+
261
+ &.top-right {
262
+ top: 0px;
263
+ right: 0px;
264
+ width: 7px;
265
+ height: 7px;
266
+ cursor: nesw-resize;
267
+ }
268
+
269
+ &.bottom-left {
270
+ bottom: 0px;
271
+ left: 0px;
272
+ width: 7px;
273
+ height: 7px;
274
+ cursor: nesw-resize;
275
+ }
276
+
277
+ &.bottom-right {
278
+ bottom: 0px;
279
+ right: 0px;
280
+ width: 7px;
281
+ height: 7px;
282
+ cursor: nwse-resize;
283
+ }
284
+ }
285
+
286
+ .dialog-btn {
287
+ border-radius: 4px;
288
+ background-color: themes.themed(hover-bg);
289
+ border: none;
290
+ text-align: center;
291
+ font-size: 16px;
292
+ padding: 3px 5px;
293
+ margin-right: 10px;
294
+ cursor: pointer;
295
+ color: themes.themed(font-color);
296
+ display: inline-block;
297
+
298
+ &.primary {
299
+ background-color: ddlg(btn-primary-bg);
300
+ border-color: ddlg(btn-primary-border-color);
301
+ color: ddlg(btn-primary-color);
302
+ }
303
+
304
+ &.secondary {
305
+ background-color: ddlg(btn-secondary-bg);
306
+ border-color: ddlg(btn-secondary-border-color);
307
+ color: ddlg(btn-secondary-color);
308
+ }
309
+
310
+ &.info {
311
+ background-color: ddlg(btn-info-bg);
312
+ border-color: ddlg(btn-info-border-color);
313
+ color: ddlg(btn-info-color);
314
+ }
315
+
316
+ &.success {
317
+ background-color: ddlg(btn-success-bg);
318
+ border-color: ddlg(btn-success-border-color);
319
+ color: ddlg(btn-success-color);
320
+ }
321
+
322
+ &.warning {
323
+ background-color: ddlg(btn-warning-bg);
324
+ border-color: ddlg(btn-warning-border-color);
325
+ color: ddlg(btn-warning-color);
326
+ }
327
+
328
+ &.danger {
329
+ background-color: ddlg(btn-danger-bg);
330
+ border-color: ddlg(btn-danger-border-color);
331
+ color: ddlg(btn-danger-color);
332
+ }
333
+ }
334
+
335
+ // 키보드 포커스 표시 (span 버튼은 tabindex 로 포커스를 받는다)
336
+ .dialog-btn:focus-visible,
337
+ .dialog-maximise:focus-visible,
338
+ .dialog-close:focus-visible {
339
+ outline: 2px solid themes.themed(selected-border-color);
340
+ outline-offset: 1px;
341
+ }
342
+
343
+ &.hide {
344
+ animation: ddlg-fade-out 0.3s;
345
+ animation-fill-mode: forwards;
346
+ }
347
+ }
348
+ }
349
+
350
+ @include base.keyframes-fade('ddlg');
351
+
352
+ @keyframes daradialogHide {
353
+ 0% {
354
+ transform: translateX(-10px);
355
+ }
356
+ 40% {
357
+ transform: translateX(0%);
358
+ }
359
+ 80% {
360
+ transform: translateX(-5%);
361
+ }
362
+ 100% {
363
+ transform: translateX(calc(100% + 20px));
364
+ }
365
+ }