jaci-ui 0.3.0 → 0.5.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/CHANGELOG.md +14 -0
- package/README.md +85 -0
- package/dist/components/calendar/calendar.cjs +377 -0
- package/dist/components/calendar/calendar.cjs.map +1 -0
- package/dist/components/calendar/calendar.d.cts +56 -0
- package/dist/components/calendar/calendar.d.ts +56 -0
- package/dist/components/calendar/calendar.js +368 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/calendar/index.d.cts +2 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/combobox/combobox.cjs +13 -1
- package/dist/components/combobox/combobox.cjs.map +1 -1
- package/dist/components/combobox/combobox.d.cts +7 -2
- package/dist/components/combobox/combobox.d.ts +7 -2
- package/dist/components/combobox/combobox.js +13 -2
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/combobox/index.d.cts +2 -2
- package/dist/components/combobox/index.d.ts +2 -2
- package/dist/components/command/command.cjs +55 -34
- package/dist/components/command/command.cjs.map +1 -1
- package/dist/components/command/command.d.cts +1 -0
- package/dist/components/command/command.d.ts +1 -0
- package/dist/components/command/command.js +55 -34
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/controls/input.cjs +26 -5
- package/dist/components/controls/input.cjs.map +1 -1
- package/dist/components/controls/input.d.cts +5 -2
- package/dist/components/controls/input.d.ts +5 -2
- package/dist/components/controls/input.js +28 -7
- package/dist/components/controls/input.js.map +1 -1
- package/dist/components/controls/textarea.cjs +26 -5
- package/dist/components/controls/textarea.cjs.map +1 -1
- package/dist/components/controls/textarea.d.cts +5 -2
- package/dist/components/controls/textarea.d.ts +5 -2
- package/dist/components/controls/textarea.js +28 -7
- package/dist/components/controls/textarea.js.map +1 -1
- package/dist/components/data-toolbar/data-toolbar.cjs +141 -0
- package/dist/components/data-toolbar/data-toolbar.cjs.map +1 -0
- package/dist/components/data-toolbar/data-toolbar.d.cts +50 -0
- package/dist/components/data-toolbar/data-toolbar.d.ts +50 -0
- package/dist/components/data-toolbar/data-toolbar.js +132 -0
- package/dist/components/data-toolbar/data-toolbar.js.map +1 -0
- package/dist/components/data-toolbar/index.d.cts +2 -0
- package/dist/components/data-toolbar/index.d.ts +2 -0
- package/dist/components/data-view/data-view.cjs +33 -1
- package/dist/components/data-view/data-view.cjs.map +1 -1
- package/dist/components/data-view/data-view.d.cts +12 -1
- package/dist/components/data-view/data-view.d.ts +12 -1
- package/dist/components/data-view/data-view.js +31 -2
- package/dist/components/data-view/data-view.js.map +1 -1
- package/dist/components/data-view/index.d.cts +2 -2
- package/dist/components/data-view/index.d.ts +2 -2
- package/dist/components/date-picker/date-picker.cjs +9 -9
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.d.cts +3 -1
- package/dist/components/date-picker/date-picker.d.ts +3 -1
- package/dist/components/date-picker/date-picker.js +9 -9
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.cjs +589 -0
- package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -0
- package/dist/components/date-range-picker/date-range-picker.d.cts +134 -0
- package/dist/components/date-range-picker/date-range-picker.d.ts +134 -0
- package/dist/components/date-range-picker/date-range-picker.js +568 -0
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -0
- package/dist/components/date-range-picker/index.d.cts +2 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/field/field.cjs +106 -11
- package/dist/components/field/field.cjs.map +1 -1
- package/dist/components/field/field.d.cts +22 -4
- package/dist/components/field/field.d.ts +22 -4
- package/dist/components/field/field.js +107 -13
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/index.d.cts +2 -2
- package/dist/components/field/index.d.ts +2 -2
- package/dist/components/list/list.cjs +3 -1
- package/dist/components/list/list.cjs.map +1 -1
- package/dist/components/list/list.d.cts +3 -1
- package/dist/components/list/list.d.ts +3 -1
- package/dist/components/list/list.js +3 -1
- package/dist/components/list/list.js.map +1 -1
- package/dist/components/pagination/index.d.cts +2 -2
- package/dist/components/pagination/index.d.ts +2 -2
- package/dist/components/pagination/pagination.cjs +122 -21
- package/dist/components/pagination/pagination.cjs.map +1 -1
- package/dist/components/pagination/pagination.d.cts +25 -13
- package/dist/components/pagination/pagination.d.ts +25 -13
- package/dist/components/pagination/pagination.js +122 -23
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/pin-input/index.d.cts +2 -0
- package/dist/components/pin-input/index.d.ts +2 -0
- package/dist/components/pin-input/pin-input.cjs +266 -0
- package/dist/components/pin-input/pin-input.cjs.map +1 -0
- package/dist/components/pin-input/pin-input.d.cts +46 -0
- package/dist/components/pin-input/pin-input.d.ts +46 -0
- package/dist/components/pin-input/pin-input.js +258 -0
- package/dist/components/pin-input/pin-input.js.map +1 -0
- package/dist/components/select/index.d.cts +2 -2
- package/dist/components/select/index.d.ts +2 -2
- package/dist/components/select/select.cjs +80 -3
- package/dist/components/select/select.cjs.map +1 -1
- package/dist/components/select/select.d.cts +18 -3
- package/dist/components/select/select.d.ts +18 -3
- package/dist/components/select/select.js +78 -5
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/table/index.d.cts +2 -2
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/table.cjs +265 -46
- package/dist/components/table/table.cjs.map +1 -1
- package/dist/components/table/table.d.cts +41 -8
- package/dist/components/table/table.d.ts +41 -8
- package/dist/components/table/table.js +264 -48
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tags-input/tags-input.cjs +83 -5
- package/dist/components/tags-input/tags-input.cjs.map +1 -1
- package/dist/components/tags-input/tags-input.d.cts +3 -0
- package/dist/components/tags-input/tags-input.d.ts +3 -0
- package/dist/components/tags-input/tags-input.js +83 -5
- package/dist/components/tags-input/tags-input.js.map +1 -1
- package/dist/components/tree-view/index.d.cts +2 -2
- package/dist/components/tree-view/index.d.ts +2 -2
- package/dist/components/tree-view/tree-view.cjs +60 -3
- package/dist/components/tree-view/tree-view.cjs.map +1 -1
- package/dist/components/tree-view/tree-view.d.cts +12 -1
- package/dist/components/tree-view/tree-view.d.ts +12 -1
- package/dist/components/tree-view/tree-view.js +58 -4
- package/dist/components/tree-view/tree-view.js.map +1 -1
- package/dist/components/upload/index.d.cts +2 -2
- package/dist/components/upload/index.d.ts +2 -2
- package/dist/components/upload/upload.cjs +90 -10
- package/dist/components/upload/upload.cjs.map +1 -1
- package/dist/components/upload/upload.d.cts +25 -2
- package/dist/components/upload/upload.d.ts +25 -2
- package/dist/components/upload/upload.js +89 -11
- package/dist/components/upload/upload.js.map +1 -1
- package/dist/index.cjs +74 -1
- package/dist/index.d.cts +17 -9
- package/dist/index.d.ts +17 -9
- package/dist/index.js +14 -10
- package/dist/styled-system/recipes/calendar.cjs +43 -0
- package/dist/styled-system/recipes/calendar.cjs.map +1 -0
- package/dist/styled-system/recipes/calendar.js +43 -0
- package/dist/styled-system/recipes/calendar.js.map +1 -0
- package/dist/styled-system/recipes/combobox.cjs +1 -0
- package/dist/styled-system/recipes/combobox.cjs.map +1 -1
- package/dist/styled-system/recipes/combobox.js +1 -0
- package/dist/styled-system/recipes/combobox.js.map +1 -1
- package/dist/styled-system/recipes/data-toolbar.cjs +40 -0
- package/dist/styled-system/recipes/data-toolbar.cjs.map +1 -0
- package/dist/styled-system/recipes/data-toolbar.js +40 -0
- package/dist/styled-system/recipes/data-toolbar.js.map +1 -0
- package/dist/styled-system/recipes/data-view.cjs +3 -0
- package/dist/styled-system/recipes/data-view.cjs.map +1 -1
- package/dist/styled-system/recipes/data-view.js +3 -0
- package/dist/styled-system/recipes/data-view.js.map +1 -1
- package/dist/styled-system/recipes/date-range-picker.cjs +52 -0
- package/dist/styled-system/recipes/date-range-picker.cjs.map +1 -0
- package/dist/styled-system/recipes/date-range-picker.js +52 -0
- package/dist/styled-system/recipes/date-range-picker.js.map +1 -0
- package/dist/styled-system/recipes/list.cjs +7 -1
- package/dist/styled-system/recipes/list.cjs.map +1 -1
- package/dist/styled-system/recipes/list.js +7 -1
- package/dist/styled-system/recipes/list.js.map +1 -1
- package/dist/styled-system/recipes/pagination.cjs +9 -1
- package/dist/styled-system/recipes/pagination.cjs.map +1 -1
- package/dist/styled-system/recipes/pagination.js +9 -1
- package/dist/styled-system/recipes/pagination.js.map +1 -1
- package/dist/styled-system/recipes/pin-input.cjs +39 -0
- package/dist/styled-system/recipes/pin-input.cjs.map +1 -0
- package/dist/styled-system/recipes/pin-input.js +39 -0
- package/dist/styled-system/recipes/pin-input.js.map +1 -0
- package/dist/styled-system/recipes/select.cjs +5 -1
- package/dist/styled-system/recipes/select.cjs.map +1 -1
- package/dist/styled-system/recipes/select.js +5 -1
- package/dist/styled-system/recipes/select.js.map +1 -1
- package/dist/styled-system/recipes/table.cjs +15 -2
- package/dist/styled-system/recipes/table.cjs.map +1 -1
- package/dist/styled-system/recipes/table.js +15 -2
- package/dist/styled-system/recipes/table.js.map +1 -1
- package/dist/styled-system/recipes/tree-view.cjs +4 -1
- package/dist/styled-system/recipes/tree-view.cjs.map +1 -1
- package/dist/styled-system/recipes/tree-view.js +4 -1
- package/dist/styled-system/recipes/tree-view.js.map +1 -1
- package/dist/styled-system/recipes/upload.cjs +2 -0
- package/dist/styled-system/recipes/upload.cjs.map +1 -1
- package/dist/styled-system/recipes/upload.js +2 -0
- package/dist/styled-system/recipes/upload.js.map +1 -1
- package/dist/styles.css +995 -95
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":["Field","BaseField"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n name: string | undefined;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n errors: [],\n insideField: false,\n invalid: false,\n name: undefined,\n});\n\nfunction normalizeErrors(errors: ReactNode | ReactNode[] | undefined): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor: string;\n}\n\nexport const Field = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const errors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const invalid = invalidProp || errors.length > 0;\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider value={{ errors, insideField: true, invalid, name }}>\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-slot=\"field\"\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n validate={validate}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { insideField, invalid } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,eAAe,cAAiC;CACpD,QAAQ,CAAC;CACT,aAAa;CACb,SAAS;CACT,MAAM,KAAA;AACR,CAAC;AAED,SAAS,gBAAgB,QAA0D;CACjF,IAAI,WAAW,KAAA,KAAa,WAAW,QAAQ,WAAW,OACxD,OAAO,CAAC;CAGV,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AACjD;AAEA,SAAS,aAAa,QAAqB;CACzC,IAAI,OAAO,UAAU,GACnB,OAAO,OAAO;CAGhB,OACE,oBAAC,MAAD,EAAA,UACG,OAAO,KAAK,OAAO,UAClB,oBAAC,MAAD,EAAA,UAAqD,MAAU,GAAtD,OAAO,UAAU,WAAW,QAAQ,KAAkB,CAChE,EACC,CAAA;AAER;AA6BA,MAAaA,UAAQ,WAAuC,SAASA,QACnE,EACE,YACA,UACA,WACA,OACA,WAAW,OACX,QAAQ,cACR,SAAS,cAAc,OACvB,MACA,SACA,UACA,wBACA,gBACA,GAAG,SAEL,KACA;CACA,MAAM,EAAE,QAAQ,eAAe,WAAW,eAAe;CACzD,MAAM,YAAY,OAAO,WAAW,QAAQ,KAAA;CAC5C,MAAM,SACJ,iBAAiB,KAAA,IAAY,gBAAgB,SAAS,IAAI,gBAAgB,YAAY;CACxF,MAAM,UAAU,eAAe,OAAO,SAAS;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AAW,YAAY;CAChE,MAAM,UAAU,YAAY,aAAa,MAAM;CAE/C,IAAI,CAAC,aAAa;EAChB,IAAI,YAAY,KAAA,KAAa,YAAY,QAAQ,YAAY,OAC3D,OAAO;EAGT,OACE,oBAAC,KAAD;GACE,GAAI;GACC;GACL,WAAW,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;GACjD,aAAU;GACV,MAAK;aAEJ;EACA,CAAA;CAEP;CAEA,OACE,oBAACA,MAAU,OAAX;EACE,GAAI;EACC;EACL,WAAW,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;EACjD,aAAU;EACV,OAAO,UAAU,UAAU,OAAO,KAAA;EAClC,QAAQ,oBAAC,KAAD,CAAI,CAAA;EACZ,MAAK;YAEJ;CACc,CAAA;AAErB,CAAC;AAED,SAAgB,gBAAgB;CAC9B,OAAO,WAAW,YAAY;AAChC"}
|
|
1
|
+
{"version":3,"file":"field.js","names":["FieldRoot","Field","BaseField"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n controlId: string | undefined;\n descriptionId: string | undefined;\n dirty: boolean;\n errorId: string | undefined;\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n labelId: string | undefined;\n name: string | undefined;\n pending: boolean;\n touched: boolean;\n valid: boolean | null;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n controlId: undefined,\n descriptionId: undefined,\n dirty: false,\n errorId: undefined,\n errors: [],\n insideField: false,\n invalid: false,\n labelId: undefined,\n name: undefined,\n pending: false,\n touched: false,\n valid: null,\n});\n\nfunction normalizeErrors(errors: ReactNode | ReactNode[] | undefined): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Marks the field as awaiting asynchronous validation. */\n pending?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor?: string;\n}\n\nconst FieldRoot = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n pending: pendingProp = false,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const descriptionId = `${generatedId}-description`;\n const errorId = `${generatedId}-error`;\n const [pendingValidation, setPendingValidation] = useState(false);\n const [validationErrors, setValidationErrors] = useState<ReactNode[]>([]);\n const [validationValid, setValidationValid] = useState<boolean | null>(null);\n const validationSequence = useRef(0);\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const externalErrors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const errors =\n directErrors !== undefined || formError !== undefined ? externalErrors : validationErrors;\n const invalid = invalidProp || errors.length > 0;\n const pending = pendingProp || pendingValidation;\n const wrappedValidate = useCallback<NonNullable<BaseFieldRoot.Props[\"validate\"]>>(\n (value, formValues) => {\n const sequence = ++validationSequence.current;\n if (!validate) return null;\n const result = validate(value, formValues);\n if (!result || typeof result !== \"object\" || !(\"then\" in result)) {\n const resultErrors = normalizeErrors(result);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n setPendingValidation(false);\n return result;\n }\n setValidationErrors([]);\n setValidationValid(null);\n setPendingValidation(true);\n return Promise.resolve(result)\n .then((validationResult) => {\n if (sequence !== validationSequence.current) return null;\n const resultErrors = normalizeErrors(validationResult);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n return validationResult;\n })\n .finally(() => {\n if (sequence === validationSequence.current) setPendingValidation(false);\n });\n },\n [validate],\n );\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider\n value={{\n controlId,\n descriptionId,\n dirty: dirty ?? false,\n errorId,\n errors,\n insideField: true,\n invalid,\n labelId,\n name,\n pending,\n touched: touched ?? false,\n valid: invalid ? false : validationValid,\n }}\n >\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n aria-busy={pending || undefined}\n data-dirty={dirty || undefined}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-pending={pending || undefined}\n data-slot=\"field\"\n data-touched={touched || undefined}\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n {...(validate ? { validate: wrappedValidate } : {})}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport interface FieldControlProps extends ComponentPropsWithoutRef<typeof BaseField.Control> {}\n\nexport const FieldControl = forwardRef<HTMLElement, FieldControlProps>(function FieldControl(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n \"aria-invalid\": ariaInvalid,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n id,\n ...props\n },\n ref,\n) {\n const { controlId, descriptionId, errorId, invalid, labelId, pending, insideField } =\n useContext(FieldContext);\n const describedBy =\n [ariaDescribedBy, descriptionId, invalid ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n const labelledBy = [ariaLabelledBy, labelId].filter(Boolean).join(\" \") || undefined;\n const controlProps = {\n ...props,\n \"aria-busy\": pending || undefined,\n \"aria-describedby\": describedBy,\n \"aria-errormessage\": ariaErrorMessage ?? (invalid ? errorId : undefined),\n \"aria-invalid\": ariaInvalid ?? (invalid || undefined),\n \"aria-labelledby\": labelledBy,\n className,\n \"data-pending\": pending || undefined,\n id: id ?? controlId,\n };\n if (!insideField) return <BaseField.Control {...controlProps} ref={ref} />;\n return <BaseField.Control {...controlProps} ref={ref} />;\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { controlId, insideField, invalid, labelId } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor: htmlFor ?? controlId,\n id: props.id ?? labelId,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor ?? controlId}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { descriptionId, insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n id: props.id ?? descriptionId,\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errorId, errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n\nexport const Field = Object.assign(FieldRoot, {\n Root: FieldRoot,\n Control: FieldControl,\n Label: FieldLabel,\n Description: FieldDescription,\n Error: FieldError,\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,eAAe,cAAiC;CACpD,WAAW,KAAA;CACX,eAAe,KAAA;CACf,OAAO;CACP,SAAS,KAAA;CACT,QAAQ,CAAC;CACT,aAAa;CACb,SAAS;CACT,SAAS,KAAA;CACT,MAAM,KAAA;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,C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Aa;CACb,OAAO;AACT,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Field, FieldDescription, FieldError, FieldErrorProps, FieldLabel, FieldLabelProps, FieldProps, FieldValidationMode, useFieldState } from "./field.cjs";
|
|
2
|
-
export { Field, FieldDescription, FieldError, type FieldErrorProps, FieldLabel, type FieldLabelProps, type FieldProps, type FieldValidationMode, useFieldState };
|
|
1
|
+
import { Field, FieldControl, FieldControlProps, FieldDescription, FieldError, FieldErrorProps, FieldLabel, FieldLabelProps, FieldProps, FieldValidationMode, useFieldState } from "./field.cjs";
|
|
2
|
+
export { Field, FieldControl, type FieldControlProps, FieldDescription, FieldError, type FieldErrorProps, FieldLabel, type FieldLabelProps, type FieldProps, type FieldValidationMode, useFieldState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Field, FieldDescription, FieldError, FieldErrorProps, FieldLabel, FieldLabelProps, FieldProps, FieldValidationMode, useFieldState } from "./field.js";
|
|
2
|
-
export { Field, FieldDescription, FieldError, type FieldErrorProps, FieldLabel, type FieldLabelProps, type FieldProps, type FieldValidationMode, useFieldState };
|
|
1
|
+
import { Field, FieldControl, FieldControlProps, FieldDescription, FieldError, FieldErrorProps, FieldLabel, FieldLabelProps, FieldProps, FieldValidationMode, useFieldState } from "./field.js";
|
|
2
|
+
export { Field, FieldControl, type FieldControlProps, FieldDescription, FieldError, type FieldErrorProps, FieldLabel, type FieldLabelProps, type FieldProps, type FieldValidationMode, useFieldState };
|
|
@@ -3,8 +3,9 @@ const require_list = require("../../styled-system/recipes/list.cjs");
|
|
|
3
3
|
let react = require("react");
|
|
4
4
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
5
|
//#region src/components/list/list.tsx
|
|
6
|
-
const ListRoot = (0, react.forwardRef)(function ListRoot({ children, className, gap = "md", ordered = false, variant = "plain", ...props }, ref) {
|
|
6
|
+
const ListRoot = (0, react.forwardRef)(function ListRoot({ children, className, density = "comfortable", gap = "md", ordered = false, variant = "plain", ...props }, ref) {
|
|
7
7
|
const styles = require_list.list({
|
|
8
|
+
density,
|
|
8
9
|
gap,
|
|
9
10
|
variant
|
|
10
11
|
});
|
|
@@ -13,6 +14,7 @@ const ListRoot = (0, react.forwardRef)(function ListRoot({ children, className,
|
|
|
13
14
|
ref,
|
|
14
15
|
className: require_cx.cx(styles.root, className),
|
|
15
16
|
"data-gap": gap,
|
|
17
|
+
"data-density": density,
|
|
16
18
|
"data-jaci-component": "list",
|
|
17
19
|
"data-ordered": ordered || void 0,
|
|
18
20
|
"data-slot": "list",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.cjs","names":["list","cx"],"sources":["../../../src/components/list/list.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { list } from \"../../styled-system/recipes\";\n\nexport type ListVariant = \"plain\" | \"divided\" | \"card\";\nexport type ListGap = \"none\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface ListRootProps extends Omit<ComponentPropsWithoutRef<\"ul\">, \"children\"> {\n children?: ReactNode;\n gap?: ListGap;\n ordered?: boolean;\n variant?: ListVariant;\n}\n\nexport const ListRoot = forwardRef<HTMLElement, ListRootProps>(function ListRoot(\n {
|
|
1
|
+
{"version":3,"file":"list.cjs","names":["list","cx"],"sources":["../../../src/components/list/list.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { list } from \"../../styled-system/recipes\";\n\nexport type ListVariant = \"plain\" | \"divided\" | \"card\";\nexport type ListGap = \"none\" | \"sm\" | \"md\" | \"lg\";\nexport type ListDensity = \"compact\" | \"comfortable\";\n\nexport interface ListRootProps extends Omit<ComponentPropsWithoutRef<\"ul\">, \"children\"> {\n children?: ReactNode;\n density?: ListDensity;\n gap?: ListGap;\n ordered?: boolean;\n variant?: ListVariant;\n}\n\nexport const ListRoot = forwardRef<HTMLElement, ListRootProps>(function ListRoot(\n {\n children,\n className,\n density = \"comfortable\",\n gap = \"md\",\n ordered = false,\n variant = \"plain\",\n ...props\n },\n ref,\n) {\n const styles = list({ density, gap, variant });\n const Component = ordered ? \"ol\" : \"ul\";\n\n return (\n <Component\n {...props}\n ref={ref as never}\n className={cx(styles.root, className)}\n data-gap={gap}\n data-density={density}\n data-jaci-component=\"list\"\n data-ordered={ordered || undefined}\n data-slot=\"list\"\n data-variant={variant}\n >\n {children}\n </Component>\n );\n});\n\nexport interface ListItemProps extends Omit<ComponentPropsWithoutRef<\"li\">, \"children\"> {\n children?: ReactNode;\n disabled?: boolean;\n interactive?: boolean;\n selected?: boolean;\n}\n\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(function ListItem(\n { children, className, disabled = false, interactive = false, selected = false, ...props },\n ref,\n) {\n const styles = list();\n\n return (\n <li\n {...props}\n ref={ref}\n aria-disabled={disabled || undefined}\n className={cx(styles.item, className)}\n data-disabled={disabled || undefined}\n data-interactive={interactive || undefined}\n data-selected={selected || undefined}\n data-slot=\"list-item\"\n >\n {children}\n </li>\n );\n});\n\nexport type ListItemContentProps = ComponentPropsWithoutRef<\"div\">;\nexport const ListItemContent = forwardRef<HTMLDivElement, ListItemContentProps>(\n function ListItemContent({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(list().content, className)}\n data-slot=\"list-item-content\"\n />\n );\n },\n);\n\nexport type ListItemTitleProps = ComponentPropsWithoutRef<\"span\">;\nexport const ListItemTitle = forwardRef<HTMLSpanElement, ListItemTitleProps>(function ListItemTitle(\n { className, ...props },\n ref,\n) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(list().title, className)}\n data-slot=\"list-item-title\"\n />\n );\n});\n\nexport type ListItemDescriptionProps = ComponentPropsWithoutRef<\"span\">;\nexport const ListItemDescription = forwardRef<HTMLSpanElement, ListItemDescriptionProps>(\n function ListItemDescription({ className, ...props }, ref) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(list().description, className)}\n data-slot=\"list-item-description\"\n />\n );\n },\n);\n\nexport type ListItemActionProps = ComponentPropsWithoutRef<\"div\">;\nexport const ListItemAction = forwardRef<HTMLDivElement, ListItemActionProps>(\n function ListItemAction({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(list().action, className)}\n data-slot=\"list-item-action\"\n />\n );\n },\n);\n\nexport const List = {\n Root: ListRoot,\n Item: ListItem,\n ItemContent: ListItemContent,\n ItemTitle: ListItemTitle,\n ItemDescription: ListItemDescription,\n ItemAction: ListItemAction,\n};\n"],"mappings":";;;;;AAkBA,MAAa,YAAA,GAAA,MAAA,WAAA,CAAkD,SAAS,SACtE,EACE,UACA,WACA,UAAU,eACV,MAAM,MACN,UAAU,OACV,UAAU,SACV,GAAG,SAEL,KACA;CACA,MAAM,SAASA,aAAAA,KAAK;EAAE;EAAS;EAAK;CAAQ,CAAC;CAG7C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAHgB,UAAU,OAAO,MAGjC;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,YAAU;EACV,gBAAc;EACd,uBAAoB;EACpB,gBAAc,WAAW,KAAA;EACzB,aAAU;EACV,gBAAc;EAEb;CACQ,CAAA;AAEf,CAAC;AASD,MAAa,YAAA,GAAA,MAAA,WAAA,CAAoD,SAAS,SACxE,EAAE,UAAU,WAAW,WAAW,OAAO,cAAc,OAAO,WAAW,OAAO,GAAG,SACnF,KACA;CACA,MAAM,SAASD,aAAAA,KAAK;CAEpB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;EACE,GAAI;EACC;EACL,iBAAe,YAAY,KAAA;EAC3B,WAAWC,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,iBAAe,YAAY,KAAA;EAC3B,oBAAkB,eAAe,KAAA;EACjC,iBAAe,YAAY,KAAA;EAC3B,aAAU;EAET;CACC,CAAA;AAER,CAAC;AAGD,MAAa,mBAAA,GAAA,MAAA,WAAA,CACX,SAAS,gBAAgB,EAAE,WAAW,GAAG,SAAS,KAAK;CACrD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAWA,WAAAA,GAAGD,aAAAA,KAAK,CAAC,CAAC,SAAS,SAAS;EACvC,aAAU;CACX,CAAA;AAEL,CACF;AAGA,MAAa,iBAAA,GAAA,MAAA,WAAA,CAAgE,SAAS,cACpF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGD,aAAAA,KAAK,CAAC,CAAC,OAAO,SAAS;EACrC,aAAU;CACX,CAAA;AAEL,CAAC;AAGD,MAAa,uBAAA,GAAA,MAAA,WAAA,CACX,SAAS,oBAAoB,EAAE,WAAW,GAAG,SAAS,KAAK;CACzD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGD,aAAAA,KAAK,CAAC,CAAC,aAAa,SAAS;EAC3C,aAAU;CACX,CAAA;AAEL,CACF;AAGA,MAAa,kBAAA,GAAA,MAAA,WAAA,CACX,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGD,aAAAA,KAAK,CAAC,CAAC,QAAQ,SAAS;EACtC,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,OAAO;CAClB,MAAM;CACN,MAAM;CACN,aAAa;CACb,WAAW;CACX,iBAAiB;CACjB,YAAY;AACd"}
|
|
@@ -2,8 +2,10 @@ import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
|
2
2
|
//#region src/components/list/list.d.ts
|
|
3
3
|
type ListVariant = "plain" | "divided" | "card";
|
|
4
4
|
type ListGap = "none" | "sm" | "md" | "lg";
|
|
5
|
+
type ListDensity = "compact" | "comfortable";
|
|
5
6
|
interface ListRootProps extends Omit<ComponentPropsWithoutRef<"ul">, "children"> {
|
|
6
7
|
children?: ReactNode;
|
|
8
|
+
density?: ListDensity;
|
|
7
9
|
gap?: ListGap;
|
|
8
10
|
ordered?: boolean;
|
|
9
11
|
variant?: ListVariant;
|
|
@@ -33,5 +35,5 @@ declare const List: {
|
|
|
33
35
|
ItemAction: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
36
|
};
|
|
35
37
|
//#endregion
|
|
36
|
-
export { List, ListGap, ListItem, ListItemAction, ListItemActionProps, ListItemContent, ListItemContentProps, ListItemDescription, ListItemDescriptionProps, ListItemProps, ListItemTitle, ListItemTitleProps, ListRoot, ListRootProps, ListVariant };
|
|
38
|
+
export { List, ListDensity, ListGap, ListItem, ListItemAction, ListItemActionProps, ListItemContent, ListItemContentProps, ListItemDescription, ListItemDescriptionProps, ListItemProps, ListItemTitle, ListItemTitleProps, ListRoot, ListRootProps, ListVariant };
|
|
37
39
|
//# sourceMappingURL=list.d.cts.map
|
|
@@ -2,8 +2,10 @@ import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
|
2
2
|
//#region src/components/list/list.d.ts
|
|
3
3
|
type ListVariant = "plain" | "divided" | "card";
|
|
4
4
|
type ListGap = "none" | "sm" | "md" | "lg";
|
|
5
|
+
type ListDensity = "compact" | "comfortable";
|
|
5
6
|
interface ListRootProps extends Omit<ComponentPropsWithoutRef<"ul">, "children"> {
|
|
6
7
|
children?: ReactNode;
|
|
8
|
+
density?: ListDensity;
|
|
7
9
|
gap?: ListGap;
|
|
8
10
|
ordered?: boolean;
|
|
9
11
|
variant?: ListVariant;
|
|
@@ -33,5 +35,5 @@ declare const List: {
|
|
|
33
35
|
ItemAction: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
36
|
};
|
|
35
37
|
//#endregion
|
|
36
|
-
export { List, ListGap, ListItem, ListItemAction, ListItemActionProps, ListItemContent, ListItemContentProps, ListItemDescription, ListItemDescriptionProps, ListItemProps, ListItemTitle, ListItemTitleProps, ListRoot, ListRootProps, ListVariant };
|
|
38
|
+
export { List, ListDensity, ListGap, ListItem, ListItemAction, ListItemActionProps, ListItemContent, ListItemContentProps, ListItemDescription, ListItemDescriptionProps, ListItemProps, ListItemTitle, ListItemTitleProps, ListRoot, ListRootProps, ListVariant };
|
|
37
39
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -3,8 +3,9 @@ import { list } from "../../styled-system/recipes/list.js";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/list/list.tsx
|
|
6
|
-
const ListRoot = forwardRef(function ListRoot({ children, className, gap = "md", ordered = false, variant = "plain", ...props }, ref) {
|
|
6
|
+
const ListRoot = forwardRef(function ListRoot({ children, className, density = "comfortable", gap = "md", ordered = false, variant = "plain", ...props }, ref) {
|
|
7
7
|
const styles = list({
|
|
8
|
+
density,
|
|
8
9
|
gap,
|
|
9
10
|
variant
|
|
10
11
|
});
|
|
@@ -13,6 +14,7 @@ const ListRoot = forwardRef(function ListRoot({ children, className, gap = "md",
|
|
|
13
14
|
ref,
|
|
14
15
|
className: cx(styles.root, className),
|
|
15
16
|
"data-gap": gap,
|
|
17
|
+
"data-density": density,
|
|
16
18
|
"data-jaci-component": "list",
|
|
17
19
|
"data-ordered": ordered || void 0,
|
|
18
20
|
"data-slot": "list",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","names":[],"sources":["../../../src/components/list/list.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { list } from \"../../styled-system/recipes\";\n\nexport type ListVariant = \"plain\" | \"divided\" | \"card\";\nexport type ListGap = \"none\" | \"sm\" | \"md\" | \"lg\";\n\nexport interface ListRootProps extends Omit<ComponentPropsWithoutRef<\"ul\">, \"children\"> {\n children?: ReactNode;\n gap?: ListGap;\n ordered?: boolean;\n variant?: ListVariant;\n}\n\nexport const ListRoot = forwardRef<HTMLElement, ListRootProps>(function ListRoot(\n {
|
|
1
|
+
{"version":3,"file":"list.js","names":[],"sources":["../../../src/components/list/list.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { list } from \"../../styled-system/recipes\";\n\nexport type ListVariant = \"plain\" | \"divided\" | \"card\";\nexport type ListGap = \"none\" | \"sm\" | \"md\" | \"lg\";\nexport type ListDensity = \"compact\" | \"comfortable\";\n\nexport interface ListRootProps extends Omit<ComponentPropsWithoutRef<\"ul\">, \"children\"> {\n children?: ReactNode;\n density?: ListDensity;\n gap?: ListGap;\n ordered?: boolean;\n variant?: ListVariant;\n}\n\nexport const ListRoot = forwardRef<HTMLElement, ListRootProps>(function ListRoot(\n {\n children,\n className,\n density = \"comfortable\",\n gap = \"md\",\n ordered = false,\n variant = \"plain\",\n ...props\n },\n ref,\n) {\n const styles = list({ density, gap, variant });\n const Component = ordered ? \"ol\" : \"ul\";\n\n return (\n <Component\n {...props}\n ref={ref as never}\n className={cx(styles.root, className)}\n data-gap={gap}\n data-density={density}\n data-jaci-component=\"list\"\n data-ordered={ordered || undefined}\n data-slot=\"list\"\n data-variant={variant}\n >\n {children}\n </Component>\n );\n});\n\nexport interface ListItemProps extends Omit<ComponentPropsWithoutRef<\"li\">, \"children\"> {\n children?: ReactNode;\n disabled?: boolean;\n interactive?: boolean;\n selected?: boolean;\n}\n\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(function ListItem(\n { children, className, disabled = false, interactive = false, selected = false, ...props },\n ref,\n) {\n const styles = list();\n\n return (\n <li\n {...props}\n ref={ref}\n aria-disabled={disabled || undefined}\n className={cx(styles.item, className)}\n data-disabled={disabled || undefined}\n data-interactive={interactive || undefined}\n data-selected={selected || undefined}\n data-slot=\"list-item\"\n >\n {children}\n </li>\n );\n});\n\nexport type ListItemContentProps = ComponentPropsWithoutRef<\"div\">;\nexport const ListItemContent = forwardRef<HTMLDivElement, ListItemContentProps>(\n function ListItemContent({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(list().content, className)}\n data-slot=\"list-item-content\"\n />\n );\n },\n);\n\nexport type ListItemTitleProps = ComponentPropsWithoutRef<\"span\">;\nexport const ListItemTitle = forwardRef<HTMLSpanElement, ListItemTitleProps>(function ListItemTitle(\n { className, ...props },\n ref,\n) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(list().title, className)}\n data-slot=\"list-item-title\"\n />\n );\n});\n\nexport type ListItemDescriptionProps = ComponentPropsWithoutRef<\"span\">;\nexport const ListItemDescription = forwardRef<HTMLSpanElement, ListItemDescriptionProps>(\n function ListItemDescription({ className, ...props }, ref) {\n return (\n <span\n {...props}\n ref={ref}\n className={cx(list().description, className)}\n data-slot=\"list-item-description\"\n />\n );\n },\n);\n\nexport type ListItemActionProps = ComponentPropsWithoutRef<\"div\">;\nexport const ListItemAction = forwardRef<HTMLDivElement, ListItemActionProps>(\n function ListItemAction({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(list().action, className)}\n data-slot=\"list-item-action\"\n />\n );\n },\n);\n\nexport const List = {\n Root: ListRoot,\n Item: ListItem,\n ItemContent: ListItemContent,\n ItemTitle: ListItemTitle,\n ItemDescription: ListItemDescription,\n ItemAction: ListItemAction,\n};\n"],"mappings":";;;;;AAkBA,MAAa,WAAW,WAAuC,SAAS,SACtE,EACE,UACA,WACA,UAAU,eACV,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F;AAGA,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,KAAK,CAAC,CAAC,QAAQ,SAAS;EACtC,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,OAAO;CAClB,MAAM;CACN,MAAM;CACN,aAAa;CACb,WAAW;CACX,iBAAiB;CACjB,YAAY;AACd"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Pagination, PaginationEllipsis, PaginationEllipsisProps, PaginationItem, PaginationItemProps, PaginationLink, PaginationLinkProps, PaginationList, PaginationListProps, PaginationNext, PaginationNextProps, PaginationPrevious, PaginationPreviousProps, PaginationRoot, PaginationRootProps } from "./pagination.cjs";
|
|
2
|
-
export { Pagination, PaginationEllipsis, type PaginationEllipsisProps, PaginationItem, type PaginationItemProps, PaginationLink, type PaginationLinkProps, PaginationList, type PaginationListProps, PaginationNext, type PaginationNextProps, PaginationPrevious, type PaginationPreviousProps, PaginationRoot, type PaginationRootProps };
|
|
1
|
+
import { Pagination, PaginationDensity, PaginationEllipsis, PaginationEllipsisProps, PaginationFirst, PaginationFirstProps, PaginationItem, PaginationItemProps, PaginationLast, PaginationLastProps, PaginationLink, PaginationLinkProps, PaginationList, PaginationListProps, PaginationNext, PaginationNextProps, PaginationPrevious, PaginationPreviousProps, PaginationRoot, PaginationRootProps } from "./pagination.cjs";
|
|
2
|
+
export { Pagination, type PaginationDensity, PaginationEllipsis, type PaginationEllipsisProps, PaginationFirst, type PaginationFirstProps, PaginationItem, type PaginationItemProps, PaginationLast, type PaginationLastProps, PaginationLink, type PaginationLinkProps, PaginationList, type PaginationListProps, PaginationNext, type PaginationNextProps, PaginationPrevious, type PaginationPreviousProps, PaginationRoot, type PaginationRootProps };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Pagination, PaginationEllipsis, PaginationEllipsisProps, PaginationItem, PaginationItemProps, PaginationLink, PaginationLinkProps, PaginationList, PaginationListProps, PaginationNext, PaginationNextProps, PaginationPrevious, PaginationPreviousProps, PaginationRoot, PaginationRootProps } from "./pagination.js";
|
|
2
|
-
export { Pagination, PaginationEllipsis, type PaginationEllipsisProps, PaginationItem, type PaginationItemProps, PaginationLink, type PaginationLinkProps, PaginationList, type PaginationListProps, PaginationNext, type PaginationNextProps, PaginationPrevious, type PaginationPreviousProps, PaginationRoot, type PaginationRootProps };
|
|
1
|
+
import { Pagination, PaginationDensity, PaginationEllipsis, PaginationEllipsisProps, PaginationFirst, PaginationFirstProps, PaginationItem, PaginationItemProps, PaginationLast, PaginationLastProps, PaginationLink, PaginationLinkProps, PaginationList, PaginationListProps, PaginationNext, PaginationNextProps, PaginationPrevious, PaginationPreviousProps, PaginationRoot, PaginationRootProps } from "./pagination.js";
|
|
2
|
+
export { Pagination, type PaginationDensity, PaginationEllipsis, type PaginationEllipsisProps, PaginationFirst, type PaginationFirstProps, PaginationItem, type PaginationItemProps, PaginationLast, type PaginationLastProps, PaginationLink, type PaginationLinkProps, PaginationList, type PaginationListProps, PaginationNext, type PaginationNextProps, PaginationPrevious, type PaginationPreviousProps, PaginationRoot, type PaginationRootProps };
|
|
@@ -1,29 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
const require_cx = require("../../styled-system/css/cx.cjs");
|
|
2
3
|
const require_pagination = require("../../styled-system/recipes/pagination.cjs");
|
|
3
4
|
let react = require("react");
|
|
4
5
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
6
|
//#region src/components/pagination/pagination.tsx
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
const PaginationContext = (0, react.createContext)(null);
|
|
8
|
+
function usePaginationContext() {
|
|
9
|
+
return (0, react.useContext)(PaginationContext);
|
|
10
|
+
}
|
|
11
|
+
const PaginationRoot = (0, react.forwardRef)(function PaginationRoot({ children, "aria-label": ariaLabel, className, defaultPage = 1, density = "comfortable", onPageChange, page: controlledPage, pageCount, showFirstLast = false, siblingCount = 1, ...props }, ref) {
|
|
12
|
+
const [uncontrolledPage, setUncontrolledPage] = (0, react.useState)(defaultPage);
|
|
13
|
+
const page = pageCount ? Math.min(Math.max(controlledPage ?? uncontrolledPage, 1), pageCount) : controlledPage;
|
|
14
|
+
const goTo = (0, react.useCallback)((nextPage) => {
|
|
15
|
+
if (!pageCount) return;
|
|
16
|
+
const next = Math.min(Math.max(nextPage, 1), pageCount);
|
|
17
|
+
if (controlledPage === void 0) setUncontrolledPage(next);
|
|
18
|
+
onPageChange?.(next);
|
|
19
|
+
}, [
|
|
20
|
+
controlledPage,
|
|
21
|
+
onPageChange,
|
|
22
|
+
pageCount
|
|
23
|
+
]);
|
|
24
|
+
const context = (0, react.useMemo)(() => ({
|
|
25
|
+
density,
|
|
26
|
+
goTo,
|
|
27
|
+
page,
|
|
28
|
+
pageCount
|
|
29
|
+
}), [
|
|
30
|
+
density,
|
|
31
|
+
goTo,
|
|
32
|
+
page,
|
|
33
|
+
pageCount
|
|
34
|
+
]);
|
|
35
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationContext.Provider, {
|
|
36
|
+
value: context,
|
|
37
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
38
|
+
...props,
|
|
39
|
+
"aria-label": ariaLabel ?? "Pagination",
|
|
40
|
+
ref,
|
|
41
|
+
className: require_cx.cx(require_pagination.pagination({ density }).root, className),
|
|
42
|
+
"data-density": density,
|
|
43
|
+
"data-jaci-component": "pagination",
|
|
44
|
+
"data-slot": "pagination",
|
|
45
|
+
children: children ?? (pageCount ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationGenerated, {
|
|
46
|
+
page: page ?? 1,
|
|
47
|
+
pageCount,
|
|
48
|
+
showFirstLast,
|
|
49
|
+
siblingCount
|
|
50
|
+
}) : null)
|
|
51
|
+
})
|
|
15
52
|
});
|
|
16
53
|
});
|
|
17
|
-
/** An unordered list of page controls. */
|
|
18
54
|
const PaginationList = (0, react.forwardRef)(function PaginationList({ className, ...props }, ref) {
|
|
55
|
+
const context = usePaginationContext();
|
|
19
56
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
20
57
|
...props,
|
|
21
58
|
ref,
|
|
22
|
-
className: require_cx.cx(require_pagination.pagination().list, className),
|
|
59
|
+
className: require_cx.cx(require_pagination.pagination({ density: context?.density }).list, className),
|
|
23
60
|
"data-slot": "pagination-list"
|
|
24
61
|
});
|
|
25
62
|
});
|
|
26
|
-
/** A list item that wraps a page link, direction control, or ellipsis. */
|
|
27
63
|
const PaginationItem = (0, react.forwardRef)(function PaginationItem({ className, ...props }, ref) {
|
|
28
64
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
29
65
|
...props,
|
|
@@ -32,24 +68,31 @@ const PaginationItem = (0, react.forwardRef)(function PaginationItem({ className
|
|
|
32
68
|
"data-slot": "pagination-item"
|
|
33
69
|
});
|
|
34
70
|
});
|
|
35
|
-
function getAnchorClassName(active, disabled, slot) {
|
|
71
|
+
function getAnchorClassName(active, disabled, density, slot) {
|
|
36
72
|
const styles = require_pagination.pagination({
|
|
37
73
|
active,
|
|
74
|
+
density,
|
|
38
75
|
disabled
|
|
39
76
|
});
|
|
40
77
|
if (slot === "pagination-previous") return require_cx.cx(styles.link, styles.previous);
|
|
41
78
|
if (slot === "pagination-next") return require_cx.cx(styles.link, styles.next);
|
|
79
|
+
if (slot === "pagination-first") return require_cx.cx(styles.link, styles.first);
|
|
80
|
+
if (slot === "pagination-last") return require_cx.cx(styles.link, styles.last);
|
|
42
81
|
return styles.link;
|
|
43
82
|
}
|
|
44
|
-
const PaginationAnchor = (0, react.forwardRef)(function PaginationAnchor({ active
|
|
83
|
+
const PaginationAnchor = (0, react.forwardRef)(function PaginationAnchor({ active: activeProp, "aria-current": ariaCurrent, className, disabled: disabledProp = false, href, onClick, page, slot, tabIndex, ...props }, ref) {
|
|
84
|
+
const context = usePaginationContext();
|
|
85
|
+
const active = activeProp ?? (page !== void 0 && context?.page === page);
|
|
86
|
+
const disabled = Boolean(disabledProp || page !== void 0 && context?.pageCount === 1);
|
|
45
87
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
46
88
|
...props,
|
|
47
89
|
"aria-current": ariaCurrent ?? (active ? "page" : void 0),
|
|
48
90
|
"aria-disabled": disabled || void 0,
|
|
49
91
|
ref,
|
|
50
|
-
className: require_cx.cx(getAnchorClassName(active, disabled, slot), className),
|
|
92
|
+
className: require_cx.cx(getAnchorClassName(Boolean(active), disabled, context?.density, slot), className),
|
|
51
93
|
"data-active": active || void 0,
|
|
52
94
|
"data-disabled": disabled || void 0,
|
|
95
|
+
"data-page": page,
|
|
53
96
|
"data-slot": slot,
|
|
54
97
|
href: disabled ? void 0 : href,
|
|
55
98
|
onClick: (event) => {
|
|
@@ -58,12 +101,15 @@ const PaginationAnchor = (0, react.forwardRef)(function PaginationAnchor({ activ
|
|
|
58
101
|
event.stopPropagation();
|
|
59
102
|
return;
|
|
60
103
|
}
|
|
104
|
+
if (page !== void 0 && context?.pageCount) {
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
context.goTo(page);
|
|
107
|
+
}
|
|
61
108
|
onClick?.(event);
|
|
62
109
|
},
|
|
63
110
|
tabIndex: disabled ? -1 : tabIndex
|
|
64
111
|
});
|
|
65
112
|
});
|
|
66
|
-
/** A link to a numbered page. Set `active` on the current destination. */
|
|
67
113
|
const PaginationLink = (0, react.forwardRef)(function PaginationLink(props, ref) {
|
|
68
114
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationAnchor, {
|
|
69
115
|
...props,
|
|
@@ -71,11 +117,14 @@ const PaginationLink = (0, react.forwardRef)(function PaginationLink(props, ref)
|
|
|
71
117
|
slot: "pagination-link"
|
|
72
118
|
});
|
|
73
119
|
});
|
|
74
|
-
|
|
75
|
-
const
|
|
120
|
+
const PaginationPrevious = (0, react.forwardRef)(function PaginationPrevious({ "aria-label": ariaLabel, children, page, rel, ...props }, ref) {
|
|
121
|
+
const context = usePaginationContext();
|
|
122
|
+
const targetPage = page ?? (context?.page ? context.page - 1 : void 0);
|
|
76
123
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationAnchor, {
|
|
77
124
|
...props,
|
|
78
125
|
"aria-label": ariaLabel ?? "Go to previous page",
|
|
126
|
+
disabled: props.disabled ?? (targetPage !== void 0 && targetPage < 1),
|
|
127
|
+
page: targetPage,
|
|
79
128
|
ref,
|
|
80
129
|
rel: rel ?? "prev",
|
|
81
130
|
slot: "pagination-previous",
|
|
@@ -85,11 +134,14 @@ const PaginationPrevious = (0, react.forwardRef)(function PaginationPrevious({ "
|
|
|
85
134
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Previous" })] })
|
|
86
135
|
});
|
|
87
136
|
});
|
|
88
|
-
|
|
89
|
-
const
|
|
137
|
+
const PaginationNext = (0, react.forwardRef)(function PaginationNext({ "aria-label": ariaLabel, children, page, rel, ...props }, ref) {
|
|
138
|
+
const context = usePaginationContext();
|
|
139
|
+
const targetPage = page ?? (context?.page ? context.page + 1 : void 0);
|
|
90
140
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationAnchor, {
|
|
91
141
|
...props,
|
|
92
142
|
"aria-label": ariaLabel ?? "Go to next page",
|
|
143
|
+
disabled: props.disabled ?? (targetPage !== void 0 && targetPage > (context?.pageCount ?? Infinity)),
|
|
144
|
+
page: targetPage,
|
|
93
145
|
ref,
|
|
94
146
|
rel: rel ?? "next",
|
|
95
147
|
slot: "pagination-next",
|
|
@@ -99,7 +151,27 @@ const PaginationNext = (0, react.forwardRef)(function PaginationNext({ "aria-lab
|
|
|
99
151
|
})] })
|
|
100
152
|
});
|
|
101
153
|
});
|
|
102
|
-
|
|
154
|
+
const PaginationFirst = (0, react.forwardRef)(function PaginationFirst({ "aria-label": ariaLabel, children, page, ...props }, ref) {
|
|
155
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationAnchor, {
|
|
156
|
+
...props,
|
|
157
|
+
"aria-label": ariaLabel ?? "Go to first page",
|
|
158
|
+
page: page ?? 1,
|
|
159
|
+
ref,
|
|
160
|
+
slot: "pagination-first",
|
|
161
|
+
children: children ?? "First"
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
const PaginationLast = (0, react.forwardRef)(function PaginationLast({ "aria-label": ariaLabel, children, page, ...props }, ref) {
|
|
165
|
+
const context = usePaginationContext();
|
|
166
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationAnchor, {
|
|
167
|
+
...props,
|
|
168
|
+
"aria-label": ariaLabel ?? "Go to last page",
|
|
169
|
+
page: page ?? context?.pageCount,
|
|
170
|
+
ref,
|
|
171
|
+
slot: "pagination-last",
|
|
172
|
+
children: children ?? "Last"
|
|
173
|
+
});
|
|
174
|
+
});
|
|
103
175
|
const PaginationEllipsis = (0, react.forwardRef)(function PaginationEllipsis({ children = "…", className, ...props }, ref) {
|
|
104
176
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
105
177
|
...props,
|
|
@@ -110,19 +182,48 @@ const PaginationEllipsis = (0, react.forwardRef)(function PaginationEllipsis({ c
|
|
|
110
182
|
children
|
|
111
183
|
});
|
|
112
184
|
});
|
|
185
|
+
function getPageItems(page, pageCount, siblingCount) {
|
|
186
|
+
const visible = /* @__PURE__ */ new Set([1, pageCount]);
|
|
187
|
+
for (let index = page - siblingCount; index <= page + siblingCount; index += 1) if (index > 0 && index <= pageCount) visible.add(index);
|
|
188
|
+
const pages = [...visible].sort((left, right) => left - right);
|
|
189
|
+
const items = [];
|
|
190
|
+
pages.forEach((value, index) => {
|
|
191
|
+
const previous = pages[index - 1];
|
|
192
|
+
if (previous !== void 0 && value - previous > 1) items.push("ellipsis");
|
|
193
|
+
items.push(value);
|
|
194
|
+
});
|
|
195
|
+
return items;
|
|
196
|
+
}
|
|
197
|
+
function PaginationGenerated({ page, pageCount, showFirstLast, siblingCount }) {
|
|
198
|
+
const pageItems = getPageItems(page, pageCount, siblingCount);
|
|
199
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PaginationList, { children: [
|
|
200
|
+
showFirstLast ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationFirst, { disabled: page <= 1 }) }) : null,
|
|
201
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationPrevious, { disabled: page <= 1 }) }),
|
|
202
|
+
pageItems.map((item, index) => item === "ellipsis" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationEllipsis, {}) }, `ellipsis-${pageItems.slice(0, index).filter((value) => value === "ellipsis").length + 1}`) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationLink, {
|
|
203
|
+
page: item,
|
|
204
|
+
children: item
|
|
205
|
+
}) }, item)),
|
|
206
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationNext, { disabled: page >= pageCount }) }),
|
|
207
|
+
showFirstLast ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationLast, { disabled: page >= pageCount }) }) : null
|
|
208
|
+
] });
|
|
209
|
+
}
|
|
113
210
|
const Pagination = {
|
|
114
211
|
Root: PaginationRoot,
|
|
115
212
|
List: PaginationList,
|
|
116
213
|
Item: PaginationItem,
|
|
117
214
|
Link: PaginationLink,
|
|
215
|
+
First: PaginationFirst,
|
|
118
216
|
Previous: PaginationPrevious,
|
|
119
217
|
Next: PaginationNext,
|
|
218
|
+
Last: PaginationLast,
|
|
120
219
|
Ellipsis: PaginationEllipsis
|
|
121
220
|
};
|
|
122
221
|
//#endregion
|
|
123
222
|
exports.Pagination = Pagination;
|
|
124
223
|
exports.PaginationEllipsis = PaginationEllipsis;
|
|
224
|
+
exports.PaginationFirst = PaginationFirst;
|
|
125
225
|
exports.PaginationItem = PaginationItem;
|
|
226
|
+
exports.PaginationLast = PaginationLast;
|
|
126
227
|
exports.PaginationLink = PaginationLink;
|
|
127
228
|
exports.PaginationList = PaginationList;
|
|
128
229
|
exports.PaginationNext = PaginationNext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.cjs","names":["cx","pagination"],"sources":["../../../src/components/pagination/pagination.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { pagination } from \"../../styled-system/recipes\";\n\nexport type PaginationRootProps = ComponentPropsWithoutRef<\"nav\">;\n\n/** A navigation landmark for moving between pages of a result set. */\nexport const PaginationRoot = forwardRef<HTMLElement, PaginationRootProps>(function PaginationRoot(\n { \"aria-label\": ariaLabel, className, ...props },\n ref,\n) {\n return (\n <nav\n {...props}\n aria-label={ariaLabel ?? \"Pagination\"}\n ref={ref}\n className={cx(pagination().root, className)}\n data-jaci-component=\"pagination\"\n data-slot=\"pagination\"\n />\n );\n});\n\nexport type PaginationListProps = ComponentPropsWithoutRef<\"ul\">;\n\n/** An unordered list of page controls. */\nexport const PaginationList = forwardRef<HTMLUListElement, PaginationListProps>(\n function PaginationList({ className, ...props }, ref) {\n return (\n <ul\n {...props}\n ref={ref}\n className={cx(pagination().list, className)}\n data-slot=\"pagination-list\"\n />\n );\n },\n);\n\nexport type PaginationItemProps = ComponentPropsWithoutRef<\"li\">;\n\n/** A list item that wraps a page link, direction control, or ellipsis. */\nexport const PaginationItem = forwardRef<HTMLLIElement, PaginationItemProps>(\n function PaginationItem({ className, ...props }, ref) {\n return (\n <li\n {...props}\n ref={ref}\n className={cx(pagination().item, className)}\n data-slot=\"pagination-item\"\n />\n );\n },\n);\n\nexport interface PaginationLinkProps extends ComponentPropsWithoutRef<\"a\"> {\n /** Marks the link as the current page. */\n active?: boolean;\n /** Presents a non-navigable control when no destination is available. */\n disabled?: boolean;\n}\n\ntype PaginationAnchorSlot = \"pagination-link\" | \"pagination-previous\" | \"pagination-next\";\n\ninterface PaginationAnchorProps extends PaginationLinkProps {\n children?: ReactNode;\n slot: PaginationAnchorSlot;\n}\n\nfunction getAnchorClassName(active: boolean, disabled: boolean, slot: PaginationAnchorSlot) {\n const styles = pagination({ active, disabled });\n\n if (slot === \"pagination-previous\") {\n return cx(styles.link, styles.previous);\n }\n\n if (slot === \"pagination-next\") {\n return cx(styles.link, styles.next);\n }\n\n return styles.link;\n}\n\nconst PaginationAnchor = forwardRef<HTMLAnchorElement, PaginationAnchorProps>(\n function PaginationAnchor(\n {\n active = false,\n \"aria-current\": ariaCurrent,\n className,\n disabled = false,\n href,\n onClick,\n slot,\n tabIndex,\n ...props\n },\n ref,\n ) {\n return (\n <a\n {...props}\n aria-current={ariaCurrent ?? (active ? \"page\" : undefined)}\n aria-disabled={disabled || undefined}\n ref={ref}\n className={cx(getAnchorClassName(active, disabled, slot), className)}\n data-active={active || undefined}\n data-disabled={disabled || undefined}\n data-slot={slot}\n href={disabled ? undefined : href}\n onClick={(event) => {\n if (disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n onClick?.(event);\n }}\n tabIndex={disabled ? -1 : tabIndex}\n />\n );\n },\n);\n\n/** A link to a numbered page. Set `active` on the current destination. */\nexport const PaginationLink = forwardRef<HTMLAnchorElement, PaginationLinkProps>(\n function PaginationLink(props, ref) {\n return <PaginationAnchor {...props} ref={ref} slot=\"pagination-link\" />;\n },\n);\n\nexport interface PaginationPreviousProps extends PaginationLinkProps {\n children?: ReactNode;\n}\n\n/** A directional link to the preceding page. */\nexport const PaginationPrevious = forwardRef<HTMLAnchorElement, PaginationPreviousProps>(\n function PaginationPrevious({ \"aria-label\": ariaLabel, children, rel, ...props }, ref) {\n return (\n <PaginationAnchor\n {...props}\n aria-label={ariaLabel ?? \"Go to previous page\"}\n ref={ref}\n rel={rel ?? \"prev\"}\n slot=\"pagination-previous\"\n >\n {children ?? (\n <>\n <span aria-hidden=\"true\">‹</span>\n <span>Previous</span>\n </>\n )}\n </PaginationAnchor>\n );\n },\n);\n\nexport interface PaginationNextProps extends PaginationLinkProps {\n children?: ReactNode;\n}\n\n/** A directional link to the following page. */\nexport const PaginationNext = forwardRef<HTMLAnchorElement, PaginationNextProps>(\n function PaginationNext({ \"aria-label\": ariaLabel, children, rel, ...props }, ref) {\n return (\n <PaginationAnchor\n {...props}\n aria-label={ariaLabel ?? \"Go to next page\"}\n ref={ref}\n rel={rel ?? \"next\"}\n slot=\"pagination-next\"\n >\n {children ?? (\n <>\n <span>Next</span>\n <span aria-hidden=\"true\">›</span>\n </>\n )}\n </PaginationAnchor>\n );\n },\n);\n\nexport type PaginationEllipsisProps = ComponentPropsWithoutRef<\"span\">;\n\n/** A non-interactive marker for omitted page ranges. */\nexport const PaginationEllipsis = forwardRef<HTMLSpanElement, PaginationEllipsisProps>(\n function PaginationEllipsis({ children = \"…\", className, ...props }, ref) {\n return (\n <span\n {...props}\n aria-hidden=\"true\"\n ref={ref}\n className={cx(pagination().ellipsis, className)}\n data-slot=\"pagination-ellipsis\"\n >\n {children}\n </span>\n );\n },\n);\n\nexport const Pagination = {\n Root: PaginationRoot,\n List: PaginationList,\n Item: PaginationItem,\n Link: PaginationLink,\n Previous: PaginationPrevious,\n Next: PaginationNext,\n Ellipsis: PaginationEllipsis,\n};\n"],"mappings":";;;;;;AASA,MAAa,kBAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,eAClF,EAAE,cAAc,WAAW,WAAW,GAAG,SAC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AA,kBAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAA,UAAM,OAAU,CAAA,GAChB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,eAAY;aAAO;EAAO,CAAA,CAChC,EAAA,CAAA;CAEY,CAAA;AAEtB,CACF;;AAKA,MAAa,sBAAA,GAAA,MAAA,WAAA,CACX,SAAS,mBAAmB,EAAE,WAAW,KAAK,WAAW,GAAG,SAAS,KAAK;CACxE,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,GAAI;EACJ,eAAY;EACP;EACL,WAAWA,WAAAA,GAAGC,mBAAAA,WAAW,CAAC,CAAC,UAAU,SAAS;EAC9C,aAAU;EAET;CACG,CAAA;AAEV,CACF;AAEA,MAAa,aAAa;CACxB,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,UAAU;CACV,MAAM;CACN,UAAU;AACZ"}
|
|
1
|
+
{"version":3,"file":"pagination.cjs","names":["cx","pagination"],"sources":["../../../src/components/pagination/pagination.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, forwardRef, useCallback, useContext, useMemo, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { pagination } from \"../../styled-system/recipes\";\n\nexport type PaginationDensity = \"compact\" | \"comfortable\";\n\ninterface PaginationContextValue {\n density: PaginationDensity;\n goTo: (page: number) => void;\n page: number | undefined;\n pageCount: number | undefined;\n}\n\nconst PaginationContext = createContext<PaginationContextValue | null>(null);\n\nfunction usePaginationContext() {\n return useContext(PaginationContext);\n}\n\nexport interface PaginationRootProps extends Omit<ComponentPropsWithoutRef<\"nav\">, \"children\"> {\n children?: ReactNode;\n defaultPage?: number;\n density?: PaginationDensity;\n onPageChange?: (page: number) => void;\n page?: number;\n pageCount?: number;\n showFirstLast?: boolean;\n siblingCount?: number;\n}\n\nexport const PaginationRoot = forwardRef<HTMLElement, PaginationRootProps>(function PaginationRoot(\n {\n children,\n \"aria-label\": ariaLabel,\n className,\n defaultPage = 1,\n density = \"comfortable\",\n onPageChange,\n page: controlledPage,\n pageCount,\n showFirstLast = false,\n siblingCount = 1,\n ...props\n },\n ref,\n) {\n const [uncontrolledPage, setUncontrolledPage] = useState(defaultPage);\n const page = pageCount\n ? Math.min(Math.max(controlledPage ?? uncontrolledPage, 1), pageCount)\n : controlledPage;\n const goTo = useCallback(\n (nextPage: number) => {\n if (!pageCount) return;\n const next = Math.min(Math.max(nextPage, 1), pageCount);\n if (controlledPage === undefined) setUncontrolledPage(next);\n onPageChange?.(next);\n },\n [controlledPage, onPageChange, pageCount],\n );\n const context = useMemo(\n () => ({ density, goTo, page, pageCount }),\n [density, goTo, page, pageCount],\n );\n\n return (\n <PaginationContext.Provider value={context}>\n <nav\n {...props}\n aria-label={ariaLabel ?? \"Pagination\"}\n ref={ref}\n className={cx(pagination({ density }).root, className)}\n data-density={density}\n data-jaci-component=\"pagination\"\n data-slot=\"pagination\"\n >\n {children ??\n (pageCount ? (\n <PaginationGenerated\n page={page ?? 1}\n pageCount={pageCount}\n showFirstLast={showFirstLast}\n siblingCount={siblingCount}\n />\n ) : null)}\n </nav>\n </PaginationContext.Provider>\n );\n});\n\nexport type PaginationListProps = ComponentPropsWithoutRef<\"ul\">;\nexport const PaginationList = forwardRef<HTMLUListElement, PaginationListProps>(\n function PaginationList({ className, ...props }, ref) {\n const context = usePaginationContext();\n return (\n <ul\n {...props}\n ref={ref}\n className={cx(pagination({ density: context?.density }).list, className)}\n data-slot=\"pagination-list\"\n />\n );\n },\n);\n\nexport type PaginationItemProps = ComponentPropsWithoutRef<\"li\">;\nexport const PaginationItem = forwardRef<HTMLLIElement, PaginationItemProps>(\n function PaginationItem({ className, ...props }, ref) {\n return (\n <li\n {...props}\n ref={ref}\n className={cx(pagination().item, className)}\n data-slot=\"pagination-item\"\n />\n );\n },\n);\n\nexport interface PaginationLinkProps extends ComponentPropsWithoutRef<\"a\"> {\n active?: boolean;\n disabled?: boolean;\n page?: number | undefined;\n}\n\ntype PaginationAnchorSlot =\n | \"pagination-link\"\n | \"pagination-first\"\n | \"pagination-last\"\n | \"pagination-previous\"\n | \"pagination-next\";\n\ninterface PaginationAnchorProps extends PaginationLinkProps {\n slot: PaginationAnchorSlot;\n}\n\nfunction getAnchorClassName(\n active: boolean,\n disabled: boolean,\n density: PaginationDensity | undefined,\n slot: PaginationAnchorSlot,\n) {\n const styles = pagination({ active, density, disabled });\n if (slot === \"pagination-previous\") return cx(styles.link, styles.previous);\n if (slot === \"pagination-next\") return cx(styles.link, styles.next);\n if (slot === \"pagination-first\") return cx(styles.link, styles.first);\n if (slot === \"pagination-last\") return cx(styles.link, styles.last);\n return styles.link;\n}\n\nconst PaginationAnchor = forwardRef<HTMLAnchorElement, PaginationAnchorProps>(\n function PaginationAnchor(\n {\n active: activeProp,\n \"aria-current\": ariaCurrent,\n className,\n disabled: disabledProp = false,\n href,\n onClick,\n page,\n slot,\n tabIndex,\n ...props\n },\n ref,\n ) {\n const context = usePaginationContext();\n const active = activeProp ?? (page !== undefined && context?.page === page);\n const disabled = Boolean(disabledProp || (page !== undefined && context?.pageCount === 1));\n return (\n <a\n {...props}\n aria-current={ariaCurrent ?? (active ? \"page\" : undefined)}\n aria-disabled={disabled || undefined}\n ref={ref}\n className={cx(\n getAnchorClassName(Boolean(active), disabled, context?.density, slot),\n className,\n )}\n data-active={active || undefined}\n data-disabled={disabled || undefined}\n data-page={page}\n data-slot={slot}\n href={disabled ? undefined : href}\n onClick={(event) => {\n if (disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n if (page !== undefined && context?.pageCount) {\n event.preventDefault();\n context.goTo(page);\n }\n onClick?.(event);\n }}\n tabIndex={disabled ? -1 : tabIndex}\n />\n );\n },\n);\n\nexport const PaginationLink = forwardRef<HTMLAnchorElement, PaginationLinkProps>(\n function PaginationLink(props, ref) {\n return <PaginationAnchor {...props} ref={ref} slot=\"pagination-link\" />;\n },\n);\n\nexport interface PaginationPreviousProps extends PaginationLinkProps {\n children?: ReactNode;\n}\nexport const PaginationPrevious = forwardRef<HTMLAnchorElement, PaginationPreviousProps>(\n function PaginationPrevious({ \"aria-label\": ariaLabel, children, page, rel, ...props }, ref) {\n const context = usePaginationContext();\n const targetPage = page ?? (context?.page ? context.page - 1 : undefined);\n return (\n <PaginationAnchor\n {...props}\n aria-label={ariaLabel ?? \"Go to previous page\"}\n disabled={props.disabled ?? (targetPage !== undefined && targetPage < 1)}\n page={targetPage}\n ref={ref}\n rel={rel ?? \"prev\"}\n slot=\"pagination-previous\"\n >\n {children ?? (\n <>\n <span aria-hidden=\"true\">‹</span>\n <span>Previous</span>\n </>\n )}\n </PaginationAnchor>\n );\n },\n);\n\nexport interface PaginationNextProps extends PaginationLinkProps {\n children?: ReactNode;\n}\nexport const PaginationNext = forwardRef<HTMLAnchorElement, PaginationNextProps>(\n function PaginationNext({ \"aria-label\": ariaLabel, children, page, rel, ...props }, ref) {\n const context = usePaginationContext();\n const targetPage = page ?? (context?.page ? context.page + 1 : undefined);\n return (\n <PaginationAnchor\n {...props}\n aria-label={ariaLabel ?? \"Go to next page\"}\n disabled={\n props.disabled ??\n (targetPage !== undefined && targetPage > (context?.pageCount ?? Infinity))\n }\n page={targetPage}\n ref={ref}\n rel={rel ?? \"next\"}\n slot=\"pagination-next\"\n >\n {children ?? (\n <>\n <span>Next</span>\n <span aria-hidden=\"true\">›</span>\n </>\n )}\n </PaginationAnchor>\n );\n },\n);\n\nexport interface PaginationFirstProps extends PaginationLinkProps {\n children?: ReactNode;\n}\nexport const PaginationFirst = forwardRef<HTMLAnchorElement, PaginationFirstProps>(\n function PaginationFirst({ \"aria-label\": ariaLabel, children, page, ...props }, ref) {\n return (\n <PaginationAnchor\n {...props}\n aria-label={ariaLabel ?? \"Go to first page\"}\n page={page ?? 1}\n ref={ref}\n slot=\"pagination-first\"\n >\n {children ?? \"First\"}\n </PaginationAnchor>\n );\n },\n);\n\nexport interface PaginationLastProps extends PaginationLinkProps {\n children?: ReactNode;\n}\nexport const PaginationLast = forwardRef<HTMLAnchorElement, PaginationLastProps>(\n function PaginationLast({ \"aria-label\": ariaLabel, children, page, ...props }, ref) {\n const context = usePaginationContext();\n return (\n <PaginationAnchor\n {...props}\n aria-label={ariaLabel ?? \"Go to last page\"}\n page={page ?? context?.pageCount}\n ref={ref}\n slot=\"pagination-last\"\n >\n {children ?? \"Last\"}\n </PaginationAnchor>\n );\n },\n);\n\nexport type PaginationEllipsisProps = ComponentPropsWithoutRef<\"span\">;\nexport const PaginationEllipsis = forwardRef<HTMLSpanElement, PaginationEllipsisProps>(\n function PaginationEllipsis({ children = \"…\", className, ...props }, ref) {\n return (\n <span\n {...props}\n aria-hidden=\"true\"\n ref={ref}\n className={cx(pagination().ellipsis, className)}\n data-slot=\"pagination-ellipsis\"\n >\n {children}\n </span>\n );\n },\n);\n\ntype PaginationPageItem = number | \"ellipsis\";\n\nfunction getPageItems(page: number, pageCount: number, siblingCount: number): PaginationPageItem[] {\n const visible = new Set<number>([1, pageCount]);\n for (let index = page - siblingCount; index <= page + siblingCount; index += 1) {\n if (index > 0 && index <= pageCount) visible.add(index);\n }\n const pages = [...visible].sort((left, right) => left - right);\n const items: PaginationPageItem[] = [];\n pages.forEach((value, index) => {\n const previous = pages[index - 1];\n if (previous !== undefined && value - previous > 1) items.push(\"ellipsis\");\n items.push(value);\n });\n return items;\n}\n\nfunction PaginationGenerated({\n page,\n pageCount,\n showFirstLast,\n siblingCount,\n}: {\n page: number;\n pageCount: number;\n showFirstLast: boolean;\n siblingCount: number;\n}) {\n const pageItems = getPageItems(page, pageCount, siblingCount);\n return (\n <PaginationList>\n {showFirstLast ? (\n <PaginationItem>\n <PaginationFirst disabled={page <= 1} />\n </PaginationItem>\n ) : null}\n <PaginationItem>\n <PaginationPrevious disabled={page <= 1} />\n </PaginationItem>\n {pageItems.map((item, index) =>\n item === \"ellipsis\" ? (\n <PaginationItem\n key={`ellipsis-${pageItems.slice(0, index).filter((value) => value === \"ellipsis\").length + 1}`}\n >\n <PaginationEllipsis />\n </PaginationItem>\n ) : (\n <PaginationItem key={item}>\n <PaginationLink page={item}>{item}</PaginationLink>\n </PaginationItem>\n ),\n )}\n <PaginationItem>\n <PaginationNext disabled={page >= pageCount} />\n </PaginationItem>\n {showFirstLast ? (\n <PaginationItem>\n <PaginationLast disabled={page >= pageCount} />\n </PaginationItem>\n ) : null}\n </PaginationList>\n );\n}\n\nexport const Pagination = {\n Root: PaginationRoot,\n List: PaginationList,\n Item: PaginationItem,\n Link: PaginationLink,\n First: PaginationFirst,\n Previous: PaginationPrevious,\n Next: PaginationNext,\n Last: PaginationLast,\n Ellipsis: PaginationEllipsis,\n};\n"],"mappings":";;;;;;AAiBA,MAAM,qBAAA,GAAA,MAAA,cAAA,CAAiE,IAAI;AAE3E,SAAS,uBAAuB;CAC9B,QAAA,GAAA,MAAA,WAAA,CAAkB,iBAAiB;AACrC;AAaA,MAAa,kBAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,eAClF,EACE,UACA,cAAc,WACd,WACA,cAAc,GACd,UAAU,eACV,cACA,MAAM,gBACN,WACA,gBAAgB,OAChB,eAAe,GACf,GAAG,SAEL,KACA;CACA,MAAM,CAAC,kBAAkB,wBAAA,GAAA,MAAA,SAAA,CAAgC,WAAW;CACpE,MAAM,OAAO,YACT,KAAK,IAAI,KAAK,IAAI,kBAAkB,kBAAkB,CAAC,GAAG,SAAS,IACnE;CACJ,MAAM,QAAA,GAAA,MAAA,YAAA,EACH,aAAqB;EACpB,IAAI,CAAC,WAAW;EAChB,MAAM,OAAO,KAAK,IAAI,KAAK,IAAI,UAAU,CAAC,GAAG,SAAS;EACtD,IAAI,mBAAmB,KAAA,GAAW,oBAAoB,IAAI;EAC1D,eAAe,IAAI;CACrB,GACA;EAAC;EAAgB;EAAc;CAAS,CAC1C;CACA,MAAM,WAAA,GAAA,MAAA,QAAA,QACG;EAAE;EAAS;EAAM;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