@accelint/design-toolkit 2.4.3 → 2.6.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/dist/components/accordion/index.d.ts +1 -1
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/accordion/styles.d.ts +1 -5
- package/dist/components/accordion/styles.js +1 -1
- package/dist/components/accordion/styles.js.map +1 -1
- package/dist/components/accordion/types.d.ts +9 -10
- package/dist/components/avatar/index.d.ts +4 -2
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/avatar/styles.d.ts +16 -15
- package/dist/components/avatar/styles.js +1 -1
- package/dist/components/avatar/styles.js.map +1 -1
- package/dist/components/avatar/types.d.ts +7 -7
- package/dist/components/badge/index.d.ts +3 -2
- package/dist/components/badge/index.js +1 -1
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/badge/styles.js +1 -1
- package/dist/components/badge/styles.js.map +1 -1
- package/dist/components/badge/types.d.ts +3 -4
- package/dist/components/box/index.js +1 -1
- package/dist/components/box/index.js.map +1 -1
- package/dist/components/button/index.d.ts +6 -4
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button/styles.d.ts +25 -24
- package/dist/components/button/styles.js +1 -1
- package/dist/components/button/styles.js.map +1 -1
- package/dist/components/button/types.d.ts +3 -5
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox/styles.d.ts +19 -18
- package/dist/components/checkbox/styles.js +1 -1
- package/dist/components/checkbox/styles.js.map +1 -1
- package/dist/components/chip/index.d.ts +4 -2
- package/dist/components/chip/index.js +1 -1
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip/styles.d.ts +70 -69
- package/dist/components/chip/styles.js +1 -1
- package/dist/components/chip/styles.js.map +1 -1
- package/dist/components/chip/types.d.ts +5 -5
- package/dist/components/classification-badge/index.d.ts +3 -2
- package/dist/components/classification-badge/index.js +1 -1
- package/dist/components/classification-badge/index.js.map +1 -1
- package/dist/components/classification-badge/styles.js +1 -1
- package/dist/components/classification-badge/styles.js.map +1 -1
- package/dist/components/classification-badge/types.d.ts +3 -4
- package/dist/components/classification-banner/index.d.ts +3 -2
- package/dist/components/classification-banner/index.js +1 -1
- package/dist/components/classification-banner/index.js.map +1 -1
- package/dist/components/classification-banner/styles.js +1 -1
- package/dist/components/classification-banner/styles.js.map +1 -1
- package/dist/components/classification-banner/types.d.ts +3 -4
- package/dist/components/color-picker/index.d.ts +45 -15
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-picker/styles.d.ts +42 -0
- package/dist/components/color-picker/styles.js +2 -0
- package/dist/components/color-picker/styles.js.map +1 -0
- package/dist/components/color-picker/types.d.ts +13 -0
- package/dist/components/color-picker/types.js +2 -0
- package/dist/components/color-picker/types.js.map +1 -0
- package/dist/components/combobox-field/index.d.ts +18 -0
- package/dist/components/combobox-field/index.js +2 -0
- package/dist/components/combobox-field/index.js.map +1 -0
- package/dist/components/combobox-field/styles.d.ts +72 -0
- package/dist/components/combobox-field/styles.js +2 -0
- package/dist/components/combobox-field/styles.js.map +1 -0
- package/dist/components/combobox-field/types.d.ts +28 -0
- package/dist/components/combobox-field/types.js +2 -0
- package/dist/components/combobox-field/types.js.map +1 -0
- package/dist/components/date-field/index.d.ts +8 -24
- package/dist/components/date-field/index.js +1 -1
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-field/styles.d.ts +69 -0
- package/dist/components/date-field/styles.js +2 -0
- package/dist/components/date-field/styles.js.map +1 -0
- package/dist/components/date-field/types.d.ts +29 -0
- package/dist/components/date-field/types.js +2 -0
- package/dist/components/date-field/types.js.map +1 -0
- package/dist/components/details-list/index.d.ts +59 -0
- package/dist/components/details-list/index.js +2 -0
- package/dist/components/details-list/index.js.map +1 -0
- package/dist/components/details-list/styles.d.ts +65 -0
- package/dist/components/details-list/styles.js +2 -0
- package/dist/components/details-list/styles.js.map +1 -0
- package/dist/components/details-list/types.d.ts +16 -0
- package/dist/components/details-list/types.js +2 -0
- package/dist/components/details-list/types.js.map +1 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/drawer/context.d.ts +13 -0
- package/dist/components/drawer/context.js +2 -0
- package/dist/components/drawer/context.js.map +1 -0
- package/dist/components/drawer/index.d.ts +48 -0
- package/dist/components/drawer/index.js +2 -0
- package/dist/components/drawer/index.js.map +1 -0
- package/dist/components/drawer/state.d.ts +26 -0
- package/dist/components/drawer/state.js +2 -0
- package/dist/components/drawer/state.js.map +1 -0
- package/dist/components/drawer/styles.d.ts +118 -0
- package/dist/components/drawer/styles.js +2 -0
- package/dist/components/drawer/styles.js.map +1 -0
- package/dist/components/drawer/types.d.ts +279 -0
- package/dist/components/drawer/types.js +2 -0
- package/dist/components/drawer/types.js.map +1 -0
- package/dist/components/hero/index.d.ts +45 -0
- package/dist/components/hero/index.js +2 -0
- package/dist/components/hero/index.js.map +1 -0
- package/dist/components/hero/styles.d.ts +48 -0
- package/dist/components/hero/styles.js +2 -0
- package/dist/components/hero/styles.js.map +1 -0
- package/dist/components/hero/types.d.ts +13 -0
- package/dist/components/hero/types.js +2 -0
- package/dist/components/hero/types.js.map +1 -0
- package/dist/components/hotkey/index.d.ts +25 -0
- package/dist/components/hotkey/index.js +2 -0
- package/dist/components/hotkey/index.js.map +1 -0
- package/dist/components/hotkey/styles.d.ts +53 -0
- package/dist/components/hotkey/styles.js +2 -0
- package/dist/components/hotkey/styles.js.map +1 -0
- package/dist/components/hotkey/types.d.ts +8 -0
- package/dist/components/hotkey/types.js +2 -0
- package/dist/components/hotkey/types.js.map +1 -0
- package/dist/components/icon/index.d.ts +3 -2
- package/dist/components/icon/index.js +1 -1
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/icon/styles.js +1 -1
- package/dist/components/icon/styles.js.map +1 -1
- package/dist/components/icon/types.d.ts +4 -5
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/index.js +1 -1
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/input/styles.d.ts +2 -24
- package/dist/components/input/styles.js +1 -1
- package/dist/components/input/styles.js.map +1 -1
- package/dist/components/input/types.d.ts +1 -0
- package/dist/components/label/index.d.ts +3 -2
- package/dist/components/label/index.js +1 -1
- package/dist/components/label/index.js.map +1 -1
- package/dist/components/label/styles.js +1 -1
- package/dist/components/label/styles.js.map +1 -1
- package/dist/components/label/types.d.ts +2 -3
- package/dist/components/menu/index.d.ts +16 -21
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/styles.d.ts +9 -6
- package/dist/components/menu/styles.js +1 -1
- package/dist/components/menu/styles.js.map +1 -1
- package/dist/components/menu/types.d.ts +9 -2
- package/dist/components/options/index.d.ts +28 -22
- package/dist/components/options/index.js +1 -1
- package/dist/components/options/index.js.map +1 -1
- package/dist/components/options/styles.d.ts +72 -0
- package/dist/components/options/styles.js +2 -0
- package/dist/components/options/styles.js.map +1 -0
- package/dist/components/options/types.d.ts +29 -0
- package/dist/components/options/types.js +2 -0
- package/dist/components/options/types.js.map +1 -0
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/popover/styles.d.ts +16 -15
- package/dist/components/popover/styles.js +1 -1
- package/dist/components/popover/styles.js.map +1 -1
- package/dist/components/query-builder/action-element.js +1 -1
- package/dist/components/query-builder/action-element.js.map +1 -1
- package/dist/components/query-builder/constants.js +1 -1
- package/dist/components/query-builder/constants.js.map +1 -1
- package/dist/components/query-builder/group.js +1 -1
- package/dist/components/query-builder/group.js.map +1 -1
- package/dist/components/query-builder/index.d.ts +5 -20
- package/dist/components/query-builder/index.js +1 -1
- package/dist/components/query-builder/index.js.map +1 -1
- package/dist/components/query-builder/rule.js +1 -1
- package/dist/components/query-builder/rule.js.map +1 -1
- package/dist/components/query-builder/types.d.ts +22 -0
- package/dist/components/query-builder/types.js +2 -0
- package/dist/components/query-builder/types.js.map +1 -0
- package/dist/components/query-builder/utils.js +1 -1
- package/dist/components/query-builder/utils.js.map +1 -1
- package/dist/components/query-builder/value-editor.js +1 -1
- package/dist/components/query-builder/value-editor.js.map +1 -1
- package/dist/components/query-builder/value-selector.js +1 -1
- package/dist/components/query-builder/value-selector.js.map +1 -1
- package/dist/components/radio/index.js +1 -1
- package/dist/components/radio/index.js.map +1 -1
- package/dist/components/radio/styles.d.ts +19 -18
- package/dist/components/radio/styles.js +1 -1
- package/dist/components/radio/styles.js.map +1 -1
- package/dist/components/radio/types.d.ts +2 -3
- package/dist/components/search-field/index.d.ts +56 -15
- package/dist/components/search-field/index.js +1 -1
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/search-field/styles.d.ts +53 -0
- package/dist/components/search-field/styles.js +2 -0
- package/dist/components/search-field/styles.js.map +1 -0
- package/dist/components/search-field/types.d.ts +25 -0
- package/dist/components/search-field/types.js +2 -0
- package/dist/components/search-field/types.js.map +1 -0
- package/dist/components/select-field/index.d.ts +23 -0
- package/dist/components/select-field/index.js +2 -0
- package/dist/components/select-field/index.js.map +1 -0
- package/dist/components/select-field/styles.d.ts +60 -0
- package/dist/components/select-field/styles.js +2 -0
- package/dist/components/select-field/styles.js.map +1 -0
- package/dist/components/select-field/types.d.ts +26 -0
- package/dist/components/select-field/types.js +2 -0
- package/dist/components/select-field/types.js.map +1 -0
- package/dist/components/skeleton/index.d.ts +42 -0
- package/dist/components/skeleton/index.js +2 -0
- package/dist/components/skeleton/index.js.map +1 -0
- package/dist/components/skeleton/styles.d.ts +23 -0
- package/dist/components/skeleton/styles.js +2 -0
- package/dist/components/skeleton/styles.js.map +1 -0
- package/dist/components/skeleton/types.d.ts +8 -0
- package/dist/components/skeleton/types.js +2 -0
- package/dist/components/skeleton/types.js.map +1 -0
- package/dist/components/slider/index.js +1 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +3 -2
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/styles.d.ts +13 -12
- package/dist/components/switch/styles.js +1 -1
- package/dist/components/switch/styles.js.map +1 -1
- package/dist/components/switch/types.d.ts +2 -3
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-area-field/index.d.ts +4 -3
- package/dist/components/text-area-field/index.js +1 -1
- package/dist/components/text-area-field/index.js.map +1 -1
- package/dist/components/text-area-field/styles.d.ts +19 -18
- package/dist/components/text-area-field/styles.js +1 -1
- package/dist/components/text-area-field/styles.js.map +1 -1
- package/dist/components/text-area-field/types.d.ts +2 -3
- package/dist/components/text-field/index.d.ts +4 -2
- package/dist/components/text-field/index.js +1 -1
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/text-field/styles.d.ts +19 -18
- package/dist/components/text-field/styles.js +1 -1
- package/dist/components/text-field/styles.js.map +1 -1
- package/dist/components/text-field/types.d.ts +4 -4
- package/dist/components/tooltip/index.d.ts +14 -28
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tooltip/styles.d.ts +5 -0
- package/dist/components/tooltip/styles.js +2 -0
- package/dist/components/tooltip/styles.js.map +1 -0
- package/dist/components/tooltip/types.d.ts +8 -0
- package/dist/components/tooltip/types.js +2 -0
- package/dist/components/tooltip/types.js.map +1 -0
- package/dist/components/view-stack/index.d.ts +28 -0
- package/dist/components/view-stack/index.js +2 -0
- package/dist/components/view-stack/index.js.map +1 -0
- package/dist/components/view-stack/types.d.ts +58 -0
- package/dist/components/view-stack/types.js +2 -0
- package/dist/components/view-stack/types.js.map +1 -0
- package/dist/icons/catalog.js +1 -1
- package/dist/index.css +20 -0
- package/dist/index.d.ts +60 -27
- package/dist/index.js +1 -1
- package/dist/lib/react.d.ts +13 -12
- package/dist/lib/react.js +4 -4
- package/dist/lib/react.js.map +1 -1
- package/dist/lib/types.d.ts +6 -2
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/styles.css +1476 -321
- package/dist/tokens/index.js +1 -1
- package/dist/tokens/index.js.map +1 -1
- package/dist/variants/variants.css +6 -0
- package/package.json +84 -56
- package/dist/components/combobox/index.d.ts +0 -32
- package/dist/components/combobox/index.js +0 -2
- package/dist/components/combobox/index.js.map +0 -1
- package/dist/components/options-item/index.d.ts +0 -30
- package/dist/components/options-item/index.js +0 -2
- package/dist/components/options-item/index.js.map +0 -1
- package/dist/components/query-builder/example-configuration.d.ts +0 -30
- package/dist/components/query-builder/example-configuration.js +0 -2
- package/dist/components/query-builder/example-configuration.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/color-picker/index.tsx"],"names":["
|
1
|
+
{"version":3,"sources":["../../../src/components/color-picker/index.tsx"],"names":["ColorPickerStyles","k","rest","c","m","classNames","picker","color","jsx","ColorSwatchPickerItem","item","ColorSwatch","l","swatch","ColorPicker"],"mappings":"oNAuBQ,CAAA,MAAQ,CAAA,CAAA,CAAA,IAAM,CAAA,CAAA,CAAA,MAAWA,CAAAA,CAAkB,EA0C5CC,iBAAA,EAAA,CAAA,SAAuB,CAAA,CAAA,CAAA,UAAY,CAAA,CAAA,CAAA,KAAO,CAAA,CAAGC,CAAK,GACvD,CAAA,CAAA,CAAA,CAAA,OACGC,GACE,CAAAC,iBAAA,CAAGF,IACJ,CAAA,CAAA,SAA8BG,CAAAA,kBAAY,CAAA,CAAA,EAAA,MACxCC,CAAAA,CAAO,EAAE,CAAA,CAAA,CAAA,SACX,CAAA,CAEC,YAAM,CAAA,CAAA,CAAKC,GACVC,CAAAA,CAACC,EAAAN,GAEC,iCAA8BE,CAAAA,kBAAY,CAAA,CAAA,EAAA,IACxCK,CAAAA,CAAK,cACP,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,gBAECC,CAAAR,GACC,CAAAS,WAAA,CAAA,CAAA,SAA8BP,CAAAA,kBAAY,UACxCQ,CAAAA,CAAO,EAAE,CAAA,CAAA,CAAA,SACX,CAAA,CACF,CAAA,CAAA,CAVKN,CAAAA,CAAM,CAAA,CAAA,CAAA,CAAA,QAAS,CAAA,MAa1B,CAEJ,CACAO,CAAAA,CAAY,CAAA,CAAA,CAAA,CAAA,WAAc,CAAA,aAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport {\n ColorSwatch,\n ColorSwatchPicker,\n ColorSwatchPickerItem,\n composeRenderProps,\n} from 'react-aria-components';\nimport { ColorPickerStyles } from './styles';\nimport type { ColorPickerProps } from './types';\n\nconst { picker, item, swatch } = ColorPickerStyles();\n\n/**\n * A color picker component that renders a grid of color swatches for selection.\n *\n * This component provides a simple interface for users to select from a predefined\n * set of colors. It renders each color as an interactive swatch that can be clicked\n * to select that color. The component supports keyboard navigation, accessibility\n * features, and fine-grained styling control through the classNames prop.\n *\n * @param items - Array of color values to display as selectable swatches\n * @param classNames - Object containing CSS class names for fine-grained styling control\n * @param classNames.picker - CSS class name for the main picker container\n * @param classNames.item - CSS class name for individual swatch items\n * @param classNames.swatch - CSS class name for the color swatch elements\n *\n * @example\n * ```tsx\n * const colors = [\n * '#ff0000',\n * '#00ff00',\n * '#0000ff',\n * ];\n *\n * <ColorPicker\n * options={colors}\n * value={'#ff0000'}\n * onChange={(color) => console.log('Selected:', color)}\n * classNames={{\n * picker: 'gap-4',\n * item: 'rounded-lg',\n * swatch: 'w-8 h-8'\n * }}\n * />\n * ```\n *\n * @remarks\n * - Colors can be provided as Color objects or color strings\n * - The component automatically handles color parsing and validation\n * - Supports all accessibility features from react-aria-components\n * - Uses a grid layout by default but can be customized via the layout prop\n */\nexport function ColorPicker({ classNames, items, ...rest }: ColorPickerProps) {\n return (\n <ColorSwatchPicker\n {...rest}\n className={composeRenderProps(classNames?.picker, (className) =>\n picker({ className }),\n )}\n >\n {items.map((color) => (\n <ColorSwatchPickerItem\n key={color.toString('hexa')}\n className={composeRenderProps(classNames?.item, (className) =>\n item({ className }),\n )}\n color={color}\n >\n <ColorSwatch\n className={composeRenderProps(classNames?.swatch, (className) =>\n swatch({ className }),\n )}\n />\n </ColorSwatchPickerItem>\n ))}\n </ColorSwatchPicker>\n );\n}\nColorPicker.displayName = 'ColorPicker';\n"]}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
2
|
+
import * as tailwind_merge from 'tailwind-merge';
|
3
|
+
|
4
|
+
declare const ColorPickerStyles: tailwind_variants.TVReturnType<{
|
5
|
+
[key: string]: {
|
6
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
7
|
+
picker?: tailwind_merge.ClassNameValue;
|
8
|
+
swatch?: tailwind_merge.ClassNameValue;
|
9
|
+
item?: tailwind_merge.ClassNameValue;
|
10
|
+
};
|
11
|
+
};
|
12
|
+
} | {
|
13
|
+
[x: string]: {
|
14
|
+
[x: string]: tailwind_merge.ClassNameValue | {
|
15
|
+
picker?: tailwind_merge.ClassNameValue;
|
16
|
+
swatch?: tailwind_merge.ClassNameValue;
|
17
|
+
item?: tailwind_merge.ClassNameValue;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
} | {}, {
|
21
|
+
picker: string;
|
22
|
+
item: string[];
|
23
|
+
swatch: string;
|
24
|
+
}, undefined, {
|
25
|
+
[key: string]: {
|
26
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
27
|
+
picker?: tailwind_merge.ClassNameValue;
|
28
|
+
swatch?: tailwind_merge.ClassNameValue;
|
29
|
+
item?: tailwind_merge.ClassNameValue;
|
30
|
+
};
|
31
|
+
};
|
32
|
+
} | {}, {
|
33
|
+
picker: string;
|
34
|
+
item: string[];
|
35
|
+
swatch: string;
|
36
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
37
|
+
picker: string;
|
38
|
+
item: string[];
|
39
|
+
swatch: string;
|
40
|
+
}, undefined, unknown, unknown, undefined>>;
|
41
|
+
|
42
|
+
export { ColorPickerStyles };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {tv}from'./../../lib/utils.js';const i=tv({slots:{picker:"flex flex-wrap gap-s",item:["w-fit cursor-pointer outline outline-transparent","focus:outline-interactive-hover","hover:outline-interactive-hover","selected:outline-highlight"],swatch:"size-l"}});export{i as ColorPickerStyles};//# sourceMappingURL=styles.js.map
|
2
|
+
//# sourceMappingURL=styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/color-picker/styles.ts"],"names":["e"],"mappings":"6CAeS,CACLA,EAAA,CAAA,CAAA,6FAGE,CAAA,iCACA,CAAA,8DAGM,CAAA,CAAA,MAEZ,CAAC,QAAA,CAAA,CAAA","file":"styles.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { tv } from '@/lib/utils';\n\nexport const ColorPickerStyles = tv({\n slots: {\n picker: 'flex flex-wrap gap-s',\n item: [\n 'w-fit cursor-pointer outline outline-transparent',\n 'focus:outline-interactive-hover',\n 'hover:outline-interactive-hover',\n 'selected:outline-highlight',\n ],\n swatch: 'size-l',\n },\n});\n"]}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { RefAttributes } from 'react';
|
2
|
+
import { ColorSwatchPickerProps, ColorSwatchPickerItemProps, ColorSwatchProps } from 'react-aria-components';
|
3
|
+
|
4
|
+
type ColorPickerProps = Omit<ColorSwatchPickerProps, 'children' | 'layout'> & RefAttributes<HTMLDivElement> & {
|
5
|
+
classNames?: {
|
6
|
+
picker?: ColorSwatchPickerProps['className'];
|
7
|
+
item?: ColorSwatchPickerItemProps['className'];
|
8
|
+
swatch?: ColorSwatchProps['className'];
|
9
|
+
};
|
10
|
+
items: ColorSwatchPickerItemProps['color'][];
|
11
|
+
};
|
12
|
+
|
13
|
+
export type { ColorPickerProps };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
+
import * as react from 'react';
|
3
|
+
import { ContextValue } from 'react-aria-components';
|
4
|
+
import { OptionsDataItem } from '../options/types.js';
|
5
|
+
import { ComboBoxFieldProps } from './types.js';
|
6
|
+
import '../icon/types.js';
|
7
|
+
import '../button/types.js';
|
8
|
+
import 'tailwind-variants';
|
9
|
+
import '../button/styles.js';
|
10
|
+
import 'tailwind-merge';
|
11
|
+
|
12
|
+
declare const ComboBoxFieldContext: react.Context<ContextValue<ComboBoxFieldProps<any>, HTMLDivElement>>;
|
13
|
+
declare function ComboBoxField<T extends OptionsDataItem>({ ref, ...props }: ComboBoxFieldProps<T>): react_jsx_runtime.JSX.Element;
|
14
|
+
declare namespace ComboBoxField {
|
15
|
+
var displayName: string;
|
16
|
+
}
|
17
|
+
|
18
|
+
export { ComboBoxField, ComboBoxFieldContext };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import'client-only';import {ChevronDown}from'@accelint/icons';import {createContext}from'react';import {useContextProps,ComboBox,composeRenderProps,Input,Button,Text,FieldError,Popover,Virtualizer,ListLayout}from'react-aria-components';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {Options}from'../options/index.js';import {ComboBoxStyles}from'./styles.js';const {field:q,label:w,control:H,input:A,trigger:G,description:J,error:K,popover:Q}=ComboBoxStyles(),c=createContext(null);function W({ref:t,...i}){[i,t]=useContextProps(i,t??null,c);const{children:x,classNames:e,description:a,errorMessage:b,inputProps:P,label:n,layoutOptions:v,menuTrigger:C="focus",size:m="medium",isInvalid:f,...y}=i,p=b||null,d=m==="small";return jsx(ComboBox,{...y,ref:t,className:composeRenderProps(e?.field,l=>q({className:l})),menuTrigger:C,isInvalid:f||(p?true:void 0),"data-size":m,children:({isDisabled:l,isInvalid:B,isRequired:N})=>jsxs(Fragment,{children:[!!n&&!d&&jsx(Label,{className:w({className:e?.label}),isDisabled:l,isRequired:N,children:n}),jsxs("div",{className:H({className:e?.control}),children:[jsx(Input,{...P,className:composeRenderProps(e?.input,r=>A({className:r}))}),jsx(Button,{className:composeRenderProps(e?.trigger,r=>G({className:r})),children:jsx(Icon,{size:"small",children:jsx(ChevronDown,{})})})]}),!!a&&!(d||B)&&jsx(Text,{className:J({className:e?.description}),slot:"description",children:a}),jsx(FieldError,{className:composeRenderProps(e?.error,r=>K({className:r})),children:p}),jsx(Popover,{className:composeRenderProps(e?.popover,r=>Q({className:r})),children:jsx(Virtualizer,{layout:ListLayout,layoutOptions:v,children:jsx(Options,{children:x})})})]})})}W.displayName="ComboBox";export{W as ComboBoxField,c as ComboBoxFieldContext};//# sourceMappingURL=index.js.map
|
2
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/combobox-field/index.tsx"],"names":["input","trigger","description","error","ComboBoxStyles","ComboBoxFieldProvider","k","children","props","ComboBoxFieldContext","labelProp","isInvalidProp","errorMessageProp","size","jsx","ComboBox","rest","ref","composeRenderProps","o","I","className","s","menuTrigger","errorMessage","isInvalid","Fragment","u","X","label","classNames","R","isDisabled","isRequired","control","D","Button","T","Icon","h","descriptionProp","g","M","FieldError","O","popover","z","L","S"],"mappings":"2bAqC+BA,MAAAA,CAAO,KAAA,CAAA,CAAA,CAAAC,KAAS,CAAA,CAAA,CAAA,OAAAC,CAAa,OAAAC,CAAO,CAAA,CAAA,OAAQ,CAAA,CACzEC,CAAAA,WAIyE,CAAA,CAE3E,CAAA,KAAA,CAAA,CAAA,CAASC,OACP,CAAA,CAAA,CAAA,CAAAC,cAAAC,EACA,CAAA,CAAA,CAAGC,aACL,CAAA,eAaqDC,CAAoB,CAAA,CAEvE,GAAA,CAAA,CAAM,CACJ,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAF,CAAAA,CACA,2BACA,CAAA,CAAA,CAAA,CAAA,KAAA,CAAA,QACA,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,cACOG,YACP,CAAA,CAAA,CAAA,UACA,CAAA,CAAA,CAAA,qBACO,CAAA,CAAA,CAAA,WACP,CAAA,CAAA,CAAWC,QAETH,IACiBI,GAAoB,QACzBC,CAAAA,SAAS,CAEzB,OACEC,CAAAA,CAACC,CAAAA,CAAA,CACE,CAAA,EAAGC,MACCC,CAAAA,CACL,GAAA,OAAWC,QAA+BC,GAAA,CAAAC,QAAQC,KAC1C,CAAE,gBAEV,CAAAC,kBAAA,CAAA,CAAA,EAAA,KAAaC,CAAAA,CACb,EAAA,CAAA,CAAA,CAAA,SAA6BC,CAAAA,CAAe,CAAA,CAAA,CAAO,YACnD,CAAA,CAAA,CAAA,oBAGI,CAAA,MAAA,CAAA,CAAA,WAAY,CAAA,CAAA,CAAAC,QAAW,CAAA,CAAA,CAAA,UAEzBC,CAAA,CACG,CAAA,SAAA,CAAC,CAAChB,CAAAA,UACA,CACC,CAAA,CAAA,GAAAiB,IAAA,CAAAC,QAAA,CAAA,CA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AA,SACZ,CAEAxB,kBAAA,CAAA,CAAA,EAAA,QAAC,CAAY,EAAA,CAAA,CAAA,CAAA,SAAoB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,0BAC/BR,MAAU,CAAAiC,UAAA,CAAA,aAEd,CACF,EAEJ,QAGU,CAAA5B,GAAA,CAAA6B,OAAA,CAAA,CAAA,QAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,WAAA,CAAA,UAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport type { ProviderProps } from '@/lib/types';\nimport { ChevronDown } from '@accelint/icons';\nimport { createContext } from 'react';\nimport {\n Button,\n ComboBox,\n type ContextValue,\n FieldError,\n Input,\n ListLayout,\n Popover,\n Text,\n Virtualizer,\n composeRenderProps,\n useContextProps,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\nimport { Options } from '../options';\nimport type { OptionsDataItem } from '../options/types';\nimport { ComboBoxStyles } from './styles';\nimport type { ComboBoxFieldProps } from './types';\n\nconst { field, label, control, input, trigger, description, error, popover } =\n ComboBoxStyles();\n\nexport const ComboBoxFieldContext =\n // biome-ignore lint/suspicious/noExplicitAny: Setting a type would restrict it beyond what the component allows to extend to\n createContext<ContextValue<ComboBoxFieldProps<any>, HTMLDivElement>>(null);\n\nfunction ComboBoxFieldProvider<T extends OptionsDataItem>({\n children,\n ...props\n}: ProviderProps<ComboBoxFieldProps<T>>) {\n return (\n <ComboBoxFieldContext.Provider value={props}>\n {children}\n </ComboBoxFieldContext.Provider>\n );\n}\nComboBoxFieldProvider.displayName = 'ComboBoxField.Provider';\n\nexport function ComboBoxField<T extends OptionsDataItem>({\n ref,\n ...props\n}: ComboBoxFieldProps<T>) {\n [props, ref] = useContextProps(props, ref ?? null, ComboBoxFieldContext);\n\n const {\n children,\n classNames,\n description: descriptionProp,\n errorMessage: errorMessageProp,\n inputProps,\n label: labelProp,\n layoutOptions,\n menuTrigger = 'focus',\n size = 'medium',\n isInvalid: isInvalidProp,\n ...rest\n } = props;\n const errorMessage = errorMessageProp || null; // Protect against empty string\n const isSmall = size === 'small';\n\n return (\n <ComboBox<T>\n {...rest}\n ref={ref}\n className={composeRenderProps(classNames?.field, (className) =>\n field({ className }),\n )}\n menuTrigger={menuTrigger}\n isInvalid={isInvalidProp || (errorMessage ? true : undefined)} // Leave uncontrolled if possible to fallback to validation state\n data-size={size}\n >\n {(\n { isDisabled, isInvalid, isRequired }, // Rely on internal state, not props, since state could differ from props\n ) => (\n <>\n {!!labelProp && !isSmall && (\n <Label\n className={label({ className: classNames?.label })}\n isDisabled={isDisabled}\n isRequired={isRequired}\n >\n {labelProp}\n </Label>\n )}\n <div className={control({ className: classNames?.control })}>\n <Input\n {...inputProps}\n className={composeRenderProps(classNames?.input, (className) =>\n input({ className }),\n )}\n />\n <Button\n className={composeRenderProps(classNames?.trigger, (className) =>\n trigger({ className }),\n )}\n >\n <Icon size='small'>\n <ChevronDown />\n </Icon>\n </Button>\n </div>\n {!!descriptionProp && !(isSmall || isInvalid) && (\n <Text\n className={description({\n className: classNames?.description,\n })}\n slot='description'\n >\n {descriptionProp}\n </Text>\n )}\n <FieldError\n className={composeRenderProps(classNames?.error, (className) =>\n error({ className }),\n )}\n >\n {errorMessage}\n </FieldError>\n <Popover\n className={composeRenderProps(classNames?.popover, (className) =>\n popover({ className }),\n )}\n >\n <Virtualizer layout={ListLayout} layoutOptions={layoutOptions}>\n <Options>{children}</Options>\n </Virtualizer>\n </Popover>\n </>\n )}\n </ComboBox>\n );\n}\nComboBoxField.displayName = 'ComboBox';\n"]}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
2
|
+
import * as tailwind_merge from 'tailwind-merge';
|
3
|
+
|
4
|
+
declare const ComboBoxStyles: tailwind_variants.TVReturnType<{
|
5
|
+
[key: string]: {
|
6
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
7
|
+
input?: tailwind_merge.ClassNameValue;
|
8
|
+
label?: tailwind_merge.ClassNameValue;
|
9
|
+
popover?: tailwind_merge.ClassNameValue;
|
10
|
+
trigger?: tailwind_merge.ClassNameValue;
|
11
|
+
error?: tailwind_merge.ClassNameValue;
|
12
|
+
control?: tailwind_merge.ClassNameValue;
|
13
|
+
description?: tailwind_merge.ClassNameValue;
|
14
|
+
field?: tailwind_merge.ClassNameValue;
|
15
|
+
};
|
16
|
+
};
|
17
|
+
} | {
|
18
|
+
[x: string]: {
|
19
|
+
[x: string]: tailwind_merge.ClassNameValue | {
|
20
|
+
input?: tailwind_merge.ClassNameValue;
|
21
|
+
label?: tailwind_merge.ClassNameValue;
|
22
|
+
popover?: tailwind_merge.ClassNameValue;
|
23
|
+
trigger?: tailwind_merge.ClassNameValue;
|
24
|
+
error?: tailwind_merge.ClassNameValue;
|
25
|
+
control?: tailwind_merge.ClassNameValue;
|
26
|
+
description?: tailwind_merge.ClassNameValue;
|
27
|
+
field?: tailwind_merge.ClassNameValue;
|
28
|
+
};
|
29
|
+
};
|
30
|
+
} | {}, {
|
31
|
+
field: string;
|
32
|
+
label: string;
|
33
|
+
control: string[];
|
34
|
+
input: string[];
|
35
|
+
trigger: string[];
|
36
|
+
description: string[];
|
37
|
+
error: string;
|
38
|
+
popover: string;
|
39
|
+
}, undefined, {
|
40
|
+
[key: string]: {
|
41
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
42
|
+
input?: tailwind_merge.ClassNameValue;
|
43
|
+
label?: tailwind_merge.ClassNameValue;
|
44
|
+
popover?: tailwind_merge.ClassNameValue;
|
45
|
+
trigger?: tailwind_merge.ClassNameValue;
|
46
|
+
error?: tailwind_merge.ClassNameValue;
|
47
|
+
control?: tailwind_merge.ClassNameValue;
|
48
|
+
description?: tailwind_merge.ClassNameValue;
|
49
|
+
field?: tailwind_merge.ClassNameValue;
|
50
|
+
};
|
51
|
+
};
|
52
|
+
} | {}, {
|
53
|
+
field: string;
|
54
|
+
label: string;
|
55
|
+
control: string[];
|
56
|
+
input: string[];
|
57
|
+
trigger: string[];
|
58
|
+
description: string[];
|
59
|
+
error: string;
|
60
|
+
popover: string;
|
61
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
62
|
+
field: string;
|
63
|
+
label: string;
|
64
|
+
control: string[];
|
65
|
+
input: string[];
|
66
|
+
trigger: string[];
|
67
|
+
description: string[];
|
68
|
+
error: string;
|
69
|
+
popover: string;
|
70
|
+
}, undefined, unknown, unknown, undefined>>;
|
71
|
+
|
72
|
+
export { ComboBoxStyles };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {tv}from'tailwind-variants';const i=tv({slots:{field:"group/combobox-field flex flex-col gap-xs",label:"",control:["flex items-center rounded-medium px-s py-xs outline","group-enabled/combobox-field:fg-default-light group-enabled:combobox-field:outline-interactive","group-enabled/combobox-field:placeholder:fg-default-dark","group-enabled/combobox-field:focus-within:outline-highlight","group-enabled/combobox-field:hover:outline-interactive-hover","group-enabled/combobox-field:group-invalid/combobox-field:outline-serious","group-disabled/combobox-field:fg-disabled group-disabled/combobox-field:outline-interactive-disabled"],input:["font-display outline-none","group-size-medium/combobox-field:text-body-s","group-size-small/combobox-field:text-body-xs"],trigger:["fg-default-light","group-open/combobox-field:rotate-180 group-open/combobox-field:transform","group-disabled/combobox-field:fg-disabled"],description:["fg-default-dark text-body-xs","group-disabled/combobox-field:fg-disabled"],error:"fg-serious text-body-xs",popover:"-ml-s min-w-[calc(var(--trigger-width)+(var(--spacing-s)*2))]"}});export{i as ComboBoxStyles};//# sourceMappingURL=styles.js.map
|
2
|
+
//# sourceMappingURL=styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/combobox-field/styles.ts"],"names":["ComboBoxStyles","tv"],"mappings":"mCAcO,MAAMA,EAAiBC,EAAAA,CAAG,CAC/B,MAAO,CACL,KAAA,CAAO,4CACP,KAAA,CAAO,EAAA,CACP,QAAS,CACP,qDAAA,CACA,iGACA,0DAAA,CACA,6DAAA,CACA,+DACA,2EAAA,CACA,sGACF,EACA,KAAA,CAAO,CACL,4BACA,8CAAA,CACA,8CACF,EACA,OAAA,CAAS,CACP,mBACA,0EAAA,CACA,2CACF,EACA,WAAA,CAAa,CACX,+BACA,2CACF,CAAA,CACA,MAAO,yBAAA,CACP,OAAA,CAAS,+DACX,CACF,CAAC","file":"styles.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { tv } from 'tailwind-variants';\n\nexport const ComboBoxStyles = tv({\n slots: {\n field: 'group/combobox-field flex flex-col gap-xs',\n label: '',\n control: [\n 'flex items-center rounded-medium px-s py-xs outline',\n 'group-enabled/combobox-field:fg-default-light group-enabled:combobox-field:outline-interactive',\n 'group-enabled/combobox-field:placeholder:fg-default-dark',\n 'group-enabled/combobox-field:focus-within:outline-highlight',\n 'group-enabled/combobox-field:hover:outline-interactive-hover',\n 'group-enabled/combobox-field:group-invalid/combobox-field:outline-serious',\n 'group-disabled/combobox-field:fg-disabled group-disabled/combobox-field:outline-interactive-disabled',\n ],\n input: [\n 'font-display outline-none',\n 'group-size-medium/combobox-field:text-body-s',\n 'group-size-small/combobox-field:text-body-xs',\n ],\n trigger: [\n 'fg-default-light',\n 'group-open/combobox-field:rotate-180 group-open/combobox-field:transform',\n 'group-disabled/combobox-field:fg-disabled',\n ],\n description: [\n 'fg-default-dark text-body-xs',\n 'group-disabled/combobox-field:fg-disabled',\n ],\n error: 'fg-serious text-body-xs',\n popover: '-ml-s min-w-[calc(var(--trigger-width)+(var(--spacing-s)*2))]',\n },\n});\n"]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { RefAttributes } from 'react';
|
2
|
+
import { ComboBoxProps, VirtualizerProps, ListLayoutOptions, LabelProps, InputProps, FieldErrorProps, PopoverProps } from 'react-aria-components';
|
3
|
+
import { ButtonProps } from '../button/types.js';
|
4
|
+
import { OptionsDataItem, OptionsProps } from '../options/types.js';
|
5
|
+
import 'tailwind-variants';
|
6
|
+
import '../button/styles.js';
|
7
|
+
import 'tailwind-merge';
|
8
|
+
import '../icon/types.js';
|
9
|
+
|
10
|
+
type ComboBoxFieldProps<T extends OptionsDataItem> = Omit<ComboBoxProps<T>, 'children' | 'className'> & Pick<VirtualizerProps<ListLayoutOptions>, 'layoutOptions'> & Pick<OptionsProps<T>, 'children'> & RefAttributes<HTMLDivElement> & {
|
11
|
+
classNames?: {
|
12
|
+
field?: ComboBoxProps<T>['className'];
|
13
|
+
label?: LabelProps['className'];
|
14
|
+
control?: string;
|
15
|
+
input?: InputProps['className'];
|
16
|
+
trigger?: ButtonProps['className'];
|
17
|
+
description?: string;
|
18
|
+
error?: FieldErrorProps['className'];
|
19
|
+
popover?: PopoverProps['className'];
|
20
|
+
};
|
21
|
+
label?: string;
|
22
|
+
inputProps?: Omit<InputProps, 'className'>;
|
23
|
+
description?: string;
|
24
|
+
errorMessage?: string;
|
25
|
+
size?: 'small' | 'medium';
|
26
|
+
};
|
27
|
+
|
28
|
+
export type { ComboBoxFieldProps };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
@@ -1,28 +1,12 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import * as cva_types from 'cva/types';
|
3
2
|
import { DateValue } from '@internationalized/date';
|
4
|
-
import {
|
5
|
-
import
|
3
|
+
import { DateFieldProps } from './types.js';
|
4
|
+
import 'react';
|
5
|
+
import 'react-aria-components';
|
6
|
+
import 'tailwind-variants';
|
7
|
+
import './styles.js';
|
8
|
+
import 'tailwind-merge';
|
6
9
|
|
7
|
-
declare
|
8
|
-
isDisabled?: boolean | null | undefined;
|
9
|
-
isInvalid?: boolean | null | undefined;
|
10
|
-
isReadOnly?: boolean | null | undefined;
|
11
|
-
size?: "small" | "medium" | null | undefined;
|
12
|
-
} & cva_types.ClassProp) | undefined) => string;
|
13
|
-
interface DateFieldProps<T extends DateValue> extends Omit<VariantProps<typeof dateFieldStyles>, 'isDisabled' | 'isInvalid' | 'isReadOnly'>, Omit<DateFieldProps$1<T>, 'className' | 'style'>, // Exclude className to avoid conflict with cva
|
14
|
-
Omit<DateInputProps, 'className' | 'children' | 'style'> {
|
15
|
-
isDisabled?: boolean;
|
16
|
-
isInvalid?: boolean;
|
17
|
-
isReadOnly?: boolean;
|
18
|
-
size?: 'small' | 'medium';
|
19
|
-
className?: string;
|
20
|
-
description?: string;
|
21
|
-
errorMessage?: string;
|
22
|
-
label?: string;
|
23
|
-
placeholder?: string;
|
24
|
-
shortMonth?: boolean;
|
25
|
-
}
|
26
|
-
declare function DateField<T extends DateValue>({ className, description, errorMessage, isDisabled, isInvalid, isReadOnly, label, placeholder, slot, size, shortMonth, ...props }: DateFieldProps<T>): react_jsx_runtime.JSX.Element;
|
10
|
+
declare function DateField<T extends DateValue>({ classNames, description: descriptionProp, errorMessage: errorMessageProp, isDisabled, isInvalid: isInvalidProp, isReadOnly, label, placeholder, slot, size, shortMonth, isRequired, ...props }: DateFieldProps<T>): react_jsx_runtime.JSX.Element;
|
27
11
|
|
28
|
-
export { DateField
|
12
|
+
export { DateField };
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
1
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import'client-only';import A from'@accelint/icons/calendar';import {DateField,composeRenderProps,Text,FieldError,DateInput,DateSegment}from'react-aria-components';import {Icon}from'../icon/index.js';import {Label}from'../label/index.js';import {DateFieldStyles}from'./styles.js';const{field:v,dateInput:E,dateInputContainer:C,icon:L,descriptionText:V,error:J,dateSegment:O}=DateFieldStyles(),U=["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"],k=({value:e,isFocused:r,isPlaceholder:a,placeholder:n,isReadOnly:i,shortMonth:l})=>{if(a)return n;let o=`${e}`;return !i&&r?o=o.padStart(2,"0"):l&&(o=U[(e??0)-1]),o},q=({segment:e,shortMonth:r,...a})=>e.type==="literal"&&e.text!==":"?jsx(Fragment,{}):jsx(DateSegment,{segment:e,className:O({}),...a,children:e.type==="month"?n=>jsx(k,{...n,shortMonth:r}):e.text}),z=({className:e,ref:r=null,size:a,...n})=>jsxs("div",{className:C({}),children:[a==="medium"?jsx(Icon,{className:L({}),children:jsx(A,{})}):null,jsx(DateInput,{...n,className:composeRenderProps(e,i=>E({className:i})),"data-size":a})]});function Q({classNames:e,description:r,errorMessage:a,isDisabled:n,isInvalid:i,isReadOnly:l,label:o,placeholder:B,slot:S,size:p="medium",shortMonth:g=true,isRequired:F,...h}){const D=a||null,u=p==="small";return jsx(DateField,{...h,isDisabled:n,isInvalid:i||(D?true:void 0),isReadOnly:l,slot:S,className:composeRenderProps(e?.field,s=>v({className:s})),children:({isDisabled:s,isInvalid:y})=>jsxs(Fragment,{children:[!u&&o&&jsx(Label,{className:e?.label,isDisabled:s,isRequired:F,children:o}),jsx(z,{className:e?.input,size:p,isInvalid:y,children:m=>jsx(q,{segment:m,shortMonth:g})}),r&&(!(u||i)||s)&&jsx(Text,{className:V({}),slot:"description",children:r}),jsx(FieldError,{className:composeRenderProps(e?.error,m=>J({className:m})),children:D})]})})}export{Q as DateField};//# sourceMappingURL=index.js.map
|
2
2
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/date-field/index.tsx"],"names":["value","isPlaceholder","placeholder","isReadOnly","displayValue","months","FormattedDateSegment","segment","Fragment","jsx","DateSegment","a","F","renderProps","dateFieldStyles","cva","g","jsxs","u","v","n","AriaDateInput","props","P","DateField","label","slot","size","isSmall","shouldShowDescription","isInvalid","isDisabled","shouldShowError","errorMessage","AriaDateField","b","Label","AriaText","S","description","FieldError"],"mappings":"4UAoCE,CAAA,CAAA,CAAA,KACA,CAAA,KACA,CAAA,KACA,CAAA,KACA,CAAA,KACA,CAAA,WAEA,CAAA,KACA,CAAA,WAEA,CAAA,MAGuB,KACvB,CAAA,CAAA,CAAAA,CAAAA,CACA,CAAA,KAAA,CAAA,CAAA,CAAA,yBAEA,CAAA,CAAA,CAAA,WACA,CAAA,CAAA,CAAA,uBAGA,CAAIC,CAAAA,CACF,GAAA,CAAA,GAAOC,EAGT,SAA0CF,IAE1C,MAAI,CAACG,CAAAA,CAAAA,OACYC,CAAa,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,WAErCA,GAAeC,CAAAA,CAAQL,IAAS,CAAA,CAAK,CAAC,CAAA,CAAA,CAGjCI,EACT,CAOME,EAAuB,CAAC,CAC5B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,QACA,CAAA,CAAA,CAAA,UAEF,CAAA,CACMA,IAAQ,CAAA,CAAA,GAAS,CAAA,CAAA,IAAA,GAAA,SAAqB,EAAS,CAAA,CAAA,IAC1CC,GAAA,GAIPC,CAAAA,GAACC,CAAAA,QAAA,CACC,EAAA,CAAA,CAAAC,GAAA,CAAAC,WAAA,CAASL,CAAAA,OACT,CAAA,CAAA,CAAA,gFAGCA,QAAQ,CAAS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* Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\nimport { cn } from '@/lib/utils';\nimport Calendar from '@accelint/icons/calendar';\nimport type { DateValue } from '@internationalized/date';\nimport type { DateSegment as TDateSegment } from '@react-stately/datepicker';\nimport 'client-only';\nimport { type VariantProps, cva } from 'cva';\nimport type { ForwardedRef } from 'react';\nimport {\n DateField as AriaDateField,\n type DateFieldProps as AriaDateFieldProps,\n DateInput as AriaDateInput,\n type DateInputProps as AriaDateInputProps,\n type DateSegmentProps as AriaDateSegmentProps,\n Text as AriaText,\n DateSegment,\n type DateSegmentRenderProps,\n FieldError,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\n\nconst months = [\n 'JAN',\n 'FEB',\n 'MAR',\n 'APR',\n 'MAY',\n 'JUN',\n 'JUL',\n 'AUG',\n 'SEP',\n 'OCT',\n 'NOV',\n 'DEC',\n];\n\nconst MonthDateSegment = ({\n value,\n isFocused,\n isPlaceholder,\n placeholder,\n isReadOnly,\n shortMonth,\n}: DateSegmentRenderProps & { shortMonth?: boolean }) => {\n if (isPlaceholder) {\n return placeholder;\n }\n\n let displayValue: string | undefined = `${value}`;\n\n if (!isReadOnly && isFocused) {\n displayValue = displayValue.padStart(2, '0');\n } else if (shortMonth) {\n displayValue = months[(value ?? 0) - 1];\n }\n\n return displayValue;\n};\n\ninterface FormattedDateSegmentProps extends AriaDateSegmentProps {\n segment: TDateSegment;\n shortMonth?: boolean;\n}\n\nconst FormattedDateSegment = ({\n segment,\n shortMonth,\n ...props\n}: FormattedDateSegmentProps) => {\n if (segment.type === 'literal' && segment.text !== ':') {\n return <></>;\n }\n\n return (\n <DateSegment\n segment={segment}\n className='focus:bg-highlight focus:text-inverse-light focus:outline-none' // Ensure caret color is visible, RAC sets the style prop and it is not overridable. Thanks for that.\n {...props}\n >\n {segment.type === 'month'\n ? (renderProps) => (\n <MonthDateSegment {...renderProps} shortMonth={shortMonth} />\n )\n : segment.text}\n </DateSegment>\n );\n};\n\nconst dateFieldStyles = cva(\n [\n 'flex w-full gap-xs rounded-medium px-s py-xs font-display outline outline-interactive',\n ],\n {\n variants: {\n isDisabled: {\n true: 'text-disabled outline-interactive-disabled placeholder:text-disabled',\n false:\n 'text-default-light placeholder:text-default-dark focus-within:outline-highlight hover:outline-interactive-hover',\n },\n isInvalid: {\n true: 'outline-serious',\n },\n isReadOnly: {\n true: 'rounded-none p-0 outline-none',\n },\n size: {\n medium: ['text-body-s', 'pl-[32px]'],\n small: 'text-body-xs',\n },\n },\n compoundVariants: [\n {\n isDisabled: true,\n isInvalid: true,\n className: 'outline-interactive-disabled',\n },\n {\n isDisabled: false,\n size: 'medium',\n },\n ],\n defaultVariants: {\n size: 'medium',\n },\n },\n);\n\ninterface DateInputProps\n extends VariantProps<typeof dateFieldStyles>,\n Omit<AriaDateInputProps, 'size'> {\n ref?: ForwardedRef<HTMLDivElement>;\n}\n\nconst DateInput = ({\n className,\n ref = null,\n size = 'medium',\n isReadOnly,\n ...props\n}: DateInputProps) => {\n return (\n <div className='relative flex'>\n {size === 'medium' ? (\n <Icon\n className={cn([\n '-translate-y-1/2 absolute top-1/2 left-s',\n props.isDisabled ? 'text-disabled' : 'text-default-light',\n ])}\n >\n <Calendar />\n </Icon>\n ) : null}\n <AriaDateInput\n {...props}\n className={({ isDisabled, isInvalid }) =>\n cn(\n dateFieldStyles({\n isDisabled,\n isInvalid,\n isReadOnly: isReadOnly,\n size,\n className,\n }),\n )\n }\n />\n </div>\n );\n};\n\nexport interface DateFieldProps<T extends DateValue>\n extends Omit<\n VariantProps<typeof dateFieldStyles>,\n 'isDisabled' | 'isInvalid' | 'isReadOnly'\n >,\n Omit<AriaDateFieldProps<T>, 'className' | 'style'>, // Exclude className to avoid conflict with cva\n Omit<AriaDateInputProps, 'className' | 'children' | 'style'> {\n isDisabled?: boolean;\n isInvalid?: boolean;\n isReadOnly?: boolean;\n size?: 'small' | 'medium';\n className?: string;\n description?: string;\n errorMessage?: string;\n label?: string;\n placeholder?: string;\n shortMonth?: boolean;\n}\n\nexport function DateField<T extends DateValue>({\n className,\n description,\n errorMessage,\n isDisabled,\n isInvalid,\n isReadOnly,\n label,\n placeholder,\n slot,\n size = 'medium',\n shortMonth = true,\n ...props\n}: DateFieldProps<T>) {\n const isSmall = size === 'small';\n const shouldShowDescription =\n description && (!(isSmall || isInvalid) || isDisabled);\n const shouldShowError =\n errorMessage && isInvalid && !isDisabled && !isReadOnly;\n\n return (\n <AriaDateField<T>\n {...props}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isReadOnly={isReadOnly}\n slot={slot}\n className={'flex flex-col gap-xs'}\n >\n {!isSmall && (\n <Label\n className='empty:hidden'\n isDisabled={isDisabled}\n isRequired={props.isRequired}\n >\n {label}\n </Label>\n )}\n\n <DateInput\n className={className}\n isDisabled={isDisabled}\n size={size}\n isReadOnly={isReadOnly}\n isInvalid={isInvalid}\n >\n {(segment) => (\n <FormattedDateSegment segment={segment} shortMonth={shortMonth} />\n )}\n </DateInput>\n {shouldShowDescription && (\n <AriaText\n className={cn([\n 'fg-default-dark text-body-xs empty:hidden',\n isDisabled && 'fg-disabled',\n ])}\n slot='description'\n >\n {description}\n </AriaText>\n )}\n {shouldShowError && (\n <FieldError className='fg-serious text-body-xs empty:hidden'>\n {errorMessage}\n </FieldError>\n )}\n </AriaDateField>\n );\n}\n"]}
|
1
|
+
{"version":3,"sources":["../../../src/components/date-field/index.tsx"],"names":["dateInput","descriptionText","error","DateFieldStyles","R","value","isFocused","shortMonth","displayValue","isReadOnly","months","FormattedDateSegment","segment","jsx","DateSegment","t","c","dateSegment","DateInput","className","ref","props","jsxs","dateInputContainer","f","icon","d","classNames","isInvalidProp","isSmall","size","AriaDateField","field","isDisabled","isInvalid","label","Label","b","isRequired","AriaText","T","descriptionProp","errorMessage"],"mappings":"yUAkCEA,KACA,CAAA,KAAA,CAAA,CAAA,CAAA,SACA,CAAA,CAAA,CAAA,oBACAC,CAAAA,IACA,CAAA,CAAA,CAAAC,eAEF,EAAIC,CAAAA,KAEW,CACb,CAAA,CAAA,WAEA,CAAA,CAAA,CAAA,CAAAC,eACA,EAAA,CAAA,CAAA,CAAA,CACA,MACA,KAAA,CACA,KAAA,CACA,MACA,KAAA,CACA,KAAA,CACA,MACA,KACF,CAAA,KAGE,MAAAC,CAAAA,KACA,CAAA,KAAAC,EACA,CAAA,CAAA,CAAA,CAAA,KAAA,CAAA,CAAA,CAAA,yBAEA,CAAA,CAAA,CAAA,WACA,CAAA,CAAA,CAAAC,WAGE,CAAA,CAAA,UAGF,CAAIC,CAAAA,CAAmC,GAAGH,CAAK,GAE/C,SAAKI,CAAcH,KACFE,CAAa,eAAe,EAClCD,EAAAA,CAAAA,CACTC,CAAAA,CAAeE,UAAuB,CAAA,CAAA,CAGjCF,GAQHG,CAAAA,CAAuB,CAAC,GAC5B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAAC,EACA,WAAAL,CAAAA,CACA,CAAA,OAEIK,CAAAA,CAAQ,WAAS,CAAA,CAAA,CAAA,GAAA,CAAaA,CAAAA,SAAiB,GAC1CC,WAINC,CAAA,CAAY,UAAkB,CAAAC,GAAA,CAAAC,QAAA,CAAA,EAAA,CAAA,CAAAD,GAAWE,YAAY,CAAC,CAAC,OACrD,YAAQ,CAAA,CAAA,CAAA,EAAA,CAAS,eAEX,CAAkB,CAAA,IAAgB,GAAA,OAAA,CAAYV,CAAAA,KAEjDK,CAAAA,CAAQ,CAAA,CAAA,GACd,EAIEM,UACJ,CAAA,CAAA,CAAA,CAAAC,CAAAA,CACA,KAAAC,CAAM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AEC,CAAA,IAAClB,CAAAA,CAAAA,CACAC,oBAAwC,CAAA,CAAA,EAAAE,GAAA,CAAYR,EAAY,CAAA,OAG/C,CAAA,CAAEsB,CAAAA,UACrBhB,CAAAA,CAAC0B,EAAA,CAAS,CAAA,CAAA,CAAA,GAAA,EAAA,CAAA,GAA2B,CAAC,GAAI,CAAA,EAAAxB,GAAA,CAAKyB,IAAA,CAAA,CAAA,SAAA,CAAA,CAC5C,SAAAC,CAAAA,sBAI2Bd,CAAY,QAAQR,UAAAA,CAAAA,CAChDjB,SAAQ,CAAAwB,kBAAA,CAAA,CAAAP,EAAW,YAGpBuB,SAMb,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n'use client';\nimport 'client-only';\nimport Calendar from '@accelint/icons/calendar';\nimport type { DateValue } from '@internationalized/date';\nimport type { DateSegment as TDateSegment } from '@react-stately/datepicker';\nimport {\n DateField as AriaDateField,\n DateInput as AriaDateInput,\n type DateSegmentProps as AriaDateSegmentProps,\n Text as AriaText,\n DateSegment,\n type DateSegmentRenderProps,\n FieldError,\n composeRenderProps,\n} from 'react-aria-components';\nimport { Icon } from '../icon';\nimport { Label } from '../label';\nimport { DateFieldStyles } from './styles';\nimport type { DateFieldProps, DateInputProps } from './types';\n\nconst {\n field,\n dateInput,\n dateInputContainer,\n icon,\n descriptionText,\n error,\n dateSegment,\n} = DateFieldStyles();\n\nconst months = [\n 'JAN',\n 'FEB',\n 'MAR',\n 'APR',\n 'MAY',\n 'JUN',\n 'JUL',\n 'AUG',\n 'SEP',\n 'OCT',\n 'NOV',\n 'DEC',\n];\n\nconst MonthDateSegment = ({\n value,\n isFocused,\n isPlaceholder,\n placeholder,\n isReadOnly,\n shortMonth,\n}: DateSegmentRenderProps & { shortMonth?: boolean }) => {\n if (isPlaceholder) {\n return placeholder;\n }\n\n let displayValue: string | undefined = `${value}`;\n\n if (!isReadOnly && isFocused) {\n displayValue = displayValue.padStart(2, '0');\n } else if (shortMonth) {\n displayValue = months[(value ?? 0) - 1];\n }\n\n return displayValue;\n};\n\ninterface FormattedDateSegmentProps extends AriaDateSegmentProps {\n segment: TDateSegment;\n shortMonth?: boolean;\n}\n\nconst FormattedDateSegment = ({\n segment,\n shortMonth,\n ...props\n}: FormattedDateSegmentProps) => {\n if (segment.type === 'literal' && segment.text !== ':') {\n return <></>;\n }\n\n return (\n <DateSegment segment={segment} className={dateSegment({})} {...props}>\n {segment.type === 'month'\n ? (renderProps) => (\n <MonthDateSegment {...renderProps} shortMonth={shortMonth} />\n )\n : segment.text}\n </DateSegment>\n );\n};\n\nconst DateInput = ({\n className,\n ref = null,\n size,\n ...props\n}: DateInputProps) => {\n return (\n <div className={dateInputContainer({})}>\n {size === 'medium' ? (\n <Icon className={icon({})}>\n <Calendar />\n </Icon>\n ) : null}\n <AriaDateInput\n {...props}\n className={composeRenderProps(className, (className) =>\n dateInput({\n className,\n }),\n )}\n data-size={size}\n />\n </div>\n );\n};\n\nexport function DateField<T extends DateValue>({\n classNames,\n description: descriptionProp,\n errorMessage: errorMessageProp,\n isDisabled,\n isInvalid: isInvalidProp,\n isReadOnly,\n label,\n placeholder,\n slot,\n size = 'medium',\n shortMonth = true,\n isRequired,\n ...props\n}: DateFieldProps<T>) {\n const errorMessage = errorMessageProp || null; // Protect against empty string\n const isSmall = size === 'small';\n\n return (\n <AriaDateField<T>\n {...props}\n isDisabled={isDisabled}\n isInvalid={isInvalidProp || (errorMessage ? true : undefined)} // Leave uncontrolled if possible to fallback to validation state\n isReadOnly={isReadOnly}\n slot={slot}\n className={composeRenderProps(classNames?.field, (className) =>\n field({ className }),\n )}\n >\n {(\n { isDisabled, isInvalid }, // Rely on internal state, not props, since state could differ from props\n ) => (\n <>\n {!isSmall && label && (\n <Label\n className={classNames?.label}\n isDisabled={isDisabled}\n isRequired={isRequired}\n >\n {label}\n </Label>\n )}\n <DateInput\n className={classNames?.input}\n size={size}\n isInvalid={isInvalid}\n >\n {(segment) => (\n <FormattedDateSegment segment={segment} shortMonth={shortMonth} />\n )}\n </DateInput>\n {descriptionProp && (!(isSmall || isInvalidProp) || isDisabled) && (\n <AriaText className={descriptionText({})} slot='description'>\n {descriptionProp}\n </AriaText>\n )}\n <FieldError\n className={composeRenderProps(classNames?.error, (className) =>\n error({ className }),\n )}\n >\n {errorMessage}\n </FieldError>\n </>\n )}\n </AriaDateField>\n );\n}\n"]}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
2
|
+
import * as tailwind_merge from 'tailwind-merge';
|
3
|
+
|
4
|
+
declare const DateFieldStylesDefault: {
|
5
|
+
readonly size: "medium";
|
6
|
+
};
|
7
|
+
declare const DateFieldStyles: tailwind_variants.TVReturnType<{
|
8
|
+
[key: string]: {
|
9
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
10
|
+
icon?: tailwind_merge.ClassNameValue;
|
11
|
+
error?: tailwind_merge.ClassNameValue;
|
12
|
+
field?: tailwind_merge.ClassNameValue;
|
13
|
+
dateInputContainer?: tailwind_merge.ClassNameValue;
|
14
|
+
dateSegment?: tailwind_merge.ClassNameValue;
|
15
|
+
dateInput?: tailwind_merge.ClassNameValue;
|
16
|
+
descriptionText?: tailwind_merge.ClassNameValue;
|
17
|
+
};
|
18
|
+
};
|
19
|
+
} | {
|
20
|
+
[x: string]: {
|
21
|
+
[x: string]: tailwind_merge.ClassNameValue | {
|
22
|
+
icon?: tailwind_merge.ClassNameValue;
|
23
|
+
error?: tailwind_merge.ClassNameValue;
|
24
|
+
field?: tailwind_merge.ClassNameValue;
|
25
|
+
dateInputContainer?: tailwind_merge.ClassNameValue;
|
26
|
+
dateSegment?: tailwind_merge.ClassNameValue;
|
27
|
+
dateInput?: tailwind_merge.ClassNameValue;
|
28
|
+
descriptionText?: tailwind_merge.ClassNameValue;
|
29
|
+
};
|
30
|
+
};
|
31
|
+
} | {}, {
|
32
|
+
field: string;
|
33
|
+
dateInput: string[];
|
34
|
+
dateInputContainer: string;
|
35
|
+
icon: string[];
|
36
|
+
descriptionText: string[];
|
37
|
+
error: string;
|
38
|
+
dateSegment: string;
|
39
|
+
}, undefined, {
|
40
|
+
[key: string]: {
|
41
|
+
[key: string]: tailwind_merge.ClassNameValue | {
|
42
|
+
icon?: tailwind_merge.ClassNameValue;
|
43
|
+
error?: tailwind_merge.ClassNameValue;
|
44
|
+
field?: tailwind_merge.ClassNameValue;
|
45
|
+
dateInputContainer?: tailwind_merge.ClassNameValue;
|
46
|
+
dateSegment?: tailwind_merge.ClassNameValue;
|
47
|
+
dateInput?: tailwind_merge.ClassNameValue;
|
48
|
+
descriptionText?: tailwind_merge.ClassNameValue;
|
49
|
+
};
|
50
|
+
};
|
51
|
+
} | {}, {
|
52
|
+
field: string;
|
53
|
+
dateInput: string[];
|
54
|
+
dateInputContainer: string;
|
55
|
+
icon: string[];
|
56
|
+
descriptionText: string[];
|
57
|
+
error: string;
|
58
|
+
dateSegment: string;
|
59
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
60
|
+
field: string;
|
61
|
+
dateInput: string[];
|
62
|
+
dateInputContainer: string;
|
63
|
+
icon: string[];
|
64
|
+
descriptionText: string[];
|
65
|
+
error: string;
|
66
|
+
dateSegment: string;
|
67
|
+
}, undefined, unknown, unknown, undefined>>;
|
68
|
+
|
69
|
+
export { DateFieldStyles, DateFieldStylesDefault };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {tv}from'tailwind-variants';const t={size:"medium"},d=tv({slots:{field:"group/date-field flex flex-col gap-xs",dateInput:["group/date-field flex w-full gap-xs rounded-medium px-s py-xs font-display outline outline-interactive","disabled:text-disabled disabled:outline-interactive-disabled disabled:placeholder:text-disabled","text-default-light placeholder:text-default-dark focus-within:outline-highlight hover:outline-interactive-hover","invalid:outline-serious","size-medium:pl-[32px] size-medium:text-body-s","size-small:text-body-xs"],dateInputContainer:"relative flex",icon:["-translate-y-1/2 absolute top-1/2 left-s text-default-light","group-disabled/date-field:text-disabled"],descriptionText:["fg-default-dark text-body-xs empty:hidden","group-disabled/date-field:fg-disabled"],error:"fg-serious text-body-xs empty:hidden",dateSegment:"focus:bg-highlight focus:text-inverse-light focus:outline-none"},defaultVariants:t});export{d as DateFieldStyles,t as DateFieldStylesDefault};//# sourceMappingURL=styles.js.map
|
2
|
+
//# sourceMappingURL=styles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/date-field/styles.ts"],"names":["DateFieldStylesDefault","DateFieldStyles","tv"],"mappings":"mCAcO,MAAMA,EAAyB,CACpC,IAAA,CAAM,QACR,CAAA,CAEaC,CAAAA,CAAkBC,GAAG,CAChC,KAAA,CAAO,CACL,KAAA,CAAO,uCAAA,CACP,UAAW,CACT,wGAAA,CACA,kGACA,iHAAA,CACA,yBAAA,CACA,gDACA,yBACF,CAAA,CACA,mBAAoB,eAAA,CACpB,IAAA,CAAM,CACJ,6DAAA,CACA,yCACF,EACA,eAAA,CAAiB,CACf,4CACA,uCACF,CAAA,CACA,MAAO,sCAAA,CACP,WAAA,CACE,gEACJ,CAAA,CACA,eAAA,CAAiBF,CACnB,CAAC","file":"styles.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { tv } from 'tailwind-variants';\n\nexport const DateFieldStylesDefault = {\n size: 'medium',\n} as const;\n\nexport const DateFieldStyles = tv({\n slots: {\n field: 'group/date-field flex flex-col gap-xs',\n dateInput: [\n 'group/date-field flex w-full gap-xs rounded-medium px-s py-xs font-display outline outline-interactive',\n 'disabled:text-disabled disabled:outline-interactive-disabled disabled:placeholder:text-disabled',\n 'text-default-light placeholder:text-default-dark focus-within:outline-highlight hover:outline-interactive-hover',\n 'invalid:outline-serious',\n 'size-medium:pl-[32px] size-medium:text-body-s',\n 'size-small:text-body-xs',\n ],\n dateInputContainer: 'relative flex',\n icon: [\n '-translate-y-1/2 absolute top-1/2 left-s text-default-light',\n 'group-disabled/date-field:text-disabled',\n ],\n descriptionText: [\n 'fg-default-dark text-body-xs empty:hidden',\n 'group-disabled/date-field:fg-disabled',\n ],\n error: 'fg-serious text-body-xs empty:hidden',\n dateSegment:\n 'focus:bg-highlight focus:text-inverse-light focus:outline-none',\n },\n defaultVariants: DateFieldStylesDefault,\n});\n"]}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { ForwardedRef } from 'react';
|
2
|
+
import { DateValue, DateFieldProps as DateFieldProps$1, DateInputProps as DateInputProps$1, LabelProps, FieldErrorProps } from 'react-aria-components';
|
3
|
+
import { VariantProps } from 'tailwind-variants';
|
4
|
+
import { DateFieldStyles } from './styles.js';
|
5
|
+
import 'tailwind-merge';
|
6
|
+
|
7
|
+
interface DateInputProps extends VariantProps<typeof DateFieldStyles>, Omit<DateInputProps$1, 'size'> {
|
8
|
+
ref?: ForwardedRef<HTMLDivElement>;
|
9
|
+
size?: 'small' | 'medium';
|
10
|
+
isInvalid?: boolean;
|
11
|
+
}
|
12
|
+
interface DateFieldProps<T extends DateValue> extends VariantProps<typeof DateFieldStyles>, Omit<DateFieldProps$1<T>, 'style' | 'className'>, Omit<DateInputProps$1, 'children' | 'style'> {
|
13
|
+
classNames?: {
|
14
|
+
field?: DateFieldProps$1<T>['className'];
|
15
|
+
label?: LabelProps['className'];
|
16
|
+
input?: DateInputProps['className'];
|
17
|
+
description?: string;
|
18
|
+
error?: FieldErrorProps['className'];
|
19
|
+
};
|
20
|
+
size?: 'small' | 'medium';
|
21
|
+
description?: string;
|
22
|
+
errorMessage?: string;
|
23
|
+
label?: string;
|
24
|
+
placeholder?: string;
|
25
|
+
shortMonth?: boolean;
|
26
|
+
isRequired?: boolean;
|
27
|
+
}
|
28
|
+
|
29
|
+
export type { DateFieldProps, DateInputProps };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"types.js"}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
+
import * as react from 'react';
|
3
|
+
import { ProviderProps } from '../../lib/types.js';
|
4
|
+
import { ContextValue } from 'react-aria-components';
|
5
|
+
import { DetailsListProps, DetailsListLabelProps, DetailsListValueProps } from './types.js';
|
6
|
+
import 'tailwind-variants';
|
7
|
+
import './styles.js';
|
8
|
+
|
9
|
+
declare const DetailsListContext: react.Context<ContextValue<DetailsListProps, HTMLDListElement>>;
|
10
|
+
declare function DetailsListProvider({ children, ...props }: ProviderProps<DetailsListProps>): react_jsx_runtime.JSX.Element;
|
11
|
+
declare namespace DetailsListProvider {
|
12
|
+
var displayName: string;
|
13
|
+
}
|
14
|
+
declare function DetailsListLabel(props: DetailsListLabelProps): react_jsx_runtime.JSX.Element;
|
15
|
+
declare namespace DetailsListLabel {
|
16
|
+
var displayName: string;
|
17
|
+
}
|
18
|
+
declare function DetailsListValue(props: DetailsListValueProps): react_jsx_runtime.JSX.Element;
|
19
|
+
declare namespace DetailsListValue {
|
20
|
+
var displayName: string;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* A semantic details list component for displaying metadata in key-value pairs.
|
24
|
+
* Uses CSS Grid layout with labels in the first column and values in the second column.
|
25
|
+
* Perfect for map object details, user profiles, or any structured information.
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
* ```tsx
|
29
|
+
* <DetailsList align="left">
|
30
|
+
* <DetailsList.Label>Key</DetailsList.Label>
|
31
|
+
* <DetailsList.Value>Value</DetailsList.Value>
|
32
|
+
*
|
33
|
+
* <DetailsList.Label>Ships</DetailsList.Label>
|
34
|
+
* <DetailsList.Value>Millennium Falcon</DetailsList.Value>
|
35
|
+
* <DetailsList.Value>USS Enterprise NCC-1701</DetailsList.Value>
|
36
|
+
* <DetailsList.Value>Serenity</DetailsList.Value>
|
37
|
+
*
|
38
|
+
* <DetailsList.Label>Coordinates</DetailsList.Label>
|
39
|
+
* <DetailsList.Value>
|
40
|
+
* <div>Great Pyramid of Giza: 29°58'44" N 31°08'02" E</div>
|
41
|
+
* <div>Machu Picchu: 13°09'47" S 72°32'41" W</div>
|
42
|
+
* <div>Colosseum: 41°53'24" N 12°29'32" E</div>
|
43
|
+
* <div>Taj Mahal: 27°10'30" N 78°02'31" E</div>
|
44
|
+
* </DetailsList.Value>
|
45
|
+
* </DetailsList>
|
46
|
+
* ```
|
47
|
+
* ## Child Component Behavior
|
48
|
+
* - **DetailsList.Label**: Minimum of 1
|
49
|
+
* - **DetailsList.Value**: Minimum of 1
|
50
|
+
*/
|
51
|
+
declare function DetailsList({ ref, ...props }: DetailsListProps): react_jsx_runtime.JSX.Element;
|
52
|
+
declare namespace DetailsList {
|
53
|
+
var displayName: string;
|
54
|
+
var Provider: typeof DetailsListProvider;
|
55
|
+
var Label: typeof DetailsListLabel;
|
56
|
+
var Value: typeof DetailsListValue;
|
57
|
+
}
|
58
|
+
|
59
|
+
export { DetailsList, DetailsListContext };
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import'client-only';import {containsExactChildren}from'./../../lib/react.js';import {createContext}from'react';import {useContextProps,TextContext,DEFAULT_SLOT,Text}from'react-aria-components';import {DetailsListStyles,DetailsListStylesDefaults}from'./styles.js';const {list:N,label:b,value:f}=DetailsListStyles(),n=createContext(null);function m({children:e,...s}){return jsx(n.Provider,{value:s,children:e})}m.displayName="DetailsListProvider.Provider";function L(e){return jsx(Text,{...e,elementType:"dt",slot:"label"})}L.displayName="DetailsList.Label";function p(e){return jsx(Text,{...e,elementType:"dd",slot:"value"})}p.displayName="DetailsList.Value";function t({ref:e,...s}){[s,e]=useContextProps(s,e??null,n);const{children:o,classNames:i,align:a=DetailsListStylesDefaults.align,...u}=s;return containsExactChildren({children:o,componentName:t.displayName,restrictions:[[t.Label,{min:1}],[t.Value,{min:1}]]}),jsx(TextContext,{value:{slots:{[DEFAULT_SLOT]:{},label:{className:b({className:i?.label,align:a})},value:{className:f({className:i?.value,align:a})}}},children:jsx("dl",{...u,className:N({className:i?.list,align:a}),children:o})})}t.displayName="DetailsList",t.Provider=m,t.Label=L,t.Value=p;export{t as DetailsList,n as DetailsListContext};//# sourceMappingURL=index.js.map
|
2
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../src/components/details-list/index.tsx"],"names":["label","value","DetailsListContext","y","props","jsx","l","DetailsListProvider","Text","r","useContextProps","ref","v","classNames","rest","D","DetailsList","TextContext","P","d","align","children","DetailsListValue"],"mappings":"2SA+Bc,MAAAA,CAAAA,IAAO,CAAA,CAAA,CAAAC,KAA4B,CAAA,CAEpCC,CAAAA,KACqD,CAAA,CAAI,CAAA,CAEtEC,wCACE,EAAA,SACA,CAAA,CAAA,CAAGC,QAEH,CAAA,CAAA,CACEC,GAACH,CAAmB,CAAA,CAAA,CAAA,OAASI,GAAA,CAAA,CAAA,CAAA,QAC1B,CAAA,CAAA,KACH,CAEJ,CACAC,CAAAA,QAAoB,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,WAAA,CAAA,8BAEsB,CACtD,SAAQC,CAAAA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AIrE,CAAA,KAAA,CAAA,CAAA,CAAAf,CAAAA,CAAC,WAAa,CAAAC,GAAA,CAAA,IAAA,CAAA,CAAA,GAAgB,CAAE,CAAA,SAAWO,CAAAA,CAAAA,CAAY,CAAA,SAAM,CAAAO,CAAM,EAAC,IACjE,CAAA,KAAAC,CAAAA,CACH,EACF,CAEJ,QACY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,CAAA,CAAA,WAAA,CAC1BL,aACAA,CAAAA,CAAY,CAAA,QACZA,CAAY,CAAA,CAAA,CAAA,CAAA,KAAQM,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA","file":"index.js","sourcesContent":["/*\n * Copyright 2025 Hypergiant Galactic Systems Inc. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n'use client';\n\nimport 'client-only';\nimport { containsExactChildren } from '@/lib/react';\nimport type { ProviderProps } from '@/lib/types';\nimport { createContext } from 'react';\nimport {\n type ContextValue,\n DEFAULT_SLOT,\n Text,\n TextContext,\n useContextProps,\n} from 'react-aria-components';\nimport { DetailsListStyles, DetailsListStylesDefaults } from './styles';\nimport type {\n DetailsListLabelProps,\n DetailsListProps,\n DetailsListValueProps,\n} from './types';\n\nconst { list, label, value } = DetailsListStyles();\n\nexport const DetailsListContext =\n createContext<ContextValue<DetailsListProps, HTMLDListElement>>(null);\n\nfunction DetailsListProvider({\n children,\n ...props\n}: ProviderProps<DetailsListProps>) {\n return (\n <DetailsListContext.Provider value={props}>\n {children}\n </DetailsListContext.Provider>\n );\n}\nDetailsListProvider.displayName = 'DetailsListProvider.Provider';\n\nfunction DetailsListLabel(props: DetailsListLabelProps) {\n return <Text {...props} elementType='dt' slot='label' />;\n}\nDetailsListLabel.displayName = 'DetailsList.Label';\n\nfunction DetailsListValue(props: DetailsListValueProps) {\n return <Text {...props} elementType='dd' slot='value' />;\n}\nDetailsListValue.displayName = 'DetailsList.Value';\n\n/**\n * A semantic details list component for displaying metadata in key-value pairs.\n * Uses CSS Grid layout with labels in the first column and values in the second column.\n * Perfect for map object details, user profiles, or any structured information.\n *\n * @example\n * ```tsx\n * <DetailsList align=\"left\">\n * <DetailsList.Label>Key</DetailsList.Label>\n * <DetailsList.Value>Value</DetailsList.Value>\n *\n * <DetailsList.Label>Ships</DetailsList.Label>\n * <DetailsList.Value>Millennium Falcon</DetailsList.Value>\n * <DetailsList.Value>USS Enterprise NCC-1701</DetailsList.Value>\n * <DetailsList.Value>Serenity</DetailsList.Value>\n *\n * <DetailsList.Label>Coordinates</DetailsList.Label>\n * <DetailsList.Value>\n * <div>Great Pyramid of Giza: 29°58'44\" N 31°08'02\" E</div>\n * <div>Machu Picchu: 13°09'47\" S 72°32'41\" W</div>\n * <div>Colosseum: 41°53'24\" N 12°29'32\" E</div>\n * <div>Taj Mahal: 27°10'30\" N 78°02'31\" E</div>\n * </DetailsList.Value>\n * </DetailsList>\n * ```\n * ## Child Component Behavior\n * - **DetailsList.Label**: Minimum of 1\n * - **DetailsList.Value**: Minimum of 1\n */\nexport function DetailsList({ ref, ...props }: DetailsListProps) {\n [props, ref] = useContextProps(props, ref ?? null, DetailsListContext);\n\n const {\n children,\n classNames,\n align = DetailsListStylesDefaults.align,\n ...rest\n } = props;\n\n containsExactChildren({\n children,\n componentName: DetailsList.displayName,\n restrictions: [\n [DetailsList.Label, { min: 1 }],\n [DetailsList.Value, { min: 1 }],\n ],\n });\n\n return (\n <TextContext\n value={{\n slots: {\n [DEFAULT_SLOT]: {},\n label: { className: label({ className: classNames?.label, align }) },\n value: { className: value({ className: classNames?.value, align }) },\n },\n }}\n >\n <dl {...rest} className={list({ className: classNames?.list, align })}>\n {children}\n </dl>\n </TextContext>\n );\n}\nDetailsList.displayName = 'DetailsList';\nDetailsList.Provider = DetailsListProvider;\nDetailsList.Label = DetailsListLabel;\nDetailsList.Value = DetailsListValue;\n"]}
|