@heliosgraphics/ui 2.0.0-alpha.68 → 2.0.0-alpha.70

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.
@@ -18,6 +18,10 @@ export const meta: HeliosAttributeMeta<ConfirmProps> = {
18
18
  cancelText: {
19
19
  type: "string",
20
20
  },
21
+ confirmOrder: {
22
+ type: "'left' | 'right'",
23
+ isOptional: true,
24
+ },
21
25
  confirmText: {
22
26
  type: "string",
23
27
  },
@@ -1,10 +1,11 @@
1
1
  import { Button, ButtonGroup, Dialog, Flex, Text } from "../.."
2
2
  import type { ConfirmProps } from "./Confirm.types"
3
- import type { FC } from "react"
3
+ import type { FC, ReactNode } from "react"
4
4
 
5
5
  export const Confirm: FC<ConfirmProps> = ({
6
- buttonGroupAlign,
6
+ buttonGroupAlign = "right",
7
7
  cancelText,
8
+ confirmOrder = "right",
8
9
  confirmText,
9
10
  description,
10
11
  icon,
@@ -14,13 +15,18 @@ export const Confirm: FC<ConfirmProps> = ({
14
15
  onConfirm,
15
16
  title,
16
17
  }) => {
18
+ const confirmButton: ReactNode = (
19
+ <Button intent={intent} value={confirmText} onClick={onConfirm} {...(icon && { icon })} />
20
+ )
21
+
17
22
  return (
18
23
  <Dialog title={title} onClose={onCancel} isOpen={isOpen} isCentered={true}>
19
24
  <Flex gap={12} isColumn={true}>
20
25
  {!!description && <Text type="paragraph">{description}</Text>}
21
26
  <ButtonGroup align={buttonGroupAlign}>
22
- <Button intent={intent} value={confirmText} onClick={onConfirm} {...(icon && { icon })} />
27
+ {confirmOrder === "left" && confirmButton}
23
28
  <Button intent="neutral" value={cancelText} onClick={onCancel} />
29
+ {confirmOrder === "right" && confirmButton}
24
30
  </ButtonGroup>
25
31
  </Flex>
26
32
  </Dialog>
@@ -3,6 +3,7 @@ import type { ButtonGroupProps, HeliosIconType, HeliosIntentionType } from "../.
3
3
  export interface ConfirmProps {
4
4
  cancelText: string
5
5
  confirmText: string
6
+ confirmOrder?: "left" | "right"
6
7
  buttonGroupAlign?: ButtonGroupProps["align"]
7
8
  description?: string
8
9
  icon?: HeliosIconType
@@ -37,7 +37,7 @@ export const meta: HeliosAttributeMeta<FlexBaseProps> = {
37
37
  paddingX: { type: "HeliosScale", isOptional: true },
38
38
  paddingY: { type: "HeliosScale", isOptional: true },
39
39
  ref: { type: "RefObject<HTMLDivElement>", isOptional: true },
40
- withBackground: { type: "boolean", isOptional: true },
40
+ withBackground: { type: "HeliosEmphasisType", isOptional: true },
41
41
  withRadius: { type: "ResponsiveRadiusType", isOptional: true },
42
42
  xAlign: { type: '"start" | "end" | "center"', isOptional: true },
43
43
  yAlign: { type: '"start" | "end" | "baseline"', isOptional: true },
@@ -1,5 +1,5 @@
1
1
  import type { HTMLAttributes, MouseEventHandler, PropsWithChildren, ForwardedRef } from "react"
2
- import type { HeliosScaleType, HeliosRadiusType } from "../.."
2
+ import type { HeliosScaleType, HeliosRadiusType, HeliosEmphasisType } from "../.."
3
3
 
4
4
  export type ResponsiveScaleType = HeliosScaleType | [HeliosScaleType, HeliosScaleType, HeliosScaleType]
5
5
  export type ResponsiveRadiusType = HeliosRadiusType | [HeliosRadiusType, HeliosRadiusType, HeliosRadiusType]
@@ -25,7 +25,7 @@ export interface FlexBaseProps {
25
25
  paddingX?: HeliosScaleType
26
26
  paddingY?: HeliosScaleType
27
27
  ref?: ForwardedRef<HTMLDivElement>
28
- withBackground?: boolean
28
+ withBackground?: HeliosEmphasisType
29
29
  withRadius?: ResponsiveRadiusType
30
30
  xAlign?: "start" | "end" | "center"
31
31
  yAlign?: "start" | "end" | "baseline"
@@ -29,12 +29,12 @@ describe("getFlexUtility", () => {
29
29
  it("Generates empty flex without attrs", () => expect(getFlexUtility(MOCK_FLEX)).toEqual(MOCK_FLEX_CLASSES))
30
30
  it("Generates empty flex with undefined", () => expect(getFlexUtility(undefined)).toEqual(MOCK_FLEX_CLASSES))
31
31
 
32
- const MOCK_FLEX_DUPLICATE_CLASSES = `flex flex-center ui-bg`
32
+ const MOCK_FLEX_DUPLICATE_CLASSES = `flex flex-center ui-bg-primary`
33
33
  const MOCK_FLEX_DUPLICATE: FlexProps = {
34
34
  children: null,
35
35
  isCentered: true,
36
36
  className: "flex",
37
- withBackground: true,
37
+ withBackground: "primary",
38
38
  }
39
39
 
40
40
  it("Generates without duplicated classes", () =>
@@ -47,7 +47,9 @@ export const getFlexUtility = (props?: FlexProps): string => {
47
47
  if (props.paddingX) flexClasses.add(`px-${props.paddingX}`)
48
48
 
49
49
  if (props.className) flexClasses.add(props.className)
50
- if (props.withBackground) flexClasses.add("ui-bg")
50
+ if (props.withBackground === "primary") flexClasses.add("ui-bg-primary")
51
+ if (props.withBackground === "secondary") flexClasses.add("ui-bg-secondary")
52
+ if (props.withBackground === "tertiary") flexClasses.add("ui-bg-tertiary")
51
53
 
52
54
  return Array.from(flexClasses).join(" ")
53
55
  }
@@ -2,6 +2,7 @@ import type { FC, ReactElement, PropsWithChildren } from "react"
2
2
  import type { LayoutAsideComposition } from "./components/LayoutAside/LayoutAside.types"
3
3
  import type { LayoutMainComposition } from "./components/LayoutMain/LayoutMain.types"
4
4
  import type { LayoutNavigationProps } from "./components/LayoutNavigation/LayoutNavigation.types"
5
+ import type { LayoutSubNavigationProps } from "./components/LayoutSubNavigation/LayoutSubNavigation.types"
5
6
 
6
7
  export type LayoutBaseProps = {
7
8
  isFullHeight?: boolean
@@ -14,4 +15,5 @@ export interface LayoutComposition {
14
15
  Aside: LayoutAsideComposition
15
16
  Main: LayoutMainComposition
16
17
  Navigation: FC<LayoutNavigationProps>
18
+ SubNavigation: FC<LayoutSubNavigationProps>
17
19
  }
@@ -8,3 +8,8 @@
8
8
  height: calc(100dvh - 64px);
9
9
  margin-top: 64px;
10
10
  }
11
+
12
+ .layoutMain:has(nav[data-ui-component="Layout.Navigation"]):has(nav[data-ui-component="Layout.SubNavigation"]) {
13
+ height: calc(100dvh - 120px);
14
+ margin-top: 120px;
15
+ }
@@ -8,6 +8,5 @@
8
8
  width: -webkit-fill-available;
9
9
  width: stretch;
10
10
 
11
- border-right: 1px solid var(--ui-border-secondary);
12
11
  border-bottom: 1px solid var(--ui-border-secondary);
13
12
  }
@@ -0,0 +1,15 @@
1
+ import type { HeliosAttributeMeta } from "../../../.."
2
+ import type { LayoutSubNavigationBaseProps } from "./LayoutSubNavigation.types"
3
+
4
+ export const meta: HeliosAttributeMeta<LayoutSubNavigationBaseProps> = {
5
+ _patterns: [
6
+ {
7
+ id: "ui-layout-sub-navigation-default",
8
+ description: "default",
9
+ content: `<Layout.SubNavigation>{CHILDREN}</Layout.SubNavigation>`,
10
+ },
11
+ ],
12
+ _status: "internal",
13
+ _category: "layout",
14
+ _extends: ["FlexProps"],
15
+ }
@@ -0,0 +1,12 @@
1
+ .layoutNavigation {
2
+ position: fixed;
3
+ top: 64px;
4
+ z-index: var(--z-index-5);
5
+
6
+ height: 56px;
7
+ width: -moz-available;
8
+ width: -webkit-fill-available;
9
+ width: stretch;
10
+
11
+ border-bottom: 1px solid var(--ui-border-secondary);
12
+ }
@@ -0,0 +1,22 @@
1
+ import { getFlexUtility, getSafeFlexProps } from "../../../Flex/Flex.utils"
2
+ import { getClasses } from "@heliosgraphics/utils"
3
+ import styles from "./LayoutSubNavigation.module.css"
4
+ import type { FC } from "react"
5
+ import type { LayoutSubNavigationProps } from "./LayoutSubNavigation.types"
6
+
7
+ export const LayoutSubNavigation: FC<LayoutSubNavigationProps> = (props) => {
8
+ const mainNavigationFlexClasses: string = getFlexUtility({
9
+ ...props,
10
+ isYCentered: props.isYCentered ?? true,
11
+ paddingX: props.paddingX ?? 8,
12
+ })
13
+
14
+ const navigationClasses: string = getClasses(mainNavigationFlexClasses, styles.layoutNavigation)
15
+ const safeProps = getSafeFlexProps(props)
16
+
17
+ return (
18
+ <nav {...safeProps} className={navigationClasses} data-ui-component="Layout.SubNavigation">
19
+ {props.children}
20
+ </nav>
21
+ )
22
+ }
@@ -0,0 +1,5 @@
1
+ import type { FlexProps } from "../../../.."
2
+
3
+ export interface LayoutSubNavigationBaseProps {}
4
+
5
+ export type LayoutSubNavigationProps = FlexProps & LayoutSubNavigationBaseProps
@@ -0,0 +1 @@
1
+ export { LayoutSubNavigation } from "./LayoutSubNavigation"
@@ -2,6 +2,7 @@ import type { LayoutComposition } from "./Layout.types"
2
2
  import { LayoutAside } from "./components/LayoutAside"
3
3
  import { LayoutMain } from "./components/LayoutMain"
4
4
  import { LayoutNavigation } from "./components/LayoutNavigation/LayoutNavigation"
5
+ import { LayoutSubNavigation } from "./components/LayoutSubNavigation"
5
6
  import { Layout as LC } from "./Layout"
6
7
  import type { LayoutAsideComposition } from "./components/LayoutAside/LayoutAside.types"
7
8
  import type { LayoutMainComposition } from "./components/LayoutMain/LayoutMain.types"
@@ -11,5 +12,6 @@ const LayoutComponent = LC as LayoutComposition
11
12
  LayoutComponent.Aside = LayoutAside as LayoutAsideComposition
12
13
  LayoutComponent.Main = LayoutMain as LayoutMainComposition
13
14
  LayoutComponent.Navigation = LayoutNavigation
15
+ LayoutComponent.SubNavigation = LayoutSubNavigation
14
16
 
15
17
  export { LayoutComponent as Layout }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heliosgraphics/ui",
3
- "version": "2.0.0-alpha.68",
3
+ "version": "2.0.0-alpha.70",
4
4
  "type": "module",
5
5
  "author": "Chris Puska <chris@puska.org>",
6
6
  "private": false,