@wallarm-org/design-system 0.6.0 → 0.6.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.
Files changed (91) hide show
  1. package/dist/components/Checkmark/Checkmark.js +2 -2
  2. package/dist/components/Code/Code.d.ts +1 -1
  3. package/dist/components/Code/Code.js +2 -2
  4. package/dist/components/Country/Country.d.ts +17 -0
  5. package/dist/components/Country/Country.js +36 -0
  6. package/dist/components/Country/CountryContext.d.ts +9 -0
  7. package/dist/components/Country/CountryContext.js +8 -0
  8. package/dist/components/Country/CountryFlag.d.ts +6 -0
  9. package/dist/components/Country/CountryFlag.js +26 -0
  10. package/dist/components/Country/CountryName.d.ts +3 -0
  11. package/dist/components/Country/CountryName.js +26 -0
  12. package/dist/components/Country/countries.d.ts +1003 -0
  13. package/dist/components/Country/countries.js +1003 -0
  14. package/dist/components/Country/index.d.ts +4 -0
  15. package/dist/components/Country/index.js +4 -0
  16. package/dist/components/Country/types.d.ts +3 -0
  17. package/dist/components/Country/types.js +0 -0
  18. package/dist/components/DateTime/DateTime.d.ts +15 -0
  19. package/dist/components/DateTime/DateTime.js +121 -0
  20. package/dist/components/DateTime/index.d.ts +1 -0
  21. package/dist/components/DateTime/index.js +2 -0
  22. package/dist/components/DropdownMenu/DropdownMenuContent.d.ts +1 -1
  23. package/dist/components/DropdownMenu/DropdownMenuContent.js +28 -18
  24. package/dist/components/DropdownMenu/DropdownMenuFooter.d.ts +7 -0
  25. package/dist/components/DropdownMenu/DropdownMenuFooter.js +8 -0
  26. package/dist/components/DropdownMenu/index.d.ts +1 -0
  27. package/dist/components/DropdownMenu/index.js +2 -1
  28. package/dist/components/Flex/Flex.d.ts +1 -1
  29. package/dist/components/Ip/Ip.d.ts +9 -0
  30. package/dist/components/Ip/Ip.js +14 -0
  31. package/dist/components/Ip/IpAddress.d.ts +6 -0
  32. package/dist/components/Ip/IpAddress.js +21 -0
  33. package/dist/components/Ip/IpCountry.d.ts +6 -0
  34. package/dist/components/Ip/IpCountry.js +9 -0
  35. package/dist/components/Ip/IpList.d.ts +9 -0
  36. package/dist/components/Ip/IpList.js +52 -0
  37. package/dist/components/Ip/IpPort.d.ts +5 -0
  38. package/dist/components/Ip/IpPort.js +12 -0
  39. package/dist/components/Ip/IpProvider.d.ts +4 -0
  40. package/dist/components/Ip/IpProvider.js +12 -0
  41. package/dist/components/Ip/constants.d.ts +29 -0
  42. package/dist/components/Ip/constants.js +30 -0
  43. package/dist/components/Ip/index.d.ts +7 -0
  44. package/dist/components/Ip/index.js +8 -0
  45. package/dist/components/Ip/utils/checkHasCountry.d.ts +2 -0
  46. package/dist/components/Ip/utils/checkHasCountry.js +10 -0
  47. package/dist/components/Link/Link.d.ts +1 -0
  48. package/dist/components/Link/Link.js +7 -3
  49. package/dist/components/Link/classes.d.ts +2 -1
  50. package/dist/components/Link/classes.js +5 -1
  51. package/dist/components/OverflowTooltip/OverflowTooltip.js +1 -1
  52. package/dist/components/ScrollArea/ScrollAreaViewport.js +1 -1
  53. package/dist/components/SegmentedControl/SegmentedControlSeparator.d.ts +1 -1
  54. package/dist/components/Separator/Separator.d.ts +1 -1
  55. package/dist/components/Skeleton/Skeleton.d.ts +1 -1
  56. package/dist/components/Stack/Stack.d.ts +1 -1
  57. package/dist/components/Table/TableActionBar/TableActionBar.js +1 -1
  58. package/dist/components/Table/TableActionBar/TableActionBarSelection.js +6 -4
  59. package/dist/components/Table/TableBody/TableBodyCell.js +17 -5
  60. package/dist/components/Table/TableColGroup.js +1 -1
  61. package/dist/components/Table/TableContext/TableProvider.js +21 -8
  62. package/dist/components/Table/TableHeadCell.js +64 -17
  63. package/dist/components/Table/TableRow.js +1 -0
  64. package/dist/components/Table/TableRowExpanded.js +1 -1
  65. package/dist/components/Table/TableScrollHandler.js +2 -0
  66. package/dist/components/Table/TableSettingsMenu/TableSettingsMenu.js +46 -48
  67. package/dist/components/Table/TableSettingsMenu/TableSettingsMenuItem.js +2 -2
  68. package/dist/components/Table/classes.js +4 -4
  69. package/dist/components/Table/lib/constants.d.ts +7 -0
  70. package/dist/components/Table/lib/constants.js +13 -1
  71. package/dist/components/Table/lib/createExpandColumn.js +1 -1
  72. package/dist/components/Table/lib/index.d.ts +1 -1
  73. package/dist/components/Table/lib/index.js +2 -2
  74. package/dist/components/Table/mocks.d.ts +4 -7
  75. package/dist/components/Table/mocks.js +141 -171
  76. package/dist/components/Table/types.d.ts +18 -0
  77. package/dist/components/Text/Text.d.ts +1 -0
  78. package/dist/components/Text/Text.js +6 -2
  79. package/dist/components/Tour/TourSpotlight.d.ts +1 -1
  80. package/dist/icons/CheckboxIndeterminate.d.ts +3 -0
  81. package/dist/icons/CheckboxIndeterminate.js +16 -0
  82. package/dist/icons/index.d.ts +1 -0
  83. package/dist/icons/index.js +2 -1
  84. package/dist/index.d.ts +3 -0
  85. package/dist/index.js +4 -1
  86. package/dist/metadata/components.json +3054 -879
  87. package/dist/utils/abbreviateNumber.d.ts +14 -0
  88. package/dist/utils/abbreviateNumber.js +39 -0
  89. package/dist/utils/formatDateTime.d.ts +38 -0
  90. package/dist/utils/formatDateTime.js +46 -0
  91. package/package.json +4 -3
@@ -1,10 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Check, Minus } from "../../icons/index.js";
2
+ import { Check, CheckboxIndeterminate } from "../../icons/index.js";
3
3
  import { cn } from "../../utils/cn.js";
4
4
  const Checkmark = ({ checkedState = false, ...props })=>/*#__PURE__*/ jsx("div", {
5
5
  className: cn('flex items-center justify-center self-start my-2', 'w-16 h-16', 'rounded-4 shadow-xs overlay transition-all data-focus-visible:ring-3', '[&_svg]:icon-sm [&_svg]:text-icon-primary-alt [&_svg]:shrink-0 [&_svg]:pointer-events-none', 'bg-bg-surface-3 border border-border-primary', '[&[data-hover]:not([data-active]):not([data-state=checked]):not([data-state=indeterminate])]:bg-states-primary-hover', '[&[data-active]:not([data-state=checked]):not([data-state=indeterminate])]:bg-states-primary-pressed', '[&[data-focus-visible]:not([data-state=checked]):not([data-state=indeterminate])]:ring-focus-primary', 'data-[state=checked]:bg-bg-fill-brand', 'data-[state=checked]:border-bg-fill-brand', 'data-[state=checked]:border-none', 'data-[state=indeterminate]:bg-bg-fill-brand', 'data-[state=indeterminate]:border-bg-fill-brand', 'data-[state=indeterminate]:border-none', '[&[data-hover]:not([data-active]):is([data-state=checked])]:overlay-states-on-fill-hover', '[&[data-hover]:not([data-active]):is([data-state=indeterminate])]:overlay-states-on-fill-hover', '[&[data-active][data-state=checked]]:overlay-states-on-fill-pressed', '[&[data-active][data-state=indeterminate]]:overlay-states-on-fill-pressed', '[&[data-focus-visible][data-state=checked]]:ring-focus-brand', '[&[data-focus-visible][data-state=indeterminate]]:ring-focus-brand'),
6
6
  "data-state": 'indeterminate' === checkedState ? 'indeterminate' : checkedState ? 'checked' : 'unchecked',
7
7
  ...props,
8
- children: 'indeterminate' === checkedState ? /*#__PURE__*/ jsx(Minus, {}) : checkedState ? /*#__PURE__*/ jsx(Check, {}) : false
8
+ children: 'indeterminate' === checkedState ? /*#__PURE__*/ jsx(CheckboxIndeterminate, {}) : checkedState ? /*#__PURE__*/ jsx(Check, {}) : false
9
9
  });
10
10
  export { Checkmark };
@@ -7,7 +7,7 @@ declare const codeVariants: (props?: ({
7
7
  italic?: boolean | null | undefined;
8
8
  truncate?: boolean | null | undefined;
9
9
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
- type CodeNativeProps = Omit<HTMLAttributes<HTMLParagraphElement>, 'className'>;
10
+ type CodeNativeProps = HTMLAttributes<HTMLParagraphElement>;
11
11
  type CodeVariantProps = VariantProps<typeof codeVariants>;
12
12
  interface CodeBaseProps {
13
13
  asChild?: boolean;
@@ -32,7 +32,7 @@ const codeVariants = cva('font-mono leading-sm', {
32
32
  italic: false
33
33
  }
34
34
  });
35
- const Code = ({ size = 'l', weight = 'regular', color = 'primary', italic = false, asChild = false, truncate = false, lineClamp, ...props })=>{
35
+ const Code = ({ size = 'l', weight = 'regular', color = 'primary', italic = false, asChild = false, truncate = false, lineClamp, className, ...props })=>{
36
36
  const Comp = asChild ? Slot : 'p';
37
37
  return /*#__PURE__*/ jsx(Comp, {
38
38
  ...props,
@@ -42,7 +42,7 @@ const Code = ({ size = 'l', weight = 'regular', color = 'primary', italic = fals
42
42
  color,
43
43
  italic,
44
44
  truncate
45
- }), lineClamp && `line-clamp-${lineClamp}`)
45
+ }), lineClamp && `line-clamp-${lineClamp}`, className)
46
46
  });
47
47
  };
48
48
  Code.displayName = 'Code';
@@ -0,0 +1,17 @@
1
+ import type { ComponentProps, FC, ReactNode, Ref } from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ import { type CountryCode } from './countries';
4
+ export declare const countryVariants: (props?: ({
5
+ size?: "small" | "medium" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ type CountryVariantsProps = VariantProps<typeof countryVariants>;
8
+ type CountryNativeProps = Omit<ComponentProps<'div'>, 'children'>;
9
+ interface CountryBaseProps {
10
+ ref?: Ref<HTMLDivElement>;
11
+ asChild?: boolean;
12
+ code: CountryCode;
13
+ children?: ReactNode;
14
+ }
15
+ export type CountryProps = CountryNativeProps & CountryVariantsProps & CountryBaseProps;
16
+ export declare const Country: FC<CountryProps>;
17
+ export {};
@@ -0,0 +1,36 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { cva } from "class-variance-authority";
4
+ import { cn } from "../../utils/cn.js";
5
+ import { CountryContext } from "./CountryContext.js";
6
+ import { countries } from "./countries.js";
7
+ const countryVariants = cva('inline-flex items-center gap-6 w-fit', {
8
+ variants: {
9
+ size: {
10
+ small: '',
11
+ medium: ''
12
+ }
13
+ }
14
+ });
15
+ const Country = ({ ref, asChild = false, code, size = 'medium', className, children, ...props })=>{
16
+ const countryData = countries[code];
17
+ const Comp = asChild ? Slot : 'div';
18
+ return /*#__PURE__*/ jsx(CountryContext.Provider, {
19
+ value: {
20
+ code,
21
+ size: size ?? 'medium',
22
+ countryData
23
+ },
24
+ children: /*#__PURE__*/ jsx(Comp, {
25
+ ...props,
26
+ ref: ref,
27
+ "data-slot": "country",
28
+ className: cn(countryVariants({
29
+ size
30
+ }), className),
31
+ children: children
32
+ })
33
+ });
34
+ };
35
+ Country.displayName = 'Country';
36
+ export { Country, countryVariants };
@@ -0,0 +1,9 @@
1
+ import type { CountryCode, countries } from './countries';
2
+ import type { Size } from './types';
3
+ export interface CountryContextValue {
4
+ code: CountryCode;
5
+ size: Size;
6
+ countryData: (typeof countries)[CountryCode] | undefined;
7
+ }
8
+ export declare const CountryContext: import("react").Context<CountryContextValue | null>;
9
+ export declare function useCountryContext(): CountryContextValue;
@@ -0,0 +1,8 @@
1
+ import { createContext, useContext } from "react";
2
+ const CountryContext = createContext(null);
3
+ function useCountryContext() {
4
+ const ctx = useContext(CountryContext);
5
+ if (!ctx) throw new Error('useCountryContext must be used within a Country component');
6
+ return ctx;
7
+ }
8
+ export { CountryContext, useCountryContext };
@@ -0,0 +1,6 @@
1
+ import type { ComponentProps, FC } from 'react';
2
+ export declare const countryFlagVariants: (props?: ({
3
+ size?: "small" | "medium" | null | undefined;
4
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
+ export type CountryFlagProps = Omit<ComponentProps<'img'>, 'src' | 'alt'>;
6
+ export declare const CountryFlag: FC<CountryFlagProps>;
@@ -0,0 +1,26 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { cn } from "../../utils/cn.js";
4
+ import { useCountryContext } from "./CountryContext.js";
5
+ const countryFlagVariants = cva('shrink-0 rounded-full object-cover', {
6
+ variants: {
7
+ size: {
8
+ small: 'size-16',
9
+ medium: 'size-20'
10
+ }
11
+ }
12
+ });
13
+ const CountryFlag = ({ className, ...props })=>{
14
+ const { code, size, countryData } = useCountryContext();
15
+ if (!countryData?.flag) return null;
16
+ return /*#__PURE__*/ jsx("img", {
17
+ ...props,
18
+ src: countryData.flag,
19
+ alt: countryData.name ?? code,
20
+ "data-slot": "country-flag",
21
+ className: cn(countryFlagVariants({
22
+ size
23
+ }), className)
24
+ });
25
+ };
26
+ export { CountryFlag, countryFlagVariants };
@@ -0,0 +1,3 @@
1
+ import type { ComponentProps, FC } from 'react';
2
+ export type CountryNameProps = ComponentProps<'span'>;
3
+ export declare const CountryName: FC<CountryNameProps>;
@@ -0,0 +1,26 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { OverflowTooltip, OverflowTooltipContent, OverflowTooltipTrigger } from "../OverflowTooltip/index.js";
3
+ import { Text } from "../Text/index.js";
4
+ import { useCountryContext } from "./CountryContext.js";
5
+ const CountryName = ({ className, ...props })=>{
6
+ const { code, size, countryData } = useCountryContext();
7
+ return /*#__PURE__*/ jsxs(OverflowTooltip, {
8
+ children: [
9
+ /*#__PURE__*/ jsx(OverflowTooltipTrigger, {
10
+ asChild: true,
11
+ children: /*#__PURE__*/ jsx(Text, {
12
+ size: 'small' === size ? 'xs' : 'sm',
13
+ "data-slot": "country-name",
14
+ lineClamp: 1,
15
+ truncate: true,
16
+ children: countryData?.name ?? code
17
+ })
18
+ }),
19
+ /*#__PURE__*/ jsx(OverflowTooltipContent, {
20
+ children: countryData?.name ?? code
21
+ })
22
+ ]
23
+ });
24
+ };
25
+ CountryName.displayName = 'CountryName';
26
+ export { CountryName };