@per-diem-calculator/vanilla 1.0.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.
- package/.prettierrc +17 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/eslint.config.js +29 -0
- package/index.html +11 -0
- package/package.json +49 -0
- package/public/output.css +2503 -0
- package/src/css/_styles.css +8 -0
- package/src/css/colors.css +45 -0
- package/src/css/fonts.css +9 -0
- package/src/css/rows/_heights.css +6 -0
- package/src/css/rows/_index.css +15 -0
- package/src/css/rows/add.css +18 -0
- package/src/css/rows/animate-btns.css +18 -0
- package/src/css/rows/animate-row-close.css +18 -0
- package/src/css/rows/animate-row-open.css +14 -0
- package/src/css/rows/animate-row-other.css +5 -0
- package/src/css/rows/btn-add-row.css +41 -0
- package/src/css/rows/btn-delete.css +22 -0
- package/src/css/rows/btn-expenses-calculate.css +22 -0
- package/src/css/rows/btn-expenses-category.css +22 -0
- package/src/css/rows/delete.css +10 -0
- package/src/css/rows/details.css +22 -0
- package/src/css/rows/expense.css +18 -0
- package/src/css/rows/location.css +34 -0
- package/src/css/rows/summary.css +22 -0
- package/src/css/tom-select/defaults.css +530 -0
- package/src/css/tom-select/overrides.css +55 -0
- package/src/css/tw-shadow-props.css +50 -0
- package/src/index.ts +1 -0
- package/src/ts/components/Button/Button.ts +50 -0
- package/src/ts/components/Button/template.html +34 -0
- package/src/ts/components/ExpenseRow/ExpenseRow.ts +397 -0
- package/src/ts/components/ExpenseRow/template.html +260 -0
- package/src/ts/components/Label/Label.ts +45 -0
- package/src/ts/components/Label/template.html +1 -0
- package/src/ts/components/LocationCategory/LocationCategory.ts +226 -0
- package/src/ts/components/LocationCategory/template.html +520 -0
- package/src/ts/components/LocationDate/LocationDate.ts +366 -0
- package/src/ts/components/LocationDate/template.html +27 -0
- package/src/ts/components/LocationSelect/LocationSelect.ts +299 -0
- package/src/ts/components/LocationSelect/template.html +45 -0
- package/src/ts/components/index.ts +6 -0
- package/src/ts/controller.ts +193 -0
- package/src/ts/model.ts +163 -0
- package/src/ts/types/config.ts +22 -0
- package/src/ts/types/dates.ts +82 -0
- package/src/ts/types/expenses.ts +73 -0
- package/src/ts/types/locations.ts +25 -0
- package/src/ts/utils/config/configDefault.ts +13 -0
- package/src/ts/utils/config/index.ts +12 -0
- package/src/ts/utils/config/numbers.ts +24 -0
- package/src/ts/utils/config/sanitizeConfig.ts +39 -0
- package/src/ts/utils/dates/INPUT_DATE_MINMAX.ts +5 -0
- package/src/ts/utils/dates/YEAR_REGEX.ts +4 -0
- package/src/ts/utils/dates/getDateSlice.ts +54 -0
- package/src/ts/utils/dates/getValidAPIYear.ts +17 -0
- package/src/ts/utils/dates/index.ts +19 -0
- package/src/ts/utils/dates/isDateRaw.ts +90 -0
- package/src/ts/utils/dates/isShortMonth.ts +24 -0
- package/src/ts/utils/dates/isYYYY.ts +10 -0
- package/src/ts/utils/dates/offsetDateString.ts +17 -0
- package/src/ts/utils/expenses/INTL_MIE_RATES.ts +2125 -0
- package/src/ts/utils/expenses/createExpenseObjs.ts +35 -0
- package/src/ts/utils/expenses/getLodgingRateDomestic.ts +73 -0
- package/src/ts/utils/expenses/getLodgingRateIntl.ts +119 -0
- package/src/ts/utils/expenses/getMieRates.ts +84 -0
- package/src/ts/utils/expenses/index.ts +5 -0
- package/src/ts/utils/expenses/parseIntlLodgingRates.ts +124 -0
- package/src/ts/utils/expenses/returnValidStateExpense.ts +46 -0
- package/src/ts/utils/fetch/fetchJsonGSA.ts +29 -0
- package/src/ts/utils/fetch/fetchXmlDOD.ts +38 -0
- package/src/ts/utils/fetch/index.ts +3 -0
- package/src/ts/utils/fetch/memoize.ts +46 -0
- package/src/ts/utils/fetch/parseXml.ts +19 -0
- package/src/ts/utils/locations/getCitiesDomestic.ts +48 -0
- package/src/ts/utils/locations/getCitiesIntl.ts +63 -0
- package/src/ts/utils/locations/getCountriesDomestic.ts +237 -0
- package/src/ts/utils/locations/getCountriesIntl.ts +34 -0
- package/src/ts/utils/locations/index.ts +6 -0
- package/src/ts/utils/locations/keepUniqueLocations.ts +12 -0
- package/src/ts/utils/locations/locationKeys.ts +10 -0
- package/src/ts/utils/locations/returnValidStateLocation.ts +13 -0
- package/src/ts/utils/locations/sortLocations.ts +19 -0
- package/src/ts/utils/misc/USD.ts +4 -0
- package/src/ts/utils/misc/debounce.ts +22 -0
- package/src/ts/utils/misc/handlePointerDown.ts +3 -0
- package/src/ts/utils/misc/handlePointerUp.ts +22 -0
- package/src/ts/utils/misc/inPrimitiveType.ts +4 -0
- package/src/ts/utils/misc/index.ts +6 -0
- package/src/ts/utils/misc/wait.ts +4 -0
- package/src/ts/utils/styles/applyStyles.ts +19 -0
- package/src/ts/utils/styles/highlightInput.ts +15 -0
- package/src/ts/utils/styles/index.ts +3 -0
- package/src/ts/utils/styles/removeStyles.ts +14 -0
- package/src/ts/views/Expense/Expense.ts +465 -0
- package/src/ts/views/Expense/template.html +176 -0
- package/src/ts/views/Location/Location.ts +763 -0
- package/src/ts/views/Location/template-row.html +146 -0
- package/src/ts/views/Location/template.html +130 -0
- package/src/ts/views/index.ts +2 -0
- package/tsconfig.json +27 -0
- package/vite.config.ts +12 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
/* From '../../node_modules/tom-select/dist/css/tom-select.default.css'
|
|
2
|
+
*/
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* tom-select.css (v2.4.3)
|
|
6
|
+
* Copyright (c) contributors
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
|
|
9
|
+
* file except in compliance with the License. You may obtain a copy of the License at:
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
14
|
+
* ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
* governing permissions and limitations under the License.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
.ts-control {
|
|
19
|
+
border: 1px solid #d0d0d0;
|
|
20
|
+
padding: 8px 8px;
|
|
21
|
+
width: 100%;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
position: relative;
|
|
24
|
+
z-index: 1;
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
|
|
27
|
+
border-radius: 3px;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-wrap: wrap;
|
|
30
|
+
}
|
|
31
|
+
.ts-wrapper.multi.has-items .ts-control {
|
|
32
|
+
padding: calc(8px - 2px - 1px) 8px calc(8px - 2px - 3px - 1px);
|
|
33
|
+
}
|
|
34
|
+
.full .ts-control {
|
|
35
|
+
background-color: #fff;
|
|
36
|
+
}
|
|
37
|
+
.disabled .ts-control,
|
|
38
|
+
.disabled .ts-control * {
|
|
39
|
+
cursor: default !important;
|
|
40
|
+
}
|
|
41
|
+
.focus .ts-control {
|
|
42
|
+
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
|
|
43
|
+
}
|
|
44
|
+
.ts-control > * {
|
|
45
|
+
vertical-align: baseline;
|
|
46
|
+
display: inline-block;
|
|
47
|
+
}
|
|
48
|
+
.ts-wrapper.multi .ts-control > div {
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
margin: 0 3px 3px 0;
|
|
51
|
+
padding: 2px 6px;
|
|
52
|
+
background: #1da7ee;
|
|
53
|
+
color: #fff;
|
|
54
|
+
border: 1px solid #0073bb;
|
|
55
|
+
}
|
|
56
|
+
.ts-wrapper.multi .ts-control > div.active {
|
|
57
|
+
background: #92c836;
|
|
58
|
+
color: #fff;
|
|
59
|
+
border: 1px solid #00578d;
|
|
60
|
+
}
|
|
61
|
+
.ts-wrapper.multi.disabled .ts-control > div,
|
|
62
|
+
.ts-wrapper.multi.disabled .ts-control > div.active {
|
|
63
|
+
color: white;
|
|
64
|
+
background: #d2d2d2;
|
|
65
|
+
border: 1px solid #aaaaaa;
|
|
66
|
+
}
|
|
67
|
+
.ts-control > input {
|
|
68
|
+
flex: 1 1 auto;
|
|
69
|
+
min-width: 7rem;
|
|
70
|
+
display: inline-block !important;
|
|
71
|
+
padding: 0 !important;
|
|
72
|
+
min-height: 0 !important;
|
|
73
|
+
max-height: none !important;
|
|
74
|
+
max-width: 100% !important;
|
|
75
|
+
margin: 0 !important;
|
|
76
|
+
text-indent: 0 !important;
|
|
77
|
+
border: 0 none !important;
|
|
78
|
+
background: none !important;
|
|
79
|
+
line-height: inherit !important;
|
|
80
|
+
-webkit-user-select: auto !important;
|
|
81
|
+
-moz-user-select: auto !important;
|
|
82
|
+
-ms-user-select: auto !important;
|
|
83
|
+
user-select: auto !important;
|
|
84
|
+
box-shadow: none !important;
|
|
85
|
+
}
|
|
86
|
+
.ts-control > input::-ms-clear {
|
|
87
|
+
display: none;
|
|
88
|
+
}
|
|
89
|
+
.ts-control > input:focus {
|
|
90
|
+
outline: none !important;
|
|
91
|
+
}
|
|
92
|
+
.has-items .ts-control > input {
|
|
93
|
+
margin: 0 4px !important;
|
|
94
|
+
}
|
|
95
|
+
.ts-control.rtl {
|
|
96
|
+
text-align: right;
|
|
97
|
+
}
|
|
98
|
+
.ts-control.rtl.single .ts-control:after {
|
|
99
|
+
left: 15px;
|
|
100
|
+
right: auto;
|
|
101
|
+
}
|
|
102
|
+
.ts-control.rtl .ts-control > input {
|
|
103
|
+
margin: 0 4px 0 -2px !important;
|
|
104
|
+
}
|
|
105
|
+
.disabled .ts-control {
|
|
106
|
+
opacity: 0.5;
|
|
107
|
+
background-color: #fafafa;
|
|
108
|
+
}
|
|
109
|
+
.input-hidden .ts-control > input {
|
|
110
|
+
opacity: 0;
|
|
111
|
+
position: absolute;
|
|
112
|
+
left: -10000px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.ts-dropdown {
|
|
116
|
+
position: absolute;
|
|
117
|
+
top: 100%;
|
|
118
|
+
left: 0;
|
|
119
|
+
width: 100%;
|
|
120
|
+
z-index: 10;
|
|
121
|
+
border: 1px solid #d0d0d0;
|
|
122
|
+
background: #fff;
|
|
123
|
+
margin: 0.25rem 0 0;
|
|
124
|
+
border-top: 0 none;
|
|
125
|
+
box-sizing: border-box;
|
|
126
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
127
|
+
border-radius: 0 0 3px 3px;
|
|
128
|
+
}
|
|
129
|
+
.ts-dropdown [data-selectable] {
|
|
130
|
+
cursor: pointer;
|
|
131
|
+
overflow: hidden;
|
|
132
|
+
}
|
|
133
|
+
.ts-dropdown [data-selectable] .highlight {
|
|
134
|
+
background: rgba(125, 168, 208, 0.2);
|
|
135
|
+
border-radius: 1px;
|
|
136
|
+
}
|
|
137
|
+
.ts-dropdown .option,
|
|
138
|
+
.ts-dropdown .optgroup-header,
|
|
139
|
+
.ts-dropdown .no-results,
|
|
140
|
+
.ts-dropdown .create {
|
|
141
|
+
padding: 5px 8px;
|
|
142
|
+
}
|
|
143
|
+
.ts-dropdown .option,
|
|
144
|
+
.ts-dropdown [data-disabled],
|
|
145
|
+
.ts-dropdown [data-disabled] [data-selectable].option {
|
|
146
|
+
cursor: inherit;
|
|
147
|
+
opacity: 0.5;
|
|
148
|
+
}
|
|
149
|
+
.ts-dropdown [data-selectable].option {
|
|
150
|
+
opacity: 1;
|
|
151
|
+
cursor: pointer;
|
|
152
|
+
}
|
|
153
|
+
.ts-dropdown .optgroup:first-child .optgroup-header {
|
|
154
|
+
border-top: 0 none;
|
|
155
|
+
}
|
|
156
|
+
.ts-dropdown .optgroup-header {
|
|
157
|
+
color: #303030;
|
|
158
|
+
background: #fff;
|
|
159
|
+
cursor: default;
|
|
160
|
+
}
|
|
161
|
+
.ts-dropdown .active {
|
|
162
|
+
background-color: #f5fafd;
|
|
163
|
+
color: #495c68;
|
|
164
|
+
}
|
|
165
|
+
.ts-dropdown .active.create {
|
|
166
|
+
color: #495c68;
|
|
167
|
+
}
|
|
168
|
+
.ts-dropdown .create {
|
|
169
|
+
color: rgba(48, 48, 48, 0.5);
|
|
170
|
+
}
|
|
171
|
+
.ts-dropdown .spinner {
|
|
172
|
+
display: inline-block;
|
|
173
|
+
width: 30px;
|
|
174
|
+
height: 30px;
|
|
175
|
+
margin: 5px 8px;
|
|
176
|
+
}
|
|
177
|
+
.ts-dropdown .spinner::after {
|
|
178
|
+
content: ' ';
|
|
179
|
+
display: block;
|
|
180
|
+
width: 24px;
|
|
181
|
+
height: 24px;
|
|
182
|
+
margin: 3px;
|
|
183
|
+
border-radius: 50%;
|
|
184
|
+
border: 5px solid #d0d0d0;
|
|
185
|
+
border-color: #d0d0d0 transparent #d0d0d0 transparent;
|
|
186
|
+
animation: lds-dual-ring 1.2s linear infinite;
|
|
187
|
+
}
|
|
188
|
+
@keyframes lds-dual-ring {
|
|
189
|
+
0% {
|
|
190
|
+
transform: rotate(0deg);
|
|
191
|
+
}
|
|
192
|
+
100% {
|
|
193
|
+
transform: rotate(360deg);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.ts-dropdown-content {
|
|
198
|
+
overflow: hidden auto;
|
|
199
|
+
max-height: 200px;
|
|
200
|
+
scroll-behavior: smooth;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.ts-wrapper.plugin-drag_drop .ts-dragging {
|
|
204
|
+
color: transparent !important;
|
|
205
|
+
}
|
|
206
|
+
.ts-wrapper.plugin-drag_drop .ts-dragging > * {
|
|
207
|
+
visibility: hidden !important;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.plugin-checkbox_options:not(.rtl) .option input {
|
|
211
|
+
margin-right: 0.5rem;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.plugin-checkbox_options.rtl .option input {
|
|
215
|
+
margin-left: 0.5rem;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* stylelint-disable function-name-case */
|
|
219
|
+
.plugin-clear_button {
|
|
220
|
+
--ts-pr-clear-button: 1em;
|
|
221
|
+
}
|
|
222
|
+
.plugin-clear_button .clear-button {
|
|
223
|
+
opacity: 0;
|
|
224
|
+
position: absolute;
|
|
225
|
+
top: 50%;
|
|
226
|
+
transform: translateY(-50%);
|
|
227
|
+
right: calc(8px - 6px);
|
|
228
|
+
margin-right: 0 !important;
|
|
229
|
+
background: transparent !important;
|
|
230
|
+
transition: opacity 0.5s;
|
|
231
|
+
cursor: pointer;
|
|
232
|
+
}
|
|
233
|
+
.plugin-clear_button.form-select .clear-button,
|
|
234
|
+
.plugin-clear_button.single .clear-button {
|
|
235
|
+
right: max(var(--ts-pr-caret), 8px);
|
|
236
|
+
}
|
|
237
|
+
.plugin-clear_button.focus.has-items .clear-button,
|
|
238
|
+
.plugin-clear_button:not(.disabled):hover.has-items .clear-button {
|
|
239
|
+
opacity: 1;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.ts-wrapper .dropdown-header {
|
|
243
|
+
position: relative;
|
|
244
|
+
padding: 10px 8px;
|
|
245
|
+
border-bottom: 1px solid #d0d0d0;
|
|
246
|
+
background: color-mix(#fff, #d0d0d0, 85%);
|
|
247
|
+
border-radius: 3px 3px 0 0;
|
|
248
|
+
}
|
|
249
|
+
.ts-wrapper .dropdown-header-close {
|
|
250
|
+
position: absolute;
|
|
251
|
+
right: 8px;
|
|
252
|
+
top: 50%;
|
|
253
|
+
color: #303030;
|
|
254
|
+
opacity: 0.4;
|
|
255
|
+
margin-top: -12px;
|
|
256
|
+
line-height: 20px;
|
|
257
|
+
font-size: 20px !important;
|
|
258
|
+
}
|
|
259
|
+
.ts-wrapper .dropdown-header-close:hover {
|
|
260
|
+
color: black;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.plugin-dropdown_input.focus.dropdown-active .ts-control {
|
|
264
|
+
box-shadow: none;
|
|
265
|
+
border: 1px solid #d0d0d0;
|
|
266
|
+
}
|
|
267
|
+
.plugin-dropdown_input .dropdown-input {
|
|
268
|
+
border: 1px solid #d0d0d0;
|
|
269
|
+
border-width: 0 0 1px;
|
|
270
|
+
display: block;
|
|
271
|
+
padding: 8px 8px;
|
|
272
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1);
|
|
273
|
+
width: 100%;
|
|
274
|
+
background: transparent;
|
|
275
|
+
}
|
|
276
|
+
.plugin-dropdown_input .items-placeholder {
|
|
277
|
+
border: 0 none !important;
|
|
278
|
+
box-shadow: none !important;
|
|
279
|
+
width: 100%;
|
|
280
|
+
}
|
|
281
|
+
.plugin-dropdown_input.has-items .items-placeholder,
|
|
282
|
+
.plugin-dropdown_input.dropdown-active .items-placeholder {
|
|
283
|
+
display: none !important;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.ts-wrapper.plugin-input_autogrow.has-items .ts-control > input {
|
|
287
|
+
min-width: 0;
|
|
288
|
+
}
|
|
289
|
+
.ts-wrapper.plugin-input_autogrow.has-items.focus .ts-control > input {
|
|
290
|
+
flex: none;
|
|
291
|
+
min-width: 4px;
|
|
292
|
+
}
|
|
293
|
+
.ts-wrapper.plugin-input_autogrow.has-items.focus
|
|
294
|
+
.ts-control
|
|
295
|
+
> input::-ms-input-placeholder {
|
|
296
|
+
color: transparent;
|
|
297
|
+
}
|
|
298
|
+
.ts-wrapper.plugin-input_autogrow.has-items.focus
|
|
299
|
+
.ts-control
|
|
300
|
+
> input::placeholder {
|
|
301
|
+
color: transparent;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.ts-dropdown.plugin-optgroup_columns .ts-dropdown-content {
|
|
305
|
+
display: flex;
|
|
306
|
+
}
|
|
307
|
+
.ts-dropdown.plugin-optgroup_columns .optgroup {
|
|
308
|
+
border-right: 1px solid #f2f2f2;
|
|
309
|
+
border-top: 0 none;
|
|
310
|
+
flex-grow: 1;
|
|
311
|
+
flex-basis: 0;
|
|
312
|
+
min-width: 0;
|
|
313
|
+
}
|
|
314
|
+
.ts-dropdown.plugin-optgroup_columns .optgroup:last-child {
|
|
315
|
+
border-right: 0 none;
|
|
316
|
+
}
|
|
317
|
+
.ts-dropdown.plugin-optgroup_columns .optgroup::before {
|
|
318
|
+
display: none;
|
|
319
|
+
}
|
|
320
|
+
.ts-dropdown.plugin-optgroup_columns .optgroup-header {
|
|
321
|
+
border-top: 0 none;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.ts-wrapper.plugin-remove_button .item {
|
|
325
|
+
display: inline-flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
}
|
|
328
|
+
.ts-wrapper.plugin-remove_button .item .remove {
|
|
329
|
+
color: inherit;
|
|
330
|
+
text-decoration: none;
|
|
331
|
+
vertical-align: middle;
|
|
332
|
+
display: inline-block;
|
|
333
|
+
padding: 0 6px;
|
|
334
|
+
border-radius: 0 2px 2px 0;
|
|
335
|
+
box-sizing: border-box;
|
|
336
|
+
}
|
|
337
|
+
.ts-wrapper.plugin-remove_button .item .remove:hover {
|
|
338
|
+
background: rgba(0, 0, 0, 0.05);
|
|
339
|
+
}
|
|
340
|
+
.ts-wrapper.plugin-remove_button.disabled .item .remove:hover {
|
|
341
|
+
background: none;
|
|
342
|
+
}
|
|
343
|
+
.ts-wrapper.plugin-remove_button .remove-single {
|
|
344
|
+
position: absolute;
|
|
345
|
+
right: 0;
|
|
346
|
+
top: 0;
|
|
347
|
+
font-size: 23px;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.ts-wrapper.plugin-remove_button:not(.rtl) .item {
|
|
351
|
+
padding-right: 0 !important;
|
|
352
|
+
}
|
|
353
|
+
.ts-wrapper.plugin-remove_button:not(.rtl) .item .remove {
|
|
354
|
+
border-left: 1px solid #0073bb;
|
|
355
|
+
margin-left: 6px;
|
|
356
|
+
}
|
|
357
|
+
.ts-wrapper.plugin-remove_button:not(.rtl) .item.active .remove {
|
|
358
|
+
border-left-color: #00578d;
|
|
359
|
+
}
|
|
360
|
+
.ts-wrapper.plugin-remove_button:not(.rtl).disabled .item .remove {
|
|
361
|
+
border-left-color: #aaaaaa;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.ts-wrapper.plugin-remove_button.rtl .item {
|
|
365
|
+
padding-left: 0 !important;
|
|
366
|
+
}
|
|
367
|
+
.ts-wrapper.plugin-remove_button.rtl .item .remove {
|
|
368
|
+
border-right: 1px solid #0073bb;
|
|
369
|
+
margin-right: 6px;
|
|
370
|
+
}
|
|
371
|
+
.ts-wrapper.plugin-remove_button.rtl .item.active .remove {
|
|
372
|
+
border-right-color: #00578d;
|
|
373
|
+
}
|
|
374
|
+
.ts-wrapper.plugin-remove_button.rtl.disabled .item .remove {
|
|
375
|
+
border-right-color: #aaaaaa;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
:root {
|
|
379
|
+
--ts-pr-clear-button: 0px;
|
|
380
|
+
--ts-pr-caret: 0px;
|
|
381
|
+
--ts-pr-min: 0.75rem;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.ts-wrapper.single .ts-control,
|
|
385
|
+
.ts-wrapper.single .ts-control input {
|
|
386
|
+
cursor: pointer;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.ts-control:not(.rtl) {
|
|
390
|
+
padding-right: max(
|
|
391
|
+
var(--ts-pr-min),
|
|
392
|
+
var(--ts-pr-clear-button) + var(--ts-pr-caret)
|
|
393
|
+
) !important;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.ts-control.rtl {
|
|
397
|
+
padding-left: max(
|
|
398
|
+
var(--ts-pr-min),
|
|
399
|
+
var(--ts-pr-clear-button) + var(--ts-pr-caret)
|
|
400
|
+
) !important;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.ts-wrapper {
|
|
404
|
+
position: relative;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.ts-dropdown,
|
|
408
|
+
.ts-control,
|
|
409
|
+
.ts-control input {
|
|
410
|
+
color: #303030;
|
|
411
|
+
font-family: inherit;
|
|
412
|
+
font-size: 13px;
|
|
413
|
+
line-height: 18px;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.ts-control,
|
|
417
|
+
.ts-wrapper.single.input-active .ts-control {
|
|
418
|
+
background: #fff;
|
|
419
|
+
cursor: text;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.ts-hidden-accessible {
|
|
423
|
+
border: 0 !important;
|
|
424
|
+
clip: rect(0 0 0 0) !important;
|
|
425
|
+
-webkit-clip-path: inset(50%) !important;
|
|
426
|
+
clip-path: inset(50%) !important;
|
|
427
|
+
overflow: hidden !important;
|
|
428
|
+
padding: 0 !important;
|
|
429
|
+
position: absolute !important;
|
|
430
|
+
width: 1px !important;
|
|
431
|
+
white-space: nowrap !important;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.ts-wrapper.single .ts-control {
|
|
435
|
+
--ts-pr-caret: 2rem;
|
|
436
|
+
}
|
|
437
|
+
.ts-wrapper.single .ts-control::after {
|
|
438
|
+
content: ' ';
|
|
439
|
+
display: block;
|
|
440
|
+
position: absolute;
|
|
441
|
+
top: 50%;
|
|
442
|
+
margin-top: -3px;
|
|
443
|
+
width: 0;
|
|
444
|
+
height: 0;
|
|
445
|
+
border-style: solid;
|
|
446
|
+
border-width: 5px 5px 0 5px;
|
|
447
|
+
border-color: #808080 transparent transparent transparent;
|
|
448
|
+
}
|
|
449
|
+
.ts-wrapper.single .ts-control:not(.rtl)::after {
|
|
450
|
+
right: 15px;
|
|
451
|
+
}
|
|
452
|
+
.ts-wrapper.single .ts-control.rtl::after {
|
|
453
|
+
left: 15px;
|
|
454
|
+
}
|
|
455
|
+
.ts-wrapper.single.dropdown-active .ts-control::after {
|
|
456
|
+
margin-top: -4px;
|
|
457
|
+
border-width: 0 5px 5px 5px;
|
|
458
|
+
border-color: transparent transparent #808080 transparent;
|
|
459
|
+
}
|
|
460
|
+
.ts-wrapper.single.input-active .ts-control,
|
|
461
|
+
.ts-wrapper.single.input-active .ts-control input {
|
|
462
|
+
cursor: text;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.ts-wrapper {
|
|
466
|
+
display: flex;
|
|
467
|
+
min-height: 36px;
|
|
468
|
+
}
|
|
469
|
+
.ts-wrapper.multi.has-items .ts-control {
|
|
470
|
+
padding-left: 5px;
|
|
471
|
+
--ts-pr-min: $padding-x;
|
|
472
|
+
}
|
|
473
|
+
.ts-wrapper.multi .ts-control [data-value] {
|
|
474
|
+
text-shadow: 0 1px 0 rgba(0, 51, 83, 0.3);
|
|
475
|
+
border-radius: 3px;
|
|
476
|
+
background-color: color-mix(#1da7ee, #178ee9, 60%);
|
|
477
|
+
background-image: linear-gradient(to bottom, #1da7ee, #178ee9);
|
|
478
|
+
background-repeat: repeat-x;
|
|
479
|
+
box-shadow:
|
|
480
|
+
0 1px 0 rgba(0, 0, 0, 0.2),
|
|
481
|
+
inset 0 1px rgba(255, 255, 255, 0.03);
|
|
482
|
+
}
|
|
483
|
+
.ts-wrapper.multi .ts-control [data-value].active {
|
|
484
|
+
background-color: color-mix(#008fd8, #0075cf, 60%);
|
|
485
|
+
background-image: linear-gradient(to bottom, #008fd8, #0075cf);
|
|
486
|
+
background-repeat: repeat-x;
|
|
487
|
+
}
|
|
488
|
+
.ts-wrapper.multi.disabled .ts-control [data-value] {
|
|
489
|
+
color: #999;
|
|
490
|
+
text-shadow: none;
|
|
491
|
+
background: none;
|
|
492
|
+
box-shadow: none;
|
|
493
|
+
}
|
|
494
|
+
.ts-wrapper.multi.disabled .ts-control [data-value],
|
|
495
|
+
.ts-wrapper.multi.disabled .ts-control [data-value] .remove {
|
|
496
|
+
border-color: #e6e6e6;
|
|
497
|
+
}
|
|
498
|
+
.ts-wrapper.multi.disabled .ts-control [data-value] .remove {
|
|
499
|
+
background: none;
|
|
500
|
+
}
|
|
501
|
+
.ts-wrapper.single .ts-control {
|
|
502
|
+
box-shadow:
|
|
503
|
+
0 1px 0 rgba(0, 0, 0, 0.05),
|
|
504
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.8);
|
|
505
|
+
background-color: color-mix(#fefefe, #f2f2f2, 60%);
|
|
506
|
+
background-image: linear-gradient(to bottom, #fefefe, #f2f2f2);
|
|
507
|
+
background-repeat: repeat-x;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.ts-wrapper.single .ts-control,
|
|
511
|
+
.ts-dropdown.single {
|
|
512
|
+
border-color: #b8b8b8;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.dropdown-active .ts-control {
|
|
516
|
+
border-radius: 3px 3px 0 0;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.ts-dropdown .optgroup-header {
|
|
520
|
+
padding-top: 7px;
|
|
521
|
+
font-weight: bold;
|
|
522
|
+
font-size: 0.85em;
|
|
523
|
+
}
|
|
524
|
+
.ts-dropdown .optgroup {
|
|
525
|
+
border-top: 1px solid #f0f0f0;
|
|
526
|
+
}
|
|
527
|
+
.ts-dropdown .optgroup:first-child {
|
|
528
|
+
border-top: 0 none;
|
|
529
|
+
}
|
|
530
|
+
/*# sourceMappingURL=tom-select.default.css.map */
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.ts-wrapper {
|
|
2
|
+
@apply [.has-items]:[&_.ts-control]:!border-r-success-400 !static min-h-[72px] w-[68%] hover:cursor-pointer sm:w-[75%] [.has-items]:[&_.ts-control]:after:!content-none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.ts-control,
|
|
6
|
+
.ts-wrapper.single .ts-control,
|
|
7
|
+
.plugin-dropdown_input.focus.dropdown-active .ts-control,
|
|
8
|
+
.ts-wrapper.single.input-active .ts-control {
|
|
9
|
+
@apply [.error]:border-r-error-400 [.success]:border-r-success-400 my-3 content-center rounded-none border-t-0 border-r-3 border-b-0 border-l-0 border-r-transparent bg-transparent bg-none !p-0 !py-3 !pr-3 text-base shadow-none transition-[border-color] select-none after:content-[none] focus:outline-none;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ts-control .item {
|
|
13
|
+
@apply truncate;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ts-wrapper.disabled * {
|
|
17
|
+
@apply !cursor-not-allowed hover:!cursor-not-allowed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ts-dropdown,
|
|
21
|
+
.ts-dropdown.single {
|
|
22
|
+
@apply ring-primary-300 top-1 left-[5px] z-100 m-0 mt-[5px] max-w-[96%] overflow-hidden rounded-lg border-none text-base leading-normal shadow-lg ring-2;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ts-dropdown [data-selectable].option {
|
|
26
|
+
@apply truncate px-5 py-2.5;
|
|
27
|
+
}
|
|
28
|
+
.plugin-dropdown_input .dropdown-input {
|
|
29
|
+
@apply px-5;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ts-dropdown .create:hover,
|
|
33
|
+
.ts-dropdown .option:hover {
|
|
34
|
+
@apply bg-primary-50 text-primary-900;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ts-dropdown .active {
|
|
38
|
+
@apply bg-primary-50 text-primary-900;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ts-dropdown-content {
|
|
42
|
+
@apply !h-lvh max-h-[calc(var(--row-location-open)-var(--row-close))] sm:max-h-[calc(var(--row-location-open-sm)-var(--row-close))];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.plugin-dropdown_input .dropdown-input {
|
|
46
|
+
@apply border-none focus:outline-none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.items-placeholder {
|
|
50
|
+
@apply py-2.5 !text-base text-neutral-700;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.no-results {
|
|
54
|
+
@apply absolute h-full w-full !p-6 sm:!p-8 md:!p-10;
|
|
55
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* Required for properties like --tw-ring to work in Shadow DOM - https://github.com/tailwindlabs/tailwindcss/discussions/15556 */
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
--tw-divide-y-reverse: 0;
|
|
5
|
+
--tw-border-style: solid;
|
|
6
|
+
--tw-font-weight: initial;
|
|
7
|
+
--tw-tracking: initial;
|
|
8
|
+
--tw-translate-x: 0;
|
|
9
|
+
--tw-translate-y: 0;
|
|
10
|
+
--tw-translate-z: 0;
|
|
11
|
+
--tw-rotate-x: rotateX(0);
|
|
12
|
+
--tw-rotate-y: rotateY(0);
|
|
13
|
+
--tw-rotate-z: rotateZ(0);
|
|
14
|
+
--tw-skew-x: skewX(0);
|
|
15
|
+
--tw-skew-y: skewY(0);
|
|
16
|
+
--tw-space-x-reverse: 0;
|
|
17
|
+
--tw-gradient-position: initial;
|
|
18
|
+
--tw-gradient-from: #0000;
|
|
19
|
+
--tw-gradient-via: #0000;
|
|
20
|
+
--tw-gradient-to: #0000;
|
|
21
|
+
--tw-gradient-stops: initial;
|
|
22
|
+
--tw-gradient-via-stops: initial;
|
|
23
|
+
--tw-gradient-from-position: 0%;
|
|
24
|
+
--tw-gradient-via-position: 50%;
|
|
25
|
+
--tw-gradient-to-position: 100%;
|
|
26
|
+
--tw-shadow: 0 0 #0000;
|
|
27
|
+
--tw-shadow-color: initial;
|
|
28
|
+
--tw-inset-shadow: 0 0 #0000;
|
|
29
|
+
--tw-inset-shadow-color: initial;
|
|
30
|
+
--tw-ring-color: initial;
|
|
31
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
32
|
+
--tw-inset-ring-color: initial;
|
|
33
|
+
--tw-inset-ring-shadow: 0 0 #0000;
|
|
34
|
+
--tw-ring-inset: initial;
|
|
35
|
+
--tw-ring-offset-width: 0px;
|
|
36
|
+
--tw-ring-offset-color: #fff;
|
|
37
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
38
|
+
--tw-blur: initial;
|
|
39
|
+
--tw-brightness: initial;
|
|
40
|
+
--tw-contrast: initial;
|
|
41
|
+
--tw-grayscale: initial;
|
|
42
|
+
--tw-hue-rotate: initial;
|
|
43
|
+
--tw-invert: initial;
|
|
44
|
+
--tw-opacity: initial;
|
|
45
|
+
--tw-saturate: initial;
|
|
46
|
+
--tw-sepia: initial;
|
|
47
|
+
--tw-drop-shadow: initial;
|
|
48
|
+
--tw-duration: initial;
|
|
49
|
+
--tw-ease: initial;
|
|
50
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Pdc } from './ts/controller';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Utils
|
|
2
|
+
import { applyStyles, removeStyles } from '../../utils/styles';
|
|
3
|
+
|
|
4
|
+
// HTML/CSS
|
|
5
|
+
import templateHTML from './template.html?raw';
|
|
6
|
+
|
|
7
|
+
// Template for this Custom Element
|
|
8
|
+
const template = document.createElement('template');
|
|
9
|
+
|
|
10
|
+
// Custom Element
|
|
11
|
+
export class PdcButton extends HTMLElement {
|
|
12
|
+
/* SETUP
|
|
13
|
+
*/
|
|
14
|
+
#styled = false;
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.attachShadow({ mode: 'open' });
|
|
18
|
+
this.#styled = this.getAttribute('styled') === 'true';
|
|
19
|
+
if (!this.shadowRoot)
|
|
20
|
+
throw new Error(
|
|
21
|
+
'Failed to create shadowRoot for button custom element.',
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
if (this.#styled) {
|
|
25
|
+
template.innerHTML = templateHTML;
|
|
26
|
+
applyStyles(this.shadowRoot);
|
|
27
|
+
} else template.innerHTML = removeStyles(templateHTML);
|
|
28
|
+
this.shadowRoot?.appendChild(template.content.cloneNode(true));
|
|
29
|
+
|
|
30
|
+
const textEl = this.#button.querySelector('#text');
|
|
31
|
+
const text = this.getAttribute('text');
|
|
32
|
+
const title = this.getAttribute('title');
|
|
33
|
+
|
|
34
|
+
if (!(textEl && text && title))
|
|
35
|
+
throw new Error('Failed to render button.');
|
|
36
|
+
|
|
37
|
+
this.#button.setAttribute('title', title);
|
|
38
|
+
textEl.textContent = text;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get #button() {
|
|
42
|
+
const el = this.shadowRoot?.querySelector('button');
|
|
43
|
+
if (!el) throw new Error('Failed to render button.');
|
|
44
|
+
return el;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
enableTabIndex(enable: boolean) {
|
|
48
|
+
this.#button.setAttribute('tabindex', enable ? '0' : '-1');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<button
|
|
2
|
+
tabindex="-1"
|
|
3
|
+
class="group focus-visible:after:!border-b-primary-800 after:content-[_]
|
|
4
|
+
offset after: relative cursor-pointer border-none bg-transparent p-0
|
|
5
|
+
font-medium [transition:filter_0.25s] after:absolute after:-bottom-4
|
|
6
|
+
after:left-0 after:w-full after:rounded-lg after:transition-colors
|
|
7
|
+
after:duration-500 after:[border-bottom:8px_solid_transparent]
|
|
8
|
+
hover:brightness-110 focus-visible:outline-none"
|
|
9
|
+
type="button"
|
|
10
|
+
>
|
|
11
|
+
<span
|
|
12
|
+
class="bg-[hsl(0deg 0% 0% / 0.25)] absolute top-0 left-0 h-full w-full
|
|
13
|
+
translate-y-0.5 rounded-lg will-change-transform
|
|
14
|
+
[transition:transform_1s_ease-out] group-hover:translate-y-1
|
|
15
|
+
group-hover:[transition:transform_0.5s_ease-out]
|
|
16
|
+
group-active:translate-y-[1px]
|
|
17
|
+
group-active:[transition:transform_0.25s]"
|
|
18
|
+
></span>
|
|
19
|
+
|
|
20
|
+
<span
|
|
21
|
+
class="from-primary-700 via-primary-500 to-primary-700 absolute top-0
|
|
22
|
+
left-0 h-full w-full rounded-lg bg-gradient-to-l
|
|
23
|
+
via-[percentage:5%_95%]"
|
|
24
|
+
></span>
|
|
25
|
+
<span
|
|
26
|
+
id="text"
|
|
27
|
+
class="text-primary-50 bg-primary-900 relative block -translate-y-1
|
|
28
|
+
rounded-lg px-11 py-3 will-change-transform
|
|
29
|
+
[transition:transform_1s_ease-out] group-hover:-translate-y-1.5
|
|
30
|
+
group-hover:[transition:transform_0.5s_ease-out]
|
|
31
|
+
group-active:-translate-y-0.5
|
|
32
|
+
group-active:[transition:transform_0.25s]"
|
|
33
|
+
></span>
|
|
34
|
+
</button>
|