@ttoss/ui 1.31.13 → 1.31.14

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.
package/dist/esm/index.js CHANGED
@@ -185,7 +185,30 @@ var Input = /*#__PURE__*/React4.forwardRef(({
185
185
  Input.displayName = "Input";
186
186
 
187
187
  // src/components/Label.tsx
188
- import { Label } from "theme-ui";
188
+ import { Label as LabelUi } from "theme-ui";
189
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
190
+ var TOOLTIP_LABEL = "tooltip";
191
+ var Label = ({
192
+ children,
193
+ onTooltipClick,
194
+ tooltip,
195
+ ...props
196
+ }) => {
197
+ return /* @__PURE__ */jsxs5(LabelUi, {
198
+ ...props,
199
+ children: [children, tooltip && /* @__PURE__ */jsx6(Text, {
200
+ sx: {
201
+ color: "currentcolor"
202
+ },
203
+ onClick: onTooltipClick,
204
+ "aria-label": TOOLTIP_LABEL,
205
+ children: /* @__PURE__ */jsx6(Icon, {
206
+ inline: true,
207
+ icon: "info"
208
+ })
209
+ })]
210
+ });
211
+ };
189
212
 
190
213
  // src/components/Link.tsx
191
214
  import { Link } from "theme-ui";
@@ -199,14 +222,14 @@ import { Text } from "theme-ui";
199
222
  // src/components/Select.tsx
200
223
  import { Select as SelectUi } from "theme-ui";
201
224
  import React5 from "react";
202
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
225
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
203
226
  var Select = /*#__PURE__*/React5.forwardRef(({
204
227
  arrow,
205
228
  ...props
206
229
  }, ref) => {
207
- return /* @__PURE__ */jsx6(SelectUi, {
208
- arrow: /* @__PURE__ */jsxs5(Fragment2, {
209
- children: [arrow ?? /* @__PURE__ */jsx6(Text, {
230
+ return /* @__PURE__ */jsx7(SelectUi, {
231
+ arrow: /* @__PURE__ */jsxs6(Fragment2, {
232
+ children: [arrow ?? /* @__PURE__ */jsx7(Text, {
210
233
  sx: {
211
234
  marginLeft: ({
212
235
  space
@@ -217,10 +240,10 @@ var Select = /*#__PURE__*/React5.forwardRef(({
217
240
  pointerEvents: "none",
218
241
  lineHeight: 0
219
242
  },
220
- children: /* @__PURE__ */jsx6(Icon, {
243
+ children: /* @__PURE__ */jsx7(Icon, {
221
244
  icon: "picker-down"
222
245
  })
223
- }), props["aria-invalid"] === "true" && /* @__PURE__ */jsx6(Text, {
246
+ }), props["aria-invalid"] === "true" && /* @__PURE__ */jsx7(Text, {
224
247
  className: "error-icon",
225
248
  sx: {
226
249
  marginLeft: ({
@@ -232,7 +255,7 @@ var Select = /*#__PURE__*/React5.forwardRef(({
232
255
  pointerEvents: "none",
233
256
  lineHeight: 0
234
257
  },
235
- children: /* @__PURE__ */jsx6(Icon, {
258
+ children: /* @__PURE__ */jsx7(Icon, {
236
259
  icon: "error"
237
260
  })
238
261
  })]
@@ -260,7 +283,7 @@ import { Checkbox } from "theme-ui";
260
283
 
261
284
  // src/components/InfiniteLinearProgress.tsx
262
285
  import * as React6 from "react";
263
- import { jsx as jsx7 } from "react/jsx-runtime";
286
+ import { jsx as jsx8 } from "react/jsx-runtime";
264
287
  var MAX_PROGRESS = 100;
265
288
  var InfiniteLinearProgress = () => {
266
289
  const [progress, setProgress] = React6.useState(0);
@@ -285,7 +308,7 @@ var InfiniteLinearProgress = () => {
285
308
  clearInterval(timer);
286
309
  };
287
310
  }, []);
288
- return /* @__PURE__ */jsx7(Progress, {
311
+ return /* @__PURE__ */jsx8(Progress, {
289
312
  max: MAX_PROGRESS,
290
313
  value: progress,
291
314
  role: "progressbar"
@@ -299,14 +322,14 @@ import { Textarea } from "theme-ui";
299
322
  import { Container } from "theme-ui";
300
323
 
301
324
  // src/components/HelpText.tsx
302
- import { jsx as jsx8 } from "react/jsx-runtime";
325
+ import { jsx as jsx9 } from "react/jsx-runtime";
303
326
  var HelpText = ({
304
327
  disabled,
305
328
  negative,
306
329
  ...props
307
330
  }) => {
308
331
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
309
- return /* @__PURE__ */jsx8(Text, {
332
+ return /* @__PURE__ */jsx9(Text, {
310
333
  variant,
311
334
  "aria-disabled": disabled ? "true" : void 0,
312
335
  ...props
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as theme_ui from 'theme-ui';
2
- import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, SelectProps as SelectProps$1, TextProps } from 'theme-ui';
3
- export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButton, IconButtonProps, Image, ImageProps, Label, LabelProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Textarea, TextareaProps, Theme } from 'theme-ui';
2
+ import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, SelectProps as SelectProps$1, TextProps } from 'theme-ui';
3
+ export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButton, IconButtonProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Textarea, TextareaProps, Theme } from 'theme-ui';
4
4
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
5
5
  import * as React from 'react';
6
6
  import React__default from 'react';
@@ -40,6 +40,12 @@ type InputProps = InputProps$1 & {
40
40
  };
41
41
  declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
42
42
 
43
+ type LabelProps = LabelProps$1 & {
44
+ tooltip?: boolean;
45
+ onTooltipClick?: () => void;
46
+ };
47
+ declare const Label: ({ children, onTooltipClick, tooltip, ...props }: LabelProps) => JSX.Element;
48
+
43
49
  type SelectProps = SelectProps$1;
44
50
  declare const Select: React__default.ForwardRefExoticComponent<Omit<SelectProps$1, "ref"> & React__default.RefAttributes<HTMLSelectElement>>;
45
51
 
@@ -51,4 +57,4 @@ type HelpTextProps = Omit<TextProps, 'variant'> & {
51
57
  };
52
58
  declare const HelpText: ({ disabled, negative, ...props }: HelpTextProps) => JSX.Element;
53
59
 
54
- export { Badge, BadgeProps, Button, ButtonProps, HelpText, HelpTextProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Select, SelectProps, ThemeProvider, ThemeProviderProps, useTheme };
60
+ export { Badge, BadgeProps, Button, ButtonProps, HelpText, HelpTextProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Label, LabelProps, Select, SelectProps, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -55,7 +55,7 @@ __export(src_exports, {
55
55
  Image: () => import_theme_ui11.Image,
56
56
  InfiniteLinearProgress: () => InfiniteLinearProgress,
57
57
  Input: () => Input,
58
- Label: () => import_theme_ui13.Label,
58
+ Label: () => Label,
59
59
  LinearProgress: () => import_theme_ui15.Progress,
60
60
  Link: () => import_theme_ui14.Link,
61
61
  Radio: () => import_theme_ui19.Radio,
@@ -255,6 +255,29 @@ Input.displayName = "Input";
255
255
 
256
256
  // src/components/Label.tsx
257
257
  var import_theme_ui13 = require("theme-ui");
258
+ var import_jsx_runtime6 = require("react/jsx-runtime");
259
+ var TOOLTIP_LABEL = "tooltip";
260
+ var Label = ({
261
+ children,
262
+ onTooltipClick,
263
+ tooltip,
264
+ ...props
265
+ }) => {
266
+ return /* @__PURE__ */(0, import_jsx_runtime6.jsxs)(import_theme_ui13.Label, {
267
+ ...props,
268
+ children: [children, tooltip && /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui16.Text, {
269
+ sx: {
270
+ color: "currentcolor"
271
+ },
272
+ onClick: onTooltipClick,
273
+ "aria-label": TOOLTIP_LABEL,
274
+ children: /* @__PURE__ */(0, import_jsx_runtime6.jsx)(Icon, {
275
+ inline: true,
276
+ icon: "info"
277
+ })
278
+ })]
279
+ });
280
+ };
258
281
 
259
282
  // src/components/Link.tsx
260
283
  var import_theme_ui14 = require("theme-ui");
@@ -268,14 +291,14 @@ var import_theme_ui16 = require("theme-ui");
268
291
  // src/components/Select.tsx
269
292
  var import_theme_ui17 = require("theme-ui");
270
293
  var import_react4 = __toESM(require("react"));
271
- var import_jsx_runtime6 = require("react/jsx-runtime");
294
+ var import_jsx_runtime7 = require("react/jsx-runtime");
272
295
  var Select = import_react4.default.forwardRef(({
273
296
  arrow,
274
297
  ...props
275
298
  }, ref) => {
276
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui17.Select, {
277
- arrow: /* @__PURE__ */(0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, {
278
- children: [arrow ?? /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui16.Text, {
299
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui17.Select, {
300
+ arrow: /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, {
301
+ children: [arrow ?? /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
279
302
  sx: {
280
303
  marginLeft: ({
281
304
  space
@@ -286,10 +309,10 @@ var Select = import_react4.default.forwardRef(({
286
309
  pointerEvents: "none",
287
310
  lineHeight: 0
288
311
  },
289
- children: /* @__PURE__ */(0, import_jsx_runtime6.jsx)(Icon, {
312
+ children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(Icon, {
290
313
  icon: "picker-down"
291
314
  })
292
- }), props["aria-invalid"] === "true" && /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui16.Text, {
315
+ }), props["aria-invalid"] === "true" && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
293
316
  className: "error-icon",
294
317
  sx: {
295
318
  marginLeft: ({
@@ -301,7 +324,7 @@ var Select = import_react4.default.forwardRef(({
301
324
  pointerEvents: "none",
302
325
  lineHeight: 0
303
326
  },
304
- children: /* @__PURE__ */(0, import_jsx_runtime6.jsx)(Icon, {
327
+ children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(Icon, {
305
328
  icon: "error"
306
329
  })
307
330
  })]
@@ -329,7 +352,7 @@ var import_theme_ui22 = require("theme-ui");
329
352
 
330
353
  // src/components/InfiniteLinearProgress.tsx
331
354
  var React6 = __toESM(require("react"));
332
- var import_jsx_runtime7 = require("react/jsx-runtime");
355
+ var import_jsx_runtime8 = require("react/jsx-runtime");
333
356
  var MAX_PROGRESS = 100;
334
357
  var InfiniteLinearProgress = () => {
335
358
  const [progress, setProgress] = React6.useState(0);
@@ -354,7 +377,7 @@ var InfiniteLinearProgress = () => {
354
377
  clearInterval(timer);
355
378
  };
356
379
  }, []);
357
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui15.Progress, {
380
+ return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui15.Progress, {
358
381
  max: MAX_PROGRESS,
359
382
  value: progress,
360
383
  role: "progressbar"
@@ -368,14 +391,14 @@ var import_theme_ui23 = require("theme-ui");
368
391
  var import_theme_ui24 = require("theme-ui");
369
392
 
370
393
  // src/components/HelpText.tsx
371
- var import_jsx_runtime8 = require("react/jsx-runtime");
394
+ var import_jsx_runtime9 = require("react/jsx-runtime");
372
395
  var HelpText = ({
373
396
  disabled,
374
397
  negative,
375
398
  ...props
376
399
  }) => {
377
400
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
378
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui16.Text, {
401
+ return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_theme_ui16.Text, {
379
402
  variant,
380
403
  "aria-disabled": disabled ? "true" : void 0,
381
404
  ...props
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.31.13",
3
+ "version": "1.31.14",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -24,7 +24,7 @@
24
24
  "@emotion/react": "^11.10.6",
25
25
  "@iconify-icon/react": "^1.0.7",
26
26
  "@theme-ui/match-media": "^0.15.5",
27
- "@ttoss/theme": "^1.4.12",
27
+ "@ttoss/theme": "^1.4.13",
28
28
  "theme-ui": "^0.15.5"
29
29
  },
30
30
  "peerDependencies": {
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "2fda7636a4a10c1085a17df991fb3fc0ac28f816"
49
+ "gitHead": "8572bc7e98343a9780146a604b0d2f04ca4388e6"
50
50
  }
@@ -1 +1,32 @@
1
- export { Label, type LabelProps } from 'theme-ui';
1
+ import { Icon, Text } from '..';
2
+ import { type LabelProps as LabelPropsUi, Label as LabelUi } from 'theme-ui';
3
+
4
+ const TOOLTIP_LABEL = 'tooltip';
5
+
6
+ export type LabelProps = LabelPropsUi & {
7
+ tooltip?: boolean;
8
+ onTooltipClick?: () => void;
9
+ };
10
+
11
+ export const Label = ({
12
+ children,
13
+ onTooltipClick,
14
+ tooltip,
15
+ ...props
16
+ }: LabelProps) => {
17
+ return (
18
+ <LabelUi {...props}>
19
+ {children}
20
+
21
+ {tooltip && (
22
+ <Text
23
+ sx={{ color: 'currentcolor' }}
24
+ onClick={onTooltipClick}
25
+ aria-label={TOOLTIP_LABEL}
26
+ >
27
+ <Icon inline icon="info" />
28
+ </Text>
29
+ )}
30
+ </LabelUi>
31
+ );
32
+ };