| 906 | * A PromptToken displays a non-editable inline object reference within a PromptTokenField. |
| 907 | */ |
| 908 | export function PromptToken(props: PromptTokenProps) { |
| 909 | let {size} = useContext(PromptFieldContext)!; |
| 910 | return ( |
| 911 | <Token |
| 912 | {...props} |
| 913 | className={renderProps => |
| 914 | style({ |
| 915 | font: { |
| 916 | size: { |
| 917 | M: 'ui', |
| 918 | S: 'ui-sm' |
| 919 | } |
| 920 | }, |
| 921 | backgroundColor: { |
| 922 | default: 'transparent-overlay-1000/10', |
| 923 | isSelected: 'blue-800' |
| 924 | }, |
| 925 | color: { |
| 926 | default: 'body', |
| 927 | isSelected: 'white' |
| 928 | }, |
| 929 | outlineStyle: { |
| 930 | default: 'solid', |
| 931 | isPlaceholder: 'dashed' |
| 932 | }, |
| 933 | outlineWidth: 1, |
| 934 | outlineColor: { |
| 935 | default: 'transparent-overlay-1000/10', |
| 936 | isPlaceholder: 'transparent-overlay-1000/40' |
| 937 | }, |
| 938 | outlineOffset: -1, |
| 939 | borderRadius: 'pill', |
| 940 | boxShadow: `[inset 0 24px 32px 0 ${color('transparent-white-50')}, 0 8px 32px 0 ${color('transparent-black-50')}]`, |
| 941 | boxDecorationBreak: 'clone', |
| 942 | paddingX: 8, |
| 943 | // not using inline-flex here due to a text selection bug in WebKit. |
| 944 | paddingY: { |
| 945 | size: { |
| 946 | M: space(3), |
| 947 | S: 2 |
| 948 | } |
| 949 | }, |
| 950 | lineHeight: '[1em]', |
| 951 | cursor: 'default', |
| 952 | '--iconPrimary': { |
| 953 | type: 'fill', |
| 954 | value: 'currentColor' |
| 955 | } |
| 956 | })({...renderProps, isPlaceholder: props.token.value?.type === 'placeholder', size}) |
| 957 | }> |
| 958 | <IconContext.Provider |
| 959 | value={{ |
| 960 | styles: style({ |
| 961 | size: '1lh', |
| 962 | display: 'inline-block', |
| 963 | verticalAlign: '[-0.18em]', |
| 964 | marginEnd: 4 |
| 965 | }) |