@shipfox/react-ui 0.12.0 → 0.13.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.
- package/.turbo/turbo-build.log +5 -5
- package/.turbo/turbo-check.log +2 -2
- package/.turbo/turbo-type.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/components/badge/index.d.ts +4 -4
- package/dist/components/badge/index.d.ts.map +1 -1
- package/dist/components/badge/index.js +4 -4
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/dropdown-menu/index.d.ts +1 -2
- package/dist/components/dropdown-menu/index.d.ts.map +1 -1
- package/dist/components/dropdown-menu/index.js +1 -1
- package/dist/components/dropdown-menu/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/modal/index.d.ts +1 -2
- package/dist/components/modal/index.d.ts.map +1 -1
- package/dist/components/modal/index.js +1 -1
- package/dist/components/modal/index.js.map +1 -1
- package/dist/components/modal/modal.d.ts +2 -1
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/modal/modal.js +5 -3
- package/dist/components/modal/modal.js.map +1 -1
- package/dist/components/modal/modal.stories.js +2 -0
- package/dist/components/modal/modal.stories.js.map +1 -1
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/components/tabs/index.js +3 -0
- package/dist/components/tabs/index.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +50 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -0
- package/dist/components/tabs/tabs.js +243 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/tabs/tabs.stories.js +179 -0
- package/dist/components/tabs/tabs.stories.js.map +1 -0
- package/dist/components/toast/index.d.ts +2 -2
- package/dist/components/toast/index.d.ts.map +1 -1
- package/dist/components/toast/index.js +2 -2
- package/dist/components/toast/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/debounce.d.ts +2 -0
- package/dist/utils/debounce.d.ts.map +1 -0
- package/dist/utils/debounce.js +13 -0
- package/dist/utils/debounce.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/index.css +3 -0
- package/package.json +1 -1
- package/src/components/badge/index.ts +4 -4
- package/src/components/dropdown-menu/index.ts +1 -29
- package/src/components/index.ts +2 -0
- package/src/components/modal/index.ts +1 -23
- package/src/components/modal/modal.stories.tsx +2 -2
- package/src/components/modal/modal.tsx +4 -2
- package/src/components/tabs/index.ts +1 -0
- package/src/components/tabs/tabs.stories.tsx +100 -0
- package/src/components/tabs/tabs.tsx +380 -0
- package/src/components/toast/index.ts +2 -2
- package/src/utils/debounce.ts +15 -0
- package/src/utils/index.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
WARN Issue while reading "/runner/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
|
|
2
2
|
|
|
3
|
-
> @shipfox/react-ui@0.
|
|
3
|
+
> @shipfox/react-ui@0.13.0 build /runner/_work/tooling/tooling/libs/react/ui
|
|
4
4
|
> swc && pnpm run build:css
|
|
5
5
|
|
|
6
|
-
Successfully compiled:
|
|
6
|
+
Successfully compiled: 136 files with swc (375.92ms)
|
|
7
7
|
WARN Issue while reading "/runner/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
|
|
8
8
|
|
|
9
|
-
> @shipfox/react-ui@0.
|
|
9
|
+
> @shipfox/react-ui@0.13.0 build:css /runner/_work/tooling/tooling/libs/react/ui
|
|
10
10
|
> vite build --config vite.css.config.ts && rm -f dist/css-entry.js dist/css-entry.js.map
|
|
11
11
|
|
|
12
12
|
[36mvite v7.2.7 [32mbuilding client environment for production...[36m[39m
|
|
@@ -14,6 +14,6 @@ transforming...
|
|
|
14
14
|
[32m✓[39m 2 modules transformed.
|
|
15
15
|
rendering chunks...
|
|
16
16
|
computing gzip size...
|
|
17
|
-
[2mdist/[22m[35mstyles.css [39m[1m[
|
|
17
|
+
[2mdist/[22m[35mstyles.css [39m[1m[2m92.31 kB[22m[1m[22m[2m │ gzip: 14.56 kB[22m
|
|
18
18
|
[2mdist/[22m[36mcss-entry.js [39m[1m[2m 0.00 kB[22m[1m[22m[2m │ gzip: 0.02 kB[22m
|
|
19
|
-
[32m✓ built in
|
|
19
|
+
[32m✓ built in 632ms[39m
|
package/.turbo/turbo-check.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
WARN Issue while reading "/runner/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
|
|
2
2
|
|
|
3
|
-
> @shipfox/react-ui@0.
|
|
3
|
+
> @shipfox/react-ui@0.13.0 check /runner/_work/tooling/tooling/libs/react/ui
|
|
4
4
|
> biome-check --fix
|
|
5
5
|
|
|
6
|
-
Checked
|
|
6
|
+
Checked 155 files in 283ms. No fixes applied.
|
package/.turbo/turbo-type.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
WARN Issue while reading "/runner/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
|
|
2
2
|
|
|
3
|
-
> @shipfox/react-ui@0.
|
|
3
|
+
> @shipfox/react-ui@0.13.0 type /runner/_work/tooling/tooling/libs/react/ui
|
|
4
4
|
> tsc-emit
|
|
5
5
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from './badge';
|
|
2
|
+
export * from './icon-badge';
|
|
3
|
+
export * from './status-badge';
|
|
4
|
+
export * from './user-badge';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/badge/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/badge/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from './badge.js';
|
|
2
|
+
export * from './icon-badge.js';
|
|
3
|
+
export * from './status-badge.js';
|
|
4
|
+
export * from './user-badge.js';
|
|
5
5
|
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/badge/index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../../../src/components/badge/index.ts"],"sourcesContent":["export * from './badge';\nexport * from './icon-badge';\nexport * from './status-badge';\nexport * from './user-badge';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,eAAe"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, dropdownMenuContentVariants, dropdownMenuItemVariants, dropdownMenuLabelVariants, } from './dropdown-menu';
|
|
1
|
+
export * from './dropdown-menu';
|
|
3
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown-menu/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './dropdown-menu.js';
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/dropdown-menu/index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../../../src/components/dropdown-menu/index.ts"],"sourcesContent":["export * from './dropdown-menu';\n"],"names":[],"mappings":"AAAA,cAAc,kBAAkB"}
|
|
@@ -17,7 +17,9 @@ export * from './input';
|
|
|
17
17
|
export * from './item';
|
|
18
18
|
export * from './label';
|
|
19
19
|
export * from './modal';
|
|
20
|
+
export * from './moving-border';
|
|
20
21
|
export * from './popover';
|
|
22
|
+
export * from './tabs';
|
|
21
23
|
export * from './textarea';
|
|
22
24
|
export * from './theme';
|
|
23
25
|
export * from './toast';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -17,7 +17,9 @@ export * from './input/index.js';
|
|
|
17
17
|
export * from './item/index.js';
|
|
18
18
|
export * from './label/index.js';
|
|
19
19
|
export * from './modal/index.js';
|
|
20
|
+
export * from './moving-border/index.js';
|
|
20
21
|
export * from './popover/index.js';
|
|
22
|
+
export * from './tabs/index.js';
|
|
21
23
|
export * from './textarea/index.js';
|
|
22
24
|
export * from './theme/index.js';
|
|
23
25
|
export * from './toast/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './alert';\nexport * from './avatar';\nexport * from './badge';\nexport * from './button';\nexport * from './calendar';\nexport * from './checkbox';\nexport * from './code-block';\nexport * from './date-picker';\nexport * from './date-time-range-picker';\nexport * from './dot-grid';\nexport * from './dropdown-menu';\nexport * from './dynamic-item';\nexport * from './form';\nexport * from './icon';\nexport * from './inline-tips';\nexport * from './input';\nexport * from './item';\nexport * from './label';\nexport * from './modal';\nexport * from './popover';\nexport * from './textarea';\nexport * from './theme';\nexport * from './toast';\nexport * from './tooltip';\nexport * from './typography';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,2BAA2B;AACzC,cAAc,aAAa;AAC3B,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,YAAY;AAC1B,cAAc,eAAe"}
|
|
1
|
+
{"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './alert';\nexport * from './avatar';\nexport * from './badge';\nexport * from './button';\nexport * from './calendar';\nexport * from './checkbox';\nexport * from './code-block';\nexport * from './date-picker';\nexport * from './date-time-range-picker';\nexport * from './dot-grid';\nexport * from './dropdown-menu';\nexport * from './dynamic-item';\nexport * from './form';\nexport * from './icon';\nexport * from './inline-tips';\nexport * from './input';\nexport * from './item';\nexport * from './label';\nexport * from './modal';\nexport * from './moving-border';\nexport * from './popover';\nexport * from './tabs';\nexport * from './textarea';\nexport * from './theme';\nexport * from './toast';\nexport * from './tooltip';\nexport * from './typography';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,2BAA2B;AACzC,cAAc,aAAa;AAC3B,cAAc,kBAAkB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,kBAAkB;AAChC,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,YAAY;AAC1B,cAAc,eAAe"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { Modal, ModalBody, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, modalContentVariants, modalDefaultTransition, modalOverlayVariants, } from './modal';
|
|
1
|
+
export * from './modal';
|
|
3
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/modal/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/modal/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './modal.js';
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modal/index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["../../../src/components/modal/index.ts"],"sourcesContent":["export * from './modal';\n"],"names":[],"mappings":"AAAA,cAAc,UAAU"}
|
|
@@ -18,8 +18,9 @@ declare function ModalOverlay({ className, animated, transition, ...props }: Mod
|
|
|
18
18
|
type ModalContentProps = ComponentProps<typeof DialogPrimitive.Content> & {
|
|
19
19
|
animated?: boolean;
|
|
20
20
|
transition?: Transition;
|
|
21
|
+
overlayClassName?: string;
|
|
21
22
|
};
|
|
22
|
-
declare function ModalContent({ className, children, animated, transition, ...props }: ModalContentProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function ModalContent({ className, children, animated, transition, overlayClassName, ...props }: ModalContentProps): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
type ModalHeaderProps = ComponentProps<'div'> & {
|
|
24
25
|
title?: string;
|
|
25
26
|
showEscIndicator?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAK1D,OAAO,EAAS,KAAK,UAAU,EAAC,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAC,KAAK,cAAc,EAA4B,MAAM,OAAO,CAAC;AAIrE,QAAA,MAAM,sBAAsB,EAAE,UAI7B,CAAC;AAiBF,QAAA,MAAM,oBAAoB,oFAEzB,CAAC;AAEF,QAAA,MAAM,oBAAoB,oFAEzB,CAAC;AAEF,iBAAS,KAAK,CAAC,EACb,UAAiC,EACjC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAC,2CAerE;AAED,iBAAS,YAAY,CAAC,KAAK,EAAE,cA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AAED,iBAAS,WAAW,CAAC,EAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,KAAK,CAAC,2CAS1E;AAED,KAAK,eAAe,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAEpE,iBAAS,UAAU,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,eAAe,2CAazD;AAED,KAAK,qBAAqB,GAAG,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,CAAC;AAEhF,iBAAS,gBAAgB,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,qBAAqB,2CAUrE;AAED,OAAO,EACL,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,GACvB,CAAC;AAEF,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,GACtB,CAAC"}
|
|
@@ -104,14 +104,15 @@ function ModalOverlay({ className, animated = true, transition = modalDefaultTra
|
|
|
104
104
|
...props
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
function ModalContent({ className, children, animated = true, transition = modalDefaultTransition, ...props }) {
|
|
107
|
+
function ModalContent({ className, children, animated = true, transition = modalDefaultTransition, overlayClassName, ...props }) {
|
|
108
108
|
const { isDesktop } = useModalContext();
|
|
109
109
|
if (!isDesktop) {
|
|
110
110
|
return /*#__PURE__*/ _jsxs(ModalPortal, {
|
|
111
111
|
children: [
|
|
112
112
|
/*#__PURE__*/ _jsx(ModalOverlay, {
|
|
113
113
|
animated: animated,
|
|
114
|
-
transition: transition
|
|
114
|
+
transition: transition,
|
|
115
|
+
className: overlayClassName
|
|
115
116
|
}),
|
|
116
117
|
/*#__PURE__*/ _jsx(VaulDrawer.Content, {
|
|
117
118
|
className: cn('fixed bottom-0 left-0 right-0 z-50 flex flex-col bg-background-neutral-base rounded-t-16 max-h-[85vh] shadow-tooltip', className),
|
|
@@ -140,7 +141,8 @@ function ModalContent({ className, children, animated = true, transition = modal
|
|
|
140
141
|
children: [
|
|
141
142
|
/*#__PURE__*/ _jsx(ModalOverlay, {
|
|
142
143
|
animated: animated,
|
|
143
|
-
transition: transition
|
|
144
|
+
transition: transition,
|
|
145
|
+
className: overlayClassName
|
|
144
146
|
}),
|
|
145
147
|
/*#__PURE__*/ _jsx(DialogPrimitive.Content, {
|
|
146
148
|
className: baseClasses,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modal/modal.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport {cva} from 'class-variance-authority';\nimport {Button} from 'components/button';\nimport {Icon} from 'components/icon';\nimport {Text} from 'components/typography';\nimport {motion, type Transition} from 'framer-motion';\nimport {useMediaQuery} from 'hooks/useMediaQuery';\nimport {type ComponentProps, createContext, useContext} from 'react';\nimport {cn} from 'utils/cn';\nimport {Drawer as VaulDrawer} from 'vaul';\n\nconst modalDefaultTransition: Transition = {\n type: 'spring',\n stiffness: 300,\n damping: 30,\n};\n\ntype ModalContextValue = {\n breakpoint: string;\n isDesktop: boolean;\n};\n\nconst ModalContext = createContext<ModalContextValue | null>(null);\n\nfunction useModalContext() {\n const context = useContext(ModalContext);\n if (!context) {\n throw new Error('Modal components must be used within a Modal component');\n }\n return context;\n}\n\nconst modalOverlayVariants = cva(\n 'fixed inset-0 z-40 bg-background-backdrop-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n);\n\nconst modalContentVariants = cva(\n 'fixed left-1/2 top-1/2 z-50 flex flex-col overflow-clip bg-background-neutral-base rounded-16 w-full max-w-[576px] -translate-x-1/2 -translate-y-1/2 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 shadow-tooltip',\n);\n\nfunction Modal({\n breakpoint = '(min-width: 768px)',\n children,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Root> & {breakpoint?: string}) {\n const isDesktop = useMediaQuery(breakpoint);\n\n const contextValue: ModalContextValue = {\n breakpoint,\n isDesktop,\n };\n\n const Root = isDesktop ? DialogPrimitive.Root : VaulDrawer.Root;\n\n return (\n <ModalContext.Provider value={contextValue}>\n <Root {...props}>{children}</Root>\n </ModalContext.Provider>\n );\n}\n\nfunction ModalTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Trigger {...props} />;\n }\n\n return <VaulDrawer.Trigger {...props} />;\n}\n\nfunction ModalPortal(props: ComponentProps<typeof DialogPrimitive.Portal>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Portal {...props} />;\n }\n\n return <VaulDrawer.Portal {...props} />;\n}\n\nfunction ModalClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Close {...props} />;\n }\n\n return <VaulDrawer.Close {...props} />;\n}\n\ntype ModalOverlayProps = ComponentProps<typeof DialogPrimitive.Overlay> & {\n animated?: boolean;\n transition?: Transition;\n};\n\nfunction ModalOverlay({\n className,\n animated = true,\n transition = modalDefaultTransition,\n ...props\n}: ModalOverlayProps) {\n const {isDesktop} = useModalContext();\n\n if (!isDesktop) {\n return <VaulDrawer.Overlay className={cn(modalOverlayVariants(), className)} {...props} />;\n }\n\n if (animated) {\n return (\n <DialogPrimitive.Overlay className={cn(modalOverlayVariants(), className)} asChild {...props}>\n <motion.div\n initial={{opacity: 0}}\n animate={{opacity: 1}}\n exit={{opacity: 0}}\n transition={transition}\n />\n </DialogPrimitive.Overlay>\n );\n }\n\n return <DialogPrimitive.Overlay className={cn(modalOverlayVariants(), className)} {...props} />;\n}\n\ntype ModalContentProps = ComponentProps<typeof DialogPrimitive.Content> & {\n animated?: boolean;\n transition?: Transition;\n};\n\nfunction ModalContent({\n className,\n children,\n animated = true,\n transition = modalDefaultTransition,\n ...props\n}: ModalContentProps) {\n const {isDesktop} = useModalContext();\n\n if (!isDesktop) {\n return (\n <ModalPortal>\n <ModalOverlay animated={animated} transition={transition} />\n <VaulDrawer.Content\n className={cn(\n 'fixed bottom-0 left-0 right-0 z-50 flex flex-col bg-background-neutral-base rounded-t-16 max-h-[85vh] shadow-tooltip',\n className,\n )}\n {...props}\n >\n <div className=\"relative w-full h-full flex flex-col min-h-0\">\n <div className=\"pointer-events-none absolute inset-0 shadow-separator-inset rounded-t-16\" />\n <div className=\"flex items-center justify-center pt-8 pb-8 shrink-0\">\n <div className=\"bg-foreground-neutral-subtle w-32 h-4 rounded-full opacity-40\" />\n </div>\n {children}\n </div>\n </VaulDrawer.Content>\n </ModalPortal>\n );\n }\n\n const baseClasses = cn(modalContentVariants(), className);\n\n return (\n <ModalPortal>\n <ModalOverlay animated={animated} transition={transition} />\n <DialogPrimitive.Content className={baseClasses} {...props}>\n <div className=\"relative size-full\">\n <div className=\"pointer-events-none absolute inset-0 shadow-separator-inset rounded-16\" />\n {children}\n </div>\n </DialogPrimitive.Content>\n </ModalPortal>\n );\n}\n\ntype ModalHeaderProps = ComponentProps<'div'> & {\n title?: string;\n showEscIndicator?: boolean;\n showClose?: boolean;\n};\n\nfunction ModalHeader({\n className,\n title,\n showEscIndicator = true,\n showClose = true,\n children,\n ...props\n}: ModalHeaderProps) {\n const {isDesktop} = useModalContext();\n\n return (\n <div className=\"flex flex-col w-full shrink-0\" {...props}>\n <div className=\"bg-background-neutral-base flex items-center justify-center gap-20 overflow-clip px-24 py-16 w-full\">\n {title ? (\n <Text size=\"lg\" className=\"flex-1 overflow-ellipsis overflow-hidden whitespace-nowrap\">\n {title}\n </Text>\n ) : (\n <div className=\"flex-1\">{children}</div>\n )}\n <div className=\"flex items-center gap-8\">\n {isDesktop && showEscIndicator && (\n <kbd className=\"flex items-center justify-center rounded-8 border border-border-neutral-base shadow-button-neutral bg-background-field-base text-xs text-foreground-neutral-subtle px-4\">\n esc\n </kbd>\n )}\n {showClose && (\n <ModalClose asChild>\n <Button\n variant=\"transparent\"\n size=\"xs\"\n className=\"rounded-4 p-2 cursor-pointer bg-transparent border-none text-foreground-neutral-muted hover:text-foreground-neutral-base hover:bg-background-components-hover transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-background-accent-blue-base focus-visible:ring-offset-2 w-24 h-24\"\n >\n <Icon name=\"close\" />\n </Button>\n </ModalClose>\n )}\n </div>\n </div>\n <div className=\"bg-border-neutral-strong h-[1px] w-full\" />\n </div>\n );\n}\n\nfunction ModalBody({className, children, ...props}: ComponentProps<'div'>) {\n const {isDesktop} = useModalContext();\n\n return (\n <div\n className={cn(\n 'bg-background-neutral-base flex flex-col items-start px-24 pb-24 pt-16 w-full',\n isDesktop ? 'overflow-clip' : 'overflow-y-auto overflow-x-clip flex-1',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nfunction ModalFooter({className, children, ...props}: ComponentProps<'div'>) {\n return (\n <div className=\"flex flex-col w-full shrink-0\" {...props}>\n <div className=\"bg-border-neutral-strong h-[1px] w-full\" />\n <div className=\"bg-background-neutral-base flex items-end justify-end gap-20 overflow-clip px-24 py-16 w-full\">\n <div className={cn('flex items-center gap-16', className)}>{children}</div>\n </div>\n </div>\n );\n}\n\ntype ModalTitleProps = ComponentProps<typeof DialogPrimitive.Title>;\n\nfunction ModalTitle({className, ...props}: ModalTitleProps) {\n const {isDesktop} = useModalContext();\n\n const titleClassName = cn(\n 'font-medium text-lg leading-20 overflow-ellipsis overflow-hidden text-foreground-neutral-base',\n className,\n );\n\n if (!isDesktop) {\n return <VaulDrawer.Title className={titleClassName} {...props} />;\n }\n\n return <DialogPrimitive.Title className={titleClassName} {...props} />;\n}\n\ntype ModalDescriptionProps = ComponentProps<typeof DialogPrimitive.Description>;\n\nfunction ModalDescription({className, ...props}: ModalDescriptionProps) {\n const {isDesktop} = useModalContext();\n\n const descClassName = cn('text-sm leading-20 text-foreground-neutral-subtle', className);\n\n if (!isDesktop) {\n return <VaulDrawer.Description className={descClassName} {...props} />;\n }\n\n return <DialogPrimitive.Description className={descClassName} {...props} />;\n}\n\nexport {\n Modal,\n ModalPortal,\n ModalOverlay,\n ModalTrigger,\n ModalClose,\n ModalContent,\n ModalHeader,\n ModalBody,\n ModalFooter,\n ModalTitle,\n ModalDescription,\n modalContentVariants,\n modalOverlayVariants,\n modalDefaultTransition,\n};\n\nexport type {\n ModalContentProps,\n ModalHeaderProps,\n ModalOverlayProps,\n ModalTitleProps,\n ModalDescriptionProps,\n};\n"],"names":["DialogPrimitive","cva","Button","Icon","Text","motion","useMediaQuery","createContext","useContext","cn","Drawer","VaulDrawer","modalDefaultTransition","type","stiffness","damping","ModalContext","useModalContext","context","Error","modalOverlayVariants","modalContentVariants","Modal","breakpoint","children","props","isDesktop","contextValue","Root","Provider","value","ModalTrigger","Trigger","ModalPortal","Portal","ModalClose","Close","ModalOverlay","className","animated","transition","Overlay","asChild","div","initial","opacity","animate","exit","ModalContent","Content","baseClasses","ModalHeader","title","showEscIndicator","showClose","size","kbd","variant","name","ModalBody","ModalFooter","ModalTitle","titleClassName","Title","ModalDescription","descClassName","Description"],"mappings":";AAAA,YAAYA,qBAAqB,yBAAyB;AAC1D,SAAQC,GAAG,QAAO,2BAA2B;AAC7C,SAAQC,MAAM,QAAO,oBAAoB;AACzC,SAAQC,IAAI,QAAO,kBAAkB;AACrC,SAAQC,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,MAAM,QAAwB,gBAAgB;AACtD,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAA6BC,aAAa,EAAEC,UAAU,QAAO,QAAQ;AACrE,SAAQC,EAAE,QAAO,WAAW;AAC5B,SAAQ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,OAAuB;IACxD,MAAM,EAACC,SAAS,EAAC,GAAGT;IAEpB,MAAM6C,iBAAiBrD,GACrB,iGACA6B;IAGF,IAAI,CAACZ,WAAW;QACd,qBAAO,KAACf,WAAWoD,KAAK;YAACzB,WAAWwB;YAAiB,GAAGrC,KAAK;;IAC/D;IAEA,qBAAO,KAACzB,gBAAgB+D,KAAK;QAACzB,WAAWwB;QAAiB,GAAGrC,KAAK;;AACpE;AAIA,SAASuC,iBAAiB,EAAC1B,SAAS,EAAE,GAAGb,OAA6B;IACpE,MAAM,EAACC,SAAS,EAAC,GAAGT;IAEpB,MAAMgD,gBAAgBxD,GAAG,qDAAqD6B;IAE9E,IAAI,CAACZ,WAAW;QACd,qBAAO,KAACf,WAAWuD,WAAW;YAAC5B,WAAW2B;YAAgB,GAAGxC,KAAK;;IACpE;IAEA,qBAAO,KAACzB,gBAAgBkE,WAAW;QAAC5B,WAAW2B;QAAgB,GAAGxC,KAAK;;AACzE;AAEA,SACEH,KAAK,EACLW,WAAW,EACXI,YAAY,EACZN,YAAY,EACZI,UAAU,EACVa,YAAY,EACZG,WAAW,EACXQ,SAAS,EACTC,WAAW,EACXC,UAAU,EACVG,gBAAgB,EAChB3C,oBAAoB,EACpBD,oBAAoB,EACpBR,sBAAsB,GACtB"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/modal/modal.tsx"],"sourcesContent":["import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport {cva} from 'class-variance-authority';\nimport {Button} from 'components/button';\nimport {Icon} from 'components/icon';\nimport {Text} from 'components/typography';\nimport {motion, type Transition} from 'framer-motion';\nimport {useMediaQuery} from 'hooks/useMediaQuery';\nimport {type ComponentProps, createContext, useContext} from 'react';\nimport {cn} from 'utils/cn';\nimport {Drawer as VaulDrawer} from 'vaul';\n\nconst modalDefaultTransition: Transition = {\n type: 'spring',\n stiffness: 300,\n damping: 30,\n};\n\ntype ModalContextValue = {\n breakpoint: string;\n isDesktop: boolean;\n};\n\nconst ModalContext = createContext<ModalContextValue | null>(null);\n\nfunction useModalContext() {\n const context = useContext(ModalContext);\n if (!context) {\n throw new Error('Modal components must be used within a Modal component');\n }\n return context;\n}\n\nconst modalOverlayVariants = cva(\n 'fixed inset-0 z-40 bg-background-backdrop-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n);\n\nconst modalContentVariants = cva(\n 'fixed left-1/2 top-1/2 z-50 flex flex-col overflow-clip bg-background-neutral-base rounded-16 w-full max-w-[576px] -translate-x-1/2 -translate-y-1/2 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 shadow-tooltip',\n);\n\nfunction Modal({\n breakpoint = '(min-width: 768px)',\n children,\n ...props\n}: ComponentProps<typeof DialogPrimitive.Root> & {breakpoint?: string}) {\n const isDesktop = useMediaQuery(breakpoint);\n\n const contextValue: ModalContextValue = {\n breakpoint,\n isDesktop,\n };\n\n const Root = isDesktop ? DialogPrimitive.Root : VaulDrawer.Root;\n\n return (\n <ModalContext.Provider value={contextValue}>\n <Root {...props}>{children}</Root>\n </ModalContext.Provider>\n );\n}\n\nfunction ModalTrigger(props: ComponentProps<typeof DialogPrimitive.Trigger>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Trigger {...props} />;\n }\n\n return <VaulDrawer.Trigger {...props} />;\n}\n\nfunction ModalPortal(props: ComponentProps<typeof DialogPrimitive.Portal>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Portal {...props} />;\n }\n\n return <VaulDrawer.Portal {...props} />;\n}\n\nfunction ModalClose(props: ComponentProps<typeof DialogPrimitive.Close>) {\n const {isDesktop} = useModalContext();\n\n if (isDesktop) {\n return <DialogPrimitive.Close {...props} />;\n }\n\n return <VaulDrawer.Close {...props} />;\n}\n\ntype ModalOverlayProps = ComponentProps<typeof DialogPrimitive.Overlay> & {\n animated?: boolean;\n transition?: Transition;\n};\n\nfunction ModalOverlay({\n className,\n animated = true,\n transition = modalDefaultTransition,\n ...props\n}: ModalOverlayProps) {\n const {isDesktop} = useModalContext();\n\n if (!isDesktop) {\n return <VaulDrawer.Overlay className={cn(modalOverlayVariants(), className)} {...props} />;\n }\n\n if (animated) {\n return (\n <DialogPrimitive.Overlay className={cn(modalOverlayVariants(), className)} asChild {...props}>\n <motion.div\n initial={{opacity: 0}}\n animate={{opacity: 1}}\n exit={{opacity: 0}}\n transition={transition}\n />\n </DialogPrimitive.Overlay>\n );\n }\n\n return <DialogPrimitive.Overlay className={cn(modalOverlayVariants(), className)} {...props} />;\n}\n\ntype ModalContentProps = ComponentProps<typeof DialogPrimitive.Content> & {\n animated?: boolean;\n transition?: Transition;\n overlayClassName?: string;\n};\n\nfunction ModalContent({\n className,\n children,\n animated = true,\n transition = modalDefaultTransition,\n overlayClassName,\n ...props\n}: ModalContentProps) {\n const {isDesktop} = useModalContext();\n\n if (!isDesktop) {\n return (\n <ModalPortal>\n <ModalOverlay animated={animated} transition={transition} className={overlayClassName} />\n <VaulDrawer.Content\n className={cn(\n 'fixed bottom-0 left-0 right-0 z-50 flex flex-col bg-background-neutral-base rounded-t-16 max-h-[85vh] shadow-tooltip',\n className,\n )}\n {...props}\n >\n <div className=\"relative w-full h-full flex flex-col min-h-0\">\n <div className=\"pointer-events-none absolute inset-0 shadow-separator-inset rounded-t-16\" />\n <div className=\"flex items-center justify-center pt-8 pb-8 shrink-0\">\n <div className=\"bg-foreground-neutral-subtle w-32 h-4 rounded-full opacity-40\" />\n </div>\n {children}\n </div>\n </VaulDrawer.Content>\n </ModalPortal>\n );\n }\n\n const baseClasses = cn(modalContentVariants(), className);\n\n return (\n <ModalPortal>\n <ModalOverlay animated={animated} transition={transition} className={overlayClassName} />\n <DialogPrimitive.Content className={baseClasses} {...props}>\n <div className=\"relative size-full\">\n <div className=\"pointer-events-none absolute inset-0 shadow-separator-inset rounded-16\" />\n {children}\n </div>\n </DialogPrimitive.Content>\n </ModalPortal>\n );\n}\n\ntype ModalHeaderProps = ComponentProps<'div'> & {\n title?: string;\n showEscIndicator?: boolean;\n showClose?: boolean;\n};\n\nfunction ModalHeader({\n className,\n title,\n showEscIndicator = true,\n showClose = true,\n children,\n ...props\n}: ModalHeaderProps) {\n const {isDesktop} = useModalContext();\n\n return (\n <div className=\"flex flex-col w-full shrink-0\" {...props}>\n <div className=\"bg-background-neutral-base flex items-center justify-center gap-20 overflow-clip px-24 py-16 w-full\">\n {title ? (\n <Text size=\"lg\" className=\"flex-1 overflow-ellipsis overflow-hidden whitespace-nowrap\">\n {title}\n </Text>\n ) : (\n <div className=\"flex-1\">{children}</div>\n )}\n <div className=\"flex items-center gap-8\">\n {isDesktop && showEscIndicator && (\n <kbd className=\"flex items-center justify-center rounded-8 border border-border-neutral-base shadow-button-neutral bg-background-field-base text-xs text-foreground-neutral-subtle px-4\">\n esc\n </kbd>\n )}\n {showClose && (\n <ModalClose asChild>\n <Button\n variant=\"transparent\"\n size=\"xs\"\n className=\"rounded-4 p-2 cursor-pointer bg-transparent border-none text-foreground-neutral-muted hover:text-foreground-neutral-base hover:bg-background-components-hover transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-background-accent-blue-base focus-visible:ring-offset-2 w-24 h-24\"\n >\n <Icon name=\"close\" />\n </Button>\n </ModalClose>\n )}\n </div>\n </div>\n <div className=\"bg-border-neutral-strong h-[1px] w-full\" />\n </div>\n );\n}\n\nfunction ModalBody({className, children, ...props}: ComponentProps<'div'>) {\n const {isDesktop} = useModalContext();\n\n return (\n <div\n className={cn(\n 'bg-background-neutral-base flex flex-col items-start px-24 pb-24 pt-16 w-full',\n isDesktop ? 'overflow-clip' : 'overflow-y-auto overflow-x-clip flex-1',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nfunction ModalFooter({className, children, ...props}: ComponentProps<'div'>) {\n return (\n <div className=\"flex flex-col w-full shrink-0\" {...props}>\n <div className=\"bg-border-neutral-strong h-[1px] w-full\" />\n <div className=\"bg-background-neutral-base flex items-end justify-end gap-20 overflow-clip px-24 py-16 w-full\">\n <div className={cn('flex items-center gap-16', className)}>{children}</div>\n </div>\n </div>\n );\n}\n\ntype ModalTitleProps = ComponentProps<typeof DialogPrimitive.Title>;\n\nfunction ModalTitle({className, ...props}: ModalTitleProps) {\n const {isDesktop} = useModalContext();\n\n const titleClassName = cn(\n 'font-medium text-lg leading-20 overflow-ellipsis overflow-hidden text-foreground-neutral-base',\n className,\n );\n\n if (!isDesktop) {\n return <VaulDrawer.Title className={titleClassName} {...props} />;\n }\n\n return <DialogPrimitive.Title className={titleClassName} {...props} />;\n}\n\ntype ModalDescriptionProps = ComponentProps<typeof DialogPrimitive.Description>;\n\nfunction ModalDescription({className, ...props}: ModalDescriptionProps) {\n const {isDesktop} = useModalContext();\n\n const descClassName = cn('text-sm leading-20 text-foreground-neutral-subtle', className);\n\n if (!isDesktop) {\n return <VaulDrawer.Description className={descClassName} {...props} />;\n }\n\n return <DialogPrimitive.Description className={descClassName} {...props} />;\n}\n\nexport {\n Modal,\n ModalPortal,\n ModalOverlay,\n ModalTrigger,\n ModalClose,\n ModalContent,\n ModalHeader,\n ModalBody,\n ModalFooter,\n ModalTitle,\n ModalDescription,\n modalContentVariants,\n modalOverlayVariants,\n modalDefaultTransition,\n};\n\nexport type {\n ModalContentProps,\n ModalHeaderProps,\n ModalOverlayProps,\n ModalTitleProps,\n ModalDescriptionProps,\n};\n"],"names":["DialogPrimitive","cva","Button","Icon","Text","motion","useMediaQuery","createContext","useContext","cn","Drawer","VaulDrawer","modalDefaultTransition","type","stiffness","damping","ModalContext","useModalContext","context","Error","modalOverlayVariants","modalContentVariants","Modal","breakpoint","children","props","isDesktop","contextValue","Root","Provider","value","ModalTrigger","Trigger","ModalPortal","Portal","ModalClose","Close","ModalOverlay","className","animated","transition","Overlay","asChild","div","initial","opacity","animate","exit","ModalContent","overlayClassName","Content","baseClasses","ModalHeader","title","showEscIndicator","showClose","size","kbd","variant","name","ModalBody","ModalFooter","ModalTitle","titleClassName","Title","ModalDescription","descClassName","Description"],"mappings":";AAAA,YAAYA,qBAAqB,yBAAyB;AAC1D,SAAQC,GAAG,QAAO,2BAA2B;AAC7C,SAAQC,MAAM,QAAO,oBAAoB;AACzC,SAAQC,IAAI,QAAO,kBAAkB;AACrC,SAAQC,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,MAAM,QAAwB,gBAAgB;AACtD,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAA6BC,aAAa,EAAEC,UAAU,QAAO,QAAQ;AACrE,SAAQC,EAAE,QAAO,WAAW;AAC5B,SAAQC,UAAUC,UAAU,QAAO,OAAO;AAE1C,MAAMC,yBAAqC;IACzCC,MAAM;IACNC,WAAW;IACXC,SAAS;AACX;AAOA,MAAMC,6BAAeT,cAAwC;AAE7D,SAASU;IACP,MAAMC,UAAUV,WAAWQ;IAC3B,IAAI,CAACE,SAAS;QACZ,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOD;AACT;AAEA,MAAME,uBAAuBnB,IAC3B;AAGF,MAAMoB,uBAAuBpB,IAC3B;AAGF,SAASqB,MAAM,EACbC,aAAa,oBAAoB,EACjCC,QAAQ,EACR,GAAGC,OACiE;IACpE,MAAMC,YAAYpB,cAAciB;IAEhC,MAAMI,eAAkC;QACtCJ;QACAG;IACF;IAEA,MAAME,OAAOF,YAAY1B,gBAAgB4B,IAAI,GAAGjB,WAAWiB,IAAI;IAE/D,qBACE,KAACZ,aAAaa,QAAQ;QAACC,OAAOH;kBAC5B,cAAA,KAACC;YAAM,GAAGH,KAAK;sBAAGD;;;AAGxB;AAEA,SAASO,aAAaN,KAAqD;IACzE,MAAM,EAACC,SAAS,EAAC,GAAGT;IAEpB,IAAIS,WAAW;QACb,qBAAO,KAAC1B,gBAAgBgC,OAAO;YAAE,GAAGP,KAAK;;IAC3C;IAEA,qBAAO,KAACd,WAAWqB,OAAO;Q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,oBAAoB,EACpBD,oBAAoB,EACpBR,sBAAsB,GACtB"}
|
|
@@ -139,6 +139,7 @@ export const ImportForm = {
|
|
|
139
139
|
}),
|
|
140
140
|
/*#__PURE__*/ _jsxs(ModalContent, {
|
|
141
141
|
"aria-describedby": undefined,
|
|
142
|
+
overlayClassName: "bg-background-modal-overlay",
|
|
142
143
|
children: [
|
|
143
144
|
/*#__PURE__*/ _jsx(ModalTitle, {
|
|
144
145
|
className: "sr-only",
|
|
@@ -263,6 +264,7 @@ export const GithubActions = {
|
|
|
263
264
|
}),
|
|
264
265
|
/*#__PURE__*/ _jsxs(ModalContent, {
|
|
265
266
|
"aria-describedby": undefined,
|
|
267
|
+
overlayClassName: "bg-background-modal-overlay",
|
|
266
268
|
children: [
|
|
267
269
|
/*#__PURE__*/ _jsx(ModalTitle, {
|
|
268
270
|
className: "sr-only",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/modal/modal.stories.tsx"],"sourcesContent":["import {argosScreenshot} from '@argos-ci/storybook/vitest';\nimport type {Meta, StoryObj} from '@storybook/react';\nimport {screen, within} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {Button, ButtonLink} from 'components/button';\nimport {\n CodeBlock,\n CodeBlockBody,\n CodeBlockContent,\n CodeBlockCopyButton,\n CodeBlockFilename,\n CodeBlockFiles,\n CodeBlockFooter,\n CodeBlockHeader,\n CodeBlockItem,\n} from 'components/code-block';\nimport {DatePicker} from 'components/date-picker';\nimport {DynamicItem} from 'components/dynamic-item';\nimport {Icon} from 'components/icon';\nimport {Input} from 'components/input';\nimport {ItemTitle} from 'components/item';\nimport {Label} from 'components/label';\nimport {MovingBorder} from 'components/moving-border';\nimport {Text} from 'components/typography';\nimport {useState} from 'react';\nimport {cn} from 'utils/cn';\nimport illustration2 from '../../assets/illustration-2.svg';\nimport illustrationBg from '../../assets/illustration-gradient.svg';\nimport {\n Modal,\n ModalBody,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalTitle,\n ModalTrigger,\n} from './modal';\n\nconst OPEN_MODAL_REGEX = /open modal/i;\nconst IMPORT_JOBS_REGEX = /import past jobs from github/i;\nconst GITHUB_ACTIONS_REGEX = /run github actions on shipfox/i;\n\nconst DEFAULT_START_DATE = new Date('2025-12-06T00:00:00.000Z');\n\nconst meta = {\n title: 'Components/Modal',\n component: Modal,\n tags: ['autodocs'],\n parameters: {\n layout: 'centered',\n },\n} satisfies Meta<typeof Modal>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n play: async (ctx) => {\n const {canvasElement, step} = ctx;\n const canvas = within(canvasElement);\n const user = userEvent.setup();\n\n await step('Open the modal', async () => {\n const triggerButton = canvas.getByRole('button', {name: OPEN_MODAL_REGEX});\n await user.click(triggerButton);\n });\n\n await step('Wait for dialog to appear and render', async () => {\n await screen.findByRole('dialog');\n await new Promise((resolve) => setTimeout(resolve, 100));\n });\n\n await argosScreenshot(ctx, 'Default Modal Open');\n },\n render: () => {\n const [open, setOpen] = useState(false);\n\n return (\n <div className=\"flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip\">\n <Modal open={open} onOpenChange={setOpen}>\n <ModalTrigger asChild>\n <Button>Open Modal</Button>\n </ModalTrigger>\n <ModalContent aria-describedby={undefined}>\n <ModalTitle className=\"sr-only\">Modal Title</ModalTitle>\n <ModalHeader>\n <Text\n size=\"lg\"\n className=\"flex-1 overflow-ellipsis overflow-hidden whitespace-nowrap\"\n >\n Modal Title\n </Text>\n </ModalHeader>\n <ModalBody>\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n This modal automatically adapts between dialog (desktop) and drawer (mobile) based\n on screen size. Try resizing your browser window!\n </Text>\n </ModalBody>\n <ModalFooter>\n <Button variant=\"transparent\" onClick={() => setOpen(false)}>\n Cancel\n </Button>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Confirm\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </div>\n );\n },\n};\n\nexport const ImportForm: Story = {\n play: async (ctx) => {\n const {canvasElement, step} = ctx;\n const canvas = within(canvasElement);\n const user = userEvent.setup();\n\n await step('Open the modal', async () => {\n const triggerButton = canvas.getByRole('button', {name: IMPORT_JOBS_REGEX});\n await user.click(triggerButton);\n });\n\n await step('Wait for dialog to appear and render', async () => {\n await screen.findByRole('dialog');\n await new Promise((resolve) => setTimeout(resolve, 100));\n });\n\n await argosScreenshot(ctx, 'Import Form Modal Open');\n },\n render: () => {\n const [open, setOpen] = useState(false);\n const [date, setDate] = useState<Date | undefined>(DEFAULT_START_DATE);\n\n return (\n <div className=\"flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip\">\n <Modal open={open} onOpenChange={setOpen}>\n <ModalTrigger asChild>\n <Button>Import past jobs from GitHub</Button>\n </ModalTrigger>\n <ModalContent aria-describedby={undefined}>\n <ModalTitle className=\"sr-only\">Import past jobs from GitHub</ModalTitle>\n <ModalHeader title=\"Import past jobs from GitHub\" />\n <ModalBody className=\"gap-20\">\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n Backfill your CI history by importing past runs from your GitHub repo. We'll\n handle the rest by creating a background task to import the data for you.\n </Text>\n <div className=\"flex flex-col gap-20 w-full\">\n <div className=\"flex flex-col gap-8 w-full\">\n <Label>Repository owner</Label>\n <Input placeholder=\"apache\" />\n </div>\n <div className=\"flex flex-col gap-8 w-full\">\n <Label>Repository name</Label>\n <Input placeholder=\"kafka\" />\n </div>\n <div className=\"flex flex-col gap-8 w-full\">\n <Label htmlFor=\"start-date\">Start date</Label>\n <DatePicker\n id=\"start-date\"\n date={date}\n onDateSelect={setDate}\n onClear={() => setDate(undefined)}\n placeholder=\"DD/MM/YYYY\"\n />\n </div>\n </div>\n </ModalBody>\n <ModalFooter>\n <Button variant=\"transparent\" onClick={() => setOpen(false)}>\n Cancel\n </Button>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Import\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </div>\n );\n },\n};\n\nconst diffCode = `jobs:\n build:\n- runs-on: ubuntu-latest\n+ runs-on: shipfox-2vcpu-ubuntu-2404`;\n\nexport const GithubActions: Story = {\n parameters: {\n viewport: {\n defaultViewport: 'large',\n },\n },\n play: async (ctx) => {\n const {canvasElement, step} = ctx;\n const canvas = within(canvasElement);\n const user = userEvent.setup();\n\n await step('Open the modal', async () => {\n const triggerButton = canvas.getByRole('button', {name: GITHUB_ACTIONS_REGEX});\n await user.click(triggerButton);\n });\n\n await step('Wait for dialog to appear and render', async () => {\n await screen.findByRole('dialog');\n await new Promise((resolve) => setTimeout(resolve, 100));\n });\n\n await argosScreenshot(ctx, 'Github Actions Modal Open');\n },\n render: () => {\n const [open, setOpen] = useState(false);\n\n return (\n <div className=\"flex h-[50vh] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip\">\n <Modal open={open} onOpenChange={setOpen}>\n <ModalTrigger asChild>\n <Button>Run GitHub Actions on Shipfox</Button>\n </ModalTrigger>\n <ModalContent aria-describedby={undefined}>\n <ModalTitle className=\"sr-only\">Run GitHub Actions on Shipfox</ModalTitle>\n <ModalHeader title=\"Run GitHub Actions on Shipfox\" />\n <ModalBody className=\"gap-32\">\n <div className=\"flex flex-col gap-20 w-full\">\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n This will run your jobs on Shipfox's optimized infrastructure. Giving you\n faster builds, and dedicated resources.\n </Text>\n <div className=\"relative\">\n <img\n src={illustration2}\n alt=\"illustration-2\"\n className=\"hidden sm:block absolute overflow-clip right-2 top-1/2 -translate-y-1/2 translate-x-8 w-fit object-contain z-50\"\n />\n <div className={cn('relative overflow-hidden bg-transparent p-1 rounded-8')}>\n <div className=\"absolute inset-0\" style={{borderRadius: 'calc(0.5rem * 0.96)'}}>\n <MovingBorder duration={6000} rx=\"30%\" ry=\"30%\">\n <div className=\"h-100 w-200 bg-[radial-gradient(#ff9e7a_40%,transparent_60%)]\" />\n </MovingBorder>\n </div>\n <div\n className=\"relative\"\n style={{\n borderRadius: 'calc(0.5rem * 0.96)',\n }}\n >\n <DynamicItem\n variant=\"default\"\n title={\n <div className=\"flex items-center gap-6\">\n <span className=\"flex shrink-0 items-center justify-center text-tag-success-icon w-16 h-16\">\n <Icon\n name=\"money\"\n size=\"sm\"\n color=\"var(--foreground-neutral-subtle, #a1a1aa)\"\n />\n </span>\n <ItemTitle>6000 free credits/month to run your jobs</ItemTitle>\n </div>\n }\n description=\"~500 builds/month. No payment required.\"\n rightElement={\n <img\n src={illustrationBg}\n alt=\"illustration-bg\"\n className=\"hidden sm:block absolute overflow-clip right-4 w-fit object-contain scale-105\"\n />\n }\n />\n </div>\n </div>\n </div>\n </div>\n <div className=\"flex flex-col gap-20 w-full\">\n <div className=\"flex flex-col gap-6\">\n <div className=\"flex items-center justify-center w-full\">\n <Text className=\"flex-1 font-semibold text-foreground-neutral-base overflow-ellipsis overflow-hidden whitespace-nowrap\">\n Update your GitHub Actions workflow\n </Text>\n <ButtonLink variant=\"base\" size=\"sm\" href=\"#\" iconRight=\"bookOpen\">\n See docs\n </ButtonLink>\n </div>\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n Replace the runs-on line in your workflow file to use Shipfox runners.\n </Text>\n </div>\n\n <CodeBlock\n data={[\n {\n language: 'yaml',\n filename: '.github/workflows/<workflow-name>.yml',\n code: diffCode,\n },\n ]}\n defaultValue=\"yaml\"\n >\n <CodeBlockHeader>\n <CodeBlockFiles>\n {(item) => (\n <CodeBlockFilename value={item.language}>{item.filename}</CodeBlockFilename>\n )}\n </CodeBlockFiles>\n <CodeBlockCopyButton />\n </CodeBlockHeader>\n <CodeBlockBody>\n {(item) => (\n <CodeBlockItem value={item.language}>\n <CodeBlockContent language={item.language}>{item.code}</CodeBlockContent>\n </CodeBlockItem>\n )}\n </CodeBlockBody>\n <CodeBlockFooter\n state=\"running\"\n message=\"Waiting for Shipfox runner event…\"\n description=\"This usually takes 30-60 seconds after you commit the workflow file.\"\n />\n </CodeBlock>\n </div>\n </ModalBody>\n <ModalFooter>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Got it\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </div>\n );\n },\n};\n\nexport const OpenedModal: Story = {\n play: async (ctx) => {\n const {canvasElement, step} = ctx;\n const canvas = within(canvasElement);\n const user = userEvent.setup();\n\n await step('Open the modal', async () => {\n const triggerButton = canvas.getByRole('button', {name: OPEN_MODAL_REGEX});\n await user.click(triggerButton);\n });\n\n await step('Wait for dialog to appear and render', async () => {\n await screen.findByRole('dialog');\n await new Promise((resolve) => setTimeout(resolve, 100));\n });\n\n await argosScreenshot(ctx, 'Opened Modal State');\n },\n render: () => {\n const [open, setOpen] = useState(false);\n\n return (\n <div className=\"flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip\">\n <Modal open={open} onOpenChange={setOpen}>\n <ModalTrigger asChild>\n <Button>Open Modal</Button>\n </ModalTrigger>\n <ModalContent aria-describedby={undefined}>\n <ModalTitle className=\"sr-only\">Modal Title</ModalTitle>\n <ModalHeader>\n <Text\n size=\"lg\"\n className=\"flex-1 overflow-ellipsis overflow-hidden whitespace-nowrap\"\n >\n Modal Title\n </Text>\n </ModalHeader>\n <ModalBody>\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n This modal automatically adapts between dialog (desktop) and drawer (mobile) based\n on screen size. Try resizing your browser window!\n </Text>\n </ModalBody>\n <ModalFooter>\n <Button variant=\"transparent\" onClick={() => setOpen(false)}>\n Cancel\n </Button>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Confirm\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </div>\n );\n },\n};\n"],"names":["argosScreenshot","screen","within","userEvent","Button","ButtonLink","CodeBlock","CodeBlockBody","CodeBlockContent","CodeBlockCopyButton","CodeBlockFilename","CodeBlockFiles","CodeBlockFooter","CodeBlockHeader","CodeBlockItem","DatePicker","DynamicItem","Icon","Input","ItemTitle","Label","MovingBorder","Text","useState","cn","illustration2","illustrationBg","Modal","ModalBody","ModalContent","ModalFooter","ModalHeader","ModalTitle","ModalTrigger","OPEN_MODAL_REGEX","IMPORT_JOBS_REGEX","GITHUB_ACTIONS_REGEX","DEFAULT_START_DATE","Date","meta","title","component","tags","parameters","layout","Default","play","ctx","canvasElement","step","canvas","user","setup","triggerButton","getByRole","name","click","findByRole","Promise","resolve","setTimeout","render","open","setOpen","div","className","onOpenChange","asChild","aria-describedby","undefined","size","variant","onClick","ImportForm","date","setDate","placeholder","htmlFor","id","onDateSelect","onClear","diffCode","GithubActions","viewport","defaultViewport","img","src","alt","style","borderRadius","duration","rx","ry","span","color","description","rightElement","href","iconRight","data","language","filename","code","defaultValue","item","value","state","message","OpenedModal"],"mappings":";AAAA,SAAQA,eAAe,QAAO,6BAA6B;AAE3D,SAAQC,MAAM,EAAEC,MAAM,QAAO,yBAAyB;AACtD,OAAOC,eAAe,8BAA8B;AACpD,SAAQC,MAAM,EAAEC,UAAU,QAAO,oBAAoB;AACrD,SACEC,SAAS,EACTC,aAAa,EACbC,gBAAgB,EAChBC,mBAAmB,EACnBC,iBAAiB,EACjBC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,aAAa,QACR,wBAAwB;AAC/B,SAAQC,UAAU,QAAO,yBAAyB;AAClD,SAAQC,WAAW,QAAO,0BAA0B;AACpD,SAAQC,IAAI,QAAO,kBAAkB;AACrC,SAAQC,KAAK,QAAO,mBAAmB;AACvC,SAAQC,SAAS,QAAO,kBAAkB;AAC1C,SAAQC,KAAK,QAAO,mBAAmB;AACvC,SAAQC,YAAY,QAAO,2BAA2B;AACtD,SAAQC,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,QAAQ,QAAO,QAAQ;AAC/B,SAAQC,EAAE,QAAO,WAAW;AA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ACrC;gCAAWiC,WAAU;0CAAU;;0CAChC,KAAClC;0CACC,cAAA,KAACT;oCACCgD,MAAK;oCACLL,WAAU;8CACX;;;0CAIH,KAACrC;0CACC,cAAA,KAACN;oCAAKgD,MAAK;oCAAKL,WAAU;8CAAwC;;;0CAKpE,MAACnC;;kDACC,KAAC1B;wCAAOmE,SAAQ;wCAAcC,SAAS,IAAMT,QAAQ;kDAAQ;;kDAG7D,KAAC3D;wCAAOmE,SAAQ;wCAAUC,SAAS,IAAMT,QAAQ;kDAAQ;;;;;;;;;IAQrE;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/modal/modal.stories.tsx"],"sourcesContent":["import {argosScreenshot} from '@argos-ci/storybook/vitest';\nimport type {Meta, StoryObj} from '@storybook/react';\nimport {screen, within} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {Button, ButtonLink} from 'components/button';\nimport {\n CodeBlock,\n CodeBlockBody,\n CodeBlockContent,\n CodeBlockCopyButton,\n CodeBlockFilename,\n CodeBlockFiles,\n CodeBlockFooter,\n CodeBlockHeader,\n CodeBlockItem,\n} from 'components/code-block';\nimport {DatePicker} from 'components/date-picker';\nimport {DynamicItem} from 'components/dynamic-item';\nimport {Icon} from 'components/icon';\nimport {Input} from 'components/input';\nimport {ItemTitle} from 'components/item';\nimport {Label} from 'components/label';\nimport {MovingBorder} from 'components/moving-border';\nimport {Text} from 'components/typography';\nimport {useState} from 'react';\nimport {cn} from 'utils/cn';\nimport illustration2 from '../../assets/illustration-2.svg';\nimport illustrationBg from '../../assets/illustration-gradient.svg';\nimport {\n Modal,\n ModalBody,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalTitle,\n ModalTrigger,\n} from './modal';\n\nconst OPEN_MODAL_REGEX = /open modal/i;\nconst IMPORT_JOBS_REGEX = /import past jobs from github/i;\nconst GITHUB_ACTIONS_REGEX = /run github actions on shipfox/i;\n\nconst DEFAULT_START_DATE = new Date('2025-12-06T00:00:00.000Z');\n\nconst meta = {\n title: 'Components/Modal',\n component: Modal,\n tags: ['autodocs'],\n parameters: {\n layout: 'centered',\n },\n} satisfies Meta<typeof Modal>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n play: async (ctx) => {\n const {canvasElement, step} = ctx;\n const canvas = within(canvasElement);\n const user = userEvent.setup();\n\n await step('Open the modal', async () => {\n const triggerButton = canvas.getByRole('button', {name: OPEN_MODAL_REGEX});\n await user.click(triggerButton);\n });\n\n await step('Wait for dialog to appear and render', async () => {\n await screen.findByRole('dialog');\n await new Promise((resolve) => setTimeout(resolve, 100));\n });\n\n await argosScreenshot(ctx, 'Default Modal Open');\n },\n render: () => {\n const [open, setOpen] = useState(false);\n\n return (\n <div className=\"flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip\">\n <Modal open={open} onOpenChange={setOpen}>\n <ModalTrigger asChild>\n <Button>Open Modal</Button>\n </ModalTrigger>\n <ModalContent aria-describedby={undefined}>\n <ModalTitle className=\"sr-only\">Modal Title</ModalTitle>\n <ModalHeader>\n <Text\n size=\"lg\"\n className=\"flex-1 overflow-ellipsis overflow-hidden whitespace-nowrap\"\n >\n Modal Title\n </Text>\n </ModalHeader>\n <ModalBody>\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n This modal automatically adapts between dialog (desktop) and drawer (mobile) based\n on screen size. Try resizing your browser window!\n </Text>\n </ModalBody>\n <ModalFooter>\n <Button variant=\"transparent\" onClick={() => setOpen(false)}>\n Cancel\n </Button>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Confirm\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </div>\n );\n },\n};\n\nexport const ImportForm: Story = {\n play: async (ctx) => {\n const {canvasElement, step} = ctx;\n const canvas = within(canvasElement);\n const user = userEvent.setup();\n\n await step('Open the modal', async () => {\n const triggerButton = canvas.getByRole('button', {name: IMPORT_JOBS_REGEX});\n await user.click(triggerButton);\n });\n\n await step('Wait for dialog to appear and render', async () => {\n await screen.findByRole('dialog');\n await new Promise((resolve) => setTimeout(resolve, 100));\n });\n\n await argosScreenshot(ctx, 'Import Form Modal Open');\n },\n render: () => {\n const [open, setOpen] = useState(false);\n const [date, setDate] = useState<Date | undefined>(DEFAULT_START_DATE);\n\n return (\n <div className=\"flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip\">\n <Modal open={open} onOpenChange={setOpen}>\n <ModalTrigger asChild>\n <Button>Import past jobs from GitHub</Button>\n </ModalTrigger>\n <ModalContent aria-describedby={undefined} overlayClassName=\"bg-background-modal-overlay\">\n <ModalTitle className=\"sr-only\">Import past jobs from GitHub</ModalTitle>\n <ModalHeader title=\"Import past jobs from GitHub\" />\n <ModalBody className=\"gap-20\">\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n Backfill your CI history by importing past runs from your GitHub repo. We'll\n handle the rest by creating a background task to import the data for you.\n </Text>\n <div className=\"flex flex-col gap-20 w-full\">\n <div className=\"flex flex-col gap-8 w-full\">\n <Label>Repository owner</Label>\n <Input placeholder=\"apache\" />\n </div>\n <div className=\"flex flex-col gap-8 w-full\">\n <Label>Repository name</Label>\n <Input placeholder=\"kafka\" />\n </div>\n <div className=\"flex flex-col gap-8 w-full\">\n <Label htmlFor=\"start-date\">Start date</Label>\n <DatePicker\n id=\"start-date\"\n date={date}\n onDateSelect={setDate}\n onClear={() => setDate(undefined)}\n placeholder=\"DD/MM/YYYY\"\n />\n </div>\n </div>\n </ModalBody>\n <ModalFooter>\n <Button variant=\"transparent\" onClick={() => setOpen(false)}>\n Cancel\n </Button>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Import\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </div>\n );\n },\n};\n\nconst diffCode = `jobs:\n build:\n- runs-on: ubuntu-latest\n+ runs-on: shipfox-2vcpu-ubuntu-2404`;\n\nexport const GithubActions: Story = {\n parameters: {\n viewport: {\n defaultViewport: 'large',\n },\n },\n play: async (ctx) => {\n const {canvasElement, step} = ctx;\n const canvas = within(canvasElement);\n const user = userEvent.setup();\n\n await step('Open the modal', async () => {\n const triggerButton = canvas.getByRole('button', {name: GITHUB_ACTIONS_REGEX});\n await user.click(triggerButton);\n });\n\n await step('Wait for dialog to appear and render', async () => {\n await screen.findByRole('dialog');\n await new Promise((resolve) => setTimeout(resolve, 100));\n });\n\n await argosScreenshot(ctx, 'Github Actions Modal Open');\n },\n render: () => {\n const [open, setOpen] = useState(false);\n\n return (\n <div className=\"flex h-[50vh] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip\">\n <Modal open={open} onOpenChange={setOpen}>\n <ModalTrigger asChild>\n <Button>Run GitHub Actions on Shipfox</Button>\n </ModalTrigger>\n <ModalContent aria-describedby={undefined} overlayClassName=\"bg-background-modal-overlay\">\n <ModalTitle className=\"sr-only\">Run GitHub Actions on Shipfox</ModalTitle>\n <ModalHeader title=\"Run GitHub Actions on Shipfox\" />\n <ModalBody className=\"gap-32\">\n <div className=\"flex flex-col gap-20 w-full\">\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n This will run your jobs on Shipfox's optimized infrastructure. Giving you\n faster builds, and dedicated resources.\n </Text>\n <div className=\"relative\">\n <img\n src={illustration2}\n alt=\"illustration-2\"\n className=\"hidden sm:block absolute overflow-clip right-2 top-1/2 -translate-y-1/2 translate-x-8 w-fit object-contain z-50\"\n />\n <div className={cn('relative overflow-hidden bg-transparent p-1 rounded-8')}>\n <div className=\"absolute inset-0\" style={{borderRadius: 'calc(0.5rem * 0.96)'}}>\n <MovingBorder duration={6000} rx=\"30%\" ry=\"30%\">\n <div className=\"h-100 w-200 bg-[radial-gradient(#ff9e7a_40%,transparent_60%)]\" />\n </MovingBorder>\n </div>\n <div\n className=\"relative\"\n style={{\n borderRadius: 'calc(0.5rem * 0.96)',\n }}\n >\n <DynamicItem\n variant=\"default\"\n title={\n <div className=\"flex items-center gap-6\">\n <span className=\"flex shrink-0 items-center justify-center text-tag-success-icon w-16 h-16\">\n <Icon\n name=\"money\"\n size=\"sm\"\n color=\"var(--foreground-neutral-subtle, #a1a1aa)\"\n />\n </span>\n <ItemTitle>6000 free credits/month to run your jobs</ItemTitle>\n </div>\n }\n description=\"~500 builds/month. No payment required.\"\n rightElement={\n <img\n src={illustrationBg}\n alt=\"illustration-bg\"\n className=\"hidden sm:block absolute overflow-clip right-4 w-fit object-contain scale-105\"\n />\n }\n />\n </div>\n </div>\n </div>\n </div>\n <div className=\"flex flex-col gap-20 w-full\">\n <div className=\"flex flex-col gap-6\">\n <div className=\"flex items-center justify-center w-full\">\n <Text className=\"flex-1 font-semibold text-foreground-neutral-base overflow-ellipsis overflow-hidden whitespace-nowrap\">\n Update your GitHub Actions workflow\n </Text>\n <ButtonLink variant=\"base\" size=\"sm\" href=\"#\" iconRight=\"bookOpen\">\n See docs\n </ButtonLink>\n </div>\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n Replace the runs-on line in your workflow file to use Shipfox runners.\n </Text>\n </div>\n\n <CodeBlock\n data={[\n {\n language: 'yaml',\n filename: '.github/workflows/<workflow-name>.yml',\n code: diffCode,\n },\n ]}\n defaultValue=\"yaml\"\n >\n <CodeBlockHeader>\n <CodeBlockFiles>\n {(item) => (\n <CodeBlockFilename value={item.language}>{item.filename}</CodeBlockFilename>\n )}\n </CodeBlockFiles>\n <CodeBlockCopyButton />\n </CodeBlockHeader>\n <CodeBlockBody>\n {(item) => (\n <CodeBlockItem value={item.language}>\n <CodeBlockContent language={item.language}>{item.code}</CodeBlockContent>\n </CodeBlockItem>\n )}\n </CodeBlockBody>\n <CodeBlockFooter\n state=\"running\"\n message=\"Waiting for Shipfox runner event…\"\n description=\"This usually takes 30-60 seconds after you commit the workflow file.\"\n />\n </CodeBlock>\n </div>\n </ModalBody>\n <ModalFooter>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Got it\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </div>\n );\n },\n};\n\nexport const OpenedModal: Story = {\n play: async (ctx) => {\n const {canvasElement, step} = ctx;\n const canvas = within(canvasElement);\n const user = userEvent.setup();\n\n await step('Open the modal', async () => {\n const triggerButton = canvas.getByRole('button', {name: OPEN_MODAL_REGEX});\n await user.click(triggerButton);\n });\n\n await step('Wait for dialog to appear and render', async () => {\n await screen.findByRole('dialog');\n await new Promise((resolve) => setTimeout(resolve, 100));\n });\n\n await argosScreenshot(ctx, 'Opened Modal State');\n },\n render: () => {\n const [open, setOpen] = useState(false);\n\n return (\n <div className=\"flex h-[calc(100vh/2)] w-[calc(100vw/2)] items-center justify-center rounded-16 bg-background-subtle-base shadow-tooltip\">\n <Modal open={open} onOpenChange={setOpen}>\n <ModalTrigger asChild>\n <Button>Open Modal</Button>\n </ModalTrigger>\n <ModalContent aria-describedby={undefined}>\n <ModalTitle className=\"sr-only\">Modal Title</ModalTitle>\n <ModalHeader>\n <Text\n size=\"lg\"\n className=\"flex-1 overflow-ellipsis overflow-hidden whitespace-nowrap\"\n >\n Modal Title\n </Text>\n </ModalHeader>\n <ModalBody>\n <Text size=\"sm\" className=\"text-foreground-neutral-subtle w-full\">\n This modal automatically adapts between dialog (desktop) and drawer (mobile) based\n on screen size. Try resizing your browser window!\n </Text>\n </ModalBody>\n <ModalFooter>\n <Button variant=\"transparent\" onClick={() => setOpen(false)}>\n Cancel\n </Button>\n <Button variant=\"primary\" onClick={() => setOpen(false)}>\n Confirm\n </Button>\n </ModalFooter>\n </ModalContent>\n </Modal>\n </div>\n );\n },\n};\n"],"names":["argosScreenshot","screen","within","userEvent","Button","ButtonLink","CodeBlock","CodeBlockBody","CodeBlockContent","CodeBlockCopyButton","CodeBlockFilename","CodeBlockFiles","CodeBlockFooter","CodeBlockHeader","CodeBlockItem","DatePicker","DynamicItem","Icon","Input","ItemTitle","Label","MovingBorder","Text","useState","cn","illustration2","illustrationBg","Modal","ModalBody","ModalContent","ModalFooter","ModalHeader","ModalTitle","ModalTrigger","OPEN_MODAL_REGEX","IMPORT_JOBS_REGEX","GITHUB_ACTIONS_REGEX","DEFAULT_START_DATE","Date","meta","title","component","tags","parameters","layout","Default","play","ctx","canvasElement","step","canvas","user","setup","triggerButton","getByRole","name","click","findByRole","Promise","resolve","setTimeout","render","open","setOpen","div","className","onOpenChange","asChild","aria-describedby","undefined","size","variant","onClick","ImportForm","date","setDate","overlayClassName","placeholder","htmlFor","id","onDateSelect","onClear","diffCode","GithubActions","viewport","defaultViewport","img","src","alt","style","borderRadius","duration","rx","ry","span","color","description","rightElement","href","iconRight","data","language","filename","code","defaultValue","item","value","state","message","OpenedModal"],"mappings":";AAAA,SAAQA,eAAe,QAAO,6BAA6B;AAE3D,SAAQC,MAAM,EAAEC,MAAM,QAAO,yBAAyB;AACtD,OAAOC,eAAe,8BAA8B;AACpD,SAAQC,MAAM,EAAEC,UAAU,QAAO,oBAAoB;AACrD,SACEC,SAAS,EACTC,aAAa,EACbC,gBAAgB,EAChBC,mBAAmB,EACnBC,iBAAiB,EACjBC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,aAAa,QACR,wBAAwB;AAC/B,SAAQC,UAAU,QAAO,yBAAyB;AAClD,SAAQC,WAAW,QAAO,0BAA0B;AACpD,SAAQC,IAAI,QAAO,kBAAkB;AACrC,SAAQC,KAAK,QAAO,mBAAmB;AACvC,SAAQC,SAAS,QAAO,kBAAkB;AAC1C,SAAQC,KAAK,QAAO,mBAAmB;AACvC,SAAQC,YAAY,QAAO,2BAA2B;AACtD,SAAQC,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,QAAQ,QAAO,QAAQ;AAC/B,SAAQC,EAAE,QAAO,WAAW;AAC5B,OAAOC,mBAAmB,kCAAkC;AAC5D,OAAOC,oBAAoB,yCAAyC;AACpE,SACEC,KAAK,EACLC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,UAAU,E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AACrC;0CACC,cAAA,KAACN;oCAAKgD,MAAK;oCAAKL,WAAU;8CAAwC;;;0CAKpE,MAACnC;;kDACC,KAAC1B;wCAAOmE,SAAQ;wCAAcC,SAAS,IAAMT,QAAQ;kDAAQ;;kDAG7D,KAAC3D;wCAAOmE,SAAQ;wCAAUC,SAAS,IAAMT,QAAQ;kDAAQ;;;;;;;;;IAQrE;AACF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/tabs/index.ts"],"sourcesContent":["export * from './tabs';\n"],"names":[],"mappings":"AAAA,cAAc,SAAS"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type HTMLMotionProps, type Transition } from 'framer-motion';
|
|
2
|
+
import { type ComponentProps, type ReactNode } from 'react';
|
|
3
|
+
type TabsContextType<T extends string = string> = {
|
|
4
|
+
activeValue: T;
|
|
5
|
+
handleValueChange: (value: T) => void;
|
|
6
|
+
registerTrigger: (value: string, node: HTMLElement | null) => void;
|
|
7
|
+
getTriggerElement: (value: string) => HTMLElement | undefined;
|
|
8
|
+
getAllTriggerValues: () => string[];
|
|
9
|
+
};
|
|
10
|
+
declare function useTabs<T extends string = string>(): TabsContextType<T>;
|
|
11
|
+
type BaseTabsProps = ComponentProps<'div'> & {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
type UnControlledTabsProps<T extends string = string> = BaseTabsProps & {
|
|
15
|
+
defaultValue?: T;
|
|
16
|
+
value?: never;
|
|
17
|
+
onValueChange?: never;
|
|
18
|
+
};
|
|
19
|
+
type ControlledTabsProps<T extends string = string> = BaseTabsProps & {
|
|
20
|
+
value: T;
|
|
21
|
+
onValueChange?: (value: T) => void;
|
|
22
|
+
defaultValue?: never;
|
|
23
|
+
};
|
|
24
|
+
type TabsProps<T extends string = string> = UnControlledTabsProps<T> | ControlledTabsProps<T>;
|
|
25
|
+
declare function Tabs<T extends string = string>({ defaultValue, value, onValueChange, children, className, ...props }: TabsProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
type TabsListProps = ComponentProps<'div'> & {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
activeClassName?: string;
|
|
29
|
+
transition?: Transition;
|
|
30
|
+
};
|
|
31
|
+
declare function TabsList({ children, className, activeClassName, transition, ...props }: TabsListProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
type TabsTriggerProps = Omit<HTMLMotionProps<'button'>, 'ref'> & {
|
|
33
|
+
value: string;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
};
|
|
36
|
+
declare const TabsTrigger: import("react").ForwardRefExoticComponent<Omit<HTMLMotionProps<"button">, "ref"> & {
|
|
37
|
+
value: string;
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
40
|
+
type TabsContentsProps = ComponentProps<'div'> & {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
};
|
|
43
|
+
declare function TabsContents({ children, className, ...props }: TabsContentsProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
type TabsContentProps = ComponentProps<'div'> & {
|
|
45
|
+
value: string;
|
|
46
|
+
children: ReactNode;
|
|
47
|
+
};
|
|
48
|
+
declare function TabsContent({ children, value, className, ...props }: TabsContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
49
|
+
export { Tabs, TabsList, TabsTrigger, TabsContents, TabsContent, useTabs, type TabsContextType, type TabsProps, type TabsListProps, type TabsTriggerProps, type TabsContentsProps, type TabsContentProps, };
|
|
50
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/tabs.tsx"],"names":[],"mappings":"AA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