@pallamart/pm-core-components 2.0.0 → 2.2.0

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.
Files changed (30) hide show
  1. package/dist/components/internal/avatar/pm-avatar.js +2 -1
  2. package/dist/components/internal/badge/pm-badge.d.ts +1 -1
  3. package/dist/components/internal/badge/pm-badge.js +4 -1
  4. package/dist/components/internal/card/pm-card.js +2 -1
  5. package/dist/components/internal/index.d.ts +1 -0
  6. package/dist/components/internal/index.js +1 -0
  7. package/dist/components/internal/input/pm-input.js +4 -1
  8. package/dist/components/internal/navigation-progress/index.d.ts +1 -0
  9. package/dist/components/internal/navigation-progress/index.js +1 -0
  10. package/dist/components/internal/navigation-progress/pm-navigation-progress.d.ts +3 -0
  11. package/dist/components/internal/navigation-progress/pm-navigation-progress.js +28 -0
  12. package/dist/components/internal/select/pm-select-trigger.js +2 -1
  13. package/dist/constants/internal/index.d.ts +2 -0
  14. package/dist/constants/internal/index.js +2 -0
  15. package/dist/constants/internal/pm-navigation-progress-config.d.ts +8 -0
  16. package/dist/constants/internal/pm-navigation-progress-config.js +8 -0
  17. package/dist/constants/internal/pm-navigation-state.d.ts +5 -0
  18. package/dist/constants/internal/pm-navigation-state.js +6 -0
  19. package/dist/models/internal/avatar/pm-avatar-props.d.ts +1 -0
  20. package/dist/models/internal/badge/pm-badge-props.d.ts +1 -0
  21. package/dist/models/internal/card/pm-card-props.d.ts +1 -0
  22. package/dist/models/internal/index.d.ts +1 -0
  23. package/dist/models/internal/index.js +1 -0
  24. package/dist/models/internal/input/pm-input-props.d.ts +1 -0
  25. package/dist/models/internal/navigation-progress/index.d.ts +1 -0
  26. package/dist/models/internal/navigation-progress/index.js +1 -0
  27. package/dist/models/internal/navigation-progress/pm-navigation-progress-props.d.ts +5 -0
  28. package/dist/models/internal/navigation-progress/pm-navigation-progress-props.js +1 -0
  29. package/dist/models/internal/select/pm-select-trigger-props.d.ts +1 -0
  30. package/package.json +1 -1
@@ -2,5 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { PallamartClassNameService } from '@pallamart/pm-design-system';
4
4
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
5
- export const PmAvatar = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Root, { ref: ref, className: PallamartClassNameService.merge('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className), ...props })));
5
+ import { PmSkeleton } from '../skeleton/pm-skeleton.js';
6
+ export const PmAvatar = React.forwardRef(({ className, isLoading = false, ...props }, ref) => isLoading ? (_jsx(PmSkeleton, { className: PallamartClassNameService.merge('h-10 w-10 shrink-0 rounded-full', className) })) : (_jsx(AvatarPrimitive.Root, { ref: ref, className: PallamartClassNameService.merge('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className), ...props })));
6
7
  PmAvatar.displayName = AvatarPrimitive.Root.displayName;
@@ -1,2 +1,2 @@
1
1
  import type { PmBadgeProps } from '../../../models/internal/badge/pm-badge-props.js';
2
- export declare const PmBadge: ({ className, variant, ...props }: PmBadgeProps) => import("react").JSX.Element;
2
+ export declare const PmBadge: ({ className, isLoading, variant, ...props }: PmBadgeProps) => import("react").JSX.Element;
@@ -1,6 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PallamartClassNameService } from '@pallamart/pm-design-system';
3
3
  import { PmBadgeVariants } from '../../../constants/internal/pm-badge-variants.js';
4
- export const PmBadge = ({ className, variant, ...props }) => {
4
+ import { PmSkeleton } from '../skeleton/pm-skeleton.js';
5
+ export const PmBadge = ({ className, isLoading = false, variant, ...props }) => {
6
+ if (isLoading)
7
+ return (_jsx(PmSkeleton, { className: PallamartClassNameService.merge('h-5 w-16 rounded-full', className) }));
5
8
  return (_jsx("div", { className: PallamartClassNameService.merge(PmBadgeVariants({ variant }), className), ...props }));
6
9
  };
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { PallamartClassNameService } from '@pallamart/pm-design-system';
4
- export const PmCard = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: PallamartClassNameService.merge('rounded-xl border bg-card text-card-foreground shadow', className), ...props })));
4
+ import { PmSkeleton } from '../skeleton/pm-skeleton.js';
5
+ export const PmCard = React.forwardRef(({ className, isLoading = false, ...props }, ref) => isLoading ? (_jsx(PmSkeleton, { className: PallamartClassNameService.merge('h-40 w-full rounded-xl', className) })) : (_jsx("div", { ref: ref, className: PallamartClassNameService.merge('rounded-xl border bg-card text-card-foreground shadow', className), ...props })));
5
6
  PmCard.displayName = 'PmCard';
@@ -17,6 +17,7 @@ export * from './file-picker/index.js';
17
17
  export * from './input/index.js';
18
18
  export * from './kbd/index.js';
19
19
  export * from './label/index.js';
20
+ export * from './navigation-progress/index.js';
20
21
  export * from './not-found/index.js';
21
22
  export * from './popover/index.js';
22
23
  export * from './progress/index.js';
@@ -17,6 +17,7 @@ export * from './file-picker/index.js';
17
17
  export * from './input/index.js';
18
18
  export * from './kbd/index.js';
19
19
  export * from './label/index.js';
20
+ export * from './navigation-progress/index.js';
20
21
  export * from './not-found/index.js';
21
22
  export * from './popover/index.js';
22
23
  export * from './progress/index.js';
@@ -1,7 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import { PallamartClassNameService } from '@pallamart/pm-design-system';
4
- export const PmInput = React.forwardRef(({ className, type, ...props }, ref) => {
4
+ import { PmSkeleton } from '../skeleton/pm-skeleton.js';
5
+ export const PmInput = React.forwardRef(({ className, isLoading = false, type, ...props }, ref) => {
6
+ if (isLoading)
7
+ return (_jsx(PmSkeleton, { className: PallamartClassNameService.merge('h-9 w-full rounded-md', className) }));
5
8
  return (_jsx("input", { type: type, className: PallamartClassNameService.merge('flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm', className), ref: ref, ...props }));
6
9
  });
7
10
  PmInput.displayName = 'PmInput';
@@ -0,0 +1 @@
1
+ export * from './pm-navigation-progress.js';
@@ -0,0 +1 @@
1
+ export * from './pm-navigation-progress.js';
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ import type { PmNavigationProgressProps } from '../../../models/internal/navigation-progress/pm-navigation-progress-props.js';
3
+ export declare const PmNavigationProgress: ({ className, state }: PmNavigationProgressProps) => React.JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from 'react';
3
+ import { PallamartClassNameService } from '@pallamart/pm-design-system';
4
+ import { PmNavigationProgressConfig } from '../../../constants/internal/pm-navigation-progress-config.js';
5
+ import { PmNavigationState } from '../../../constants/internal/pm-navigation-state.js';
6
+ import { PmProgress } from '../progress/pm-progress.js';
7
+ export const PmNavigationProgress = ({ className, state }) => {
8
+ const [value, setValue] = React.useState(PmNavigationProgressConfig.startValue);
9
+ const [isVisible, setIsVisible] = React.useState(false);
10
+ React.useEffect(() => {
11
+ if (state === PmNavigationState.Idle) {
12
+ if (!isVisible)
13
+ return;
14
+ setValue(PmNavigationProgressConfig.completeValue);
15
+ const hideTimer = window.setTimeout(() => setIsVisible(false), PmNavigationProgressConfig.hideDelayMs);
16
+ const resetTimer = window.setTimeout(() => setValue(PmNavigationProgressConfig.startValue), PmNavigationProgressConfig.resetDelayMs);
17
+ return () => {
18
+ window.clearTimeout(hideTimer);
19
+ window.clearTimeout(resetTimer);
20
+ };
21
+ }
22
+ setIsVisible(true);
23
+ setValue(state === PmNavigationState.Submitting
24
+ ? PmNavigationProgressConfig.submittingValue
25
+ : PmNavigationProgressConfig.loadingValue);
26
+ }, [isVisible, state]);
27
+ return (_jsx(PmProgress, { "aria-hidden": !isVisible, className: PallamartClassNameService.merge('pointer-events-none fixed inset-x-0 top-0 z-[999] h-0.5 rounded-none bg-transparent transition-opacity', isVisible ? 'opacity-100' : 'opacity-0', className), value: value }));
28
+ };
@@ -3,5 +3,6 @@ import * as React from 'react';
3
3
  import { PallamartClassNameService } from '@pallamart/pm-design-system';
4
4
  import * as SelectPrimitive from '@radix-ui/react-select';
5
5
  import { ChevronDown } from 'lucide-react';
6
- export const PmSelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: PallamartClassNameService.merge('flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1', className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: 'h-4 w-4 opacity-50' }) })] })));
6
+ import { PmSkeleton } from '../skeleton/pm-skeleton.js';
7
+ export const PmSelectTrigger = React.forwardRef(({ className, children, isLoading = false, ...props }, ref) => isLoading ? (_jsx(PmSkeleton, { className: PallamartClassNameService.merge('h-9 w-full rounded-md', className) })) : (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: PallamartClassNameService.merge('flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1', className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: 'h-4 w-4 opacity-50' }) })] })));
7
8
  PmSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
@@ -4,6 +4,8 @@ export * from './pm-badge-variants.js';
4
4
  export * from './pm-button-variants.js';
5
5
  export * from './pm-field-orientation.js';
6
6
  export * from './pm-label-variants.js';
7
+ export * from './pm-navigation-progress-config.js';
8
+ export * from './pm-navigation-state.js';
7
9
  export * from './pm-root-status-messages.js';
8
10
  export * from './pm-sheet-variants.js';
9
11
  export * from './pm-toggle-variants.js';
@@ -4,6 +4,8 @@ export * from './pm-badge-variants.js';
4
4
  export * from './pm-button-variants.js';
5
5
  export * from './pm-field-orientation.js';
6
6
  export * from './pm-label-variants.js';
7
+ export * from './pm-navigation-progress-config.js';
8
+ export * from './pm-navigation-state.js';
7
9
  export * from './pm-root-status-messages.js';
8
10
  export * from './pm-sheet-variants.js';
9
11
  export * from './pm-toggle-variants.js';
@@ -0,0 +1,8 @@
1
+ export declare const PmNavigationProgressConfig: {
2
+ readonly completeValue: 100;
3
+ readonly hideDelayMs: 200;
4
+ readonly loadingValue: 75;
5
+ readonly resetDelayMs: 450;
6
+ readonly startValue: 0;
7
+ readonly submittingValue: 40;
8
+ };
@@ -0,0 +1,8 @@
1
+ export const PmNavigationProgressConfig = {
2
+ completeValue: 100,
3
+ hideDelayMs: 200,
4
+ loadingValue: 75,
5
+ resetDelayMs: 450,
6
+ startValue: 0,
7
+ submittingValue: 40,
8
+ };
@@ -0,0 +1,5 @@
1
+ export declare enum PmNavigationState {
2
+ Idle = "idle",
3
+ Loading = "loading",
4
+ Submitting = "submitting"
5
+ }
@@ -0,0 +1,6 @@
1
+ export var PmNavigationState;
2
+ (function (PmNavigationState) {
3
+ PmNavigationState["Idle"] = "idle";
4
+ PmNavigationState["Loading"] = "loading";
5
+ PmNavigationState["Submitting"] = "submitting";
6
+ })(PmNavigationState || (PmNavigationState = {}));
@@ -1,4 +1,5 @@
1
1
  import type * as React from 'react';
2
2
  import type * as AvatarPrimitive from '@radix-ui/react-avatar';
3
3
  export interface PmAvatarProps extends React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> {
4
+ isLoading?: boolean;
4
5
  }
@@ -2,4 +2,5 @@ import type * as React from 'react';
2
2
  import type { VariantProps } from 'class-variance-authority';
3
3
  import type { PmBadgeVariants } from '../../../constants/internal/pm-badge-variants.js';
4
4
  export interface PmBadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof PmBadgeVariants> {
5
+ isLoading?: boolean;
5
6
  }
@@ -1,3 +1,4 @@
1
1
  import type * as React from 'react';
2
2
  export interface PmCardProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ isLoading?: boolean;
3
4
  }
@@ -17,6 +17,7 @@ export * from './file-picker/index.js';
17
17
  export * from './input/index.js';
18
18
  export * from './kbd/index.js';
19
19
  export * from './label/index.js';
20
+ export * from './navigation-progress/index.js';
20
21
  export * from './not-found/index.js';
21
22
  export * from './popover/index.js';
22
23
  export * from './progress/index.js';
@@ -17,6 +17,7 @@ export * from './file-picker/index.js';
17
17
  export * from './input/index.js';
18
18
  export * from './kbd/index.js';
19
19
  export * from './label/index.js';
20
+ export * from './navigation-progress/index.js';
20
21
  export * from './not-found/index.js';
21
22
  export * from './popover/index.js';
22
23
  export * from './progress/index.js';
@@ -1,3 +1,4 @@
1
1
  import type * as React from 'react';
2
2
  export interface PmInputProps extends React.ComponentProps<'input'> {
3
+ isLoading?: boolean;
3
4
  }
@@ -0,0 +1 @@
1
+ export * from './pm-navigation-progress-props.js';
@@ -0,0 +1 @@
1
+ export * from './pm-navigation-progress-props.js';
@@ -0,0 +1,5 @@
1
+ import type { PmNavigationState } from '../../../constants/internal/pm-navigation-state.js';
2
+ export interface PmNavigationProgressProps {
3
+ className?: string;
4
+ state: PmNavigationState;
5
+ }
@@ -1,4 +1,5 @@
1
1
  import type * as React from 'react';
2
2
  import type * as SelectPrimitive from '@radix-ui/react-select';
3
3
  export interface PmSelectTriggerProps extends React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> {
4
+ isLoading?: boolean;
4
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pallamart/pm-core-components",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",