@geckoui/geckoui 1.1.2 → 1.2.0-beta.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/dist/index.css ADDED
@@ -0,0 +1,16 @@
1
+ /* src/components/RHF/RHFCounterInput/RHFCounterInput.scss */
2
+ .GeckoUIRHFCounterInput--error .GeckoUICounterInput__button,
3
+ .GeckoUIRHFCounterInput--error .GeckoUICounterInput__input {
4
+ --tw-border-opacity: 1;
5
+ border-color: rgb(239 68 68 / var(--tw-border-opacity, 1));
6
+ }
7
+ .GeckoUIRHFCounterInput--error:hover .GeckoUICounterInput__button,
8
+ .GeckoUIRHFCounterInput--error:hover .GeckoUICounterInput__input {
9
+ --tw-border-opacity: 1;
10
+ border-color: rgb(220 38 38 / var(--tw-border-opacity, 1));
11
+ }
12
+ .GeckoUIRHFCounterInput--error:focus-within .GeckoUICounterInput__button,
13
+ .GeckoUIRHFCounterInput--error:focus-within .GeckoUICounterInput__input {
14
+ --tw-border-opacity: 1;
15
+ border-color: rgb(239 68 68 / var(--tw-border-opacity, 1));
16
+ }
package/dist/index.d.mts CHANGED
@@ -1,8 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { RefObject, SVGProps, ReactNode, FC, InputHTMLAttributes, JSX, ForwardedRef, LabelHTMLAttributes, PropsWithChildren, ButtonHTMLAttributes, DetailedHTMLProps, ReactElement, RefCallback, Dispatch, SetStateAction, HtmlHTMLAttributes, ChangeEvent, HTMLAttributes, JSXElementConstructor } from 'react';
3
- import * as unified from 'unified';
4
- import * as hast from 'hast';
5
- import * as mdast from 'mdast';
2
+ import react__default, { RefObject, InputHTMLAttributes, FC, ReactNode, JSX, ForwardedRef, LabelHTMLAttributes, PropsWithChildren, ButtonHTMLAttributes, DetailedHTMLProps, ReactElement, RefCallback, Dispatch, SetStateAction, HtmlHTMLAttributes, ChangeEvent, HTMLAttributes, JSXElementConstructor, SVGProps } from 'react';
6
3
  import { ControllerProps, Control, FieldValues, ControllerRenderProps, ControllerFieldState, UseFormStateReturn } from 'react-hook-form';
7
4
  import { Placement, Strategy, useFloating } from '@floating-ui/react';
8
5
  import { TextareaAutosizeProps } from 'react-textarea-autosize';
@@ -11,7 +8,6 @@ import { SwitchProps as SwitchProps$1, MenuItemsProps as MenuItemsProps$1, MenuB
11
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
12
9
  import { ToasterProps } from 'sonner';
13
10
  export { toast } from 'sonner';
14
- import { MermaidConfig } from 'mermaid';
15
11
 
16
12
  /**
17
13
  * Reuseable hook to detect clicks outside of a ref element that is passed as an argument
@@ -242,93 +238,6 @@ declare const usePreventDefault: () => {
242
238
  * */
243
239
  declare const useEscListener: (callback?: () => void) => void;
244
240
 
245
- type MermaidDiagramBaseProps = Omit<SVGProps<SVGSVGElement>, "id" | "viewBox" | "dangerouslySetInnerHTML">;
246
- interface MermaidDiagramProps extends MermaidDiagramBaseProps {
247
- /**
248
- * Placeholder component to show when the diagram is loading.
249
- * */
250
- placeholder?: ReactNode | FC;
251
- /**
252
- * Error component to show when the diagram fails to render.
253
- * If not provided, a simple error message will be shown.
254
- *
255
- * ```js
256
- * <MermaidDiagram error={({ message }) => ...}>
257
- * ...
258
- * </MermaidDiagram>
259
- * ```
260
- * */
261
- renderError?: ReactNode | FC<{
262
- message: string;
263
- }>;
264
- /**
265
- * Mermaid template to render the diagram.
266
- * */
267
- children: string;
268
- }
269
-
270
- /**
271
- * useMermaidDiagram is a hook that takes a mermaid template and returns a React component that renders the diagram.
272
- * It also handle `loading` and `error` states. You rarely need to use this hook directly, use `MermaidDiagram` component instead.
273
- *
274
- * @example
275
- *
276
- * ```js
277
- * const template = `
278
- * graph TD;
279
- * A-->B;
280
- * A-->C;
281
- * B-->D;
282
- * C-->D;
283
- * `;
284
- *
285
- * const { loading, error, Diagram } = useMermaidDiagram(template);
286
- *
287
- * if (loading) return <p>Loading...</p>;
288
- *
289
- * if (error) return <p>Error: {error}</p>;
290
- *
291
- * return <Diagram />;
292
- * ```
293
- * */
294
- declare const useMermaidDiagram: (template: string) => {
295
- loading: boolean;
296
- error: string;
297
- Diagram: react.FC<MermaidDiagramBaseProps> | null;
298
- };
299
-
300
- interface MarkdownProcessorOptions {
301
- /**
302
- * Enable HTML sanitization to prevent XSS attacks.
303
- * Only set to false when you 100% trust the source.
304
- * @default true
305
- */
306
- sanitize?: boolean;
307
- }
308
- declare const createMarkdownProcessor: (options?: MarkdownProcessorOptions) => unified.Processor<mdast.Root, mdast.Root, hast.Root, hast.Root, string>;
309
-
310
- interface UseMarkdownOptions extends MarkdownProcessorOptions {
311
- /**
312
- * Render the markdown asynchronously for large markdown content.
313
- * Not intended for network requests - use for processing large markdown strings.
314
- * @default false
315
- * */
316
- async?: boolean;
317
- }
318
- declare const useMarkdown: (str: string, options?: UseMarkdownOptions) => {
319
- content: string;
320
- error?: undefined;
321
- loading?: undefined;
322
- } | {
323
- error: string;
324
- content?: undefined;
325
- loading?: undefined;
326
- } | {
327
- loading: boolean;
328
- error: string;
329
- content: string;
330
- };
331
-
332
241
  interface RHFBaseProps {
333
242
  /**
334
243
  * Name of the input field.(required)
@@ -396,6 +305,47 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "typ
396
305
  */
397
306
  declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
398
307
 
308
+ interface CounterInputSizeMap {
309
+ sm: unknown;
310
+ md: unknown;
311
+ lg: unknown;
312
+ }
313
+ interface CounterInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange"> {
314
+ /** Current numeric value */
315
+ value: number;
316
+ /** Callback when value changes */
317
+ onChange: (value: number) => void;
318
+ /** Minimum allowed value */
319
+ min?: number;
320
+ /** Maximum allowed value */
321
+ max?: number;
322
+ /** Increment/decrement step (default: 1) */
323
+ step?: number;
324
+ /** Size variant (default: 'md') */
325
+ size?: keyof CounterInputSizeMap;
326
+ /** Disable the entire component */
327
+ disabled?: boolean;
328
+ /** Read-only mode - buttons and input are non-interactive */
329
+ readOnly?: boolean;
330
+ /** Allow typing in input field (default: false) */
331
+ editable?: boolean;
332
+ /** Class name for the input element */
333
+ inputClassName?: string;
334
+ /** Class name for the buttons */
335
+ buttonClassName?: string;
336
+ }
337
+
338
+ /**
339
+ * A numeric input component with increment/decrement buttons.
340
+ *
341
+ * @example
342
+ * ```tsx
343
+ * const [count, setCount] = useState(0);
344
+ * <CounterInput value={count} onChange={setCount} min={0} max={10} />
345
+ * ```
346
+ */
347
+ declare const CounterInput: react.ForwardRefExoticComponent<CounterInputProps & react.RefAttributes<HTMLInputElement>>;
348
+
399
349
  type DateFormat$2 = "DD/MM/YYYY" | "MM/DD/YYYY" | "YYYY/MM/DD";
400
350
  interface BaseDateInputProps {
401
351
  value?: string | null;
@@ -1128,6 +1078,22 @@ interface RHFCheckboxProps extends RHFBaseProps, Omit<CheckboxProps, "name" | "v
1128
1078
  */
1129
1079
  declare const RHFCheckbox: FC<RHFCheckboxProps>;
1130
1080
 
1081
+ interface RHFCounterInputProps extends RHFBaseProps, Omit<CounterInputProps, "name" | "value" | "onChange"> {
1082
+ onChange?: (value: number) => void;
1083
+ }
1084
+
1085
+ /**
1086
+ * A numeric counter input component integrated with React Hook Form.
1087
+ *
1088
+ * @example
1089
+ * ```tsx
1090
+ * <FormProvider {...methods}>
1091
+ * <RHFCounterInput name="quantity" min={0} max={10} />
1092
+ * </FormProvider>
1093
+ * ```
1094
+ */
1095
+ declare const RHFCounterInput: FC<RHFCounterInputProps>;
1096
+
1131
1097
  interface InputTransformer {
1132
1098
  input?: (value: string) => string;
1133
1099
  output?: (value: string) => string;
@@ -3536,35 +3502,9 @@ declare const ConfirmDialog: {
3536
3502
  };
3537
3503
 
3538
3504
  interface GeckoUIPortalProps {
3539
- mermaidConfig?: MermaidConfig;
3540
3505
  toastOptions?: ToasterProps;
3541
3506
  }
3542
3507
 
3543
- /**
3544
- * GeckoUIPortal is a container component that wraps the Toast, ConfirmDialog, and other components that need to mount at the top level of the application.
3545
- *
3546
- * Please refer to [MermaidOptions](https://mermaid.js.org/config/schema-docs/config.html#mermaid-config-schema) to see the available options for the `mermaidOptions` prop.
3547
- * @example
3548
- *
3549
- * ```js
3550
- * import { GeckoUIPortal } from '@geckoui/geckoui';
3551
- *
3552
- * renderApp(
3553
- * <>
3554
- * <App />
3555
- * <GeckoUIPortal
3556
- * toastOptions={{
3557
- * position: 'bottom-right',
3558
- * ... other options
3559
- * }},
3560
- * mermaidConfig={{
3561
- * startOnLoad: true,
3562
- * }}
3563
- * />
3564
- * </>
3565
- * )
3566
- * ```
3567
- * */
3568
3508
  declare const GeckoUIPortal: FC<GeckoUIPortalProps>;
3569
3509
 
3570
3510
  /** Extensible placement map - To allow module augmentation */
@@ -3858,150 +3798,6 @@ declare namespace Dropdown {
3858
3798
  var displayName: string;
3859
3799
  }
3860
3800
 
3861
- /**
3862
- * MermaidDiagram renders diagrams from Mermaid syntax with automatic loading and error state management.
3863
- * Supports flowcharts, sequence diagrams, class diagrams, and all other Mermaid diagram types.
3864
- * Provides custom placeholder and error rendering options.
3865
- *
3866
- * @example
3867
- * Flowchart for user workflow:
3868
- *
3869
- * ```tsx
3870
- * <MermaidDiagram>
3871
- * {`
3872
- * flowchart LR
3873
- * Start[User Login] --> Auth{Authenticated?}
3874
- * Auth -->|Yes| Dashboard[Show Dashboard]
3875
- * Auth -->|No| Login[Login Page]
3876
- * Login --> Auth
3877
- * `}
3878
- * </MermaidDiagram>
3879
- * ```
3880
- *
3881
- * @example
3882
- * Sequence diagram with custom loading:
3883
- *
3884
- * ```tsx
3885
- * <MermaidDiagram
3886
- * placeholder={<div className="animate-pulse">Loading diagram...</div>}
3887
- * renderError={(props) => <ErrorBoundary message={props.message} />}
3888
- * >
3889
- * {`
3890
- * sequenceDiagram
3891
- * participant Client
3892
- * participant API
3893
- * participant Database
3894
- * Client->>API: Request Data
3895
- * API->>Database: Query
3896
- * Database-->>API: Results
3897
- * API-->>Client: Response
3898
- * `}
3899
- * </MermaidDiagram>
3900
- * ```
3901
- *
3902
- * @example
3903
- * Class diagram for documentation:
3904
- *
3905
- * ```tsx
3906
- * <MermaidDiagram className="border rounded-lg p-4">
3907
- * {`
3908
- * classDiagram
3909
- * class User {
3910
- * +String email
3911
- * +String name
3912
- * +login()
3913
- * +logout()
3914
- * }
3915
- * class Admin {
3916
- * +manageUsers()
3917
- * }
3918
- * User <|-- Admin
3919
- * `}
3920
- * </MermaidDiagram>
3921
- * ```
3922
- *
3923
- * @see https://mermaid.js.org/ for diagram syntax reference
3924
- */
3925
- declare const MermaidDiagram: FC<MermaidDiagramProps>;
3926
-
3927
- interface MarkdownBaseProps<T extends keyof JSX.IntrinsicElements> extends UseMarkdownOptions {
3928
- /**
3929
- * HTML tag to render the markdown content.
3930
- * @default "div"
3931
- */
3932
- as?: T;
3933
- /**
3934
- * Placeholder component to show while async rendering is in progress.
3935
- * Will be ignored if async is false.
3936
- */
3937
- renderPlaceholder?: ReactNode | FC;
3938
- /**
3939
- * Error component to show when the markdown fails to render.
3940
- * If not provided, a simple error message will be shown.
3941
- */
3942
- renderError?: ReactNode | FC<{
3943
- message: string;
3944
- }>;
3945
- /**
3946
- * Markdown content to render.
3947
- */
3948
- children: string;
3949
- }
3950
- type InferredProps<T extends keyof JSX.IntrinsicElements> = JSX.IntrinsicElements[T] & {
3951
- className?: string;
3952
- };
3953
- type MarkdownProps<T extends keyof JSX.IntrinsicElements = "div"> = MarkdownBaseProps<T> & Omit<InferredProps<T>, "children">;
3954
-
3955
- /**
3956
- * Markdown renders formatted markdown text as HTML with support for both synchronous
3957
- * and asynchronous rendering. Includes built-in loading states, error handling, and
3958
- * HTML sanitization enabled by default for security.
3959
- *
3960
- * @example
3961
- * Basic usage (synchronous rendering with sanitization enabled by default):
3962
- *
3963
- * ```tsx
3964
- * <Markdown className="prose">{docs}</Markdown>
3965
- * ```
3966
- *
3967
- * @example
3968
- * Async rendering for large markdown content (not for network requests):
3969
- *
3970
- * ```tsx
3971
- * const [largeContent, setLargeContent] = useState('');
3972
- *
3973
- * <Markdown
3974
- * async
3975
- * renderPlaceholder={<Spinner />}
3976
- * renderError={(props) => <Alert variant="error">{props.message}</Alert>}
3977
- * >
3978
- * {largeContent}
3979
- * </Markdown>
3980
- * ```
3981
- *
3982
- * @example
3983
- * Disabling HTML sanitization (⚠️ WARNING: Only use when you 100% trust the source):
3984
- *
3985
- * ```tsx
3986
- * <Markdown sanitize={false} as="article">
3987
- * {trustedMarkdown}
3988
- * </Markdown>
3989
- * ```
3990
- *
3991
- * @example
3992
- * Using with anchor tag and href prop:
3993
- *
3994
- * ```tsx
3995
- * <Markdown as="a" href="https://example.com" target="_blank">
3996
- * {linkMarkdown}
3997
- * </Markdown>
3998
- * ```
3999
- */
4000
- declare function Markdown<T extends keyof JSX.IntrinsicElements = "div">({ children, renderError, renderPlaceholder, as, async, className, sanitize, ...props }: MarkdownProps<T>): react_jsx_runtime.JSX.Element;
4001
- declare namespace Markdown {
4002
- var displayName: string;
4003
- }
4004
-
4005
3801
  type BaseIconProps = SVGProps<SVGSVGElement>;
4006
3802
 
4007
3803
  /**
@@ -4073,4 +3869,4 @@ declare class FileOnlyPickerHandler extends BaseFilePickerHandler {
4073
3869
 
4074
3870
  declare const FilePicker: typeof FileOnlyPickerHandler;
4075
3871
 
4076
- export { type ActionsArgs, Alert, type AlertProps, type AlertVariantMap, BaseDateRangeInput, type BaseDateRangeInputProps, type BaseSelectProps, Button, type ButtonColorMap, type ButtonProps, type ButtonSizeMap, type ButtonVariantMap, _default as Calendar, type CalendarActiveProps, type CalendarOverload, type CalendarProps, type CalendarRangeModeProps, type CalendarRef, type CalendarSingleModeProps, CalendarType, Checkbox, type CheckboxProps, ConfirmDialog, type ConfirmDialogActionsArgs, type ConfirmDialogContentProps, type ConfirmDialogOptions, type CustomSelectOptionArgs, type CustomSelectOptionBaseArgs, type DataAttributeProps, type DateFormat$1 as DateFormat, DateInput, type DateInputProps, type DateRange, DateRangeInput, type DateRangeInputProps, type DayCellRenderProps, Dialog, type DialogContentProps, type DialogOptions, Drawer, type DrawerPlacementMap, type DrawerProps, Dropdown, type DropdownClassName, type DropdownItem, type DropdownProps, FilePicker, type FilePickerFile, type FilePickerOptions, type FileSize, type FileWithPreview, type FocusedOption, GeckoUIPortal, type GeckoUIPortalProps, Input, InputError, type InputErrorProps, type InputProps, Label, type LabelProps, LoadingButton, type LoadingButtonProps, Markdown, type MarkdownBaseProps, type MarkdownProcessorOptions, type MarkdownProps, Menu, MenuButton, type MenuButtonProps, MenuHeading, MenuItem, type MenuItemProps, MenuItems, type MenuItemsProps, MenuSection, MenuSeparator, MermaidDiagram, type MermaidDiagramBaseProps, type MermaidDiagramProps, type MultiSelectProps, type MultiSelectTriggerProps, type MultiSelectTriggerRenderProps, OTPInput, type OTPInputProps, type OpenFilePickerFn, type OpenFilePickerOptions, Pagination, type PaginationProps, type RHFBaseProps, RHFCheckbox, type RHFCheckboxProps, RHFController, RHFCurrencyInput, type RHFCurrencyInputProps, RHFDateInput, type RHFDateInputProps, RHFDateRangeInput, type RHFDateRangeInputProps, RHFError, type RHFErrorProps, type RHFErrorRenderProps, RHFFileInput, type RHFFileInputProps, RHFFilePicker, type RHFFilePickerBaseProps, type RHFFilePickerProps, type RHFFilePickerRenderProps, type RHFFilePickerRendererProps, RHFInput, RHFInputGroup, type RHFInputGroupProps, type RHFInputProps, RHFNumberInput, type RHFNumberInputProps, RHFOTPInput, type RHFOTPInputProps, RHFRadio, type RHFRadioProps, type RHFRenderArgs, RHFSelect, type RHFSelectOverload, type RHFSelectProps, RHFSwitch, type RHFSwitchProps, RHFTextarea, type RHFTextareaProps, Radio, type RadioProps, type ReactTag, Select, SelectConsumer, type SelectConsumerProps, type SelectContextProps, SelectDropdownSearch, SelectEmpty, type SelectEmptyProps, SelectOption, type SelectOptionConfig, type SelectOptionElement, type SelectOptionProps, type SelectOverload, type SelectProps, SelectTrigger, type SelectTriggerBaseRenderProps, type SelectTriggerOverload, type SelectTriggerProps, type SelectionMode, type SingleSelectProps, type SingleSelectTriggerProps, type SingleSelectTriggerRenderProps, Spinner, Switch, type SwitchProps, type SwitchSizeMap, Textarea, type TextareaProps, Tooltip, type TooltipProps, type UseFilePickerOptions, type UseFilePickerReturn, createMarkdownProcessor, fileToUInt8Array, getDataAttributes, hasDisplayName, isAsyncFn, isTwoFileEqualByFileContent, toThousandsSeparatorFormat, useClickOutside, useEscListener, useFilePicker, useMarkdown, useMermaidDiagram, usePreventDefault, useSelect };
3872
+ export { type ActionsArgs, Alert, type AlertProps, type AlertVariantMap, BaseDateRangeInput, type BaseDateRangeInputProps, type BaseSelectProps, Button, type ButtonColorMap, type ButtonProps, type ButtonSizeMap, type ButtonVariantMap, _default as Calendar, type CalendarActiveProps, type CalendarOverload, type CalendarProps, type CalendarRangeModeProps, type CalendarRef, type CalendarSingleModeProps, CalendarType, Checkbox, type CheckboxProps, ConfirmDialog, type ConfirmDialogActionsArgs, type ConfirmDialogContentProps, type ConfirmDialogOptions, CounterInput, type CounterInputProps, type CounterInputSizeMap, type CustomSelectOptionArgs, type CustomSelectOptionBaseArgs, type DataAttributeProps, type DateFormat$1 as DateFormat, DateInput, type DateInputProps, type DateRange, DateRangeInput, type DateRangeInputProps, type DayCellRenderProps, Dialog, type DialogContentProps, type DialogOptions, Drawer, type DrawerPlacementMap, type DrawerProps, Dropdown, type DropdownClassName, type DropdownItem, type DropdownProps, FilePicker, type FilePickerFile, type FilePickerOptions, type FileSize, type FileWithPreview, type FocusedOption, GeckoUIPortal, type GeckoUIPortalProps, Input, InputError, type InputErrorProps, type InputProps, Label, type LabelProps, LoadingButton, type LoadingButtonProps, Menu, MenuButton, type MenuButtonProps, MenuHeading, MenuItem, type MenuItemProps, MenuItems, type MenuItemsProps, MenuSection, MenuSeparator, type MultiSelectProps, type MultiSelectTriggerProps, type MultiSelectTriggerRenderProps, OTPInput, type OTPInputProps, type OpenFilePickerFn, type OpenFilePickerOptions, Pagination, type PaginationProps, type RHFBaseProps, RHFCheckbox, type RHFCheckboxProps, RHFController, RHFCounterInput, type RHFCounterInputProps, RHFCurrencyInput, type RHFCurrencyInputProps, RHFDateInput, type RHFDateInputProps, RHFDateRangeInput, type RHFDateRangeInputProps, RHFError, type RHFErrorProps, type RHFErrorRenderProps, RHFFileInput, type RHFFileInputProps, RHFFilePicker, type RHFFilePickerBaseProps, type RHFFilePickerProps, type RHFFilePickerRenderProps, type RHFFilePickerRendererProps, RHFInput, RHFInputGroup, type RHFInputGroupProps, type RHFInputProps, RHFNumberInput, type RHFNumberInputProps, RHFOTPInput, type RHFOTPInputProps, RHFRadio, type RHFRadioProps, type RHFRenderArgs, RHFSelect, type RHFSelectOverload, type RHFSelectProps, RHFSwitch, type RHFSwitchProps, RHFTextarea, type RHFTextareaProps, Radio, type RadioProps, type ReactTag, Select, SelectConsumer, type SelectConsumerProps, type SelectContextProps, SelectDropdownSearch, SelectEmpty, type SelectEmptyProps, SelectOption, type SelectOptionConfig, type SelectOptionElement, type SelectOptionProps, type SelectOverload, type SelectProps, SelectTrigger, type SelectTriggerBaseRenderProps, type SelectTriggerOverload, type SelectTriggerProps, type SelectionMode, type SingleSelectProps, type SingleSelectTriggerProps, type SingleSelectTriggerRenderProps, Spinner, Switch, type SwitchProps, type SwitchSizeMap, Textarea, type TextareaProps, Tooltip, type TooltipProps, type UseFilePickerOptions, type UseFilePickerReturn, fileToUInt8Array, getDataAttributes, hasDisplayName, isAsyncFn, isTwoFileEqualByFileContent, toThousandsSeparatorFormat, useClickOutside, useEscListener, useFilePicker, usePreventDefault, useSelect };