@giddaa-housing/ui 3.4.0 → 3.6.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/css/components.css +13 -0
- package/css/generated/shared.css +1 -1
- package/dist/accordion.js +1 -1
- package/dist/activity-timeline.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/auth-layout.js +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +5 -1
- package/dist/badge.js +20 -6
- package/dist/bar-chart.d.ts +1 -1
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/bullet-chart.d.ts +1 -1
- package/dist/bullet-chart.js +1 -1
- package/dist/button-BS5KCibF.d.ts +33 -0
- package/dist/button-group.d.ts +1 -1
- package/dist/button-group.js +1 -1
- package/dist/button.d.ts +1 -1
- package/dist/button.js +50 -22
- package/dist/calendar.js +2 -2
- package/dist/call-card.js +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.d.ts +4 -2
- package/dist/carousel.js +13 -16
- package/dist/chart.d.ts +1 -1
- package/dist/chart.js +1 -1
- package/dist/chat.d.ts +1 -1
- package/dist/chat.js +1 -1
- package/dist/checkbox.d.ts +2 -2
- package/dist/checkbox.js +21 -7
- package/dist/collapsible.js +1 -1
- package/dist/combobox-CACVdp1R.js +430 -0
- package/dist/combobox.d.ts +9 -4
- package/dist/combobox.js +2 -309
- package/dist/cta.d.ts +1 -1
- package/dist/cta.js +1 -1
- package/dist/currency-selector.js +2 -2
- package/dist/data-table.d.ts +2 -2
- package/dist/data-table.js +1 -1
- package/dist/date-picker.d.ts +6 -5
- package/dist/date-picker.js +7 -17
- package/dist/details-card.js +1 -1
- package/dist/dialog.d.ts +3 -1
- package/dist/dialog.js +10 -6
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/dropzone.js +1 -1
- package/dist/editorial-card.js +2 -4
- package/dist/empty-state.js +1 -1
- package/dist/field.d.ts +4 -1
- package/dist/field.js +29 -12
- package/dist/file-upload.js +1 -1
- package/dist/filter.js +1 -1
- package/dist/footer.d.ts +2 -2
- package/dist/footer.js +1 -1
- package/dist/funnel-chart.d.ts +1 -1
- package/dist/funnel-chart.js +1 -1
- package/dist/gallery-indicator.js +1 -1
- package/dist/heatmap-chart.d.ts +1 -1
- package/dist/icons-C9JXR5Xv.d.ts +111 -0
- package/dist/icons.d.ts +2 -93
- package/dist/icons.js +37 -1
- package/dist/image.d.ts +59 -0
- package/dist/image.js +53 -0
- package/dist/infinite-scroll.js +3 -29
- package/dist/infotip.js +1 -1
- package/dist/input-group.d.ts +6 -6
- package/dist/input-group.js +39 -14
- package/dist/input-otp.d.ts +2 -2
- package/dist/input-otp.js +32 -15
- package/dist/input-size-context-BMhves-J.d.ts +13 -0
- package/dist/input-size-context.d.ts +2 -2
- package/dist/input-size-context.js +9 -2
- package/dist/input.d.ts +20 -2
- package/dist/input.js +31 -12
- package/dist/item.js +1 -1
- package/dist/kpi-card.js +1 -1
- package/dist/label.js +1 -1
- package/dist/line-chart.d.ts +1 -1
- package/dist/line-chart.js +1 -1
- package/dist/list-item.js +1 -1
- package/dist/map-indicator.js +1 -1
- package/dist/mask-input.d.ts +1 -1
- package/dist/match.d.ts +5 -2
- package/dist/match.js +183 -27
- package/dist/media-gallery-hero.js +15 -10
- package/dist/media-player.js +5 -13
- package/dist/message.js +2 -12
- package/dist/mobile-sidebar.js +2 -1
- package/dist/multi-step-form.js +2 -2
- package/dist/number-input.d.ts +2 -2
- package/dist/number-input.js +3 -3
- package/dist/page-header.js +1 -1
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +1 -1
- package/dist/password-input.js +1 -1
- package/dist/phone-input.d.ts +2 -2
- package/dist/phone-input.js +16 -21
- package/dist/photo-gallery.js +6 -3
- package/dist/picker-BTXBrsl4.js +62 -0
- package/dist/picker-j3txxA5t.d.ts +14 -0
- package/dist/pie-chart.d.ts +1 -1
- package/dist/pie-chart.js +1 -1
- package/dist/popover-CNymD33m.d.ts +20 -0
- package/dist/popover.d.ts +1 -19
- package/dist/popover.js +1 -1
- package/dist/price-tag.d.ts +1 -1
- package/dist/price-tag.js +50 -22
- package/dist/progress.js +1 -1
- package/dist/property-listing-card.d.ts +68 -2
- package/dist/property-listing-card.js +115 -29
- package/dist/purchase-option-card.js +1 -1
- package/dist/radar-chart.d.ts +1 -1
- package/dist/radar-chart.js +1 -1
- package/dist/radio-group.d.ts +2 -2
- package/dist/radio-group.js +24 -10
- package/dist/review-block.js +1 -1
- package/dist/rich-text-editor.d.ts +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/scatter-chart.d.ts +1 -1
- package/dist/scatter-chart.js +1 -1
- package/dist/scroll-spy.d.ts +8 -2
- package/dist/scroll-spy.js +16 -16
- package/dist/search-input.js +1 -1
- package/dist/section-jumper.d.ts +31 -0
- package/dist/section-jumper.js +276 -0
- package/dist/select.d.ts +9 -4
- package/dist/select.js +113 -20
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +3 -1
- package/dist/sheet.js +10 -6
- package/dist/sidebar.d.ts +2 -2
- package/dist/sidebar.js +4 -16
- package/dist/size-context-BVhHduLi.d.ts +33 -0
- package/dist/size-context.d.ts +2 -2
- package/dist/size-context.js +30 -1
- package/dist/skeleton.js +1 -1
- package/dist/slider.d.ts +5 -3
- package/dist/slider.js +26 -11
- package/dist/sonar.d.ts +1 -1
- package/dist/sonar.js +2 -2
- package/dist/sparkline.d.ts +1 -1
- package/dist/sparkline.js +1 -1
- package/dist/stepper.js +1 -1
- package/dist/styles.css +1622 -264
- package/dist/switch.d.ts +2 -2
- package/dist/switch.js +21 -7
- package/dist/table-card.js +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tag.d.ts +1 -1
- package/dist/tag.js +1 -1
- package/dist/testimonial-block.js +1 -1
- package/dist/textarea.d.ts +17 -1
- package/dist/textarea.js +24 -10
- package/dist/theme-switcher.js +1 -1
- package/dist/time-picker.d.ts +5 -4
- package/dist/time-picker.js +5 -7
- package/dist/toast.js +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/top-navbar.js +1 -1
- package/dist/tree-map.d.ts +1 -1
- package/dist/tree-map.js +1 -1
- package/dist/utils/cn.d.ts +5 -0
- package/dist/utils/cn.js +33 -0
- package/dist/utils/format.d.ts +45 -0
- package/dist/utils/format.js +70 -0
- package/dist/utils/phone.d.ts +98 -0
- package/dist/utils/phone.js +93 -0
- package/dist/utils/use-intersection.d.ts +9 -0
- package/dist/utils/use-intersection.js +29 -0
- package/dist/utils/use-is-mobile.d.ts +5 -0
- package/dist/utils/use-is-mobile.js +16 -0
- package/dist/utils/use-reduced-motion.d.ts +5 -0
- package/dist/{use-reduced-motion-BDvOK14x.js → utils/use-reduced-motion.js} +2 -2
- package/dist/utils/use-uncontrolled.d.ts +11 -0
- package/dist/{use-uncontrolled-CLfM1XbB.js → utils/use-uncontrolled.js} +2 -2
- package/dist/video-player-dialog.d.ts +12 -2
- package/dist/video-player-dialog.js +50 -9
- package/dist/waterfall-chart.d.ts +1 -1
- package/dist/waterfall-chart.js +1 -1
- package/package.json +13 -1
- package/dist/button-DW5OijoR.d.ts +0 -17
- package/dist/cn-BI_4DMBf.js +0 -23
- package/dist/input-CfoEJ8A6.d.ts +0 -12
- package/dist/input-size-context-C-SFx9sx.d.ts +0 -10
- package/dist/picker-xSTzeYhc.js +0 -50
- package/dist/size-context-BX6kAdVj.d.ts +0 -11
- package/dist/textarea-IS_D8pXf.d.ts +0 -11
package/dist/switch.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as ComponentSizeValue } from "./size-context-BVhHduLi.js";
|
|
2
2
|
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
3
3
|
//#region src/switch.d.ts
|
|
4
4
|
declare const switchVariants: (props?: ({
|
|
5
5
|
size?: "lg" | "md" | "sm" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
type SwitchSize =
|
|
7
|
+
type SwitchSize = ComponentSizeValue;
|
|
8
8
|
type SwitchProps = Omit<Switch$1.Root.Props, "children"> & {
|
|
9
9
|
loading?: boolean;
|
|
10
10
|
size?: SwitchSize;
|
package/dist/switch.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { cn } from "./utils/cn.js";
|
|
3
|
+
import { responsiveValueClasses, useComponentSizeValue } from "./size-context.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
7
7
|
//#region src/switch.tsx
|
|
8
|
-
const
|
|
8
|
+
const switchSizeVariants = {
|
|
9
9
|
sm: "h-5 w-8 [--switch-spinner-size:0.625rem] [--switch-thumb-size:14px] [--switch-track-width:2rem]",
|
|
10
10
|
md: "h-6 w-10 [--switch-spinner-size:0.75rem] [--switch-thumb-size:18px] [--switch-track-width:2.5rem]",
|
|
11
11
|
lg: "h-7 w-12 [--switch-spinner-size:0.875rem] [--switch-thumb-size:22px] [--switch-track-width:3rem]"
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
|
+
const switchVariants = cva("peer group/switch relative inline-flex shrink-0 items-center rounded-full border bg-clip-padding p-0.5 transition-[background-color,border-color,box-shadow,opacity,scale] duration-[var(--duration-motion-press)] ease-gdt-out active:scale-[0.97] motion-reduce:active:scale-100 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-line-focus focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-focus)] aria-invalid:border-line-danger aria-invalid:ring-3 aria-invalid:ring-line-danger/20 aria-invalid:focus-visible:border-line-danger aria-invalid:focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-danger)] data-checked:border-action-primary data-checked:bg-action-primary data-unchecked:border-line data-unchecked:bg-transparent data-[loading=true]:border-action-primary data-[loading=true]:bg-action-primary data-disabled:border-line-subtle! data-disabled:bg-transparent! data-disabled:cursor-not-allowed data-disabled:opacity-60 data-disabled:active:scale-100", { variants: { size: switchSizeVariants } });
|
|
13
14
|
/**
|
|
14
15
|
* Compose with the shared field primitives for label and helper text.
|
|
15
16
|
*
|
|
@@ -24,17 +25,17 @@ const switchVariants = cva("peer group/switch relative inline-flex shrink-0 item
|
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
27
|
function Switch({ className, disabled = false, loading = false, readOnly = false, size, ...props }) {
|
|
27
|
-
const resolvedSize =
|
|
28
|
+
const resolvedSize = responsiveValueClasses(useComponentSizeValue(size), responsiveSwitchSizes);
|
|
28
29
|
const isDisabled = disabled;
|
|
29
30
|
const isReadOnly = readOnly || loading;
|
|
30
31
|
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
31
32
|
"aria-busy": loading || void 0,
|
|
32
33
|
"data-slot": "switch",
|
|
33
34
|
"data-loading": loading,
|
|
34
|
-
"data-size": resolvedSize,
|
|
35
|
+
"data-size": resolvedSize.base,
|
|
35
36
|
disabled: isDisabled,
|
|
36
37
|
readOnly: isReadOnly,
|
|
37
|
-
className: cn(switchVariants({ size:
|
|
38
|
+
className: cn(switchVariants({ size: null }), resolvedSize.className, className),
|
|
38
39
|
...props,
|
|
39
40
|
children: /* @__PURE__ */ jsx(Switch$1.Thumb, {
|
|
40
41
|
"data-slot": "switch-thumb",
|
|
@@ -47,5 +48,18 @@ function Switch({ className, disabled = false, loading = false, readOnly = false
|
|
|
47
48
|
})
|
|
48
49
|
});
|
|
49
50
|
}
|
|
51
|
+
const responsiveSwitchSizes = {
|
|
52
|
+
base: switchSizeVariants,
|
|
53
|
+
md: {
|
|
54
|
+
sm: "md:h-5 md:w-8 md:[--switch-spinner-size:0.625rem] md:[--switch-thumb-size:14px] md:[--switch-track-width:2rem]",
|
|
55
|
+
md: "md:h-6 md:w-10 md:[--switch-spinner-size:0.75rem] md:[--switch-thumb-size:18px] md:[--switch-track-width:2.5rem]",
|
|
56
|
+
lg: "md:h-7 md:w-12 md:[--switch-spinner-size:0.875rem] md:[--switch-thumb-size:22px] md:[--switch-track-width:3rem]"
|
|
57
|
+
},
|
|
58
|
+
lg: {
|
|
59
|
+
sm: "lg:h-5 lg:w-8 lg:[--switch-spinner-size:0.625rem] lg:[--switch-thumb-size:14px] lg:[--switch-track-width:2rem]",
|
|
60
|
+
md: "lg:h-6 lg:w-10 lg:[--switch-spinner-size:0.75rem] lg:[--switch-thumb-size:18px] lg:[--switch-track-width:2.5rem]",
|
|
61
|
+
lg: "lg:h-7 lg:w-12 lg:[--switch-spinner-size:0.875rem] lg:[--switch-thumb-size:22px] lg:[--switch-track-width:3rem]"
|
|
62
|
+
}
|
|
63
|
+
};
|
|
50
64
|
//#endregion
|
|
51
65
|
export { Switch, switchVariants };
|
package/dist/table-card.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { cn } from "./utils/cn.js";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
5
|
import { useRender } from "@base-ui/react/use-render";
|
package/dist/table.js
CHANGED
package/dist/tabs.d.ts
CHANGED
package/dist/tabs.js
CHANGED
package/dist/tag.d.ts
CHANGED
package/dist/tag.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { X } from "./icons.js";
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from "./utils/cn.js";
|
|
4
4
|
import { useComponentSize } from "./size-context.js";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ArrowUpRight, Play, Star } from "./icons.js";
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from "./utils/cn.js";
|
|
4
4
|
import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
5
5
|
import { buttonVariants } from "./button.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
package/dist/textarea.d.ts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { n as ComponentSizeValue } from "./size-context-BVhHduLi.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/textarea.d.ts
|
|
4
|
+
declare const textareaSizeVariants: {
|
|
5
|
+
readonly sm: "min-h-22 px-3 py-2 text-gdt-xs";
|
|
6
|
+
readonly md: "min-h-26 px-3.5 py-2.5 text-gdt-sm";
|
|
7
|
+
readonly lg: "min-h-31 px-4 py-3 text-gdt-md";
|
|
8
|
+
};
|
|
9
|
+
declare const textareaVariants: (props?: ({
|
|
10
|
+
size?: "lg" | "md" | "sm" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
type TextareaProps = Omit<React.ComponentProps<"textarea">, "size"> & {
|
|
13
|
+
size?: ComponentSizeValue;
|
|
14
|
+
};
|
|
15
|
+
type TextareaSize = keyof typeof textareaSizeVariants;
|
|
16
|
+
declare function Textarea({ className, size, ...props }: TextareaProps): React.JSX.Element;
|
|
17
|
+
//#endregion
|
|
2
18
|
export { Textarea, type TextareaSize, textareaVariants };
|
package/dist/textarea.js
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { cn } from "./utils/cn.js";
|
|
3
|
+
import { responsiveValueClasses, useComponentSizeValue } from "./size-context.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
//#region src/textarea.tsx
|
|
7
|
+
const textareaSizeVariants = {
|
|
8
|
+
sm: "min-h-22 px-3 py-2 text-gdt-xs",
|
|
9
|
+
md: "min-h-26 px-3.5 py-2.5 text-gdt-sm",
|
|
10
|
+
lg: "min-h-31 px-4 py-3 text-gdt-md"
|
|
11
|
+
};
|
|
7
12
|
const textareaVariants = cva("flex field-sizing-content w-full min-w-0 resize-y rounded-xl border border-line bg-canvas text-fg-primary transition-[background-color,border-color,box-shadow,color] outline-none placeholder:text-fg-caption-placeholder hover:border-line-strong focus-visible:border-line-focus focus-visible:inset-ring-1 focus-visible:inset-ring-line-focus disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-line-subtle disabled:bg-surface disabled:text-fg-caption-placeholder disabled:placeholder:text-fg-caption-placeholder aria-invalid:border-line-danger aria-invalid:text-fg-danger aria-invalid:placeholder:text-fg-danger aria-invalid:shadow-none aria-invalid:focus-visible:border-line-danger aria-invalid:focus-visible:inset-ring-line-danger", {
|
|
8
|
-
variants: { size:
|
|
9
|
-
sm: "min-h-22 px-3 py-2 text-gdt-xs",
|
|
10
|
-
md: "min-h-26 px-3.5 py-2.5 text-gdt-sm",
|
|
11
|
-
lg: "min-h-31 px-4 py-3 text-gdt-md"
|
|
12
|
-
} },
|
|
13
|
+
variants: { size: textareaSizeVariants },
|
|
13
14
|
defaultVariants: { size: "md" }
|
|
14
15
|
});
|
|
15
16
|
function Textarea({ className, size, ...props }) {
|
|
16
|
-
const resolvedSize =
|
|
17
|
+
const resolvedSize = responsiveValueClasses(useComponentSizeValue(size), responsiveTextareaSizes);
|
|
17
18
|
return /* @__PURE__ */ jsx("textarea", {
|
|
18
19
|
"data-slot": "textarea",
|
|
19
|
-
"data-size": resolvedSize,
|
|
20
|
-
className: cn(textareaVariants({ size:
|
|
20
|
+
"data-size": resolvedSize.base,
|
|
21
|
+
className: cn(textareaVariants({ size: null }), resolvedSize.className, className),
|
|
21
22
|
...props
|
|
22
23
|
});
|
|
23
24
|
}
|
|
25
|
+
const responsiveTextareaSizes = {
|
|
26
|
+
base: textareaSizeVariants,
|
|
27
|
+
md: {
|
|
28
|
+
sm: "md:min-h-22 md:px-3 md:py-2 md:text-gdt-xs",
|
|
29
|
+
md: "md:min-h-26 md:px-3.5 md:py-2.5 md:text-gdt-sm",
|
|
30
|
+
lg: "md:min-h-31 md:px-4 md:py-3 md:text-gdt-md"
|
|
31
|
+
},
|
|
32
|
+
lg: {
|
|
33
|
+
sm: "lg:min-h-22 lg:px-3 lg:py-2 lg:text-gdt-xs",
|
|
34
|
+
md: "lg:min-h-26 lg:px-3.5 lg:py-2.5 lg:text-gdt-sm",
|
|
35
|
+
lg: "lg:min-h-31 lg:px-4 lg:py-3 lg:text-gdt-md"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
24
38
|
//#endregion
|
|
25
39
|
export { Textarea, textareaVariants };
|
package/dist/theme-switcher.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ChevronDown, Monitor, Moon, Sun } from "./icons.js";
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from "./utils/cn.js";
|
|
4
4
|
import { useComponentSize } from "./size-context.js";
|
|
5
5
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
package/dist/time-picker.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InputSizeValue } from "./input.js";
|
|
2
|
+
import { t as PickerPlacementProps } from "./picker-j3txxA5t.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
//#region src/time-picker.d.ts
|
|
4
|
-
interface TimePickerProps {
|
|
5
|
+
interface TimePickerProps extends PickerPlacementProps {
|
|
5
6
|
value?: string;
|
|
6
7
|
onChange?: (time: string | undefined) => void;
|
|
7
8
|
format?: "12h" | "24h";
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
/** Controls the trigger size. The time selection panel is not resized. */
|
|
10
|
-
size?:
|
|
11
|
+
size?: InputSizeValue;
|
|
11
12
|
placeholder?: string;
|
|
12
13
|
className?: string;
|
|
13
14
|
}
|
|
14
|
-
declare function TimePicker({ value, onChange, format, disabled, size, placeholder, className }: TimePickerProps): React.JSX.Element;
|
|
15
|
+
declare function TimePicker({ value, onChange, format, disabled, size, placeholder, className, ...placement }: TimePickerProps): React.JSX.Element;
|
|
15
16
|
//#endregion
|
|
16
17
|
export { TimePicker, type TimePickerProps };
|
package/dist/time-picker.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Clock } from "./icons.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { cn } from "./utils/cn.js";
|
|
4
|
+
import { useReducedMotion } from "./utils/use-reduced-motion.js";
|
|
5
5
|
import { Popover, PopoverContent } from "./popover.js";
|
|
6
|
-
import { n as
|
|
6
|
+
import { n as PickerTrigger, t as PickerFooter } from "./picker-BTXBrsl4.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
//#region src/lib/time-picker-paint.ts
|
|
@@ -239,7 +239,7 @@ function TimeColumn({ label, items, value, onChange }) {
|
|
|
239
239
|
})]
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
|
-
function TimePicker({ value, onChange, format = "12h", disabled = false, size, placeholder = "Select time", className }) {
|
|
242
|
+
function TimePicker({ value, onChange, format = "12h", disabled = false, size, placeholder = "Select time", className, ...placement }) {
|
|
243
243
|
const [open, setOpen] = React.useState(false);
|
|
244
244
|
const [pending, setPending] = React.useState(() => parseTimeString(value, format));
|
|
245
245
|
function handleOpenChange(next) {
|
|
@@ -273,10 +273,8 @@ function TimePicker({ value, onChange, format = "12h", disabled = false, size, p
|
|
|
273
273
|
className
|
|
274
274
|
}), /* @__PURE__ */ jsxs(PopoverContent, {
|
|
275
275
|
showArrow: false,
|
|
276
|
-
align: "center",
|
|
277
|
-
side: "bottom",
|
|
278
|
-
collisionAvoidance: PICKER_COLLISION_AVOIDANCE,
|
|
279
276
|
className: "min-w-(--anchor-width) gap-0 overflow-hidden rounded-2xl p-0 border border-line-subtle",
|
|
277
|
+
...placement,
|
|
280
278
|
children: [
|
|
281
279
|
/* @__PURE__ */ jsx("div", {
|
|
282
280
|
className: "flex w-full items-center justify-center gap-2 border-b border-line-subtle",
|
package/dist/toast.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Check, Info, X } from "./icons.js";
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from "./utils/cn.js";
|
|
4
4
|
import { Button } from "./button.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { Toast } from "@base-ui/react/toast";
|
package/dist/tooltip.js
CHANGED
package/dist/top-navbar.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ArrowUpRight, ChevronDown } from "./icons.js";
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from "./utils/cn.js";
|
|
4
4
|
import { MobileSidebar } from "./mobile-sidebar.js";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { mergeProps } from "@base-ui/react/merge-props";
|
package/dist/tree-map.d.ts
CHANGED
package/dist/tree-map.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { cn } from "./utils/cn.js";
|
|
3
3
|
import { useComponentSize } from "./size-context.js";
|
|
4
4
|
import { ChartCard, ChartContainer, ChartDescription, ChartHeader, ChartTitle, ChartTooltip, ChartTooltipContent } from "./chart.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
package/dist/utils/cn.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
3
|
+
//#region src/utils/cn.ts
|
|
4
|
+
/**
|
|
5
|
+
* The class merger every component in this package uses.
|
|
6
|
+
*
|
|
7
|
+
* Published because overriding a component's classes safely means merging them
|
|
8
|
+
* the same way it does. `clsx` alone leaves both `text-gdt-sm` and your
|
|
9
|
+
* `text-gdt-lg` on the element and lets source order decide; a stock
|
|
10
|
+
* `tailwind-merge` does not know the `text-gdt-*` scale is a font size and
|
|
11
|
+
* keeps both for a different reason. This one is configured for the design
|
|
12
|
+
* tokens, so the last class wins the way you meant it to.
|
|
13
|
+
*/
|
|
14
|
+
const twMerge = extendTailwindMerge({ extend: { classGroups: { "font-size": [{ text: [
|
|
15
|
+
"gdt-display",
|
|
16
|
+
"gdt-h1",
|
|
17
|
+
"gdt-h2",
|
|
18
|
+
"gdt-h3",
|
|
19
|
+
"gdt-h4",
|
|
20
|
+
"gdt-h5",
|
|
21
|
+
"gdt-xl",
|
|
22
|
+
"gdt-lg",
|
|
23
|
+
"gdt-md",
|
|
24
|
+
"gdt-sm",
|
|
25
|
+
"gdt-xs",
|
|
26
|
+
"gdt-subtext",
|
|
27
|
+
"gdt-capitalized"
|
|
28
|
+
] }] } } });
|
|
29
|
+
function cn(...inputs) {
|
|
30
|
+
return twMerge(clsx(inputs));
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { cn };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/utils/format.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Formatters the components here already use, published because the same
|
|
4
|
+
* values get written outside a component as often as inside one — a duration
|
|
5
|
+
* in a table cell, initials on a server-rendered avatar, a date in an export.
|
|
6
|
+
*
|
|
7
|
+
* Every one is a pure function with no React and no styling, so a server-only
|
|
8
|
+
* module can import them.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Seconds as a clock: `3723` → `"1:02:03"`, `95` → `"1:35"`. The hours part is
|
|
12
|
+
* dropped below an hour rather than padded to `0:01:35`, so a short clip does
|
|
13
|
+
* not read as if it might be long.
|
|
14
|
+
*
|
|
15
|
+
* Anything that is not a finite number is `"0:00"` — a media element reports
|
|
16
|
+
* `NaN` for its duration until it has loaded metadata, and the alternative is
|
|
17
|
+
* `NaN:NaN` on screen for the first few frames.
|
|
18
|
+
*/
|
|
19
|
+
declare function formatDuration(value: number | undefined): string;
|
|
20
|
+
/**
|
|
21
|
+
* A date written out in full: `"08 August 2026"`. Day before month, because
|
|
22
|
+
* the product's audience reads it that way and `"8/8/2026"` is ambiguous
|
|
23
|
+
* between two conventions where a spelled month is not.
|
|
24
|
+
*/
|
|
25
|
+
declare function formatDate(value: Date, locale?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* A time of day, 24-hour: `"14:05"`. A string passes through untouched, so a
|
|
28
|
+
* caller that already has the wording it wants — `"Yesterday"`, `"just now"` —
|
|
29
|
+
* can hand it over without this second-guessing it.
|
|
30
|
+
*/
|
|
31
|
+
declare function formatTimestamp(value: Date | string, locale?: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* A `datetime` attribute's value for a `<time>` element. A `Date` becomes ISO;
|
|
34
|
+
* a string is assumed to already be in a machine-readable form and passes
|
|
35
|
+
* through, matching {@link formatTimestamp}.
|
|
36
|
+
*/
|
|
37
|
+
declare function toDateTimeAttribute(value: Date | string): string;
|
|
38
|
+
/**
|
|
39
|
+
* The first letter of the first two words: `"Daniel Ikoyo"` → `"DI"`. Two and
|
|
40
|
+
* not three, because a monogram is a fallback for a missing photo and a third
|
|
41
|
+
* letter starts to compete with the name beside it.
|
|
42
|
+
*/
|
|
43
|
+
declare function getInitials(name: string): string;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { formatDate, formatDuration, formatTimestamp, getInitials, toDateTimeAttribute };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//#region src/utils/format.ts
|
|
2
|
+
/**
|
|
3
|
+
* Formatters the components here already use, published because the same
|
|
4
|
+
* values get written outside a component as often as inside one — a duration
|
|
5
|
+
* in a table cell, initials on a server-rendered avatar, a date in an export.
|
|
6
|
+
*
|
|
7
|
+
* Every one is a pure function with no React and no styling, so a server-only
|
|
8
|
+
* module can import them.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Seconds as a clock: `3723` → `"1:02:03"`, `95` → `"1:35"`. The hours part is
|
|
12
|
+
* dropped below an hour rather than padded to `0:01:35`, so a short clip does
|
|
13
|
+
* not read as if it might be long.
|
|
14
|
+
*
|
|
15
|
+
* Anything that is not a finite number is `"0:00"` — a media element reports
|
|
16
|
+
* `NaN` for its duration until it has loaded metadata, and the alternative is
|
|
17
|
+
* `NaN:NaN` on screen for the first few frames.
|
|
18
|
+
*/
|
|
19
|
+
function formatDuration(value) {
|
|
20
|
+
if (!Number.isFinite(value)) return "0:00";
|
|
21
|
+
const safeValue = Math.max(0, Math.floor(value ?? 0));
|
|
22
|
+
const hours = Math.floor(safeValue / 3600);
|
|
23
|
+
const minutes = Math.floor(safeValue % 3600 / 60);
|
|
24
|
+
const seconds = safeValue % 60;
|
|
25
|
+
if (hours > 0) return `${hours}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`;
|
|
26
|
+
return `${minutes}:${String(seconds).padStart(2, "0")}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A date written out in full: `"08 August 2026"`. Day before month, because
|
|
30
|
+
* the product's audience reads it that way and `"8/8/2026"` is ambiguous
|
|
31
|
+
* between two conventions where a spelled month is not.
|
|
32
|
+
*/
|
|
33
|
+
function formatDate(value, locale = "en-GB") {
|
|
34
|
+
return value.toLocaleDateString(locale, {
|
|
35
|
+
day: "2-digit",
|
|
36
|
+
month: "long",
|
|
37
|
+
year: "numeric"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A time of day, 24-hour: `"14:05"`. A string passes through untouched, so a
|
|
42
|
+
* caller that already has the wording it wants — `"Yesterday"`, `"just now"` —
|
|
43
|
+
* can hand it over without this second-guessing it.
|
|
44
|
+
*/
|
|
45
|
+
function formatTimestamp(value, locale) {
|
|
46
|
+
if (typeof value === "string") return value;
|
|
47
|
+
return value.toLocaleTimeString(locale ? [locale] : [], {
|
|
48
|
+
hour: "2-digit",
|
|
49
|
+
minute: "2-digit",
|
|
50
|
+
hour12: false
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A `datetime` attribute's value for a `<time>` element. A `Date` becomes ISO;
|
|
55
|
+
* a string is assumed to already be in a machine-readable form and passes
|
|
56
|
+
* through, matching {@link formatTimestamp}.
|
|
57
|
+
*/
|
|
58
|
+
function toDateTimeAttribute(value) {
|
|
59
|
+
return value instanceof Date ? value.toISOString() : value;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The first letter of the first two words: `"Daniel Ikoyo"` → `"DI"`. Two and
|
|
63
|
+
* not three, because a monogram is a fallback for a missing photo and a third
|
|
64
|
+
* letter starts to compete with the name beside it.
|
|
65
|
+
*/
|
|
66
|
+
function getInitials(name) {
|
|
67
|
+
return name.trim().split(/\s+/).slice(0, 2).map((part) => part[0]?.toUpperCase()).join("");
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { formatDate, formatDuration, formatTimestamp, getInitials, toDateTimeAttribute };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { CountryCode } from "libphonenumber-js";
|
|
2
|
+
//#region src/utils/phone.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Phone number helpers, shared by `PhoneInput` and by the forms around it.
|
|
5
|
+
*
|
|
6
|
+
* These are here because a phone number is validated in more places than it is
|
|
7
|
+
* typed — a zod schema, a server action, a CSV import, a table cell — and every
|
|
8
|
+
* one of those was otherwise reaching for its own regex. They carry no React
|
|
9
|
+
* and no styling, so a server-only module can import them.
|
|
10
|
+
*
|
|
11
|
+
* One rule runs through all of them: **invalid in, empty out**. Anything that
|
|
12
|
+
* is not a real, dialable number formats and parses to `""` rather than to
|
|
13
|
+
* `null`, to `undefined`, or to a half-cleaned version of what you passed. A
|
|
14
|
+
* caller then has one thing to check instead of three.
|
|
15
|
+
*/
|
|
16
|
+
/** How a number should read once it is formatted. */
|
|
17
|
+
type PhoneNumberFormat =
|
|
18
|
+
/** `+234 801 234 5678` — the one to show when the country matters. */
|
|
19
|
+
"international" |
|
|
20
|
+
/** `0801 234 5678` — the one to show to someone in that country. */
|
|
21
|
+
"national" |
|
|
22
|
+
/** `+2348012345678` — the one to store. */
|
|
23
|
+
"e164" |
|
|
24
|
+
/** `tel:+234-801-234-5678` — the one to put in an `href`. */
|
|
25
|
+
"rfc3966";
|
|
26
|
+
interface PhoneNumberOptions {
|
|
27
|
+
/**
|
|
28
|
+
* The country to read a number against when it does not carry its own
|
|
29
|
+
* calling code. `"08012345678"` is a valid Nigerian number and nothing at
|
|
30
|
+
* all without this; `"+2348012345678"` needs it either way.
|
|
31
|
+
*/
|
|
32
|
+
country?: CountryCode;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether a value is a phone number that could actually be dialed. Stricter
|
|
36
|
+
* than "has the right number of digits" — it checks the number against the
|
|
37
|
+
* ranges its country has assigned.
|
|
38
|
+
*
|
|
39
|
+
* Written to be passed by reference to a schema:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* z.string().refine(validatePhoneNumber, "Enter a valid phone number");
|
|
43
|
+
* yup.string().test("phone", "Enter a valid phone number", validatePhoneNumber);
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Empty and `null` are invalid. Mark the field optional in the schema rather
|
|
47
|
+
* than asking this to have an opinion about whether a missing number is a
|
|
48
|
+
* problem, which is the schema's business and not this function's.
|
|
49
|
+
*/
|
|
50
|
+
declare function validatePhoneNumber(value: unknown, options?: PhoneNumberOptions): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The E.164 form of a valid number — `+2348012345678`, the one to store — or
|
|
53
|
+
* `""` if the value is not a valid number.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* parsePhoneNumber("0801 234 5678", { country: "NG" }); // "+2348012345678"
|
|
57
|
+
* parsePhoneNumber("0801 234"); // ""
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
declare function parsePhoneNumber(value: unknown, options?: PhoneNumberOptions): string;
|
|
61
|
+
/**
|
|
62
|
+
* A valid number written for a reader, or `""` if the value is not a valid
|
|
63
|
+
* number. Defaults to `international`, which is the form that does not depend
|
|
64
|
+
* on knowing where the reader is.
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* formatPhoneNumber("+2348012345678"); // "+234 801 234 5678"
|
|
68
|
+
* formatPhoneNumber("+2348012345678", { format: "national" }); // "0801 234 5678"
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* Blanking an invalid number is the point rather than an oversight: a value
|
|
72
|
+
* that cannot be formatted is a value that should be fixed, and showing a
|
|
73
|
+
* half-formatted one hides that.
|
|
74
|
+
*/
|
|
75
|
+
declare function formatPhoneNumber(value: unknown, options?: PhoneNumberOptions & {
|
|
76
|
+
format?: PhoneNumberFormat;
|
|
77
|
+
}): string;
|
|
78
|
+
/** The country a valid number belongs to, or `undefined`. */
|
|
79
|
+
declare function getPhoneNumberCountry(value: unknown, options?: PhoneNumberOptions): CountryCode | undefined;
|
|
80
|
+
interface PhoneCountry {
|
|
81
|
+
/** ISO 3166-1 alpha-2, e.g. `"NG"`. */
|
|
82
|
+
code: CountryCode;
|
|
83
|
+
/** Localised display name, falling back to the code where `Intl` is absent. */
|
|
84
|
+
name: string;
|
|
85
|
+
/** Calling code without the `+`, e.g. `"234"`. */
|
|
86
|
+
callingCode: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Every country a number can be entered for, sorted by name in `locale`.
|
|
90
|
+
*
|
|
91
|
+
* `PhoneInput` builds its own list from this. It is exported because the
|
|
92
|
+
* country a phone number belongs to tends to be asked for elsewhere in the
|
|
93
|
+
* same form — an address, a nationality — and a second, differently-sorted
|
|
94
|
+
* list of countries in one form is a bug people notice.
|
|
95
|
+
*/
|
|
96
|
+
declare function getPhoneCountries(locale?: string): PhoneCountry[];
|
|
97
|
+
//#endregion
|
|
98
|
+
export { type CountryCode, type PhoneCountry, type PhoneNumberFormat, type PhoneNumberOptions, formatPhoneNumber, getPhoneCountries, getPhoneNumberCountry, parsePhoneNumber, validatePhoneNumber };
|