@max-ts/kit 0.27.0 → 0.27.1

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/lib/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
1
  export * from './components';
2
+ export * from './form';
3
+ export * from './hooks';
4
+ export * from './theme';
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/lib/index.mjs CHANGED
@@ -27,6 +27,7 @@ import { Indicator, Item as react_radio_group_Item, Root as react_radio_group_Ro
27
27
  import { Slider } from "@base-ui/react/slider";
28
28
  import { Content as react_select_Content, Group as react_select_Group, Icon, Item as react_select_Item, ItemIndicator, ItemText, Label as react_select_Label, Portal as react_select_Portal, Root as react_select_Root, ScrollDownButton, ScrollUpButton, Separator as react_select_Separator, Trigger as react_select_Trigger, Value as react_select_Value, Viewport } from "@radix-ui/react-select";
29
29
  import { Content as react_tabs_Content, List as react_tabs_List, Tabs, Trigger as react_tabs_Trigger } from "@radix-ui/react-tabs";
30
+ import { Controller, FormProvider, useController, useFieldArray, useForm, useFormContext, useWatch } from "react-hook-form";
30
31
  import * as __rspack_external_react from "react";
31
32
  var __webpack_require__ = {};
32
33
  (()=>{
@@ -630,7 +631,7 @@ const Calendar = ({ className, classNames, showOutsideDays = true, ...props })=>
630
631
  },
631
632
  ...props
632
633
  });
633
- var theme_css_theme = {
634
+ var theme = {
634
635
  colors: {
635
636
  primary: 'var(--colors-primary)',
636
637
  secondary: 'var(--colors-secondary)',
@@ -707,6 +708,9 @@ var theme_css_theme = {
707
708
  lg: 'var(--borderRadius-lg)'
708
709
  }
709
710
  };
711
+ const negativeSpacing = (...keys)=>keys.map((key)=>`calc(-1 * ${theme.spacing[key]})`).join(' ');
712
+ const spacing = (...keys)=>keys.map((key)=>theme.spacing[key]).join(' ');
713
+ const calculateSize = (value)=>'number' == typeof value ? `${value}px` : value;
710
714
  var card_css_content = 'style__oyalw04';
711
715
  var card_css_description = 'style__oyalw03';
712
716
  var card_css_footer = 'style__oyalw05';
@@ -715,7 +719,7 @@ var card_css_root = 'style__oyalw00';
715
719
  var card_css_title = 'style__oyalw02';
716
720
  const Card = ({ className, elevation = 2, ...props })=>/*#__PURE__*/ jsx("div", {
717
721
  style: {
718
- boxShadow: theme_css_theme.elevation[elevation]
722
+ boxShadow: theme.elevation[elevation]
719
723
  },
720
724
  className: clsx(card_css_root, className),
721
725
  ...props
@@ -2928,19 +2932,19 @@ const NotificationContainer = ({ position = 'bottomRight', ...props })=>/*#__PUR
2928
2932
  icons: {
2929
2933
  error: /*#__PURE__*/ jsx(OctagonAlert, {
2930
2934
  size: 20,
2931
- color: theme_css_theme.colors.error
2935
+ color: theme.colors.error
2932
2936
  }),
2933
2937
  success: /*#__PURE__*/ jsx(CircleCheck, {
2934
2938
  size: 20,
2935
- color: theme_css_theme.colors.success
2939
+ color: theme.colors.success
2936
2940
  }),
2937
2941
  warning: /*#__PURE__*/ jsx(TriangleAlert, {
2938
2942
  size: 20,
2939
- color: theme_css_theme.colors.warning
2943
+ color: theme.colors.warning
2940
2944
  }),
2941
2945
  info: /*#__PURE__*/ jsx(Info, {
2942
2946
  size: 20,
2943
- color: theme_css_theme.colors.info
2947
+ color: theme.colors.info
2944
2948
  })
2945
2949
  },
2946
2950
  position: NOTIFICATION_POSITIONS[position],
@@ -3520,7 +3524,7 @@ const RadioGroupItem = ({ className, label, ...props })=>/*#__PURE__*/ jsxs("div
3520
3524
  })
3521
3525
  ]
3522
3526
  });
3523
- var control = 'style__h9oy581';
3527
+ var styles_css_control = 'style__h9oy581';
3524
3528
  var styles_css_range = 'style__h9oy583';
3525
3529
  var Slider_styles_css_root = 'style__h9oy580';
3526
3530
  var styles_css_thumb = 'style__h9oy584';
@@ -3557,7 +3561,7 @@ function Slider_Slider({ className, defaultValue, value, min = 0, max = 100, onV
3557
3561
  },
3558
3562
  ...props,
3559
3563
  children: /*#__PURE__*/ jsxs(Slider.Control, {
3560
- className: control,
3564
+ className: styles_css_control,
3561
3565
  children: [
3562
3566
  /*#__PURE__*/ jsx(Slider.Track, {
3563
3567
  "data-slot": "slider-track",
@@ -4454,4 +4458,53 @@ const ToggleGroup = ({ value, onChange, options, size, className, label, multipl
4454
4458
  ]
4455
4459
  });
4456
4460
  };
4457
- export { Accordion_Accordion as Accordion, AlertDialog_AlertDialog as AlertDialog, Avatar_Avatar as Avatar, Badge_Badge as Badge, Breadcrumb, ButtonGroup, Button_Button as Button, Button_buttonSizes as buttonSizes, Button_buttonVariants as buttonVariants, Calendar, Card, Carousel, Checkbox_Checkbox as Checkbox, CircularProgress, Collapsible_Collapsible as Collapsible, ConfirmAction, ContentState, CopyTypography, DEFAULT_SEPARATOR, DEFAULT_SYMBOL, DESCRIPTION_ROOT_CLASSNAME, DashboardLayout, DataGrid, DataGridActionCell, DataGridSortHeader, DataList, DatePicker, Description_Description as Description, Dialog_Dialog as Dialog, Drawer_Drawer as Drawer, DropdownMenu, Empty, ImageCarousel, Image_Image as Image, Input, InputOTP, Label_Label as Label, MaskField, NOTIFICATION_POSITIONS, NOTIFY_CLASSNAME, Notification, NotificationContainer, OverflowTypography, PageLayout, Pagination, PeriodPicker, Placeholder, Popover_Popover as Popover, RadioGroupItem, RadioGroup_RadioGroup as RadioGroup, RangeInput, ScrollTopButton, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sheet, Sidebar_Sidebar as Sidebar, Slider_Slider as Slider, Tabs_Tabs as Tabs, TextField, ToggleGroup, Tooltip, Typography, alignments, badgeVariants, colors, constants_NotificationVariantTypes as NotificationVariantTypes, createHandle, displays, notification, transforms, useDashboard, useSidebar, variants, weights };
4461
+ const Form = ({ form, children, ...props })=>/*#__PURE__*/ jsx(FormProvider, {
4462
+ ...form,
4463
+ children: /*#__PURE__*/ jsx("form", {
4464
+ noValidate: true,
4465
+ ...props,
4466
+ children: children
4467
+ })
4468
+ });
4469
+ function FormMaskField({ name, control, ...props }) {
4470
+ return /*#__PURE__*/ jsx(Controller, {
4471
+ control: control,
4472
+ name: name,
4473
+ render: ({ field, fieldState })=>/*#__PURE__*/ jsx(MaskField, {
4474
+ ...props,
4475
+ ...field,
4476
+ error: !!fieldState.error,
4477
+ helperText: fieldState.error?.message
4478
+ })
4479
+ });
4480
+ }
4481
+ const useForm_useForm = ({ mode = 'onBlur', ...params } = {})=>useForm({
4482
+ ...params,
4483
+ mode
4484
+ });
4485
+ const FormSubmitButton = ({ children, isLoading, ...props })=>{
4486
+ const { formState } = useFormContext();
4487
+ return /*#__PURE__*/ jsx(Button_Button, {
4488
+ type: "submit",
4489
+ isLoading: isLoading || formState.isSubmitting,
4490
+ ...props,
4491
+ children: children
4492
+ });
4493
+ };
4494
+ function FormTextField({ name, control, gridArea, ...props }) {
4495
+ return /*#__PURE__*/ jsx(Controller, {
4496
+ control: control,
4497
+ name: name,
4498
+ render: ({ field, fieldState })=>/*#__PURE__*/ jsx(TextField, {
4499
+ ...props,
4500
+ ...field,
4501
+ style: {
4502
+ gridArea
4503
+ },
4504
+ value: field.value || '',
4505
+ error: !!fieldState.error,
4506
+ helperText: fieldState.error?.message
4507
+ })
4508
+ });
4509
+ }
4510
+ export { Accordion_Accordion as Accordion, AlertDialog_AlertDialog as AlertDialog, Avatar_Avatar as Avatar, Badge_Badge as Badge, Breadcrumb, ButtonGroup, Button_Button as Button, Button_buttonSizes as buttonSizes, Button_buttonVariants as buttonVariants, Calendar, Card, Carousel, Checkbox_Checkbox as Checkbox, CircularProgress, Collapsible_Collapsible as Collapsible, ConfirmAction, ContentState, Controller as FormController, CopyTypography, DEFAULT_SEPARATOR, DEFAULT_SYMBOL, DESCRIPTION_ROOT_CLASSNAME, DashboardLayout, DataGrid, DataGridActionCell, DataGridSortHeader, DataList, DatePicker, Description_Description as Description, Dialog_Dialog as Dialog, Drawer_Drawer as Drawer, DropdownMenu, Empty, Form, FormMaskField, FormProvider, FormSubmitButton, FormTextField, ImageCarousel, Image_Image as Image, Input, InputOTP, Label_Label as Label, MaskField, NOTIFICATION_POSITIONS, NOTIFY_CLASSNAME, Notification, NotificationContainer, OverflowTypography, PageLayout, Pagination, PeriodPicker, Placeholder, Popover_Popover as Popover, RadioGroupItem, RadioGroup_RadioGroup as RadioGroup, RangeInput, ScrollTopButton, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sheet, Sidebar_Sidebar as Sidebar, Slider_Slider as Slider, Tabs_Tabs as Tabs, TextField, ToggleGroup, Tooltip, Typography, alignments, badgeVariants, calculateSize, colors, constants_NotificationVariantTypes as NotificationVariantTypes, createHandle, displays, negativeSpacing, notification, spacing, theme, transforms, useController as useFormController, useDashboard, useFieldArray as useFormFieldArray, useFormContext, useForm_useForm as useForm, useIsMobile, useOverflowed, useSidebar, useWatch as useFormWatch, variants, weights };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@max-ts/kit",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.ts",