@nixxie-cms/fields-rating 1.0.1 → 2.0.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 ADDED
@@ -0,0 +1,15 @@
1
+ # @nixxie-cms/fields-rating
2
+
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 450043a:
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [0fe028d]
12
+ - Updated dependencies [690e433]
13
+ - Updated dependencies [2c0d28c]
14
+ - Updated dependencies [450043a]
15
+ - @nixxie-cms/core@2.0.0
@@ -1,6 +1,6 @@
1
1
  import type { IntegerFieldConfig } from '@nixxie-cms/core/fields';
2
- import type { BaseListTypeInfo, FieldTypeFunc } from '@nixxie-cms/core/types';
3
- export type RatingFieldConfig<ListTypeInfo extends BaseListTypeInfo> = Omit<IntegerFieldConfig<ListTypeInfo>, 'validation' | 'defaultValue'> & {
2
+ import type { BaseCollectionTypeInfo, FieldTypeFunc } from '@nixxie-cms/core/types';
3
+ export type RatingFieldConfig<CollectionTypeInfo extends BaseCollectionTypeInfo> = Omit<IntegerFieldConfig<CollectionTypeInfo>, 'validation' | 'defaultValue'> & {
4
4
  /** Highest allowed rating. Default: 5 */
5
5
  max?: number;
6
6
  /** Lowest allowed rating. Default: 0 */
@@ -13,5 +13,5 @@ export type RatingFieldConfig<ListTypeInfo extends BaseListTypeInfo> = Omit<Inte
13
13
  /**
14
14
  * A rating field (e.g. 0–5 stars). Built on the core `integer` field with a constrained range.
15
15
  */
16
- export declare function rating<ListTypeInfo extends BaseListTypeInfo>(config?: RatingFieldConfig<ListTypeInfo>): FieldTypeFunc<ListTypeInfo>;
16
+ export declare function rating<CollectionTypeInfo extends BaseCollectionTypeInfo>(config?: RatingFieldConfig<CollectionTypeInfo>): FieldTypeFunc<CollectionTypeInfo>;
17
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"../../../src","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE7E,MAAM,MAAM,iBAAiB,CAAC,YAAY,SAAS,gBAAgB,IAAI,IAAI,CACzE,kBAAkB,CAAC,YAAY,CAAC,EAChC,YAAY,GAAG,cAAc,CAC9B,GAAG;IACF,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,UAAU,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CACtC,CAAA;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,YAAY,SAAS,gBAAgB,EAC1D,MAAM,GAAE,iBAAiB,CAAC,YAAY,CAAM,GAC3C,aAAa,CAAC,YAAY,CAAC,CAS7B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"../../../src","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEnF,MAAM,MAAM,iBAAiB,CAAC,kBAAkB,SAAS,sBAAsB,IAAI,IAAI,CACrF,kBAAkB,CAAC,kBAAkB,CAAC,EACtC,YAAY,GAAG,cAAc,CAC9B,GAAG;IACF,yCAAyC;IACzC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,UAAU,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CACtC,CAAA;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,kBAAkB,SAAS,sBAAsB,EACtE,MAAM,GAAE,iBAAiB,CAAC,kBAAkB,CAAM,GACjD,aAAa,CAAC,kBAAkB,CAAC,CASnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nixxie-cms/fields-rating",
3
- "version": "1.0.1",
3
+ "version": "2.0.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/nixxie-cms-fields-rating.cjs.js",
6
6
  "module": "dist/nixxie-cms-fields-rating.esm.js",
@@ -16,10 +16,10 @@
16
16
  "@babel/runtime": "^7.24.7"
17
17
  },
18
18
  "devDependencies": {
19
- "@nixxie-cms/core": "^1.0.1"
19
+ "@nixxie-cms/core": "^2.0.0"
20
20
  },
21
21
  "peerDependencies": {
22
- "@nixxie-cms/core": "^1.0.1"
22
+ "@nixxie-cms/core": "^2.0.0"
23
23
  },
24
24
  "preconstruct": {
25
25
  "entrypoints": [
package/src/index.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { integer } from '@nixxie-cms/core/fields'
2
2
  import type { IntegerFieldConfig } from '@nixxie-cms/core/fields'
3
- import type { BaseListTypeInfo, FieldTypeFunc } from '@nixxie-cms/core/types'
3
+ import type { BaseCollectionTypeInfo, FieldTypeFunc } from '@nixxie-cms/core/types'
4
4
 
5
- export type RatingFieldConfig<ListTypeInfo extends BaseListTypeInfo> = Omit<
6
- IntegerFieldConfig<ListTypeInfo>,
5
+ export type RatingFieldConfig<CollectionTypeInfo extends BaseCollectionTypeInfo> = Omit<
6
+ IntegerFieldConfig<CollectionTypeInfo>,
7
7
  'validation' | 'defaultValue'
8
8
  > & {
9
9
  /** Highest allowed rating. Default: 5 */
@@ -17,13 +17,13 @@ export type RatingFieldConfig<ListTypeInfo extends BaseListTypeInfo> = Omit<
17
17
  /**
18
18
  * A rating field (e.g. 0–5 stars). Built on the core `integer` field with a constrained range.
19
19
  */
20
- export function rating<ListTypeInfo extends BaseListTypeInfo>(
21
- config: RatingFieldConfig<ListTypeInfo> = {}
22
- ): FieldTypeFunc<ListTypeInfo> {
20
+ export function rating<CollectionTypeInfo extends BaseCollectionTypeInfo>(
21
+ config: RatingFieldConfig<CollectionTypeInfo> = {}
22
+ ): FieldTypeFunc<CollectionTypeInfo> {
23
23
  const { max = 5, min = 0, defaultValue, validation, ...rest } = config
24
24
 
25
- return integer<ListTypeInfo>({
26
- ...(rest as IntegerFieldConfig<ListTypeInfo>),
25
+ return integer<CollectionTypeInfo>({
26
+ ...(rest as IntegerFieldConfig<CollectionTypeInfo>),
27
27
  defaultValue: defaultValue ?? null,
28
28
  validation: { isRequired: validation?.isRequired, min, max },
29
29
  ui: { description: `A rating from ${min} to ${max}`, ...rest.ui },