@segmentify/ui 0.0.27 → 0.0.29
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/README.md +16 -6
- package/dist/components/atoms/content-wrapper.d.ts +1 -1
- package/dist/components/molecules/date-range-picker.d.ts +7 -7
- package/dist/components/organisms/date-preset/context.d.ts +8 -0
- package/dist/components/organisms/date-preset/date-preset.d.ts +9 -0
- package/dist/components/organisms/date-preset/index.d.ts +8 -0
- package/dist/components/organisms/date-preset/presets.d.ts +21 -0
- package/dist/components/organisms/date-preset/root.d.ts +9 -0
- package/dist/index.d.ts +4 -0
- package/dist/mock.d.ts +3 -0
- package/dist/segmentify-ui.cjs +52 -52
- package/dist/segmentify-ui.js +6168 -6113
- package/dist/ui.css +107 -12
- package/package.json +22 -21
package/README.md
CHANGED
|
@@ -56,14 +56,24 @@ import '@segmentify/ui/dist/ui.css';
|
|
|
56
56
|
- `pnpm format`: Format the codebase using Prettier.
|
|
57
57
|
- `pnpm release`: Publish the package using Changesets.
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
## Releasing
|
|
60
60
|
|
|
61
|
-
This project uses Changesets for versioning and releases.
|
|
61
|
+
This project uses Changesets for versioning and releases.
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
### Configuration
|
|
64
|
+
|
|
65
|
+
To publish new releases, you must have an `.npmrc` file in the root of the project with a valid npm authToken:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
@segmentify:registry=https://registry.npmjs.org/
|
|
69
|
+
//registry.npmjs.org/:_authToken=YOUR_NPM_AUTH_TOKEN
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Process
|
|
73
|
+
|
|
74
|
+
1. **Create a Changeset**: Run `pnpm changeset` and follow the prompts to document your changes.
|
|
75
|
+
2. **Version Packages**: Run `pnpm version-packages` to update versions and the changelog.
|
|
76
|
+
3. **Publish**: Run `pnpm release` to publish the new version to npm.
|
|
67
77
|
|
|
68
78
|
## License
|
|
69
79
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type DateRange } from 'react-day-picker';
|
|
2
2
|
import { type ClassValue } from 'clsx';
|
|
3
3
|
type Props = {
|
|
4
|
-
start
|
|
5
|
-
end
|
|
4
|
+
start?: Date;
|
|
5
|
+
end?: Date;
|
|
6
6
|
onConfirm: (range: DateRange) => void;
|
|
7
|
-
|
|
8
|
-
triggerButtonClassName?: ClassValue;
|
|
9
|
-
label: string;
|
|
7
|
+
label?: string;
|
|
10
8
|
placeholder: string;
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
triggerButtonClassName?: ClassValue;
|
|
10
|
+
className?: ClassValue;
|
|
11
|
+
confirmLabel?: string;
|
|
12
|
+
disabledCondition?: boolean | ((date: Date) => boolean);
|
|
13
13
|
};
|
|
14
14
|
export declare const DateRangePicker: ({ start, end, onConfirm, className, triggerButtonClassName, label, placeholder, confirmLabel, disabledCondition, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type DateRange } from './presets';
|
|
2
|
+
export interface DatePresetContextValue {
|
|
3
|
+
range: DateRange;
|
|
4
|
+
preset: string | null;
|
|
5
|
+
setRange: (range: DateRange, preset?: string | null) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const DatePresetContext: import("react").Context<DatePresetContextValue | null>;
|
|
8
|
+
export declare function useDatePreset(): DatePresetContextValue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DatePresetItem } from './presets';
|
|
2
|
+
export interface DatePresetProps {
|
|
3
|
+
presets?: Record<string, DatePresetItem>;
|
|
4
|
+
className?: string;
|
|
5
|
+
confirmLabel?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
disabledCondition?: boolean | ((date: Date) => boolean);
|
|
8
|
+
}
|
|
9
|
+
export declare function DatePreset({ presets, className, confirmLabel, placeholder, disabledCondition, }: DatePresetProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { DateRange, DatePresetItem } from './presets';
|
|
2
|
+
export type { DatePresetContextValue } from './context';
|
|
3
|
+
export type { DatePresetProps } from './date-preset';
|
|
4
|
+
export type { DatePresetProviderProps } from './root';
|
|
5
|
+
export { DATE_PRESETS, DEFAULT_PRESET_KEY, findMatchingPreset } from './presets';
|
|
6
|
+
export { useDatePreset } from './context';
|
|
7
|
+
export { DatePreset } from './date-preset';
|
|
8
|
+
export { DatePresetProvider } from './root';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface DateRange {
|
|
2
|
+
from: Date;
|
|
3
|
+
to: Date;
|
|
4
|
+
}
|
|
5
|
+
export interface DateRangeOptional {
|
|
6
|
+
from?: Date;
|
|
7
|
+
to?: Date;
|
|
8
|
+
}
|
|
9
|
+
export interface DatePresetItem {
|
|
10
|
+
key: string;
|
|
11
|
+
label: string;
|
|
12
|
+
getRange: () => DateRange;
|
|
13
|
+
}
|
|
14
|
+
export declare const DATE_PRESETS: Record<string, DatePresetItem>;
|
|
15
|
+
export declare const DEFAULT_PRESET_KEY = "LAST_7_DAYS";
|
|
16
|
+
/**
|
|
17
|
+
* Finds a matching preset for a given date range.
|
|
18
|
+
* Compares dates by day (ignores time).
|
|
19
|
+
* @returns The matching preset key or null if no match found.
|
|
20
|
+
*/
|
|
21
|
+
export declare function findMatchingPreset(range: DateRange, presets?: Record<string, DatePresetItem>): string | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type DateRange } from './presets';
|
|
3
|
+
export interface DatePresetProviderProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
initialRange?: DateRange;
|
|
6
|
+
initialPreset?: string | null;
|
|
7
|
+
onRangeChange?: (range: DateRange, preset: string | null) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function DatePresetProvider({ children, initialRange, initialPreset, onRangeChange, }: DatePresetProviderProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -72,5 +72,9 @@ export { TextAreaField } from './components/molecules/textarea-field';
|
|
|
72
72
|
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './components/atoms/tooltip';
|
|
73
73
|
export { TooltipField } from './components/molecules/tooltip-field';
|
|
74
74
|
export { QuillEditor } from './components/atoms/quill-editor';
|
|
75
|
+
export { DATE_PRESETS, DEFAULT_PRESET_KEY } from './components/organisms/date-preset/presets';
|
|
76
|
+
export { type DateRange, type DatePresetItem } from './components/organisms/date-preset/presets';
|
|
77
|
+
export { type DatePresetProviderProps } from './components/organisms/date-preset/root';
|
|
78
|
+
export { type DatePresetContextValue } from './components/organisms/date-preset/context';
|
|
75
79
|
export { useDataTable, type UseDataTableOptions, type UseDataTableReturn, type FetcherParams, type FetcherResponse, } from './hooks/use-data-table';
|
|
76
80
|
export { cn } from './lib/utils';
|
package/dist/mock.d.ts
ADDED