goobs-frontend 0.9.31 → 0.9.33

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.
@@ -41,26 +41,26 @@ export interface PercentageFieldProps extends Omit<TextFieldProps, 'onChange'> {
41
41
  sacredtheme?: boolean
42
42
  }
43
43
 
44
- const StyledIconButton = styled(IconButton)<{ sacredtheme?: boolean }>(
45
- ({ theme, sacredtheme }) => ({
46
- padding: 0,
47
- width: '16px',
48
- height: '16px',
49
- minWidth: '16px',
50
- minHeight: '16px',
51
- borderRadius: '2px',
52
- transition: 'all 0.3s ease',
53
- color: sacredtheme ? '#FFD700' : 'inherit',
54
- '&:hover': {
55
- backgroundColor: sacredtheme
56
- ? alpha('#FFD700', 0.1)
57
- : theme.palette.grey[200],
58
- ...(sacredtheme && {
59
- animation: `${sacredGlow} 1s ease-in-out infinite`,
60
- }),
61
- },
62
- })
63
- )
44
+ const StyledIconButton = styled(IconButton, {
45
+ shouldForwardProp: prop => prop !== 'sacredtheme',
46
+ })<{ sacredtheme?: boolean }>(({ theme, sacredtheme }) => ({
47
+ padding: 0,
48
+ width: '16px',
49
+ height: '16px',
50
+ minWidth: '16px',
51
+ minHeight: '16px',
52
+ borderRadius: '2px',
53
+ transition: 'all 0.3s ease',
54
+ color: sacredtheme ? '#FFD700' : 'inherit',
55
+ '&:hover': {
56
+ backgroundColor: sacredtheme
57
+ ? alpha('#FFD700', 0.1)
58
+ : theme.palette.grey[200],
59
+ ...(sacredtheme && {
60
+ animation: `${sacredGlow} 1s ease-in-out infinite`,
61
+ }),
62
+ },
63
+ }))
64
64
 
65
65
  const ArrowIcon = styled(Box)({
66
66
  display: 'flex',
@@ -50,7 +50,12 @@ const StyledFormControl = styled(FormControl)({
50
50
  justifyContent: 'flex-end',
51
51
  })
52
52
 
53
- const StyledOutlinedInput = styled(OutlinedInput)<{
53
+ const StyledOutlinedInput = styled(OutlinedInput, {
54
+ shouldForwardProp: prop =>
55
+ !['backgroundcolor', 'outlinecolor', 'fontcolor', 'sacredtheme'].includes(
56
+ prop as string
57
+ ),
58
+ })<{
54
59
  backgroundcolor?: string
55
60
  outlinecolor?: string
56
61
  fontcolor?: string
@@ -117,7 +122,16 @@ const StyledOutlinedInput = styled(OutlinedInput)<{
117
122
  },
118
123
  }))
119
124
 
120
- const StyledInputLabel = styled(InputLabel)<{
125
+ const StyledInputLabel = styled(InputLabel, {
126
+ shouldForwardProp: prop =>
127
+ ![
128
+ 'fontcolor',
129
+ 'shrunkfontcolor',
130
+ 'unshrunkfontcolor',
131
+ 'shrunklabelposition',
132
+ 'sacredtheme',
133
+ ].includes(prop as string),
134
+ })<{
121
135
  fontcolor?: string
122
136
  shrunkfontcolor?: string
123
137
  unshrunkfontcolor?: string
@@ -1,10 +1,9 @@
1
1
  'use client'
2
- import React, { useCallback, useMemo } from 'react'
2
+ import React, { useCallback } from 'react'
3
3
  import {
4
4
  Box,
5
5
  TextField as MuiTextField,
6
6
  TextFieldProps as MuiTextFieldProps,
7
- InputAdornment,
8
7
  StandardTextFieldProps,
9
8
  OutlinedTextFieldProps,
10
9
  FilledTextFieldProps,
@@ -128,12 +127,12 @@ const StyledMuiTextField = styled(MuiTextField, {
128
127
  content: '"𓊹"',
129
128
  position: 'absolute',
130
129
  top: '50%',
131
- right: '45px',
130
+ right: '15px',
132
131
  transform: 'translateY(-50%)',
133
132
  color: alpha('#FFD700', 0.3),
134
133
  fontSize: '14px',
135
134
  pointerEvents: 'none',
136
- zIndex: 1,
135
+ zIndex: 0,
137
136
  animation: `${floatGlyph} 3s ease-in-out infinite`,
138
137
  },
139
138
  }),
@@ -247,7 +246,6 @@ const TextField = React.memo<TextFieldProps>(props => {
247
246
  startAdornment,
248
247
  endAdornment,
249
248
  textAlign = 'left',
250
- slotProps: customSlotProps = {},
251
249
  backgroundcolor,
252
250
  outlinecolor,
253
251
  fontcolor,
@@ -260,19 +258,6 @@ const TextField = React.memo<TextFieldProps>(props => {
260
258
  ...restProps
261
259
  } = props
262
260
 
263
- const inputStyle = useMemo<React.CSSProperties>(
264
- () => ({
265
- backgroundColor: sacredtheme
266
- ? alpha('#000000', 0.8)
267
- : backgroundcolor || 'inherit',
268
- width: '100%',
269
- cursor: 'text',
270
- boxSizing: 'border-box',
271
- borderRadius: 5,
272
- }),
273
- [backgroundcolor, sacredtheme]
274
- )
275
-
276
261
  const handleChange = useCallback(
277
262
  (e: React.ChangeEvent<HTMLInputElement>) => onChange?.(e),
278
263
  [onChange]
@@ -290,63 +275,6 @@ const TextField = React.memo<TextFieldProps>(props => {
290
275
  e.preventDefault()
291
276
  }, [])
292
277
 
293
- const mergedSlotProps = useMemo(() => {
294
- const adornmentSx = {
295
- color: sacredtheme ? '#FFD700 !important' : '#000000 !important',
296
- '& svg': {
297
- color: sacredtheme ? '#FFD700 !important' : '#000000 !important',
298
- fill: sacredtheme ? '#FFD700 !important' : '#000000 !important',
299
- stroke: sacredtheme ? '#FFD700 !important' : '#000000 !important',
300
- ...(sacredtheme && {
301
- filter: 'drop-shadow(0 0 4px rgba(255, 215, 0, 0.6))',
302
- }),
303
- },
304
- }
305
-
306
- const defaultSlotProps = {
307
- input: {
308
- style: inputStyle,
309
- ...(startAdornment && {
310
- startAdornment: (
311
- <InputAdornment position="start" sx={adornmentSx}>
312
- {startAdornment}
313
- </InputAdornment>
314
- ),
315
- }),
316
- ...(endAdornment && {
317
- endAdornment: (
318
- <InputAdornment position="end" sx={adornmentSx}>
319
- {endAdornment}
320
- </InputAdornment>
321
- ),
322
- }),
323
- },
324
- inputLabel: {
325
- sx: {
326
- '&.MuiInputLabel-shrink': { top: '0px', left: '0px' },
327
- '&:not(.MuiInputLabel-shrink)': {
328
- transform: 'scale(1)',
329
- transformOrigin: 'top left',
330
- top: '9px',
331
- left: '12px',
332
- },
333
- },
334
- },
335
- }
336
-
337
- return {
338
- ...defaultSlotProps,
339
- input: {
340
- ...defaultSlotProps.input,
341
- ...(customSlotProps.input || {}),
342
- },
343
- inputLabel: {
344
- ...defaultSlotProps.inputLabel,
345
- ...(customSlotProps.inputLabel || {}),
346
- },
347
- }
348
- }, [inputStyle, startAdornment, endAdornment, customSlotProps, sacredtheme])
349
-
350
278
  const hasValue = Boolean(value?.toString().length).toString()
351
279
 
352
280
  return (
@@ -374,7 +302,19 @@ const TextField = React.memo<TextFieldProps>(props => {
374
302
  value={value}
375
303
  error={error}
376
304
  disabled={disabled}
377
- slotProps={mergedSlotProps}
305
+ InputProps={{
306
+ startAdornment,
307
+ endAdornment,
308
+ }}
309
+ sx={{
310
+ // Hide the sacred hieroglyph when there's an endAdornment
311
+ ...(sacredtheme &&
312
+ endAdornment && {
313
+ '& .MuiOutlinedInput-root::before': {
314
+ display: 'none !important',
315
+ },
316
+ }),
317
+ }}
378
318
  fullWidth
379
319
  variant="outlined"
380
320
  hasvalue={hasValue}