@frontify/fondue 12.12.3 → 12.12.4

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,15 +1,15 @@
1
1
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
2
  import { useLinkOpenButtonState as s } from "@udecode/plate-link";
3
- import d from "../../../../../../foundation/Icon/Generated/IconPen16.es.js";
4
- import l from "../../../../../../foundation/Icon/Generated/IconTrashBin16.es.js";
5
- import { LINK_PLUGIN as p } from "../../id.es.js";
6
- import { getUrlFromLinkOrLegacyLink as m } from "../../utils/getUrl.es.js";
3
+ import { getUrlFromLinkOrLegacyLink as d } from "../../utils/getUrl.es.js";
4
+ import l from "../../../../../../foundation/Icon/Generated/IconPen16.es.js";
5
+ import p from "../../../../../../foundation/Icon/Generated/IconTrashBin16.es.js";
6
+ import { LINK_PLUGIN as m } from "../../id.es.js";
7
7
  import { FloatingModalWrapper as c } from "../../../../components/FloatingModal/FloatingModal.es.js";
8
8
  import { useRichTextEditorContext as u } from "../../../../context/RichTextEditorContext.es.js";
9
9
  const N = ({ editButtonProps: o, unlinkButtonProps: r }) => {
10
- const { element: e } = s(), { styles: i } = u(), a = e ? m(e) : "";
10
+ const { element: e } = s(), { styles: i } = u(), a = e ? d(e) : "";
11
11
  return /* @__PURE__ */ t(c, { "data-test-id": "floating-link-edit", padding: "16px", minWidth: "400px", children: /* @__PURE__ */ n("span", { "data-test-id": "preview-link-flyout", className: "tw-flex tw-justify-between", children: [
12
- /* @__PURE__ */ t("span", { style: i[p], className: "tw-pointer-events-none", children: a }),
12
+ /* @__PURE__ */ t("span", { style: i[m], className: "tw-pointer-events-none", children: a }),
13
13
  /* @__PURE__ */ n("span", { className: "tw-flex tw-gap-2", children: [
14
14
  /* @__PURE__ */ t(
15
15
  "button",
@@ -19,7 +19,7 @@ const N = ({ editButtonProps: o, unlinkButtonProps: r }) => {
19
19
  "data-test-id": "edit-link-button",
20
20
  className: "tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",
21
21
  ...o,
22
- children: /* @__PURE__ */ t(d, {})
22
+ children: /* @__PURE__ */ t(l, {})
23
23
  }
24
24
  ),
25
25
  /* @__PURE__ */ t(
@@ -30,7 +30,7 @@ const N = ({ editButtonProps: o, unlinkButtonProps: r }) => {
30
30
  "data-test-id": "remove-link-button",
31
31
  className: "tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",
32
32
  ...r,
33
- children: /* @__PURE__ */ t(l, {})
33
+ children: /* @__PURE__ */ t(p, {})
34
34
  }
35
35
  )
36
36
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.es.js","sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useButton } from '@react-aria/button';\nimport { useFocusRing } from '@react-aria/focus';\nimport { mergeProps } from '@react-aria/utils';\nimport { type MouseEvent, useRef } from 'react';\n\nimport IconCross from '@foundation/Icon/Generated/IconCross';\nimport { IconSize } from '@foundation/Icon/IconSize';\nimport { FOCUS_STYLE } from '@utilities/focusStyle';\nimport { merge } from '@utilities/merge';\n\nexport enum TagType {\n Suggested = 'Suggested',\n Selected = 'Selected',\n SelectedWithFocus = 'SelectedWithFocus',\n PreviouslySelected = 'PreviouslySelected',\n}\n\nexport enum TagSize {\n Small = 'Small',\n Medium = 'Medium',\n}\n\nexport const tagStyles: Record<TagType, string> = {\n [TagType.Suggested]:\n 'tw-border tw-bg-base tw-text-text-weak tw-border-line hover:tw-text-text hover:tw-border-line-strong',\n [TagType.Selected]:\n 'tw-bg-box-neutral hover:tw-bg-box-neutral-hover tw-text-text-weak hover:tw-text-box-neutral-inverse-hover',\n [TagType.SelectedWithFocus]:\n 'tw-bg-box-selected-strong hover:tw-bg-box-selected-strong-hover tw-text-box-selected-strong-inverse',\n [TagType.PreviouslySelected]:\n 'tw-bg-base tw-border tw-text-box-selected-strong tw-border-box-selected-strong hover:tw-bg-box-neutral hover:tw-text-box-selected-inverse hover:tw-border-box-selected-inverse',\n};\n\nexport type TagProps = { 'data-test-id'?: string } & (TagPropsUnselected | TagPropsSelected);\n\ntype TagPropsSelected = {\n type: TagType.Selected | TagType.SelectedWithFocus;\n label: string;\n onClick?: (event?: MouseEvent<HTMLButtonElement>) => void;\n size?: TagSize;\n};\n\ntype TagPropsUnselected = {\n type: TagType.Suggested | TagType.PreviouslySelected;\n label: string;\n onClick?: null;\n size?: TagSize;\n};\n\nexport const Tag = ({ type, label, onClick, size = TagSize.Medium, 'data-test-id': dataTestId = 'tag' }: TagProps) => {\n const ref = useRef<HTMLButtonElement | null>(null);\n const { isFocusVisible, focusProps } = useFocusRing();\n const isClickable = (type === TagType.Selected || type === TagType.SelectedWithFocus) && onClick;\n const { buttonProps } = useButton(\n {\n onPress: () => isClickable && onClick(),\n },\n ref,\n );\n\n return (\n <button\n type=\"button\"\n data-test-id={dataTestId}\n className={merge([\n 'tw-inline-flex tw-items-center tw-rounded-full tw-text-xs tw-transition-colors tw-group tw-outline-none tw-break-word',\n size === TagSize.Small ? 'tw-px-1.5 tw-py-0.5' : 'tw-px-2.5 tw-py-1',\n tagStyles[type],\n isClickable ? 'tw-cursor-pointer' : 'tw-cursor-default',\n isFocusVisible && FOCUS_STYLE,\n ])}\n {...mergeProps(buttonProps, focusProps)}\n >\n {label}\n {isClickable && (\n <span\n data-test-id={`${dataTestId}-reject-icon`}\n className=\"tw-opacity-80 group-hover:tw-opacity-100 tw-transition-opacity tw-ml-1 tw-leading-[0]\"\n >\n <IconCross size={IconSize.Size12} />\n </span>\n )}\n </button>\n );\n};\nTag.displayName = 'FondueTag';\n"],"names":["TagType","TagSize","tagStyles","Tag","type","label","onClick","size","dataTestId","ref","useRef","isFocusVisible","focusProps","useFocusRing","isClickable","buttonProps","useButton","jsxs","merge","FOCUS_STYLE","mergeProps","jsx","IconCross","IconSize"],"mappings":";;;;;;;;;AAYO,IAAKA,sBAAAA,OACRA,EAAA,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ag.es.js","sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useButton } from '@react-aria/button';\nimport { useFocusRing } from '@react-aria/focus';\nimport { mergeProps } from '@react-aria/utils';\nimport { type MouseEvent, useRef } from 'react';\n\nimport IconCross from '@foundation/Icon/Generated/IconCross';\nimport { IconSize } from '@foundation/Icon/IconSize';\nimport { FOCUS_STYLE } from '@utilities/focusStyle';\nimport { merge } from '@utilities/merge';\n\n/**\n * @deprecated Use the new Tag component from @frontify/fondue/components instead\n */\nexport enum TagType {\n Suggested = 'Suggested',\n Selected = 'Selected',\n SelectedWithFocus = 'SelectedWithFocus',\n PreviouslySelected = 'PreviouslySelected',\n}\n\n/**\n * @deprecated Use the new Tag component from @frontify/fondue/components instead\n */\nexport enum TagSize {\n Small = 'Small',\n Medium = 'Medium',\n}\n\n/**\n * @deprecated Use the new Tag component from @frontify/fondue/components instead\n */\nexport const tagStyles: Record<TagType, string> = {\n [TagType.Suggested]:\n 'tw-border tw-bg-base tw-text-text-weak tw-border-line hover:tw-text-text hover:tw-border-line-strong',\n [TagType.Selected]:\n 'tw-bg-box-neutral hover:tw-bg-box-neutral-hover tw-text-text-weak hover:tw-text-box-neutral-inverse-hover',\n [TagType.SelectedWithFocus]:\n 'tw-bg-box-selected-strong hover:tw-bg-box-selected-strong-hover tw-text-box-selected-strong-inverse',\n [TagType.PreviouslySelected]:\n 'tw-bg-base tw-border tw-text-box-selected-strong tw-border-box-selected-strong hover:tw-bg-box-neutral hover:tw-text-box-selected-inverse hover:tw-border-box-selected-inverse',\n};\n\n/**\n * @deprecated Use the new Tag component from @frontify/fondue/components instead\n */\nexport type TagProps = { 'data-test-id'?: string } & (TagPropsUnselected | TagPropsSelected);\n\ntype TagPropsSelected = {\n type: TagType.Selected | TagType.SelectedWithFocus;\n label: string;\n onClick?: (event?: MouseEvent<HTMLButtonElement>) => void;\n size?: TagSize;\n};\n\ntype TagPropsUnselected = {\n type: TagType.Suggested | TagType.PreviouslySelected;\n label: string;\n onClick?: null;\n size?: TagSize;\n};\n\n/**\n * @deprecated Use the new Tag component from @frontify/fondue/components instead\n */\nexport const Tag = ({ type, label, onClick, size = TagSize.Medium, 'data-test-id': dataTestId = 'tag' }: TagProps) => {\n const ref = useRef<HTMLButtonElement | null>(null);\n const { isFocusVisible, focusProps } = useFocusRing();\n const isClickable = (type === TagType.Selected || type === TagType.SelectedWithFocus) && onClick;\n const { buttonProps } = useButton(\n {\n onPress: () => isClickable && onClick(),\n },\n ref,\n );\n\n return (\n <button\n type=\"button\"\n data-test-id={dataTestId}\n className={merge([\n 'tw-inline-flex tw-items-center tw-rounded-full tw-text-xs tw-transition-colors tw-group tw-outline-none tw-break-word',\n size === TagSize.Small ? 'tw-px-1.5 tw-py-0.5' : 'tw-px-2.5 tw-py-1',\n tagStyles[type],\n isClickable ? 'tw-cursor-pointer' : 'tw-cursor-default',\n isFocusVisible && FOCUS_STYLE,\n ])}\n {...mergeProps(buttonProps, focusProps)}\n >\n {label}\n {isClickable && (\n <span\n data-test-id={`${dataTestId}-reject-icon`}\n className=\"tw-opacity-80 group-hover:tw-opacity-100 tw-transition-opacity tw-ml-1 tw-leading-[0]\"\n >\n <IconCross size={IconSize.Size12} />\n </span>\n )}\n </button>\n );\n};\nTag.displayName = 'FondueTag';\n"],"names":["TagType","TagSize","tagStyles","Tag","type","label","onClick","size","dataTestId","ref","useRef","isFocusVisible","focusProps","useFocusRing","isClickable","buttonProps","useButton","jsxs","merge","FOCUS_STYLE","mergeProps","jsx","IconCross","IconSize"],"mappings":";;;;;;;;;AAeO,IAAKA,sBAAAA,OACRA,EAAA,YAAY,aACZA,EAAA,WAAW,YACXA,EAAA,oBAAoB,qBACpBA,EAAA,qBAAqB,sBAJbA,IAAAA,KAAA,CAAA,CAAA,GAUAC,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,SAAS,UAFDA,IAAAA,KAAA,CAAA,CAAA;AAQL,MAAMC,IAA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