@nervure/datetime 0.0.0-stage → 0.1.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/dist/react.js ADDED
@@ -0,0 +1,45 @@
1
+ import { createElement, useEffect, useRef } from 'react';
2
+ import { createDatePicker } from "./core.js";
3
+ const same = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
4
+ /** `<DateTimePicker mode="range" presets value={value} onChange={(s) => setValue(s.value)} />`. */
5
+ export function DateTimePicker(props) {
6
+ const { className, panelClassName, style, name, id, disabled, pickerRef, 'aria-label': label, ...options } = props;
7
+ const host = useRef(null);
8
+ const picker = useRef(null);
9
+ const latest = useRef(options);
10
+ latest.current = options;
11
+ const inline = !!options.inline;
12
+ useEffect(() => {
13
+ const p = createDatePicker(host.current, {
14
+ ...latest.current,
15
+ class: panelClassName,
16
+ onChange: (s) => latest.current.onChange?.(s),
17
+ onOpen: () => latest.current.onOpen?.(),
18
+ onClose: () => latest.current.onClose?.(),
19
+ });
20
+ picker.current = p;
21
+ pickerRef?.(p);
22
+ return () => {
23
+ p.destroy();
24
+ picker.current = null;
25
+ pickerRef?.(null);
26
+ };
27
+ // The picker is made once for a field or a box; the other options go through update()
28
+ }, [inline, name]);
29
+ const { value, onChange: _c, onOpen: _o, onClose: _x, ...rest } = options;
30
+ const settings = JSON.stringify(rest, (_, v) => (typeof v === 'function' ? String(v) : v));
31
+ useEffect(() => {
32
+ picker.current?.update({ ...rest, class: panelClassName });
33
+ }, [settings, panelClassName]);
34
+ useEffect(() => {
35
+ const p = picker.current;
36
+ if (p && value !== undefined && !same(p.getValue(), value instanceof Date ? null : value))
37
+ p.setValue(value);
38
+ }, [value instanceof Date ? value.getTime() : JSON.stringify(value)]);
39
+ const ref = (node) => {
40
+ host.current = node;
41
+ };
42
+ return inline
43
+ ? createElement('div', { ref, id, className, style })
44
+ : createElement('input', { ref, id, name, className, style, disabled, type: 'text', 'aria-label': label });
45
+ }
package/dist/style.css ADDED
@@ -0,0 +1,64 @@
1
+ .nv-dt{--nv-dt-accent:#e04f39;--nv-dt-accent-ink:#fff;--nv-dt-bg:#fff;--nv-dt-ink:#1b1f24;--nv-dt-muted:#6b7480;--nv-dt-line:#e3e6ea;--nv-dt-hover:#f1f3f5;--nv-dt-range:color-mix(in srgb,var(--nv-dt-accent) 14%,transparent);--nv-dt-radius:10px;--nv-dt-cell:36px;--nv-dt-font:inherit;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.14);box-sizing:border-box;display:inline-flex;max-width:100%;font-family:var(--nv-dt-font);font-size:14px;line-height:1.3;color:var(--nv-dt-ink);background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:var(--nv-dt-radius);user-select:none;-webkit-user-select:none}
2
+ .nv-dt *,.nv-dt *::before{box-sizing:border-box}
3
+ .nv-dt[data-theme=dark]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}
4
+ @media (prefers-color-scheme:dark){.nv-dt[data-theme=auto]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}}
5
+ :root.dark .nv-dt[data-theme=auto],:root[data-theme=dark] .nv-dt[data-theme=auto]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}
6
+ :root:not(.dark)[data-theme=light] .nv-dt[data-theme=auto]{--nv-dt-bg:#fff;--nv-dt-ink:#1b1f24;--nv-dt-muted:#6b7480;--nv-dt-line:#e3e6ea;--nv-dt-hover:#f1f3f5;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.14)}
7
+ .nv-dt-pop{position:absolute;z-index:1000;box-shadow:var(--nv-dt-shadow)}
8
+ .nv-dt[hidden]{display:none}
9
+ .nv-dt button{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;border-radius:calc(var(--nv-dt-radius) - 4px)}
10
+ .nv-dt button:focus-visible,.nv-dt input:focus-visible,.nv-dt select:focus-visible{outline:2px solid var(--nv-dt-accent);outline-offset:1px}
11
+ .nv-dt button:disabled{cursor:default;opacity:.35}
12
+ .nv-dt-presets{display:flex;flex-direction:column;gap:2px;padding:10px 8px;border-inline-end:1px solid var(--nv-dt-line);min-width:150px}
13
+ .nv-dt-presets button{text-align:start;padding:7px 10px;white-space:nowrap}
14
+ .nv-dt-presets button:hover{background:var(--nv-dt-hover)}
15
+ .nv-dt-presets button[aria-pressed=true]{background:var(--nv-dt-range);color:var(--nv-dt-accent);font-weight:600}
16
+ .nv-dt-main{display:flex;flex-direction:column;gap:10px;padding:12px;min-width:0}
17
+ .nv-dt-months{display:flex;gap:18px;flex-wrap:wrap}
18
+ .nv-dt-month{display:flex;flex-direction:column;gap:6px}
19
+ .nv-dt-head{display:flex;align-items:center;gap:4px;min-height:32px}
20
+ .nv-dt-title{flex:1;display:flex;justify-content:center;gap:2px;font-weight:600}
21
+ .nv-dt-title button{padding:5px 8px;text-transform:capitalize}
22
+ .nv-dt-title button:hover,.nv-dt-nav:hover{background:var(--nv-dt-hover)}
23
+ .nv-dt-nav{width:32px;height:32px;display:grid;place-items:center;flex:none}
24
+ .nv-dt-nav svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
25
+ .nv-dt[dir=rtl] .nv-dt-nav svg{transform:scaleX(-1)}
26
+ .nv-dt-nav[data-hide]{visibility:hidden}
27
+ .nv-dt-grid{display:grid;grid-template-columns:repeat(7,var(--nv-dt-cell));row-gap:2px}
28
+ .nv-dt-grid[data-weeks]{grid-template-columns:28px repeat(7,var(--nv-dt-cell))}
29
+ .nv-dt-dow,.nv-dt-wk{display:grid;place-items:center;height:28px;font-size:12px;color:var(--nv-dt-muted);text-transform:capitalize}
30
+ .nv-dt-wk{height:var(--nv-dt-cell);font-variant-numeric:tabular-nums}
31
+ .nv-dt-day{height:var(--nv-dt-cell);font-variant-numeric:tabular-nums;position:relative}
32
+ .nv-dt-day:hover:not(:disabled){background:var(--nv-dt-hover)}
33
+ .nv-dt-day.is-out{color:var(--nv-dt-muted);opacity:.55}
34
+ .nv-dt-day.is-today::after{content:"";position:absolute;inset-inline:0;bottom:5px;margin:auto;width:4px;height:4px;border-radius:50%;background:var(--nv-dt-accent)}
35
+ .nv-dt-day.is-in{background:var(--nv-dt-range);border-radius:0}
36
+ .nv-dt-day.is-start,.nv-dt-day.is-end,.nv-dt-day.is-on{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink);opacity:1}
37
+ .nv-dt-day.is-start:hover,.nv-dt-day.is-end:hover,.nv-dt-day.is-on:hover{background:var(--nv-dt-accent)}
38
+ .nv-dt-day.is-start.is-in{border-start-end-radius:0;border-end-end-radius:0}
39
+ .nv-dt-day.is-end.is-in{border-start-start-radius:0;border-end-start-radius:0}
40
+ .nv-dt-day.is-on.is-today::after,.nv-dt-day.is-start.is-today::after,.nv-dt-day.is-end.is-today::after{background:var(--nv-dt-accent-ink)}
41
+ .nv-dt-day:disabled{text-decoration:line-through}
42
+ .nv-dt-cells{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;min-width:calc(var(--nv-dt-cell) * 7)}
43
+ .nv-dt-cells[data-view=quarters]{grid-template-columns:repeat(2,1fr)}
44
+ .nv-dt-cell{padding:14px 6px;text-transform:capitalize;font-variant-numeric:tabular-nums}
45
+ .nv-dt-cell small{display:block;font-size:11px;color:var(--nv-dt-muted);margin-top:2px;text-transform:none}
46
+ .nv-dt-cell:hover:not(:disabled){background:var(--nv-dt-hover)}
47
+ .nv-dt-cell.is-on{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink)}
48
+ .nv-dt-cell.is-on small{color:inherit;opacity:.85}
49
+ .nv-dt-cell.is-now{box-shadow:inset 0 0 0 1px var(--nv-dt-accent)}
50
+ .nv-dt-times{display:flex;flex-wrap:wrap;gap:8px 18px;padding-top:10px;border-top:1px solid var(--nv-dt-line)}
51
+ .nv-dt-time{display:flex;align-items:center;gap:4px}
52
+ .nv-dt-time>span:first-child{color:var(--nv-dt-muted);font-size:12px;margin-inline-end:4px}
53
+ .nv-dt-time input{width:46px;height:32px;text-align:center;font:inherit;font-variant-numeric:tabular-nums;color:inherit;background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:calc(var(--nv-dt-radius) - 4px);padding:0;user-select:text;-webkit-user-select:text}
54
+ .nv-dt-time button{height:32px;padding:0 8px;border:1px solid var(--nv-dt-line)}
55
+ .nv-dt-zone{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--nv-dt-muted)}
56
+ .nv-dt-zone select{flex:1;min-width:0;height:30px;font:inherit;color:var(--nv-dt-ink);background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:calc(var(--nv-dt-radius) - 4px);padding:0 6px}
57
+ .nv-dt-foot{display:flex;gap:6px;justify-content:space-between;padding-top:10px;border-top:1px solid var(--nv-dt-line)}
58
+ .nv-dt-foot div{display:flex;gap:6px}
59
+ .nv-dt-foot button{padding:6px 10px}
60
+ .nv-dt-foot button:hover{background:var(--nv-dt-hover)}
61
+ .nv-dt-foot .nv-dt-apply{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink)}
62
+ .nv-dt-foot .nv-dt-apply:hover{background:var(--nv-dt-accent);filter:brightness(1.08)}
63
+ @media (max-width:520px){.nv-dt{flex-direction:column}.nv-dt-presets{flex-direction:row;flex-wrap:wrap;border-inline-end:0;border-bottom:1px solid var(--nv-dt-line);min-width:0}.nv-dt{--nv-dt-cell:clamp(30px,calc((100vw - 60px)/7),36px)}}
64
+ @media (prefers-reduced-motion:no-preference){.nv-dt-day,.nv-dt-cell,.nv-dt button{transition:background-color .12s,color .12s}}
@@ -0,0 +1 @@
1
+ export declare const pickerCss = "\n.nv-dt{--nv-dt-accent:#e04f39;--nv-dt-accent-ink:#fff;--nv-dt-bg:#fff;--nv-dt-ink:#1b1f24;--nv-dt-muted:#6b7480;--nv-dt-line:#e3e6ea;--nv-dt-hover:#f1f3f5;--nv-dt-range:color-mix(in srgb,var(--nv-dt-accent) 14%,transparent);--nv-dt-radius:10px;--nv-dt-cell:36px;--nv-dt-font:inherit;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.14);box-sizing:border-box;display:inline-flex;max-width:100%;font-family:var(--nv-dt-font);font-size:14px;line-height:1.3;color:var(--nv-dt-ink);background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:var(--nv-dt-radius);user-select:none;-webkit-user-select:none}\n.nv-dt *,.nv-dt *::before{box-sizing:border-box}\n.nv-dt[data-theme=dark]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}\n@media (prefers-color-scheme:dark){.nv-dt[data-theme=auto]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}}\n:root.dark .nv-dt[data-theme=auto],:root[data-theme=dark] .nv-dt[data-theme=auto]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}\n:root:not(.dark)[data-theme=light] .nv-dt[data-theme=auto]{--nv-dt-bg:#fff;--nv-dt-ink:#1b1f24;--nv-dt-muted:#6b7480;--nv-dt-line:#e3e6ea;--nv-dt-hover:#f1f3f5;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.14)}\n.nv-dt-pop{position:absolute;z-index:1000;box-shadow:var(--nv-dt-shadow)}\n.nv-dt[hidden]{display:none}\n.nv-dt button{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;border-radius:calc(var(--nv-dt-radius) - 4px)}\n.nv-dt button:focus-visible,.nv-dt input:focus-visible,.nv-dt select:focus-visible{outline:2px solid var(--nv-dt-accent);outline-offset:1px}\n.nv-dt button:disabled{cursor:default;opacity:.35}\n.nv-dt-presets{display:flex;flex-direction:column;gap:2px;padding:10px 8px;border-inline-end:1px solid var(--nv-dt-line);min-width:150px}\n.nv-dt-presets button{text-align:start;padding:7px 10px;white-space:nowrap}\n.nv-dt-presets button:hover{background:var(--nv-dt-hover)}\n.nv-dt-presets button[aria-pressed=true]{background:var(--nv-dt-range);color:var(--nv-dt-accent);font-weight:600}\n.nv-dt-main{display:flex;flex-direction:column;gap:10px;padding:12px;min-width:0}\n.nv-dt-months{display:flex;gap:18px;flex-wrap:wrap}\n.nv-dt-month{display:flex;flex-direction:column;gap:6px}\n.nv-dt-head{display:flex;align-items:center;gap:4px;min-height:32px}\n.nv-dt-title{flex:1;display:flex;justify-content:center;gap:2px;font-weight:600}\n.nv-dt-title button{padding:5px 8px;text-transform:capitalize}\n.nv-dt-title button:hover,.nv-dt-nav:hover{background:var(--nv-dt-hover)}\n.nv-dt-nav{width:32px;height:32px;display:grid;place-items:center;flex:none}\n.nv-dt-nav svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n.nv-dt[dir=rtl] .nv-dt-nav svg{transform:scaleX(-1)}\n.nv-dt-nav[data-hide]{visibility:hidden}\n.nv-dt-grid{display:grid;grid-template-columns:repeat(7,var(--nv-dt-cell));row-gap:2px}\n.nv-dt-grid[data-weeks]{grid-template-columns:28px repeat(7,var(--nv-dt-cell))}\n.nv-dt-dow,.nv-dt-wk{display:grid;place-items:center;height:28px;font-size:12px;color:var(--nv-dt-muted);text-transform:capitalize}\n.nv-dt-wk{height:var(--nv-dt-cell);font-variant-numeric:tabular-nums}\n.nv-dt-day{height:var(--nv-dt-cell);font-variant-numeric:tabular-nums;position:relative}\n.nv-dt-day:hover:not(:disabled){background:var(--nv-dt-hover)}\n.nv-dt-day.is-out{color:var(--nv-dt-muted);opacity:.55}\n.nv-dt-day.is-today::after{content:\"\";position:absolute;inset-inline:0;bottom:5px;margin:auto;width:4px;height:4px;border-radius:50%;background:var(--nv-dt-accent)}\n.nv-dt-day.is-in{background:var(--nv-dt-range);border-radius:0}\n.nv-dt-day.is-start,.nv-dt-day.is-end,.nv-dt-day.is-on{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink);opacity:1}\n.nv-dt-day.is-start:hover,.nv-dt-day.is-end:hover,.nv-dt-day.is-on:hover{background:var(--nv-dt-accent)}\n.nv-dt-day.is-start.is-in{border-start-end-radius:0;border-end-end-radius:0}\n.nv-dt-day.is-end.is-in{border-start-start-radius:0;border-end-start-radius:0}\n.nv-dt-day.is-on.is-today::after,.nv-dt-day.is-start.is-today::after,.nv-dt-day.is-end.is-today::after{background:var(--nv-dt-accent-ink)}\n.nv-dt-day:disabled{text-decoration:line-through}\n.nv-dt-cells{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;min-width:calc(var(--nv-dt-cell) * 7)}\n.nv-dt-cells[data-view=quarters]{grid-template-columns:repeat(2,1fr)}\n.nv-dt-cell{padding:14px 6px;text-transform:capitalize;font-variant-numeric:tabular-nums}\n.nv-dt-cell small{display:block;font-size:11px;color:var(--nv-dt-muted);margin-top:2px;text-transform:none}\n.nv-dt-cell:hover:not(:disabled){background:var(--nv-dt-hover)}\n.nv-dt-cell.is-on{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink)}\n.nv-dt-cell.is-on small{color:inherit;opacity:.85}\n.nv-dt-cell.is-now{box-shadow:inset 0 0 0 1px var(--nv-dt-accent)}\n.nv-dt-times{display:flex;flex-wrap:wrap;gap:8px 18px;padding-top:10px;border-top:1px solid var(--nv-dt-line)}\n.nv-dt-time{display:flex;align-items:center;gap:4px}\n.nv-dt-time>span:first-child{color:var(--nv-dt-muted);font-size:12px;margin-inline-end:4px}\n.nv-dt-time input{width:46px;height:32px;text-align:center;font:inherit;font-variant-numeric:tabular-nums;color:inherit;background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:calc(var(--nv-dt-radius) - 4px);padding:0;user-select:text;-webkit-user-select:text}\n.nv-dt-time button{height:32px;padding:0 8px;border:1px solid var(--nv-dt-line)}\n.nv-dt-zone{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--nv-dt-muted)}\n.nv-dt-zone select{flex:1;min-width:0;height:30px;font:inherit;color:var(--nv-dt-ink);background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:calc(var(--nv-dt-radius) - 4px);padding:0 6px}\n.nv-dt-foot{display:flex;gap:6px;justify-content:space-between;padding-top:10px;border-top:1px solid var(--nv-dt-line)}\n.nv-dt-foot div{display:flex;gap:6px}\n.nv-dt-foot button{padding:6px 10px}\n.nv-dt-foot button:hover{background:var(--nv-dt-hover)}\n.nv-dt-foot .nv-dt-apply{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink)}\n.nv-dt-foot .nv-dt-apply:hover{background:var(--nv-dt-accent);filter:brightness(1.08)}\n@media (max-width:520px){.nv-dt{flex-direction:column}.nv-dt-presets{flex-direction:row;flex-wrap:wrap;border-inline-end:0;border-bottom:1px solid var(--nv-dt-line);min-width:0}.nv-dt{--nv-dt-cell:clamp(30px,calc((100vw - 60px)/7),36px)}}\n@media (prefers-reduced-motion:no-preference){.nv-dt-day,.nv-dt-cell,.nv-dt button{transition:background-color .12s,color .12s}}\n";
package/dist/styles.js ADDED
@@ -0,0 +1,67 @@
1
+ // The stylesheet of the picker. Everything a designer changes is a CSS variable on `.nv-dt`.
2
+ export const pickerCss = `
3
+ .nv-dt{--nv-dt-accent:#e04f39;--nv-dt-accent-ink:#fff;--nv-dt-bg:#fff;--nv-dt-ink:#1b1f24;--nv-dt-muted:#6b7480;--nv-dt-line:#e3e6ea;--nv-dt-hover:#f1f3f5;--nv-dt-range:color-mix(in srgb,var(--nv-dt-accent) 14%,transparent);--nv-dt-radius:10px;--nv-dt-cell:36px;--nv-dt-font:inherit;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.14);box-sizing:border-box;display:inline-flex;max-width:100%;font-family:var(--nv-dt-font);font-size:14px;line-height:1.3;color:var(--nv-dt-ink);background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:var(--nv-dt-radius);user-select:none;-webkit-user-select:none}
4
+ .nv-dt *,.nv-dt *::before{box-sizing:border-box}
5
+ .nv-dt[data-theme=dark]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}
6
+ @media (prefers-color-scheme:dark){.nv-dt[data-theme=auto]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}}
7
+ :root.dark .nv-dt[data-theme=auto],:root[data-theme=dark] .nv-dt[data-theme=auto]{--nv-dt-bg:#1c2026;--nv-dt-ink:#eef0f3;--nv-dt-muted:#9aa3ad;--nv-dt-line:#333a43;--nv-dt-hover:#2a3038;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.5)}
8
+ :root:not(.dark)[data-theme=light] .nv-dt[data-theme=auto]{--nv-dt-bg:#fff;--nv-dt-ink:#1b1f24;--nv-dt-muted:#6b7480;--nv-dt-line:#e3e6ea;--nv-dt-hover:#f1f3f5;--nv-dt-shadow:0 10px 30px rgba(0,0,0,.14)}
9
+ .nv-dt-pop{position:absolute;z-index:1000;box-shadow:var(--nv-dt-shadow)}
10
+ .nv-dt[hidden]{display:none}
11
+ .nv-dt button{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;border-radius:calc(var(--nv-dt-radius) - 4px)}
12
+ .nv-dt button:focus-visible,.nv-dt input:focus-visible,.nv-dt select:focus-visible{outline:2px solid var(--nv-dt-accent);outline-offset:1px}
13
+ .nv-dt button:disabled{cursor:default;opacity:.35}
14
+ .nv-dt-presets{display:flex;flex-direction:column;gap:2px;padding:10px 8px;border-inline-end:1px solid var(--nv-dt-line);min-width:150px}
15
+ .nv-dt-presets button{text-align:start;padding:7px 10px;white-space:nowrap}
16
+ .nv-dt-presets button:hover{background:var(--nv-dt-hover)}
17
+ .nv-dt-presets button[aria-pressed=true]{background:var(--nv-dt-range);color:var(--nv-dt-accent);font-weight:600}
18
+ .nv-dt-main{display:flex;flex-direction:column;gap:10px;padding:12px;min-width:0}
19
+ .nv-dt-months{display:flex;gap:18px;flex-wrap:wrap}
20
+ .nv-dt-month{display:flex;flex-direction:column;gap:6px}
21
+ .nv-dt-head{display:flex;align-items:center;gap:4px;min-height:32px}
22
+ .nv-dt-title{flex:1;display:flex;justify-content:center;gap:2px;font-weight:600}
23
+ .nv-dt-title button{padding:5px 8px;text-transform:capitalize}
24
+ .nv-dt-title button:hover,.nv-dt-nav:hover{background:var(--nv-dt-hover)}
25
+ .nv-dt-nav{width:32px;height:32px;display:grid;place-items:center;flex:none}
26
+ .nv-dt-nav svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
27
+ .nv-dt[dir=rtl] .nv-dt-nav svg{transform:scaleX(-1)}
28
+ .nv-dt-nav[data-hide]{visibility:hidden}
29
+ .nv-dt-grid{display:grid;grid-template-columns:repeat(7,var(--nv-dt-cell));row-gap:2px}
30
+ .nv-dt-grid[data-weeks]{grid-template-columns:28px repeat(7,var(--nv-dt-cell))}
31
+ .nv-dt-dow,.nv-dt-wk{display:grid;place-items:center;height:28px;font-size:12px;color:var(--nv-dt-muted);text-transform:capitalize}
32
+ .nv-dt-wk{height:var(--nv-dt-cell);font-variant-numeric:tabular-nums}
33
+ .nv-dt-day{height:var(--nv-dt-cell);font-variant-numeric:tabular-nums;position:relative}
34
+ .nv-dt-day:hover:not(:disabled){background:var(--nv-dt-hover)}
35
+ .nv-dt-day.is-out{color:var(--nv-dt-muted);opacity:.55}
36
+ .nv-dt-day.is-today::after{content:"";position:absolute;inset-inline:0;bottom:5px;margin:auto;width:4px;height:4px;border-radius:50%;background:var(--nv-dt-accent)}
37
+ .nv-dt-day.is-in{background:var(--nv-dt-range);border-radius:0}
38
+ .nv-dt-day.is-start,.nv-dt-day.is-end,.nv-dt-day.is-on{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink);opacity:1}
39
+ .nv-dt-day.is-start:hover,.nv-dt-day.is-end:hover,.nv-dt-day.is-on:hover{background:var(--nv-dt-accent)}
40
+ .nv-dt-day.is-start.is-in{border-start-end-radius:0;border-end-end-radius:0}
41
+ .nv-dt-day.is-end.is-in{border-start-start-radius:0;border-end-start-radius:0}
42
+ .nv-dt-day.is-on.is-today::after,.nv-dt-day.is-start.is-today::after,.nv-dt-day.is-end.is-today::after{background:var(--nv-dt-accent-ink)}
43
+ .nv-dt-day:disabled{text-decoration:line-through}
44
+ .nv-dt-cells{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;min-width:calc(var(--nv-dt-cell) * 7)}
45
+ .nv-dt-cells[data-view=quarters]{grid-template-columns:repeat(2,1fr)}
46
+ .nv-dt-cell{padding:14px 6px;text-transform:capitalize;font-variant-numeric:tabular-nums}
47
+ .nv-dt-cell small{display:block;font-size:11px;color:var(--nv-dt-muted);margin-top:2px;text-transform:none}
48
+ .nv-dt-cell:hover:not(:disabled){background:var(--nv-dt-hover)}
49
+ .nv-dt-cell.is-on{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink)}
50
+ .nv-dt-cell.is-on small{color:inherit;opacity:.85}
51
+ .nv-dt-cell.is-now{box-shadow:inset 0 0 0 1px var(--nv-dt-accent)}
52
+ .nv-dt-times{display:flex;flex-wrap:wrap;gap:8px 18px;padding-top:10px;border-top:1px solid var(--nv-dt-line)}
53
+ .nv-dt-time{display:flex;align-items:center;gap:4px}
54
+ .nv-dt-time>span:first-child{color:var(--nv-dt-muted);font-size:12px;margin-inline-end:4px}
55
+ .nv-dt-time input{width:46px;height:32px;text-align:center;font:inherit;font-variant-numeric:tabular-nums;color:inherit;background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:calc(var(--nv-dt-radius) - 4px);padding:0;user-select:text;-webkit-user-select:text}
56
+ .nv-dt-time button{height:32px;padding:0 8px;border:1px solid var(--nv-dt-line)}
57
+ .nv-dt-zone{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--nv-dt-muted)}
58
+ .nv-dt-zone select{flex:1;min-width:0;height:30px;font:inherit;color:var(--nv-dt-ink);background:var(--nv-dt-bg);border:1px solid var(--nv-dt-line);border-radius:calc(var(--nv-dt-radius) - 4px);padding:0 6px}
59
+ .nv-dt-foot{display:flex;gap:6px;justify-content:space-between;padding-top:10px;border-top:1px solid var(--nv-dt-line)}
60
+ .nv-dt-foot div{display:flex;gap:6px}
61
+ .nv-dt-foot button{padding:6px 10px}
62
+ .nv-dt-foot button:hover{background:var(--nv-dt-hover)}
63
+ .nv-dt-foot .nv-dt-apply{background:var(--nv-dt-accent);color:var(--nv-dt-accent-ink)}
64
+ .nv-dt-foot .nv-dt-apply:hover{background:var(--nv-dt-accent);filter:brightness(1.08)}
65
+ @media (max-width:520px){.nv-dt{flex-direction:column}.nv-dt-presets{flex-direction:row;flex-wrap:wrap;border-inline-end:0;border-bottom:1px solid var(--nv-dt-line);min-width:0}.nv-dt{--nv-dt-cell:clamp(30px,calc((100vw - 60px)/7),36px)}}
66
+ @media (prefers-reduced-motion:no-preference){.nv-dt-day,.nv-dt-cell,.nv-dt button{transition:background-color .12s,color .12s}}
67
+ `;
@@ -0,0 +1,103 @@
1
+ import type { PeriodName } from './calendar.ts';
2
+ import type { Labels } from './i18n.ts';
3
+ /**
4
+ * What the reader picks.
5
+ * `date`: one day. `range`: a first and a last day. `multiple`: several days. `week`, `month`, `quarter`, `year`:
6
+ * one whole period. `time`: a time of day. Add `time: true` to `date` or `range` to pick the hour too.
7
+ */
8
+ export type Mode = 'date' | 'range' | 'multiple' | 'week' | 'month' | 'quarter' | 'year' | 'time';
9
+ /**
10
+ * A value, as ISO 8601 text.
11
+ * `date`: `2026-12-04`, or `2026-12-04T14:30+01:00` with `time: true`. `range`: `{ start, end }`, both included.
12
+ * `multiple`: a list of dates. `week`: `2026-W49`. `month`: `2026-12`. `quarter`: `2026-Q4`. `year`: `2026`. `time`: `14:30`.
13
+ */
14
+ export type PickerValue = string | readonly string[] | {
15
+ readonly start: string;
16
+ readonly end: string;
17
+ } | null;
18
+ /** The pick, ready to use: its ISO value, its two instants and its text for the reader. */
19
+ export interface Selection {
20
+ readonly mode: Mode;
21
+ readonly value: PickerValue;
22
+ /** First instant of the pick, in the zone. Null when nothing is picked, and for `time` and `multiple`. */
23
+ readonly start: Date | null;
24
+ /** The instant just after the pick (exclusive): filter with `start <= t && t < end`. With `time: true`, the picked instant itself. */
25
+ readonly end: Date | null;
26
+ /** IANA name of the zone the pick is read in. */
27
+ readonly zone: string;
28
+ /** The pick as the field shows it. */
29
+ readonly text: string;
30
+ }
31
+ /** A ready-made period of your own. `range` gives the first and last day, from today's date in the zone. */
32
+ export interface CustomPeriod {
33
+ readonly label: string;
34
+ readonly range: (today: string) => readonly [start: string, end: string];
35
+ }
36
+ export interface PickerOptions {
37
+ /** Default `date`. */
38
+ mode?: Mode;
39
+ /** Pick the hour too (`date` and `range`). Default false. */
40
+ time?: boolean;
41
+ /** Show seconds. Default false. */
42
+ seconds?: boolean;
43
+ /** Step of the minutes field. Default 1. */
44
+ minuteStep?: number;
45
+ /** 12-hour clock with AM and PM. Default: what the locale uses. */
46
+ hour12?: boolean;
47
+ value?: PickerValue | Date;
48
+ /** `local` (default), `UTC`, or an IANA name such as `Europe/Paris`. */
49
+ zone?: string;
50
+ /** Zones the reader can switch between; shows a list in the panel. */
51
+ zones?: readonly string[];
52
+ /** BCP 47 tag: `fr`, `de-CH`, `ar-TN`. Default: the language of the page, then of the browser. */
53
+ locale?: string;
54
+ /** Replace words of the picker. */
55
+ labels?: Partial<Omit<Labels, 'periods'>> & {
56
+ periods?: Partial<Labels['periods']>;
57
+ };
58
+ /** First day of the week, 0 Monday to 6 Sunday. Default: what the locale uses. */
59
+ firstDay?: number;
60
+ /** First day that can be picked, `2026-01-01`. */
61
+ min?: string;
62
+ /** Last day that can be picked. */
63
+ max?: string;
64
+ /** Days that cannot be picked: a list of dates, or a function of the date and its weekday (0 Monday to 6 Sunday). */
65
+ disable?: readonly string[] | ((date: string, weekday: number) => boolean);
66
+ /** Months shown side by side, 1 to 3. Default 1, and 2 for `range`. */
67
+ months?: number;
68
+ /** Show ISO week numbers. Default false, true for `week`. */
69
+ weekNumbers?: boolean;
70
+ /** Ready-made periods beside the calendar (`range`): true for the usual ones, or your list. */
71
+ presets?: boolean | readonly (PeriodName | CustomPeriod)[];
72
+ /** Always open, in the page, instead of a panel under the field. Default: true when the target is not a field. */
73
+ inline?: boolean;
74
+ /** Close the panel when the pick is complete. Default true, false with `time`. */
75
+ autoClose?: boolean;
76
+ placeholder?: string;
77
+ /** Accent colour (CSS). Sets `--nv-dt-accent` on the panel. */
78
+ accent?: string;
79
+ /** `auto` (default) follows the page or the system. */
80
+ theme?: 'light' | 'dark' | 'auto';
81
+ /** How the field writes the pick: Intl options, or your function. */
82
+ format?: Intl.DateTimeFormatOptions | ((selection: Selection) => string);
83
+ /** Extra classes on the panel. */
84
+ class?: string;
85
+ onChange?: (selection: Selection) => void;
86
+ onOpen?: () => void;
87
+ onClose?: () => void;
88
+ }
89
+ export interface Picker {
90
+ /** The panel. */
91
+ readonly element: HTMLElement;
92
+ getValue(): PickerValue;
93
+ getSelection(): Selection;
94
+ /** Sets the pick without calling `onChange`. */
95
+ setValue(value: PickerValue | Date): void;
96
+ /** Changes options and draws again: language, zone, mode, limits, colours. */
97
+ update(options: PickerOptions): void;
98
+ open(): void;
99
+ close(): void;
100
+ toggle(): void;
101
+ /** Removes the panel and its listeners. */
102
+ destroy(): void;
103
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/vue.d.ts ADDED
@@ -0,0 +1,72 @@
1
+ import { type PropType } from 'vue';
2
+ import type { Mode, PickerOptions, PickerValue, Selection } from './types.ts';
3
+ export type { Mode, Picker, PickerOptions, PickerValue, Selection } from './types.ts';
4
+ /** `<NvDateTime v-model="period" mode="range" presets locale="fr" />`. `change` gives the whole selection. */
5
+ export declare const NvDateTime: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ modelValue: {
7
+ type: PropType<PickerValue | Date>;
8
+ default: undefined;
9
+ };
10
+ mode: {
11
+ type: PropType<Mode>;
12
+ default: undefined;
13
+ };
14
+ /** Every other option of the picker: zone, zones, locale, min, max, months, time, presets, format, disable... */
15
+ options: {
16
+ type: PropType<PickerOptions>;
17
+ default: () => {};
18
+ };
19
+ inline: {
20
+ type: BooleanConstructor;
21
+ default: boolean;
22
+ };
23
+ name: {
24
+ type: StringConstructor;
25
+ default: undefined;
26
+ };
27
+ disabled: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
32
+ [key: string]: any;
33
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
34
+ 'update:modelValue': (_value: PickerValue) => true;
35
+ change: (_selection: Selection) => true;
36
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
37
+ modelValue: {
38
+ type: PropType<PickerValue | Date>;
39
+ default: undefined;
40
+ };
41
+ mode: {
42
+ type: PropType<Mode>;
43
+ default: undefined;
44
+ };
45
+ /** Every other option of the picker: zone, zones, locale, min, max, months, time, presets, format, disable... */
46
+ options: {
47
+ type: PropType<PickerOptions>;
48
+ default: () => {};
49
+ };
50
+ inline: {
51
+ type: BooleanConstructor;
52
+ default: boolean;
53
+ };
54
+ name: {
55
+ type: StringConstructor;
56
+ default: undefined;
57
+ };
58
+ disabled: {
59
+ type: BooleanConstructor;
60
+ default: boolean;
61
+ };
62
+ }>> & Readonly<{
63
+ onChange?: ((_selection: Selection) => any) | undefined;
64
+ "onUpdate:modelValue"?: ((_value: PickerValue) => any) | undefined;
65
+ }>, {
66
+ mode: Mode;
67
+ name: string;
68
+ disabled: boolean;
69
+ inline: boolean;
70
+ options: PickerOptions;
71
+ modelValue: Date | PickerValue;
72
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
package/dist/vue.js ADDED
@@ -0,0 +1,49 @@
1
+ import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch } from 'vue';
2
+ import { createDatePicker } from "./core.js";
3
+ /** `<NvDateTime v-model="period" mode="range" presets locale="fr" />`. `change` gives the whole selection. */
4
+ export const NvDateTime = defineComponent({
5
+ name: 'NvDateTime',
6
+ props: {
7
+ modelValue: { type: [String, Array, Object, Date], default: undefined },
8
+ mode: { type: String, default: undefined },
9
+ /** Every other option of the picker: zone, zones, locale, min, max, months, time, presets, format, disable... */
10
+ options: { type: Object, default: () => ({}) },
11
+ inline: { type: Boolean, default: false },
12
+ name: { type: String, default: undefined },
13
+ disabled: { type: Boolean, default: false },
14
+ },
15
+ emits: {
16
+ 'update:modelValue': (_value) => true,
17
+ change: (_selection) => true,
18
+ },
19
+ setup(props, { emit, expose }) {
20
+ const host = ref(null);
21
+ let picker = null;
22
+ const settings = () => ({
23
+ ...props.options,
24
+ ...(props.mode ? { mode: props.mode } : {}),
25
+ inline: props.inline || props.options.inline,
26
+ });
27
+ onMounted(() => {
28
+ picker = createDatePicker(host.value, {
29
+ ...settings(),
30
+ value: props.modelValue,
31
+ onChange: (selection) => {
32
+ props.options.onChange?.(selection);
33
+ emit('update:modelValue', selection.value);
34
+ emit('change', selection);
35
+ },
36
+ });
37
+ });
38
+ onBeforeUnmount(() => picker?.destroy());
39
+ watch(() => [props.options, props.mode], () => picker?.update(settings()), { deep: true });
40
+ watch(() => props.modelValue, (value) => {
41
+ if (picker && value !== undefined && JSON.stringify(picker.getValue()) !== JSON.stringify(value))
42
+ picker.setValue(value);
43
+ }, { deep: true });
44
+ expose({ picker: () => picker });
45
+ return () => props.inline || props.options.inline
46
+ ? h('div', { ref: host })
47
+ : h('input', { ref: host, type: 'text', name: props.name, disabled: props.disabled });
48
+ },
49
+ });
package/dist/zone.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { PlainDate, PlainTime } from './calendar.ts';
2
+ /** The zone of the browser or the server. */
3
+ export declare const localZone: () => string;
4
+ /** `local` becomes the zone of the device; `utc` in any case becomes `UTC`. */
5
+ export declare const resolveZone: (zone: string | undefined) => string;
6
+ /** True when the platform knows the zone (an IANA name such as `Europe/Paris`). */
7
+ export declare function isZone(zone: string): boolean;
8
+ /** The wall clock of a zone at an instant. */
9
+ export declare function wallClock(epoch: number, zone: string): PlainDate & PlainTime;
10
+ /** Minutes to add to UTC to get the wall clock of the zone at this instant (Paris in winter: 60). */
11
+ export declare function offsetMinutes(epoch: number, zone: string): number;
12
+ /**
13
+ * The instant of a wall clock in a zone. An hour that does not exist (spring change) moves forward;
14
+ * an hour that comes twice (autumn change) takes the first one.
15
+ */
16
+ export declare function instant(date: PlainDate, time: PlainTime, zone: string): number;
17
+ /** Today in a zone. */
18
+ export declare function today(zone: string, now?: number): PlainDate;
19
+ /** `+01:00`, `-05:30`, or `Z` for UTC. */
20
+ export declare function offsetText(epoch: number, zone: string): string;
21
+ /** Short name of the zone at an instant, in the language of the reader: `UTC+1`, `CET`, `GMT-5`. */
22
+ export declare function zoneLabel(epoch: number, zone: string, locale: string): string;
package/dist/zone.js ADDED
@@ -0,0 +1,81 @@
1
+ const formats = new Map();
2
+ /** The zone of the browser or the server. */
3
+ export const localZone = () => new Intl.DateTimeFormat().resolvedOptions().timeZone;
4
+ /** `local` becomes the zone of the device; `utc` in any case becomes `UTC`. */
5
+ export const resolveZone = (zone) => !zone || zone === 'local' ? localZone() : zone.toUpperCase() === 'UTC' ? 'UTC' : zone;
6
+ /** True when the platform knows the zone (an IANA name such as `Europe/Paris`). */
7
+ export function isZone(zone) {
8
+ try {
9
+ new Intl.DateTimeFormat('en-US', { timeZone: zone });
10
+ return true;
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ }
16
+ function format(zone) {
17
+ let f = formats.get(zone);
18
+ if (!f) {
19
+ f = new Intl.DateTimeFormat('en-US', {
20
+ timeZone: zone,
21
+ hourCycle: 'h23',
22
+ year: 'numeric',
23
+ month: '2-digit',
24
+ day: '2-digit',
25
+ hour: '2-digit',
26
+ minute: '2-digit',
27
+ second: '2-digit',
28
+ });
29
+ formats.set(zone, f);
30
+ }
31
+ return f;
32
+ }
33
+ /** The wall clock of a zone at an instant. */
34
+ export function wallClock(epoch, zone) {
35
+ const out = {};
36
+ for (const part of format(zone).formatToParts(epoch))
37
+ if (part.type !== 'literal')
38
+ out[part.type] = Number(part.value);
39
+ return { y: out.year, m: out.month, d: out.day, h: out.hour % 24, mi: out.minute, s: out.second };
40
+ }
41
+ /** Minutes to add to UTC to get the wall clock of the zone at this instant (Paris in winter: 60). */
42
+ export function offsetMinutes(epoch, zone) {
43
+ const w = wallClock(epoch, zone);
44
+ return Math.round((Date.UTC(w.y, w.m - 1, w.d, w.h, w.mi, w.s) - Math.floor(epoch / 1000) * 1000) / 60_000);
45
+ }
46
+ /**
47
+ * The instant of a wall clock in a zone. An hour that does not exist (spring change) moves forward;
48
+ * an hour that comes twice (autumn change) takes the first one.
49
+ */
50
+ export function instant(date, time, zone) {
51
+ const wall = Date.UTC(date.y, date.m - 1, date.d, time.h, time.mi, time.s);
52
+ const guess = wall - offsetMinutes(wall, zone) * 60_000;
53
+ const later = wall - offsetMinutes(guess, zone) * 60_000;
54
+ // The offset in force three hours earlier: it gives the first of two equal hours when the clock goes back
55
+ const before = offsetMinutes(later - 3 * 3_600_000, zone);
56
+ const earlier = wall - before * 60_000;
57
+ return earlier < later && offsetMinutes(earlier, zone) === before ? earlier : later;
58
+ }
59
+ /** Today in a zone. */
60
+ export function today(zone, now = Date.now()) {
61
+ const w = wallClock(now, zone);
62
+ return { y: w.y, m: w.m, d: w.d };
63
+ }
64
+ /** `+01:00`, `-05:30`, or `Z` for UTC. */
65
+ export function offsetText(epoch, zone) {
66
+ const minutes = offsetMinutes(epoch, zone);
67
+ if (zone === 'UTC' || minutes === 0)
68
+ return zone === 'UTC' ? 'Z' : '+00:00';
69
+ const abs = Math.abs(minutes);
70
+ return `${minutes < 0 ? '-' : '+'}${String(Math.floor(abs / 60)).padStart(2, '0')}:${String(abs % 60).padStart(2, '0')}`;
71
+ }
72
+ /** Short name of the zone at an instant, in the language of the reader: `UTC+1`, `CET`, `GMT-5`. */
73
+ export function zoneLabel(epoch, zone, locale) {
74
+ try {
75
+ const parts = new Intl.DateTimeFormat(locale, { timeZone: zone, timeZoneName: 'shortOffset' }).formatToParts(epoch);
76
+ return parts.find((p) => p.type === 'timeZoneName')?.value ?? zone;
77
+ }
78
+ catch {
79
+ return zone;
80
+ }
81
+ }
package/package.json CHANGED
@@ -1,6 +1,102 @@
1
1
  {
2
2
  "name": "@nervure/datetime",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Date and time picker from the nervure family: one day, a range, several days, a week, a month, a quarter, a year or a time, in any time zone and language. Framework-free, web component, React and Vue. No dependency.",
5
+ "keywords": [
6
+ "nervure",
7
+ "datepicker",
8
+ "date picker",
9
+ "datetime",
10
+ "datetime picker",
11
+ "date range picker",
12
+ "time picker",
13
+ "month picker",
14
+ "quarter picker",
15
+ "week picker",
16
+ "timezone",
17
+ "time zone",
18
+ "i18n",
19
+ "rtl",
20
+ "calendar",
21
+ "web component",
22
+ "custom element",
23
+ "react",
24
+ "vue",
25
+ "accessible",
26
+ "typescript",
27
+ "no dependency"
28
+ ],
29
+ "license": "MIT",
30
+ "author": "Ali Ben Macha <contact@benmacha.tn>",
31
+ "homepage": "https://nervurejs.github.io/datetime",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/nervurejs/nervure.git",
35
+ "directory": "packages/datetime"
36
+ },
37
+ "bugs": "https://github.com/nervurejs/nervure/issues",
38
+ "type": "module",
39
+ "sideEffects": [
40
+ "./dist/element.js",
41
+ "./cdn/*"
42
+ ],
43
+ "files": [
44
+ "dist",
45
+ "cdn",
46
+ "README.md",
47
+ "CHANGELOG.md",
48
+ "LICENSE"
49
+ ],
50
+ "exports": {
51
+ ".": {
52
+ "types": "./dist/index.d.ts",
53
+ "default": "./dist/index.js"
54
+ },
55
+ "./core": {
56
+ "types": "./dist/core.d.ts",
57
+ "default": "./dist/core.js"
58
+ },
59
+ "./element": {
60
+ "types": "./dist/element.d.ts",
61
+ "default": "./dist/element.js"
62
+ },
63
+ "./react": {
64
+ "types": "./dist/react.d.ts",
65
+ "default": "./dist/react.js"
66
+ },
67
+ "./vue": {
68
+ "types": "./dist/vue.d.ts",
69
+ "default": "./dist/vue.js"
70
+ },
71
+ "./style.css": "./dist/style.css",
72
+ "./package.json": "./package.json"
73
+ },
74
+ "unpkg": "./cdn/nervure-datetime.min.js",
75
+ "jsdelivr": "./cdn/nervure-datetime.min.js",
76
+ "scripts": {
77
+ "build": "rm -rf dist cdn && tsc -p tsconfig.build.json && node scripts/build.mjs",
78
+ "test": "vitest run",
79
+ "types": "tsc -p tsconfig.json",
80
+ "size": "node scripts/size.mjs",
81
+ "check": "npm run types && npm run build && npm test && npm run size",
82
+ "prepublishOnly": "npm run check"
83
+ },
84
+ "peerDependencies": {
85
+ "react": ">=18",
86
+ "vue": ">=3.3"
87
+ },
88
+ "peerDependenciesMeta": {
89
+ "react": {
90
+ "optional": true
91
+ },
92
+ "vue": {
93
+ "optional": true
94
+ }
95
+ },
96
+ "publishConfig": {
97
+ "access": "public"
98
+ },
99
+ "engines": {
100
+ "node": ">=20"
101
+ }
102
+ }