@heliosgraphics/ui 2.0.0-alpha.99 → 2.0.1-alpha.1

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.
@@ -1,7 +1,7 @@
1
1
  import type { ChangeEventHandler } from "react"
2
2
  import type { HeliosColorType } from "../../types/colors"
3
3
 
4
- export interface BaseCheckboxProps {
4
+ export interface CheckboxBaseProps {
5
5
  color?: HeliosColorType
6
6
  description?: string
7
7
  isChecked?: boolean
@@ -14,4 +14,4 @@ export interface BaseCheckboxProps {
14
14
  onChange?: ChangeEventHandler<HTMLInputElement>
15
15
  }
16
16
 
17
- export interface CheckboxProps extends BaseCheckboxProps {}
17
+ export interface CheckboxProps extends CheckboxBaseProps {}
@@ -1,7 +1,7 @@
1
1
  import type { LayoutAsideComposition } from "./LayoutAside.types"
2
- import { LayoutAsideContent } from "./components/LayoutAsideContent/LayoutAsideContent"
3
- import { LayoutAsideFooter } from "./components/LayoutAsideFooter/LayoutAsideFooter"
4
- import { LayoutAsideToggle } from "./components/LayoutAsideToggle/LayoutAsideToggle"
2
+ import { LayoutAsideContent } from "./components/LayoutAsideContent"
3
+ import { LayoutAsideFooter } from "./components/LayoutAsideFooter"
4
+ import { LayoutAsideToggle } from "./components/LayoutAsideToggle"
5
5
  import { LayoutAside as LAC } from "./LayoutAside"
6
6
 
7
7
  const LayoutAsideComponent = LAC as LayoutAsideComposition
@@ -1,5 +1,5 @@
1
1
  import type { LayoutMainComposition } from "./LayoutMain.types"
2
- import { LayoutMainContent } from "./components/LayoutMainContent/LayoutMainContent"
2
+ import { LayoutMainContent } from "./components/LayoutMainContent"
3
3
  import { LayoutMain as SC } from "./LayoutMain"
4
4
 
5
5
  const LayoutMainComponent = SC as LayoutMainComposition
@@ -1,7 +1,7 @@
1
1
  import type { LayoutComposition } from "./Layout.types"
2
2
  import { LayoutAside } from "./components/LayoutAside"
3
3
  import { LayoutMain } from "./components/LayoutMain"
4
- import { LayoutNavigation } from "./components/LayoutNavigation/LayoutNavigation"
4
+ import { LayoutNavigation } from "./components/LayoutNavigation"
5
5
  import { LayoutSubNavigation } from "./components/LayoutSubNavigation"
6
6
  import { Layout as LC } from "./Layout"
7
7
  import type { LayoutAsideComposition } from "./components/LayoutAside/LayoutAside.types"
@@ -1,4 +1,4 @@
1
- import { renderMarkdown } from "./Markdown.utils"
1
+ import { renderMarkdown } from "../../utils/markdown"
2
2
  import { getClasses } from "@heliosgraphics/utils"
3
3
  import styles from "./Markdown.module.css"
4
4
  import type { FC } from "react"
@@ -1,7 +1,7 @@
1
1
  import type { MenuComposition } from "./Menu.types"
2
- import { MenuCategory } from "./components/MenuCategory/MenuCategory"
3
- import { MenuFilter } from "./components/MenuFilter/MenuFilter"
4
- import { MenuItem } from "./components/MenuItem/MenuItem"
2
+ import { MenuCategory } from "./components/MenuCategory"
3
+ import { MenuFilter } from "./components/MenuFilter"
4
+ import { MenuItem } from "./components/MenuItem"
5
5
  import { Menu as SC } from "./Menu"
6
6
 
7
7
  const MenuComponent = SC as MenuComposition
@@ -1,7 +1,7 @@
1
1
  import type { HeliosAttributeMeta } from "../../types/meta"
2
- import type { BaseRadioProps } from "./Radio.types"
2
+ import type { RadioBaseProps } from "./Radio.types"
3
3
 
4
- export const meta: HeliosAttributeMeta<BaseRadioProps> = {
4
+ export const meta: HeliosAttributeMeta<RadioBaseProps> = {
5
5
  _patterns: [
6
6
  {
7
7
  id: "ui-radio-default",
@@ -11,7 +11,7 @@ export const meta: HeliosAttributeMeta<BaseRadioProps> = {
11
11
  ],
12
12
  _status: "nominal",
13
13
  _category: "core",
14
- _extends: ["BaseCheckboxProps"],
14
+ _extends: ["CheckboxBaseProps"],
15
15
  name: {
16
16
  type: "string",
17
17
  },
@@ -1,8 +1,8 @@
1
- import type { BaseCheckboxProps } from "../Checkbox/Checkbox.types"
1
+ import type { CheckboxBaseProps } from "../Checkbox/Checkbox.types"
2
2
 
3
- export interface BaseRadioProps {
3
+ export interface RadioBaseProps {
4
4
  name: string
5
5
  value: string
6
6
  }
7
7
 
8
- export type RadioProps = BaseRadioProps & BaseCheckboxProps
8
+ export type RadioProps = RadioBaseProps & CheckboxBaseProps
@@ -32,12 +32,12 @@ export const Segments: FC<SegmentsProps> = ({ children, isFullWidth, isSmall, de
32
32
  }, [activeValue])
33
33
 
34
34
  useEffect(() => {
35
- const timer: ReturnType<typeof setTimeout> = setTimeout(updateSliderPosition, 0)
35
+ const frameId: number = requestAnimationFrame(updateSliderPosition)
36
36
 
37
37
  globalThis.addEventListener("resize", updateSliderPosition)
38
38
 
39
39
  return (): void => {
40
- globalThis.clearTimeout(timer)
40
+ cancelAnimationFrame(frameId)
41
41
  globalThis.removeEventListener("resize", updateSliderPosition)
42
42
  }
43
43
  }, [updateSliderPosition])
@@ -4,7 +4,7 @@ import styles from "./SegmentButton.module.css"
4
4
  import { getClasses } from "@heliosgraphics/utils"
5
5
  import { Icon } from "../../../Icon"
6
6
  import { useSegments } from "../../Segments.utils"
7
- import { useCallback, type FC } from "react"
7
+ import { useCallback, useEffect, type FC } from "react"
8
8
  import type { HeliosIconType } from "../../../../types/icons"
9
9
  import type { SegmentButtonProps } from "./SegmentButton.types"
10
10
 
@@ -19,6 +19,12 @@ export const SegmentButton: FC<SegmentButtonProps> = ({
19
19
  const { activeValue, onSelect, registerRef } = useSegments()
20
20
  const isActive: boolean = isActiveProp ?? value === activeValue
21
21
 
22
+ useEffect(() => {
23
+ if (isActiveProp) {
24
+ onSelect(value)
25
+ }
26
+ }, [isActiveProp, value, onSelect])
27
+
22
28
  const segmentButtonClasses: string = getClasses(styles.segmentButton, {
23
29
  [styles.segmentButtonActive]: isActive,
24
30
  })
@@ -1,5 +1,5 @@
1
1
  import type { SegmentsComposition } from "./Segments.types"
2
- import { SegmentButton } from "./components/SegmentButton/SegmentButton"
2
+ import { SegmentButton } from "./components/SegmentButton"
3
3
  import { Segments as SC } from "./Segments"
4
4
 
5
5
  const SegmentedComponent = SC as SegmentsComposition
@@ -1,7 +1,7 @@
1
1
  import type { HeliosAttributeMeta } from "../../types/meta"
2
- import type { BaseToggleProps } from "./Toggle.types"
2
+ import type { ToggleBaseProps } from "./Toggle.types"
3
3
 
4
- export const meta: HeliosAttributeMeta<BaseToggleProps> = {
4
+ export const meta: HeliosAttributeMeta<ToggleBaseProps> = {
5
5
  _patterns: [
6
6
  {
7
7
  id: "ui-toggle-default",
@@ -26,7 +26,7 @@ export const meta: HeliosAttributeMeta<BaseToggleProps> = {
26
26
  ],
27
27
  _status: "nominal",
28
28
  _category: "core",
29
- _extends: ["BaseCheckboxProps"],
29
+ _extends: ["CheckboxBaseProps"],
30
30
  intent: {
31
31
  type: "HeliosIntentionType",
32
32
  default: "neutral",
@@ -1,9 +1,9 @@
1
1
  import type { HeliosIntentionType } from "../../types/intentions"
2
- import type { BaseCheckboxProps } from "../Checkbox/Checkbox.types"
2
+ import type { CheckboxBaseProps } from "../Checkbox/Checkbox.types"
3
3
 
4
- export interface BaseToggleProps {
4
+ export interface ToggleBaseProps {
5
5
  intent?: HeliosIntentionType
6
6
  style?: "toggle" | "switch"
7
7
  }
8
8
 
9
- export type ToggleProps = BaseToggleProps & BaseCheckboxProps
9
+ export type ToggleProps = ToggleBaseProps & CheckboxBaseProps
package/index.ts CHANGED
@@ -76,6 +76,8 @@ export { usePrint } from "./hooks/usePrint"
76
76
  export { useResizeObserver } from "./hooks/useResizeObserver"
77
77
  export { useTheme } from "./hooks/useTheme"
78
78
 
79
+ export { renderMarkdown } from "./utils/markdown"
80
+
79
81
  export type { HeliosAppearanceType, HeliosColorType } from "./types/colors"
80
82
  export type { HeliosFontFamilyType } from "./types/typography"
81
83
  export type { HeliosIconType } from "./types/icons"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heliosgraphics/ui",
3
- "version": "2.0.0-alpha.99",
3
+ "version": "2.0.1-alpha.1",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "*.css",