@akad/design-system 1.1.9 → 2.0.0

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.
@@ -2,6 +2,29 @@ import { PushClickEventOptions } from '@akad/data-owl';
2
2
  import { default as PropTypes } from 'prop-types';
3
3
  import { HTMLAttributes, ReactNode } from 'react';
4
4
 
5
+ /**
6
+ * Named keys of `PushClickEventOptions`. The data-owl base options carry a
7
+ * `[key: string]: unknown` index signature (custom properties), which makes
8
+ * `Omit`/`keyof` collapse every named key into the index signature — this
9
+ * mapped type strips it so the required fields stay required.
10
+ */
11
+ type PushClickEventKnownOptions = {
12
+ [K in keyof PushClickEventOptions as string extends K ? never : number extends K ? never : K]: PushClickEventOptions[K];
13
+ };
14
+ /**
15
+ * Tracking payload for DsButton (data-owl 2.0.0).
16
+ *
17
+ * The consumer provides the element identity (`elementName`) and the shared
18
+ * business context (`product`, `productCategory`, `squadId`, `source`,
19
+ * `handler`, `businessFlow`). The button fills in what only it knows at click
20
+ * time — `elementType`, the page context (`pagePath`/`pageTitle`/`pageUrl`/
21
+ * `pageReferrer`) and `elementText` — but any value passed here always wins
22
+ * over those defaults.
23
+ */
24
+ export type DsButtonTrackingData = Omit<PushClickEventKnownOptions, 'elementType' | 'pagePath' | 'pageTitle' | 'pageUrl' | 'pageReferrer'> & Partial<Pick<PushClickEventKnownOptions, 'elementType' | 'pagePath' | 'pageTitle' | 'pageUrl' | 'pageReferrer'>> & {
25
+ /** Any additional custom properties (converted to snake_case by data-owl). */
26
+ [key: string]: unknown;
27
+ };
5
28
  export interface DsButtonProps extends HTMLAttributes<HTMLButtonElement> {
6
29
  children: string | ReactNode;
7
30
  className?: string;
@@ -16,7 +39,7 @@ export interface DsButtonProps extends HTMLAttributes<HTMLButtonElement> {
16
39
  iconFill?: boolean;
17
40
  iconPosition?: string;
18
41
  fullSize?: boolean;
19
- trackingData?: PushClickEventOptions;
42
+ trackingData?: DsButtonTrackingData;
20
43
  }
21
44
  declare const DsButton: {
22
45
  ({ children, className, onClick, size, disabled, icon, id, testId, elevation, variant, color, iconFill, iconPosition, fullSize, trackingData, }: DsButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -31,7 +54,16 @@ declare const DsButton: {
31
54
  testId: PropTypes.Requireable<string>;
32
55
  id: PropTypes.Requireable<string>;
33
56
  fullSize: PropTypes.Requireable<boolean>;
34
- trackingData: PropTypes.Requireable<object>;
57
+ trackingData: PropTypes.Requireable<PropTypes.InferProps<{
58
+ elementName: PropTypes.Validator<string>;
59
+ elementType: PropTypes.Requireable<string>;
60
+ product: PropTypes.Validator<string>;
61
+ productCategory: PropTypes.Validator<string>;
62
+ squadId: PropTypes.Validator<string>;
63
+ source: PropTypes.Validator<string>;
64
+ handler: PropTypes.Validator<string>;
65
+ businessFlow: PropTypes.Validator<string>;
66
+ }>>;
35
67
  };
36
68
  displayName: string;
37
69
  };
@@ -1,3 +1,4 @@
1
+ import { BusinessFlow, EventHandler, EventSource, ProductCategory, Squad } from '@akad/data-owl';
1
2
  import { Meta } from '@storybook/react';
2
3
  import { DsButtonProps } from './Button';
3
4
  import { ThemeProviderProps } from '../../molecules/ThemeProvider';
@@ -15,3 +16,28 @@ export declare const Default: {
15
16
  onClick: import('@storybook/addon-actions').HandlerFunction;
16
17
  };
17
18
  };
19
+ /**
20
+ * Exemplo com tracking do data-owl 2.0.0: o consumidor passa a identidade do
21
+ * elemento e o contexto de negócio; o botão preenche `elementType`,
22
+ * `elementText` e o contexto de página no momento do clique.
23
+ */
24
+ export declare const WithTracking: {
25
+ render: import('storybook/internal/types').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, ThemeProviderProps & DsButtonProps>;
26
+ args: {
27
+ trackingData: {
28
+ elementName: string;
29
+ product: string;
30
+ productCategory: ProductCategory;
31
+ squadId: Squad;
32
+ source: EventSource;
33
+ handler: EventHandler;
34
+ businessFlow: BusinessFlow;
35
+ };
36
+ variant: import('./Button.config').ButtonVariant;
37
+ fullSize: boolean;
38
+ iconFill: boolean;
39
+ size: import('./Button.config').ButtonSize;
40
+ disabled: boolean;
41
+ onClick: import('@storybook/addon-actions').HandlerFunction;
42
+ };
43
+ };
@@ -20,6 +20,7 @@ export interface DsInputProps extends React.HTMLAttributes<HTMLDivElement> {
20
20
  hasFeedback?: boolean;
21
21
  noMargin?: boolean;
22
22
  disabled?: boolean;
23
+ autoFocus?: boolean;
23
24
  mask?: string | object;
24
25
  onChangeHandler?: (event: React.ChangeEvent<HTMLInputElement>) => void;
25
26
  onBlurHandler?: (event: React.FocusEvent<HTMLInputElement>) => void;
@@ -28,6 +28,10 @@ export interface EditableSelectAnimatedProps {
28
28
  type: BooleanConstructor;
29
29
  default: boolean;
30
30
  }
31
+ export interface EditableSelectInputAutoFocusProps {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ }
31
35
  export interface EditableSelectPlaceholderProps {
32
36
  type: StringConstructor;
33
37
  default: string;
@@ -88,6 +92,7 @@ export interface EditableSelectConfig {
88
92
  label: EditableSelectLabelProps;
89
93
  testId: EditableSelectTestIdProps;
90
94
  animated: EditableSelectAnimatedProps;
95
+ inputAutoFocus: EditableSelectInputAutoFocusProps;
91
96
  loading: EditableSelectLoadingProps;
92
97
  disabled: EditableSelectDisabledProps;
93
98
  icon: EditableSelectIconProps;
@@ -111,6 +111,7 @@ export interface DsEditableSelectProps {
111
111
  placeholder?: string;
112
112
  loading?: boolean;
113
113
  animated?: boolean;
114
+ inputAutoFocus?: boolean;
114
115
  onBlurHandler?: () => void;
115
116
  onFocusHandler?: () => void;
116
117
  showOptionsOnFocus?: boolean;
@@ -127,7 +128,7 @@ export interface DsEditableSelectProps {
127
128
  inputOnKeyDownHandler?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
128
129
  }
129
130
  declare const DsEditableSelect: {
130
- ({ label, name, testId, value, options, size, onChangeHandler, onSelectHandler, onClearHandler, icon, noOptionsMessage, disabled, status, onBlurHandler, onFocusHandler, animated, placeholder, loading, showOptionsOnFocus, inputType, inputMin, inputMax, inputTooltip, inputTooltipPosition, inputTooltipPlacement, inputFeedback, inputHasFeedback, inputNoMargin, inputMask, inputOnKeyDownHandler, }: DsEditableSelectProps): import("react/jsx-runtime").JSX.Element;
131
+ ({ label, name, testId, value, options, size, onChangeHandler, onSelectHandler, onClearHandler, icon, noOptionsMessage, disabled, status, onBlurHandler, onFocusHandler, animated, inputAutoFocus, placeholder, loading, showOptionsOnFocus, inputType, inputMin, inputMax, inputTooltip, inputTooltipPosition, inputTooltipPlacement, inputFeedback, inputHasFeedback, inputNoMargin, inputMask, inputOnKeyDownHandler, }: DsEditableSelectProps): import("react/jsx-runtime").JSX.Element;
131
132
  displayName: string;
132
133
  };
133
134
  export default DsEditableSelect;