@dashx/react 0.1.1 → 0.1.2
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/cjs/components/button.d.ts +2 -1
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +3 -3
- package/dist/cjs/components/card.js +1 -1
- package/dist/cjs/components/card.js.map +2 -2
- package/dist/cjs/components/checkbox.d.ts +18 -0
- package/dist/cjs/components/checkbox.js +2 -0
- package/dist/cjs/components/checkbox.js.map +7 -0
- package/dist/cjs/components/flex.d.ts +66 -49
- package/dist/cjs/components/flex.js +1 -1
- package/dist/cjs/components/flex.js.map +3 -3
- package/dist/cjs/components/form.d.ts +11 -0
- package/dist/cjs/components/form.js +2 -0
- package/dist/cjs/components/form.js.map +7 -0
- package/dist/cjs/components/index.d.ts +5 -0
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +2 -2
- package/dist/cjs/components/link.d.ts +10 -0
- package/dist/cjs/components/link.js +2 -0
- package/dist/cjs/components/link.js.map +7 -0
- package/dist/cjs/components/number-field.d.ts +11 -0
- package/dist/cjs/components/number-field.js +2 -0
- package/dist/cjs/components/number-field.js.map +7 -0
- package/dist/cjs/components/popover.d.ts +6 -6
- package/dist/cjs/components/text-area.d.ts +11 -0
- package/dist/cjs/components/text-area.js +2 -0
- package/dist/cjs/components/text-area.js.map +7 -0
- package/dist/cjs/components/text-field.d.ts +10 -1
- package/dist/cjs/components/text-field.js +1 -1
- package/dist/cjs/components/text-field.js.map +3 -3
- package/dist/cjs/components/text.d.ts +1 -1
- package/dist/cjs/components/text.js +1 -1
- package/dist/cjs/components/text.js.map +3 -3
- package/dist/cjs/components/theme.d.ts +2 -0
- package/dist/cjs/components/theme.js +1 -1
- package/dist/cjs/components/theme.js.map +3 -3
- package/dist/cjs/components/tooltip.js +1 -1
- package/dist/cjs/components/tooltip.js.map +2 -2
- package/dist/cjs/hooks/index.d.ts +1 -0
- package/dist/cjs/hooks/index.js +1 -1
- package/dist/cjs/hooks/index.js.map +3 -3
- package/dist/cjs/hooks/use-in-app.js +1 -1
- package/dist/cjs/hooks/use-in-app.js.map +3 -3
- package/dist/cjs/hooks/use-product-release.d.ts +6 -0
- package/dist/cjs/hooks/use-product-release.js +2 -0
- package/dist/cjs/hooks/use-product-release.js.map +7 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/providers/DashXProvider.d.ts +7 -2
- package/dist/cjs/providers/DashXProvider.js +1 -1
- package/dist/cjs/providers/DashXProvider.js.map +3 -3
- package/dist/cjs/providers/index.d.ts +1 -1
- package/dist/cjs/providers/index.js +1 -1
- package/dist/cjs/providers/index.js.map +2 -2
- package/dist/cjs/utils/helpers.d.ts +2 -0
- package/dist/cjs/utils/helpers.js +2 -0
- package/dist/cjs/utils/helpers.js.map +7 -0
- package/dist/cjs/variants/base-element.d.ts +25 -18
- package/dist/cjs/variants/base-element.js +1 -1
- package/dist/cjs/variants/base-element.js.map +2 -2
- package/dist/cjs/variants/base-field.d.ts +110 -0
- package/dist/cjs/variants/base-field.js +2 -0
- package/dist/cjs/variants/base-field.js.map +7 -0
- package/dist/cjs/variants/base-input.d.ts +5 -0
- package/dist/cjs/variants/base-input.js +2 -0
- package/dist/cjs/variants/base-input.js.map +7 -0
- package/dist/cjs/variants/button.d.ts +26 -54
- package/dist/cjs/variants/button.js +1 -1
- package/dist/cjs/variants/button.js.map +2 -2
- package/dist/cjs/variants/card.d.ts +2 -62
- package/dist/cjs/variants/card.js +1 -1
- package/dist/cjs/variants/card.js.map +2 -2
- package/dist/cjs/variants/checkbox.d.ts +23 -0
- package/dist/cjs/variants/checkbox.js +2 -0
- package/dist/cjs/variants/checkbox.js.map +7 -0
- package/dist/cjs/variants/field-error.d.ts +65 -0
- package/dist/cjs/variants/field-error.js +2 -0
- package/dist/cjs/variants/field-error.js.map +7 -0
- package/dist/cjs/variants/heading.d.ts +19 -205
- package/dist/cjs/variants/index.d.ts +2 -0
- package/dist/cjs/variants/index.js +1 -1
- package/dist/cjs/variants/index.js.map +2 -2
- package/dist/cjs/variants/link.d.ts +215 -0
- package/dist/cjs/variants/link.js +2 -0
- package/dist/cjs/variants/link.js.map +7 -0
- package/dist/cjs/variants/popover.d.ts +5 -61
- package/dist/cjs/variants/popover.js +1 -1
- package/dist/cjs/variants/popover.js.map +2 -2
- package/dist/cjs/variants/text-area.d.ts +141 -0
- package/dist/cjs/variants/text-area.js +2 -0
- package/dist/cjs/variants/text-area.js.map +7 -0
- package/dist/cjs/variants/text-field.d.ts +78 -30
- package/dist/cjs/variants/text-field.js +1 -1
- package/dist/cjs/variants/text-field.js.map +3 -3
- package/dist/cjs/variants/text.d.ts +20 -205
- package/dist/cjs/variants/text.js +1 -1
- package/dist/cjs/variants/text.js.map +2 -2
- package/dist/cjs/variants/tooltip.d.ts +1 -1
- package/dist/cjs/variants/tooltip.js +1 -1
- package/dist/cjs/variants/tooltip.js.map +2 -2
- package/dist/cjs/variants/typography.d.ts +14 -159
- package/dist/cjs/variants/typography.js +1 -1
- package/dist/cjs/variants/typography.js.map +2 -2
- package/dist/esm/components/button.d.ts +2 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.js.map +3 -3
- package/dist/esm/components/card.js +1 -1
- package/dist/esm/components/card.js.map +2 -2
- package/dist/esm/components/checkbox.d.ts +18 -0
- package/dist/esm/components/checkbox.js +2 -0
- package/dist/esm/components/checkbox.js.map +7 -0
- package/dist/esm/components/flex.d.ts +321 -16
- package/dist/esm/components/flex.js +1 -1
- package/dist/esm/components/flex.js.map +3 -3
- package/dist/esm/components/form.d.ts +11 -0
- package/dist/esm/components/form.js +2 -0
- package/dist/esm/components/form.js.map +7 -0
- package/dist/esm/components/index.d.ts +5 -0
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/components/link.d.ts +10 -0
- package/dist/esm/components/link.js +2 -0
- package/dist/esm/components/link.js.map +7 -0
- package/dist/esm/components/number-field.d.ts +11 -0
- package/dist/esm/components/number-field.js +2 -0
- package/dist/esm/components/number-field.js.map +7 -0
- package/dist/esm/components/popover.d.ts +6 -6
- package/dist/esm/components/text-area.d.ts +11 -0
- package/dist/esm/components/text-area.js +2 -0
- package/dist/esm/components/text-area.js.map +7 -0
- package/dist/esm/components/text-field.d.ts +10 -1
- package/dist/esm/components/text-field.js +1 -1
- package/dist/esm/components/text-field.js.map +3 -3
- package/dist/esm/components/text.d.ts +1 -1
- package/dist/esm/components/text.js +1 -1
- package/dist/esm/components/text.js.map +3 -3
- package/dist/esm/components/theme.d.ts +2 -0
- package/dist/esm/components/theme.js +1 -1
- package/dist/esm/components/theme.js.map +3 -3
- package/dist/esm/components/tooltip.js +1 -1
- package/dist/esm/components/tooltip.js.map +2 -2
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/index.js.map +2 -2
- package/dist/esm/hooks/use-in-app.js +1 -1
- package/dist/esm/hooks/use-in-app.js.map +3 -3
- package/dist/esm/hooks/use-product-release.d.ts +6 -0
- package/dist/esm/hooks/use-product-release.js +2 -0
- package/dist/esm/hooks/use-product-release.js.map +7 -0
- package/dist/esm/providers/DashXProvider.d.ts +7 -2
- package/dist/esm/providers/DashXProvider.js +1 -1
- package/dist/esm/providers/DashXProvider.js.map +3 -3
- package/dist/esm/providers/index.d.ts +1 -1
- package/dist/esm/providers/index.js +1 -1
- package/dist/esm/providers/index.js.map +3 -3
- package/dist/esm/utils/helpers.d.ts +2 -0
- package/dist/esm/utils/helpers.js +2 -0
- package/dist/esm/utils/helpers.js.map +7 -0
- package/dist/esm/variants/base-element.d.ts +91 -0
- package/dist/esm/variants/base-element.js +1 -1
- package/dist/esm/variants/base-element.js.map +2 -2
- package/dist/esm/variants/base-field.d.ts +236 -0
- package/dist/esm/variants/base-field.js +2 -0
- package/dist/esm/variants/base-field.js.map +7 -0
- package/dist/esm/variants/base-input.d.ts +5 -0
- package/dist/esm/variants/base-input.js +2 -0
- package/dist/esm/variants/base-input.js.map +7 -0
- package/dist/esm/variants/button.d.ts +122 -15
- package/dist/esm/variants/button.js +1 -1
- package/dist/esm/variants/button.js.map +2 -2
- package/dist/esm/variants/card.d.ts +2 -2
- package/dist/esm/variants/card.js +1 -1
- package/dist/esm/variants/card.js.map +2 -2
- package/dist/esm/variants/checkbox.d.ts +41 -0
- package/dist/esm/variants/checkbox.js +2 -0
- package/dist/esm/variants/checkbox.js.map +7 -0
- package/dist/esm/variants/field-error.d.ts +149 -0
- package/dist/esm/variants/field-error.js +2 -0
- package/dist/esm/variants/field-error.js.map +7 -0
- package/dist/esm/variants/heading.d.ts +45 -0
- package/dist/esm/variants/index.d.ts +2 -0
- package/dist/esm/variants/index.js +1 -1
- package/dist/esm/variants/index.js.map +2 -2
- package/dist/esm/variants/link.d.ts +470 -0
- package/dist/esm/variants/link.js +2 -0
- package/dist/esm/variants/link.js.map +7 -0
- package/dist/esm/variants/popover.d.ts +4 -4
- package/dist/esm/variants/popover.js +1 -1
- package/dist/esm/variants/popover.js.map +2 -2
- package/dist/esm/variants/text-area.d.ts +298 -0
- package/dist/esm/variants/text-area.js +2 -0
- package/dist/esm/variants/text-area.js.map +7 -0
- package/dist/esm/variants/text-field.d.ts +218 -13
- package/dist/esm/variants/text-field.js +1 -1
- package/dist/esm/variants/text-field.js.map +3 -3
- package/dist/esm/variants/text.d.ts +48 -1
- package/dist/esm/variants/text.js +1 -1
- package/dist/esm/variants/text.js.map +2 -2
- package/dist/esm/variants/tooltip.d.ts +1 -1
- package/dist/esm/variants/tooltip.js +1 -1
- package/dist/esm/variants/tooltip.js.map +2 -2
- package/dist/esm/variants/typography.d.ts +35 -0
- package/dist/esm/variants/typography.js +1 -1
- package/dist/esm/variants/typography.js.map +2 -2
- package/package.json +5 -6
- package/src/components/button.tsx +17 -21
- package/src/components/card.tsx +2 -2
- package/src/components/checkbox.tsx +255 -0
- package/src/components/flex.tsx +17 -7
- package/src/components/form.tsx +30 -0
- package/src/components/index.ts +5 -0
- package/src/components/link.tsx +90 -0
- package/src/components/number-field.tsx +174 -0
- package/src/components/text-area.tsx +107 -0
- package/src/components/text-field.tsx +103 -3
- package/src/components/text.tsx +13 -4
- package/src/components/theme.tsx +16 -4
- package/src/components/tooltip.tsx +1 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-in-app.ts +17 -58
- package/src/hooks/use-product-release.ts +38 -0
- package/src/providers/DashXProvider.tsx +91 -5
- package/src/providers/index.ts +1 -1
- package/src/styles/index.css +180 -43
- package/src/utils/helpers.ts +21 -0
- package/src/variants/base-element.ts +18 -5
- package/src/variants/base-field.ts +42 -0
- package/src/variants/base-input.ts +13 -0
- package/src/variants/button.ts +47 -27
- package/src/variants/card.ts +3 -3
- package/src/variants/checkbox.ts +33 -0
- package/src/variants/field-error.ts +29 -0
- package/src/variants/index.ts +2 -0
- package/src/variants/link.ts +34 -0
- package/src/variants/popover.ts +5 -5
- package/src/variants/text-area.ts +26 -0
- package/src/variants/text-field.ts +14 -3
- package/src/variants/text.ts +2 -1
- package/src/variants/tooltip.ts +1 -1
- package/src/variants/typography.ts +14 -9
- package/styles.css +546 -124
- package/dist/cjs/tsconfig.tsbuildinfo +0 -1
- package/dist/esm/tsconfig.tsbuildinfo +0 -1
|
@@ -20,25 +20,25 @@ type PopoverBodyProps = React.PropsWithChildren<{
|
|
|
20
20
|
asChild?: boolean;
|
|
21
21
|
}>;
|
|
22
22
|
declare const PopoverBody: React.ForwardRefExoticComponent<{
|
|
23
|
-
asChild?: boolean
|
|
23
|
+
asChild?: boolean;
|
|
24
24
|
} & {
|
|
25
|
-
children?: React.ReactNode;
|
|
25
|
+
children?: React.ReactNode | undefined;
|
|
26
26
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
27
27
|
type PopoverHeaderProps = React.PropsWithChildren<{
|
|
28
28
|
asChild?: boolean;
|
|
29
29
|
}>;
|
|
30
30
|
declare const PopoverHeader: React.ForwardRefExoticComponent<{
|
|
31
|
-
asChild?: boolean
|
|
31
|
+
asChild?: boolean;
|
|
32
32
|
} & {
|
|
33
|
-
children?: React.ReactNode;
|
|
33
|
+
children?: React.ReactNode | undefined;
|
|
34
34
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
35
35
|
type PopoverFooterProps = React.PropsWithChildren<{
|
|
36
36
|
asChild?: boolean;
|
|
37
37
|
}>;
|
|
38
38
|
declare const PopoverFooter: React.ForwardRefExoticComponent<{
|
|
39
|
-
asChild?: boolean
|
|
39
|
+
asChild?: boolean;
|
|
40
40
|
} & {
|
|
41
|
-
children?: React.ReactNode;
|
|
41
|
+
children?: React.ReactNode | undefined;
|
|
42
42
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
43
43
|
interface PopoverCloseProps extends React.PropsWithChildren<{}> {
|
|
44
44
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { TextFieldProps, ValidationResult } from 'react-aria-components';
|
|
3
|
+
import { type TextAreaVariantProps } from '../variants/text-area.js';
|
|
4
|
+
interface TextAreaProps extends TextFieldProps, TextAreaVariantProps {
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
description?: string | ReactNode;
|
|
8
|
+
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
9
|
+
}
|
|
10
|
+
declare const TextArea: import("react").ForwardRefExoticComponent<TextAreaProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export { TextArea };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as a,jsxs as x}from"react/jsx-runtime";import{useContextProps as y,TextFieldContext as R}from"react-aria-components";import{cn as u}from"../utils/cn.js";import{Flex as P,Text as l}from"./index.js";import{fieldError as g}from"../variants/field-error.js";import{filterDOMProps as A}from"@react-aria/utils";import{useTextField as F}from"react-aria";import{forwardRef as b,useRef as w}from"react";import{removeDataAttributes as D}from"../utils/helpers.js";import{textArea as E}from"../variants/text-area.js";function N({label:r,description:s,errorMessage:i,size:m="medium",roundness:d="medium",elevation:n="medium",...e},o){[e,o]=y(e,o,R);let f=w(null),{labelProps:p,inputProps:c,descriptionProps:T,errorMessageProps:v,...t}=F({...D(e),inputElementType:"text-area",label:r},f);return x(P,{...A(e),gap:2,direction:"column",ref:o,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":t.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,children:[r&&a(l,{...p,size:1,transform:"uppercase",weight:"semibold",variant:"tertiary",color:"gray",children:r}),x("div",{role:"group",className:"relative","data-radius":d,"data-shadow":n,children:[a("textarea",{...c,ref:f,className:u("dx","w-full",E({size:m,roundness:d,elevation:n})),"data-disabled":e.isDisabled||void 0,"data-invalid":t.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0}),t.isInvalid&&a(l,{...v,size:1,className:u("dx",g({size:m,roundness:d,elevation:n})),children:i?typeof i=="string"?i:i(t):t.validationErrors.length===0?void 0:t.validationErrors.join(" ")})]}),s&&a(l,{size:1,variant:"tertiary",...T,children:s})]})}const h=b(N);export{h as TextArea};
|
|
2
|
+
//# sourceMappingURL=text-area.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/text-area.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useContextProps, TextFieldContext } from 'react-aria-components';\nimport { cn } from '../utils/cn.js';\n\nimport { Flex, Text } from './index.js';\nimport { fieldError } from '../variants/field-error.js';\nimport { filterDOMProps } from '@react-aria/utils';\nimport { useTextField } from 'react-aria';\nimport { forwardRef, useRef, type ReactNode } from 'react';\nimport { removeDataAttributes } from '../utils/helpers.js';\n\nimport type { TextFieldProps, ValidationResult } from 'react-aria-components';\nimport { textArea, type TextAreaVariantProps } from '../variants/text-area.js';\n\ninterface TextAreaProps extends TextFieldProps, TextAreaVariantProps {\n placeholder?: string;\n label?: string;\n description?: string | ReactNode;\n errorMessage?: string | ((validation: ValidationResult) => string);\n}\n\nfunction _TextArea(\n {\n label,\n description,\n errorMessage,\n size = 'medium',\n roundness = 'medium',\n elevation = 'medium',\n ...props\n }: TextAreaProps,\n ref: React.ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, TextFieldContext);\n let inputRef = useRef(null);\n\n let { labelProps, inputProps, descriptionProps, errorMessageProps, ...validation } =\n useTextField<any>(\n {\n ...removeDataAttributes(props),\n inputElementType: 'text-area',\n label,\n },\n inputRef,\n );\n\n return (\n <Flex\n {...filterDOMProps(props)}\n gap={2}\n direction=\"column\"\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n >\n {label && (\n <Text\n {...labelProps}\n size={1}\n transform=\"uppercase\"\n weight=\"semibold\"\n variant=\"tertiary\"\n color=\"gray\"\n >\n {label}\n </Text>\n )}\n <div role=\"group\" className=\"relative\" data-radius={roundness} data-shadow={elevation}>\n <textarea\n {...inputProps}\n ref={inputRef}\n className={cn('dx', 'w-full', textArea({ size, roundness, elevation }))}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n />\n {validation.isInvalid && (\n <Text\n {...errorMessageProps}\n size={1}\n className={cn('dx', fieldError({ size, roundness, elevation }))}\n >\n {errorMessage\n ? typeof errorMessage === 'string'\n ? errorMessage\n : errorMessage(validation)\n : validation.validationErrors.length === 0\n ? undefined\n : validation.validationErrors.join(' ')}\n </Text>\n )}\n </div>\n {description && (\n <Text size={1} variant=\"tertiary\" {...descriptionProps}>\n {description}\n </Text>\n )}\n </Flex>\n );\n}\n\nconst TextArea = forwardRef(_TextArea);\n\nexport { TextArea };\n"],
|
|
5
|
+
"mappings": "AA0DQ,cAAAA,EAWF,QAAAC,MAXE,oBA1DR,OAAS,mBAAAC,EAAiB,oBAAAC,MAAwB,wBAClD,OAAS,MAAAC,MAAU,iBAEnB,OAAS,QAAAC,EAAM,QAAAC,MAAY,aAC3B,OAAS,cAAAC,MAAkB,6BAC3B,OAAS,kBAAAC,MAAsB,oBAC/B,OAAS,gBAAAC,MAAoB,aAC7B,OAAS,cAAAC,EAAY,UAAAC,MAA8B,QACnD,OAAS,wBAAAC,MAA4B,sBAGrC,OAAS,YAAAC,MAA2C,2BASpD,SAASC,EACP,CACE,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,KAAAC,EAAO,SACP,UAAAC,EAAY,SACZ,UAAAC,EAAY,SACZ,GAAGC,CACL,EACAC,EACA,CACA,CAACD,EAAOC,CAAG,EAAIpB,EAAgBmB,EAAOC,EAAKnB,CAAgB,EAC3D,IAAIoB,EAAWZ,EAAO,IAAI,EAEtB,CAAE,WAAAa,EAAY,WAAAC,EAAY,iBAAAC,EAAkB,kBAAAC,EAAmB,GAAGC,CAAW,EAC/EnB,EACE,CACE,GAAGG,EAAqBS,CAAK,EAC7B,iBAAkB,YAClB,MAAAN,CACF,EACAQ,CACF,EAEF,OACEtB,EAACI,EAAA,CACE,GAAGG,EAAea,CAAK,EACxB,IAAK,EACL,UAAU,SACV,IAAKC,EACL,KAAMD,EAAM,MAAQ,OACpB,gBAAeA,EAAM,YAAc,OACnC,eAAcO,EAAW,WAAa,OACtC,gBAAeP,EAAM,YAAc,OACnC,gBAAeA,EAAM,YAAc,OAElC,UAAAN,GACCf,EAACM,EAAA,CACE,GAAGkB,EACJ,KAAM,EACN,UAAU,YACV,OAAO,WACP,QAAQ,WACR,MAAM,OAEL,SAAAT,EACH,EAEFd,EAAC,OAAI,KAAK,QAAQ,UAAU,WAAW,cAAakB,EAAW,cAAaC,EAC1E,UAAApB,EAAC,YACE,GAAGyB,EACJ,IAAKF,EACL,UAAWnB,EAAG,KAAM,SAAUS,EAAS,CAAE,KAAAK,EAAM,UAAAC,EAAW,UAAAC,CAAU,CAAC,CAAC,EACtE,gBAAeC,EAAM,YAAc,OACnC,eAAcO,EAAW,WAAa,OACtC,gBAAeP,EAAM,YAAc,OACnC,gBAAeA,EAAM,YAAc,OACrC,EACCO,EAAW,WACV5B,EAACM,EAAA,CACE,GAAGqB,EACJ,KAAM,EACN,UAAWvB,EAAG,KAAMG,EAAW,CAAE,KAAAW,EAAM,UAAAC,EAAW,UAAAC,CAAU,CAAC,CAAC,EAE7D,SAAAH,EACG,OAAOA,GAAiB,SACtBA,EACAA,EAAaW,CAAU,EACzBA,EAAW,iBAAiB,SAAW,EACrC,OACAA,EAAW,iBAAiB,KAAK,GAAG,EAC5C,GAEJ,EACCZ,GACChB,EAACM,EAAA,CAAK,KAAM,EAAG,QAAQ,WAAY,GAAGoB,EACnC,SAAAV,EACH,GAEJ,CAEJ,CAEA,MAAMa,EAAWnB,EAAWI,CAAS",
|
|
6
|
+
"names": ["jsx", "jsxs", "useContextProps", "TextFieldContext", "cn", "Flex", "Text", "fieldError", "filterDOMProps", "useTextField", "forwardRef", "useRef", "removeDataAttributes", "textArea", "_TextArea", "label", "description", "errorMessage", "size", "roundness", "elevation", "props", "ref", "inputRef", "labelProps", "inputProps", "descriptionProps", "errorMessageProps", "validation", "TextArea"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { TextFieldVariantProps } from '../variants/index.js';
|
|
3
|
+
import type { TextFieldProps as BaseTextFieldProps, ValidationResult } from 'react-aria-components';
|
|
4
|
+
interface TextFieldProps extends BaseTextFieldProps, TextFieldVariantProps {
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
description?: string | ReactNode;
|
|
8
|
+
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
9
|
+
}
|
|
10
|
+
declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
2
11
|
export { TextField };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as d,jsxs as x}from"react/jsx-runtime";import{useContextProps as F,TextFieldContext as y}from"react-aria-components";import{cn as u}from"../utils/cn.js";import{textField as P}from"../variants/index.js";import{Flex as R,Text as l}from"./index.js";import{fieldError as g}from"../variants/field-error.js";import{filterDOMProps as b}from"@react-aria/utils";import{useTextField as w}from"react-aria";import{forwardRef as D,useRef as E}from"react";import{removeDataAttributes as N}from"../utils/helpers.js";function h({label:a,description:s,errorMessage:t,size:m="medium",roundness:r="medium",elevation:n="medium",...e},o){[e,o]=F(e,o,y);let f=E(null),{labelProps:p,inputProps:c,descriptionProps:T,errorMessageProps:v,...i}=w({...N(e),inputElementType:"input",label:a},f);return x(R,{...b(e),gap:2,direction:"column",ref:o,slot:e.slot||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":i.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0,children:[a&&d(l,{...p,size:1,transform:"uppercase",weight:"semibold",variant:"tertiary",color:"gray",children:a}),x("div",{role:"group",className:"relative","data-radius":r,"data-shadow":n,children:[d("input",{...c,ref:f,className:u("dx","w-full",P({size:m,roundness:r,elevation:n})),"data-disabled":e.isDisabled||void 0,"data-invalid":i.isInvalid||void 0,"data-readonly":e.isReadOnly||void 0,"data-required":e.isRequired||void 0}),i.isInvalid&&d(l,{...v,size:1,className:u("dx",g({size:m,roundness:r,elevation:n})),children:t?typeof t=="string"?t:t(i):i.validationErrors.length===0?void 0:i.validationErrors.join(" ")})]}),s&&d(l,{size:1,variant:"tertiary",...T,children:s})]})}const q=D(h);export{q as TextField};
|
|
2
2
|
//# sourceMappingURL=text-field.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/text-field.tsx"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "TextField"]
|
|
4
|
+
"sourcesContent": ["import { useContextProps, TextFieldContext } from 'react-aria-components';\nimport { cn } from '../utils/cn.js';\nimport { textField } from '../variants/index.js';\nimport { Flex, Text } from './index.js';\nimport { fieldError } from '../variants/field-error.js';\nimport { filterDOMProps } from '@react-aria/utils';\nimport { useTextField } from 'react-aria';\nimport { forwardRef, useRef, type ReactNode } from 'react';\nimport { removeDataAttributes } from '../utils/helpers.js';\n\nimport type { TextFieldVariantProps } from '../variants/index.js';\nimport type { TextFieldProps as BaseTextFieldProps, ValidationResult } from 'react-aria-components';\n\ninterface TextFieldProps extends BaseTextFieldProps, TextFieldVariantProps {\n placeholder?: string;\n label?: string;\n description?: string | ReactNode;\n errorMessage?: string | ((validation: ValidationResult) => string);\n}\n\nfunction _TextField(\n {\n label,\n description,\n errorMessage,\n size = 'medium',\n roundness = 'medium',\n elevation = 'medium',\n ...props\n }: TextFieldProps,\n ref: React.ForwardedRef<HTMLDivElement>,\n) {\n [props, ref] = useContextProps(props, ref, TextFieldContext);\n let inputRef = useRef(null);\n\n let { labelProps, inputProps, descriptionProps, errorMessageProps, ...validation } =\n useTextField<any>(\n {\n ...removeDataAttributes(props),\n inputElementType: 'input',\n label,\n },\n inputRef,\n );\n\n return (\n <Flex\n {...filterDOMProps(props)}\n gap={2}\n direction=\"column\"\n ref={ref}\n slot={props.slot || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n >\n {label && (\n <Text\n {...labelProps}\n size={1}\n transform=\"uppercase\"\n weight=\"semibold\"\n variant=\"tertiary\"\n color=\"gray\"\n >\n {label}\n </Text>\n )}\n <div role=\"group\" className=\"relative\" data-radius={roundness} data-shadow={elevation}>\n <input\n {...inputProps}\n ref={inputRef}\n className={cn('dx', 'w-full', textField({ size, roundness, elevation }))}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-readonly={props.isReadOnly || undefined}\n data-required={props.isRequired || undefined}\n />\n {validation.isInvalid && (\n <Text\n {...errorMessageProps}\n size={1}\n className={cn('dx', fieldError({ size, roundness, elevation }))}\n >\n {errorMessage\n ? typeof errorMessage === 'string'\n ? errorMessage\n : errorMessage(validation)\n : validation.validationErrors.length === 0\n ? undefined\n : validation.validationErrors.join(' ')}\n </Text>\n )}\n </div>\n {description && (\n <Text size={1} variant=\"tertiary\" {...descriptionProps}>\n {description}\n </Text>\n )}\n </Flex>\n );\n}\n\nconst TextField = forwardRef(_TextField);\n\nexport { TextField };\n"],
|
|
5
|
+
"mappings": "AA0DQ,cAAAA,EAWF,QAAAC,MAXE,oBA1DR,OAAS,mBAAAC,EAAiB,oBAAAC,MAAwB,wBAClD,OAAS,MAAAC,MAAU,iBACnB,OAAS,aAAAC,MAAiB,uBAC1B,OAAS,QAAAC,EAAM,QAAAC,MAAY,aAC3B,OAAS,cAAAC,MAAkB,6BAC3B,OAAS,kBAAAC,MAAsB,oBAC/B,OAAS,gBAAAC,MAAoB,aAC7B,OAAS,cAAAC,EAAY,UAAAC,MAA8B,QACnD,OAAS,wBAAAC,MAA4B,sBAYrC,SAASC,EACP,CACE,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,KAAAC,EAAO,SACP,UAAAC,EAAY,SACZ,UAAAC,EAAY,SACZ,GAAGC,CACL,EACAC,EACA,CACA,CAACD,EAAOC,CAAG,EAAIpB,EAAgBmB,EAAOC,EAAKnB,CAAgB,EAC3D,IAAIoB,EAAWX,EAAO,IAAI,EAEtB,CAAE,WAAAY,EAAY,WAAAC,EAAY,iBAAAC,EAAkB,kBAAAC,EAAmB,GAAGC,CAAW,EAC/ElB,EACE,CACE,GAAGG,EAAqBQ,CAAK,EAC7B,iBAAkB,QAClB,MAAAN,CACF,EACAQ,CACF,EAEF,OACEtB,EAACK,EAAA,CACE,GAAGG,EAAeY,CAAK,EACxB,IAAK,EACL,UAAU,SACV,IAAKC,EACL,KAAMD,EAAM,MAAQ,OACpB,gBAAeA,EAAM,YAAc,OACnC,eAAcO,EAAW,WAAa,OACtC,gBAAeP,EAAM,YAAc,OACnC,gBAAeA,EAAM,YAAc,OAElC,UAAAN,GACCf,EAACO,EAAA,CACE,GAAGiB,EACJ,KAAM,EACN,UAAU,YACV,OAAO,WACP,QAAQ,WACR,MAAM,OAEL,SAAAT,EACH,EAEFd,EAAC,OAAI,KAAK,QAAQ,UAAU,WAAW,cAAakB,EAAW,cAAaC,EAC1E,UAAApB,EAAC,SACE,GAAGyB,EACJ,IAAKF,EACL,UAAWnB,EAAG,KAAM,SAAUC,EAAU,CAAE,KAAAa,EAAM,UAAAC,EAAW,UAAAC,CAAU,CAAC,CAAC,EACvE,gBAAeC,EAAM,YAAc,OACnC,eAAcO,EAAW,WAAa,OACtC,gBAAeP,EAAM,YAAc,OACnC,gBAAeA,EAAM,YAAc,OACrC,EACCO,EAAW,WACV5B,EAACO,EAAA,CACE,GAAGoB,EACJ,KAAM,EACN,UAAWvB,EAAG,KAAMI,EAAW,CAAE,KAAAU,EAAM,UAAAC,EAAW,UAAAC,CAAU,CAAC,CAAC,EAE7D,SAAAH,EACG,OAAOA,GAAiB,SACtBA,EACAA,EAAaW,CAAU,EACzBA,EAAW,iBAAiB,SAAW,EACrC,OACAA,EAAW,iBAAiB,KAAK,GAAG,EAC5C,GAEJ,EACCZ,GACChB,EAACO,EAAA,CAAK,KAAM,EAAG,QAAQ,WAAY,GAAGmB,EACnC,SAAAV,EACH,GAEJ,CAEJ,CAEA,MAAMa,EAAYlB,EAAWG,CAAU",
|
|
6
|
+
"names": ["jsx", "jsxs", "useContextProps", "TextFieldContext", "cn", "textField", "Flex", "Text", "fieldError", "filterDOMProps", "useTextField", "forwardRef", "useRef", "removeDataAttributes", "_TextField", "label", "description", "errorMessage", "size", "roundness", "elevation", "props", "ref", "inputRef", "labelProps", "inputProps", "descriptionProps", "errorMessageProps", "validation", "TextField"]
|
|
7
7
|
}
|
|
@@ -16,5 +16,5 @@ type TextPProps = {
|
|
|
16
16
|
as: 'p';
|
|
17
17
|
} & React.HTMLAttributes<HTMLParagraphElement>;
|
|
18
18
|
type TextProps = TextOwnProps & (TextSpanProps | TextDivProps | TextLabelProps | TextPProps);
|
|
19
|
-
declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<
|
|
19
|
+
declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLElement>>;
|
|
20
20
|
export { Text };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as a}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{useContextProps as b,TextContext as o}from"react-aria-components";import d from"react";import{Slot as v}from"@radix-ui/react-slot";import{text as H}from"../variants/text.js";const s=d.forwardRef((t,e)=>{[t,e]=b(t,e,o);const{as:n="span",asChild:p,children:r,className:T,size:i,align:x,color:l,variant:P,weight:m,transform:L,...c}=t;return a(o.Provider,{value:t,children:a(v,{className:H({className:T,size:i,align:x,color:l,variant:P,weight:m,transform:L}),ref:e,...c,children:p?r:a(n,{children:r})})})});s.displayName="Text";export{s as Text};
|
|
2
2
|
//# sourceMappingURL=text.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/text.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport { text } from '../variants/text.js';\n\nimport type { TextVariantProps } from '../variants/text.js';\n\ninterface TextOwnProps extends TextVariantProps {\n asChild?: boolean;\n}\n\ntype TextSpanProps = { as?: 'span' } & React.HTMLAttributes<HTMLSpanElement>;\ntype TextDivProps = { as: 'div' } & React.HTMLAttributes<HTMLDivElement>;\ntype TextLabelProps = { as: 'label' } & React.HTMLAttributes<HTMLLabelElement>;\ntype TextPProps = { as: 'p' } & React.HTMLAttributes<HTMLParagraphElement>;\n\ntype TextProps = TextOwnProps & (TextSpanProps | TextDivProps | TextLabelProps | TextPProps);\n\nconst Text = React.forwardRef<
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "React", "Slot", "text", "Text", "props", "ref", "Tag", "asChild", "children", "className", "size", "align", "color", "variant", "weight", "rest"]
|
|
4
|
+
"sourcesContent": ["import { useContextProps, LinkContext, TextContext } from 'react-aria-components';\nimport React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport { text } from '../variants/text.js';\n\nimport type { TextVariantProps } from '../variants/text.js';\n\ninterface TextOwnProps extends TextVariantProps {\n asChild?: boolean;\n}\n\ntype TextSpanProps = { as?: 'span' } & React.HTMLAttributes<HTMLSpanElement>;\ntype TextDivProps = { as: 'div' } & React.HTMLAttributes<HTMLDivElement>;\ntype TextLabelProps = { as: 'label' } & React.HTMLAttributes<HTMLLabelElement>;\ntype TextPProps = { as: 'p' } & React.HTMLAttributes<HTMLParagraphElement>;\n\ntype TextProps = TextOwnProps & (TextSpanProps | TextDivProps | TextLabelProps | TextPProps);\n\nconst Text = React.forwardRef<HTMLElement, TextProps>((props, ref) => {\n [props, ref] = useContextProps(props, ref, TextContext);\n const {\n as: Tag = 'span',\n asChild,\n children,\n className,\n size,\n align,\n color,\n variant,\n weight,\n transform,\n ...rest\n } = props;\n\n return (\n <TextContext.Provider value={props}>\n <Slot\n className={text({ className, size, align, color, variant, weight, transform })}\n ref={ref}\n {...rest}\n >\n {asChild ? children : <Tag>{children}</Tag>}\n </Slot>\n </TextContext.Provider>\n );\n});\n\nText.displayName = 'Text';\n\nexport { Text };\n"],
|
|
5
|
+
"mappings": "AA0C8B,cAAAA,MAAA,oBA1C9B,OAAS,mBAAAC,EAA8B,eAAAC,MAAmB,wBAC1D,OAAOC,MAAW,QAClB,OAAS,QAAAC,MAAY,uBAErB,OAAS,QAAAC,MAAY,sBAerB,MAAMC,EAAOH,EAAM,WAAmC,CAACI,EAAOC,IAAQ,CACpE,CAACD,EAAOC,CAAG,EAAIP,EAAgBM,EAAOC,EAAKN,CAAW,EACtD,KAAM,CACJ,GAAIO,EAAM,OACV,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,KAAAC,EACA,MAAAC,EACA,MAAAC,EACA,QAAAC,EACA,OAAAC,EACA,UAAAC,EACA,GAAGC,CACL,EAAIZ,EAEJ,OACEP,EAACE,EAAY,SAAZ,CAAqB,MAAOK,EAC3B,SAAAP,EAACI,EAAA,CACC,UAAWC,EAAK,CAAE,UAAAO,EAAW,KAAAC,EAAM,MAAAC,EAAO,MAAAC,EAAO,QAAAC,EAAS,OAAAC,EAAQ,UAAAC,CAAU,CAAC,EAC7E,IAAKV,EACJ,GAAGW,EAEH,SAAAT,EAAUC,EAAWX,EAACS,EAAA,CAAK,SAAAE,EAAS,EACvC,EACF,CAEJ,CAAC,EAEDL,EAAK,YAAc",
|
|
6
|
+
"names": ["jsx", "useContextProps", "TextContext", "React", "Slot", "text", "Text", "props", "ref", "Tag", "asChild", "children", "className", "size", "align", "color", "variant", "weight", "transform", "rest"]
|
|
7
7
|
}
|
|
@@ -4,8 +4,10 @@ interface ThemeContext {
|
|
|
4
4
|
negativeBaseColor?: string;
|
|
5
5
|
grayBaseColor?: string;
|
|
6
6
|
roundness?: 'none' | 'small' | 'medium' | 'large' | 'full';
|
|
7
|
+
elevation?: 'none' | 'small' | 'medium' | 'large';
|
|
7
8
|
density?: number;
|
|
8
9
|
contrast?: number;
|
|
10
|
+
chroma?: number;
|
|
9
11
|
mode?: 'light' | 'dark';
|
|
10
12
|
}
|
|
11
13
|
interface ThemeProps extends ThemeContext, React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{Slot as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{Slot as y}from"@radix-ui/react-slot";import*as t from"react";import{TooltipProvider as T}from"@radix-ui/react-tooltip";import{DirectionProvider as B}from"@radix-ui/react-direction";const h=t.createContext({accentBaseColor:void 0,negativeBaseColor:"oklch(0% 0 20)",grayBaseColor:void 0,roundness:"medium",elevation:"medium",density:1,contrast:1,mode:"light",chroma:1}),C=t.forwardRef((u,v)=>{const e=t.useContext(h),{asChild:g,accentBaseColor:r=e.accentBaseColor,negativeBaseColor:a=e.negativeBaseColor,grayBaseColor:n=e.grayBaseColor,roundness:s=e.roundness,elevation:i=e.elevation,density:m=e.density,contrast:d=e.contrast,mode:l=e.mode,chroma:c=e.chroma,...f}=u,p=g?y:"div";return o(T,{delayDuration:200,children:o(B,{dir:"ltr",children:o(h.Provider,{value:{accentBaseColor:r,negativeBaseColor:a,grayBaseColor:n,roundness:s,elevation:i,density:m,contrast:d,mode:l,chroma:c},children:o(p,{...f,className:"dx "+l,ref:v,style:{"--accent-base":r,"--negative-base":a,"--gray-base":n,"--base-density":m,"--contrast-factor":d,"--chroma-factor":c},"data-radius":s,"data-shadow":i})})})})});C.displayName="Theme";export{C as Theme};
|
|
2
2
|
//# sourceMappingURL=theme.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/theme.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Slot } from '@radix-ui/react-slot';\nimport * as React from 'react';\nimport { TooltipProvider } from '@radix-ui/react-tooltip';\nimport { DirectionProvider } from '@radix-ui/react-direction';\n\ninterface ThemeContext {\n accentBaseColor?: string;\n negativeBaseColor?: string;\n grayBaseColor?: string;\n roundness?: 'none' | 'small' | 'medium' | 'large' | 'full';\n density?: number;\n contrast?: number;\n mode?: 'light' | 'dark';\n}\n\ninterface ThemeProps extends ThemeContext, React.HTMLAttributes<HTMLDivElement> {\n asChild?: boolean;\n}\n\nconst ThemeContext = React.createContext<ThemeContext>({\n accentBaseColor: undefined,\n negativeBaseColor:
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "Slot", "React", "TooltipProvider", "DirectionProvider", "ThemeContext", "Theme", "props", "ref", "parentTheme", "asChild", "accentBaseColor", "negativeBaseColor", "grayBaseColor", "roundness", "density", "contrast", "mode", "rest", "Comp"]
|
|
4
|
+
"sourcesContent": ["import { Slot } from '@radix-ui/react-slot';\nimport * as React from 'react';\nimport { TooltipProvider } from '@radix-ui/react-tooltip';\nimport { DirectionProvider } from '@radix-ui/react-direction';\n\ninterface ThemeContext {\n accentBaseColor?: string;\n negativeBaseColor?: string;\n grayBaseColor?: string;\n roundness?: 'none' | 'small' | 'medium' | 'large' | 'full';\n elevation?: 'none' | 'small' | 'medium' | 'large';\n density?: number;\n contrast?: number;\n chroma?: number;\n mode?: 'light' | 'dark';\n}\n\ninterface ThemeProps extends ThemeContext, React.HTMLAttributes<HTMLDivElement> {\n asChild?: boolean;\n}\n\nconst ThemeContext = React.createContext<ThemeContext>({\n accentBaseColor: undefined,\n negativeBaseColor: 'oklch(0% 0 20)',\n grayBaseColor: undefined,\n roundness: 'medium',\n elevation: 'medium',\n density: 1,\n contrast: 1,\n mode: 'light',\n chroma: 1,\n});\n\nconst Theme = React.forwardRef<React.ElementRef<'div'>, ThemeProps>((props, ref) => {\n const parentTheme = React.useContext(ThemeContext);\n const {\n asChild,\n accentBaseColor = parentTheme.accentBaseColor,\n negativeBaseColor = parentTheme.negativeBaseColor,\n grayBaseColor = parentTheme.grayBaseColor,\n roundness = parentTheme.roundness,\n elevation = parentTheme.elevation,\n density = parentTheme.density,\n contrast = parentTheme.contrast,\n mode = parentTheme.mode,\n chroma = parentTheme.chroma,\n ...rest\n } = props;\n\n const Comp = asChild ? Slot : 'div';\n return (\n <TooltipProvider delayDuration={200}>\n <DirectionProvider dir=\"ltr\">\n <ThemeContext.Provider\n value={{\n accentBaseColor,\n negativeBaseColor,\n grayBaseColor,\n roundness,\n elevation,\n density,\n contrast,\n mode,\n chroma,\n }}\n >\n <Comp\n {...rest}\n className={'dx ' + mode}\n ref={ref}\n style={\n {\n '--accent-base': accentBaseColor,\n '--negative-base': negativeBaseColor,\n '--gray-base': grayBaseColor,\n '--base-density': density,\n '--contrast-factor': contrast,\n '--chroma-factor': chroma,\n } as any\n }\n data-radius={roundness}\n data-shadow={elevation}\n />\n </ThemeContext.Provider>\n </DirectionProvider>\n </TooltipProvider>\n );\n});\n\nTheme.displayName = 'Theme';\n\nexport { Theme };\nexport type { ThemeProps };\n"],
|
|
5
|
+
"mappings": "AAkEU,cAAAA,MAAA,oBAlEV,OAAS,QAAAC,MAAY,uBACrB,UAAYC,MAAW,QACvB,OAAS,mBAAAC,MAAuB,0BAChC,OAAS,qBAAAC,MAAyB,4BAkBlC,MAAMC,EAAeH,EAAM,cAA4B,CACrD,gBAAiB,OACjB,kBAAmB,iBACnB,cAAe,OACf,UAAW,SACX,UAAW,SACX,QAAS,EACT,SAAU,EACV,KAAM,QACN,OAAQ,CACV,CAAC,EAEKI,EAAQJ,EAAM,WAAgD,CAACK,EAAOC,IAAQ,CAClF,MAAMC,EAAcP,EAAM,WAAWG,CAAY,EAC3C,CACJ,QAAAK,EACA,gBAAAC,EAAkBF,EAAY,gBAC9B,kBAAAG,EAAoBH,EAAY,kBAChC,cAAAI,EAAgBJ,EAAY,cAC5B,UAAAK,EAAYL,EAAY,UACxB,UAAAM,EAAYN,EAAY,UACxB,QAAAO,EAAUP,EAAY,QACtB,SAAAQ,EAAWR,EAAY,SACvB,KAAAS,EAAOT,EAAY,KACnB,OAAAU,EAASV,EAAY,OACrB,GAAGW,CACL,EAAIb,EAEEc,EAAOX,EAAUT,EAAO,MAC9B,OACED,EAACG,EAAA,CAAgB,cAAe,IAC9B,SAAAH,EAACI,EAAA,CAAkB,IAAI,MACrB,SAAAJ,EAACK,EAAa,SAAb,CACC,MAAO,CACL,gBAAAM,EACA,kBAAAC,EACA,cAAAC,EACA,UAAAC,EACA,UAAAC,EACA,QAAAC,EACA,SAAAC,EACA,KAAAC,EACA,OAAAC,CACF,EAEA,SAAAnB,EAACqB,EAAA,CACE,GAAGD,EACJ,UAAW,MAAQF,EACnB,IAAKV,EACL,MACE,CACE,gBAAiBG,EACjB,kBAAmBC,EACnB,cAAeC,EACf,iBAAkBG,EAClB,oBAAqBC,EACrB,kBAAmBE,CACrB,EAEF,cAAaL,EACb,cAAaC,EACf,EACF,EACF,EACF,CAEJ,CAAC,EAEDT,EAAM,YAAc",
|
|
6
|
+
"names": ["jsx", "Slot", "React", "TooltipProvider", "DirectionProvider", "ThemeContext", "Theme", "props", "ref", "parentTheme", "asChild", "accentBaseColor", "negativeBaseColor", "grayBaseColor", "roundness", "elevation", "density", "contrast", "mode", "chroma", "rest", "Comp"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as o,jsxs as P}from"react/jsx-runtime";import*as p from"react";import*as e from"@radix-ui/react-tooltip";import{Slot as f}from"@radix-ui/react-slot";import{Text as c}from"./text.js";import{Theme as g}from"./theme.js";const l=t=>o(e.Root,{...t});l.displayName="Tooltip.Root";const n=p.forwardRef(({children:t,...i},r)=>o(e.Trigger,{...i,ref:r,asChild:!0,children:o(f,{children:t})}));n.displayName="Tooltip.Trigger";const a=p.forwardRef((t,i)=>{const{content:r,container:s,forceMount:m,...T}=t;return o(e.Portal,{container:s,forceMount:m,children:o(g,{asChild:!0,children:P(e.Content,{sideOffset:4,collisionPadding:10,...T,asChild:!1,ref:i,className:"rounded-sm bg-gray-600 py-2 px-4 shadow-md shadow-gray-400/30",children:[o(c,{className:"text-
|
|
1
|
+
import{jsx as o,jsxs as P}from"react/jsx-runtime";import*as p from"react";import*as e from"@radix-ui/react-tooltip";import{Slot as f}from"@radix-ui/react-slot";import{Text as c}from"./text.js";import{Theme as g}from"./theme.js";const l=t=>o(e.Root,{...t});l.displayName="Tooltip.Root";const n=p.forwardRef(({children:t,...i},r)=>o(e.Trigger,{...i,ref:r,asChild:!0,children:o(f,{children:t})}));n.displayName="Tooltip.Trigger";const a=p.forwardRef((t,i)=>{const{content:r,container:s,forceMount:m,...T}=t;return o(e.Portal,{container:s,forceMount:m,children:o(g,{asChild:!0,children:P(e.Content,{sideOffset:4,collisionPadding:10,...T,asChild:!1,ref:i,className:"rounded-sm bg-gray-600 py-2 px-4 shadow-md shadow-gray-400/30",children:[o(c,{className:"text-bg",as:"p",size:1,children:r}),o(e.Arrow,{className:"fill-gray-600"})]})})})});a.displayName="Tooltip.Content";export{a as Content,l as Root,n as Trigger};
|
|
2
2
|
//# sourceMappingURL=tooltip.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/tooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport { Text } from './text.js';\nimport { Theme } from './theme.js';\n\ntype TooltipElement = React.ElementRef<typeof TooltipPrimitive.Content>;\n\ninterface TooltipRootProps extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root> {}\nconst TooltipRoot: React.FC<TooltipRootProps> = (props: TooltipRootProps) => (\n <TooltipPrimitive.Root {...props} />\n);\nTooltipRoot.displayName = 'Tooltip.Root';\n\ntype TooltipTriggerElement = React.ElementRef<typeof TooltipPrimitive.Trigger>;\ninterface TooltipTriggerProps extends React.PropsWithChildren<{}> {}\nconst TooltipTrigger = React.forwardRef<TooltipTriggerElement, TooltipTriggerProps>(\n ({ children, ...rest }, ref) => (\n <TooltipPrimitive.Trigger {...rest} ref={ref} asChild>\n <Slot>{children}</Slot>\n </TooltipPrimitive.Trigger>\n ),\n);\nTooltipTrigger.displayName = 'Tooltip.Trigger';\n\ninterface TooltipProps\n extends Omit<\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Portal>,\n 'children' | 'className'\n >,\n Omit<\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>,\n 'children' | 'className'\n > {}\nconst TooltipContent = React.forwardRef<TooltipElement, TooltipProps>((props, forwardedRef) => {\n const { content, container, forceMount, ...rest } = props;\n\n return (\n <TooltipPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <TooltipPrimitive.Content\n sideOffset={4}\n collisionPadding={10}\n {...rest}\n asChild={false}\n ref={forwardedRef}\n className={'rounded-sm bg-gray-600 py-2 px-4 shadow-md shadow-gray-400/30'}\n >\n <Text className=\"text-
|
|
5
|
-
"mappings": "AAWE,cAAAA,EA8BM,QAAAC,MA9BN,oBAXF,UAAYC,MAAW,QACvB,UAAYC,MAAsB,0BAClC,OAAS,QAAAC,MAAY,uBAErB,OAAS,QAAAC,MAAY,YACrB,OAAS,SAAAC,MAAa,aAKtB,MAAMC,EAA2CC,GAC/CR,EAACG,EAAiB,KAAjB,CAAuB,GAAGK,EAAO,EAEpCD,EAAY,YAAc,eAI1B,MAAME,EAAiBP,EAAM,WAC3B,CAAC,CAAE,SAAAQ,EAAU,GAAGC,CAAK,EAAGC,IACtBZ,EAACG,EAAiB,QAAjB,CAA0B,GAAGQ,EAAM,IAAKC,EAAK,QAAO,GACnD,SAAAZ,EAACI,EAAA,CAAM,SAAAM,EAAS,EAClB,CAEJ,EACAD,EAAe,YAAc,kBAW7B,MAAMI,EAAiBX,EAAM,WAAyC,CAACM,EAAOM,IAAiB,CAC7F,KAAM,CAAE,QAAAC,EAAS,UAAAC,EAAW,WAAAC,EAAY,GAAGN,CAAK,EAAIH,EAEpD,OACER,EAACG,EAAiB,OAAjB,CAAwB,UAAWa,EAAW,WAAYC,EACzD,SAAAjB,EAACM,EAAA,CAAM,QAAO,GACZ,SAAAL,EAACE,EAAiB,QAAjB,CACC,WAAY,EACZ,iBAAkB,GACjB,GAAGQ,EACJ,QAAS,GACT,IAAKG,EACL,UAAW,gEAEX,UAAAd,EAACK,EAAA,CAAK,UAAU,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport { Text } from './text.js';\nimport { Theme } from './theme.js';\n\ntype TooltipElement = React.ElementRef<typeof TooltipPrimitive.Content>;\n\ninterface TooltipRootProps extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root> {}\nconst TooltipRoot: React.FC<TooltipRootProps> = (props: TooltipRootProps) => (\n <TooltipPrimitive.Root {...props} />\n);\nTooltipRoot.displayName = 'Tooltip.Root';\n\ntype TooltipTriggerElement = React.ElementRef<typeof TooltipPrimitive.Trigger>;\ninterface TooltipTriggerProps extends React.PropsWithChildren<{}> {}\nconst TooltipTrigger = React.forwardRef<TooltipTriggerElement, TooltipTriggerProps>(\n ({ children, ...rest }, ref) => (\n <TooltipPrimitive.Trigger {...rest} ref={ref} asChild>\n <Slot>{children}</Slot>\n </TooltipPrimitive.Trigger>\n ),\n);\nTooltipTrigger.displayName = 'Tooltip.Trigger';\n\ninterface TooltipProps\n extends Omit<\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Portal>,\n 'children' | 'className'\n >,\n Omit<\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>,\n 'children' | 'className'\n > {}\nconst TooltipContent = React.forwardRef<TooltipElement, TooltipProps>((props, forwardedRef) => {\n const { content, container, forceMount, ...rest } = props;\n\n return (\n <TooltipPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <TooltipPrimitive.Content\n sideOffset={4}\n collisionPadding={10}\n {...rest}\n asChild={false}\n ref={forwardedRef}\n className={'rounded-sm bg-gray-600 py-2 px-4 shadow-md shadow-gray-400/30'}\n >\n <Text className=\"text-bg\" as=\"p\" size={1}>\n {content}\n </Text>\n <TooltipPrimitive.Arrow className=\"fill-gray-600\" />\n </TooltipPrimitive.Content>\n </Theme>\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = 'Tooltip.Content';\n\nexport { TooltipContent as Content, TooltipRoot as Root, TooltipTrigger as Trigger };\nexport type { TooltipProps };\n"],
|
|
5
|
+
"mappings": "AAWE,cAAAA,EA8BM,QAAAC,MA9BN,oBAXF,UAAYC,MAAW,QACvB,UAAYC,MAAsB,0BAClC,OAAS,QAAAC,MAAY,uBAErB,OAAS,QAAAC,MAAY,YACrB,OAAS,SAAAC,MAAa,aAKtB,MAAMC,EAA2CC,GAC/CR,EAACG,EAAiB,KAAjB,CAAuB,GAAGK,EAAO,EAEpCD,EAAY,YAAc,eAI1B,MAAME,EAAiBP,EAAM,WAC3B,CAAC,CAAE,SAAAQ,EAAU,GAAGC,CAAK,EAAGC,IACtBZ,EAACG,EAAiB,QAAjB,CAA0B,GAAGQ,EAAM,IAAKC,EAAK,QAAO,GACnD,SAAAZ,EAACI,EAAA,CAAM,SAAAM,EAAS,EAClB,CAEJ,EACAD,EAAe,YAAc,kBAW7B,MAAMI,EAAiBX,EAAM,WAAyC,CAACM,EAAOM,IAAiB,CAC7F,KAAM,CAAE,QAAAC,EAAS,UAAAC,EAAW,WAAAC,EAAY,GAAGN,CAAK,EAAIH,EAEpD,OACER,EAACG,EAAiB,OAAjB,CAAwB,UAAWa,EAAW,WAAYC,EACzD,SAAAjB,EAACM,EAAA,CAAM,QAAO,GACZ,SAAAL,EAACE,EAAiB,QAAjB,CACC,WAAY,EACZ,iBAAkB,GACjB,GAAGQ,EACJ,QAAS,GACT,IAAKG,EACL,UAAW,gEAEX,UAAAd,EAACK,EAAA,CAAK,UAAU,UAAU,GAAG,IAAI,KAAM,EACpC,SAAAU,EACH,EACAf,EAACG,EAAiB,MAAjB,CAAuB,UAAU,gBAAgB,GACpD,EACF,EACF,CAEJ,CAAC,EACDU,EAAe,YAAc",
|
|
6
6
|
"names": ["jsx", "jsxs", "React", "TooltipPrimitive", "Slot", "Text", "Theme", "TooltipRoot", "props", "TooltipTrigger", "children", "rest", "ref", "TooltipContent", "forwardedRef", "content", "container", "forceMount"]
|
|
7
7
|
}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{default as a}from"./use-dashx-provider.js";import{default as s}from"./use-in-app.js";export{a as useDashXProvider,s as useInApp};
|
|
1
|
+
import{default as a}from"./use-dashx-provider.js";import{default as s}from"./use-in-app.js";import{default as u}from"./use-product-release.js";export{a as useDashXProvider,s as useInApp,u as useProductRelease};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as useDashXProvider } from './use-dashx-provider.js';\nexport { default as useInApp } from './use-in-app.js';\n"],
|
|
5
|
-
"mappings": "AAAA,OAAoB,WAAXA,MAAmC,0BAC5C,OAAoB,WAAXA,MAA2B",
|
|
4
|
+
"sourcesContent": ["export { default as useDashXProvider } from './use-dashx-provider.js';\nexport { default as useInApp } from './use-in-app.js';\nexport { default as useProductRelease } from './use-product-release.js';\n"],
|
|
5
|
+
"mappings": "AAAA,OAAoB,WAAXA,MAAmC,0BAC5C,OAAoB,WAAXA,MAA2B,kBACpC,OAAoB,WAAXA,MAAoC",
|
|
6
6
|
"names": ["default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import m from"react-hot-toast";import{useEffect as n,useState as e}from"react";import{WebsocketMessage as N}from"@dashx/browser";import d from"./use-dashx-provider.js";import{useWebSocket as A}from"../providers/DashXProvider.js";const b=()=>{let t=d();const{subscribe:i}=A(),[a,r]=e([]),[c,p]=e(null),f=o=>t.trackNotification({id:o,status:"READ"}),u=async o=>t.trackNotification({id:o,status:"UNREAD"});return n(()=>{t.watchFetchInAppNotifications(r),t.watchFetchInAppNotificationsAggregate(p)},[t]),n(()=>i(s=>{s?.type===N.IN_APP_NOTIFICATION&&m(s.data.renderedContent.body)}),[i]),{notifications:a,unreadNotificationsCount:c,markNotificationAsRead:f,markNotificationAsUnread:u}};var h=b;export{h as default};
|
|
2
2
|
//# sourceMappingURL=use-in-app.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/use-in-app.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "AAAA,OAAS,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["import toast from 'react-hot-toast';\nimport { useEffect, useState } from 'react';\nimport { WebsocketMessage } from '@dashx/browser';\nimport type { InAppNotifications, WebsocketMessageType } from '@dashx/browser';\n\nimport useDashXProvider from './use-dashx-provider.js';\nimport { useWebSocket } from '../providers/DashXProvider.js';\n\ntype UseInAppHookResponse = {\n notifications: InAppNotifications;\n unreadNotificationsCount: number | null;\n markNotificationAsRead: (id: string) => Promise<any>;\n markNotificationAsUnread: (id: string) => Promise<any>;\n};\n\nconst useInApp = (): UseInAppHookResponse => {\n let dashX = useDashXProvider();\n const { subscribe } = useWebSocket();\n const [notifications, setNotifications] = useState<InAppNotifications>([]);\n const [unreadNotificationsCount, setUnreadNotificationsCount] = useState<number | null>(null);\n\n const markNotificationAsRead = (id: string) => dashX.trackNotification({ id, status: 'READ' });\n\n const markNotificationAsUnread = async (id: string) =>\n dashX.trackNotification({ id, status: 'UNREAD' });\n\n\n useEffect(() => {\n // Set up notification watchers (automatically refetch on WebSocket reconnection)\n dashX.watchFetchInAppNotifications(setNotifications);\n dashX.watchFetchInAppNotificationsAggregate(setUnreadNotificationsCount);\n }, [dashX]);\n\n useEffect(() => {\n // Subscribe to WebSocket messages for notifications\n const unsubscribe = subscribe((message: WebsocketMessageType) => {\n // Handle only IN_APP_NOTIFICATION for toast display\n // The client handles all other message processing internally\n if (message?.type === WebsocketMessage.IN_APP_NOTIFICATION) {\n toast(message.data.renderedContent.body);\n }\n });\n\n return unsubscribe;\n }, [subscribe]);\n\n return {\n notifications,\n unreadNotificationsCount,\n markNotificationAsRead,\n markNotificationAsUnread,\n };\n};\n\nexport default useInApp;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAOA,MAAW,kBAClB,OAAS,aAAAC,EAAW,YAAAC,MAAgB,QACpC,OAAS,oBAAAC,MAAwB,iBAGjC,OAAOC,MAAsB,0BAC7B,OAAS,gBAAAC,MAAoB,gCAS7B,MAAMC,EAAW,IAA4B,CAC3C,IAAIC,EAAQH,EAAiB,EAC7B,KAAM,CAAE,UAAAI,CAAU,EAAIH,EAAa,EAC7B,CAACI,EAAeC,CAAgB,EAAIR,EAA6B,CAAC,CAAC,EACnE,CAACS,EAA0BC,CAA2B,EAAIV,EAAwB,IAAI,EAEtFW,EAA0BC,GAAeP,EAAM,kBAAkB,CAAE,GAAAO,EAAI,OAAQ,MAAO,CAAC,EAEvFC,EAA2B,MAAOD,GACtCP,EAAM,kBAAkB,CAAE,GAAAO,EAAI,OAAQ,QAAS,CAAC,EAGlD,OAAAb,EAAU,IAAM,CAEdM,EAAM,6BAA6BG,CAAgB,EACnDH,EAAM,sCAAsCK,CAA2B,CACzE,EAAG,CAACL,CAAK,CAAC,EAEVN,EAAU,IAEYO,EAAWQ,GAAkC,CAG3DA,GAAS,OAASb,EAAiB,qBACrCH,EAAMgB,EAAQ,KAAK,gBAAgB,IAAI,CAE3C,CAAC,EAGA,CAACR,CAAS,CAAC,EAEP,CACL,cAAAC,EACA,yBAAAE,EACA,uBAAAE,EACA,yBAAAE,CACF,CACF,EAEA,IAAOE,EAAQX",
|
|
6
|
+
"names": ["toast", "useEffect", "useState", "WebsocketMessage", "useDashXProvider", "useWebSocket", "useInApp", "dashX", "subscribe", "notifications", "setNotifications", "unreadNotificationsCount", "setUnreadNotificationsCount", "markNotificationAsRead", "id", "markNotificationAsUnread", "message", "use_in_app_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ProductVariantReleaseRule } from '@dashx/browser';
|
|
2
|
+
type UseProductReleaseHookResponse = {
|
|
3
|
+
productVariantReleaseRule: ProductVariantReleaseRule | null;
|
|
4
|
+
};
|
|
5
|
+
declare const useProductRelease: () => UseProductReleaseHookResponse;
|
|
6
|
+
export default useProductRelease;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useEffect as o,useState as u}from"react";import{WebsocketMessage as l}from"@dashx/browser";import c from"./use-dashx-provider.js";import{useWebSocket as R}from"../providers/DashXProvider.js";const n=()=>{let e=c();const{subscribe:t}=R(),[a,s]=u(null);return o(()=>{e.watchFetchProductVariantReleaseRule(s)},[e]),o(()=>t(r=>{r?.type===l.PRODUCT_VARIANT_RELEASE_RULE_UPDATED&&s(r.data)}),[t]),{productVariantReleaseRule:a}};var f=n;export{f as default};
|
|
2
|
+
//# sourceMappingURL=use-product-release.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/use-product-release.ts"],
|
|
4
|
+
"sourcesContent": ["import { useEffect, useState } from 'react';\nimport { WebsocketMessage } from '@dashx/browser';\nimport type { ProductVariantReleaseRule, WebsocketMessageType } from '@dashx/browser';\n\nimport useDashXProvider from './use-dashx-provider.js';\nimport { useWebSocket } from '../providers/DashXProvider.js';\n\ntype UseProductReleaseHookResponse = {\n productVariantReleaseRule: ProductVariantReleaseRule | null;\n};\n\nconst useProductRelease = (): UseProductReleaseHookResponse => {\n let dashX = useDashXProvider();\n const { subscribe } = useWebSocket();\n const [productVariantReleaseRule, setProductVariantReleaseRule] = useState<ProductVariantReleaseRule | null>(null);\n\n useEffect(() => {\n // Set up product variant release rule watcher (automatically refetch on WebSocket reconnection)\n dashX.watchFetchProductVariantReleaseRule(setProductVariantReleaseRule);\n }, [dashX]);\n\n useEffect(() => {\n // Subscribe to WebSocket messages for product variant release updates\n const unsubscribe = subscribe((message: WebsocketMessageType) => {\n if (message?.type === WebsocketMessage.PRODUCT_VARIANT_RELEASE_RULE_UPDATED) {\n setProductVariantReleaseRule(message.data);\n }\n });\n\n return unsubscribe;\n }, [subscribe]);\n\n return {\n productVariantReleaseRule,\n };\n};\n\nexport default useProductRelease;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,aAAAA,EAAW,YAAAC,MAAgB,QACpC,OAAS,oBAAAC,MAAwB,iBAGjC,OAAOC,MAAsB,0BAC7B,OAAS,gBAAAC,MAAoB,gCAM7B,MAAMC,EAAoB,IAAqC,CAC7D,IAAIC,EAAQH,EAAiB,EAC7B,KAAM,CAAE,UAAAI,CAAU,EAAIH,EAAa,EAC7B,CAACI,EAA2BC,CAA4B,EAAIR,EAA2C,IAAI,EAEjH,OAAAD,EAAU,IAAM,CAEdM,EAAM,oCAAoCG,CAA4B,CACxE,EAAG,CAACH,CAAK,CAAC,EAEVN,EAAU,IAEYO,EAAWG,GAAkC,CAC3DA,GAAS,OAASR,EAAiB,sCACrCO,EAA6BC,EAAQ,IAAI,CAE7C,CAAC,EAGA,CAACH,CAAS,CAAC,EAEP,CACL,0BAAAC,CACF,CACF,EAEA,IAAOG,EAAQN",
|
|
6
|
+
"names": ["useEffect", "useState", "WebsocketMessage", "useDashXProvider", "useWebSocket", "useProductRelease", "dashX", "subscribe", "productVariantReleaseRule", "setProductVariantReleaseRule", "message", "use_product_release_default"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { Client, ClientParams } from '@dashx/browser';
|
|
2
|
+
import type { Client, ClientParams, WebsocketMessageType } from '@dashx/browser';
|
|
3
3
|
declare const DashXContext: React.Context<Client | null>;
|
|
4
|
-
|
|
4
|
+
type WebSocketContextType = {
|
|
5
|
+
isConnected: boolean;
|
|
6
|
+
subscribe: (callback: (message: WebsocketMessageType) => void) => () => void;
|
|
7
|
+
};
|
|
8
|
+
declare function DashXProvider({ children, publicKey, baseUri, realtimeBaseUri, targetEnvironment, targetProduct, }: React.PropsWithChildren<ClientParams>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useWebSocket(): WebSocketContextType;
|
|
5
10
|
export default DashXProvider;
|
|
6
11
|
export { DashXContext };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as m}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import y from"@dashx/browser";import S,{createContext as d,useContext as h,useEffect as x,useRef as f,useState as E}from"react";const p=d(null),C=d(null);function M({children:n,publicKey:a,baseUri:l,realtimeBaseUri:i,targetEnvironment:u,targetProduct:b}){const e=S.useMemo(()=>y({publicKey:a,baseUri:l,realtimeBaseUri:i,targetEnvironment:u,targetProduct:b}),[a,l,i,u,b]),[g,r]=E(!1),s=f(null),c=f(new Set),k=o=>(c.current.add(o),()=>{c.current.delete(o)});return x(()=>{if(!e)return;const o=e.createWebSocketConnection({queryParams:{publicKey:e.publicKey,...e.targetEnvironment&&{targetEnvironment:e.targetEnvironment}},onError:t=>console.error({errorEvent:t}),onClose:t=>{console.log({closeEvent:t}),r(!1)},onMessage:t=>{c.current.forEach(v=>{try{v(t)}catch(W){console.error("Error in WebSocket subscriber callback:",W)}})},onOpen:()=>{console.log("WebSocket connected successfully"),r(!0)},onReconnect:t=>{console.log(`WebSocket reconnecting... attempt ${t}`)},onReconnectFailed:()=>{console.error("WebSocket reconnection failed"),r(!1)}});return s.current=o,o.connect(),()=>{s.current&&(s.current.disconnect(),s.current=null),r(!1)}},[e]),m(p.Provider,{value:e,children:m(C.Provider,{value:{isConnected:g,subscribe:k},children:n})})}function R(){const n=h(C);if(!n)throw new Error("useWebSocket must be used within a DashXProvider");return n}var T=M;export{p as DashXContext,T as default,R as useWebSocket};
|
|
2
2
|
//# sourceMappingURL=DashXProvider.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/providers/DashXProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import DashX from '@dashx/browser';\nimport React from 'react';\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "DashX", "React", "DashXContext", "DashXProvider", "children", "publicKey", "baseUri", "realtimeBaseUri", "targetEnvironment", "dashX", "DashXProvider_default"]
|
|
4
|
+
"sourcesContent": ["import DashX from '@dashx/browser';\nimport React, { createContext, useContext, useEffect, useRef, useState } from 'react';\nimport type { Client, ClientParams, WebsocketMessageType } from '@dashx/browser';\n\nconst DashXContext = createContext<Client | null>(null);\n\ntype WebSocketContextType = {\n isConnected: boolean;\n subscribe: (callback: (message: WebsocketMessageType) => void) => () => void;\n};\n\nconst WebSocketContext = createContext<WebSocketContextType | null>(null);\n\nfunction DashXProvider({\n children,\n publicKey,\n baseUri,\n realtimeBaseUri,\n targetEnvironment,\n targetProduct,\n}: React.PropsWithChildren<ClientParams>) {\n const dashX = React.useMemo(\n () =>\n DashX({\n publicKey: publicKey,\n baseUri: baseUri,\n realtimeBaseUri: realtimeBaseUri,\n targetEnvironment: targetEnvironment,\n targetProduct\n }),\n [publicKey, baseUri, realtimeBaseUri, targetEnvironment, targetProduct],\n );\n\n // WebSocket state\n const [isConnected, setIsConnected] = useState(false);\n const wsManagerRef = useRef<any>(null);\n const subscribersRef = useRef<Set<(message: WebsocketMessageType) => void>>(new Set());\n\n const subscribe = (callback: (message: WebsocketMessageType) => void) => {\n subscribersRef.current.add(callback);\n\n // Return unsubscribe function\n return () => {\n subscribersRef.current.delete(callback);\n };\n };\n\n useEffect(() => {\n if (!dashX) return;\n\n // Create WebSocket connection\n const wsManager = dashX.createWebSocketConnection({\n queryParams: {\n publicKey: dashX.publicKey,\n ...(dashX.targetEnvironment && { targetEnvironment: dashX.targetEnvironment }),\n },\n onError: (errorEvent: Event) => console.error({ errorEvent }),\n onClose: (closeEvent: CloseEvent) => {\n console.log({ closeEvent });\n setIsConnected(false);\n },\n onMessage: (message: WebsocketMessageType) => {\n // Notify all subscribers\n subscribersRef.current.forEach(callback => {\n try {\n callback(message);\n } catch (error) {\n console.error('Error in WebSocket subscriber callback:', error);\n }\n });\n },\n onOpen: () => {\n console.log('WebSocket connected successfully');\n setIsConnected(true);\n },\n onReconnect: (attempt: number) => {\n console.log(`WebSocket reconnecting... attempt ${attempt}`);\n },\n onReconnectFailed: () => {\n console.error('WebSocket reconnection failed');\n setIsConnected(false);\n },\n });\n\n wsManagerRef.current = wsManager;\n wsManager.connect();\n\n // Cleanup function\n return () => {\n if (wsManagerRef.current) {\n wsManagerRef.current.disconnect();\n wsManagerRef.current = null;\n }\n setIsConnected(false);\n };\n }, [dashX]);\n\n return (\n <DashXContext.Provider value={dashX}>\n <WebSocketContext.Provider value={{ isConnected, subscribe }}>\n {children}\n </WebSocketContext.Provider>\n </DashXContext.Provider>\n );\n}\n\nexport function useWebSocket() {\n const context = useContext(WebSocketContext);\n if (!context) {\n throw new Error('useWebSocket must be used within a DashXProvider');\n }\n return context;\n}\n\nexport default DashXProvider;\nexport { DashXContext };\n"],
|
|
5
|
+
"mappings": "AAmGM,cAAAA,MAAA,oBAnGN,OAAOC,MAAW,iBAClB,OAAOC,GAAS,iBAAAC,EAAe,cAAAC,EAAY,aAAAC,EAAW,UAAAC,EAAQ,YAAAC,MAAgB,QAG9E,MAAMC,EAAeL,EAA6B,IAAI,EAOhDM,EAAmBN,EAA2C,IAAI,EAExE,SAASO,EAAc,CACrB,SAAAC,EACA,UAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,cAAAC,CACF,EAA0C,CACxC,MAAMC,EAAQf,EAAM,QAClB,IACED,EAAM,CACJ,UAAWW,EACX,QAASC,EACT,gBAAiBC,EACjB,kBAAmBC,EACnB,cAAAC,CACF,CAAC,EACH,CAACJ,EAAWC,EAASC,EAAiBC,EAAmBC,CAAa,CACxE,EAGM,CAACE,EAAaC,CAAc,EAAIZ,EAAS,EAAK,EAC9Ca,EAAed,EAAY,IAAI,EAC/Be,EAAiBf,EAAqD,IAAI,GAAK,EAE/EgB,EAAaC,IACjBF,EAAe,QAAQ,IAAIE,CAAQ,EAG5B,IAAM,CACXF,EAAe,QAAQ,OAAOE,CAAQ,CACxC,GAGF,OAAAlB,EAAU,IAAM,CACd,GAAI,CAACY,EAAO,OAGZ,MAAMO,EAAYP,EAAM,0BAA0B,CAChD,YAAa,CACX,UAAWA,EAAM,UACjB,GAAIA,EAAM,mBAAqB,CAAE,kBAAmBA,EAAM,iBAAkB,CAC9E,EACA,QAAUQ,GAAsB,QAAQ,MAAM,CAAE,WAAAA,CAAW,CAAC,EAC5D,QAAUC,GAA2B,CACnC,QAAQ,IAAI,CAAE,WAAAA,CAAW,CAAC,EAC1BP,EAAe,EAAK,CACtB,EACA,UAAYQ,GAAkC,CAE5CN,EAAe,QAAQ,QAAQE,GAAY,CACzC,GAAI,CACFA,EAASI,CAAO,CAClB,OAASC,EAAO,CACd,QAAQ,MAAM,0CAA2CA,CAAK,CAChE,CACF,CAAC,CACH,EACA,OAAQ,IAAM,CACZ,QAAQ,IAAI,kCAAkC,EAC9CT,EAAe,EAAI,CACrB,EACA,YAAcU,GAAoB,CAChC,QAAQ,IAAI,qCAAqCA,CAAO,EAAE,CAC5D,EACA,kBAAmB,IAAM,CACvB,QAAQ,MAAM,+BAA+B,EAC7CV,EAAe,EAAK,CACtB,CACF,CAAC,EAED,OAAAC,EAAa,QAAUI,EACvBA,EAAU,QAAQ,EAGX,IAAM,CACPJ,EAAa,UACfA,EAAa,QAAQ,WAAW,EAChCA,EAAa,QAAU,MAEzBD,EAAe,EAAK,CACtB,CACF,EAAG,CAACF,CAAK,CAAC,EAGRjB,EAACQ,EAAa,SAAb,CAAsB,MAAOS,EAC5B,SAAAjB,EAACS,EAAiB,SAAjB,CAA0B,MAAO,CAAE,YAAAS,EAAa,UAAAI,CAAU,EACxD,SAAAX,EACH,EACF,CAEJ,CAEO,SAASmB,GAAe,CAC7B,MAAMC,EAAU3B,EAAWK,CAAgB,EAC3C,GAAI,CAACsB,EACH,MAAM,IAAI,MAAM,kDAAkD,EAEpE,OAAOA,CACT,CAEA,IAAOC,EAAQtB",
|
|
6
|
+
"names": ["jsx", "DashX", "React", "createContext", "useContext", "useEffect", "useRef", "useState", "DashXContext", "WebSocketContext", "DashXProvider", "children", "publicKey", "baseUri", "realtimeBaseUri", "targetEnvironment", "targetProduct", "dashX", "isConnected", "setIsConnected", "wsManagerRef", "subscribersRef", "subscribe", "callback", "wsManager", "errorEvent", "closeEvent", "message", "error", "attempt", "useWebSocket", "context", "DashXProvider_default"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as DashXProvider } from './DashXProvider.js';
|
|
1
|
+
export { default as DashXProvider, DashXContext } from './DashXProvider.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{default as
|
|
1
|
+
import{default as o,DashXContext as r}from"./DashXProvider.js";export{r as DashXContext,o as DashXProvider};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/providers/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as DashXProvider } from './DashXProvider.js';\n"],
|
|
5
|
-
"mappings": "AAAA,OAAoB,WAAXA,
|
|
6
|
-
"names": ["default"]
|
|
4
|
+
"sourcesContent": ["export { default as DashXProvider, DashXContext } from './DashXProvider.js';\n"],
|
|
5
|
+
"mappings": "AAAA,OAAoB,WAAXA,EAA0B,gBAAAC,MAAoB",
|
|
6
|
+
"names": ["default", "DashXContext"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["export function removeDataAttributes<T>(props: T): T {\n const prefix = /^(data-.*)$/;\n let filteredProps = {} as T;\n\n for (const prop in props) {\n if (!prefix.test(prop)) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n\nexport const fallbackEventTo = (props: any, eventName: string, fallbackEventName: string) => {\n const event = props[eventName];\n if (fallbackEventName in props && !event) {\n return [props[fallbackEventName], undefined];\n }\n\n return [event, props[fallbackEventName]];\n};\n"],
|
|
5
|
+
"mappings": "AAAO,SAASA,EAAwBC,EAAa,CACnD,MAAMC,EAAS,cACf,IAAIC,EAAgB,CAAC,EAErB,UAAWC,KAAQH,EACZC,EAAO,KAAKE,CAAI,IACnBD,EAAcC,CAAI,EAAIH,EAAMG,CAAI,GAIpC,OAAOD,CACT,CAEO,MAAME,EAAkB,CAACJ,EAAYK,EAAmBC,IAA8B,CAC3F,MAAMC,EAAQP,EAAMK,CAAS,EAC7B,OAAIC,KAAqBN,GAAS,CAACO,EAC1B,CAACP,EAAMM,CAAiB,EAAG,MAAS,EAGtC,CAACC,EAAOP,EAAMM,CAAiB,CAAC,CACzC",
|
|
6
|
+
"names": ["removeDataAttributes", "props", "prefix", "filteredProps", "prop", "fallbackEventTo", "eventName", "fallbackEventName", "event"]
|
|
7
|
+
}
|
|
@@ -6,6 +6,19 @@ declare const baseElement: import("tailwind-variants").TVReturnType<{
|
|
|
6
6
|
large: string;
|
|
7
7
|
extralarge: string;
|
|
8
8
|
};
|
|
9
|
+
roundness: {
|
|
10
|
+
none: string;
|
|
11
|
+
small: string;
|
|
12
|
+
medium: string;
|
|
13
|
+
large: string;
|
|
14
|
+
full: string;
|
|
15
|
+
};
|
|
16
|
+
elevation: {
|
|
17
|
+
none: string;
|
|
18
|
+
small: string;
|
|
19
|
+
medium: string;
|
|
20
|
+
large: string;
|
|
21
|
+
};
|
|
9
22
|
}, undefined, undefined, import("tailwind-variants/dist/config.js").TVConfig<{
|
|
10
23
|
size: {
|
|
11
24
|
extrasmall: string;
|
|
@@ -14,6 +27,19 @@ declare const baseElement: import("tailwind-variants").TVReturnType<{
|
|
|
14
27
|
large: string;
|
|
15
28
|
extralarge: string;
|
|
16
29
|
};
|
|
30
|
+
roundness: {
|
|
31
|
+
none: string;
|
|
32
|
+
small: string;
|
|
33
|
+
medium: string;
|
|
34
|
+
large: string;
|
|
35
|
+
full: string;
|
|
36
|
+
};
|
|
37
|
+
elevation: {
|
|
38
|
+
none: string;
|
|
39
|
+
small: string;
|
|
40
|
+
medium: string;
|
|
41
|
+
large: string;
|
|
42
|
+
};
|
|
17
43
|
}, {
|
|
18
44
|
size: {
|
|
19
45
|
extrasmall: string;
|
|
@@ -22,6 +48,19 @@ declare const baseElement: import("tailwind-variants").TVReturnType<{
|
|
|
22
48
|
large: string;
|
|
23
49
|
extralarge: string;
|
|
24
50
|
};
|
|
51
|
+
roundness: {
|
|
52
|
+
none: string;
|
|
53
|
+
small: string;
|
|
54
|
+
medium: string;
|
|
55
|
+
large: string;
|
|
56
|
+
full: string;
|
|
57
|
+
};
|
|
58
|
+
elevation: {
|
|
59
|
+
none: string;
|
|
60
|
+
small: string;
|
|
61
|
+
medium: string;
|
|
62
|
+
large: string;
|
|
63
|
+
};
|
|
25
64
|
}>, {
|
|
26
65
|
size: {
|
|
27
66
|
extrasmall: string;
|
|
@@ -30,6 +69,19 @@ declare const baseElement: import("tailwind-variants").TVReturnType<{
|
|
|
30
69
|
large: string;
|
|
31
70
|
extralarge: string;
|
|
32
71
|
};
|
|
72
|
+
roundness: {
|
|
73
|
+
none: string;
|
|
74
|
+
small: string;
|
|
75
|
+
medium: string;
|
|
76
|
+
large: string;
|
|
77
|
+
full: string;
|
|
78
|
+
};
|
|
79
|
+
elevation: {
|
|
80
|
+
none: string;
|
|
81
|
+
small: string;
|
|
82
|
+
medium: string;
|
|
83
|
+
large: string;
|
|
84
|
+
};
|
|
33
85
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
34
86
|
size: {
|
|
35
87
|
extrasmall: string;
|
|
@@ -38,6 +90,19 @@ declare const baseElement: import("tailwind-variants").TVReturnType<{
|
|
|
38
90
|
large: string;
|
|
39
91
|
extralarge: string;
|
|
40
92
|
};
|
|
93
|
+
roundness: {
|
|
94
|
+
none: string;
|
|
95
|
+
small: string;
|
|
96
|
+
medium: string;
|
|
97
|
+
large: string;
|
|
98
|
+
full: string;
|
|
99
|
+
};
|
|
100
|
+
elevation: {
|
|
101
|
+
none: string;
|
|
102
|
+
small: string;
|
|
103
|
+
medium: string;
|
|
104
|
+
large: string;
|
|
105
|
+
};
|
|
41
106
|
}, undefined, undefined, import("tailwind-variants/dist/config.js").TVConfig<{
|
|
42
107
|
size: {
|
|
43
108
|
extrasmall: string;
|
|
@@ -46,6 +111,19 @@ declare const baseElement: import("tailwind-variants").TVReturnType<{
|
|
|
46
111
|
large: string;
|
|
47
112
|
extralarge: string;
|
|
48
113
|
};
|
|
114
|
+
roundness: {
|
|
115
|
+
none: string;
|
|
116
|
+
small: string;
|
|
117
|
+
medium: string;
|
|
118
|
+
large: string;
|
|
119
|
+
full: string;
|
|
120
|
+
};
|
|
121
|
+
elevation: {
|
|
122
|
+
none: string;
|
|
123
|
+
small: string;
|
|
124
|
+
medium: string;
|
|
125
|
+
large: string;
|
|
126
|
+
};
|
|
49
127
|
}, {
|
|
50
128
|
size: {
|
|
51
129
|
extrasmall: string;
|
|
@@ -54,5 +132,18 @@ declare const baseElement: import("tailwind-variants").TVReturnType<{
|
|
|
54
132
|
large: string;
|
|
55
133
|
extralarge: string;
|
|
56
134
|
};
|
|
135
|
+
roundness: {
|
|
136
|
+
none: string;
|
|
137
|
+
small: string;
|
|
138
|
+
medium: string;
|
|
139
|
+
large: string;
|
|
140
|
+
full: string;
|
|
141
|
+
};
|
|
142
|
+
elevation: {
|
|
143
|
+
none: string;
|
|
144
|
+
small: string;
|
|
145
|
+
medium: string;
|
|
146
|
+
large: string;
|
|
147
|
+
};
|
|
57
148
|
}>, unknown, unknown, undefined>>;
|
|
58
149
|
export default baseElement;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{tv as
|
|
1
|
+
import{tv as e}from"tailwind-variants";const l=e({variants:{size:{extrasmall:"h-6",small:"h-8",medium:"h-10",large:"h-12",extralarge:"h-14"},roundness:{none:"",small:"",medium:"",large:"",full:""},elevation:{none:"",small:"",medium:"",large:""}}});var m=l;export{m as default};
|
|
2
2
|
//# sourceMappingURL=base-element.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/variants/base-element.ts"],
|
|
4
|
-
"sourcesContent": ["import { tv } from 'tailwind-variants';\n\nconst baseElement = tv({\n variants: {\n size: {\n extrasmall: '
|
|
5
|
-
"mappings": "AAAA,OAAS,MAAAA,MAAU,oBAEnB,MAAMC,EAAcD,EAAG,CACrB,SAAU,CACR,KAAM,CACJ,WAAY,
|
|
4
|
+
"sourcesContent": ["import { tv } from 'tailwind-variants';\n\nconst baseElement = tv({\n variants: {\n size: {\n extrasmall: 'h-6',\n small: 'h-8',\n medium: 'h-10',\n large: 'h-12',\n extralarge: 'h-14',\n },\n roundness: {\n none: '',\n small: '',\n medium: '',\n large: '',\n full: '',\n },\n elevation: {\n none: '',\n small: '',\n medium: '',\n large: '',\n },\n },\n});\n\nexport default baseElement;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,MAAAA,MAAU,oBAEnB,MAAMC,EAAcD,EAAG,CACrB,SAAU,CACR,KAAM,CACJ,WAAY,MACZ,MAAO,MACP,OAAQ,OACR,MAAO,OACP,WAAY,MACd,EACA,UAAW,CACT,KAAM,GACN,MAAO,GACP,OAAQ,GACR,MAAO,GACP,KAAM,EACR,EACA,UAAW,CACT,KAAM,GACN,MAAO,GACP,OAAQ,GACR,MAAO,EACT,CACF,CACF,CAAC,EAED,IAAOE,EAAQD",
|
|
6
6
|
"names": ["tv", "baseElement", "base_element_default"]
|
|
7
7
|
}
|