@omer-x/tailwind-ui-kit 1.0.0-alpha.36 → 1.0.0-alpha.38

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 (42) hide show
  1. package/README.md +182 -3
  2. package/dist/components/display/BaseMeter.d.ts +60 -0
  3. package/dist/components/display/BaseMeter.js +45 -0
  4. package/dist/components/display/BaseMeterIndicator.d.ts +9 -0
  5. package/dist/components/display/BaseMeterIndicator.js +12 -0
  6. package/dist/components/display/BaseMeterLabel.d.ts +9 -0
  7. package/dist/components/display/BaseMeterLabel.js +7 -0
  8. package/dist/components/display/BaseMeterTrack.d.ts +12 -0
  9. package/dist/components/display/BaseMeterTrack.js +12 -0
  10. package/dist/components/display/BaseMeterValue.d.ts +14 -0
  11. package/dist/components/display/BaseMeterValue.js +10 -0
  12. package/dist/components/display/barStyles.d.ts +5 -0
  13. package/dist/components/display/barStyles.js +20 -0
  14. package/dist/components/display/index.d.ts +2 -1
  15. package/dist/components/display/index.js +3 -1
  16. package/dist/components/form/BaseAutocomplete.d.ts +1 -1
  17. package/dist/components/menu/BaseContextMenu.d.ts +22 -12
  18. package/dist/components/menu/BaseMenu.d.ts +171 -0
  19. package/dist/components/menu/BaseMenu.js +62 -0
  20. package/dist/components/menu/BaseMenuClear.d.ts +16 -0
  21. package/dist/components/menu/BaseMenuClear.js +10 -0
  22. package/dist/components/menu/BaseMenuEmpty.d.ts +8 -0
  23. package/dist/components/menu/BaseMenuEmpty.js +7 -0
  24. package/dist/components/menu/BaseMenuInput.d.ts +15 -0
  25. package/dist/components/menu/BaseMenuInput.js +10 -0
  26. package/dist/components/menu/BaseMenuList.d.ts +11 -0
  27. package/dist/components/menu/BaseMenuList.js +14 -0
  28. package/dist/components/menu/BaseMenuPopup.d.ts +52 -6
  29. package/dist/components/menu/BaseMenuPopup.js +6 -1
  30. package/dist/components/menu/BaseMenuSubmenu.d.ts +3 -18
  31. package/dist/components/menu/BaseMenuSubmenu.js +16 -4
  32. package/dist/components/menu/BaseMenuTrigger.d.ts +26 -0
  33. package/dist/components/menu/BaseMenuTrigger.js +11 -0
  34. package/dist/components/menu/BaseMenuViewport.d.ts +18 -0
  35. package/dist/components/menu/BaseMenuViewport.js +11 -0
  36. package/dist/components/menu/createMenuHandle.d.ts +30 -0
  37. package/dist/components/menu/createMenuHandle.js +27 -0
  38. package/dist/components/menu/index.d.ts +9 -2
  39. package/dist/components/menu/index.js +4 -1
  40. package/dist/components/menu/menuTypes.d.ts +69 -0
  41. package/dist/components/menu/menuTypes.js +16 -0
  42. package/package.json +1 -1
@@ -1,12 +1,19 @@
1
1
  import _default from "./BaseContextMenu.js";
2
+ import _default$1 from "./BaseMenu.js";
3
+ import createMenuHandle, { MenuHandle } from "./createMenuHandle.js";
4
+ import { MenuActions, MenuHighlightReason } from "./menuTypes.js";
2
5
  import { ContextMenuTriggerState } from "./BaseContextMenuTrigger.js";
6
+ import { MenuTriggerState } from "./BaseMenuTrigger.js";
3
7
  import { MenuArrowState } from "./BaseMenuArrow.js";
4
8
  import { MenuCheckboxItemState } from "./BaseMenuCheckboxItem.js";
5
9
  import { MenuItemState } from "./BaseMenuItem.js";
6
10
  import { MenuLinkItemState } from "./BaseMenuLinkItem.js";
7
- import { MenuAlign, MenuBackdropState, MenuFocusTarget, MenuInteractionType, MenuPopupState, MenuPositionerState, MenuSide } from "./BaseMenuPopup.js";
11
+ import { MenuAlign, MenuBackdropState, MenuCollisionAvoidance, MenuFocusTarget, MenuInteractionType, MenuOffsetFunction, MenuPopupState, MenuPositionerState, MenuSide } from "./BaseMenuPopup.js";
8
12
  import { MenuRadioGroupState } from "./BaseMenuRadioGroup.js";
9
13
  import { MenuRadioItemState } from "./BaseMenuRadioItem.js";
10
14
  import { MenuSeparatorState } from "./BaseMenuSeparator.js";
11
15
  import { MenuSubmenuTriggerState } from "./BaseMenuSubmenuTrigger.js";
12
- export { _default as BaseContextMenu, type ContextMenuTriggerState, type MenuAlign, type MenuArrowState, type MenuBackdropState, type MenuCheckboxItemState, type MenuFocusTarget, type MenuInteractionType, type MenuItemState, type MenuLinkItemState, type MenuPopupState, type MenuPositionerState, type MenuRadioGroupState, type MenuRadioItemState, type MenuSeparatorState, type MenuSide, type MenuSubmenuTriggerState };
16
+ import { MenuViewportState } from "./BaseMenuViewport.js";
17
+ import { MenuInputState } from "./BaseMenuInput.js";
18
+ import { MenuClearState } from "./BaseMenuClear.js";
19
+ export { _default as BaseContextMenu, _default$1 as BaseMenu, type ContextMenuTriggerState, type MenuActions, type MenuAlign, type MenuArrowState, type MenuBackdropState, type MenuCheckboxItemState, type MenuClearState, type MenuCollisionAvoidance, type MenuFocusTarget, type MenuHandle, type MenuHighlightReason, type MenuInputState, type MenuInteractionType, type MenuItemState, type MenuLinkItemState, type MenuOffsetFunction, type MenuPopupState, type MenuPositionerState, type MenuRadioGroupState, type MenuRadioItemState, type MenuSeparatorState, type MenuSide, type MenuSubmenuTriggerState, type MenuTriggerState, type MenuViewportState, createMenuHandle };
@@ -1 +1,4 @@
1
- export { default as BaseContextMenu } from "./BaseContextMenu.js";
1
+ import BaseContextMenu_default from "./BaseContextMenu.js";
2
+ import BaseMenu_default from "./BaseMenu.js";
3
+ import createMenuHandle from "./createMenuHandle.js";
4
+ export { BaseContextMenu_default as BaseContextMenu, BaseMenu_default as BaseMenu, createMenuHandle };
@@ -0,0 +1,69 @@
1
+ import { RefObject } from "react";
2
+ /** Why the highlighted item changed: arrow keys, the pointer, or anything else (filtering, opening, …). */
3
+ export type MenuHighlightReason = "keyboard" | "pointer" | "none";
4
+ /** Imperative actions, through `actionsRef`. */
5
+ export type MenuActions = {
6
+ /** Closes the menu. */
7
+ close: () => void;
8
+ };
9
+ /** Props shared by `BaseMenu` and `BaseMenu.Submenu`. */
10
+ export type MenuRootSharedProps = {
11
+ open?: boolean;
12
+ defaultOpen?: boolean;
13
+ /** Called after the open or close transition ends. */
14
+ onOpenChangeComplete?: (open: boolean) => void;
15
+ /** Wraps keyboard navigation from the last item to the first and back. @default true */
16
+ loopFocus?: boolean;
17
+ /**
18
+ * Set to `false` to stop the pointer from highlighting items, so `:hover` and `data-highlighted` can differ.
19
+ * @default true
20
+ */
21
+ highlightItemOnHover?: boolean;
22
+ /** Whether the arrow keys move up/down (`vertical`) or left/right (`horizontal`). @default "vertical" */
23
+ orientation?: "horizontal" | "vertical";
24
+ disabled?: boolean;
25
+ /** Called when an item is highlighted, or with `undefined` when none is. `label` is the item's `label` or text. */
26
+ onItemHighlighted?: (item: HTMLElement | undefined, details: {
27
+ reason: MenuHighlightReason;
28
+ label: string | undefined;
29
+ }) => void;
30
+ /** Imperative actions, e.g. `actionsRef.current?.close()`. */
31
+ actionsRef?: RefObject<MenuActions | null>;
32
+ /**
33
+ * Lets the user filter the items by typing in a `BaseMenu.Input`. Put the items in a `BaseMenu.List`.
34
+ * The `filter`, `autoHighlight`, `locale` and `query` props only apply with it.
35
+ */
36
+ filterable?: boolean;
37
+ /**
38
+ * Decides whether an item matches. Gets the item's `label` (or its text) and the trimmed query.
39
+ * Defaults to "contains", ignoring case, accents and punctuation. `null` shows every item (filter them yourself).
40
+ */
41
+ filter?: ((text: string, query: string) => boolean) | null;
42
+ /**
43
+ * Highlights the first match while the query isn't empty, or `"always"` (also when it is).
44
+ * @default false
45
+ */
46
+ autoHighlight?: boolean | "always";
47
+ /** The locale used by the default filter. Defaults to the user's locale. */
48
+ locale?: Intl.LocalesArgument;
49
+ /** The filter query, controlled. It's cleared (through `onQueryChange`) when the menu closes. */
50
+ query?: string;
51
+ /** The initial filter query, uncontrolled. */
52
+ defaultQuery?: string;
53
+ /** Called with the new query and the DOM event that changed it (none when it was changed from code). */
54
+ onQueryChange?: (query: string, event: Event | undefined) => void;
55
+ };
56
+ /** Splits the filtering props off a root's other props, in Base UI's shape. Internal: not exported to apps. */
57
+ export declare function splitFilterProps<Props extends MenuRootSharedProps>({ filterable, filter, autoHighlight, locale, query, defaultQuery, onQueryChange, ...rootProps }: Props): {
58
+ filterProps: {
59
+ filter: ((text: string, query: string) => boolean) | null | undefined;
60
+ autoHighlight: boolean | "always" | undefined;
61
+ locale: Intl.LocalesArgument;
62
+ value: string | undefined;
63
+ defaultValue: string | undefined;
64
+ onValueChange: ((value: string, details: {
65
+ event: Event | undefined;
66
+ }) => void) | undefined;
67
+ } | null;
68
+ rootProps: Omit<Props, "filter" | "autoHighlight" | "locale" | "filterable" | "query" | "defaultQuery" | "onQueryChange">;
69
+ };
@@ -0,0 +1,16 @@
1
+ // src/components/menu/menuTypes.ts
2
+ /** Splits the filtering props off a root's other props, in Base UI's shape. Internal: not exported to apps. */
3
+ function splitFilterProps({ filterable, filter, autoHighlight, locale, query, defaultQuery, onQueryChange, ...rootProps }) {
4
+ return {
5
+ filterProps: filterable ? {
6
+ filter,
7
+ autoHighlight,
8
+ locale,
9
+ value: query,
10
+ defaultValue: defaultQuery,
11
+ onValueChange: onQueryChange && ((value, details) => onQueryChange(value, details.event))
12
+ } : null,
13
+ rootProps
14
+ };
15
+ }
16
+ export { splitFilterProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omer-x/tailwind-ui-kit",
3
- "version": "1.0.0-alpha.36",
3
+ "version": "1.0.0-alpha.38",
4
4
  "description": "Tailwind CSS-based React component library for building user interfaces",
5
5
  "keywords": [
6
6
  "tailwind",