@adamosuiteservices/ui 2.10.13 → 2.11.13

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.
@@ -0,0 +1,6 @@
1
+ declare class _FullScreenLoaderManager {
2
+ show(): void;
3
+ hide(): void;
4
+ }
5
+ export declare const FullScreenLoaderManager: _FullScreenLoaderManager;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ import { Loader } from './full-screen-loader';
2
+ declare class _FullScreenLoaderObservable {
3
+ subscribers: ((loader: Loader) => void)[];
4
+ subscribe(callback: (loader: Loader) => void): () => void;
5
+ emit(loader: Loader): void;
6
+ }
7
+ export declare const FullScreenLoaderObservable: _FullScreenLoaderObservable;
8
+ export {};
@@ -0,0 +1,4 @@
1
+ export type Loader = {
2
+ open: boolean;
3
+ };
4
+ export declare function FullScreenLoader(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,3 @@
1
+ export * from './full-screen-loader';
2
+ export * from './full-screen-loader-manager';
3
+ export * from './full-screen-loader-observable';
@@ -0,0 +1,21 @@
1
+ import { Calendar } from '../calendar';
2
+ import { Combobox } from '../combobox';
3
+ import { ComponentProps } from 'react';
4
+ import { DateRange } from 'react-day-picker';
5
+ export type DatePickerSelectorLabels = {
6
+ last30Days?: string;
7
+ last7Days?: string;
8
+ last90Days?: string;
9
+ custom?: string;
10
+ placeholder?: string;
11
+ cancel?: string;
12
+ apply?: string;
13
+ };
14
+ export type DatePickerSelectorProps = ComponentProps<"div"> & Readonly<{
15
+ dateRange: DateRange;
16
+ onDateRangeChange: (dateRange: DateRange) => void;
17
+ labels?: DatePickerSelectorLabels;
18
+ combobox?: Omit<ComponentProps<typeof Combobox>, "options">;
19
+ calendar?: Omit<ComponentProps<typeof Calendar>, "mode" | "selected" | "onSelected">;
20
+ }>;
21
+ export declare function DatePickerSelector({ dateRange, onDateRangeChange, labels, combobox, calendar, className, ...props }: DatePickerSelectorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './date-picker-selector';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-BB_1_6y_.cjs"),p=require("./button-hCW1Pww0.cjs"),m=require("./calendar-DMvGcwMp.cjs"),g=require("./combobox-CW07jN3o.cjs"),k=require("./input-CWDpI1Ua.cjs"),d=require("./popover-cGp_rNLg.cjs"),C=require("./index-DoxiiusW.cjs"),i=require("react");function u(n,o,l){return m.addDays(n,-o,l)}function E({dateRange:n,onDateRangeChange:o,labels:l,combobox:y,calendar:j,className:f,...b}){const[h,D]=i.useState(void 0),[v,r]=i.useState(!1),[c,x]=i.useState(n),a={...{last30Days:"Last 30 days",last7Days:"Last 7 days",last90Days:"Last 90 days",custom:"Custom",placeholder:"Date",cancel:"Cancel",apply:"Apply"},...l},R=s=>{const t=m.startOfDay(new Date);switch(s){case"7_days":return{from:u(t,7),to:t};case"30_days":return{from:u(t,30),to:t};case"90_days":return{from:u(t,90),to:t};default:return{from:void 0,to:void 0}}};return e.jsxRuntimeExports.jsxs("div",{className:C.cn("adm:flex adm:w-max adm:flex-col",f),...b,children:[e.jsxRuntimeExports.jsx(g.Combobox,{alwaysShowPlaceholder:!0,selectedFeedback:"check",icon:"calendar_today",options:[{label:a.last30Days,value:"30_days"},{label:a.last7Days,value:"7_days"},{label:a.last90Days,value:"90_days"},{label:a.custom,value:"custom"}],value:h,onValueChange:s=>{if(typeof s=="string")if(s==="custom")r(!0);else{const t=R(s);o(t),x(void 0)}D(s)},labels:{placeholder:a.placeholder},...y}),e.jsxRuntimeExports.jsxs(d.Popover,{open:v,onOpenChange:r,children:[e.jsxRuntimeExports.jsx(d.PopoverAnchor,{asChild:!0,children:e.jsxRuntimeExports.jsx(k.Input,{className:"adm:sr-only"})}),e.jsxRuntimeExports.jsxs(d.PopoverContent,{align:"start",children:[e.jsxRuntimeExports.jsx(m.Calendar,{required:!0,mode:"range",selected:c,onSelect:x,captionLayout:"dropdown",classNames:{root:"adm:p-0!"},...j}),e.jsxRuntimeExports.jsxs("div",{className:"adm:mt-2 adm:flex adm:justify-end adm:gap-2",children:[e.jsxRuntimeExports.jsx(p.Button,{variant:"link",onClick:()=>{r(!1)},children:a.cancel}),e.jsxRuntimeExports.jsx(p.Button,{variant:"link",onClick:()=>{c&&o(c),r(!1)},children:a.apply})]})]})]})]})}exports.DatePickerSelector=E;
@@ -0,0 +1,105 @@
1
+ import { j as a } from "./jsx-runtime-BzflLqGi.js";
2
+ import { B as p } from "./button-CBy_oQDu.js";
3
+ import { b as v, C, s as g } from "./calendar-Bapd0vmU.js";
4
+ import { C as k } from "./combobox-CtdzWxGX.js";
5
+ import { I as P } from "./input-DFvZLcgm.js";
6
+ import { P as w, c as L, b as _ } from "./popover-DcQ18EVl.js";
7
+ import { c as N } from "./index-CRiPKpXj.js";
8
+ import { useState as d } from "react";
9
+ function i(r, o, n) {
10
+ return v(r, -o, n);
11
+ }
12
+ function E({ dateRange: r, onDateRangeChange: o, labels: n, combobox: u, calendar: f, className: y, ...x }) {
13
+ const [h, D] = d(void 0), [b, l] = d(!1), [c, m] = d(r), s = { ...{
14
+ last30Days: "Last 30 days",
15
+ last7Days: "Last 7 days",
16
+ last90Days: "Last 90 days",
17
+ custom: "Custom",
18
+ placeholder: "Date",
19
+ cancel: "Cancel",
20
+ apply: "Apply"
21
+ }, ...n }, j = (t) => {
22
+ const e = g(/* @__PURE__ */ new Date());
23
+ switch (t) {
24
+ case "7_days":
25
+ return { from: i(e, 7), to: e };
26
+ case "30_days":
27
+ return { from: i(e, 30), to: e };
28
+ case "90_days":
29
+ return { from: i(e, 90), to: e };
30
+ default:
31
+ return { from: void 0, to: void 0 };
32
+ }
33
+ };
34
+ return /* @__PURE__ */ a.jsxs("div", { className: N("adm:flex adm:w-max adm:flex-col", y), ...x, children: [
35
+ /* @__PURE__ */ a.jsx(
36
+ k,
37
+ {
38
+ alwaysShowPlaceholder: !0,
39
+ selectedFeedback: "check",
40
+ icon: "calendar_today",
41
+ options: [
42
+ { label: s.last30Days, value: "30_days" },
43
+ { label: s.last7Days, value: "7_days" },
44
+ { label: s.last90Days, value: "90_days" },
45
+ { label: s.custom, value: "custom" }
46
+ ],
47
+ value: h,
48
+ onValueChange: (t) => {
49
+ if (typeof t == "string")
50
+ if (t === "custom")
51
+ l(!0);
52
+ else {
53
+ const e = j(t);
54
+ o(e), m(void 0);
55
+ }
56
+ D(t);
57
+ },
58
+ labels: { placeholder: s.placeholder },
59
+ ...u
60
+ }
61
+ ),
62
+ /* @__PURE__ */ a.jsxs(w, { open: b, onOpenChange: l, children: [
63
+ /* @__PURE__ */ a.jsx(L, { asChild: !0, children: /* @__PURE__ */ a.jsx(P, { className: "adm:sr-only" }) }),
64
+ /* @__PURE__ */ a.jsxs(_, { align: "start", children: [
65
+ /* @__PURE__ */ a.jsx(
66
+ C,
67
+ {
68
+ required: !0,
69
+ mode: "range",
70
+ selected: c,
71
+ onSelect: m,
72
+ captionLayout: "dropdown",
73
+ classNames: { root: "adm:p-0!" },
74
+ ...f
75
+ }
76
+ ),
77
+ /* @__PURE__ */ a.jsxs("div", { className: "adm:mt-2 adm:flex adm:justify-end adm:gap-2", children: [
78
+ /* @__PURE__ */ a.jsx(
79
+ p,
80
+ {
81
+ variant: "link",
82
+ onClick: () => {
83
+ l(!1);
84
+ },
85
+ children: s.cancel
86
+ }
87
+ ),
88
+ /* @__PURE__ */ a.jsx(
89
+ p,
90
+ {
91
+ variant: "link",
92
+ onClick: () => {
93
+ c && o(c), l(!1);
94
+ },
95
+ children: s.apply
96
+ }
97
+ )
98
+ ] })
99
+ ] })
100
+ ] })
101
+ ] });
102
+ }
103
+ export {
104
+ E as DatePickerSelector
105
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-BB_1_6y_.cjs"),i=require("./spinner-B-sC3DVC.cjs"),a=require("react");class l{subscribers=[];subscribe(e){return this.subscribers.push(e),()=>{this.subscribers=this.subscribers.filter(r=>r!==e)}}emit(e){this.subscribers.forEach(r=>r(e))}}const s=new l;function c(){const[t,e]=a.useState(!1);return a.useEffect(()=>{const r=s.subscribe(({open:u})=>{e(u)});return()=>{r()}},[]),t?n.jsxRuntimeExports.jsx("div",{"data-slot":"full-screen-loader",className:`
2
+ adm:fixed adm:inset-0 adm:z-100 adm:flex adm:items-center
3
+ adm:justify-center adm:bg-black/50
4
+ `,children:n.jsxRuntimeExports.jsx(i.Spinner,{className:"adm:text-4xl adm:text-primary"})}):null}class o{show(){s.emit({open:!0})}hide(){s.emit({open:!1})}}const b=new o;exports.FullScreenLoader=c;exports.FullScreenLoaderManager=b;exports.FullScreenLoaderObservable=s;
@@ -0,0 +1,50 @@
1
+ import { j as a } from "./jsx-runtime-BzflLqGi.js";
2
+ import { S as i } from "./spinner-DvrliN2E.js";
3
+ import { useState as c, useEffect as l } from "react";
4
+ class u {
5
+ subscribers = [];
6
+ subscribe(e) {
7
+ return this.subscribers.push(e), () => {
8
+ this.subscribers = this.subscribers.filter((s) => s !== e);
9
+ };
10
+ }
11
+ emit(e) {
12
+ this.subscribers.forEach((s) => s(e));
13
+ }
14
+ }
15
+ const t = new u();
16
+ function f() {
17
+ const [r, e] = c(!1);
18
+ return l(() => {
19
+ const s = t.subscribe(({ open: n }) => {
20
+ e(n);
21
+ });
22
+ return () => {
23
+ s();
24
+ };
25
+ }, []), r ? /* @__PURE__ */ a.jsx(
26
+ "div",
27
+ {
28
+ "data-slot": "full-screen-loader",
29
+ className: `
30
+ adm:fixed adm:inset-0 adm:z-100 adm:flex adm:items-center
31
+ adm:justify-center adm:bg-black/50
32
+ `,
33
+ children: /* @__PURE__ */ a.jsx(i, { className: "adm:text-4xl adm:text-primary" })
34
+ }
35
+ ) : null;
36
+ }
37
+ class o {
38
+ show() {
39
+ t.emit({ open: !0 });
40
+ }
41
+ hide() {
42
+ t.emit({ open: !1 });
43
+ }
44
+ }
45
+ const p = new o();
46
+ export {
47
+ f as FullScreenLoader,
48
+ p as FullScreenLoaderManager,
49
+ t as FullScreenLoaderObservable
50
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";const i=require("./jsx-runtime-BB_1_6y_.cjs"),s=require("./icon-DPMQJBkA.cjs"),t=require("./index-DoxiiusW.cjs");function r({className:e,...n}){return i.jsxRuntimeExports.jsx(s.Icon,{symbol:"progress_activity",role:"status","aria-label":"Loading",className:t.cn("adm:animate-spin adm:text-lg",e),...n})}exports.Spinner=r;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { j as t } from "./jsx-runtime-BzflLqGi.js";
3
+ import { I as r } from "./icon-DKAhvlX_.js";
4
+ import { c as o } from "./index-CRiPKpXj.js";
5
+ function n({ className: a, ...s }) {
6
+ return /* @__PURE__ */ t.jsx(
7
+ r,
8
+ {
9
+ symbol: "progress_activity",
10
+ role: "status",
11
+ "aria-label": "Loading",
12
+ className: o("adm:animate-spin adm:text-lg", a),
13
+ ...s
14
+ }
15
+ );
16
+ }
17
+ export {
18
+ n as S
19
+ };
package/dist/spinner.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-BB_1_6y_.cjs"),i=require("./icon-DPMQJBkA.cjs"),r=require("./index-DoxiiusW.cjs");function s({className:e,...t}){return n.jsxRuntimeExports.jsx(i.Icon,{symbol:"progress_activity",role:"status","aria-label":"Loading",className:r.cn("adm:animate-spin adm:text-lg",e),...t})}exports.Spinner=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./spinner-B-sC3DVC.cjs");exports.Spinner=e.Spinner;
package/dist/spinner.js CHANGED
@@ -1,19 +1,4 @@
1
- "use client";
2
- import { j as r } from "./jsx-runtime-BzflLqGi.js";
3
- import { I as s } from "./icon-DKAhvlX_.js";
4
- import { c as o } from "./index-CRiPKpXj.js";
5
- function n({ className: t, ...a }) {
6
- return /* @__PURE__ */ r.jsx(
7
- s,
8
- {
9
- symbol: "progress_activity",
10
- role: "status",
11
- "aria-label": "Loading",
12
- className: o("adm:animate-spin adm:text-lg", t),
13
- ...a
14
- }
15
- );
16
- }
1
+ import { S as n } from "./spinner-DvrliN2E.js";
17
2
  export {
18
3
  n as Spinner
19
4
  };