@js-empire/emperor-ui 1.3.6 → 1.3.7
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/emperor-ui.js +60623 -158
- package/package.json +7 -3
- package/.cursor/rules/code-conventions.mdc +0 -50
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -10
- package/.storybook/main.ts +0 -24
- package/.storybook/preview.ts +0 -19
- package/.storybook/vitest.setup.ts +0 -7
- package/.vscode/extensions.json +0 -1
- package/dist/index-ABKcY4tX.js +0 -60607
- package/dist/index-CWu5fG3N.js +0 -6
- package/dist/index-DpemL3iQ.js +0 -291
- package/dist/src-UW24ZMRV-I8bMqcTI.js +0 -6
- package/eslint.config.js +0 -34
- package/index.html +0 -13
- package/public/icons/emperor-ui-logo.ico +0 -0
- package/public/images/avatar-female.jpg +0 -0
- package/public/images/avatar-male.jpg +0 -0
- package/public/images/emperor-ui-logo.png +0 -0
- package/src/animations/blink.ts +0 -26
- package/src/animations/floating.ts +0 -12
- package/src/animations/index.ts +0 -2
- package/src/components/atoms/brand/brand.stories.tsx +0 -27
- package/src/components/atoms/brand/brand.tsx +0 -56
- package/src/components/atoms/brand/index.ts +0 -1
- package/src/components/atoms/brand/styles/classes.ts +0 -9
- package/src/components/atoms/brand/styles/index.ts +0 -2
- package/src/components/atoms/brand/styles/styles.ts +0 -0
- package/src/components/atoms/color-picker/color-picker.tsx +0 -12
- package/src/components/atoms/color-picker/free-color-picker.tsx +0 -58
- package/src/components/atoms/color-picker/index.ts +0 -3
- package/src/components/atoms/color-picker/preset-color-picker.tsx +0 -66
- package/src/components/atoms/color-picker/stories/color-picker.stories.tsx +0 -63
- package/src/components/atoms/column/column.stories.tsx +0 -37
- package/src/components/atoms/column/column.tsx +0 -21
- package/src/components/atoms/column/index.ts +0 -1
- package/src/components/atoms/container/column.stories.tsx +0 -37
- package/src/components/atoms/container/container.tsx +0 -28
- package/src/components/atoms/container/index.ts +0 -1
- package/src/components/atoms/copy-button/copy-button.tsx +0 -73
- package/src/components/atoms/copy-button/index.ts +0 -1
- package/src/components/atoms/copy-button/stories/copy-button.stories.tsx +0 -21
- package/src/components/atoms/field/field.tsx +0 -81
- package/src/components/atoms/field/index.ts +0 -3
- package/src/components/atoms/field/styles/classes.ts +0 -9
- package/src/components/atoms/field/styles/index.ts +0 -1
- package/src/components/atoms/field/units/autocomplete-field.tsx +0 -49
- package/src/components/atoms/field/units/checkbox-field.tsx +0 -35
- package/src/components/atoms/field/units/index.ts +0 -7
- package/src/components/atoms/field/units/input-field.tsx +0 -35
- package/src/components/atoms/field/units/radio-field.tsx +0 -43
- package/src/components/atoms/field/units/select-field.tsx +0 -50
- package/src/components/atoms/field/units/switch-field.tsx +0 -35
- package/src/components/atoms/field/units/textarea-field.tsx +0 -37
- package/src/components/atoms/filter/filter.tsx +0 -93
- package/src/components/atoms/filter/index.ts +0 -3
- package/src/components/atoms/filter/stories/filter.stories.tsx +0 -238
- package/src/components/atoms/filter/styles/classes.ts +0 -20
- package/src/components/atoms/filter/styles/index.ts +0 -1
- package/src/components/atoms/filter/units/autocomplete-filter.tsx +0 -66
- package/src/components/atoms/filter/units/checkbox-filter.tsx +0 -42
- package/src/components/atoms/filter/units/checkbox-group-filter.tsx +0 -68
- package/src/components/atoms/filter/units/date-filter.tsx +0 -46
- package/src/components/atoms/filter/units/index.ts +0 -9
- package/src/components/atoms/filter/units/numeric-filter.tsx +0 -41
- package/src/components/atoms/filter/units/range-filter.tsx +0 -65
- package/src/components/atoms/filter/units/search-filter.tsx +0 -53
- package/src/components/atoms/filter/units/select-filter.tsx +0 -57
- package/src/components/atoms/filter/units/switch-filter.tsx +0 -35
- package/src/components/atoms/index.ts +0 -11
- package/src/components/atoms/portal/index.ts +0 -1
- package/src/components/atoms/portal/portal.stories.tsx +0 -43
- package/src/components/atoms/portal/portal.tsx +0 -25
- package/src/components/atoms/row/index.ts +0 -1
- package/src/components/atoms/row/row.stories.tsx +0 -37
- package/src/components/atoms/row/row.tsx +0 -26
- package/src/components/atoms/theme-switch/index.ts +0 -1
- package/src/components/atoms/theme-switch/styles/classes.ts +0 -16
- package/src/components/atoms/theme-switch/styles/index.ts +0 -1
- package/src/components/atoms/theme-switch/theme-switch.stories.tsx +0 -26
- package/src/components/atoms/theme-switch/theme-switch.tsx +0 -54
- package/src/components/atoms/uploader/components/avatar-label.tsx +0 -102
- package/src/components/atoms/uploader/components/index.ts +0 -8
- package/src/components/atoms/uploader/components/upload-file-error-box.tsx +0 -40
- package/src/components/atoms/uploader/components/upload-file-input.tsx +0 -36
- package/src/components/atoms/uploader/components/upload-file-label.tsx +0 -92
- package/src/components/atoms/uploader/components/upload-file-listing.tsx +0 -64
- package/src/components/atoms/uploader/components/uploader-title.tsx +0 -21
- package/src/components/atoms/uploader/components/uploader.tsx +0 -89
- package/src/components/atoms/uploader/components/view-image-modal.tsx +0 -41
- package/src/components/atoms/uploader/index.ts +0 -1
- package/src/components/atoms/uploader/stories/uploader.stories.tsx +0 -202
- package/src/components/index.ts +0 -4
- package/src/components/molecules/index.ts +0 -4
- package/src/components/molecules/item-card/components/actions/index.ts +0 -3
- package/src/components/molecules/item-card/components/actions/item-actions-buttons.tsx +0 -43
- package/src/components/molecules/item-card/components/actions/item-actions-dropdown.tsx +0 -57
- package/src/components/molecules/item-card/components/actions/item-actions-overlay.tsx +0 -50
- package/src/components/molecules/item-card/components/additions/index.ts +0 -2
- package/src/components/molecules/item-card/components/additions/item-banner.tsx +0 -22
- package/src/components/molecules/item-card/components/additions/loading-item.tsx +0 -88
- package/src/components/molecules/item-card/components/card/index.ts +0 -4
- package/src/components/molecules/item-card/components/card/item-card-body.tsx +0 -74
- package/src/components/molecules/item-card/components/card/item-card-footer.tsx +0 -79
- package/src/components/molecules/item-card/components/card/item-card-header.tsx +0 -69
- package/src/components/molecules/item-card/components/card/item-card.tsx +0 -123
- package/src/components/molecules/item-card/components/index.ts +0 -3
- package/src/components/molecules/item-card/index.ts +0 -2
- package/src/components/molecules/item-card/stories/item-card.stories.tsx +0 -218
- package/src/components/molecules/item-card/styles/classes.ts +0 -141
- package/src/components/molecules/item-card/styles/index.ts +0 -1
- package/src/components/molecules/nav-bar/index.ts +0 -3
- package/src/components/molecules/nav-bar/nav-bar-item.tsx +0 -64
- package/src/components/molecules/nav-bar/nav-bar.tsx +0 -57
- package/src/components/molecules/nav-bar/stories/hover-effect/nav-bar-hover-effect.stories.tsx +0 -52
- package/src/components/molecules/nav-bar/stories/nav-bar.stories.tsx +0 -50
- package/src/components/molecules/nav-bar/styles/classes.ts +0 -68
- package/src/components/molecules/nav-bar/styles/index.ts +0 -2
- package/src/components/molecules/nav-bar/styles/styles.ts +0 -85
- package/src/components/molecules/nav-bar/sub-items-box.tsx +0 -58
- package/src/components/molecules/scaffold/index.ts +0 -2
- package/src/components/molecules/scaffold/scaffold.stories.tsx +0 -21
- package/src/components/molecules/scaffold/scaffold.tsx +0 -23
- package/src/components/molecules/scaffold/styles/index.ts +0 -1
- package/src/components/molecules/scaffold/styles/scaffold-classes.ts +0 -10
- package/src/components/molecules/side-bar/compact-side-bar.tsx +0 -77
- package/src/components/molecules/side-bar/index.ts +0 -1
- package/src/components/molecules/side-bar/side-bar-drawer.tsx +0 -113
- package/src/components/molecules/side-bar/side-bar.stories.tsx +0 -111
- package/src/components/molecules/side-bar/side-bar.tsx +0 -31
- package/src/components/molecules/side-bar/styles/classes.ts +0 -28
- package/src/components/molecules/side-bar/styles/index.ts +0 -2
- package/src/components/molecules/side-bar/styles/styles.ts +0 -13
- package/src/components/organisms/deletion-confirmor/deletion-confirmor.tsx +0 -110
- package/src/components/organisms/deletion-confirmor/index.ts +0 -3
- package/src/components/organisms/deletion-confirmor/stories/components.tsx +0 -25
- package/src/components/organisms/deletion-confirmor/stories/deletion-confirmor.stories.tsx +0 -78
- package/src/components/organisms/deletion-confirmor/styles/classes.ts +0 -28
- package/src/components/organisms/deletion-confirmor/styles/index.ts +0 -2
- package/src/components/organisms/deletion-confirmor/styles/styles.ts +0 -4
- package/src/components/organisms/footer/copy-rights-box.tsx +0 -27
- package/src/components/organisms/footer/footer.tsx +0 -75
- package/src/components/organisms/footer/index.ts +0 -5
- package/src/components/organisms/footer/policies-box.tsx +0 -27
- package/src/components/organisms/footer/quick-links-box.tsx +0 -46
- package/src/components/organisms/footer/social-links-box.tsx +0 -33
- package/src/components/organisms/footer/stories/footer.stories.tsx +0 -61
- package/src/components/organisms/footer/styles/classes.ts +0 -71
- package/src/components/organisms/footer/styles/index.ts +0 -2
- package/src/components/organisms/footer/styles/styles.ts +0 -6
- package/src/components/organisms/form-builder/form-builder.stories.tsx +0 -144
- package/src/components/organisms/form-builder/form-builder.tsx +0 -75
- package/src/components/organisms/form-builder/index.ts +0 -1
- package/src/components/organisms/header/header.tsx +0 -87
- package/src/components/organisms/header/index.ts +0 -1
- package/src/components/organisms/header/segmented-header-content.tsx +0 -29
- package/src/components/organisms/header/stories/header.stories.tsx +0 -144
- package/src/components/organisms/header/styles/classes.ts +0 -22
- package/src/components/organisms/header/styles/index.ts +0 -2
- package/src/components/organisms/header/styles/styles.ts +0 -39
- package/src/components/organisms/index.ts +0 -6
- package/src/components/organisms/item-details/index.ts +0 -1
- package/src/components/organisms/item-details/item-details.tsx +0 -6
- package/src/components/organisms/listings/empty-listings.tsx +0 -80
- package/src/components/organisms/listings/index.ts +0 -3
- package/src/components/organisms/listings/listings.tsx +0 -96
- package/src/components/organisms/listings/stories/grid-listings.stories.tsx +0 -153
- package/src/components/organisms/listings/stories/list-listings.stories.tsx +0 -171
- package/src/components/organisms/listings/styles/classes.ts +0 -49
- package/src/components/organisms/listings/styles/index.ts +0 -2
- package/src/components/organisms/listings/styles/styles.ts +0 -6
- package/src/components/templates/index.ts +0 -1
- package/src/components/templates/landing-page/index.ts +0 -1
- package/src/components/templates/landing-page/landing-page.stories.tsx +0 -21
- package/src/components/templates/landing-page/landing-page.tsx +0 -57
- package/src/components/templates/landing-page/styles/classes.ts +0 -11
- package/src/components/templates/landing-page/styles/index.ts +0 -1
- package/src/constants/animations.ts +0 -14
- package/src/constants/card.tsx +0 -42
- package/src/constants/defaults.ts +0 -59
- package/src/constants/fake.ts +0 -5
- package/src/constants/footer.tsx +0 -157
- package/src/constants/index.ts +0 -6
- package/src/constants/uploader.ts +0 -33
- package/src/context/emperor-ui-context.ts +0 -6
- package/src/context/form-builder-context.tsx +0 -8
- package/src/context/index.ts +0 -4
- package/src/context/navigation-context.ts +0 -6
- package/src/context/uploader-context.ts +0 -6
- package/src/enums/index.ts +0 -2
- package/src/enums/placeholders.ts +0 -4
- package/src/enums/preserved-keys.ts +0 -3
- package/src/examples/index.ts +0 -1
- package/src/hooks/index.ts +0 -8
- package/src/hooks/use-emperor-ui.ts +0 -12
- package/src/hooks/use-filters.ts +0 -20
- package/src/hooks/use-form-builder-context.ts +0 -16
- package/src/hooks/use-navigation.ts +0 -12
- package/src/hooks/use-search-params-handler.tsx +0 -186
- package/src/hooks/use-uploader-context.ts +0 -14
- package/src/hooks/use-uploader.tsx +0 -164
- package/src/hooks/use-window-size.tsx +0 -53
- package/src/i18n/configs/i18n.ts +0 -7
- package/src/i18n/configs/index.ts +0 -1
- package/src/i18n/constants/index.ts +0 -1
- package/src/i18n/constants/locales.ts +0 -4
- package/src/i18n/index.ts +0 -5
- package/src/i18n/locales/ar.ts +0 -15
- package/src/i18n/locales/atoms/ar.ts +0 -18
- package/src/i18n/locales/atoms/en.ts +0 -18
- package/src/i18n/locales/atoms/index.ts +0 -2
- package/src/i18n/locales/common/ar.ts +0 -1
- package/src/i18n/locales/common/en.ts +0 -1
- package/src/i18n/locales/common/index.ts +0 -2
- package/src/i18n/locales/en.ts +0 -15
- package/src/i18n/locales/index.ts +0 -4
- package/src/i18n/locales/molecules/ar.ts +0 -1
- package/src/i18n/locales/molecules/en.ts +0 -1
- package/src/i18n/locales/molecules/index.ts +0 -2
- package/src/i18n/locales/organisms/ar.ts +0 -11
- package/src/i18n/locales/organisms/en.ts +0 -11
- package/src/i18n/locales/organisms/index.ts +0 -2
- package/src/i18n/locales/templates/ar.ts +0 -1
- package/src/i18n/locales/templates/en.ts +0 -1
- package/src/i18n/locales/templates/index.ts +0 -2
- package/src/i18n/locales/toasts/ar.ts +0 -1
- package/src/i18n/locales/toasts/en.ts +0 -1
- package/src/i18n/locales/toasts/index.ts +0 -2
- package/src/i18n/types/index.ts +0 -2
- package/src/i18n/types/locale.ts +0 -5
- package/src/i18n/types/toasts.ts +0 -3
- package/src/i18n/utils/get-locales.ts +0 -4
- package/src/i18n/utils/index.ts +0 -2
- package/src/i18n/utils/localize.ts +0 -15
- package/src/index.ts +0 -14
- package/src/mocks/constants.ts +0 -103
- package/src/mocks/deletion-confirmor.ts +0 -16
- package/src/mocks/header.tsx +0 -118
- package/src/mocks/index.ts +0 -6
- package/src/mocks/listings.tsx +0 -154
- package/src/mocks/locales/index.ts +0 -1
- package/src/mocks/locales/uploader.ts +0 -33
- package/src/mocks/types.ts +0 -64
- package/src/providers/config-provider.tsx +0 -72
- package/src/providers/emperor-ui-provider.tsx +0 -35
- package/src/providers/form-builder-provider-context.tsx +0 -18
- package/src/providers/index.ts +0 -6
- package/src/providers/navigation-provider.tsx +0 -42
- package/src/providers/theme-provider.tsx +0 -16
- package/src/providers/uploader-provider.tsx +0 -53
- package/src/styles/globals.css +0 -38
- package/src/styles/hero.ts +0 -3
- package/src/styles/index.css +0 -18
- package/src/types/components/atoms/brand.ts +0 -13
- package/src/types/components/atoms/color-picker/color-picker.ts +0 -21
- package/src/types/components/atoms/color-picker/index.ts +0 -1
- package/src/types/components/atoms/column.ts +0 -3
- package/src/types/components/atoms/container.ts +0 -3
- package/src/types/components/atoms/field/field.ts +0 -61
- package/src/types/components/atoms/field/index.ts +0 -1
- package/src/types/components/atoms/filter/filter.ts +0 -52
- package/src/types/components/atoms/filter/index.ts +0 -2
- package/src/types/components/atoms/filter/select-filter.ts +0 -8
- package/src/types/components/atoms/index.ts +0 -9
- package/src/types/components/atoms/portal.ts +0 -6
- package/src/types/components/atoms/row.ts +0 -3
- package/src/types/components/atoms/uploader.ts +0 -103
- package/src/types/components/index.ts +0 -4
- package/src/types/components/molecules/footer/footer.ts +0 -68
- package/src/types/components/molecules/footer/index.ts +0 -1
- package/src/types/components/molecules/header/header.ts +0 -51
- package/src/types/components/molecules/header/index.ts +0 -1
- package/src/types/components/molecules/index.ts +0 -9
- package/src/types/components/molecules/item-card/index.ts +0 -1
- package/src/types/components/molecules/item-card/item-card.ts +0 -69
- package/src/types/components/molecules/item-details/index.ts +0 -1
- package/src/types/components/molecules/item-details/item-details.ts +0 -9
- package/src/types/components/molecules/listings/index.ts +0 -1
- package/src/types/components/molecules/listings/listings.ts +0 -29
- package/src/types/components/molecules/nav-bar/index.ts +0 -1
- package/src/types/components/molecules/nav-bar/nav-bar.ts +0 -66
- package/src/types/components/molecules/scaffold/index.ts +0 -1
- package/src/types/components/molecules/scaffold/scaffold.ts +0 -9
- package/src/types/components/molecules/side-bar/index.ts +0 -1
- package/src/types/components/molecules/side-bar/side-bar.ts +0 -40
- package/src/types/components/molecules/theme-switch/index.ts +0 -1
- package/src/types/components/molecules/theme-switch/theme-switch.ts +0 -9
- package/src/types/components/organisms/deletion-confirmor/deletion-confirmor.ts +0 -22
- package/src/types/components/organisms/deletion-confirmor/index.ts +0 -1
- package/src/types/components/organisms/filters/filters.ts +0 -11
- package/src/types/components/organisms/filters/index.ts +0 -1
- package/src/types/components/organisms/form-builder/context.ts +0 -6
- package/src/types/components/organisms/form-builder/form-builder.ts +0 -39
- package/src/types/components/organisms/form-builder/index.ts +0 -2
- package/src/types/components/organisms/index.ts +0 -3
- package/src/types/components/templates/index.ts +0 -1
- package/src/types/components/templates/landing-page.ts +0 -10
- package/src/types/context/config.ts +0 -24
- package/src/types/context/index.ts +0 -4
- package/src/types/context/localization.ts +0 -24
- package/src/types/context/navigation.ts +0 -17
- package/src/types/context/theme.ts +0 -33
- package/src/types/index.ts +0 -3
- package/src/types/shared/components.ts +0 -13
- package/src/types/shared/index.ts +0 -1
- package/src/utils/cn.ts +0 -6
- package/src/utils/compress-images.ts +0 -36
- package/src/utils/index.ts +0 -5
- package/src/utils/locales.ts +0 -54
- package/src/utils/storybook.tsx +0 -15
- package/src/utils/uploader.ts +0 -170
- package/tsconfig.app.json +0 -37
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -25
- package/vite.config.ts +0 -47
- package/vitest.shims.d.ts +0 -1
package/dist/index-CWu5fG3N.js
DELETED
package/dist/index-DpemL3iQ.js
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { l as a, a as s, d as e } from "./index-ABKcY4tX.js";
|
|
3
|
-
import { A as n, b as c, D as l, c as d, e as m, F as u, f as b, H as p, g, J as x, K as V, L as f, h as T, M as y, i as D, j as A, k as S, m as v, N as P, n as E, o as M, P as h, p as C, q as B, S as O, r as I, s as G, V as L, t as N, u as R, v as F, w as k, x as j, y as w, z, B as q, C as K, E as H, G as W, I as U, O as Z, Q as J, R as Q, T as X, U as Y, W as _, X as $, Y as aa, Z as sa, _ as ea, $ as ia, a0 as ta, a1 as oa, a2 as ra, a3 as na, a4 as ca, a5 as la, a6 as da, a7 as ma, a8 as ua, a9 as ba, aa as pa, ab as ga, ac as xa, ad as Va, ae as fa, af as Ta, ag as ya, ah as Da, ai as Aa, aj as Sa, ak as va, al as Pa, am as Ea, an as Ma, ao as ha, ap as Ca, aq as Ba, ar as Oa, as as Ia, at as Ga, au as La, av as Na, aw as Ra, ax as Fa, ay as ka, az as ja, aA as wa, aB as za, aC as qa, aD as Ka, aE as Ha, aF as Wa, aG as Ua, aH as Za, aI as Ja, aJ as Qa, aK as Xa, aL as Ya, aM as _a, aN as $a, aO as as, aP as ss, aQ as es, aR as is, aS as ts, aT as os, aU as rs, aV as ns, aW as cs, aX as ls, aY as ds, aZ as ms, a_ as us, a$ as bs, b0 as ps, b1 as gs, b2 as xs, b3 as Vs, b4 as fs, b5 as Ts, b6 as ys, b7 as Ds, b8 as As, b9 as Ss, ba as vs, bb as Ps, bc as Es, bd as Ms, be as hs, bf as Cs, bg as Bs, bh as Os, bi as Is, bj as Gs, bk as Ls, bl as Ns, bm as Rs, bn as Fs, bo as ks, bp as js, bq as ws, br as zs, bs as qs, bt as Ks, bu as Hs, bv as Ws, bw as Us, bx as Zs, by as Js, bz as Qs, bA as Xs, bB as Ys, bC as _s, bD as $s, bE as ae, bF as se, bG as ee, bH as ie, bI as te, bJ as oe, bK as re, bL as ne, bM as ce, bN as le, bO as de, bP as me, bQ as ue, bR as be, bS as pe, bT as ge, bU as xe, bV as Ve, bW as fe, bX as Te, bY as ye, bZ as De, b_ as Ae, b$ as Se, c0 as ve, c1 as Pe, c2 as Ee, c3 as Me, c4 as he, c5 as Ce, c6 as Be, c7 as Oe, c8 as Ie, c9 as Ge, ca as Le, cb as Ne, cc as Re, cd as Fe, ce as ke, cf as je, cg as we, ch as ze, ci as qe, cj as Ke, ck as He, cl as We, cm as Ue, cn as Ze, co as Je, cp as Qe, cq as Xe, cr as Ye, cs as _e, ct as $e, cu as ai, cv as si, cw as ei, cx as ii, cy as ti, cz as oi, cA as ri, cB as ni, cC as ci, cD as li, cE as di, cF as mi, cG as ui, cH as bi, cI as pi, cJ as gi, cK as xi, cL as Vi, cM as fi, cN as Ti, cO as yi, cP as Di, cQ as Ai, cR as Si, cS as vi, cT as Pi, cU as Ei, cV as Mi, cW as hi, cX as Ci, cY as Bi, cZ as Oi, c_ as Ii, c$ as Gi, d0 as Li, d1 as Ni, d2 as Ri, d3 as Fi, d4 as ki, d5 as ji, d6 as wi, d7 as zi, d8 as qi, d9 as Ki, da as Hi, db as Wi, dc as Ui, dd as Zi, de as Ji, df as Qi, dg as Xi, dh as Yi, di as _i, dj as $i, dk as at, dl as st, dm as et, dn as it, dp as tt, dq as ot, dr as rt, ds as nt, dt as ct, du as lt, dv as dt, dw as mt, dx as ut, dy as bt, dz as pt, dA as gt } from "./index-ABKcY4tX.js";
|
|
4
|
-
const t = {
|
|
5
|
-
...e,
|
|
6
|
-
...s,
|
|
7
|
-
...a
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
n as AnimatePresence,
|
|
11
|
-
c as AsyncMotionValueAnimation,
|
|
12
|
-
l as DOMKeyframesResolver,
|
|
13
|
-
d as DOMVisualElement,
|
|
14
|
-
m as DocumentProjectionNode,
|
|
15
|
-
u as Feature,
|
|
16
|
-
b as FlatTree,
|
|
17
|
-
p as HTMLProjectionNode,
|
|
18
|
-
g as HTMLVisualElement,
|
|
19
|
-
x as JSAnimation,
|
|
20
|
-
V as KeyframeResolver,
|
|
21
|
-
f as LayoutGroupContext,
|
|
22
|
-
T as LazyMotion,
|
|
23
|
-
y as MotionConfig,
|
|
24
|
-
D as MotionConfigContext,
|
|
25
|
-
A as MotionContext,
|
|
26
|
-
S as MotionGlobalConfig,
|
|
27
|
-
v as MotionValue,
|
|
28
|
-
P as NativeAnimation,
|
|
29
|
-
E as NativeAnimationExtended,
|
|
30
|
-
M as NodeStack,
|
|
31
|
-
h as PopChild,
|
|
32
|
-
C as PresenceChild,
|
|
33
|
-
B as PresenceContext,
|
|
34
|
-
O as SVGVisualElement,
|
|
35
|
-
I as SubscriptionManager,
|
|
36
|
-
G as SwitchLayoutGroupContext,
|
|
37
|
-
L as VisualElement,
|
|
38
|
-
N as acceleratedValues,
|
|
39
|
-
R as addDomEvent,
|
|
40
|
-
F as addPointerEvent,
|
|
41
|
-
k as addPointerInfo,
|
|
42
|
-
j as addUniqueItem,
|
|
43
|
-
w as addValueToWillChange,
|
|
44
|
-
z as alpha,
|
|
45
|
-
q as analyseComplexValue,
|
|
46
|
-
K as animateMotionValue,
|
|
47
|
-
H as animateSingleValue,
|
|
48
|
-
W as animateTarget,
|
|
49
|
-
U as animateVariant,
|
|
50
|
-
Z as animateVisualElement,
|
|
51
|
-
J as animations,
|
|
52
|
-
Q as anticipate,
|
|
53
|
-
X as applyAxisDelta,
|
|
54
|
-
Y as applyBoxDelta,
|
|
55
|
-
_ as applyGeneratorOptions,
|
|
56
|
-
$ as applyPointDelta,
|
|
57
|
-
aa as applyTreeDeltas,
|
|
58
|
-
sa as aspectRatio,
|
|
59
|
-
ea as axisDeltaEquals,
|
|
60
|
-
ia as axisEquals,
|
|
61
|
-
ta as axisEqualsRounded,
|
|
62
|
-
oa as backIn,
|
|
63
|
-
ra as backInOut,
|
|
64
|
-
na as backOut,
|
|
65
|
-
ca as boxEquals,
|
|
66
|
-
la as boxEqualsRounded,
|
|
67
|
-
da as buildHTMLStyles,
|
|
68
|
-
ma as buildProjectionTransform,
|
|
69
|
-
ua as buildSVGAttrs,
|
|
70
|
-
ba as buildSVGPath,
|
|
71
|
-
pa as buildTransform,
|
|
72
|
-
ga as calcAxisDelta,
|
|
73
|
-
xa as calcBoxDelta,
|
|
74
|
-
Va as calcChildStagger,
|
|
75
|
-
fa as calcGeneratorDuration,
|
|
76
|
-
Ta as calcLength,
|
|
77
|
-
ya as calcRelativeAxis,
|
|
78
|
-
Da as calcRelativeAxisPosition,
|
|
79
|
-
Aa as calcRelativeBox,
|
|
80
|
-
Sa as calcRelativePosition,
|
|
81
|
-
va as camelCaseAttributes,
|
|
82
|
-
Pa as camelToDash,
|
|
83
|
-
Ea as cancelFrame,
|
|
84
|
-
Ma as checkVariantsDidChange,
|
|
85
|
-
ha as circIn,
|
|
86
|
-
Ca as circInOut,
|
|
87
|
-
Ba as circOut,
|
|
88
|
-
Oa as clamp,
|
|
89
|
-
Ia as cleanDirtyNodes,
|
|
90
|
-
Ga as color,
|
|
91
|
-
La as compareByDepth,
|
|
92
|
-
Na as complex,
|
|
93
|
-
Ra as containsCSSVariable,
|
|
94
|
-
Fa as convertBoundingBoxToBox,
|
|
95
|
-
ka as convertBoxToBoundingBox,
|
|
96
|
-
ja as convertOffsetToTimes,
|
|
97
|
-
wa as copyAxisDeltaInto,
|
|
98
|
-
za as copyAxisInto,
|
|
99
|
-
qa as copyBoxInto,
|
|
100
|
-
Ka as correctBorderRadius,
|
|
101
|
-
Ha as correctBoxShadow,
|
|
102
|
-
Wa as createAnimationState,
|
|
103
|
-
Ua as createAxis,
|
|
104
|
-
Za as createAxisDelta,
|
|
105
|
-
Ja as createBox,
|
|
106
|
-
Qa as createDelta,
|
|
107
|
-
Xa as createGeneratorEasing,
|
|
108
|
-
Ya as createProjectionNode,
|
|
109
|
-
_a as createRenderBatcher,
|
|
110
|
-
$a as cubicBezier,
|
|
111
|
-
as as cubicBezierAsString,
|
|
112
|
-
ss as defaultEasing,
|
|
113
|
-
es as defaultOffset,
|
|
114
|
-
is as defaultTransformValue,
|
|
115
|
-
ts as defaultValueTypes,
|
|
116
|
-
os as degrees,
|
|
117
|
-
rs as delay,
|
|
118
|
-
ns as dimensionValueTypes,
|
|
119
|
-
cs as distance,
|
|
120
|
-
ls as distance2D,
|
|
121
|
-
e as domAnimation,
|
|
122
|
-
t as domMax,
|
|
123
|
-
ds as eachAxis,
|
|
124
|
-
ms as easeIn,
|
|
125
|
-
us as easeInOut,
|
|
126
|
-
bs as easeOut,
|
|
127
|
-
ps as easingDefinitionToFunction,
|
|
128
|
-
gs as fillOffset,
|
|
129
|
-
xs as fillWildcards,
|
|
130
|
-
Vs as filterProps,
|
|
131
|
-
fs as findDimensionValueType,
|
|
132
|
-
Ts as findValueType,
|
|
133
|
-
ys as flushKeyframeResolvers,
|
|
134
|
-
Ds as frame,
|
|
135
|
-
As as frameData,
|
|
136
|
-
Ss as frameSteps,
|
|
137
|
-
vs as generateLinearEasing,
|
|
138
|
-
Ps as getAnimatableNone,
|
|
139
|
-
Es as getDefaultTransition,
|
|
140
|
-
Ms as getDefaultValueType,
|
|
141
|
-
hs as getFeatureDefinitions,
|
|
142
|
-
Cs as getFinalKeyframe,
|
|
143
|
-
Bs as getMixer,
|
|
144
|
-
Os as getOptimisedAppearId,
|
|
145
|
-
Is as getValueAsType,
|
|
146
|
-
Gs as getValueTransition,
|
|
147
|
-
Ls as getVariableValue,
|
|
148
|
-
Ns as getVariantContext,
|
|
149
|
-
Rs as globalProjectionState,
|
|
150
|
-
Fs as has2DTranslate,
|
|
151
|
-
ks as hasReducedMotionListener,
|
|
152
|
-
js as hasScale,
|
|
153
|
-
ws as hasTransform,
|
|
154
|
-
zs as hex,
|
|
155
|
-
qs as hover,
|
|
156
|
-
Ks as hsla,
|
|
157
|
-
Hs as hslaToRgba,
|
|
158
|
-
Ws as inertia,
|
|
159
|
-
Us as initPrefersReducedMotion,
|
|
160
|
-
Zs as interpolate,
|
|
161
|
-
Js as invariant,
|
|
162
|
-
Qs as invisibleValues,
|
|
163
|
-
Xs as isAnimationControls,
|
|
164
|
-
Ys as isBezierDefinition,
|
|
165
|
-
_s as isBrowser,
|
|
166
|
-
$s as isCSSVariableName,
|
|
167
|
-
ae as isCSSVariableToken,
|
|
168
|
-
se as isControllingVariants,
|
|
169
|
-
ee as isDeltaZero,
|
|
170
|
-
ie as isDragActive,
|
|
171
|
-
te as isDragging,
|
|
172
|
-
oe as isEasingArray,
|
|
173
|
-
re as isElementKeyboardAccessible,
|
|
174
|
-
ne as isElementTextInput,
|
|
175
|
-
ce as isForcedMotionValue,
|
|
176
|
-
le as isGenerator,
|
|
177
|
-
de as isHTMLElement,
|
|
178
|
-
me as isKeyframesTarget,
|
|
179
|
-
ue as isMotionValue,
|
|
180
|
-
be as isNear,
|
|
181
|
-
pe as isNodeOrChild,
|
|
182
|
-
ge as isNumericalString,
|
|
183
|
-
xe as isObject,
|
|
184
|
-
Ve as isPrimaryPointer,
|
|
185
|
-
fe as isSVGElement,
|
|
186
|
-
Te as isSVGSVGElement,
|
|
187
|
-
ye as isSVGTag,
|
|
188
|
-
De as isTransitionDefined,
|
|
189
|
-
Ae as isValidMotionProp,
|
|
190
|
-
Se as isVariantLabel,
|
|
191
|
-
ve as isVariantNode,
|
|
192
|
-
Pe as isWillChangeMotionValue,
|
|
193
|
-
Ee as isZeroValueString,
|
|
194
|
-
Me as keyframes,
|
|
195
|
-
he as m,
|
|
196
|
-
Ce as makeAnimationInstant,
|
|
197
|
-
Be as makeUseVisualState,
|
|
198
|
-
Oe as mapEasingToNativeEasing,
|
|
199
|
-
Ie as maxGeneratorDuration,
|
|
200
|
-
Ge as measurePageBox,
|
|
201
|
-
Le as measureViewportBox,
|
|
202
|
-
Ne as memo,
|
|
203
|
-
Re as microtask,
|
|
204
|
-
Fe as millisecondsToSeconds,
|
|
205
|
-
ke as mirrorEasing,
|
|
206
|
-
je as mix,
|
|
207
|
-
we as mixArray,
|
|
208
|
-
ze as mixColor,
|
|
209
|
-
qe as mixComplex,
|
|
210
|
-
Ke as mixImmediate,
|
|
211
|
-
He as mixLinearColor,
|
|
212
|
-
We as mixNumber,
|
|
213
|
-
Ue as mixObject,
|
|
214
|
-
Ze as mixValues,
|
|
215
|
-
Je as mixVisibility,
|
|
216
|
-
Qe as motion,
|
|
217
|
-
Xe as motionValue,
|
|
218
|
-
Ye as noop,
|
|
219
|
-
_e as number,
|
|
220
|
-
$e as numberValueTypes,
|
|
221
|
-
ai as optimizedAppearDataAttribute,
|
|
222
|
-
si as optimizedAppearDataId,
|
|
223
|
-
ei as parseCSSVariable,
|
|
224
|
-
ii as parseValueFromTransform,
|
|
225
|
-
ti as percent,
|
|
226
|
-
oi as pipe,
|
|
227
|
-
ri as pixelsToPercent,
|
|
228
|
-
ni as positionalKeys,
|
|
229
|
-
ci as prefersReducedMotion,
|
|
230
|
-
li as press,
|
|
231
|
-
di as progress,
|
|
232
|
-
mi as progressPercentage,
|
|
233
|
-
ui as propagateDirtyNodes,
|
|
234
|
-
bi as px,
|
|
235
|
-
pi as readTransformValue,
|
|
236
|
-
gi as removeAxisDelta,
|
|
237
|
-
xi as removeAxisTransforms,
|
|
238
|
-
Vi as removeBoxTransforms,
|
|
239
|
-
fi as removeItem,
|
|
240
|
-
Ti as removePointDelta,
|
|
241
|
-
yi as renderHTML,
|
|
242
|
-
Di as renderSVG,
|
|
243
|
-
Ai as resize,
|
|
244
|
-
Si as resolveElements,
|
|
245
|
-
vi as resolveMotionValue,
|
|
246
|
-
Pi as resolveTransition,
|
|
247
|
-
Ei as resolveVariant,
|
|
248
|
-
Mi as resolveVariantFromProps,
|
|
249
|
-
hi as reverseEasing,
|
|
250
|
-
Ci as rgbUnit,
|
|
251
|
-
Bi as rgba,
|
|
252
|
-
Oi as rootProjectionNode,
|
|
253
|
-
Ii as scale,
|
|
254
|
-
Gi as scaleCorrectors,
|
|
255
|
-
Li as scalePoint,
|
|
256
|
-
Ni as scrapeHTMLMotionValuesFromProps,
|
|
257
|
-
Ri as scrapeSVGMotionValuesFromProps,
|
|
258
|
-
Fi as secondsToMilliseconds,
|
|
259
|
-
ki as setDragLock,
|
|
260
|
-
ji as setFeatureDefinitions,
|
|
261
|
-
wi as setStyle,
|
|
262
|
-
zi as setTarget,
|
|
263
|
-
qi as spring,
|
|
264
|
-
Ki as startWaapiAnimation,
|
|
265
|
-
Hi as supportedWaapiEasing,
|
|
266
|
-
Wi as supportsBrowserAnimation,
|
|
267
|
-
Ui as supportsFlags,
|
|
268
|
-
Zi as supportsLinearEasing,
|
|
269
|
-
Ji as supportsScrollTimeline,
|
|
270
|
-
Qi as testValueType,
|
|
271
|
-
Xi as time,
|
|
272
|
-
Yi as transformAxis,
|
|
273
|
-
_i as transformBox,
|
|
274
|
-
$i as transformBoxPoints,
|
|
275
|
-
at as transformPropOrder,
|
|
276
|
-
st as transformProps,
|
|
277
|
-
et as transformValueTypes,
|
|
278
|
-
it as translateAxis,
|
|
279
|
-
tt as updateMotionValuesFromProps,
|
|
280
|
-
ot as useComposedRefs,
|
|
281
|
-
rt as useIsomorphicLayoutEffect,
|
|
282
|
-
nt as usePresence,
|
|
283
|
-
ct as variantPriorityOrder,
|
|
284
|
-
lt as variantProps,
|
|
285
|
-
dt as velocityPerSecond,
|
|
286
|
-
mt as vh,
|
|
287
|
-
ut as visualElementStore,
|
|
288
|
-
bt as vw,
|
|
289
|
-
pt as warnOnce,
|
|
290
|
-
gt as warning
|
|
291
|
-
};
|
package/eslint.config.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
|
|
2
|
-
import storybook from "eslint-plugin-storybook";
|
|
3
|
-
|
|
4
|
-
import js from "@eslint/js";
|
|
5
|
-
import globals from "globals";
|
|
6
|
-
import reactHooks from "eslint-plugin-react-hooks";
|
|
7
|
-
import reactRefresh from "eslint-plugin-react-refresh";
|
|
8
|
-
import tseslint from "typescript-eslint";
|
|
9
|
-
import { defineConfig, globalIgnores } from "eslint/config";
|
|
10
|
-
|
|
11
|
-
export default defineConfig([
|
|
12
|
-
globalIgnores(["dist"]),
|
|
13
|
-
js.configs.recommended,
|
|
14
|
-
...tseslint.configs.recommended,
|
|
15
|
-
reactHooks.configs.flat.recommended,
|
|
16
|
-
reactRefresh.configs.vite,
|
|
17
|
-
...storybook.configs["flat/recommended"],
|
|
18
|
-
{
|
|
19
|
-
files: ["**/*.{ts,tsx}"],
|
|
20
|
-
languageOptions: {
|
|
21
|
-
ecmaVersion: 2020,
|
|
22
|
-
globals: globals.browser,
|
|
23
|
-
},
|
|
24
|
-
rules: {
|
|
25
|
-
"react-refresh/only-export-components": [
|
|
26
|
-
"warn",
|
|
27
|
-
{ allowConstantExport: true },
|
|
28
|
-
],
|
|
29
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
30
|
-
"@typescript-eslint/ban-types": "off",
|
|
31
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
]);
|
package/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>emperor-ui</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/animations/blink.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Variants } from "framer-motion";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ? In order to work, the parent container must have the blinkContainer variants
|
|
5
|
-
* ? and each of the children must have the blinkItem variants
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export const blinkContainer: Variants = {
|
|
9
|
-
hidden: { opacity: 0 },
|
|
10
|
-
visible: {
|
|
11
|
-
opacity: 1,
|
|
12
|
-
transition: {
|
|
13
|
-
staggerChildren: 0.12,
|
|
14
|
-
delayChildren: 0.08,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const blinkItem: Variants = {
|
|
20
|
-
hidden: { opacity: 0, y: 16 },
|
|
21
|
-
visible: {
|
|
22
|
-
opacity: 1,
|
|
23
|
-
y: 0,
|
|
24
|
-
transition: { duration: 0.4, ease: "easeOut" },
|
|
25
|
-
},
|
|
26
|
-
};
|
package/src/animations/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { Brand } from "@/components";
|
|
3
|
-
import { getStorybookDecorators } from "@/utils";
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Brand> = {
|
|
6
|
-
title: "Atoms/Brand",
|
|
7
|
-
component: Brand,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: "centered",
|
|
10
|
-
},
|
|
11
|
-
tags: ["autodocs"],
|
|
12
|
-
decorators: getStorybookDecorators({
|
|
13
|
-
config: {
|
|
14
|
-
layout: {
|
|
15
|
-
withScaffold: false,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
}),
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default meta;
|
|
22
|
-
|
|
23
|
-
type Story = StoryObj<typeof meta>;
|
|
24
|
-
|
|
25
|
-
export const Default: Story = {
|
|
26
|
-
args: {},
|
|
27
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { BrandProps } from "@/types";
|
|
2
|
-
import { cn } from "@/utils";
|
|
3
|
-
import { VariantProps } from "class-variance-authority";
|
|
4
|
-
import { ComponentProps, forwardRef } from "react";
|
|
5
|
-
import { Row } from "@/components";
|
|
6
|
-
import { brandStyles } from "./styles";
|
|
7
|
-
import { Image } from "@heroui/image";
|
|
8
|
-
|
|
9
|
-
export const Brand = forwardRef<
|
|
10
|
-
HTMLElement,
|
|
11
|
-
ComponentProps<"div"> & VariantProps<typeof brandStyles> & BrandProps
|
|
12
|
-
>(
|
|
13
|
-
(
|
|
14
|
-
{
|
|
15
|
-
className,
|
|
16
|
-
variant,
|
|
17
|
-
src = "/images/emperor-ui-logo.png",
|
|
18
|
-
alt = "Emperor UI",
|
|
19
|
-
name = "Emperor UI",
|
|
20
|
-
isIconOnly = false,
|
|
21
|
-
classNames,
|
|
22
|
-
...props
|
|
23
|
-
},
|
|
24
|
-
ref,
|
|
25
|
-
) => {
|
|
26
|
-
return (
|
|
27
|
-
<Row
|
|
28
|
-
ref={ref}
|
|
29
|
-
data-slot="emperor-brand"
|
|
30
|
-
className={cn(
|
|
31
|
-
brandStyles({ variant, className: cn(className, classNames?.base) }),
|
|
32
|
-
)}
|
|
33
|
-
{...props}
|
|
34
|
-
>
|
|
35
|
-
{src && (
|
|
36
|
-
<Image
|
|
37
|
-
data-slot="emperor-brand-logo"
|
|
38
|
-
src={src}
|
|
39
|
-
alt={alt}
|
|
40
|
-
radius="md"
|
|
41
|
-
className={cn("min-w-7 min-h-7 size-7", classNames?.logo)}
|
|
42
|
-
/>
|
|
43
|
-
)}
|
|
44
|
-
|
|
45
|
-
{name && !isIconOnly && (
|
|
46
|
-
<p
|
|
47
|
-
data-slot="emperor-brand-name"
|
|
48
|
-
className={cn("font-semibold text-lg", classNames?.name)}
|
|
49
|
-
>
|
|
50
|
-
{name}
|
|
51
|
-
</p>
|
|
52
|
-
)}
|
|
53
|
-
</Row>
|
|
54
|
-
);
|
|
55
|
-
},
|
|
56
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./brand";
|
|
File without changes
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { ColorPickerProps } from "@/types";
|
|
4
|
-
import { FreeColorPicker, PresetColorPicker } from "@/components";
|
|
5
|
-
|
|
6
|
-
export function ColorPicker({ ...props }: ColorPickerProps) {
|
|
7
|
-
if (props?.inputType === "preset") {
|
|
8
|
-
return <PresetColorPicker {...props} />;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return <FreeColorPicker {...props} />;
|
|
12
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { Input } from "@heroui/input";
|
|
5
|
-
import { cn } from "@/utils";
|
|
6
|
-
import type { ColorPickerProps } from "@/types";
|
|
7
|
-
import { CopyButton } from "@/components";
|
|
8
|
-
import { useEmperorUI } from "@/hooks";
|
|
9
|
-
|
|
10
|
-
export function FreeColorPicker({
|
|
11
|
-
className,
|
|
12
|
-
classNames,
|
|
13
|
-
value = "#000000",
|
|
14
|
-
onChange,
|
|
15
|
-
defaultValue,
|
|
16
|
-
inputType = "free",
|
|
17
|
-
...props
|
|
18
|
-
}: ColorPickerProps) {
|
|
19
|
-
const { config } = useEmperorUI();
|
|
20
|
-
|
|
21
|
-
const locales = config?.interLocalization?.locales;
|
|
22
|
-
const lang = config?.interLocalization?.lang;
|
|
23
|
-
const locale = locales?.[lang ?? "en"];
|
|
24
|
-
const errorMessage = locale?.atoms?.colorPicker?.invalidColorFormat;
|
|
25
|
-
|
|
26
|
-
const isInvalid = useMemo(() => {
|
|
27
|
-
if (!value) return true;
|
|
28
|
-
const HEX_COLOR_REGEX = /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;
|
|
29
|
-
|
|
30
|
-
return !HEX_COLOR_REGEX.test(value);
|
|
31
|
-
}, [value]);
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Input
|
|
35
|
-
labelPlacement="outside"
|
|
36
|
-
variant="faded"
|
|
37
|
-
className={cn(className)}
|
|
38
|
-
classNames={{ label: "font-bold", input: "h-12", ...classNames }}
|
|
39
|
-
defaultValue={defaultValue}
|
|
40
|
-
value={value}
|
|
41
|
-
onValueChange={onChange}
|
|
42
|
-
isInvalid={isInvalid}
|
|
43
|
-
errorMessage={isInvalid ? errorMessage : undefined}
|
|
44
|
-
endContent={<CopyButton value={value} />}
|
|
45
|
-
startContent={
|
|
46
|
-
<input
|
|
47
|
-
type="color"
|
|
48
|
-
className="color-swatch"
|
|
49
|
-
value={value}
|
|
50
|
-
onChange={(e) => {
|
|
51
|
-
onChange?.(e.target.value as string);
|
|
52
|
-
}}
|
|
53
|
-
/>
|
|
54
|
-
}
|
|
55
|
-
{...props}
|
|
56
|
-
/>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { cn } from "@/utils";
|
|
4
|
-
import type { ColorPickerProps } from "@/types";
|
|
5
|
-
import { Select, SelectItem } from "@heroui/select";
|
|
6
|
-
import { CopyButton } from "@/components";
|
|
7
|
-
|
|
8
|
-
export function PresetColorPicker({
|
|
9
|
-
className,
|
|
10
|
-
classNames,
|
|
11
|
-
value = "#000000",
|
|
12
|
-
onChange,
|
|
13
|
-
defaultValue,
|
|
14
|
-
inputType,
|
|
15
|
-
presets = [],
|
|
16
|
-
...props
|
|
17
|
-
}: ColorPickerProps) {
|
|
18
|
-
if (inputType === "preset" && (!presets || presets?.length === 0))
|
|
19
|
-
throw new Error(
|
|
20
|
-
"Presets array is required in the ColorPicker when the input type is 'preset'.",
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Select
|
|
25
|
-
labelPlacement="outside"
|
|
26
|
-
variant="faded"
|
|
27
|
-
className={cn(className)}
|
|
28
|
-
classNames={{
|
|
29
|
-
label: "font-bold",
|
|
30
|
-
input: "h-12",
|
|
31
|
-
trigger: "min-w-52",
|
|
32
|
-
...classNames,
|
|
33
|
-
}}
|
|
34
|
-
selectedKeys={value ? [value] : undefined}
|
|
35
|
-
defaultSelectedKeys={defaultValue ? [defaultValue] : undefined}
|
|
36
|
-
onSelectionChange={(value) => onChange?.(value?.currentKey ?? "")}
|
|
37
|
-
endContent={<CopyButton value={value} />}
|
|
38
|
-
renderValue={() => {
|
|
39
|
-
return (
|
|
40
|
-
<div className="flex items-center gap-2 text-gray-600">
|
|
41
|
-
<div
|
|
42
|
-
style={{ backgroundColor: value }}
|
|
43
|
-
className="size-4 rounded-full border border-gray-300"
|
|
44
|
-
/>
|
|
45
|
-
{value}
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
}}
|
|
49
|
-
{...props}
|
|
50
|
-
>
|
|
51
|
-
{Array.from(new Set(presets))?.map((preset) => (
|
|
52
|
-
<SelectItem
|
|
53
|
-
key={preset}
|
|
54
|
-
startContent={
|
|
55
|
-
<div
|
|
56
|
-
style={{ backgroundColor: preset }}
|
|
57
|
-
className="size-4 rounded-full border border-gray-300"
|
|
58
|
-
/>
|
|
59
|
-
}
|
|
60
|
-
>
|
|
61
|
-
{preset}
|
|
62
|
-
</SelectItem>
|
|
63
|
-
))}
|
|
64
|
-
</Select>
|
|
65
|
-
);
|
|
66
|
-
}
|