@ttoss/ui 1.31.13 → 1.31.15

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,31 @@ 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
+ cursor: onTooltipClick ? "pointer" : void 0
203
+ },
204
+ onClick: onTooltipClick,
205
+ "aria-label": TOOLTIP_LABEL,
206
+ children: /* @__PURE__ */jsx6(Icon, {
207
+ inline: true,
208
+ icon: "info"
209
+ })
210
+ })]
211
+ });
212
+ };
189
213
 
190
214
  // src/components/Link.tsx
191
215
  import { Link } from "theme-ui";
@@ -199,14 +223,14 @@ import { Text } from "theme-ui";
199
223
  // src/components/Select.tsx
200
224
  import { Select as SelectUi } from "theme-ui";
201
225
  import React5 from "react";
202
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
226
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
203
227
  var Select = /*#__PURE__*/React5.forwardRef(({
204
228
  arrow,
205
229
  ...props
206
230
  }, ref) => {
207
- return /* @__PURE__ */jsx6(SelectUi, {
208
- arrow: /* @__PURE__ */jsxs5(Fragment2, {
209
- children: [arrow ?? /* @__PURE__ */jsx6(Text, {
231
+ return /* @__PURE__ */jsx7(SelectUi, {
232
+ arrow: /* @__PURE__ */jsxs6(Fragment2, {
233
+ children: [arrow ?? /* @__PURE__ */jsx7(Text, {
210
234
  sx: {
211
235
  marginLeft: ({
212
236
  space
@@ -217,10 +241,10 @@ var Select = /*#__PURE__*/React5.forwardRef(({
217
241
  pointerEvents: "none",
218
242
  lineHeight: 0
219
243
  },
220
- children: /* @__PURE__ */jsx6(Icon, {
244
+ children: /* @__PURE__ */jsx7(Icon, {
221
245
  icon: "picker-down"
222
246
  })
223
- }), props["aria-invalid"] === "true" && /* @__PURE__ */jsx6(Text, {
247
+ }), props["aria-invalid"] === "true" && /* @__PURE__ */jsx7(Text, {
224
248
  className: "error-icon",
225
249
  sx: {
226
250
  marginLeft: ({
@@ -232,7 +256,7 @@ var Select = /*#__PURE__*/React5.forwardRef(({
232
256
  pointerEvents: "none",
233
257
  lineHeight: 0
234
258
  },
235
- children: /* @__PURE__ */jsx6(Icon, {
259
+ children: /* @__PURE__ */jsx7(Icon, {
236
260
  icon: "error"
237
261
  })
238
262
  })]
@@ -260,7 +284,7 @@ import { Checkbox } from "theme-ui";
260
284
 
261
285
  // src/components/InfiniteLinearProgress.tsx
262
286
  import * as React6 from "react";
263
- import { jsx as jsx7 } from "react/jsx-runtime";
287
+ import { jsx as jsx8 } from "react/jsx-runtime";
264
288
  var MAX_PROGRESS = 100;
265
289
  var InfiniteLinearProgress = () => {
266
290
  const [progress, setProgress] = React6.useState(0);
@@ -285,7 +309,7 @@ var InfiniteLinearProgress = () => {
285
309
  clearInterval(timer);
286
310
  };
287
311
  }, []);
288
- return /* @__PURE__ */jsx7(Progress, {
312
+ return /* @__PURE__ */jsx8(Progress, {
289
313
  max: MAX_PROGRESS,
290
314
  value: progress,
291
315
  role: "progressbar"
@@ -299,14 +323,14 @@ import { Textarea } from "theme-ui";
299
323
  import { Container } from "theme-ui";
300
324
 
301
325
  // src/components/HelpText.tsx
302
- import { jsx as jsx8 } from "react/jsx-runtime";
326
+ import { jsx as jsx9 } from "react/jsx-runtime";
303
327
  var HelpText = ({
304
328
  disabled,
305
329
  negative,
306
330
  ...props
307
331
  }) => {
308
332
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
309
- return /* @__PURE__ */jsx8(Text, {
333
+ return /* @__PURE__ */jsx9(Text, {
310
334
  variant,
311
335
  "aria-disabled": disabled ? "true" : void 0,
312
336
  ...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,30 @@ 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
+ cursor: onTooltipClick ? "pointer" : void 0
272
+ },
273
+ onClick: onTooltipClick,
274
+ "aria-label": TOOLTIP_LABEL,
275
+ children: /* @__PURE__ */(0, import_jsx_runtime6.jsx)(Icon, {
276
+ inline: true,
277
+ icon: "info"
278
+ })
279
+ })]
280
+ });
281
+ };
258
282
 
259
283
  // src/components/Link.tsx
260
284
  var import_theme_ui14 = require("theme-ui");
@@ -268,14 +292,14 @@ var import_theme_ui16 = require("theme-ui");
268
292
  // src/components/Select.tsx
269
293
  var import_theme_ui17 = require("theme-ui");
270
294
  var import_react4 = __toESM(require("react"));
271
- var import_jsx_runtime6 = require("react/jsx-runtime");
295
+ var import_jsx_runtime7 = require("react/jsx-runtime");
272
296
  var Select = import_react4.default.forwardRef(({
273
297
  arrow,
274
298
  ...props
275
299
  }, 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, {
300
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui17.Select, {
301
+ arrow: /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, {
302
+ children: [arrow ?? /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
279
303
  sx: {
280
304
  marginLeft: ({
281
305
  space
@@ -286,10 +310,10 @@ var Select = import_react4.default.forwardRef(({
286
310
  pointerEvents: "none",
287
311
  lineHeight: 0
288
312
  },
289
- children: /* @__PURE__ */(0, import_jsx_runtime6.jsx)(Icon, {
313
+ children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(Icon, {
290
314
  icon: "picker-down"
291
315
  })
292
- }), props["aria-invalid"] === "true" && /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui16.Text, {
316
+ }), props["aria-invalid"] === "true" && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
293
317
  className: "error-icon",
294
318
  sx: {
295
319
  marginLeft: ({
@@ -301,7 +325,7 @@ var Select = import_react4.default.forwardRef(({
301
325
  pointerEvents: "none",
302
326
  lineHeight: 0
303
327
  },
304
- children: /* @__PURE__ */(0, import_jsx_runtime6.jsx)(Icon, {
328
+ children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(Icon, {
305
329
  icon: "error"
306
330
  })
307
331
  })]
@@ -329,7 +353,7 @@ var import_theme_ui22 = require("theme-ui");
329
353
 
330
354
  // src/components/InfiniteLinearProgress.tsx
331
355
  var React6 = __toESM(require("react"));
332
- var import_jsx_runtime7 = require("react/jsx-runtime");
356
+ var import_jsx_runtime8 = require("react/jsx-runtime");
333
357
  var MAX_PROGRESS = 100;
334
358
  var InfiniteLinearProgress = () => {
335
359
  const [progress, setProgress] = React6.useState(0);
@@ -354,7 +378,7 @@ var InfiniteLinearProgress = () => {
354
378
  clearInterval(timer);
355
379
  };
356
380
  }, []);
357
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui15.Progress, {
381
+ return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui15.Progress, {
358
382
  max: MAX_PROGRESS,
359
383
  value: progress,
360
384
  role: "progressbar"
@@ -368,14 +392,14 @@ var import_theme_ui23 = require("theme-ui");
368
392
  var import_theme_ui24 = require("theme-ui");
369
393
 
370
394
  // src/components/HelpText.tsx
371
- var import_jsx_runtime8 = require("react/jsx-runtime");
395
+ var import_jsx_runtime9 = require("react/jsx-runtime");
372
396
  var HelpText = ({
373
397
  disabled,
374
398
  negative,
375
399
  ...props
376
400
  }) => {
377
401
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
378
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui16.Text, {
402
+ return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_theme_ui16.Text, {
379
403
  variant,
380
404
  "aria-disabled": disabled ? "true" : void 0,
381
405
  ...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.15",
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": "93e161a8af481b0a74c48331c5d193566f3878dc"
50
50
  }
@@ -1 +1,35 @@
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={{
24
+ color: 'currentcolor',
25
+ cursor: onTooltipClick ? 'pointer' : undefined,
26
+ }}
27
+ onClick={onTooltipClick}
28
+ aria-label={TOOLTIP_LABEL}
29
+ >
30
+ <Icon inline icon="info" />
31
+ </Text>
32
+ )}
33
+ </LabelUi>
34
+ );
35
+ };