Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zag-js/rating-group

Package Overview
Dependencies
Maintainers
0
Versions
793
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/rating-group - npm Package Compare versions

Comparing version 0.70.0 to 0.71.0

130

dist/index.js

@@ -1,46 +0,15 @@

"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
'use strict';
// src/index.ts
var src_exports = {};
__export(src_exports, {
anatomy: () => anatomy,
connect: () => connect,
itemProps: () => itemProps,
machine: () => machine,
props: () => props,
splitItemProps: () => splitItemProps,
splitProps: () => splitProps
});
module.exports = __toCommonJS(src_exports);
var anatomy$1 = require('@zag-js/anatomy');
var domEvent = require('@zag-js/dom-event');
var domQuery = require('@zag-js/dom-query');
var formUtils = require('@zag-js/form-utils');
var core = require('@zag-js/core');
var utils = require('@zag-js/utils');
var types = require('@zag-js/types');
// src/rating-group.anatomy.ts
var import_anatomy = require("@zag-js/anatomy");
var anatomy = (0, import_anatomy.createAnatomy)("rating-group").parts("root", "label", "item", "control");
var anatomy = anatomy$1.createAnatomy("rating-group").parts("root", "label", "item", "control");
var parts = anatomy.build();
// src/rating-group.connect.ts
var import_dom_event = require("@zag-js/dom-event");
var import_dom_query2 = require("@zag-js/dom-query");
// src/rating-group.dom.ts
var import_dom_query = require("@zag-js/dom-query");
var import_form_utils = require("@zag-js/form-utils");
var dom = (0, import_dom_query.createScope)({
var dom = domQuery.createScope({
getRootId: (ctx) => ctx.ids?.root ?? `rating:${ctx.id}`,

@@ -55,3 +24,3 @@ getLabelId: (ctx) => ctx.ids?.label ?? `rating:${ctx.id}:label`,

const selector = `[role=radio][aria-posinset='${Math.ceil(value)}']`;
return (0, import_dom_query.query)(dom.getControlEl(ctx), selector);
return domQuery.query(dom.getControlEl(ctx), selector);
},

@@ -62,3 +31,3 @@ getHiddenInputEl: (ctx) => dom.getById(ctx, dom.getHiddenInputId(ctx)),

if (!inputEl) return;
(0, import_form_utils.dispatchInputValueEvent)(inputEl, { value: ctx.value });
formUtils.dispatchInputValueEvent(inputEl, { value: ctx.value });
}

@@ -122,3 +91,3 @@ });

id: dom.getLabelId(state.context),
"data-disabled": (0, import_dom_query2.dataAttr)(disabled),
"data-disabled": domQuery.dataAttr(disabled),
htmlFor: dom.getHiddenInputId(state.context),

@@ -142,6 +111,6 @@ onClick(event) {

"aria-labelledby": dom.getLabelId(state.context),
"aria-readonly": (0, import_dom_query2.ariaAttr)(state.context.readOnly),
"data-readonly": (0, import_dom_query2.dataAttr)(state.context.readOnly),
"aria-readonly": domQuery.ariaAttr(state.context.readOnly),
"data-readonly": domQuery.dataAttr(state.context.readOnly),
tabIndex: state.context.readOnly ? 0 : -1,
"data-disabled": (0, import_dom_query2.dataAttr)(disabled),
"data-disabled": domQuery.dataAttr(disabled),
onPointerMove(event) {

@@ -173,13 +142,13 @@ if (!interactive) return;

"aria-disabled": disabled,
"data-disabled": (0, import_dom_query2.dataAttr)(disabled),
"data-readonly": (0, import_dom_query2.dataAttr)(state.context.readOnly),
"data-disabled": domQuery.dataAttr(disabled),
"data-readonly": domQuery.dataAttr(state.context.readOnly),
"aria-setsize": state.context.count,
"aria-checked": itemState.checked,
"data-checked": (0, import_dom_query2.dataAttr)(itemState.checked),
"data-checked": domQuery.dataAttr(itemState.checked),
"aria-posinset": index,
"data-highlighted": (0, import_dom_query2.dataAttr)(itemState.highlighted),
"data-half": (0, import_dom_query2.dataAttr)(itemState.half),
"data-highlighted": domQuery.dataAttr(itemState.highlighted),
"data-half": domQuery.dataAttr(itemState.half),
onPointerDown(event) {
if (!interactive) return;
if (!(0, import_dom_event.isLeftClick)(event)) return;
if (!domEvent.isLeftClick(event)) return;
event.preventDefault();

@@ -189,4 +158,4 @@ },

if (!interactive) return;
const point = (0, import_dom_event.getEventPoint)(event);
const relativePoint = (0, import_dom_event.getRelativePoint)(point, event.currentTarget);
const point = domEvent.getEventPoint(event);
const relativePoint = domEvent.getRelativePoint(point, event.currentTarget);
const percentX = relativePoint.getPercentValue({

@@ -225,3 +194,3 @@ orientation: "horizontal",

};
const key = (0, import_dom_event.getEventKey)(event, state.context);
const key = domEvent.getEventKey(event, state.context);
const exec = keyMap[key];

@@ -249,11 +218,5 @@ if (exec) {

}
// src/rating-group.machine.ts
var import_core = require("@zag-js/core");
var import_dom_query3 = require("@zag-js/dom-query");
var import_form_utils2 = require("@zag-js/form-utils");
var import_utils = require("@zag-js/utils");
function machine(userContext) {
const ctx = (0, import_utils.compact)(userContext);
return (0, import_core.createMachine)(
const ctx = utils.compact(userContext);
return core.createMachine(
{

@@ -368,3 +331,3 @@ id: "rating",

trackFormControlState(ctx2, _evt, { initialContext }) {
return (0, import_form_utils2.trackFormControl)(dom.getHiddenInputEl(ctx2), {
return formUtils.trackFormControl(dom.getHiddenInputEl(ctx2), {
onFieldsetDisabledChange(disabled) {

@@ -384,3 +347,3 @@ ctx2.fieldsetDisabled = disabled;

focusActiveRadio(ctx2) {
(0, import_dom_query3.raf)(() => dom.getRadioEl(ctx2)?.focus());
domQuery.raf(() => dom.getRadioEl(ctx2)?.focus());
},

@@ -433,3 +396,3 @@ setPrevValue(ctx2) {

value: (ctx, value) => {
if ((0, import_utils.isEqual)(ctx.value, value)) return;
if (utils.isEqual(ctx.value, value)) return;
ctx.value = value;

@@ -439,3 +402,3 @@ invoke.change(ctx);

hoveredValue: (ctx, value) => {
if ((0, import_utils.isEqual)(ctx.hoveredValue, value)) return;
if (utils.isEqual(ctx.hoveredValue, value)) return;
ctx.hoveredValue = value;

@@ -445,7 +408,3 @@ invoke.hoverChange(ctx);

};
// src/rating-group.props.ts
var import_types = require("@zag-js/types");
var import_utils2 = require("@zag-js/utils");
var props = (0, import_types.createProps)()([
var props = types.createProps()([
"allowHalf",

@@ -468,15 +427,12 @@ "autoFocus",

]);
var splitProps = (0, import_utils2.createSplitProps)(props);
var itemProps = (0, import_types.createProps)()(["index"]);
var splitItemProps = (0, import_utils2.createSplitProps)(itemProps);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
anatomy,
connect,
itemProps,
machine,
props,
splitItemProps,
splitProps
});
//# sourceMappingURL=index.js.map
var splitProps = utils.createSplitProps(props);
var itemProps = types.createProps()(["index"]);
var splitItemProps = utils.createSplitProps(itemProps);
exports.anatomy = anatomy;
exports.connect = connect;
exports.itemProps = itemProps;
exports.machine = machine;
exports.props = props;
exports.splitItemProps = splitItemProps;
exports.splitProps = splitProps;
{
"name": "@zag-js/rating-group",
"version": "0.70.0",
"version": "0.71.0",
"description": "Core logic for the rating-group widget implemented as a state machine",

@@ -21,4 +21,3 @@ "keywords": [

"files": [
"dist",
"src"
"dist"
],

@@ -32,9 +31,9 @@ "publishConfig": {

"dependencies": {
"@zag-js/anatomy": "0.70.0",
"@zag-js/dom-query": "0.70.0",
"@zag-js/dom-event": "0.70.0",
"@zag-js/form-utils": "0.70.0",
"@zag-js/core": "0.70.0",
"@zag-js/utils": "0.70.0",
"@zag-js/types": "0.70.0"
"@zag-js/dom-event": "0.71.0",
"@zag-js/anatomy": "0.71.0",
"@zag-js/dom-query": "0.71.0",
"@zag-js/form-utils": "0.71.0",
"@zag-js/utils": "0.71.0",
"@zag-js/core": "0.71.0",
"@zag-js/types": "0.71.0"
},

@@ -41,0 +40,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc