@harnessio/ui 0.5.70 → 0.5.71

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,52 +1,55 @@
1
1
  import { G as c, H as v, u as g, a as P } from "./button-Dngz8cJe.js";
2
- import { R as T, u as h } from "./use-resize-observer-DNQ1lBLF.js";
3
- import { E, e as w, v as b, w as y, f as D, x as S, q as _, d as j, u as M } from "./index-Do23wv9r.js";
2
+ import { R as T, u as w } from "./use-resize-observer-DNQ1lBLF.js";
3
+ import { E, e as b, v as h, w as y, f as D, x as S, q as _, d as j, u as M } from "./index-Do23wv9r.js";
4
4
  import { jsx as i, jsxs as O } from "react/jsx-runtime";
5
5
  import { createContext as u, useContext as C, useState as a, useCallback as R, useMemo as k } from "react";
6
6
  import { a as q, C as z, M as B, l as G, k as H } from "./types-DuzuERyI.js";
7
- const m = u(void 0), N = ({
7
+ function L(o) {
8
+ return o != null && o.endsWith("-low") ? o.replace(/-low$/, "-std") : o;
9
+ }
10
+ const l = u(void 0), N = ({
8
11
  components: o,
9
12
  children: e
10
- }) => /* @__PURE__ */ i(m.Provider, { value: o, children: e }), A = () => {
11
- const o = C(m);
13
+ }) => /* @__PURE__ */ i(l.Provider, { value: o, children: e }), W = () => {
14
+ const o = C(l);
12
15
  if (!o) throw new Error("useComponents must be used within ComponentProvider");
13
16
  return o;
14
- }, r = u({
17
+ }, s = u({
15
18
  show: (o) => {
16
19
  }
17
20
  });
18
- function F({ children: o }) {
19
- const [e, l] = a(), [d, s] = a(!1), n = R(
21
+ function $({ children: o }) {
22
+ const [e, m] = a(), [d, r] = a(!1), n = R(
20
23
  (t) => {
21
- l(t), s(!0);
24
+ m(t), r(!0);
22
25
  },
23
- [s]
26
+ [r]
24
27
  ), p = () => {
25
28
  var t;
26
- (t = e == null ? void 0 : e.onConfirm) == null || t.call(e), s(!1);
27
- }, x = () => {
29
+ (t = e == null ? void 0 : e.onConfirm) == null || t.call(e), r(!1);
30
+ }, f = () => {
28
31
  var t;
29
- (t = e == null ? void 0 : e.onCancel) == null || t.call(e), s(!1);
30
- }, f = k(() => ({ show: n }), [n]);
31
- return /* @__PURE__ */ O(r.Provider, { value: f, children: [
32
+ (t = e == null ? void 0 : e.onCancel) == null || t.call(e), r(!1);
33
+ }, x = k(() => ({ show: n }), [n]);
34
+ return /* @__PURE__ */ O(s.Provider, { value: x, children: [
32
35
  o,
33
- /* @__PURE__ */ i(E, { ...e, onCancel: x, onConfirm: p, open: d })
36
+ /* @__PURE__ */ i(E, { ...e, onCancel: f, onConfirm: p, open: d })
34
37
  ] });
35
38
  }
36
- const I = () => {
37
- const o = C(r);
39
+ const A = () => {
40
+ const o = C(s);
38
41
  if (!o)
39
42
  throw new Error("useExitConfirm must be used within a ExitConfirmProvider");
40
43
  return o;
41
- }, W = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
44
+ }, V = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
42
45
  __proto__: null,
43
46
  ColorType: q,
44
47
  ComponentProvider: N,
45
48
  ContrastType: z,
46
- DialogOpenContext: w,
47
- DialogProvider: b,
48
- ExitConfirmContext: r,
49
- ExitConfirmProvider: F,
49
+ DialogOpenContext: b,
50
+ DialogProvider: h,
51
+ ExitConfirmContext: s,
52
+ ExitConfirmProvider: $,
50
53
  ModeType: B,
51
54
  PortalProvider: c,
52
55
  RouterContextProvider: T,
@@ -56,21 +59,23 @@ const I = () => {
56
59
  defaultTheme: G,
57
60
  getT: S,
58
61
  getThemeCSSName: H,
59
- useComponents: A,
62
+ migrateLowContrastTheme: L,
63
+ useComponents: W,
60
64
  useCustomDialogTrigger: _,
61
- useExitConfirm: I,
65
+ useExitConfirm: A,
62
66
  usePortal: g,
63
67
  useRegisterDialog: j,
64
- useRouterContext: h,
68
+ useRouterContext: w,
65
69
  useTheme: P,
66
70
  useTranslation: M
67
71
  }, Symbol.toStringTag, { value: "Module" }));
68
72
  export {
69
73
  N as C,
70
- r as E,
71
- F as a,
72
- I as b,
73
- W as i,
74
- A as u
74
+ s as E,
75
+ $ as a,
76
+ A as b,
77
+ V as i,
78
+ L as m,
79
+ W as u
75
80
  };
76
- //# sourceMappingURL=index-BvoDfbvj.js.map
81
+ //# sourceMappingURL=index-BoHdNQzo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BoHdNQzo.js","sources":["../src/context/theme/migrate-persisted-theme.ts","../src/context/component-context.tsx","../src/context/exit-confirm-context.tsx"],"sourcesContent":["import { FullTheme } from './types'\n\n/** Rewrite deprecated dimmer/low contrast themes to standard contrast. */\nexport function migrateLowContrastTheme(theme?: FullTheme): FullTheme | undefined {\n if (theme?.endsWith('-low')) {\n return theme.replace(/-low$/, '-std') as FullTheme\n }\n\n return theme\n}\n","// ComponentContext.tsx\n\nimport React, { createContext, ReactNode, RefAttributes, useContext } from 'react'\n\nimport { RbacButtonProps, RbacMoreActionsTooltipProps, RbacSplitButtonProps } from '@components/rbac'\n\ninterface ComponentContextValue {\n RbacButton: React.ComponentType<RbacButtonProps & RefAttributes<HTMLButtonElement>>\n RbacSplitButton: <T extends string>(props: RbacSplitButtonProps<T>) => JSX.Element\n RbacMoreActionsTooltip: React.ForwardRefExoticComponent<\n RbacMoreActionsTooltipProps & RefAttributes<HTMLButtonElement>\n >\n}\n\nconst ComponentContext = createContext<ComponentContextValue | undefined>(undefined)\n\nexport const ComponentProvider = ({\n components,\n children\n}: {\n components: ComponentContextValue\n children: ReactNode\n}) => {\n return <ComponentContext.Provider value={components}>{children}</ComponentContext.Provider>\n}\n\nexport const useComponents = () => {\n const ctx = useContext(ComponentContext)\n if (!ctx) throw new Error('useComponents must be used within ComponentProvider')\n return ctx\n}\n","import { createContext, useCallback, useContext, useMemo, useState } from 'react'\n\nimport { ExitConfirmDialog, ExitConfirmOptions } from '../components/dialogs/exit-confirm-dialog'\n\nexport interface ExitConfirmContextType {\n show: (options: ExitConfirmOptions) => void\n}\n\nexport const ExitConfirmContext = createContext<ExitConfirmContextType>({\n show: (_options: ExitConfirmOptions) => undefined\n})\n\nexport function ExitConfirmProvider({ children }: { children: React.ReactNode }) {\n const [confirm, setConfirm] = useState<ExitConfirmOptions>()\n const [open, setOpen] = useState(false)\n\n const show = useCallback(\n (confirmOptions?: ExitConfirmOptions) => {\n setConfirm(confirmOptions)\n setOpen(true)\n },\n [setOpen]\n )\n\n const onConfirm = () => {\n confirm?.onConfirm?.()\n setOpen(false)\n }\n\n const onCancel = () => {\n confirm?.onCancel?.()\n setOpen(false)\n }\n\n const value = useMemo(() => ({ show }), [show])\n\n return (\n <ExitConfirmContext.Provider value={value}>\n {children}\n <ExitConfirmDialog {...confirm} onCancel={onCancel} onConfirm={onConfirm} open={open} />\n </ExitConfirmContext.Provider>\n )\n}\n\nexport const useExitConfirm = () => {\n const context = useContext(ExitConfirmContext)\n if (!context) {\n throw new Error('useExitConfirm must be used within a ExitConfirmProvider')\n }\n return context\n}\n"],"names":["migrateLowContrastTheme","theme","ComponentContext","createContext","ComponentProvider","components","children","useComponents","ctx","useContext","ExitConfirmContext","_options","ExitConfirmProvider","confirm","setConfirm","useState","open","setOpen","show","useCallback","confirmOptions","onConfirm","_a","onCancel","value","useMemo","jsxs","ExitConfirmDialog","useExitConfirm","context"],"mappings":";;;;;;AAGO,SAASA,EAAwBC,GAA0C;AAC5E,SAAAA,KAAA,QAAAA,EAAO,SAAS,UACXA,EAAM,QAAQ,SAAS,MAAM,IAG/BA;AACT;ACKA,MAAMC,IAAmBC,EAAiD,MAAS,GAEtEC,IAAoB,CAAC;AAAA,EAChC,YAAAC;AAAA,EACA,UAAAC;AACF,wBAIUJ,EAAiB,UAAjB,EAA0B,OAAOG,GAAa,UAAAC,GAAS,GAGpDC,IAAgB,MAAM;AAC3B,QAAAC,IAAMC,EAAWP,CAAgB;AACvC,MAAI,CAACM,EAAW,OAAA,IAAI,MAAM,qDAAqD;AACxE,SAAAA;AACT,GCtBaE,IAAqBP,EAAsC;AAAA,EACtE,MAAM,CAACQ,MAAiC;AAAA;AAC1C,CAAC;AAEe,SAAAC,EAAoB,EAAE,UAAAN,KAA2C;AAC/E,QAAM,CAACO,GAASC,CAAU,IAAIC,EAA6B,GACrD,CAACC,GAAMC,CAAO,IAAIF,EAAS,EAAK,GAEhCG,IAAOC;AAAA,IACX,CAACC,MAAwC;AACvC,MAAAN,EAAWM,CAAc,GACzBH,EAAQ,EAAI;AAAA,IACd;AAAA,IACA,CAACA,CAAO;AAAA,EACV,GAEMI,IAAY,MAAM;;AACtB,KAAAC,IAAAT,KAAA,gBAAAA,EAAS,cAAT,QAAAS,EAAA,KAAAT,IACAI,EAAQ,EAAK;AAAA,EACf,GAEMM,IAAW,MAAM;;AACrB,KAAAD,IAAAT,KAAA,gBAAAA,EAAS,aAAT,QAAAS,EAAA,KAAAT,IACAI,EAAQ,EAAK;AAAA,EACf,GAEMO,IAAQC,EAAQ,OAAO,EAAE,MAAAP,MAAS,CAACA,CAAI,CAAC;AAE9C,SACG,gBAAAQ,EAAAhB,EAAmB,UAAnB,EAA4B,OAAAc,GAC1B,UAAA;AAAA,IAAAlB;AAAA,sBACAqB,GAAmB,EAAA,GAAGd,GAAS,UAAAU,GAAoB,WAAAF,GAAsB,MAAAL,EAAY,CAAA;AAAA,EAAA,GACxF;AAEJ;AAEO,MAAMY,IAAiB,MAAM;AAC5B,QAAAC,IAAUpB,EAAWC,CAAkB;AAC7C,MAAI,CAACmB;AACG,UAAA,IAAI,MAAM,0DAA0D;AAErE,SAAAA;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1742,6 +1742,7 @@ declare namespace context {
1742
1742
  defaultTheme,
1743
1743
  ThemeProvider,
1744
1744
  useTheme,
1745
+ migrateLowContrastTheme,
1745
1746
  TranslationProvider,
1746
1747
  useTranslation,
1747
1748
  TFunction,
@@ -1893,7 +1894,7 @@ declare interface CustomItemProps extends React.HTMLAttributes<HTMLDivElement> {
1893
1894
  children: ReactNode;
1894
1895
  }
1895
1896
 
1896
- declare const DataTable: (<TData>({ data, columns, size, variant, paginationProps, getRowClassName, onRowClick, getRowLink, disableHighlightOnHover, className, currentSorting, currentRowSelection, onSortingChange: externalOnSortingChange, enableRowSelection, onRowSelectionChange: externalOnRowSelectionChange, enableExpanding, getRowCanExpand, getRowCanSelect, getIsRowDisabled, initiallyExpandAllRows, currentExpanded, onExpandedChange: externalOnExpandedChange, renderSubComponent, getSubRows, _enableColumnResizing, getRowId, visibleColumns, columnPinning }: DataTableProps<TData>) => JSX_2.Element) & {
1897
+ declare const DataTable: (<TData>({ data, columns, size, variant, paginationProps, getRowClassName, onRowClick, getRowLink, disableHighlightOnHover, className, currentSorting, currentRowSelection, onSortingChange: externalOnSortingChange, enableRowSelection, onRowSelectionChange: externalOnRowSelectionChange, enableExpanding, getRowCanExpand, getRowCanSelect, getIsRowDisabled, initiallyExpandAllRows, currentExpanded, onExpandedChange: externalOnExpandedChange, renderSubComponent, getSubRows, _enableColumnResizing, getRowId, visibleColumns, columnPinning, manualSorting }: DataTableProps<TData>) => JSX_2.Element) & {
1897
1898
  ColumnFilter: FC<DataTableColumnFilterDropdownProps>;
1898
1899
  };
1899
1900
 
@@ -1915,6 +1916,11 @@ declare interface DataTableProps<TData> {
1915
1916
  disableHighlightOnHover?: boolean;
1916
1917
  className?: string;
1917
1918
  currentSorting?: SortingState;
1919
+ /**
1920
+ * See {@link https://tanstack.com/table/latest/docs/api/features/sorting#manualsorting React Table docs}.
1921
+ * Unless disabled, you must sort the data yourself (such as on the server side).
1922
+ */
1923
+ manualSorting?: boolean;
1918
1924
  currentRowSelection?: RowSelectionState;
1919
1925
  columnPinning?: ColumnPinningState;
1920
1926
  /**
@@ -4592,6 +4598,9 @@ declare enum MeterState {
4592
4598
  Info = 4
4593
4599
  }
4594
4600
 
4601
+ /** Rewrite deprecated dimmer/low contrast themes to standard contrast. */
4602
+ declare function migrateLowContrastTheme(theme?: FullTheme): FullTheme | undefined;
4603
+
4595
4604
  declare type ModalDialogRootProps = Pick<SheetPrimitive.DialogProps, 'open' | 'onOpenChange' | 'children'>;
4596
4605
 
4597
4606
  declare enum ModeType {
@@ -7452,6 +7461,8 @@ declare interface ThemeDialogProps {
7452
7461
  showAccentColor?: boolean;
7453
7462
  showGrayColor?: boolean;
7454
7463
  showAccessibilityThemeOptions?: boolean;
7464
+ /** Contrast levels to omit from the selector. Defaults to hiding deprecated Low/dimmer. */
7465
+ hiddenContrastOptions?: ContrastType[];
7455
7466
  /** Optional loading state indicator */
7456
7467
  isThemeLoading?: boolean;
7457
7468
  }
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as s } from "./index-DDLV5nJ6.js";
2
- import { i as e } from "./index-n21j6vWp.js";
3
- import { i as a } from "./index-BvoDfbvj.js";
2
+ import { i as e } from "./index-BdMamYc4.js";
3
+ import { i as a } from "./index-BoHdNQzo.js";
4
4
  import { i as m } from "./index-C4bDY5-3.js";
5
5
  import { i as f } from "./index-yGuTXfMI.js";
6
6
  import { i as l } from "./index-wmoXHrrC.js";