@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.
Files changed (104) hide show
  1. package/components/Alert/Alert.tsx +1 -1
  2. package/components/Breadcrumb/Breadcrumb.meta.ts +1 -1
  3. package/components/Breadcrumb/Breadcrumb.tsx +4 -4
  4. package/components/Browser/Browser.tsx +6 -2
  5. package/components/Button/Button.tsx +175 -173
  6. package/components/ButtonGroup/ButtonGroup.tsx +2 -4
  7. package/components/Checkbox/Checkbox.tsx +61 -55
  8. package/components/Clock/Clock.module.css +1 -1
  9. package/components/Clock/Clock.tsx +1 -1
  10. package/components/Column/Column.tsx +2 -2
  11. package/components/Confirm/Confirm.tsx +1 -1
  12. package/components/DatePicker/DatePicker.tsx +6 -2
  13. package/components/Debug/Debug.tsx +2 -2
  14. package/components/Details/Details.tsx +1 -1
  15. package/components/Dialog/Dialog.tsx +32 -5
  16. package/components/Donut/Donut.module.css +1 -1
  17. package/components/Donut/Donut.tsx +8 -1
  18. package/components/Dot/Dot.tsx +1 -1
  19. package/components/Dropdown/Dropdown.tsx +46 -19
  20. package/components/Fieldset/Fieldset.tsx +1 -1
  21. package/components/Flex/Flex.tsx +7 -6
  22. package/components/Flex/Flex.types.ts +2 -2
  23. package/components/Grid/Grid.tsx +7 -3
  24. package/components/Heading/Heading.tsx +15 -10
  25. package/components/Heading/components/H0/H0.tsx +1 -1
  26. package/components/Icon/Icon.tsx +1 -1
  27. package/components/Input/Input.tsx +13 -3
  28. package/components/Layout/components/LayoutAside/LayoutAside.tsx +1 -1
  29. package/components/Layout/components/LayoutAside/components/LayoutAsideContent/LayoutAsideContent.tsx +1 -1
  30. package/components/Layout/components/LayoutAside/components/LayoutAsideFooter/LayoutAsideFooter.tsx +1 -1
  31. package/components/Layout/components/LayoutAside/components/LayoutAsideToggle/LayoutAsideToggle.tsx +1 -1
  32. package/components/Layout/components/LayoutMain/LayoutMain.tsx +1 -1
  33. package/components/Layout/components/LayoutMain/components/LayoutMainContent/LayoutMainContent.tsx +1 -1
  34. package/components/Layout/components/LayoutNavigation/LayoutNavigation.tsx +1 -1
  35. package/components/Loading/Loading.tsx +10 -2
  36. package/components/Markdown/Markdown.meta.ts +7 -0
  37. package/components/Markdown/Markdown.tsx +15 -6
  38. package/components/Markdown/Markdown.types.ts +4 -1
  39. package/components/Markdown/Markdown.utils.spec.ts +3 -3
  40. package/components/Markdown/Markdown.utils.ts +9 -7
  41. package/components/Masonry/Masonry.meta.ts +1 -1
  42. package/components/Masonry/Masonry.tsx +2 -2
  43. package/components/Masonry/Masonry.types.ts +1 -1
  44. package/components/Menu/Menu.tsx +1 -3
  45. package/components/Menu/components/MenuCategory/MenuCategory.tsx +13 -2
  46. package/components/Menu/components/MenuFilter/MenuFilter.tsx +1 -1
  47. package/components/Menu/components/MenuItem/MenuItem.tsx +14 -1
  48. package/components/Overlay/Overlay.tsx +1 -1
  49. package/components/Pie/Pie.tsx +7 -4
  50. package/components/Pill/Pill.tsx +1 -1
  51. package/components/Placeholder/Placeholder.tsx +1 -0
  52. package/components/Progress/Progress.tsx +9 -1
  53. package/components/Radio/Radio.tsx +64 -58
  54. package/components/Segments/Segments.tsx +7 -12
  55. package/components/Segments/components/SegmentButton/SegmentButton.meta.ts +4 -0
  56. package/components/Segments/components/SegmentButton/SegmentButton.tsx +13 -16
  57. package/components/Segments/components/SegmentButton/SegmentButton.types.ts +2 -0
  58. package/components/Select/Select.tsx +5 -4
  59. package/components/Separator/components/HorizontalSeparator/HorizontalSeparator.tsx +1 -1
  60. package/components/Separator/components/VerticalSeparator/VerticalSeparator.tsx +1 -1
  61. package/{components.css → components/Setup/Setup.components.css} +2 -2
  62. package/components/Setup/Setup.meta.ts +2 -2
  63. package/components/Setup/Setup.tsx +10 -7
  64. package/components/Setup/Setup.types.ts +1 -0
  65. package/components/Shimmer/Shimmer.tsx +3 -2
  66. package/components/Slider/Slider.tsx +4 -4
  67. package/components/Spacer/Spacer.tsx +1 -1
  68. package/components/Table/Table.tsx +1 -1
  69. package/components/Tabs/Tabs.tsx +36 -12
  70. package/components/Text/Text.tsx +5 -2
  71. package/components/Textarea/Textarea.tsx +10 -5
  72. package/components/Tile/Tile.tsx +2 -9
  73. package/components/Tile/Tile.types.ts +1 -1
  74. package/components/Timestamp/Timestamp.meta.ts +5 -1
  75. package/components/Timestamp/Timestamp.tsx +3 -3
  76. package/components/Timestamp/Timestamp.types.ts +1 -1
  77. package/components/Toggle/Toggle.tsx +2 -2
  78. package/components/Tooltip/Tooltip.module.css +32 -0
  79. package/components/Tooltip/Tooltip.tsx +36 -72
  80. package/components/Tooltip/Tooltip.types.ts +1 -0
  81. package/components/Tooltip/components/TooltipContent/TooltipContent.tsx +5 -3
  82. package/components/Tooltip/components/TooltipTrigger/TooltipTrigger.tsx +10 -4
  83. package/components/shared/InputLabel/InputLabel.tsx +1 -1
  84. package/components/shared/ResultList/ResultList.meta.ts +4 -0
  85. package/components/shared/ResultList/ResultList.tsx +8 -10
  86. package/components/shared/ResultList/ResultList.types.ts +1 -0
  87. package/constants/hooks.ts +1 -1
  88. package/contexts/LayoutContext/LayoutContext.tsx +30 -20
  89. package/contexts/LayoutContext/LayoutContext.types.ts +1 -0
  90. package/hooks/useDebounce.tsx +2 -2
  91. package/hooks/useLayoutContext.tsx +1 -0
  92. package/hooks/usePrint.tsx +31 -0
  93. package/index.ts +4 -0
  94. package/package.json +20 -12
  95. package/utils/date.ts +54 -0
  96. package/utils/dayjs.ts +0 -21
  97. /package/{css → components/Setup/css}/core.colors-helpers.css +0 -0
  98. /package/{css → components/Setup/css}/core.colors.css +0 -0
  99. /package/{css → components/Setup/css}/core.scale.css +0 -0
  100. /package/{css → components/Setup/css}/core.setup.css +0 -0
  101. /package/{css → components/Setup/css}/core.typography.css +0 -0
  102. /package/{css → components/Setup/css}/feat.atomics.css +0 -0
  103. /package/{css → components/Setup/css}/feat.markdown.css +0 -0
  104. /package/{css → components/Setup/css}/feat.responsive.css +0 -0
@@ -8,4 +8,5 @@ export interface LayoutContextProps {
8
8
  onAsideClose: () => void
9
9
  onNavigationToggle: () => void
10
10
  shouldShowNavigation: boolean
11
+ windowWidth: number
11
12
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { useState, useEffect } from "react"
4
4
 
5
- export const useDebounce = (value: unknown, delay: number): unknown => {
6
- const [debouncedValue, setDebouncedValue] = useState<unknown>(value)
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(() => {
@@ -12,6 +12,7 @@ const DEFAULT_LAYOUT_CONTEXT: LayoutContextProps = {
12
12
  onAsideClose: () => {},
13
13
  onNavigationToggle: () => {},
14
14
  shouldShowNavigation: true,
15
+ windowWidth: 0,
15
16
  }
16
17
 
17
18
  export const useLayoutContext = (): LayoutContextProps => {
@@ -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.89",
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
- "markdown-it": "^14.1.0",
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
- "@typescript-eslint/eslint-plugin": "^8.54.0",
43
- "@vitejs/plugin-react": "^5.1.2",
54
+ "@vitejs/plugin-react": "^5.1.4",
44
55
  "@vitest/coverage-v8": "^4.0.18",
45
- "esbuild": "latest",
46
- "esbuild-css-modules-plugin": "latest",
47
- "eslint": "^9.39.2",
48
- "eslint-config-prettier": "^10.1.8",
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