@frontify/fondue 12.0.0-beta.130 → 12.0.0-beta.131
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/components/InputLabel/InputLabel.es.js +23 -21
- package/dist/components/InputLabel/InputLabel.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,41 +1,44 @@
|
|
|
1
1
|
import { TooltipIcon as f } from "../TooltipIcon/TooltipIcon.es.js";
|
|
2
2
|
import { IconSize as k } from "../../foundation/Icon/IconSize.es.js";
|
|
3
|
-
import { merge as
|
|
3
|
+
import { merge as i } from "../../utilities/merge.es.js";
|
|
4
4
|
import t from "react";
|
|
5
5
|
const u = ({
|
|
6
6
|
children: e,
|
|
7
|
-
htmlFor:
|
|
8
|
-
required:
|
|
9
|
-
disabled:
|
|
10
|
-
clickable:
|
|
7
|
+
htmlFor: w,
|
|
8
|
+
required: n = !1,
|
|
9
|
+
disabled: o = !1,
|
|
10
|
+
clickable: s = !1,
|
|
11
11
|
tooltip: a = [],
|
|
12
|
-
bold:
|
|
12
|
+
bold: c
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
14
|
+
const m = (Array.isArray(a) ? a : [a]).map((r, l) => ({
|
|
15
|
+
key: l,
|
|
16
|
+
...r
|
|
17
|
+
}));
|
|
15
18
|
return /* @__PURE__ */ t.createElement(
|
|
16
19
|
"div",
|
|
17
20
|
{
|
|
18
|
-
className:
|
|
19
|
-
"tw-inline-flex tw-items-center tw-gap-1 tw-font-sans tw-text-s tw-max-w-full tw-min-w-0 tw-flex-initial",
|
|
20
|
-
|
|
21
|
+
className: i([
|
|
22
|
+
"tw-inline-flex tw-leading-4 tw-items-center tw-gap-1 tw-font-sans tw-text-s tw-max-w-full tw-min-w-0 tw-flex-initial",
|
|
23
|
+
o ? "tw-text-black-40 hover:tw-text-black-40 dark:tw-text-black-60 dark:hover:tw-text-black-60" : "tw-text-black-90 dark:tw-text-white"
|
|
21
24
|
]),
|
|
22
25
|
"data-test-id": "input-label-container"
|
|
23
26
|
},
|
|
24
27
|
/* @__PURE__ */ t.createElement("div", { className: "tw-flex-1 tw-overflow-hidden tw-text-ellipsis tw-whitespace-nowrap" }, /* @__PURE__ */ t.createElement(
|
|
25
28
|
"label",
|
|
26
29
|
{
|
|
27
|
-
htmlFor:
|
|
28
|
-
className:
|
|
30
|
+
htmlFor: w,
|
|
31
|
+
className: i([
|
|
29
32
|
"tw-select-none",
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
c && "tw-font-medium",
|
|
34
|
+
o || !s ? "hover:tw-cursor-not-allowed tw-pointer-events-none" : "hover:tw-cursor-pointer hover:tw-text-black dark:hover:tw-text-white group-hover:tw-text-black dark:group-hover:tw-text-white"
|
|
32
35
|
]),
|
|
33
36
|
"data-test-id": "input-label",
|
|
34
37
|
title: typeof e == "string" ? e : ""
|
|
35
38
|
},
|
|
36
39
|
e
|
|
37
40
|
)),
|
|
38
|
-
|
|
41
|
+
n && /* @__PURE__ */ t.createElement(
|
|
39
42
|
"span",
|
|
40
43
|
{
|
|
41
44
|
"data-test-id": "input-label-required",
|
|
@@ -43,16 +46,15 @@ const u = ({
|
|
|
43
46
|
},
|
|
44
47
|
"*"
|
|
45
48
|
),
|
|
46
|
-
|
|
49
|
+
m.map(({ key: r, triggerIcon: l, triggerStyle: p, hoverDelay: d = 100, ...x }) => /* @__PURE__ */ t.createElement("div", { key: r, className: "tw-leading-3" }, /* @__PURE__ */ t.createElement(
|
|
47
50
|
f,
|
|
48
51
|
{
|
|
49
|
-
tooltip: { ...x, hoverDelay:
|
|
50
|
-
key: d,
|
|
52
|
+
tooltip: { ...x, hoverDelay: d },
|
|
51
53
|
iconSize: k.Size16,
|
|
52
|
-
triggerIcon:
|
|
53
|
-
triggerStyle:
|
|
54
|
+
triggerIcon: l,
|
|
55
|
+
triggerStyle: p
|
|
54
56
|
}
|
|
55
|
-
))
|
|
57
|
+
)))
|
|
56
58
|
);
|
|
57
59
|
};
|
|
58
60
|
u.displayName = "FondueInputLabel";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputLabel.es.js","sources":["../../../src/components/InputLabel/InputLabel.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TooltipProps } from '@components/Tooltip/Tooltip';\nimport { TooltipIcon, TooltipIconProps } from '@components/TooltipIcon/TooltipIcon';\nimport { IconSize } from '@foundation/Icon/IconSize';\nimport { merge } from '@utilities/merge';\nimport React, { FC, PropsWithChildren } from 'react';\n\nexport type InputLabelTooltipProps =\n | (TooltipProps & Pick<TooltipIconProps, 'triggerStyle' | 'triggerIcon'>)\n | (TooltipProps & Pick<TooltipIconProps, 'triggerStyle' | 'triggerIcon'>)[];\n\nexport type InputLabelProps = PropsWithChildren<{\n htmlFor: string;\n required?: boolean;\n disabled?: boolean;\n clickable?: boolean;\n tooltip?: InputLabelTooltipProps;\n bold?: boolean;\n}>;\n\nexport const InputLabel: FC<InputLabelProps> = ({\n children,\n htmlFor,\n required = false,\n disabled = false,\n clickable = false,\n tooltip = [],\n bold,\n}) => {\n const tooltips = Array.isArray(tooltip) ? tooltip : [tooltip];\n\n return (\n <div\n className={merge([\n 'tw-inline-flex tw-items-center tw-gap-1 tw-font-sans tw-text-s tw-max-w-full tw-min-w-0 tw-flex-initial',\n disabled\n ? 'tw-text-black-40 hover:tw-text-black-40 dark:tw-text-black-60 dark:hover:tw-text-black-60'\n : 'tw-text-black-90 dark:tw-text-white',\n ])}\n data-test-id=\"input-label-container\"\n >\n <div className=\"tw-flex-1 tw-overflow-hidden tw-text-ellipsis tw-whitespace-nowrap\">\n <label\n htmlFor={htmlFor}\n className={merge([\n 'tw-select-none',\n bold && 'tw-font-medium',\n disabled || !clickable\n ? 'hover:tw-cursor-not-allowed tw-pointer-events-none'\n : 'hover:tw-cursor-pointer hover:tw-text-black dark:hover:tw-text-white group-hover:tw-text-black dark:group-hover:tw-text-white',\n ])}\n data-test-id=\"input-label\"\n title={typeof children === 'string' ? children : ''}\n >\n {children}\n </label>\n </div>\n\n {required && (\n <span\n data-test-id=\"input-label-required\"\n className=\"tw-h-4 tw-text-m tw-text-red-60 dark:tw-text-red-50\"\n >\n *\n </span>\n )}\n {
|
|
1
|
+
{"version":3,"file":"InputLabel.es.js","sources":["../../../src/components/InputLabel/InputLabel.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TooltipProps } from '@components/Tooltip/Tooltip';\nimport { TooltipIcon, TooltipIconProps } from '@components/TooltipIcon/TooltipIcon';\nimport { IconSize } from '@foundation/Icon/IconSize';\nimport { merge } from '@utilities/merge';\nimport React, { FC, PropsWithChildren } from 'react';\n\nexport type InputLabelTooltipProps =\n | (TooltipProps & Pick<TooltipIconProps, 'triggerStyle' | 'triggerIcon'>)\n | (TooltipProps & Pick<TooltipIconProps, 'triggerStyle' | 'triggerIcon'>)[];\n\nexport type InputLabelProps = PropsWithChildren<{\n htmlFor: string;\n required?: boolean;\n disabled?: boolean;\n clickable?: boolean;\n tooltip?: InputLabelTooltipProps;\n bold?: boolean;\n}>;\n\nexport const InputLabel: FC<InputLabelProps> = ({\n children,\n htmlFor,\n required = false,\n disabled = false,\n clickable = false,\n tooltip = [],\n bold,\n}) => {\n const tooltips = Array.isArray(tooltip) ? tooltip : [tooltip];\n\n const tooltipsWithKeys = tooltips.map((tooltip, index) => ({\n key: index,\n ...tooltip,\n }));\n\n return (\n <div\n className={merge([\n 'tw-inline-flex tw-leading-4 tw-items-center tw-gap-1 tw-font-sans tw-text-s tw-max-w-full tw-min-w-0 tw-flex-initial',\n disabled\n ? 'tw-text-black-40 hover:tw-text-black-40 dark:tw-text-black-60 dark:hover:tw-text-black-60'\n : 'tw-text-black-90 dark:tw-text-white',\n ])}\n data-test-id=\"input-label-container\"\n >\n <div className=\"tw-flex-1 tw-overflow-hidden tw-text-ellipsis tw-whitespace-nowrap\">\n <label\n htmlFor={htmlFor}\n className={merge([\n 'tw-select-none',\n bold && 'tw-font-medium',\n disabled || !clickable\n ? 'hover:tw-cursor-not-allowed tw-pointer-events-none'\n : 'hover:tw-cursor-pointer hover:tw-text-black dark:hover:tw-text-white group-hover:tw-text-black dark:group-hover:tw-text-white',\n ])}\n data-test-id=\"input-label\"\n title={typeof children === 'string' ? children : ''}\n >\n {children}\n </label>\n </div>\n\n {required && (\n <span\n data-test-id=\"input-label-required\"\n className=\"tw-h-4 tw-text-m tw-text-red-60 dark:tw-text-red-50\"\n >\n *\n </span>\n )}\n {tooltipsWithKeys.map(({ key, triggerIcon, triggerStyle, hoverDelay = 100, ...tooltipProps }) => (\n <div key={key} className=\"tw-leading-3\">\n <TooltipIcon\n tooltip={{ ...tooltipProps, hoverDelay }}\n iconSize={IconSize.Size16}\n triggerIcon={triggerIcon}\n triggerStyle={triggerStyle}\n />\n </div>\n ))}\n </div>\n );\n};\nInputLabel.displayName = 'FondueInputLabel';\n"],"names":["InputLabel","children","htmlFor","required","disabled","clickable","tooltip","bold","tooltipsWithKeys","index","React","merge","key","triggerIcon","triggerStyle","hoverDelay","tooltipProps","TooltipIcon","IconSize"],"mappings":";;;;AAqBO,MAAMA,IAAkC,CAAC;AAAA,EAC5C,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU,CAAC;AAAA,EACX,MAAAC;AACJ,MAAM;AAGF,QAAMC,KAFW,MAAM,QAAQF,CAAO,IAAIA,IAAU,CAACA,CAAO,GAE1B,IAAI,CAACA,GAASG,OAAW;AAAA,IACvD,KAAKA;AAAA,IACL,GAAGH;AAAAA,EACL,EAAA;AAGE,SAAA,gBAAAI,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAWC,EAAM;AA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