@box/content-field 2.2.22 → 2.2.24
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 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{FileDefault,Folder}from"@box/blueprint-web-assets/icons/Fill";import{bpSpace040,bpSpace060}from"@box/blueprint-web-assets/tokens/tokens";import{createElement}from"react";import{FileVariable,FolderVariable}from"@box/blueprint-web-assets/icons/Content";import{jsx}from"react/jsx-runtime";import '../styles/content-field-icon.css';var content_field_module_default={contentFieldWrapper:`_contentFieldWrapper_hg8tt_1`,contentField:`_contentField_hg8tt_1`,inlineError:`_inlineError_hg8tt_64`,contentButton:`_contentButton_hg8tt_68`,error:`_error_hg8tt_82`,hasSelection:`_hasSelection_hg8tt_86`,disabled:`_disabled_hg8tt_99`,labelWrapper:`_labelWrapper_hg8tt_116`,contentLabel:`_contentLabel_hg8tt_122`,variable:`_variable_hg8tt_127`,variableError:`_variableError_hg8tt_131`,circledIconContainer:`_circledIconContainer_hg8tt_135`,clearButton:`_clearButton_hg8tt_146`},ContentFieldIcon=({icon})=>createElement(icon,{role:`presentation`,height:bpSpace060,width:bpSpace060}),ContentFieldCircledIcon=({icon})=>jsx(`div`,{className:content_field_module_default.circledIconContainer,children:createElement(icon,{role:`presentation`,height:bpSpace040,width:bpSpace040})}),ContentFieldFolderIcon=()=>jsx(ContentFieldCircledIcon,{icon:Folder}),ContentFieldFileIcon=()=>jsx(ContentFieldCircledIcon,{icon:FileDefault}),ContentFieldVariableFolderIcon=()=>jsx(ContentFieldIcon,{icon:FolderVariable}),ContentFieldVariableFileIcon=()=>jsx(ContentFieldIcon,{icon:FileVariable});export{ContentFieldVariableFileIcon as a,ContentFieldIcon as i,ContentFieldFileIcon as n,ContentFieldVariableFolderIcon as o,ContentFieldFolderIcon as r,content_field_module_default as s,ContentFieldCircledIcon as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ContentFieldVariableFileIcon,i as ContentFieldIcon,n as ContentFieldFileIcon,o as ContentFieldVariableFolderIcon,r as ContentFieldFolderIcon,s as content_field_module_default}from"../../chunks/content-field-icon.js";import{useContentFieldTooltip}from"./hooks/useContentFieldTooltip.js";import messages_default from"./messages.js";import{Button}from"@ariakit/react";import{InlineError,Text,
|
|
1
|
+
import{a as ContentFieldVariableFileIcon,i as ContentFieldIcon,n as ContentFieldFileIcon,o as ContentFieldVariableFolderIcon,r as ContentFieldFolderIcon,s as content_field_module_default}from"../../chunks/content-field-icon.js";import{useContentFieldTooltip}from"./hooks/useContentFieldTooltip.js";import messages_default from"./messages.js";import{Button}from"@ariakit/react";import{InlineError,Text,useUniqueId}from"@box/blueprint-web";import{XMark}from"@box/blueprint-web-assets/icons/Fill";import{bpSpace040}from"@box/blueprint-web-assets/tokens/tokens";import clsx from"clsx";import{forwardRef,useRef}from"react";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";var isVariable=title=>title?.type===`variable`,ContentIcon=({icon,variant,isVariableWithTitle})=>icon?jsx(ContentFieldIcon,{icon}):jsx(isVariableWithTitle?variant===`file`?ContentFieldVariableFileIcon:ContentFieldVariableFolderIcon:variant===`file`?ContentFieldFileIcon:ContentFieldFolderIcon,{}),ContentField=forwardRef(({icon,placeholder,onClick,onClear,title,error,clearButtonRef,disabled=!1,variant=`folder`,triggerRef,...rest},forwardedRef)=>{let intl=useIntl(),{titleValue}=title??{},labelRef=useRef(null),textValue=titleValue??placeholder,{TooltipComponent,tooltipProps}=useContentFieldTooltip(labelRef,title),handleOnClickClearButton=event=>{labelRef.current?.focus(),onClear(event)},inlineErrorId=useUniqueId(`inline-error-`),isVariableWithTitle=isVariable(title)&&!!titleValue,tooltipVariant=error?`error`:`standard`;return jsxs(`div`,{ref:forwardedRef,className:content_field_module_default.contentFieldWrapper,"data-modern":!0,children:[jsxs(`div`,{className:content_field_module_default.contentField,children:[jsx(TooltipComponent,{...tooltipProps,variant:tooltipVariant,children:jsxs(Button,{ref:triggerRef,"aria-describedby":inlineErrorId,className:clsx(content_field_module_default.contentButton,{[content_field_module_default.hasSelection]:title,[content_field_module_default.error]:!!error,[content_field_module_default.disabled]:disabled}),disabled,onClick,type:`button`,...rest,children:[jsx(ContentIcon,{icon,isVariableWithTitle,variant}),jsx(`div`,{className:content_field_module_default.labelWrapper,children:jsx(Text,{ref:labelRef,as:`span`,className:clsx(content_field_module_default.contentLabel,{[content_field_module_default.variable]:isVariableWithTitle,[content_field_module_default.variableError]:isVariableWithTitle&&error}),variant:isVariableWithTitle?`bodyDefaultBold`:`bodyDefault`,children:textValue})})]})}),titleValue&&jsx(Button,{ref:clearButtonRef,"aria-label":intl.formatMessage(messages_default.clearButtonLabel),className:clsx(content_field_module_default.clearButton,{[content_field_module_default.hasSelection]:titleValue,[content_field_module_default.error]:!!error,[content_field_module_default.disabled]:disabled}),disabled,onClick:handleOnClickClearButton,type:`button`,children:jsx(XMark,{height:bpSpace040,role:`presentation`,width:bpSpace040})})]}),jsx(InlineError,{className:content_field_module_default.inlineError,id:inlineErrorId,children:error})]})});export{ContentField};
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/content-field",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.24",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@ariakit/react": "^0.4.21",
|
|
7
|
-
"@box/blueprint-web": "^
|
|
8
|
-
"@box/blueprint-web-assets": "^5.7.
|
|
7
|
+
"@box/blueprint-web": "^17.0.0",
|
|
8
|
+
"@box/blueprint-web-assets": "^5.7.15",
|
|
9
9
|
"react": "^18.0.0",
|
|
10
10
|
"react-dom": "^18.0.0",
|
|
11
11
|
"react-intl": "^6.4.2"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@box/blueprint-web": "^
|
|
15
|
-
"@box/blueprint-web-assets": "^5.7.
|
|
14
|
+
"@box/blueprint-web": "^17.0.0",
|
|
15
|
+
"@box/blueprint-web-assets": "^5.7.15",
|
|
16
16
|
"@box/eslint-plugin-blueprint": "2.2.8",
|
|
17
|
-
"@box/storybook-utils": "1.2.
|
|
17
|
+
"@box/storybook-utils": "1.2.24",
|
|
18
18
|
"@testing-library/react": "^15.0.6",
|
|
19
19
|
"react-intl": "^6.4.2"
|
|
20
20
|
},
|