@rufous/ui 0.2.72 → 0.2.75
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.
- package/dist/main.cjs +27 -0
- package/dist/main.css +2 -1
- package/dist/main.d.cts +12 -1
- package/dist/main.d.ts +12 -1
- package/dist/main.js +27 -0
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -1740,6 +1740,25 @@ var Checkbox = ({
|
|
|
1740
1740
|
|
|
1741
1741
|
// lib/TextFields/TextField.tsx
|
|
1742
1742
|
var import_react17 = __toESM(require("react"), 1);
|
|
1743
|
+
var NUMBER_BLOCKED_KEYS = ["e", "E", "+", "-"];
|
|
1744
|
+
var BLOCKED_KEYS_BY_VARIANT = {
|
|
1745
|
+
"integer": [...NUMBER_BLOCKED_KEYS, ".", ","],
|
|
1746
|
+
"decimal": [...NUMBER_BLOCKED_KEYS],
|
|
1747
|
+
"positive-integer": [...NUMBER_BLOCKED_KEYS, ".", ","],
|
|
1748
|
+
"positive-decimal": [...NUMBER_BLOCKED_KEYS]
|
|
1749
|
+
};
|
|
1750
|
+
var STEP_BY_VARIANT = {
|
|
1751
|
+
"integer": 1,
|
|
1752
|
+
"decimal": 0.1,
|
|
1753
|
+
"positive-integer": 1,
|
|
1754
|
+
"positive-decimal": 0.1
|
|
1755
|
+
};
|
|
1756
|
+
var MIN_BY_VARIANT = {
|
|
1757
|
+
"integer": void 0,
|
|
1758
|
+
"decimal": void 0,
|
|
1759
|
+
"positive-integer": 0,
|
|
1760
|
+
"positive-decimal": 0
|
|
1761
|
+
};
|
|
1743
1762
|
var TextField = (0, import_react17.forwardRef)(({
|
|
1744
1763
|
label,
|
|
1745
1764
|
name,
|
|
@@ -1761,6 +1780,7 @@ var TextField = (0, import_react17.forwardRef)(({
|
|
|
1761
1780
|
fullWidth = false,
|
|
1762
1781
|
slotProps,
|
|
1763
1782
|
InputProps,
|
|
1783
|
+
numberVariant,
|
|
1764
1784
|
...props
|
|
1765
1785
|
}, ref) => {
|
|
1766
1786
|
const sxClass = useSx(sx);
|
|
@@ -1816,6 +1836,11 @@ var TextField = (0, import_react17.forwardRef)(({
|
|
|
1816
1836
|
};
|
|
1817
1837
|
const handleKeyDown = (e) => {
|
|
1818
1838
|
if (type === "number") {
|
|
1839
|
+
const blockedKeys = numberVariant ? BLOCKED_KEYS_BY_VARIANT[numberVariant] : NUMBER_BLOCKED_KEYS;
|
|
1840
|
+
if (blockedKeys.includes(e.key)) {
|
|
1841
|
+
e.preventDefault();
|
|
1842
|
+
return;
|
|
1843
|
+
}
|
|
1819
1844
|
if (e.key === "ArrowUp") {
|
|
1820
1845
|
e.preventDefault();
|
|
1821
1846
|
if (internalRef.current) {
|
|
@@ -1849,6 +1874,8 @@ var TextField = (0, import_react17.forwardRef)(({
|
|
|
1849
1874
|
required,
|
|
1850
1875
|
disabled,
|
|
1851
1876
|
readOnly,
|
|
1877
|
+
step: type === "number" && numberVariant ? STEP_BY_VARIANT[numberVariant] : void 0,
|
|
1878
|
+
min: type === "number" && numberVariant ? MIN_BY_VARIANT[numberVariant] : void 0,
|
|
1852
1879
|
...slotProps?.input,
|
|
1853
1880
|
...props
|
|
1854
1881
|
}
|
package/dist/main.css
CHANGED
package/dist/main.d.cts
CHANGED
|
@@ -518,6 +518,7 @@ interface CheckboxProps {
|
|
|
518
518
|
|
|
519
519
|
declare const Checkbox: React.FC<CheckboxProps>;
|
|
520
520
|
|
|
521
|
+
type NumberVariant = 'integer' | 'decimal' | 'positive-integer' | 'positive-decimal';
|
|
521
522
|
interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
522
523
|
/** Label text shown for the input */
|
|
523
524
|
label?: string;
|
|
@@ -525,6 +526,16 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'si
|
|
|
525
526
|
variant?: 'outlined' | 'filled' | 'standard';
|
|
526
527
|
/** The size of the component */
|
|
527
528
|
size?: 'small' | 'medium';
|
|
529
|
+
/**
|
|
530
|
+
* Sub-variant for number inputs. Only applies when `type="number"`.
|
|
531
|
+
* - `integer`: whole numbers (blocks `.`)
|
|
532
|
+
* - `decimal`: floating point numbers
|
|
533
|
+
* - `positive-integer`: whole numbers ≥ 0
|
|
534
|
+
* - `positive-decimal`: floating point numbers ≥ 0
|
|
535
|
+
*
|
|
536
|
+
* All number variants block `e`, `E`, `+`, `-`.
|
|
537
|
+
*/
|
|
538
|
+
numberVariant?: NumberVariant;
|
|
528
539
|
/** The color of the component */
|
|
529
540
|
color?: 'primary' | 'secondary' | 'error' | 'success' | 'info' | 'warning';
|
|
530
541
|
/** If true, the label is displayed in an error state. */
|
|
@@ -1714,4 +1725,4 @@ interface MentionItemData {
|
|
|
1714
1725
|
shortName?: string;
|
|
1715
1726
|
}
|
|
1716
1727
|
|
|
1717
|
-
export { APP_THEMES, Accordion, AccordionDetails, type AccordionDetailsProps, type AccordionProps, AccordionSummary, type AccordionSummaryProps, type Action, ActivateUserIcon, AddButton, AddressLookup, ArchivedIcon, AssignGroupIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BaseDialog, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CameraIcon, CancelButton, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, CircularProgressIcon, type CircularProgressIconProps, CloseIcon, Collapse, type CollapseProps, type Column, CopyIcon, DataGrid, type DataGridProps, DateField, type DateFieldProps, type DateFormatString, DateRangeField, type DateRangeFieldProps, type DateRangeValue, DifficultyAllIcon, DifficultyEasyIcon, DifficultyHardIcon, DifficultyMediumIcon, Divider, type DividerProps, DollarIcon, DownloadIcon, DownloadPdfIcon, Drawer, type DrawerProps, EditChatIcon, EditIcon, EngagementIcon, Fade, type FadeProps, FunctionIcon, Grid, type GridProps, Grow, type GrowProps, HelpOutlinedIcon, HierarchyIcon, IconButton, type IconButtonProps, ImageField, type ImageFieldProps, InactiveGroupIcon, IndustryIcon, InvoiceIcon, Link, type LinkProps, List, ListItem, ListItemButton, type ListItemButtonProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, LocationPinIcon, LogsIcon, Menu, MenuDivider, MenuItem, type MenuItemProps, MenuList, type MenuListProps, type MenuProps, MinExperienceIcon, NineDotMenuIcon, NotificationIcon, Paper, type PaperProps, PhoneField, type PhoneFieldProps, Popover, type PopoverProps, Popper, type PopperProps, ProjectIcon, QualificationsIcon, QuestionStatusAllIcon, QuestionStatusPrivateIcon, QuestionStatusPublicIcon, QuestionTypeAllIcon, QuestionTypeCodingIcon, QuestionTypeDescriptiveIcon, QuestionTypeMultipleIcon, QuestionTypeSingleIcon, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, RefreshIcon, ResendInviteIcon, RolesIcon, RufousAiIcon, RufousBirdIcon, RufousLauncherIcon, RufousLogoLoader, type RufousLogoLoaderProps, RufousTextContent, type RufousTextContentProps, RufousTextEditor, type MentionItemData as RufousTextEditorMentionItem, type RufousTextEditorProps, RufousThemeProvider, Select, type SelectProps, SidebarIcon, Skeleton, type SkeletonProps, Slide, type SlideProps, Slider, type SliderProps, Snackbar, type SnackbarProps, SoftSkillsIcon, type SortDirection, Stack, type StackProps, StandardButton, Step, StepButton, type StepButtonProps, StepContent, type StepContentProps, StepLabel, type StepLabelProps, type StepProps, Stepper, type StepperProps, SubmitButton, SubscribeIcon, SuspendUserIcon, Switch, type SwitchProps, type SxProp, Tab, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, TechnicalSkillsIcon, TextField, type TextFieldProps, TickIcon, TimerIcon, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, Tooltip, type TooltipProps, TrashIcon, Typography, type TypographyProps, UnArchivedIcon, UnsubscribeIcon, UploadIcon, UserAssignIcon, ViewIcon, WorkItemIcon, Zoom, type ZoomProps, transformLegacyTodos, useRufousTheme };
|
|
1728
|
+
export { APP_THEMES, Accordion, AccordionDetails, type AccordionDetailsProps, type AccordionProps, AccordionSummary, type AccordionSummaryProps, type Action, ActivateUserIcon, AddButton, AddressLookup, ArchivedIcon, AssignGroupIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BaseDialog, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CameraIcon, CancelButton, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, CircularProgressIcon, type CircularProgressIconProps, CloseIcon, Collapse, type CollapseProps, type Column, CopyIcon, DataGrid, type DataGridProps, DateField, type DateFieldProps, type DateFormatString, DateRangeField, type DateRangeFieldProps, type DateRangeValue, DifficultyAllIcon, DifficultyEasyIcon, DifficultyHardIcon, DifficultyMediumIcon, Divider, type DividerProps, DollarIcon, DownloadIcon, DownloadPdfIcon, Drawer, type DrawerProps, EditChatIcon, EditIcon, EngagementIcon, Fade, type FadeProps, FunctionIcon, Grid, type GridProps, Grow, type GrowProps, HelpOutlinedIcon, HierarchyIcon, IconButton, type IconButtonProps, ImageField, type ImageFieldProps, InactiveGroupIcon, IndustryIcon, InvoiceIcon, Link, type LinkProps, List, ListItem, ListItemButton, type ListItemButtonProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, LocationPinIcon, LogsIcon, Menu, MenuDivider, MenuItem, type MenuItemProps, MenuList, type MenuListProps, type MenuProps, MinExperienceIcon, NineDotMenuIcon, NotificationIcon, type NumberVariant, Paper, type PaperProps, PhoneField, type PhoneFieldProps, Popover, type PopoverProps, Popper, type PopperProps, ProjectIcon, QualificationsIcon, QuestionStatusAllIcon, QuestionStatusPrivateIcon, QuestionStatusPublicIcon, QuestionTypeAllIcon, QuestionTypeCodingIcon, QuestionTypeDescriptiveIcon, QuestionTypeMultipleIcon, QuestionTypeSingleIcon, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, RefreshIcon, ResendInviteIcon, RolesIcon, RufousAiIcon, RufousBirdIcon, RufousLauncherIcon, RufousLogoLoader, type RufousLogoLoaderProps, RufousTextContent, type RufousTextContentProps, RufousTextEditor, type MentionItemData as RufousTextEditorMentionItem, type RufousTextEditorProps, RufousThemeProvider, Select, type SelectProps, SidebarIcon, Skeleton, type SkeletonProps, Slide, type SlideProps, Slider, type SliderProps, Snackbar, type SnackbarProps, SoftSkillsIcon, type SortDirection, Stack, type StackProps, StandardButton, Step, StepButton, type StepButtonProps, StepContent, type StepContentProps, StepLabel, type StepLabelProps, type StepProps, Stepper, type StepperProps, SubmitButton, SubscribeIcon, SuspendUserIcon, Switch, type SwitchProps, type SxProp, Tab, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, TechnicalSkillsIcon, TextField, type TextFieldProps, TickIcon, TimerIcon, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, Tooltip, type TooltipProps, TrashIcon, Typography, type TypographyProps, UnArchivedIcon, UnsubscribeIcon, UploadIcon, UserAssignIcon, ViewIcon, WorkItemIcon, Zoom, type ZoomProps, transformLegacyTodos, useRufousTheme };
|
package/dist/main.d.ts
CHANGED
|
@@ -518,6 +518,7 @@ interface CheckboxProps {
|
|
|
518
518
|
|
|
519
519
|
declare const Checkbox: React.FC<CheckboxProps>;
|
|
520
520
|
|
|
521
|
+
type NumberVariant = 'integer' | 'decimal' | 'positive-integer' | 'positive-decimal';
|
|
521
522
|
interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
522
523
|
/** Label text shown for the input */
|
|
523
524
|
label?: string;
|
|
@@ -525,6 +526,16 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'si
|
|
|
525
526
|
variant?: 'outlined' | 'filled' | 'standard';
|
|
526
527
|
/** The size of the component */
|
|
527
528
|
size?: 'small' | 'medium';
|
|
529
|
+
/**
|
|
530
|
+
* Sub-variant for number inputs. Only applies when `type="number"`.
|
|
531
|
+
* - `integer`: whole numbers (blocks `.`)
|
|
532
|
+
* - `decimal`: floating point numbers
|
|
533
|
+
* - `positive-integer`: whole numbers ≥ 0
|
|
534
|
+
* - `positive-decimal`: floating point numbers ≥ 0
|
|
535
|
+
*
|
|
536
|
+
* All number variants block `e`, `E`, `+`, `-`.
|
|
537
|
+
*/
|
|
538
|
+
numberVariant?: NumberVariant;
|
|
528
539
|
/** The color of the component */
|
|
529
540
|
color?: 'primary' | 'secondary' | 'error' | 'success' | 'info' | 'warning';
|
|
530
541
|
/** If true, the label is displayed in an error state. */
|
|
@@ -1714,4 +1725,4 @@ interface MentionItemData {
|
|
|
1714
1725
|
shortName?: string;
|
|
1715
1726
|
}
|
|
1716
1727
|
|
|
1717
|
-
export { APP_THEMES, Accordion, AccordionDetails, type AccordionDetailsProps, type AccordionProps, AccordionSummary, type AccordionSummaryProps, type Action, ActivateUserIcon, AddButton, AddressLookup, ArchivedIcon, AssignGroupIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BaseDialog, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CameraIcon, CancelButton, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, CircularProgressIcon, type CircularProgressIconProps, CloseIcon, Collapse, type CollapseProps, type Column, CopyIcon, DataGrid, type DataGridProps, DateField, type DateFieldProps, type DateFormatString, DateRangeField, type DateRangeFieldProps, type DateRangeValue, DifficultyAllIcon, DifficultyEasyIcon, DifficultyHardIcon, DifficultyMediumIcon, Divider, type DividerProps, DollarIcon, DownloadIcon, DownloadPdfIcon, Drawer, type DrawerProps, EditChatIcon, EditIcon, EngagementIcon, Fade, type FadeProps, FunctionIcon, Grid, type GridProps, Grow, type GrowProps, HelpOutlinedIcon, HierarchyIcon, IconButton, type IconButtonProps, ImageField, type ImageFieldProps, InactiveGroupIcon, IndustryIcon, InvoiceIcon, Link, type LinkProps, List, ListItem, ListItemButton, type ListItemButtonProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, LocationPinIcon, LogsIcon, Menu, MenuDivider, MenuItem, type MenuItemProps, MenuList, type MenuListProps, type MenuProps, MinExperienceIcon, NineDotMenuIcon, NotificationIcon, Paper, type PaperProps, PhoneField, type PhoneFieldProps, Popover, type PopoverProps, Popper, type PopperProps, ProjectIcon, QualificationsIcon, QuestionStatusAllIcon, QuestionStatusPrivateIcon, QuestionStatusPublicIcon, QuestionTypeAllIcon, QuestionTypeCodingIcon, QuestionTypeDescriptiveIcon, QuestionTypeMultipleIcon, QuestionTypeSingleIcon, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, RefreshIcon, ResendInviteIcon, RolesIcon, RufousAiIcon, RufousBirdIcon, RufousLauncherIcon, RufousLogoLoader, type RufousLogoLoaderProps, RufousTextContent, type RufousTextContentProps, RufousTextEditor, type MentionItemData as RufousTextEditorMentionItem, type RufousTextEditorProps, RufousThemeProvider, Select, type SelectProps, SidebarIcon, Skeleton, type SkeletonProps, Slide, type SlideProps, Slider, type SliderProps, Snackbar, type SnackbarProps, SoftSkillsIcon, type SortDirection, Stack, type StackProps, StandardButton, Step, StepButton, type StepButtonProps, StepContent, type StepContentProps, StepLabel, type StepLabelProps, type StepProps, Stepper, type StepperProps, SubmitButton, SubscribeIcon, SuspendUserIcon, Switch, type SwitchProps, type SxProp, Tab, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, TechnicalSkillsIcon, TextField, type TextFieldProps, TickIcon, TimerIcon, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, Tooltip, type TooltipProps, TrashIcon, Typography, type TypographyProps, UnArchivedIcon, UnsubscribeIcon, UploadIcon, UserAssignIcon, ViewIcon, WorkItemIcon, Zoom, type ZoomProps, transformLegacyTodos, useRufousTheme };
|
|
1728
|
+
export { APP_THEMES, Accordion, AccordionDetails, type AccordionDetailsProps, type AccordionProps, AccordionSummary, type AccordionSummaryProps, type Action, ActivateUserIcon, AddButton, AddressLookup, ArchivedIcon, AssignGroupIcon, Autocomplete, type AutocompleteProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, BaseDialog, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, CameraIcon, CancelButton, Card, CardActions, type CardActionsProps, CardContent, type CardContentProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CircularProgress, CircularProgressIcon, type CircularProgressIconProps, CloseIcon, Collapse, type CollapseProps, type Column, CopyIcon, DataGrid, type DataGridProps, DateField, type DateFieldProps, type DateFormatString, DateRangeField, type DateRangeFieldProps, type DateRangeValue, DifficultyAllIcon, DifficultyEasyIcon, DifficultyHardIcon, DifficultyMediumIcon, Divider, type DividerProps, DollarIcon, DownloadIcon, DownloadPdfIcon, Drawer, type DrawerProps, EditChatIcon, EditIcon, EngagementIcon, Fade, type FadeProps, FunctionIcon, Grid, type GridProps, Grow, type GrowProps, HelpOutlinedIcon, HierarchyIcon, IconButton, type IconButtonProps, ImageField, type ImageFieldProps, InactiveGroupIcon, IndustryIcon, InvoiceIcon, Link, type LinkProps, List, ListItem, ListItemButton, type ListItemButtonProps, ListItemIcon, type ListItemIconProps, type ListItemProps, ListItemText, type ListItemTextProps, type ListProps, ListSubheader, type ListSubheaderProps, LocationPinIcon, LogsIcon, Menu, MenuDivider, MenuItem, type MenuItemProps, MenuList, type MenuListProps, type MenuProps, MinExperienceIcon, NineDotMenuIcon, NotificationIcon, type NumberVariant, Paper, type PaperProps, PhoneField, type PhoneFieldProps, Popover, type PopoverProps, Popper, type PopperProps, ProjectIcon, QualificationsIcon, QuestionStatusAllIcon, QuestionStatusPrivateIcon, QuestionStatusPublicIcon, QuestionTypeAllIcon, QuestionTypeCodingIcon, QuestionTypeDescriptiveIcon, QuestionTypeMultipleIcon, QuestionTypeSingleIcon, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Rating, type RatingProps, RefreshIcon, ResendInviteIcon, RolesIcon, RufousAiIcon, RufousBirdIcon, RufousLauncherIcon, RufousLogoLoader, type RufousLogoLoaderProps, RufousTextContent, type RufousTextContentProps, RufousTextEditor, type MentionItemData as RufousTextEditorMentionItem, type RufousTextEditorProps, RufousThemeProvider, Select, type SelectProps, SidebarIcon, Skeleton, type SkeletonProps, Slide, type SlideProps, Slider, type SliderProps, Snackbar, type SnackbarProps, SoftSkillsIcon, type SortDirection, Stack, type StackProps, StandardButton, Step, StepButton, type StepButtonProps, StepContent, type StepContentProps, StepLabel, type StepLabelProps, type StepProps, Stepper, type StepperProps, SubmitButton, SubscribeIcon, SuspendUserIcon, Switch, type SwitchProps, type SxProp, Tab, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, TechnicalSkillsIcon, TextField, type TextFieldProps, TickIcon, TimerIcon, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, Tooltip, type TooltipProps, TrashIcon, Typography, type TypographyProps, UnArchivedIcon, UnsubscribeIcon, UploadIcon, UserAssignIcon, ViewIcon, WorkItemIcon, Zoom, type ZoomProps, transformLegacyTodos, useRufousTheme };
|
package/dist/main.js
CHANGED
|
@@ -1574,6 +1574,25 @@ var Checkbox = ({
|
|
|
1574
1574
|
|
|
1575
1575
|
// lib/TextFields/TextField.tsx
|
|
1576
1576
|
import React68, { forwardRef as forwardRef3 } from "react";
|
|
1577
|
+
var NUMBER_BLOCKED_KEYS = ["e", "E", "+", "-"];
|
|
1578
|
+
var BLOCKED_KEYS_BY_VARIANT = {
|
|
1579
|
+
"integer": [...NUMBER_BLOCKED_KEYS, ".", ","],
|
|
1580
|
+
"decimal": [...NUMBER_BLOCKED_KEYS],
|
|
1581
|
+
"positive-integer": [...NUMBER_BLOCKED_KEYS, ".", ","],
|
|
1582
|
+
"positive-decimal": [...NUMBER_BLOCKED_KEYS]
|
|
1583
|
+
};
|
|
1584
|
+
var STEP_BY_VARIANT = {
|
|
1585
|
+
"integer": 1,
|
|
1586
|
+
"decimal": 0.1,
|
|
1587
|
+
"positive-integer": 1,
|
|
1588
|
+
"positive-decimal": 0.1
|
|
1589
|
+
};
|
|
1590
|
+
var MIN_BY_VARIANT = {
|
|
1591
|
+
"integer": void 0,
|
|
1592
|
+
"decimal": void 0,
|
|
1593
|
+
"positive-integer": 0,
|
|
1594
|
+
"positive-decimal": 0
|
|
1595
|
+
};
|
|
1577
1596
|
var TextField = forwardRef3(({
|
|
1578
1597
|
label,
|
|
1579
1598
|
name,
|
|
@@ -1595,6 +1614,7 @@ var TextField = forwardRef3(({
|
|
|
1595
1614
|
fullWidth = false,
|
|
1596
1615
|
slotProps,
|
|
1597
1616
|
InputProps,
|
|
1617
|
+
numberVariant,
|
|
1598
1618
|
...props
|
|
1599
1619
|
}, ref) => {
|
|
1600
1620
|
const sxClass = useSx(sx);
|
|
@@ -1650,6 +1670,11 @@ var TextField = forwardRef3(({
|
|
|
1650
1670
|
};
|
|
1651
1671
|
const handleKeyDown = (e) => {
|
|
1652
1672
|
if (type === "number") {
|
|
1673
|
+
const blockedKeys = numberVariant ? BLOCKED_KEYS_BY_VARIANT[numberVariant] : NUMBER_BLOCKED_KEYS;
|
|
1674
|
+
if (blockedKeys.includes(e.key)) {
|
|
1675
|
+
e.preventDefault();
|
|
1676
|
+
return;
|
|
1677
|
+
}
|
|
1653
1678
|
if (e.key === "ArrowUp") {
|
|
1654
1679
|
e.preventDefault();
|
|
1655
1680
|
if (internalRef.current) {
|
|
@@ -1683,6 +1708,8 @@ var TextField = forwardRef3(({
|
|
|
1683
1708
|
required,
|
|
1684
1709
|
disabled,
|
|
1685
1710
|
readOnly,
|
|
1711
|
+
step: type === "number" && numberVariant ? STEP_BY_VARIANT[numberVariant] : void 0,
|
|
1712
|
+
min: type === "number" && numberVariant ? MIN_BY_VARIANT[numberVariant] : void 0,
|
|
1686
1713
|
...slotProps?.input,
|
|
1687
1714
|
...props
|
|
1688
1715
|
}
|