@almadar/ui 3.5.0 → 3.5.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.
@@ -11041,38 +11041,16 @@ var init_MapView = __esm({
11041
11041
  }
11042
11042
  });
11043
11043
  function ButtonPattern({
11044
- label,
11045
- variant = "primary",
11046
- size = "md",
11047
- disabled = false,
11044
+ action,
11048
11045
  onClick,
11049
11046
  event,
11050
11047
  icon,
11051
- iconPosition = "left",
11052
- className
11048
+ iconPosition,
11049
+ ...rest
11053
11050
  }) {
11054
- const { emit } = useEventBus();
11055
- const eventName = onClick ?? event;
11056
- const handleClick = () => {
11057
- if (eventName && !disabled) {
11058
- emit(`UI:${eventName}`, {});
11059
- }
11060
- };
11061
- return /* @__PURE__ */ jsxRuntime.jsxs(
11062
- Button,
11063
- {
11064
- variant,
11065
- size,
11066
- disabled,
11067
- onClick: handleClick,
11068
- className,
11069
- children: [
11070
- icon && iconPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" }),
11071
- label,
11072
- icon && iconPosition === "right" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" })
11073
- ]
11074
- }
11075
- );
11051
+ const resolvedAction = action ?? onClick ?? event;
11052
+ const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
11053
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
11076
11054
  }
11077
11055
  function TextPattern({
11078
11056
  content,
package/dist/avl/index.js CHANGED
@@ -10995,38 +10995,16 @@ var init_MapView = __esm({
10995
10995
  }
10996
10996
  });
10997
10997
  function ButtonPattern({
10998
- label,
10999
- variant = "primary",
11000
- size = "md",
11001
- disabled = false,
10998
+ action,
11002
10999
  onClick,
11003
11000
  event,
11004
11001
  icon,
11005
- iconPosition = "left",
11006
- className
11002
+ iconPosition,
11003
+ ...rest
11007
11004
  }) {
11008
- const { emit } = useEventBus();
11009
- const eventName = onClick ?? event;
11010
- const handleClick = () => {
11011
- if (eventName && !disabled) {
11012
- emit(`UI:${eventName}`, {});
11013
- }
11014
- };
11015
- return /* @__PURE__ */ jsxs(
11016
- Button,
11017
- {
11018
- variant,
11019
- size,
11020
- disabled,
11021
- onClick: handleClick,
11022
- className,
11023
- children: [
11024
- icon && iconPosition === "left" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }),
11025
- label,
11026
- icon && iconPosition === "right" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" })
11027
- ]
11028
- }
11029
- );
11005
+ const resolvedAction = action ?? onClick ?? event;
11006
+ const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
11007
+ return /* @__PURE__ */ jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
11030
11008
  }
11031
11009
  function TextPattern({
11032
11010
  content,
@@ -6398,38 +6398,16 @@ var init_MapView = __esm({
6398
6398
  }
6399
6399
  });
6400
6400
  function ButtonPattern({
6401
- label,
6402
- variant = "primary",
6403
- size = "md",
6404
- disabled = false,
6401
+ action,
6405
6402
  onClick,
6406
6403
  event,
6407
6404
  icon,
6408
- iconPosition = "left",
6409
- className
6405
+ iconPosition,
6406
+ ...rest
6410
6407
  }) {
6411
- const { emit } = useEventBus();
6412
- const eventName = onClick ?? event;
6413
- const handleClick = () => {
6414
- if (eventName && !disabled) {
6415
- emit(`UI:${eventName}`, {});
6416
- }
6417
- };
6418
- return /* @__PURE__ */ jsxRuntime.jsxs(
6419
- exports.Button,
6420
- {
6421
- variant,
6422
- size,
6423
- disabled,
6424
- onClick: handleClick,
6425
- className,
6426
- children: [
6427
- icon && iconPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: icon, size: "sm" }),
6428
- label,
6429
- icon && iconPosition === "right" && /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { name: icon, size: "sm" })
6430
- ]
6431
- }
6432
- );
6408
+ const resolvedAction = action ?? onClick ?? event;
6409
+ const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
6410
+ return /* @__PURE__ */ jsxRuntime.jsx(exports.Button, { ...rest, action: resolvedAction, ...iconProps });
6433
6411
  }
6434
6412
  function TextPattern({
6435
6413
  content,
@@ -6353,38 +6353,16 @@ var init_MapView = __esm({
6353
6353
  }
6354
6354
  });
6355
6355
  function ButtonPattern({
6356
- label,
6357
- variant = "primary",
6358
- size = "md",
6359
- disabled = false,
6356
+ action,
6360
6357
  onClick,
6361
6358
  event,
6362
6359
  icon,
6363
- iconPosition = "left",
6364
- className
6360
+ iconPosition,
6361
+ ...rest
6365
6362
  }) {
6366
- const { emit } = useEventBus();
6367
- const eventName = onClick ?? event;
6368
- const handleClick = () => {
6369
- if (eventName && !disabled) {
6370
- emit(`UI:${eventName}`, {});
6371
- }
6372
- };
6373
- return /* @__PURE__ */ jsxs(
6374
- Button,
6375
- {
6376
- variant,
6377
- size,
6378
- disabled,
6379
- onClick: handleClick,
6380
- className,
6381
- children: [
6382
- icon && iconPosition === "left" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }),
6383
- label,
6384
- icon && iconPosition === "right" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" })
6385
- ]
6386
- }
6387
- );
6363
+ const resolvedAction = action ?? onClick ?? event;
6364
+ const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
6365
+ return /* @__PURE__ */ jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
6388
6366
  }
6389
6367
  function TextPattern({
6390
6368
  content,
@@ -9,7 +9,8 @@
9
9
  * @packageDocumentation
10
10
  */
11
11
  import React from 'react';
12
- import { type ButtonVariant, type ButtonSize } from '../atoms/Button';
12
+ import type { EventKey, EventPayload } from '@almadar/core';
13
+ import { type ButtonProps } from '../atoms/Button';
13
14
  import { type BadgeVariant } from '../atoms/Badge';
14
15
  import { type AlertVariant } from '../molecules/Alert';
15
16
  import { type MapViewProps } from '../molecules/MapView';
@@ -22,36 +23,54 @@ interface ClosedCircuitProps {
22
23
  error?: Error | null;
23
24
  entity?: string;
24
25
  }
25
- export interface ButtonPatternProps extends ClosedCircuitProps {
26
- label: string;
27
- variant?: ButtonVariant;
28
- size?: ButtonSize;
29
- disabled?: boolean;
30
- onClick?: string;
31
- event?: string;
32
- icon?: string;
26
+ /**
27
+ * Props for {@link ButtonPattern}. A thin pass-through over the Button
28
+ * atom: accepts every Button prop plus wrapper-level aliases for the
29
+ * `.orb` schema convention (`action`/`event`/`onClick` as string
30
+ * event names, `iconPosition` for left/right icon placement).
31
+ *
32
+ * Anything not explicitly named is forwarded to `<Button>` via rest-spread,
33
+ * so a future Button prop lands automatically without needing a wrapper
34
+ * edit. This is the contract that fixes VG17: `action: EventKey` flows
35
+ * through to Button, which owns both `UI:{action}` emit AND the
36
+ * `data-testid="action-{NAME}"` attribute the verifier selects on.
37
+ */
38
+ export interface ButtonPatternProps extends Omit<ButtonProps, 'onClick'>, ClosedCircuitProps {
39
+ /** Legacy alias for {@link ButtonProps.action} (string event name). */
40
+ onClick?: EventKey;
41
+ /** Legacy alias for {@link ButtonProps.action}. */
42
+ event?: EventKey;
43
+ /** Icon placement — maps to Button's `icon` (left) or `iconRight` (right). */
33
44
  iconPosition?: 'left' | 'right';
34
- className?: string;
35
45
  }
36
46
  /**
37
- * Button pattern that emits events via the event bus.
47
+ * Button pattern thin pass-through to the Button atom.
48
+ *
49
+ * Prior to VG17 this wrapper owned a local event-bus emit and
50
+ * hand-enumerated only a narrow slice of props, silently dropping
51
+ * every prop outside that list (including the Pre-Phase `action:
52
+ * EventKey`). The atom already handles emit + data-testid via its
53
+ * `action` prop, so the wrapper simply forwards everything.
38
54
  */
39
- export declare function ButtonPattern({ label, variant, size, disabled, onClick, event, icon, iconPosition, className, }: ButtonPatternProps): React.ReactElement;
55
+ export declare function ButtonPattern({ action, onClick, event, icon, iconPosition, ...rest }: ButtonPatternProps): React.ReactElement;
40
56
  export declare namespace ButtonPattern {
41
57
  var displayName: string;
42
58
  }
43
- export interface IconButtonPatternProps extends ClosedCircuitProps {
59
+ export interface IconButtonPatternProps extends Omit<ButtonProps, 'onClick'>, ClosedCircuitProps {
44
60
  icon: string;
45
- variant?: ButtonVariant;
46
- size?: ButtonSize;
47
- onClick?: string;
48
61
  ariaLabel?: string;
49
- className?: string;
62
+ /** Legacy alias for {@link ButtonProps.action}. */
63
+ onClick?: EventKey;
64
+ /** Legacy alias for {@link ButtonProps.action}. */
65
+ event?: EventKey;
50
66
  }
51
67
  /**
52
- * Icon-only button pattern.
68
+ * Icon-only button pattern — pass-through to the Button atom with a
69
+ * mandatory icon and optional aria-label. Same VG17 fix as
70
+ * {@link ButtonPattern}: `action` forwards to the atom, which owns the
71
+ * emit + data-testid.
53
72
  */
54
- export declare function IconButtonPattern({ icon, variant, size, onClick, ariaLabel, className, }: IconButtonPatternProps): React.ReactElement;
73
+ export declare function IconButtonPattern({ action, onClick, event, icon, ariaLabel, variant, ...rest }: IconButtonPatternProps): React.ReactElement;
55
74
  export declare namespace IconButtonPattern {
56
75
  var displayName: string;
57
76
  }
@@ -59,13 +78,24 @@ export interface LinkPatternProps extends ClosedCircuitProps {
59
78
  label: string;
60
79
  href?: string;
61
80
  external?: boolean;
62
- onClick?: string;
81
+ /** Event key emitted on click (intercepts native navigation when set). */
82
+ action?: EventKey;
83
+ /** Legacy alias for action. */
84
+ onClick?: EventKey;
85
+ /** Legacy alias for action. */
86
+ event?: EventKey;
87
+ /** Payload for the dispatched event. */
88
+ actionPayload?: EventPayload;
63
89
  className?: string;
64
90
  }
65
91
  /**
66
- * Link pattern for navigation.
92
+ * Link pattern for navigation. When an event key is provided via
93
+ * `action` / `onClick` / `event`, intercepts the native `<a>`
94
+ * navigation and emits `UI:{action}` with the `href` in the payload.
95
+ * Sets `data-testid="action-{NAME}"` so the verifier's click-path
96
+ * gate can select it symmetrically with Button.
67
97
  */
68
- export declare function LinkPattern({ label, href, external, onClick, className, }: LinkPatternProps): React.ReactElement;
98
+ export declare function LinkPattern({ label, href, external, action, onClick, event, actionPayload, className, }: LinkPatternProps): React.ReactElement;
69
99
  export declare namespace LinkPattern {
70
100
  var displayName: string;
71
101
  }
@@ -8029,38 +8029,16 @@ var init_MapView = __esm({
8029
8029
  }
8030
8030
  });
8031
8031
  function ButtonPattern({
8032
- label,
8033
- variant = "primary",
8034
- size = "md",
8035
- disabled = false,
8032
+ action,
8036
8033
  onClick,
8037
8034
  event,
8038
8035
  icon,
8039
- iconPosition = "left",
8040
- className
8036
+ iconPosition,
8037
+ ...rest
8041
8038
  }) {
8042
- const { emit } = useEventBus();
8043
- const eventName = onClick ?? event;
8044
- const handleClick = () => {
8045
- if (eventName && !disabled) {
8046
- emit(`UI:${eventName}`, {});
8047
- }
8048
- };
8049
- return /* @__PURE__ */ jsxRuntime.jsxs(
8050
- Button,
8051
- {
8052
- variant,
8053
- size,
8054
- disabled,
8055
- onClick: handleClick,
8056
- className,
8057
- children: [
8058
- icon && iconPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" }),
8059
- label,
8060
- icon && iconPosition === "right" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" })
8061
- ]
8062
- }
8063
- );
8039
+ const resolvedAction = action ?? onClick ?? event;
8040
+ const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
8041
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
8064
8042
  }
8065
8043
  function TextPattern({
8066
8044
  content,
@@ -7984,38 +7984,16 @@ var init_MapView = __esm({
7984
7984
  }
7985
7985
  });
7986
7986
  function ButtonPattern({
7987
- label,
7988
- variant = "primary",
7989
- size = "md",
7990
- disabled = false,
7987
+ action,
7991
7988
  onClick,
7992
7989
  event,
7993
7990
  icon,
7994
- iconPosition = "left",
7995
- className
7991
+ iconPosition,
7992
+ ...rest
7996
7993
  }) {
7997
- const { emit } = useEventBus();
7998
- const eventName = onClick ?? event;
7999
- const handleClick = () => {
8000
- if (eventName && !disabled) {
8001
- emit(`UI:${eventName}`, {});
8002
- }
8003
- };
8004
- return /* @__PURE__ */ jsxs(
8005
- Button,
8006
- {
8007
- variant,
8008
- size,
8009
- disabled,
8010
- onClick: handleClick,
8011
- className,
8012
- children: [
8013
- icon && iconPosition === "left" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }),
8014
- label,
8015
- icon && iconPosition === "right" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" })
8016
- ]
8017
- }
8018
- );
7994
+ const resolvedAction = action ?? onClick ?? event;
7995
+ const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
7996
+ return /* @__PURE__ */ jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
8019
7997
  }
8020
7998
  function TextPattern({
8021
7999
  content,
@@ -8166,38 +8166,16 @@ var init_MapView = __esm({
8166
8166
  }
8167
8167
  });
8168
8168
  function ButtonPattern({
8169
- label,
8170
- variant = "primary",
8171
- size = "md",
8172
- disabled = false,
8169
+ action,
8173
8170
  onClick,
8174
8171
  event,
8175
8172
  icon,
8176
- iconPosition = "left",
8177
- className
8173
+ iconPosition,
8174
+ ...rest
8178
8175
  }) {
8179
- const { emit } = useEventBus();
8180
- const eventName = onClick ?? event;
8181
- const handleClick = () => {
8182
- if (eventName && !disabled) {
8183
- emit(`UI:${eventName}`, {});
8184
- }
8185
- };
8186
- return /* @__PURE__ */ jsxRuntime.jsxs(
8187
- Button,
8188
- {
8189
- variant,
8190
- size,
8191
- disabled,
8192
- onClick: handleClick,
8193
- className,
8194
- children: [
8195
- icon && iconPosition === "left" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" }),
8196
- label,
8197
- icon && iconPosition === "right" && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: icon, size: "sm" })
8198
- ]
8199
- }
8200
- );
8176
+ const resolvedAction = action ?? onClick ?? event;
8177
+ const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
8178
+ return /* @__PURE__ */ jsxRuntime.jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
8201
8179
  }
8202
8180
  function TextPattern({
8203
8181
  content,
@@ -8121,38 +8121,16 @@ var init_MapView = __esm({
8121
8121
  }
8122
8122
  });
8123
8123
  function ButtonPattern({
8124
- label,
8125
- variant = "primary",
8126
- size = "md",
8127
- disabled = false,
8124
+ action,
8128
8125
  onClick,
8129
8126
  event,
8130
8127
  icon,
8131
- iconPosition = "left",
8132
- className
8128
+ iconPosition,
8129
+ ...rest
8133
8130
  }) {
8134
- const { emit } = useEventBus();
8135
- const eventName = onClick ?? event;
8136
- const handleClick = () => {
8137
- if (eventName && !disabled) {
8138
- emit(`UI:${eventName}`, {});
8139
- }
8140
- };
8141
- return /* @__PURE__ */ jsxs(
8142
- Button,
8143
- {
8144
- variant,
8145
- size,
8146
- disabled,
8147
- onClick: handleClick,
8148
- className,
8149
- children: [
8150
- icon && iconPosition === "left" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }),
8151
- label,
8152
- icon && iconPosition === "right" && /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" })
8153
- ]
8154
- }
8155
- );
8131
+ const resolvedAction = action ?? onClick ?? event;
8132
+ const iconProps = iconPosition === "right" ? { iconRight: icon } : { icon };
8133
+ return /* @__PURE__ */ jsx(Button, { ...rest, action: resolvedAction, ...iconProps });
8156
8134
  }
8157
8135
  function TextPattern({
8158
8136
  content,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "3.5.0",
3
+ "version": "3.5.1",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/components/index.js",
@@ -152,6 +152,8 @@
152
152
  },
153
153
  "devDependencies": {
154
154
  "@almadar/eslint-plugin": ">=2.3.0",
155
+ "@react-three/drei": "^10.7.7",
156
+ "@react-three/fiber": "^9.6.0",
155
157
  "@react-three/postprocessing": "3.0.4",
156
158
  "@storybook/addon-docs": "^10.2.6",
157
159
  "@storybook/addon-links": "^10.2.6",
@@ -185,6 +187,7 @@
185
187
  "react-router-dom": "^7.13.0",
186
188
  "storybook": "^10.2.6",
187
189
  "tailwindcss": "^3.4.0",
190
+ "three": "^0.160.1",
188
191
  "tsup": "^8.0.0",
189
192
  "tsx": "^4.7.0",
190
193
  "typescript": "^5.4.0",