skillgrid 0.0.41 → 0.0.42-dev-43812.1262745

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,6 +1,7 @@
1
- import { ButtonProps, BackButtonProps } from './Button.type';
1
+ import { ButtonProps, BackButtonProps, LinkButtonProps } from './Button.type';
2
2
  export declare const Button: import('react').ForwardRefExoticComponent<(ButtonProps & {
3
3
  style?: React.CSSProperties;
4
4
  }) & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
5
5
  Back: import('react').ForwardRefExoticComponent<BackButtonProps & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
6
+ Link: import('react').ForwardRefExoticComponent<LinkButtonProps & import('react').RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
6
7
  };
@@ -85,51 +85,24 @@ type ButtonBaseProps = BaseProps & {
85
85
  */
86
86
  iconLeft?: React.ReactNode;
87
87
  };
88
- /**
89
- * Base properties common to all link variants
90
- */
91
- type LinkBaseProps = BaseProps & LinkStyleProps & {
92
- /**
93
- * Display variant
94
- */
95
- displayAs: 'link';
96
- /**
97
- * Underline setting (only for displayAs='link')
98
- * @default false
99
- */
100
- showUnderline?: boolean;
101
- /**
102
- * Button icon (right side, only for links)
103
- */
104
- iconRight?: React.ReactNode;
105
- postfix?: never;
106
- subcaption?: never;
107
- loading?: never;
108
- stretched?: never;
109
- };
110
88
  type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
111
89
  /**
112
- * Button style type
90
+ * Button style type (gray is not available for this variant)
113
91
  * @default 'neutral'
114
92
  */
115
- buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast' | 'gray';
93
+ buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast';
116
94
  /**
117
- * Button variant - primary mode supports all buttonStyle options including gray
95
+ * Button variant - supports both primary and secondary modes
118
96
  * @default 'primary'
119
97
  */
120
- mode?: 'primary';
98
+ mode?: 'primary' | 'secondary';
121
99
  /**
122
100
  * Button size
123
101
  * @default 'm'
124
102
  */
125
103
  size?: ButtonSize;
126
104
  /**
127
- * Display variant
128
- * @default 'button'
129
- */
130
- displayAs?: 'button';
131
- /**
132
- * Button postfix (only for displayAs='button')
105
+ * Button postfix
133
106
  */
134
107
  postfix?: React.ReactNode;
135
108
  /**
@@ -156,27 +129,24 @@ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
156
129
  paddings?: never;
157
130
  } & ButtonSizeAndSubcaption) | (Omit<ButtonBaseProps, 'mode'> & {
158
131
  /**
159
- * Button style type (gray is not available for secondary/tertiary)
132
+ * Button style type - supports union types including 'gray'
133
+ * When 'gray' is used, mode must be 'primary' only
160
134
  * @default 'neutral'
161
135
  */
162
- buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast';
136
+ buttonStyle?: 'neutral' | 'accent' | 'positive' | 'negative' | 'contrast' | 'gray';
163
137
  /**
164
- * Button variant
138
+ * Button variant - when buttonStyle includes 'gray', only 'primary' is allowed
139
+ * For other buttonStyle values, both 'primary' and 'secondary' are allowed
165
140
  * @default 'primary'
166
141
  */
167
- mode?: 'secondary';
142
+ mode?: 'primary' | 'secondary';
168
143
  /**
169
144
  * Button size
170
145
  * @default 'm'
171
146
  */
172
147
  size?: ButtonSize;
173
148
  /**
174
- * Display variant
175
- * @default 'button'
176
- */
177
- displayAs?: 'button';
178
- /**
179
- * Button postfix (only for displayAs='button')
149
+ * Button postfix
180
150
  */
181
151
  postfix?: React.ReactNode;
182
152
  /**
@@ -218,12 +188,7 @@ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
218
188
  */
219
189
  size?: ButtonSize;
220
190
  /**
221
- * Display variant
222
- * @default 'button'
223
- */
224
- displayAs?: 'button';
225
- /**
226
- * Button postfix (only for displayAs='button')
191
+ * Button postfix
227
192
  */
228
193
  postfix?: React.ReactNode;
229
194
  /**
@@ -252,7 +217,7 @@ type CommonProps = (Omit<ButtonBaseProps, 'mode'> & {
252
217
  paddings?: boolean;
253
218
  iconRight?: never;
254
219
  showUnderline?: never;
255
- } & ButtonSizeAndSubcaption) | (LinkBaseProps & LinkIconVariant);
220
+ } & ButtonSizeAndSubcaption);
256
221
  /**
257
222
  * Props when rendered as a native HTMLButtonElement (default behaviour).
258
223
  */
@@ -272,28 +237,17 @@ export type ButtonAsAnchorProps = CommonProps & React.AnchorHTMLAttributes<HTMLA
272
237
  };
273
238
  /**
274
239
  * Discriminated union tying `href` and `onClick` types to the `as` prop.
240
+ * Properties unavailable for regular Button (iconRight, showUnderline) are excluded from autocomplete.
275
241
  */
276
- export type ButtonProps = ButtonAsNativeButtonProps | ButtonAsAnchorProps;
242
+ export type ButtonProps = Omit<ButtonAsNativeButtonProps, 'iconRight' | 'showUnderline'> | Omit<ButtonAsAnchorProps, 'iconRight' | 'showUnderline'>;
277
243
  /**
278
244
  * Runtime type guard that checks if the provided props correspond to an anchor variant of the Button.
279
245
  */
280
- export declare const isAsLink: (props: ButtonProps) => props is ButtonAsAnchorProps;
246
+ export declare const isAsLink: (props: ButtonProps) => props is Omit<ButtonAsAnchorProps, "iconRight" | "showUnderline">;
281
247
  /**
282
248
  * Runtime type guard that checks if the provided props correspond to a native button variant.
283
249
  */
284
- export declare const isAsButton: (props: ButtonProps) => props is ButtonAsNativeButtonProps;
285
- /**
286
- * Runtime type guard that checks if the component should be displayed as a button.
287
- */
288
- export declare const isDisplayAsButton: (props: ButtonProps) => props is Extract<ButtonProps, {
289
- displayAs?: "button";
290
- }>;
291
- /**
292
- * Runtime type guard that checks if the component should be displayed as a link.
293
- */
294
- export declare const isDisplayAsLink: (props: ButtonProps) => props is Extract<ButtonProps, {
295
- displayAs: "link";
296
- }>;
250
+ export declare const isAsButton: (props: ButtonProps) => props is Omit<ButtonAsNativeButtonProps, "iconRight" | "showUnderline">;
297
251
  /**
298
252
  * Enforces that subcaption can be provided only when size is 'l'.
299
253
  * - If subcaption is present → size must be 'l'
@@ -306,8 +260,38 @@ type ButtonSizeAndSubcaption = {
306
260
  subcaption: React.ReactNode;
307
261
  size: 'l';
308
262
  };
263
+ /**
264
+ * Props for Button.Link component - specialized variant for link display.
265
+ * Properties unavailable for Button.Link (loading, stretched, postfix, subcaption, paddings) are excluded from autocomplete.
266
+ */
267
+ export type LinkButtonProps = Omit<BaseProps & LinkStyleProps & LinkIconVariant & {
268
+ /**
269
+ * Underline setting
270
+ * @default false
271
+ */
272
+ showUnderline?: boolean;
273
+ /**
274
+ * Render as native button element
275
+ */
276
+ as?: 'button';
277
+ } & React.ButtonHTMLAttributes<HTMLButtonElement>, 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'paddings'> | Omit<BaseProps & LinkStyleProps & LinkIconVariant & {
278
+ /**
279
+ * Underline setting
280
+ * @default false
281
+ */
282
+ showUnderline?: boolean;
283
+ /**
284
+ * Render as anchor element
285
+ */
286
+ as: 'a';
287
+ /**
288
+ * External link default. If target/rel are not provided, sets target="_blank"
289
+ * and adds rel="noopener noreferrer". Explicit target/rel take precedence.
290
+ */
291
+ isExternal?: boolean;
292
+ } & React.AnchorHTMLAttributes<HTMLAnchorElement>, 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'paddings'>;
309
293
  /**
310
294
  * Props for Button.Back component - based on ButtonProps with restricted design props
311
295
  */
312
- export type BackButtonProps = Omit<ButtonAsNativeButtonProps, 'mode' | 'buttonStyle' | 'size' | 'displayAs' | 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'iconRight' | 'showUnderline'> | Omit<ButtonAsAnchorProps, 'mode' | 'buttonStyle' | 'size' | 'displayAs' | 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'iconRight' | 'showUnderline'>;
296
+ export type BackButtonProps = Omit<ButtonAsNativeButtonProps, 'mode' | 'buttonStyle' | 'size' | 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'iconRight' | 'showUnderline'> | Omit<ButtonAsAnchorProps, 'mode' | 'buttonStyle' | 'size' | 'loading' | 'stretched' | 'postfix' | 'subcaption' | 'iconRight' | 'showUnderline'>;
313
297
  export {};
@@ -1,2 +1,2 @@
1
1
  export { Button } from './Button';
2
- export type { ButtonProps } from './Button.type';
2
+ export type { ButtonProps, BackButtonProps, LinkButtonProps } from './Button.type';
@@ -12,10 +12,7 @@ export type TooltipContentClassNames = {
12
12
  text?: string;
13
13
  closeButton?: string;
14
14
  };
15
- type TooltipNativeButton = Extract<ButtonAsNativeButtonProps, {
16
- displayAs?: 'button';
17
- }>;
18
- export type TooltipButtonConfig = TooltipNativeButton & {
15
+ export type TooltipButtonConfig = ButtonAsNativeButtonProps & {
19
16
  closeOnClick?: boolean;
20
17
  };
21
18
  export interface TooltipCommonProps {