mirror of
https://github.com/documenso/documenso.git
synced 2026-07-09 20:45:00 +10:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 24f8473d05 | |||
| 66a00634eb | |||
| 19326aec56 | |||
| d34a6eddf4 | |||
| da2d8ffa7e | |||
| 58ccfd5512 | |||
| 223fbef143 | |||
| 4c486fc1e9 |
+7
-1
@@ -1,5 +1,6 @@
|
||||
import type { TRecipientActionAuth } from '@documenso/lib/types/document-auth';
|
||||
import { ZFieldMetaSchema } from '@documenso/lib/types/field-meta';
|
||||
import { isFieldUnsignedAndRequired } from '@documenso/lib/utils/advanced-fields-helpers';
|
||||
import type { FieldWithSignature } from '@documenso/prisma/types/field-with-signature';
|
||||
import { FieldRootContainer } from '@documenso/ui/components/field/field';
|
||||
import { getRecipientColorStyles } from '@documenso/ui/lib/recipient-colors';
|
||||
@@ -117,7 +118,12 @@ export const DocumentSigningFieldContainer = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<FieldRootContainer color={getRecipientColorStyles(field.fieldMeta?.readOnly ? 'readOnly' : 0)} field={field}>
|
||||
<FieldRootContainer
|
||||
color={getRecipientColorStyles(
|
||||
field.fieldMeta?.readOnly ? 'readOnly' : isFieldUnsignedAndRequired(field) ? 'required' : 0,
|
||||
)}
|
||||
field={field}
|
||||
>
|
||||
{!field.inserted && !loading && !readOnlyField && (
|
||||
<button
|
||||
type="submit"
|
||||
|
||||
+7
-1
@@ -152,7 +152,13 @@ export const EnvelopeSignerPageRenderer = ({ pageData }: { pageData: PageRenderD
|
||||
|
||||
const isValidating = showPendingFieldTooltip && isFieldUnsignedAndRequired(fieldToRender);
|
||||
|
||||
const color = fieldToRender.fieldMeta?.readOnly ? 'readOnly' : isValidating ? 'orange' : 'green';
|
||||
const color = fieldToRender.fieldMeta?.readOnly
|
||||
? 'readOnly'
|
||||
: isValidating
|
||||
? 'orange'
|
||||
: isFieldUnsignedAndRequired(fieldToRender)
|
||||
? 'required'
|
||||
: 'green';
|
||||
|
||||
const { fieldGroup } = renderField({
|
||||
scale,
|
||||
|
||||
@@ -116,6 +116,7 @@ module.exports = {
|
||||
orange: 'hsl(var(--recipient-orange))',
|
||||
yellow: 'hsl(var(--recipient-yellow))',
|
||||
pink: 'hsl(var(--recipient-pink))',
|
||||
red: 'hsl(var(--recipient-red))',
|
||||
},
|
||||
},
|
||||
backgroundImage: {
|
||||
|
||||
@@ -119,7 +119,7 @@ export function FieldRootContainer({ field, children, color, className, readonly
|
||||
data-readonly={readonly ? 'true' : 'false'}
|
||||
className={cn(
|
||||
FIELD_ROOT_CONTAINER_CLASS_NAME,
|
||||
color?.base,
|
||||
!(isValidating && isFieldUnsignedAndRequired(field)) && color?.base,
|
||||
{
|
||||
'px-2': field.type !== FieldType.SIGNATURE && field.type !== FieldType.FREE_SIGNATURE,
|
||||
'justify-center': !field.inserted,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { colord } from 'colord';
|
||||
import { once } from 'remeda';
|
||||
|
||||
export type TRecipientColor = 'readOnly' | (typeof AVAILABLE_RECIPIENT_COLORS)[number];
|
||||
export type TRecipientColor = 'readOnly' | 'required' | (typeof AVAILABLE_RECIPIENT_COLORS)[number];
|
||||
|
||||
export type RecipientColorStyles = {
|
||||
base: string;
|
||||
@@ -33,6 +33,7 @@ const RECIPIENT_COLOR_STYLES: Record<TRecipientColor, () => RecipientColorStyles
|
||||
'ring-2 ring-recipient-green shadow-[0_0_0_5px_hsl(var(--recipient-green)/10%),0_0_0_2px_hsl(var(--recipient-green)/60%),0_0_0_0.5px_hsl(var(--recipient-green))]',
|
||||
comboBoxItem: '',
|
||||
}),
|
||||
required: once(() => generateStyles('red')),
|
||||
green: once(() => generateStyles('green')),
|
||||
blue: once(() => generateStyles('blue')),
|
||||
purple: once(() => generateStyles('purple')),
|
||||
@@ -41,7 +42,7 @@ const RECIPIENT_COLOR_STYLES: Record<TRecipientColor, () => RecipientColorStyles
|
||||
pink: once(() => generateStyles('pink')),
|
||||
};
|
||||
|
||||
const generateStyles = (recipientColor: TRecipientColor): RecipientColorStyles => {
|
||||
const generateStyles = (recipientColor: TCssVarRecipientColor): RecipientColorStyles => {
|
||||
const { bg, border, ring, text } = CSS_PROPERTY;
|
||||
const { active, hover, groupHover, groupHoverFieldItem } = CSS_VARIANT;
|
||||
|
||||
@@ -79,9 +80,13 @@ const CSS_VARIANT = {
|
||||
|
||||
const AVAILABLE_RECIPIENT_COLORS = ['green', 'blue', 'purple', 'orange', 'yellow', 'pink'] as const;
|
||||
|
||||
const CSS_VAR_RECIPIENT_COLORS = [...AVAILABLE_RECIPIENT_COLORS, 'red'] as const;
|
||||
|
||||
type TCssVarRecipientColor = (typeof CSS_VAR_RECIPIENT_COLORS)[number];
|
||||
|
||||
export const RECIPIENT_DYNAMIC_CLASS = {
|
||||
pattern: new RegExp(
|
||||
`(${Object.values(CSS_PROPERTY).join('|')})-recipient-(${AVAILABLE_RECIPIENT_COLORS.join('|')})(\\/(15|30))?$`,
|
||||
`(${Object.values(CSS_PROPERTY).join('|')})-recipient-(${CSS_VAR_RECIPIENT_COLORS.join('|')})(\\/(15|30))?$`,
|
||||
),
|
||||
variants: Object.values(CSS_VARIANT),
|
||||
};
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
--recipient-orange: 36 92% 54%;
|
||||
--recipient-yellow: 51 100% 43%;
|
||||
--recipient-pink: 313 65% 57%;
|
||||
--recipient-red: 0 91% 71%;
|
||||
|
||||
/* Base - Neutral */
|
||||
--new-neutral-50: 0, 0%, 96%;
|
||||
|
||||
Reference in New Issue
Block a user