@heliosgraphics/ui 2.0.0-alpha.89 → 2.0.0-alpha.91
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/components/Alert/Alert.tsx +1 -1
- package/components/Breadcrumb/Breadcrumb.meta.ts +1 -1
- package/components/Breadcrumb/Breadcrumb.tsx +4 -4
- package/components/Browser/Browser.tsx +6 -2
- package/components/Button/Button.tsx +175 -173
- package/components/ButtonGroup/ButtonGroup.tsx +2 -4
- package/components/Checkbox/Checkbox.tsx +61 -55
- package/components/Clock/Clock.module.css +1 -1
- package/components/Clock/Clock.tsx +1 -1
- package/components/Column/Column.tsx +2 -2
- package/components/Confirm/Confirm.tsx +1 -1
- package/components/DatePicker/DatePicker.tsx +6 -2
- package/components/Debug/Debug.tsx +2 -2
- package/components/Details/Details.tsx +1 -1
- package/components/Dialog/Dialog.tsx +32 -5
- package/components/Donut/Donut.module.css +1 -1
- package/components/Donut/Donut.tsx +8 -1
- package/components/Dot/Dot.tsx +1 -1
- package/components/Dropdown/Dropdown.tsx +46 -19
- package/components/Fieldset/Fieldset.tsx +1 -1
- package/components/Flex/Flex.tsx +7 -6
- package/components/Flex/Flex.types.ts +2 -2
- package/components/Grid/Grid.tsx +7 -3
- package/components/Heading/Heading.tsx +15 -10
- package/components/Heading/components/H0/H0.tsx +1 -1
- package/components/Icon/Icon.tsx +1 -1
- package/components/Input/Input.tsx +13 -3
- package/components/Layout/components/LayoutAside/LayoutAside.tsx +1 -1
- package/components/Layout/components/LayoutAside/components/LayoutAsideContent/LayoutAsideContent.tsx +1 -1
- package/components/Layout/components/LayoutAside/components/LayoutAsideFooter/LayoutAsideFooter.tsx +1 -1
- package/components/Layout/components/LayoutAside/components/LayoutAsideToggle/LayoutAsideToggle.tsx +1 -1
- package/components/Layout/components/LayoutMain/LayoutMain.tsx +1 -1
- package/components/Layout/components/LayoutMain/components/LayoutMainContent/LayoutMainContent.tsx +1 -1
- package/components/Layout/components/LayoutNavigation/LayoutNavigation.tsx +1 -1
- package/components/Loading/Loading.tsx +10 -2
- package/components/Markdown/Markdown.meta.ts +7 -0
- package/components/Markdown/Markdown.tsx +15 -6
- package/components/Markdown/Markdown.types.ts +4 -1
- package/components/Markdown/Markdown.utils.spec.ts +3 -3
- package/components/Markdown/Markdown.utils.ts +9 -7
- package/components/Masonry/Masonry.meta.ts +1 -1
- package/components/Masonry/Masonry.tsx +2 -2
- package/components/Masonry/Masonry.types.ts +1 -1
- package/components/Menu/Menu.tsx +1 -3
- package/components/Menu/components/MenuCategory/MenuCategory.tsx +13 -2
- package/components/Menu/components/MenuFilter/MenuFilter.tsx +1 -1
- package/components/Menu/components/MenuItem/MenuItem.tsx +14 -1
- package/components/Overlay/Overlay.tsx +1 -1
- package/components/Pie/Pie.tsx +7 -4
- package/components/Pill/Pill.tsx +1 -1
- package/components/Placeholder/Placeholder.tsx +1 -0
- package/components/Progress/Progress.tsx +9 -1
- package/components/Radio/Radio.tsx +64 -58
- package/components/Segments/Segments.tsx +7 -12
- package/components/Segments/components/SegmentButton/SegmentButton.meta.ts +4 -0
- package/components/Segments/components/SegmentButton/SegmentButton.tsx +13 -16
- package/components/Segments/components/SegmentButton/SegmentButton.types.ts +2 -0
- package/components/Select/Select.tsx +5 -4
- package/components/Separator/components/HorizontalSeparator/HorizontalSeparator.tsx +1 -1
- package/components/Separator/components/VerticalSeparator/VerticalSeparator.tsx +1 -1
- package/{components.css → components/Setup/Setup.components.css} +2 -2
- package/components/Setup/Setup.meta.ts +2 -2
- package/components/Setup/Setup.tsx +10 -7
- package/components/Setup/Setup.types.ts +1 -0
- package/components/Shimmer/Shimmer.tsx +3 -2
- package/components/Slider/Slider.tsx +4 -4
- package/components/Spacer/Spacer.tsx +1 -1
- package/components/Table/Table.tsx +1 -1
- package/components/Tabs/Tabs.tsx +36 -12
- package/components/Text/Text.tsx +5 -2
- package/components/Textarea/Textarea.tsx +10 -5
- package/components/Tile/Tile.tsx +2 -9
- package/components/Tile/Tile.types.ts +1 -1
- package/components/Timestamp/Timestamp.meta.ts +5 -1
- package/components/Timestamp/Timestamp.tsx +3 -3
- package/components/Timestamp/Timestamp.types.ts +1 -1
- package/components/Toggle/Toggle.tsx +2 -2
- package/components/Tooltip/Tooltip.module.css +32 -0
- package/components/Tooltip/Tooltip.tsx +36 -72
- package/components/Tooltip/Tooltip.types.ts +1 -0
- package/components/Tooltip/components/TooltipContent/TooltipContent.tsx +5 -3
- package/components/Tooltip/components/TooltipTrigger/TooltipTrigger.tsx +10 -4
- package/components/shared/InputLabel/InputLabel.tsx +1 -1
- package/components/shared/ResultList/ResultList.meta.ts +4 -0
- package/components/shared/ResultList/ResultList.tsx +8 -10
- package/components/shared/ResultList/ResultList.types.ts +1 -0
- package/constants/hooks.ts +1 -1
- package/contexts/LayoutContext/LayoutContext.tsx +30 -20
- package/contexts/LayoutContext/LayoutContext.types.ts +1 -0
- package/hooks/useDebounce.tsx +2 -2
- package/hooks/useLayoutContext.tsx +1 -0
- package/hooks/usePrint.tsx +31 -0
- package/index.ts +4 -0
- package/package.json +20 -12
- package/utils/date.ts +54 -0
- package/utils/dayjs.ts +0 -21
- /package/{css → components/Setup/css}/core.colors-helpers.css +0 -0
- /package/{css → components/Setup/css}/core.colors.css +0 -0
- /package/{css → components/Setup/css}/core.scale.css +0 -0
- /package/{css → components/Setup/css}/core.setup.css +0 -0
- /package/{css → components/Setup/css}/core.typography.css +0 -0
- /package/{css → components/Setup/css}/feat.atomics.css +0 -0
- /package/{css → components/Setup/css}/feat.markdown.css +0 -0
- /package/{css → components/Setup/css}/feat.responsive.css +0 -0
package/hooks/useDebounce.tsx
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState, useEffect } from "react"
|
|
4
4
|
|
|
5
|
-
export const useDebounce = (value:
|
|
6
|
-
const [debouncedValue, setDebouncedValue] = useState<
|
|
5
|
+
export const useDebounce = <T,>(value: T, delay: number): T => {
|
|
6
|
+
const [debouncedValue, setDebouncedValue] = useState<T>(value)
|
|
7
7
|
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
const handler: ReturnType<typeof setTimeout> = setTimeout(() => {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useState } from "react"
|
|
4
|
+
|
|
5
|
+
interface UsePrintReturn {
|
|
6
|
+
isPrinting: boolean
|
|
7
|
+
print: () => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const usePrint = (): UsePrintReturn => {
|
|
11
|
+
const [isPrinting, setIsPrinting] = useState<boolean>(false)
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const handleBeforePrint = (): void => setIsPrinting(true)
|
|
15
|
+
const handleAfterPrint = (): void => setIsPrinting(false)
|
|
16
|
+
|
|
17
|
+
globalThis.addEventListener("beforeprint", handleBeforePrint)
|
|
18
|
+
globalThis.addEventListener("afterprint", handleAfterPrint)
|
|
19
|
+
|
|
20
|
+
return (): void => {
|
|
21
|
+
globalThis.removeEventListener("beforeprint", handleBeforePrint)
|
|
22
|
+
globalThis.removeEventListener("afterprint", handleAfterPrint)
|
|
23
|
+
}
|
|
24
|
+
}, [])
|
|
25
|
+
|
|
26
|
+
const print = useCallback((): void => {
|
|
27
|
+
globalThis.print()
|
|
28
|
+
}, [])
|
|
29
|
+
|
|
30
|
+
return { isPrinting, print }
|
|
31
|
+
}
|
package/index.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// eslint-disable-next-line typescript/triple-slash-reference
|
|
2
|
+
/// <reference path="./globals.d.ts" />
|
|
3
|
+
|
|
1
4
|
export { Alert } from "./components/Alert"
|
|
2
5
|
export { Breadcrumb } from "./components/Breadcrumb"
|
|
3
6
|
export { Browser } from "./components/Browser"
|
|
@@ -64,6 +67,7 @@ export type { TextBaseProps, TextProps } from "./components/Text"
|
|
|
64
67
|
export { useIntersection } from "./hooks/useIntersection"
|
|
65
68
|
export { useLayoutContext } from "./hooks/useLayoutContext"
|
|
66
69
|
export { usePrevious } from "./hooks/usePrevious"
|
|
70
|
+
export { usePrint } from "./hooks/usePrint"
|
|
67
71
|
export { useTheme } from "./hooks/useTheme"
|
|
68
72
|
|
|
69
73
|
export type { HeliosAppearanceType, HeliosColorType } from "./types/colors"
|
package/package.json
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heliosgraphics/ui",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.91",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"author": "Chris Puska <chris@puska.org>",
|
|
7
7
|
"private": false,
|
|
8
8
|
"description": "Helios UI",
|
|
9
9
|
"main": "./index.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./index.ts",
|
|
12
|
+
"./components/*": "./components/*/index.ts",
|
|
13
|
+
"./constants/*": "./constants/*.ts",
|
|
14
|
+
"./contexts/*": "./contexts/*/index.ts",
|
|
15
|
+
"./hooks/*": "./hooks/*.tsx",
|
|
16
|
+
"./types/*": "./types/*.ts",
|
|
17
|
+
"./utils/*": "./utils/*.ts",
|
|
18
|
+
"./css/*": "./css/*.css",
|
|
19
|
+
"./components.css": "./components.css"
|
|
20
|
+
},
|
|
10
21
|
"files": [
|
|
11
22
|
"components/**/*.*",
|
|
12
23
|
"constants/*.*",
|
|
@@ -31,24 +42,21 @@
|
|
|
31
42
|
"@heliosgraphics/css": "1.0.0-alpha.3",
|
|
32
43
|
"@heliosgraphics/icons": "1.0.0-alpha.11",
|
|
33
44
|
"@heliosgraphics/utils": "6.0.0-alpha.9",
|
|
34
|
-
"@types/markdown-it": "^14.1.2",
|
|
35
45
|
"dayjs": "^1.11.19",
|
|
36
|
-
"
|
|
46
|
+
"marked": "^17.0.2",
|
|
47
|
+
"marked-linkify-it": "^3.1.14",
|
|
48
|
+
"marked-xhtml": "^1.0.14",
|
|
37
49
|
"react-plock": "^3.6.1"
|
|
38
50
|
},
|
|
39
51
|
"devDependencies": {
|
|
40
52
|
"@testing-library/react": "^16.3.2",
|
|
41
53
|
"@types/node": "^25",
|
|
42
|
-
"@
|
|
43
|
-
"@vitejs/plugin-react": "^5.1.2",
|
|
54
|
+
"@vitejs/plugin-react": "^5.1.4",
|
|
44
55
|
"@vitest/coverage-v8": "^4.0.18",
|
|
45
|
-
"esbuild": "
|
|
46
|
-
"esbuild-css-modules-plugin": "
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"eslint-plugin-prettier": "^5.5.5",
|
|
50
|
-
"glob": "latest",
|
|
51
|
-
"jsdom": "^27.4.0",
|
|
56
|
+
"esbuild": "^0.27.3",
|
|
57
|
+
"esbuild-css-modules-plugin": "^3.1.5",
|
|
58
|
+
"glob": "^13.0.3",
|
|
59
|
+
"jsdom": "^28.0.0",
|
|
52
60
|
"next": "^16.1.6",
|
|
53
61
|
"prettier": "^3.8.1",
|
|
54
62
|
"typescript": "^5.9.3",
|
package/utils/date.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const DEFAULT_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {
|
|
2
|
+
year: "numeric",
|
|
3
|
+
month: "long",
|
|
4
|
+
day: "numeric",
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const RELATIVE_UNITS: Array<{ unit: Intl.RelativeTimeFormatUnit; ms: number }> = [
|
|
8
|
+
{ unit: "year", ms: 365.25 * 24 * 60 * 60 * 1000 },
|
|
9
|
+
{ unit: "month", ms: 30.44 * 24 * 60 * 60 * 1000 },
|
|
10
|
+
{ unit: "week", ms: 7 * 24 * 60 * 60 * 1000 },
|
|
11
|
+
{ unit: "day", ms: 24 * 60 * 60 * 1000 },
|
|
12
|
+
{ unit: "hour", ms: 60 * 60 * 1000 },
|
|
13
|
+
{ unit: "minute", ms: 60 * 1000 },
|
|
14
|
+
{ unit: "second", ms: 1000 },
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "auto" })
|
|
18
|
+
|
|
19
|
+
export const formatDate = (
|
|
20
|
+
date?: string | null,
|
|
21
|
+
options: Intl.DateTimeFormatOptions = DEFAULT_FORMAT_OPTIONS,
|
|
22
|
+
): string => {
|
|
23
|
+
if (!date) return ""
|
|
24
|
+
|
|
25
|
+
const parsed = new Date(date)
|
|
26
|
+
|
|
27
|
+
if (Number.isNaN(parsed.getTime())) return ""
|
|
28
|
+
|
|
29
|
+
return new Intl.DateTimeFormat("en-US", options).format(parsed)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const getIsValid = (date?: string | null): boolean => {
|
|
33
|
+
if (!date) return false
|
|
34
|
+
|
|
35
|
+
return !Number.isNaN(new Date(date).getTime())
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const getFromNow = (date?: string | null): string => {
|
|
39
|
+
if (!date) return ""
|
|
40
|
+
|
|
41
|
+
const parsed = new Date(date)
|
|
42
|
+
|
|
43
|
+
if (Number.isNaN(parsed.getTime())) return ""
|
|
44
|
+
|
|
45
|
+
const diff: number = parsed.getTime() - Date.now()
|
|
46
|
+
|
|
47
|
+
for (const { unit, ms } of RELATIVE_UNITS) {
|
|
48
|
+
if (Math.abs(diff) >= ms) {
|
|
49
|
+
return rtf.format(Math.round(diff / ms), unit)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return rtf.format(0, "second")
|
|
54
|
+
}
|
package/utils/dayjs.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import dayjs from "dayjs"
|
|
2
|
-
import relativeTime from "dayjs/plugin/relativeTime"
|
|
3
|
-
|
|
4
|
-
dayjs.extend(relativeTime)
|
|
5
|
-
|
|
6
|
-
export const formatDate = (date?: string | null, format?: string): string => {
|
|
7
|
-
if (!date || !format) return ""
|
|
8
|
-
|
|
9
|
-
const formatted: string = dayjs(date).format(format)
|
|
10
|
-
|
|
11
|
-
return formatted
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const getIsValid = (date?: string | null): boolean => {
|
|
15
|
-
const parseDate = dayjs(date)
|
|
16
|
-
const isValid: boolean = parseDate.isValid()
|
|
17
|
-
|
|
18
|
-
return isValid
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const getFromNow = (date?: string | null): string => dayjs(date).fromNow()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|