noph-ui 0.37.0 → 0.38.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.
@@ -172,14 +172,6 @@
172
172
  bind:element
173
173
  aria-label={title}
174
174
  class={['np-date-range-picker', attributes.class]}
175
- --np-dialog-container-width="100%"
176
- --np-dialog-container-min-width="0"
177
- --np-dialog-inset="0"
178
- --np-dialog-padding="0"
179
- --np-dialog-max-height="100dvh"
180
- --np-dialog-elevation="none"
181
- --np-dialog-container-color="var(--np-date-range-picker-container-color, var(--np-color-surface))"
182
- --np-dialog-container-shape="var(--np-date-range-picker-container-shape, var(--np-shape-corner-none))"
183
175
  ontoggle={(event) => {
184
176
  const nowOpen = event.newState === 'open'
185
177
  open = nowOpen
@@ -198,7 +190,7 @@
198
190
  {#if open}
199
191
  <div class="np-date-range-picker-content">
200
192
  <div class="np-date-range-picker-header">
201
- <div class="np-date-range-picker-actions">
193
+ <div class="np-date-range-picker-top-bar">
202
194
  <IconButton type="button" aria-label={cancelLabel} onclick={cancel}>
203
195
  <CloseIcon />
204
196
  </IconButton>
@@ -206,11 +198,14 @@
206
198
  {confirmLabel}
207
199
  </Button>
208
200
  </div>
209
- <h2 class="np-date-range-picker-headline">
210
- <span class={[!startDate && 'placeholder']}>{headlineStart}</span>
211
- <span aria-hidden="true">–</span>
212
- <span class={[!endDate && 'placeholder']}>{headlineEnd}</span>
213
- </h2>
201
+ <div class="np-date-range-picker-header-text">
202
+ <span class="np-date-range-picker-title">{title}</span>
203
+ <h2 class="np-date-range-picker-headline">
204
+ <span class={[!startDate && 'placeholder']}>{headlineStart}</span>
205
+ <span aria-hidden="true">–</span>
206
+ <span class={[!endDate && 'placeholder']}>{headlineEnd}</span>
207
+ </h2>
208
+ </div>
214
209
  </div>
215
210
  <Divider />
216
211
 
@@ -251,9 +246,35 @@
251
246
  </div>
252
247
  </div>
253
248
  {/if}
249
+
250
+ {#snippet actions()}
251
+ {#if open}
252
+ <Button type="button" variant="text" onclick={cancel}>{cancelLabel}</Button>
253
+ <Button type="button" variant="text" disabled={!canConfirm} onclick={confirm}>
254
+ {confirmLabel}
255
+ </Button>
256
+ {/if}
257
+ {/snippet}
254
258
  </Dialog>
255
259
 
256
260
  <style>
261
+ :global(.np-date-range-picker) {
262
+ --np-dialog-container-width: 100%;
263
+ --np-dialog-container-min-width: 0;
264
+ --np-dialog-inset: 0;
265
+ --np-dialog-padding: 0;
266
+ --np-dialog-max-height: 100dvh;
267
+ --np-dialog-elevation: none;
268
+ --np-dialog-container-color: var(
269
+ --np-date-range-picker-container-color,
270
+ var(--np-color-surface)
271
+ );
272
+ --np-dialog-container-shape: var(
273
+ --np-date-range-picker-container-shape,
274
+ var(--np-shape-corner-none)
275
+ );
276
+ }
277
+
257
278
  :global(.np-date-range-picker .np-dialog) {
258
279
  height: 100dvh;
259
280
  }
@@ -262,6 +283,10 @@
262
283
  overflow: hidden;
263
284
  }
264
285
 
286
+ :global(.np-date-range-picker .np-dialog .np-dialog-actions) {
287
+ display: none;
288
+ }
289
+
265
290
  .np-date-range-picker-content {
266
291
  display: flex;
267
292
  flex-direction: column;
@@ -272,13 +297,18 @@
272
297
  .np-date-range-picker-header,
273
298
  .np-date-range-picker-weekdays,
274
299
  .np-date-range-picker-months {
300
+ box-sizing: border-box;
275
301
  max-width: var(--np-date-range-picker-content-width, 25.5rem);
276
302
  margin-inline: auto;
277
303
  width: 100%;
278
304
  }
279
305
 
306
+ .np-date-range-picker-header,
307
+ .np-date-range-picker-weekdays {
308
+ flex: none;
309
+ }
310
+
280
311
  .np-date-range-picker-header {
281
- box-sizing: border-box;
282
312
  min-height: 8rem;
283
313
  display: flex;
284
314
  flex-direction: column;
@@ -288,12 +318,24 @@
288
318
  color: var(--np-color-on-surface-variant);
289
319
  }
290
320
 
291
- .np-date-range-picker-actions {
321
+ .np-date-range-picker-top-bar {
292
322
  display: flex;
293
323
  align-items: center;
294
324
  justify-content: space-between;
295
325
  }
296
326
 
327
+ .np-date-range-picker-header-text {
328
+ display: flex;
329
+ flex-direction: column;
330
+ gap: 0.25rem;
331
+ }
332
+
333
+ .np-date-range-picker-title {
334
+ font-size: 0.875rem;
335
+ line-height: 1.25rem;
336
+ font-weight: 500;
337
+ }
338
+
297
339
  .np-date-range-picker-headline {
298
340
  margin: 0;
299
341
  display: flex;
@@ -314,10 +356,6 @@
314
356
  align-items: center;
315
357
  height: 3rem;
316
358
  padding-inline: 0.75rem;
317
- max-width: 25.5rem;
318
- margin-inline: auto;
319
- width: 100%;
320
- box-sizing: border-box;
321
359
  font-size: 1rem;
322
360
  line-height: 1.5rem;
323
361
  color: var(--np-color-on-surface);
@@ -330,10 +368,6 @@
330
368
  overflow-y: auto;
331
369
  overscroll-behavior: contain;
332
370
  padding-inline: 0.75rem;
333
- max-width: 25.5rem;
334
- margin-inline: auto;
335
- width: 100%;
336
- box-sizing: border-box;
337
371
  scrollbar-color: var(--np-color-on-surface-variant) transparent;
338
372
  scrollbar-width: thin;
339
373
  }
@@ -348,4 +382,50 @@
348
382
  font-weight: 500;
349
383
  color: var(--np-date-picker-range-month-subhead-color, var(--np-color-on-surface-variant));
350
384
  }
385
+
386
+ @media (min-width: 37.5rem) {
387
+ :global(.np-date-range-picker) {
388
+ --np-dialog-container-width: fit-content;
389
+ --np-dialog-inset: 2rem 1rem;
390
+ --np-dialog-max-height: calc(100dvh - 3rem);
391
+ --np-dialog-elevation: var(--np-elevation-3);
392
+ --np-dialog-container-color: var(
393
+ --np-date-range-picker-container-color,
394
+ var(--np-color-surface-container-high)
395
+ );
396
+ --np-dialog-container-shape: var(
397
+ --np-date-range-picker-container-shape,
398
+ var(--np-shape-corner-extra-large)
399
+ );
400
+ }
401
+
402
+ :global(.np-date-range-picker .np-dialog) {
403
+ height: auto;
404
+ }
405
+
406
+ :global(.np-date-range-picker .np-dialog .np-dialog-actions) {
407
+ display: flex;
408
+ margin-top: 0;
409
+ padding: 0.5rem 0.75rem 0.75rem;
410
+ }
411
+
412
+ .np-date-range-picker-content {
413
+ width: var(--np-date-range-picker-content-width, 22.5rem);
414
+ max-width: 100%;
415
+ }
416
+
417
+ .np-date-range-picker-top-bar {
418
+ display: none;
419
+ }
420
+
421
+ .np-date-range-picker-header {
422
+ min-height: 7.5rem;
423
+ justify-content: flex-end;
424
+ padding: 1rem 0.75rem 0.75rem 1.5rem;
425
+ }
426
+
427
+ .np-date-range-picker-months {
428
+ max-height: var(--np-date-range-picker-months-max-height, 20rem);
429
+ }
430
+ }
351
431
  </style>
@@ -111,9 +111,6 @@
111
111
  const len = wavelength
112
112
  const width = containerWidth
113
113
  const host = wavePathA?.closest('.progress') as HTMLElement | null
114
- // Live declaration: --np-lp-percent is a registered custom property that carries
115
- // the same transition as the track, so reading it each frame gives the wave the
116
- // eased position instead of jumping straight to the new value.
117
114
  const hostStyles = host && getComputedStyle(host)
118
115
  let raf = 0
119
116
  let last = 0
@@ -80,7 +80,6 @@
80
80
 
81
81
  const getTranslationCoordinates = (positionEvent?: Event) => {
82
82
  const { height, width } = element!.parentElement!.getBoundingClientRect()
83
- // end in the center
84
83
  const endPoint = {
85
84
  x: (width - initialSize) / 2,
86
85
  y: (height - initialSize) / 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {